예제 #1
0
 def sonTest(do):
     name = 'son demo'
     print "this is son function; name : %s " % name
     print "local son function globals and locals "
     CollectionHelper.printEx(globals())
     print "*" * 22 + "local" + "*" * 22
     CollectionHelper.printEx(locals())
예제 #2
0
 def sonTest(do):
     name = 'son demo'
     print "this is son function; name : %s " % name
     print "local son function globals and locals "
     CollectionHelper.printEx(globals())
     print "*" * 22 + "local" + "*" * 22
     CollectionHelper.printEx(locals())
예제 #3
0
def test(name):
    info = 'hello world'

    def sonTest(do):
        name = 'son demo'
        print "this is son function; name : %s " % name
        print "local son function globals and locals "
        CollectionHelper.printEx(globals())
        print "*" * 22 + "local" + "*" * 22
        CollectionHelper.printEx(locals())

    sonTest(info)
    print "-------------- local test function globals and locals -------------- "
    CollectionHelper.printEx(globals())
    print "*" * 22 + "local" + "*" * 22
    CollectionHelper.printEx(locals())
    return None
예제 #4
0
def test(name):
    info = 'hello world'

    def sonTest(do):
        name = 'son demo'
        print "this is son function; name : %s " % name
        print "local son function globals and locals "
        CollectionHelper.printEx(globals())
        print "*" * 22 + "local" + "*" * 22
        CollectionHelper.printEx(locals())

    sonTest(info)
    print "-------------- local test function globals and locals -------------- "
    CollectionHelper.printEx(globals())
    print "*" * 22 + "local" + "*" * 22
    CollectionHelper.printEx(locals())
    return None
예제 #5
0
        fLog.write("no txns this month\n")
        fLog.close()
        return None

    fLog.write("-------------------begin--------------------\n")
    dataArr = fAccount.readlines()
    fAccount.close()

    totalAccount = 0
    for line in dataArr:
        tmpAccount = set_float(line)
        if isinstance(tmpAccount, float):
            totalAccount += tmpAccount
            fLog.write("add acount  %s \n" % tmpAccount)
        else:
            fLog.write("ingore %s \n" % tmpAccount)
    fLog.close()
    print "total money is : %.2f " % tmpAccount
    return None
checkAmount()

try:
    raise TypeError, ('has error ', 12)
    with open('../../data/amount.json.demos1', 'r') as f:
        CollectionHelper.printEx(f.readlines())
except (IOError, TypeError), e:
    print "has error %s " % str(e)

print "*" * 88
assert 1 == 2
예제 #6
0
파일: test.py 프로젝트: flybird1971/spiders
# /usr/bin/env python
# encoding:utf8

import threading
import time
from time import sleep, ctime
import sys
import os
sys.path.insert(1, os.path.realpath('..'))
from utils.CollectionHelper import CollectionHelper


print "-" * 88
CollectionHelper.printEx(sys.modules)
print CollectionHelper.getMaxDeepth()


def now():
    return str(time.strftime('%Y-%m-%d %H:%M:%S', time.localtime()))


class myThread (threading.Thread):
    """docstring for myThread"""

    def __init__(self, nloop, nsec):
        super(myThread, self).__init__()
        self.nloop = nloop
        self.nsec = nsec

    def run(self):
        print 'start loop', self.nloop, 'at:', ctime()
예제 #7
0
#!/usr/bin/env python
# encoding:utf8

import sys
import os
import feedparser
sys.path.insert(1, os.path.realpath('..'))
from utils.CollectionHelper import CollectionHelper
# from future import Future

python_wiki_rss_url = "http://www.python.org/cgi-bin/moinmoin/" \
                      "RecentChanges?action=rss_rc"

feed = feedparser.parse(python_wiki_rss_url)
print "-" * 88
CollectionHelper.printEx(feed)
print CollectionHelper.getMaxDeepth()

# hit_list = [ "http://...", "...", "..." ] # list of feeds to pull down
# pull down all feeds
# future_calls = [Future(feedparser.parse,rss_url) for rss_url in hit_list]
# block until they are all in
# feeds = [future_obj() for future_obj in future_calls]

