Did I find the right examples for you? yes no Crawl my project Python Jobs
All Samples(248669) | Call(242594) | Derive(6068) | Import(7)
list() -> new empty list list(iterable) -> new list initialized from iterable's items
src/p/y/pysam-0.7.7/tests/example.py pysam(Download)
print "###################" # check different ways to iterate print len(list(samfile.fetch())) print len(list(samfile.fetch( "chr1", 10, 200 ))) print len(list(samfile.fetch( region="chr1:10-200" ))) print len(list(samfile.fetch( "chr1" ))) print len(list(samfile.fetch( region="chr1")))
src/h/u/hunch-sample-app-HEAD/django/contrib/messages/tests/base.py hunch-sample-app(Download)
storage.add(constants.INFO, 'Test message 3') list(storage) # Simulates a read storage.update(response)
def test_existing_read_add_update(self): storage = self.get_existing_storage() response = self.get_response() list(storage) # Simulates a read
user = User.objects.create_user('test', 'test@example.com', 'test') self.client.login(username='test', password='test') settings.INSTALLED_APPS = list(settings.INSTALLED_APPS) settings.INSTALLED_APPS.remove( 'django.contrib.messages', ) settings.MIDDLEWARE_CLASSES = list(settings.MIDDLEWARE_CLASSES)
src/m/o/modern-python-example-HEAD/lib/python2.7/site-packages/logilab/astng/test/unittest_inference.py modern-python-example(Download)
a1 = astng.locals['A'][0] a2 = astng.locals['A'][1] a2_ancestors = list(a2.ancestors()) self.failUnlessEqual(len(a2_ancestors), 1) self.failUnless(a2_ancestors[0] is a1)
a1 = astng.locals['A'][0] a2 = astng.locals['A'][1] a2_ancestors = list(a2.ancestors()) self.failUnlessEqual(len(a2_ancestors), 2) self.failUnless(a2_ancestors[0] is astng.locals['B'][0])
astng = builder.string_build(code, __name__, __file__) node = get_name_node(astng, 'help', -1) infered = list(node.infer()) self.failUnlessEqual(len(infered), 1, infered) self.assertIsInstance(infered[0], Instance)
astng = builder.string_build(code, __name__, __file__) node = get_name_node(astng, 'open', -1) infered = list(node.infer()) self.failUnlessEqual(len(infered), 1) self.assertIsInstance(infered[0], nodes.Function)
''' astng = builder.string_build(code, __name__, __file__) infered = list(astng.igetattr('un')) self.failUnlessEqual(len(infered), 1) self.assertIsInstance(infered[0], nodes.Const)
src/d/j/django-admin-report-HEAD/example/lib/reportlab/platypus/tables.py django-admin-report(Download)
setattr(self,a,getattr(parent,a)) if cmds: commands = commands + list(cmds) self._cmds = commands self._opts={}
and assign some best-guess values.""" W = list(self._argW) # _calc_pc(self._argW,availWidth) verbose = 0 totalDefined = 0.0 percentDefined = 0 percentTotal = 0 numberUndefined = 0 numberGreedyUndefined = 0 for w in W:
elementWidth = self._elementWidth for colNo in xrange(self._ncols): w = W[colNo] if w is None or w=='*' or _endswith(w,'%'): siz = 1
effectiveRemaining = remaining for colNo, minimum in minimums.items(): w = W[colNo] if _endswith(w,'%'): desired = (float(w[:-1])/percentTotal)*availWidth
src/p/y/pyaaf-HEAD/example/qt_aafmodel.py pyaaf(Download)
elif isinstance(item, aaf.storage.ContentStorage): l = [] l.append(DummyItem(list(item.composition_mobs()),"CompositionMobs")) l.append(DummyItem(list(item.master_mobs()),"MasterMobs")) #l.append(DummyItem(list(item.GetSourceMobs()),"SourceMobs"))
elif isinstance(item, aaf.dictionary.Dictionary): l = [] l.append(DummyItem(list(item.class_defs()), 'ClassDefs')) l.append(DummyItem(list(item.codec_defs()), 'CodecDefs')) l.append(DummyItem(list(item.container_defs()), 'ContainerDefs'))
src/n/e/networkx-HEAD/examples/subclass/printgraph.py networkx(Download)
print(G.edges(data=True)) G.remove_edge(0,1) G.add_edges_from(list(zip(list(range(0o3)),list(range(1,4)))),weight=10) print(G.edges(data=True)) G.remove_edges_from(list(zip(list(range(0o3)),list(range(1,4)))))
src/a/d/adder-HEAD/samples/web/w.py adder(Download)
_adder__0023_003cgensym_002dscratch_0020_002350_003e=_adder_head_002d1596213198(_adder_cs_002d1588635523) _adder__0023_003cgensym_002dscratch_0020_002351_003e=_adder_head_002d1596213198(_adder__0023_003cgensym_002dscratch_0020_002350_003e) _adder__0023_003cgensym_002dscratch_0020_002352_003e=adder.common.Symbol('begin') _adder__0023_003cgensym_002dscratch_0020_002353_003e=[_adder__0023_003cgensym_002dscratch_0020_002352_003e] _adder__0023_003cgensym_002dscratch_0020_002354_003e=_adder_head_002d1596213198(_adder_cs_002d1588635523)
_adder__0023_003cgensym_002dscratch_0020_002364_003e=adder.common.Symbol('lambda') _adder__0023_003cgensym_002dscratch_0020_002365_003e=adder.common.Symbol('obj') _adder__0023_003cgensym_002dscratch_0020_002366_003e=[_adder__0023_003cgensym_002dscratch_0020_002365_003e] _adder__0023_003cgensym_002dscratch_0020_002367_003e=adder.common.Symbol('.') _adder__0023_003cgensym_002dscratch_0020_002368_003e=adder.common.Symbol('obj')
else: _adder__0023_003cgensym_002dscratch_0020_0023100_003e=adder.common.Symbol('defvar') _adder__0023_003cgensym_002dscratch_0020_0023101_003e=[_adder__0023_003cgensym_002dscratch_0020_0023100_003e, _adder_def_002d1581057848] _adder__0023_003cgensym_002dif_0020_002399_003e=_adder__0023_003cgensym_002dscratch_0020_0023101_003e return _adder__0023_003cgensym_002dif_0020_002399_003e
_adder__0023_003cgensym_002dscratch_0020_0023111_003e=_adder_head_002d1596213198(_adder_def_002d1574562698) _adder__0023_003cgensym_002dif_0020_0023112_003e=_adder__0023_003cgensym_002dscratch_0020_0023111_003e else: _adder__0023_003cgensym_002dif_0020_0023112_003e=_adder_def_002d1574562698 return _adder__0023_003cgensym_002dif_0020_0023112_003e
src/h/o/hortonworks-sandbox-HEAD/desktop/core/ext-py/processing/examples/ex_pool.py hortonworks-sandbox(Download)
t = time.time() C = list(pool.imap(pow3, xrange(N), chunksize=N//8)) print '\tlist(pool.imap(pow3, xrange(%d), chunksize=%d)):\n\t\t%s' \ ' seconds' % (N, N//8, time.time() - t) assert A == B == C, (len(A), len(B), len(C))
t = time.time() C = list(pool.imap(noop, L, chunksize=len(L)//8)) print '\tlist(pool.imap(noop, L, chunksize=%d)):\n\t\t%s seconds' % \ (len(L)//8, time.time() - t) assert A == B == C, (len(A), len(B), len(C))
src/q/s/QSTK-0.2.7/Examples/FeatureSearch/functions.py QSTK(Download)
def sequentialForwardSelection(naFeatTrain,naFeatTest,lFeatures,classLabelIndex): lSelectedFeatures = list() lRemainingFeatures = lFeatures[:] lCorrCoef = list(); while len(lRemainingFeatures) > 0:
def sequentialBackwardSelection(naFeatTrain,naFeatTest,lFeatures,classLabelIndex): lSelectedFeatures = lFeatures[:] lCorrCoef = list() lRemovedFeatures = list() while len(lSelectedFeatures) > 0:
maxlCorrCoef = max(lCorrCoef) maxlCorrCoefIndex = lCorrCoef.index(maxlCorrCoef) lBestSet = list(set(lFeatures) - set(lRemovedFeatures[0:maxlCorrCoefIndex+1])) sys.stdout.write('best feature set is ' + str(lBestSet+[classLabelIndex]) + '\n') sys.stdout.write('corr coef = ' + str(maxlCorrCoef))
src/c/o/coopr.pyomo-3.5/coopr/pyomo/tests/examples/pmedian2.py coopr.pyomo(Download)
def pyomo_preprocess(**kwds): print( "PREPROCESSING %s"%(sorted(list(kwds.keys()))) ) def pyomo_create_model(**kwds): print( "CREATING MODEL %s"%(sorted(list(kwds.keys()))) ) return pmedian.model def pyomo_print_model(**kwds): print( "PRINTING MODEL %s"%(sorted(list(kwds.keys()))) )
def pyomo_print_instance(**kwds): print( "PRINTING INSTANCE %s"%(sorted(list(kwds.keys()))) ) def pyomo_save_instance(**kwds): print( "SAVE INSTANCE %s"%(sorted(list(kwds.keys()))) )
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 Next