Dataset Viewer
Auto-converted to Parquet Duplicate
index
int64
statement_id
int64
statement
string
lineno
int64
end_lineno
int64
comprehension_types
list
metadata
dict
0
0
yield (self.tree.get_text (x) for x in tr)
87
87
[ "GeneratorExp" ]
{ "hexsha": "f70001f658d4dfaa72dd4f0d1b3176492f6658bb", "max_stars_repo_name": "CNDB/CNDB", "max_stars_repo_path": "spider/openwrt.py", "lang": "Python" }
0
1
lq, nlq, etx = (float (x) for x in (lq, nlq, etx))
102
102
[ "GeneratorExp" ]
{ "hexsha": "f70001f658d4dfaa72dd4f0d1b3176492f6658bb", "max_stars_repo_name": "CNDB/CNDB", "max_stars_repo_path": "spider/openwrt.py", "lang": "Python" }
12
0
images = [self.resize(image=image, size=self.size, resample=self.resample) for image in images]
139
139
[ "ListComp" ]
{ "hexsha": "f700088372c0eeaff049211c5fe92cdccb5fa804", "max_stars_repo_name": "djroxx2000/transformers", "max_stars_repo_path": "src/transformers/models/vit/feature_extraction_vit.py", "lang": "Python" }
12
1
images = [self.normalize(image=image, mean=self.image_mean, std=self.image_std) for image in images]
141
141
[ "ListComp" ]
{ "hexsha": "f700088372c0eeaff049211c5fe92cdccb5fa804", "max_stars_repo_name": "djroxx2000/transformers", "max_stars_repo_path": "src/transformers/models/vit/feature_extraction_vit.py", "lang": "Python" }
13
0
return [read_row() for _ in range(read_val())]
12
12
[ "ListComp" ]
{ "hexsha": "f700096cbce5db1538215892bb1dcc76b6c37987", "max_stars_repo_name": "EliahKagan/old-practice-snapshot", "max_stars_repo_path": "hier/project-euler/euler-067-hackerrank/euler067.py", "lang": "Python" }
13
1
return [make_blank_row(i) for i in range(1, n + 1)]
18
18
[ "ListComp" ]
{ "hexsha": "f700096cbce5db1538215892bb1dcc76b6c37987", "max_stars_repo_name": "EliahKagan/old-practice-snapshot", "max_stars_repo_path": "hier/project-euler/euler-067-hackerrank/euler067.py", "lang": "Python" }
29
0
communities = [f.id for f in gamer.communities.all()]
170
170
[ "ListComp" ]
{ "hexsha": "f700169f42c4405db98ca51444ca7070b1d5d538", "max_stars_repo_name": "andrlik/looking-for-group", "max_stars_repo_path": "looking_for_group/games/api_views.py", "lang": "Python" }
29
1
game_player_ids = [ obj.game.id for obj in models.Player.objects.filter(gamer=gamer).select_related("game") ]
171
174
[ "ListComp" ]
{ "hexsha": "f700169f42c4405db98ca51444ca7070b1d5d538", "max_stars_repo_name": "andrlik/looking-for-group", "max_stars_repo_path": "looking_for_group/games/api_views.py", "lang": "Python" }
34
0
env_file.writelines((' - %s\n' % ch for ch in self._conda_channels))
132
132
[ "GeneratorExp" ]
{ "hexsha": "f7001ad17b839c3551d7b4c8edcc8b1d1d322b6f", "max_stars_repo_name": "prisae/asv", "max_stars_repo_path": "asv/plugins/conda.py", "lang": "Python" }
34
1
env_file.writelines((' - %s\n' % s for s in conda_args))
140
140
[ "GeneratorExp" ]
{ "hexsha": "f7001ad17b839c3551d7b4c8edcc8b1d1d322b6f", "max_stars_repo_name": "prisae/asv", "max_stars_repo_path": "asv/plugins/conda.py", "lang": "Python" }
34
2
env_file.writelines((' - %s\n' % s for s in pip_args))
145
145
[ "GeneratorExp" ]
{ "hexsha": "f7001ad17b839c3551d7b4c8edcc8b1d1d322b6f", "max_stars_repo_name": "prisae/asv", "max_stars_repo_path": "asv/plugins/conda.py", "lang": "Python" }
36
0
overhead = np.median([self._timer.timeit(0) for _ in range(5)])
286
286
[ "ListComp" ]
{ "hexsha": "f7001b697392ceebda04fd774fb9d56f47820f4b", "max_stars_repo_name": "GOOGLE-M/SGC", "max_stars_repo_path": "venv/lib/python3.7/site-packages/torch/utils/benchmark/utils/timer.py", "lang": "Python" }
41
0
x = tuple([i.detach() for i in x])
225
225
[ "ListComp" ]
{ "hexsha": "f7001e1d779abcb0aeb35035bb723969df9248a9", "max_stars_repo_name": "mohammedshariqnawaz/Pedestron", "max_stars_repo_path": "mmdet/models/detectors/csp.py", "lang": "Python" }
41
1
bbox_list = [ bbox2result(det_bboxes, det_labels, self.bbox_head.num_classes)[0] for det_bboxes, det_labels in bbox_list ]
229
232
[ "ListComp" ]
{ "hexsha": "f7001e1d779abcb0aeb35035bb723969df9248a9", "max_stars_repo_name": "mohammedshariqnawaz/Pedestron", "max_stars_repo_path": "mmdet/models/detectors/csp.py", "lang": "Python" }
41
2
gt_bboxes_ignore = [None for _ in range(num_imgs)]
239
239
[ "ListComp" ]
{ "hexsha": "f7001e1d779abcb0aeb35035bb723969df9248a9", "max_stars_repo_name": "mohammedshariqnawaz/Pedestron", "max_stars_repo_path": "mmdet/models/detectors/csp.py", "lang": "Python" }
41
3
samp_list = [res.bboxes for res in sampling_results]
256
256
[ "ListComp" ]
{ "hexsha": "f7001e1d779abcb0aeb35035bb723969df9248a9", "max_stars_repo_name": "mohammedshariqnawaz/Pedestron", "max_stars_repo_path": "mmdet/models/detectors/csp.py", "lang": "Python" }
41
4
pred_scores = torch.cat([torch.tensor(bbox[:, 4]).float().cuda() for bbox in bbox_list], dim=0)
262
262
[ "ListComp" ]
{ "hexsha": "f7001e1d779abcb0aeb35035bb723969df9248a9", "max_stars_repo_name": "mohammedshariqnawaz/Pedestron", "max_stars_repo_path": "mmdet/models/detectors/csp.py", "lang": "Python" }
41
5
pred_rois = bbox2roi([torch.tensor(bbox).float().cuda() for bbox in bbox_list])
263
263
[ "ListComp" ]
{ "hexsha": "f7001e1d779abcb0aeb35035bb723969df9248a9", "max_stars_repo_name": "mohammedshariqnawaz/Pedestron", "max_stars_repo_path": "mmdet/models/detectors/csp.py", "lang": "Python" }
41
6
bbox_list = [ bbox2result(det_bboxes, det_labels, self.bbox_head.num_classes)[0] for det_bboxes, det_labels in bbox_list ]
311
314
[ "ListComp" ]
{ "hexsha": "f7001e1d779abcb0aeb35035bb723969df9248a9", "max_stars_repo_name": "mohammedshariqnawaz/Pedestron", "max_stars_repo_path": "mmdet/models/detectors/csp.py", "lang": "Python" }
41
7
bbox_list = [torch.tensor(bbox).float().cuda() for bbox in bbox_list]
316
316
[ "ListComp" ]
{ "hexsha": "f7001e1d779abcb0aeb35035bb723969df9248a9", "max_stars_repo_name": "mohammedshariqnawaz/Pedestron", "max_stars_repo_path": "mmdet/models/detectors/csp.py", "lang": "Python" }
41
8
bbox_list = [bbox/im_scale for bbox in bbox_list]
318
318
[ "ListComp" ]
{ "hexsha": "f7001e1d779abcb0aeb35035bb723969df9248a9", "max_stars_repo_name": "mohammedshariqnawaz/Pedestron", "max_stars_repo_path": "mmdet/models/detectors/csp.py", "lang": "Python" }
41
9
bbox_results = [ bbox2result(det_bboxes, det_labels, self.bbox_head.num_classes) for det_bboxes, det_labels in bbox_list ]
336
339
[ "ListComp" ]
{ "hexsha": "f7001e1d779abcb0aeb35035bb723969df9248a9", "max_stars_repo_name": "mohammedshariqnawaz/Pedestron", "max_stars_repo_path": "mmdet/models/detectors/csp.py", "lang": "Python" }
41
10
bbox_results = [ bbox2result(det_bboxes, det_labels, self.bbox_head.num_classes) for det_bboxes, det_labels in bbox_list ]
346
349
[ "ListComp" ]
{ "hexsha": "f7001e1d779abcb0aeb35035bb723969df9248a9", "max_stars_repo_name": "mohammedshariqnawaz/Pedestron", "max_stars_repo_path": "mmdet/models/detectors/csp.py", "lang": "Python" }
45
0
myString = ', '.join('"{0}"'.format(s) for s in df.symbol.unique())
15
15
[ "GeneratorExp" ]
{ "hexsha": "f7001f45079e3103298a8ceb0386c7b776820464", "max_stars_repo_name": "brettelliot/event-study", "max_stars_repo_path": "examples/earnings_surprises/earnings-converter.py", "lang": "Python" }
48
0
self._window_blocks = { field: ExpiringCache(LRU(sid_cache_size)) for field in self.FIELDS }
332
335
[ "DictComp" ]
{ "hexsha": "f7002044d0369ad65533164d260b2c8f91cb7841", "max_stars_repo_name": "SJCosgrove/quantoipian", "max_stars_repo_path": "zipline/data/history_loader.py", "lang": "Python" }
48
1
return [asset_windows[asset] for asset in assets]
470
470
[ "ListComp" ]
{ "hexsha": "f7002044d0369ad65533164d260b2c8f91cb7841", "max_stars_repo_name": "SJCosgrove/quantoipian", "max_stars_repo_path": "zipline/data/history_loader.py", "lang": "Python" }
48
2
return concatenate( [window.get(end_ix) for window in block], axis=1, )
553
556
[ "ListComp" ]
{ "hexsha": "f7002044d0369ad65533164d260b2c8f91cb7841", "max_stars_repo_name": "SJCosgrove/quantoipian", "max_stars_repo_path": "zipline/data/history_loader.py", "lang": "Python" }
60
0
cls_map = {name: i for i, name in enumerate(config.classes)}
163
163
[ "DictComp" ]
{ "hexsha": "f70024e5f14d8c48a9b1684bda03d5b19a8c5e49", "max_stars_repo_name": "taroxd/mindspore", "max_stars_repo_path": "model_zoo/official/cv/ssd/src/dataset.py", "lang": "Python" }
64
0
self.assertTrue(any([p.name == option_name for p in self.vdq.__click_params__]), msg=f"Can not find {option_name} in option parameters")
35
35
[ "ListComp" ]
{ "hexsha": "f7002809c326a21adb3489f8362fe6d0df39aa6a", "max_stars_repo_name": "grizmin/ssm-port-forwarding", "max_stars_repo_path": "ssmpfwd/test/test_helpers.py", "lang": "Python" }
64
1
self.assertTrue(any([p.flag_value == flag_value for p in self.vdq.__click_params__]), msg=f"Can not find {flag_value} in option flag values")
39
39
[ "ListComp" ]
{ "hexsha": "f7002809c326a21adb3489f8362fe6d0df39aa6a", "max_stars_repo_name": "grizmin/ssm-port-forwarding", "max_stars_repo_path": "ssmpfwd/test/test_helpers.py", "lang": "Python" }
64
2
self.assertTrue(any([p.flag_value == flag_value for p in self.vdq.__click_params__]), msg=f"Can not find {flag_value} in option flag values")
43
43
[ "ListComp" ]
{ "hexsha": "f7002809c326a21adb3489f8362fe6d0df39aa6a", "max_stars_repo_name": "grizmin/ssm-port-forwarding", "max_stars_repo_path": "ssmpfwd/test/test_helpers.py", "lang": "Python" }
64
3
self.assertTrue(any([p.flag_value == flag_value for p in self.vdq.__click_params__]), msg=f"Can not find {flag_value} in option flag values")
47
47
[ "ListComp" ]
{ "hexsha": "f7002809c326a21adb3489f8362fe6d0df39aa6a", "max_stars_repo_name": "grizmin/ssm-port-forwarding", "max_stars_repo_path": "ssmpfwd/test/test_helpers.py", "lang": "Python" }
65
0
I0_modulation_err = np.array([val.m.s for val in I0_modulation])
39
39
[ "ListComp" ]
{ "hexsha": "f70028f9fa4d86978ac4bf40e069c11a32974d6b", "max_stars_repo_name": "doronbehar/lab4", "max_stars_repo_path": "x2.ESR/ESRB.py", "lang": "Python" }
65
1
I0_modulation_raw = np.array([val.m.n for val in I0_modulation])
40
40
[ "ListComp" ]
{ "hexsha": "f70028f9fa4d86978ac4bf40e069c11a32974d6b", "max_stars_repo_name": "doronbehar/lab4", "max_stars_repo_path": "x2.ESR/ESRB.py", "lang": "Python" }
65
2
absorption_deriviative_raw = np.array([val.m.n for val in absorption_deriviative])
43
43
[ "ListComp" ]
{ "hexsha": "f70028f9fa4d86978ac4bf40e069c11a32974d6b", "max_stars_repo_name": "doronbehar/lab4", "max_stars_repo_path": "x2.ESR/ESRB.py", "lang": "Python" }
65
3
absorption_deriviative_err = np.array([val.m.s for val in absorption_deriviative])
44
44
[ "ListComp" ]
{ "hexsha": "f70028f9fa4d86978ac4bf40e069c11a32974d6b", "max_stars_repo_name": "doronbehar/lab4", "max_stars_repo_path": "x2.ESR/ESRB.py", "lang": "Python" }
70
0
d[ 6 ] = HydrusSerialisable.SerialisableDictionary( { i : 'test' + str( i ) for i in range( 20 ) } )
97
97
[ "DictComp" ]
{ "hexsha": "f7002c90467435a91e99ee2aae11e1a594ffba14", "max_stars_repo_name": "baibhavvishalpani/hydrus", "max_stars_repo_path": "hydrus/test/TestHydrusSerialisable.py", "lang": "Python" }
70
1
d[ ClientSearch.Predicate( ClientSearch.PREDICATE_TYPE_TAG, 'test pred 2' ) ] = HydrusSerialisable.SerialisableList( [ ClientSearch.Predicate( ClientSearch.PREDICATE_TYPE_TAG, 'test' + str( i ) ) for i in range( 10 ) ] )
100
100
[ "ListComp" ]
{ "hexsha": "f7002c90467435a91e99ee2aae11e1a594ffba14", "max_stars_repo_name": "baibhavvishalpani/hydrus", "max_stars_repo_path": "hydrus/test/TestHydrusSerialisable.py", "lang": "Python" }
70
2
db[ HydrusData.GenerateKey() ] = [ HydrusData.GenerateKey() for i in range( 10 ) ]
116
116
[ "ListComp" ]
{ "hexsha": "f7002c90467435a91e99ee2aae11e1a594ffba14", "max_stars_repo_name": "baibhavvishalpani/hydrus", "max_stars_repo_path": "hydrus/test/TestHydrusSerialisable.py", "lang": "Python" }
70
3
db[ 2 ] = [ HydrusData.GenerateKey() for i in range( 10 ) ]
118
118
[ "ListComp" ]
{ "hexsha": "f7002c90467435a91e99ee2aae11e1a594ffba14", "max_stars_repo_name": "baibhavvishalpani/hydrus", "max_stars_repo_path": "hydrus/test/TestHydrusSerialisable.py", "lang": "Python" }
75
0
return [Request(x, callback=self.parse_item) for x in links]
22
22
[ "ListComp" ]
{ "hexsha": "f7002fa28c4f96c4ce9de895ed3dc6923730e7d5", "max_stars_repo_name": "fictivekin/openrecipes", "max_stars_repo_path": "scrapy_proj/openrecipes/spiders/elanaspantry_feedspider.py", "lang": "Python" }
77
0
class_sample_count = torch.LongTensor( [(bin_labels == t).sum() for t in torch.arange(nbins)])
49
50
[ "ListComp" ]
{ "hexsha": "f700308f76753f938a995240fe09d0f4b13796ba", "max_stars_repo_name": "ayushkarnawat/profit", "max_stars_repo_path": "examples/gb1/train_oracle.py", "lang": "Python" }
77
1
stratified = {split: Subset(dataset, sorted(idx)) for split, idx in zip(splits, subset_idx)}
65
66
[ "DictComp" ]
{ "hexsha": "f700308f76753f938a995240fe09d0f4b13796ba", "max_stars_repo_name": "ayushkarnawat/profit", "max_stars_repo_path": "examples/gb1/train_oracle.py", "lang": "Python" }
78
0
results = [i for i in pager]
812
812
[ "ListComp" ]
{ "hexsha": "f70031964499de2478621f668a6bbbbe0d067348", "max_stars_repo_name": "LaudateCorpus1/python-deploy", "max_stars_repo_path": "tests/unit/gapic/deploy_v1/test_cloud_deploy.py", "lang": "Python" }
78
1
assert all(isinstance(i, cloud_deploy.DeliveryPipeline) for i in results)
814
814
[ "GeneratorExp" ]
{ "hexsha": "f70031964499de2478621f668a6bbbbe0d067348", "max_stars_repo_name": "LaudateCorpus1/python-deploy", "max_stars_repo_path": "tests/unit/gapic/deploy_v1/test_cloud_deploy.py", "lang": "Python" }
78
2
assert all(isinstance(i, cloud_deploy.DeliveryPipeline) for i in responses)
898
898
[ "GeneratorExp" ]
{ "hexsha": "f70031964499de2478621f668a6bbbbe0d067348", "max_stars_repo_name": "LaudateCorpus1/python-deploy", "max_stars_repo_path": "tests/unit/gapic/deploy_v1/test_cloud_deploy.py", "lang": "Python" }
78
3
results = [i for i in pager]
2,089
2,089
[ "ListComp" ]
{ "hexsha": "f70031964499de2478621f668a6bbbbe0d067348", "max_stars_repo_name": "LaudateCorpus1/python-deploy", "max_stars_repo_path": "tests/unit/gapic/deploy_v1/test_cloud_deploy.py", "lang": "Python" }
78
4
assert all(isinstance(i, cloud_deploy.Target) for i in results)
2,091
2,091
[ "GeneratorExp" ]
{ "hexsha": "f70031964499de2478621f668a6bbbbe0d067348", "max_stars_repo_name": "LaudateCorpus1/python-deploy", "max_stars_repo_path": "tests/unit/gapic/deploy_v1/test_cloud_deploy.py", "lang": "Python" }
78
5
assert all(isinstance(i, cloud_deploy.Target) for i in responses)
2,159
2,159
[ "GeneratorExp" ]
{ "hexsha": "f70031964499de2478621f668a6bbbbe0d067348", "max_stars_repo_name": "LaudateCorpus1/python-deploy", "max_stars_repo_path": "tests/unit/gapic/deploy_v1/test_cloud_deploy.py", "lang": "Python" }
78
6
results = [i for i in pager]
3,270
3,270
[ "ListComp" ]
{ "hexsha": "f70031964499de2478621f668a6bbbbe0d067348", "max_stars_repo_name": "LaudateCorpus1/python-deploy", "max_stars_repo_path": "tests/unit/gapic/deploy_v1/test_cloud_deploy.py", "lang": "Python" }
78
7
assert all(isinstance(i, cloud_deploy.Release) for i in results)
3,272
3,272
[ "GeneratorExp" ]
{ "hexsha": "f70031964499de2478621f668a6bbbbe0d067348", "max_stars_repo_name": "LaudateCorpus1/python-deploy", "max_stars_repo_path": "tests/unit/gapic/deploy_v1/test_cloud_deploy.py", "lang": "Python" }
78
8
assert all(isinstance(i, cloud_deploy.Release) for i in responses)
3,340
3,340
[ "GeneratorExp" ]
{ "hexsha": "f70031964499de2478621f668a6bbbbe0d067348", "max_stars_repo_name": "LaudateCorpus1/python-deploy", "max_stars_repo_path": "tests/unit/gapic/deploy_v1/test_cloud_deploy.py", "lang": "Python" }
78
9
results = [i for i in pager]
4,253
4,253
[ "ListComp" ]
{ "hexsha": "f70031964499de2478621f668a6bbbbe0d067348", "max_stars_repo_name": "LaudateCorpus1/python-deploy", "max_stars_repo_path": "tests/unit/gapic/deploy_v1/test_cloud_deploy.py", "lang": "Python" }
78
10
assert all(isinstance(i, cloud_deploy.Rollout) for i in results)
4,255
4,255
[ "GeneratorExp" ]
{ "hexsha": "f70031964499de2478621f668a6bbbbe0d067348", "max_stars_repo_name": "LaudateCorpus1/python-deploy", "max_stars_repo_path": "tests/unit/gapic/deploy_v1/test_cloud_deploy.py", "lang": "Python" }
78
11
assert all(isinstance(i, cloud_deploy.Rollout) for i in responses)
4,323
4,323
[ "GeneratorExp" ]
{ "hexsha": "f70031964499de2478621f668a6bbbbe0d067348", "max_stars_repo_name": "LaudateCorpus1/python-deploy", "max_stars_repo_path": "tests/unit/gapic/deploy_v1/test_cloud_deploy.py", "lang": "Python" }
80
0
self.ids = [os.path.join(dir, data_rank, mode, filename) for filename in os.listdir(os.path.join(dir, data_rank, mode))]
34
34
[ "ListComp" ]
{ "hexsha": "f70033d1cbc2d6abea9a13563db9c1b94096e116", "max_stars_repo_name": "Theia-4869/U-RISC", "max_stars_repo_path": "utils/dataset.py", "lang": "Python" }
82
0
fpolicies = {k: int(v) for k, v in policies.items() if k.endswith("max")}
405
406
[ "DictComp" ]
{ "hexsha": "f70034b5d8bc1589a710450b847c2f39ab19cddb", "max_stars_repo_name": "traghavendra/cinder-train", "max_stars_repo_path": "cinder/volume/drivers/datera/datera_iscsi.py", "lang": "Python" }
90
0
return [Evaluator.evaluate(m, y, y_pred) for m in metric]
265
265
[ "ListComp" ]
{ "hexsha": "f700384c604ac91f885c84ab6ed838d3ba8c4771", "max_stars_repo_name": "GZHoffie/analytics-zoo", "max_stars_repo_path": "pyzoo/zoo/zouwu/model/Seq2Seq.py", "lang": "Python" }
90
1
return [np.array([Evaluator.evaluate(m, y[:, i, :], y_pred[:, i, :]) for i in range(self.future_seq_len)]) for m in metric]
267
269
[ "ListComp" ]
{ "hexsha": "f700384c604ac91f885c84ab6ed838d3ba8c4771", "max_stars_repo_name": "GZHoffie/analytics-zoo", "max_stars_repo_path": "pyzoo/zoo/zouwu/model/Seq2Seq.py", "lang": "Python" }
90
2
result = np.array([self.predict(x, mc=True) for i in range(n_iter)])
283
283
[ "ListComp" ]
{ "hexsha": "f700384c604ac91f885c84ab6ed838d3ba8c4771", "max_stars_repo_name": "GZHoffie/analytics-zoo", "max_stars_repo_path": "pyzoo/zoo/zouwu/model/Seq2Seq.py", "lang": "Python" }
104
0
dist_info = dict( line.strip().split('=', 1) for line in f.readlines())
412
413
[ "GeneratorExp" ]
{ "hexsha": "f70045418bc49a61f9a7a48205189a79ca91e491", "max_stars_repo_name": "marijnfs/onnxruntime", "max_stars_repo_path": "tools/ci_build/build.py", "lang": "Python" }
104
1
return ( os.path.exists('/.dockerenv') or os.path.isfile(path) and any('docker' in line for line in open(path)) )
463
466
[ "GeneratorExp" ]
{ "hexsha": "f70045418bc49a61f9a7a48205189a79ca91e491", "max_stars_repo_name": "marijnfs/onnxruntime", "max_stars_repo_path": "tools/ci_build/build.py", "lang": "Python" }
104
2
raise BuildError( "iOS build on MacOS canceled due to missing arguments: " + ', '.join( val for val, cond in zip(arg_names, needed_args) if not cond))
771
775
[ "GeneratorExp" ]
{ "hexsha": "f70045418bc49a61f9a7a48205189a79ca91e491", "max_stars_repo_name": "marijnfs/onnxruntime", "max_stars_repo_path": "tools/ci_build/build.py", "lang": "Python" }
104
3
raise BuildError( "iOS build canceled due to missing arguments: " + ', '.join( val for val, cond in zip(arg_names, needed_args) if not cond))
806
810
[ "GeneratorExp" ]
{ "hexsha": "f70045418bc49a61f9a7a48205189a79ca91e491", "max_stars_repo_name": "marijnfs/onnxruntime", "max_stars_repo_path": "tools/ci_build/build.py", "lang": "Python" }
104
4
cmake_args += ["-D{}".format(define) for define in cmake_extra_defines]
853
853
[ "ListComp" ]
{ "hexsha": "f70045418bc49a61f9a7a48205189a79ca91e491", "max_stars_repo_name": "marijnfs/onnxruntime", "max_stars_repo_path": "tools/ci_build/build.py", "lang": "Python" }
107
0
main([int(x) for x in sys.argv[1].split(',')], int(sys.argv[2]))
82
82
[ "ListComp" ]
{ "hexsha": "f70047cdafe4dcd083f47814ee7d17be097fee36", "max_stars_repo_name": "not-sponsored/Guide-to-Data-Structures-and-Algorithms-Exercises", "max_stars_repo_path": "algorithms/quicksort.py", "lang": "Python" }
109
0
return [w for w in cls._split_words(text) if w]
800
800
[ "ListComp" ]
{ "hexsha": "f70049a62ff8108e599465f06904de5438b65282", "max_stars_repo_name": "lordloki/upbge", "max_stars_repo_path": "release/scripts/modules/bl_i18n_utils/utils_spell_check.py", "lang": "Python" }
110
0
t_prime = [math.radians(i) for i in y_prime]
170
170
[ "ListComp" ]
{ "hexsha": "f7004a6a9da6e184c08cdd829e3bc4d6ac4c80b7", "max_stars_repo_name": "NingAnMe/voxelmorph", "max_stars_repo_path": "scripts/sphere/register.py", "lang": "Python" }
110
1
p_prime = [math.radians(i) for i in x_prime]
171
171
[ "ListComp" ]
{ "hexsha": "f7004a6a9da6e184c08cdd829e3bc4d6ac4c80b7", "max_stars_repo_name": "NingAnMe/voxelmorph", "max_stars_repo_path": "scripts/sphere/register.py", "lang": "Python" }
110
2
phi_prime = [math.degrees(p) for p in phi_prime]
202
202
[ "ListComp" ]
{ "hexsha": "f7004a6a9da6e184c08cdd829e3bc4d6ac4c80b7", "max_stars_repo_name": "NingAnMe/voxelmorph", "max_stars_repo_path": "scripts/sphere/register.py", "lang": "Python" }
110
3
thtea_prime = [math.degrees(t) for t in theta_prime]
203
203
[ "ListComp" ]
{ "hexsha": "f7004a6a9da6e184c08cdd829e3bc4d6ac4c80b7", "max_stars_repo_name": "NingAnMe/voxelmorph", "max_stars_repo_path": "scripts/sphere/register.py", "lang": "Python" }
125
0
if not (or_list([i in stopword_list for i in bigram])): if freq > threshold: frequent_bigrams.append('{}${}'.format(bigram[0], bigram[1])) else: break
29
33
[ "ListComp" ]
{ "hexsha": "f7005624326db8bd844029d49a4f69d03cd93970", "max_stars_repo_name": "GU-DataLab/topic-modeling-textPrep", "max_stars_repo_path": "settings/ngrams.py", "lang": "Python" }
125
1
fb, fn = get_dataset_ngrams([x[1] for x in date_docs], min_freq, sw, extra_bigrams, extra_ngrams)
98
98
[ "ListComp" ]
{ "hexsha": "f7005624326db8bd844029d49a4f69d03cd93970", "max_stars_repo_name": "GU-DataLab/topic-modeling-textPrep", "max_stars_repo_path": "settings/ngrams.py", "lang": "Python" }
132
0
stdout = "".join( [line.decode("utf-8") for line in iter(pipe.stdout.readline, b"")] )
33
35
[ "ListComp" ]
{ "hexsha": "f7005b28d042d57735c533e59720388a5a80e44f", "max_stars_repo_name": "PansoK/slp", "max_stars_repo_path": "tools/poor-mans-video-editor.py", "lang": "Python" }
132
1
return ( [st] + [ t for s in delete_timestamps.split(",") for t in (s.split("-")[0], s.split("-")[1]) ] + [et] )
70
80
[ "ListComp" ]
{ "hexsha": "f7005b28d042d57735c533e59720388a5a80e44f", "max_stars_repo_name": "PansoK/slp", "max_stars_repo_path": "tools/poor-mans-video-editor.py", "lang": "Python" }
132
2
timestamps = [to_cut_fmt(t) for t in timestamps]
105
105
[ "ListComp" ]
{ "hexsha": "f7005b28d042d57735c533e59720388a5a80e44f", "max_stars_repo_name": "PansoK/slp", "max_stars_repo_path": "tools/poor-mans-video-editor.py", "lang": "Python" }
132
3
cmds = [f"-ss {s} -to {e}" for s, e in pairwise(timestamps)]
133
133
[ "ListComp" ]
{ "hexsha": "f7005b28d042d57735c533e59720388a5a80e44f", "max_stars_repo_name": "PansoK/slp", "max_stars_repo_path": "tools/poor-mans-video-editor.py", "lang": "Python" }
132
4
segments = [ln.strip().split("\t") for ln in f]
162
162
[ "ListComp" ]
{ "hexsha": "f7005b28d042d57735c533e59720388a5a80e44f", "max_stars_repo_name": "PansoK/slp", "max_stars_repo_path": "tools/poor-mans-video-editor.py", "lang": "Python" }
135
0
color_modes = [e.value for e in ColorMode]
76
76
[ "ListComp" ]
{ "hexsha": "f7005bd1aad9ac2334d62b543f0e7ac8f6381776", "max_stars_repo_name": "Mishrasubha/napari", "max_stars_repo_path": "napari/_qt/layer_controls/qt_vectors_controls.py", "lang": "Python" }
138
0
item_lst=[item.strip() for item in item_lst]
112
112
[ "ListComp" ]
{ "hexsha": "f700608f35098a7965b60e53b106f0704bc73300", "max_stars_repo_name": "XuboGU/neorl", "max_stars_repo_path": "neorl/tune/runners/estune.py", "lang": "Python" }
138
1
strategy= [random.uniform(self.SMIN, self.SMAX) for _ in range(size)]
237
237
[ "ListComp" ]
{ "hexsha": "f700608f35098a7965b60e53b106f0704bc73300", "max_stars_repo_name": "XuboGU/neorl", "max_stars_repo_path": "neorl/tune/runners/estune.py", "lang": "Python" }
138
2
[pop[ind].append(fitness[ind]) for ind in range(len(pop))]
264
264
[ "ListComp" ]
{ "hexsha": "f700608f35098a7965b60e53b106f0704bc73300", "max_stars_repo_name": "XuboGU/neorl", "max_stars_repo_path": "neorl/tune/runners/estune.py", "lang": "Python" }
138
3
csvfile=[f for f in os.listdir('./tunecases/case{}/case{}_log/'.format(casenum, casenum)) if f.endswith('_out.csv')]
313
313
[ "ListComp" ]
{ "hexsha": "f700608f35098a7965b60e53b106f0704bc73300", "max_stars_repo_name": "XuboGU/neorl", "max_stars_repo_path": "neorl/tune/runners/estune.py", "lang": "Python" }
138
4
[fout.write(str(item) + ',') for item in ind]
323
323
[ "ListComp" ]
{ "hexsha": "f700608f35098a7965b60e53b106f0704bc73300", "max_stars_repo_name": "XuboGU/neorl", "max_stars_repo_path": "neorl/tune/runners/estune.py", "lang": "Python" }
138
5
[fout.write(item + ',') for item in self.param_names]
532
532
[ "ListComp" ]
{ "hexsha": "f700608f35098a7965b60e53b106f0704bc73300", "max_stars_repo_name": "XuboGU/neorl", "max_stars_repo_path": "neorl/tune/runners/estune.py", "lang": "Python" }
138
6
caseids=['ind{}'.format(ind) for ind in range(self.currentcase, self.currentcase+self.popsize+1)]
542
542
[ "ListComp" ]
{ "hexsha": "f700608f35098a7965b60e53b106f0704bc73300", "max_stars_repo_name": "XuboGU/neorl", "max_stars_repo_path": "neorl/tune/runners/estune.py", "lang": "Python" }
138
7
[offspring[ind].append(fitness[ind]) for ind in range(len(offspring))]
557
557
[ "ListComp" ]
{ "hexsha": "f700608f35098a7965b60e53b106f0704bc73300", "max_stars_repo_name": "XuboGU/neorl", "max_stars_repo_path": "neorl/tune/runners/estune.py", "lang": "Python" }
138
8
failed_cases=len([print ('failed') for item in self.population if isinstance(item, str)])
579
579
[ "ListComp" ]
{ "hexsha": "f700608f35098a7965b60e53b106f0704bc73300", "max_stars_repo_name": "XuboGU/neorl", "max_stars_repo_path": "neorl/tune/runners/estune.py", "lang": "Python" }
139
0
all_boxes = [[[] for _ in xrange(num_images)] for _ in xrange(imdb.num_classes)]
215
216
[ "ListComp" ]
{ "hexsha": "f70060aa3fd6b00edb6202ecf166cc9464082bba", "max_stars_repo_name": "zhuriheng/faster-rcnn.pytorch", "max_stars_repo_path": "test_net.py", "lang": "Python" }
139
1
image_scores = np.hstack([all_boxes[j][i][:, -1] for j in xrange(1, imdb.num_classes)])
304
305
[ "ListComp" ]
{ "hexsha": "f70060aa3fd6b00edb6202ecf166cc9464082bba", "max_stars_repo_name": "zhuriheng/faster-rcnn.pytorch", "max_stars_repo_path": "test_net.py", "lang": "Python" }
141
0
avg_val_loss = torch.stack([x["val_loss"] for x in outputs]).mean()
72
72
[ "ListComp" ]
{ "hexsha": "f700615e2a905b6e5d941c75f337b6670c36b49b", "max_stars_repo_name": "hirune924/kaggle-HuBMAP", "max_stars_repo_path": "system/system.py", "lang": "Python" }
141
1
avg_val_dice = torch.stack([x["val_dice"] for x in outputs]).mean()
73
73
[ "ListComp" ]
{ "hexsha": "f700615e2a905b6e5d941c75f337b6670c36b49b", "max_stars_repo_name": "hirune924/kaggle-HuBMAP", "max_stars_repo_path": "system/system.py", "lang": "Python" }
142
0
scores = {k: '?' for k in PCODES}
89
89
[ "DictComp" ]
{ "hexsha": "f70061697e12c46d39594f2bf2f9bb8e344f31c7", "max_stars_repo_name": "han-kwang/coronatest-scandata", "max_stars_repo_path": "coronatest_analyze_csv.py", "lang": "Python" }
142
1
qtm = _mean_time([v[0] for v in vlist])
111
111
[ "ListComp" ]
{ "hexsha": "f70061697e12c46d39594f2bf2f9bb8e344f31c7", "max_stars_repo_name": "han-kwang/coronatest-scandata", "max_stars_repo_path": "coronatest_analyze_csv.py", "lang": "Python" }
142
2
atm = min(v[1] for v in vlist)
113
113
[ "GeneratorExp" ]
{ "hexsha": "f70061697e12c46d39594f2bf2f9bb8e344f31c7", "max_stars_repo_name": "han-kwang/coronatest-scandata", "max_stars_repo_path": "coronatest_analyze_csv.py", "lang": "Python" }
142
3
wtimes_this = [atm - qtm for qtm, atm in vlist]
157
157
[ "ListComp" ]
{ "hexsha": "f70061697e12c46d39594f2bf2f9bb8e344f31c7", "max_stars_repo_name": "han-kwang/coronatest-scandata", "max_stars_repo_path": "coronatest_analyze_csv.py", "lang": "Python" }
142
4
dates = [t.strftime('%Y-%m-%d') for t in index]
274
274
[ "ListComp" ]
{ "hexsha": "f70061697e12c46d39594f2bf2f9bb8e344f31c7", "max_stars_repo_name": "han-kwang/coronatest-scandata", "max_stars_repo_path": "coronatest_analyze_csv.py", "lang": "Python" }
142
5
times = [t.strftime('%H:%M') for t in index]
275
275
[ "ListComp" ]
{ "hexsha": "f70061697e12c46d39594f2bf2f9bb8e344f31c7", "max_stars_repo_name": "han-kwang/coronatest-scandata", "max_stars_repo_path": "coronatest_analyze_csv.py", "lang": "Python" }
142
6
sdf.columns = [ ('/'.join([str(x) for x in c]) if isinstance(c, tuple) else c) for c in sdf.columns ]
282
285
[ "ListComp" ]
{ "hexsha": "f70061697e12c46d39594f2bf2f9bb8e344f31c7", "max_stars_repo_name": "han-kwang/coronatest-scandata", "max_stars_repo_path": "coronatest_analyze_csv.py", "lang": "Python" }
146
0
watched = {full_dataset.to_inner_iid(key): value for key,value in watched.items()}
35
35
[ "DictComp" ]
{ "hexsha": "f7006506115787b6ab648322e288f899a2ea56b5", "max_stars_repo_name": "mateuszrusin/filmweb-rekomendacje", "max_stars_repo_path": "movies_recommender/RecommenderSVD.py", "lang": "Python" }
End of preview. Expand in Data Studio