# t = raw_input('hellow')
예제 #8
0
        print "local son function globals and locals "
        CollectionHelper.printEx(globals())
        print "*" * 22 + "local" + "*" * 22
        CollectionHelper.printEx(locals())

    sonTest(info)
    print "-------------- local test function globals and locals -------------- "
    CollectionHelper.printEx(globals())
    print "*" * 22 + "local" + "*" * 22
    CollectionHelper.printEx(locals())
    return None


test(name)
print "-------------- top globals and locals -------------- "
CollectionHelper.printEx(globals())
print "*" * 22 + "local" + "*" * 22
CollectionHelper.printEx(locals())

print "*" * 88

# import os.path as path
# print help(path)
# from os import path
# print dir(path)
t = __import__("utils.CollectionHelper", globals(), locals(),
               ['CollectionHelper'])

print help(t)
print t.__file__
예제 #9
0
파일: test.py 프로젝트: flybird1971/spiders
# /usr/bin/env python
# encoding:utf8

import threading
import time
from time import sleep, ctime
import sys
import os
sys.path.insert(1, os.path.realpath('..'))
from utils.CollectionHelper import CollectionHelper

print "-" * 88
CollectionHelper.printEx(sys.modules)
print CollectionHelper.getMaxDeepth()


def now():
    return str(time.strftime('%Y-%m-%d %H:%M:%S', time.localtime()))


class myThread(threading.Thread):
    """docstring for myThread"""
    def __init__(self, nloop, nsec):
        super(myThread, self).__init__()
        self.nloop = nloop
        self.nsec = nsec

    def run(self):
        print 'start loop', self.nloop, 'at:', ctime()
        sleep(self.nsec)
        print 'loop', self.nloop, 'done at:', ctime()
예제 #10
0
        print "this is son function; name : %s " % name
        print "local son function globals and locals "
        CollectionHelper.printEx(globals())
        print "*" * 22 + "local" + "*" * 22
        CollectionHelper.printEx(locals())

    sonTest(info)
    print "-------------- local test function globals and locals -------------- "
    CollectionHelper.printEx(globals())
    print "*" * 22 + "local" + "*" * 22
    CollectionHelper.printEx(locals())
    return None

test(name)
print "-------------- top globals and locals -------------- "
CollectionHelper.printEx(globals())
print "*" * 22 + "local" + "*" * 22
CollectionHelper.printEx(locals())

print "*" * 88

# import os.path as path
# print help(path)
# from os import path
# print dir(path)
t = __import__("utils.CollectionHelper", globals(), locals(), ['CollectionHelper'])

print help(t)
print t.__file__

예제 #11
0
        return None

    fLog.write("-------------------begin--------------------\n")
    dataArr = fAccount.readlines()
    fAccount.close()

    totalAccount = 0
    for line in dataArr:
        tmpAccount = set_float(line)
        if isinstance(tmpAccount, float):
            totalAccount += tmpAccount
            fLog.write("add acount  %s \n" % tmpAccount)
        else:
            fLog.write("ingore %s \n" % tmpAccount)
    fLog.close()
    print "total money is : %.2f " % tmpAccount
    return None


checkAmount()

try:
    raise TypeError, ('has error ', 12)
    with open('../../data/amount.json.demos1', 'r') as f:
        CollectionHelper.printEx(f.readlines())
except (IOError, TypeError), e:
    print "has error %s " % str(e)

print "*" * 88
assert 1 == 2
예제 #12
0
#!/usr/bin/env python
# encoding:utf8

import sys
import os
import feedparser
sys.path.insert(1, os.path.realpath('..'))
from utils.CollectionHelper import CollectionHelper
# from future import Future

python_wiki_rss_url = "http://www.python.org/cgi-bin/moinmoin/" \
                      "RecentChanges?action=rss_rc"

feed = feedparser.parse(python_wiki_rss_url)
print "-" * 88
CollectionHelper.printEx(feed)
print CollectionHelper.getMaxDeepth()


# hit_list = [ "http://...", "...", "..." ] # list of feeds to pull down
# pull down all feeds
# future_calls = [Future(feedparser.parse,rss_url) for rss_url in hit_list]
# block until they are all in
# feeds = [future_obj() for future_obj in future_calls]

# t = raw_input('hellow')