当前位置: 首页>>代码示例>>Python>>正文


Python collector.Collector类代码示例

本文整理汇总了Python中collector.Collector的典型用法代码示例。如果您正苦于以下问题:Python Collector类的具体用法?Python Collector怎么用?Python Collector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Collector类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_enhances_caller

    def test_enhances_caller(self):
        assembly = """
00000098 <pbl_table_addr>:
        8e4:	f000 f824 	bl	930 <app_log>

00000930 <app_log>:
$t():
        """
        c = Collector()
        self.assertEqual(2, c.parse_assembly_text(assembly))
        self.assertTrue(c.symbols.has_key(0x00000098))
        self.assertTrue(c.symbols.has_key(0x00000930))

        pbl_table_addr = c.symbols[0x00000098]
        app_log = c.symbols[0x00000930]

        self.assertFalse(pbl_table_addr.has_key("callers"))
        self.assertFalse(pbl_table_addr.has_key("callees"))
        self.assertFalse(app_log.has_key("callers"))
        self.assertFalse(app_log.has_key("callees"))

        c.enhance_call_tree()

        self.assertEqual(pbl_table_addr["callers"], [])
        self.assertEqual(pbl_table_addr["callees"], [app_log])
        self.assertEqual(app_log["callers"], [pbl_table_addr])
        self.assertEqual(app_log["callees"], [])
开发者ID:kevincon,项目名称:puncover,代码行数:27,代码来源:collector_tests.py

示例2: main

def main():
    query_terms=['#NBAFinals2015', '#Warriors']
    # We only need a single mongodb sink; FilteringFacet will just let us
    # avoid storing non-matching tweets
    sink = MongoDBSink('db_restT')
    sink.open('tweets')
    # closing ensures any files written get flushed/closed.
    with closing(
            FilteringFacet(
                RegexMatcher('(' + '|'.join(query_terms) + ')'),
                lambda key: sink)) as facet:
        creds = Credentials(os.path.expanduser('~/.tweepy'))
        auth = tweepy.AppAuthHandler(creds.consumer_key, creds.consumer_secret)
        collector = Collector(auth, facet)
        
        today = datetime.date.today()
        week = datetime.timedelta(7)

        query_ops={}
        query_ops['lang'] = 'en'
        query_ops['result_type'] = 'mixed'
        
        print("Starting search")
        collector.search(query_terms=query_terms,
                         query_ops=query_ops)
        print('All done!  Last ID processed={0}'.format(collector.last_id))
开发者ID:nkrishnaswami,项目名称:mids-w205-hw3,代码行数:26,代码来源:1.1_acq.py

示例3: make_app

def make_app():
    """Instantiates Flask app, attaches collector database, installs acl."""
    LOG.info('Starting API')
    app = flask.Flask(__name__)
    app.register_blueprint(v1.blueprint, url_prefix='/v1')

    collector = Collector()
    collector.clean()

    thread.start_new_thread(listen, (collector.add,))

    @app.before_request
    def attach_config():
        flask.request.collector = collector
        collector.lock.acquire()

    @app.after_request
    def unlock(response):
        collector.lock.release()
        return response

    # Install the middleware wrapper
    if cfg.CONF.acl_enabled:
        acl.install(app, cfg.CONF)

    return app
开发者ID:openstack,项目名称:kwapi,代码行数:26,代码来源:app.py

示例4: main

def main():
    creds = Credentials(os.path.expanduser('~/.tweepy'))
    today = datetime.date.today()
    week = datetime.timedelta(7)
    query_terms=['#NBAFinals2015', '#Warriors'] 
    query_ops={}
    query_ops['lang'] = 'en'
    stream = False;
    if stream:
        auth = tweepy.OAuthHandler(creds.consumer_key, creds.consumer_secret)
        auth.set_access_token(creds.access_token, creds.access_token_secret)
        query_ops['until'] = today+week
    else:
        #Per Ron Cordell's suggestion, use App Auth token for increased limits
        auth = tweepy.AppAuthHandler(creds.consumer_key, creds.consumer_secret)
        query_ops['since'] = today-week
        query_ops['until'] = today
        query_ops['result_type'] = 'recent'
    collector = Collector(auth)
    if stream:
        print("Starting streaming")
        collector.stream(query_terms=query_terms,
                  query_ops=query_ops)
    else:
        print("Starting search")
        collector.search(query_terms=query_terms,
                  query_ops=query_ops)
    print('All done!  Last ID processed={0}'.format(collector.last_id))
开发者ID:nkrishnaswami,项目名称:mids-w205-hw2,代码行数:28,代码来源:acq.py