Python Comprehension Statements 1K

This dataset contains 1,000 Python statements extracted from bigcode/the-stack that include at least one Python comprehension expression:

  • list comprehensions
  • set comprehensions
  • dict comprehensions
  • generator expressions

Each row is a nearest enclosing Python statement around one or more comprehension expressions, along with line number information and source metadata copied from the original The Stack sample.

Dataset Details

  • Dataset name: py_comprehension_statements_1k
  • Rows: 1,000
  • Split: train
  • Source dataset: bigcode/the-stack, Python subset
  • Extraction script: scripts/collect_stack_comprehension_statements.py
  • Original local JSONL: outputs/the_stack_python_comprehension_statements.jsonl

Schema

Field Type Description
index int64 Zero-based index of the streamed source sample.
statement_id int64 Statement index within the source sample.
statement string Extracted Python statement containing a comprehension.
lineno int64 Starting line number in the original source file.
end_lineno int64 Ending line number in the original source file.
comprehension_types list[string] AST comprehension node types present in the statement.
metadata.hexsha string Source commit hash from The Stack metadata.
metadata.max_stars_repo_name string Repository name from The Stack metadata.
metadata.max_stars_repo_path string File path from The Stack metadata.
metadata.lang string Source language label.

Comprehension Type Counts

The comprehension_types field can contain multiple values for a single row. Across the 1,000 rows, the type occurrences are:

Type Count
ListComp 754
GeneratorExp 181
DictComp 76
SetComp 9

Usage

from datasets import load_dataset

dataset = load_dataset("nexround/py_comprehension_statements_1k")
train = dataset["train"]

print(train[0]["statement"])
print(train[0]["comprehension_types"])

If you have the dataset saved locally with datasets.save_to_disk, use:

from datasets import load_from_disk

dataset = load_from_disk("outputs/the_stack_python_comprehension_statements_hf_dataset")

Construction

The extraction process streamed Python files from The Stack, parsed each source file with Python's ast module, found ListComp, SetComp, DictComp, and GeneratorExp nodes, and saved the nearest enclosing statement for each unique statement span.

Rows that could not be parsed as Python source were skipped.

Intended Uses

This dataset is intended for lightweight analysis and experimentation around Python comprehension syntax, such as:

  • inspecting comprehension usage patterns
  • evaluating code models on comprehension-heavy snippets
  • constructing small probes or prompts involving Python comprehensions

Licensing

This is a derived sample from The Stack. The original source code snippets come from many upstream repositories with varying licenses. Users should consult and respect the licensing metadata and terms of the upstream The Stack dataset and the original repositories when using or redistributing examples.

Downloads last month
2