示例5: test_enhance_sibling_symbols

    def test_enhance_sibling_symbols(self):
        c = Collector()
        aeabi_drsub = {
            collector.ADDRESS: "0000009c",
            collector.SIZE: 8,
            collector.TYPE: collector.TYPE_FUNCTION,
        }
        aeabi_dsub = {
            collector.ADDRESS: "000000a4",
            collector.SIZE: 4,
            collector.TYPE: collector.TYPE_FUNCTION,
        }
        adddf3 = {
            collector.ADDRESS: "000000a8",
            collector.SIZE: 123,
            collector.TYPE: collector.TYPE_FUNCTION,
        }

        c.symbols = {int(f[collector.ADDRESS], 16): f for f in [aeabi_drsub, aeabi_dsub, adddf3]}
        c.enhance_sibling_symbols()

        self.assertFalse(aeabi_drsub.has_key(collector.PREV_FUNCTION))
        self.assertEqual(aeabi_dsub, aeabi_drsub.get(collector.NEXT_FUNCTION))

        self.assertEqual(aeabi_drsub, aeabi_dsub.get(collector.PREV_FUNCTION))
        self.assertEqual(adddf3, aeabi_dsub.get(collector.NEXT_FUNCTION))

        self.assertEqual(aeabi_dsub, adddf3.get(collector.PREV_FUNCTION))
        self.assertFalse(adddf3.has_key(collector.NEXT_FUNCTION))
开发者ID:kevincon,项目名称:puncover,代码行数:29,代码来源:collector_tests.py

示例6: test_parses_assembly_and_stops_after_function

    def test_parses_assembly_and_stops_after_function(self):
        assembly = """
000034fc <window_raw_click_subscribe>:
$t():
    34fc:	b40f      	push	{r0, r1, r2, r3}
    34fe:	4901      	ldr	r1, [pc, #4]	; (3504 <window_raw_click_subscribe+0x8>)
    3500:	f7fc bdc2 	b.w	88 <jump_to_pbl_function>
$d():
    3504:	000004c4 	.word	0x000004c4
    3508:	00040000 	.word	0x00040000
    350c:	000b008d 	.word	0x000b008d

00003510 <.LC1>:
.LC1():
    3510:	69727073 	.word	0x69727073
    3514:	42736574 	.word	0x42736574
    3518:	31647269 	.word	0x31647269
    351c:	0036      	.short	0x0036

"""

        c = Collector()
        self.assertEqual(2, c.parse_assembly_text(assembly))
        self.assertTrue(c.symbols.has_key(0x000034fc))
        self.assertEqual(c.symbols[0x000034fc]["name"], "window_raw_click_subscribe")
        # print "\n".join(c.symbols["000034fc"]["asm"])
        self.assertEqual(len(c.symbols[0x000034fc]["asm"]), 8)
开发者ID:kevincon,项目名称:puncover,代码行数:27,代码来源:collector_tests.py

示例7: test_stack_usage_line2

 def test_stack_usage_line2(self):
     line = "puncover.c:8:43:dynamic_stack2	16	dynamic"
     c = Collector()
     c.symbols = {"123": {
         "base_file": "puncover.c",
         "line": 8,
     }}
     self.assertTrue(c.parse_stack_usage_line(line))
开发者ID:kevincon,项目名称:puncover,代码行数:8,代码来源:collector_tests.py

示例8: test_stack_usage_line

 def test_stack_usage_line(self):
     line = "puncover.c:14:40:0	16	dynamic,bounded"
     c = Collector()
     c.symbols = {"123": {
         "base_file": "puncover.c",
         "line": 14,
     }}
     self.assertTrue(c.parse_stack_usage_line(line))
     self.assertEqual(16, c.symbols["123"]["stack_size"])
     self.assertEqual("dynamic,bounded", c.symbols["123"]["stack_qualifiers"])
开发者ID:kevincon,项目名称:puncover,代码行数:10,代码来源:collector_tests.py

示例9: main

def main():
    conf = parse_options()

    c = Client(conf)
    collector = Collector(c)
    start = c.get_user(conf.start_user)
    collector.collect(start)

    g = collector.graph
    nx.write_dot(g, conf.output_file)
开发者ID:thomasernste,项目名称:twitter-followers,代码行数:10,代码来源:twitter_graph_gen.py

示例10: test_derive_filename_from_assembly

    def test_derive_filename_from_assembly(self):
        c = Collector()
        c.parse_assembly_text("""
000008a8 <uses_doubles2.constprop.0>:
uses_doubles2():
/Users/behrens/Documents/projects/pebble/puncover/pebble/build/../src/puncover.c:19
 8a8:	b508      	push	{r3, lr}
         """)
        s = c.symbol_by_addr("8a8")
        self.assertEqual("/Users/behrens/Documents/projects/pebble/puncover/pebble/build/../src/puncover.c", s[collector.PATH])
        self.assertEqual("puncover.c", s[collector.BASE_FILE])
        self.assertEqual(19, s[collector.LINE])
开发者ID:kevincon,项目名称:puncover,代码行数:12,代码来源:collector_tests.py

示例11: test_parses_assembly_and_ignores_c

    def test_parses_assembly_and_ignores_c(self):
        assembly = """
00000098 <pbl_table_addr>:
/path/to.c:8
pbl_table_addr():
  98:	a8a8a8a8 	.word	0xa8a8a8a8
"""
        c = Collector()
        self.assertEqual(1, c.parse_assembly_text(assembly))
        self.assertTrue(c.symbols.has_key(0x00000098))
        self.assertEqual(c.symbols[0x00000098]["name"], "pbl_table_addr")
        self.assertEqual(len(c.symbols[0x00000098]["asm"]), 2)
        self.assertEqual(c.symbols[0x00000098]["asm"][0], "pbl_table_addr():")
开发者ID:kevincon,项目名称:puncover,代码行数:13,代码来源:collector_tests.py

示例12: test_enhances_assembly

    def test_enhances_assembly(self):
        assembly = """
00000098 <pbl_table_addr>:
pbl_table_addr():
 568:	f7ff ffca 	bl	98
"""
        c = Collector()
        self.assertEqual(1, c.parse_assembly_text(assembly))
        self.assertTrue(c.symbols.has_key(0x00000098))
        self.assertEqual(c.symbols[0x00000098]["name"], "pbl_table_addr")
        self.assertEqual(c.symbols[0x00000098]["asm"][1], " 568:\tf7ff ffca \tbl\t98")

        c.enhance_assembly()
        self.assertEqual(c.symbols[0x00000098]["asm"][1], " 568:\tf7ff ffca \tbl\t98 <pbl_table_addr>")
开发者ID:kevincon,项目名称:puncover,代码行数:14,代码来源:collector_tests.py

示例13: test_derive_file_elements_for_unknown_files

 def test_derive_file_elements_for_unknown_files(self):
     c = Collector()
     s = c.add_symbol("some_symbol", "00a")
     self.assertEqual("some_symbol", s[collector.NAME])
     self.assertNotIn(collector.PATH, s)
     self.assertNotIn(collector.BASE_FILE, s)
     c.derive_folders()
     self.assertEqual("<unknown>/<unknown>", s[collector.PATH])
     self.assertEqual("<unknown>", s[collector.BASE_FILE])
     self.assertIn(collector.FILE, s)
     file = s[collector.FILE]
     self.assertEqual("<unknown>", file[collector.NAME])
     folder = file[collector.FOLDER]
     self.assertEqual("<unknown>", file[collector.NAME])
开发者ID:kevincon,项目名称:puncover,代码行数:14,代码来源:collector_tests.py

示例14: run

 def run(self):
     while True:
          """ collection management module """
          logger.info("CollectorManager has successfuly initiated")
          collector = Collector()
          collector.create_tenants_bills()
          """ subscription management module """
          logger.info("SubscriptionManager has successfuly initiated")
          subs = SubscriptionManager()
          subs.manage_subscription()
          logger.info("SchedulingManager has successfuly initiated")
          sched = SchedulingManager()
          sched.commence()
          time.sleep(60)
开发者ID:neumerance,项目名称:deploy,代码行数:14,代码来源:daemonize.py

示例15: test_parses_assembly2

    def test_parses_assembly2(self):
        assembly = """
00000098 <pbl_table_addr.constprop.0>:
pbl_table_addr():
  98:	a8a8a8a8 	.word	0xa8a8a8a8

0000009c <__aeabi_dmul>:
__aeabi_dmul():
  9c:	b570      	push	{r4, r5, r6, lr}
"""
        c = Collector()
        self.assertEqual(2, c.parse_assembly_text(assembly))
        self.assertTrue(c.symbols.has_key(0x0000009c))
        self.assertEqual(c.symbols[0x0000009c]["name"], "__aeabi_dmul")
        self.assertTrue(c.symbols.has_key(0x00000098))
        self.assertEqual(c.symbols[0x00000098]["name"], "pbl_table_addr")
开发者ID:kevincon,项目名称:puncover,代码行数:16,代码来源:collector_tests.py


注:本文中的collector.Collector类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。