uid
stringlengths
24
24
split
stringclasses
1 value
category
stringclasses
2 values
content
stringlengths
5
482k
signature
stringlengths
1
14k
suffix
stringlengths
1
482k
prefix
stringlengths
9
14k
prefix_token_count
int64
3
5.01k
prefix_token_budget
int64
64
256
element_token_count
int64
1
292k
signature_token_count
int64
1
5.01k
prefix_context_token_count
int64
0
255
repo
stringlengths
7
112
path
stringlengths
4
208
language
stringclasses
1 value
name
stringlengths
1
218
qualname
stringlengths
1
218
start_line
int64
1
26.7k
end_line
int64
1
26.7k
signature_start_line
int64
1
26.7k
signature_end_line
int64
1
26.7k
source_hash
stringlengths
40
40
source_dataset
stringclasses
1 value
source_split
stringclasses
1 value
2dbdc2167d802904136cbea0
train
function
@pytest.fixture def resource_group2(resource_in_unit2): group = ResourceGroup.objects.create( identifier='test_group_2', name='Test resource group 2' ) group.resources.set([resource_in_unit2]) return group
@pytest.fixture def resource_group2(resource_in_unit2):
group = ResourceGroup.objects.create( identifier='test_group_2', name='Test resource group 2' ) group.resources.set([resource_in_unit2]) return group
', id='test-purpose') @pytest.fixture def resource_group(resource_in_unit): group = ResourceGroup.objects.create( identifier='test_group', name='Test resource group' ) group.resources.set([resource_in_unit]) return group @pytest.fixture def resource_group2(resource_in_unit2):
64
64
53
12
51
codepointtku/respa
resources/tests/conftest.py
Python
resource_group2
resource_group2
376
383
376
377
b4244f426e27527cde6dc708807fc1976808017f
bigcode/the-stack
train
71d97770cf93e8c2b921c4f7
train
function
@pytest.mark.django_db @pytest.fixture def space_resource_type(): return ResourceType.objects.get_or_create(id="test_space", name="test_space", main_type="space")[0]
@pytest.mark.django_db @pytest.fixture def space_resource_type():
return ResourceType.objects.get_or_create(id="test_space", name="test_space", main_type="space")[0]
all_user_types_api_client(request): api_client = APIClient() if request.param: api_client.force_authenticate(request.getfixturevalue(request.param)) return api_client @pytest.fixture def api_rf(): return APIRequestFactory() @pytest.mark.django_db @pytest.fixture def space_resource_type():
64
64
39
14
50
codepointtku/respa
resources/tests/conftest.py
Python
space_resource_type
space_resource_type
47
50
47
49
92c65a51d78f6abf5547772c1c9950455526c5d3
bigcode/the-stack
train
8568060262b0b01c88ec7c70
train
function
@pytest.mark.django_db @pytest.fixture def resource_in_unit2(space_resource_type, test_unit2): return Resource.objects.create( type=space_resource_type, authentication="none", name="resource in unit 2", unit=test_unit2, max_reservations_per_user=2, max_period=datetime...
@pytest.mark.django_db @pytest.fixture def resource_in_unit2(space_resource_type, test_unit2):
return Resource.objects.create( type=space_resource_type, authentication="none", name="resource in unit 2", unit=test_unit2, max_reservations_per_user=2, max_period=datetime.timedelta(hours=4), reservable=True, )
=payment_terms, specific_terms_fi='spesifiset käyttöehdot', specific_terms_en='specific terms of use', reservation_confirmed_notification_extra_en='this resource rocks' ) @pytest.mark.django_db @pytest.fixture def resource_in_unit2(space_resource_type, test_unit2):
64
64
81
22
42
codepointtku/respa
resources/tests/conftest.py
Python
resource_in_unit2
resource_in_unit2
114
125
114
116
d2515189f775b909427397fbe1bff67443e8e382
bigcode/the-stack
train
518b89760f59ee063b7bbe68
train
function
@pytest.fixture def staff_api_client(staff_user): api_client = APIClient() api_client.force_authenticate(user=staff_user) return api_client
@pytest.fixture def staff_api_client(staff_user):
api_client = APIClient() api_client.force_authenticate(user=staff_user) return api_client
EquipmentAlias, ResourceEquipment, EquipmentCategory, TermsOfUse, ResourceGroup from resources.models import AccessibilityValue, AccessibilityViewpoint, ResourceAccessibility, UnitAccessibility from munigeo.models import Municipality @pytest.fixture def api_client(): return APIClient() @pytest.fixture def staff_...
64
64
34
11
53
codepointtku/respa
resources/tests/conftest.py
Python
staff_api_client
staff_api_client
20
24
20
21
e5919ab384667910ce9035c793de79890a38ebc9
bigcode/the-stack
train
f9545aa672a5687674ab5fc0
train
function
@pytest.mark.django_db @pytest.fixture def strong_user(): user = get_user_model().objects.create( username='test_user_super_strong', first_name='Evert', last_name='Bäckström', email='cem@kaner.com', preferred_language='en' ) user.amr = 'very_strong_auth' return us...
@pytest.mark.django_db @pytest.fixture def strong_user():
user = get_user_model().objects.create( username='test_user_super_strong', first_name='Evert', last_name='Bäckström', email='cem@kaner.com', preferred_language='en' ) user.amr = 'very_strong_auth' return user
data = {'test_key': 'test_value'} resource_equipment = ResourceEquipment.objects.create( equipment=equipment, resource=resource_in_unit, data=data, description='test resource equipment', ) return resource_equipment @pytest.mark.django_db @pytest.fixture def strong_user():
64
64
79
13
50
codepointtku/respa
resources/tests/conftest.py
Python
strong_user
strong_user
218
229
218
220
c4f8c7903dac7542ca4b40c7ab05dcd5e3530731
bigcode/the-stack
train
fa12ac9e681df7737f5abdd6
train
function
@pytest.mark.django_db @pytest.fixture def user(): return get_user_model().objects.create( username='test_user', first_name='Cem', last_name='Kaner', email='cem@kaner.com', preferred_language='en' )
@pytest.mark.django_db @pytest.fixture def user():
return get_user_model().objects.create( username='test_user', first_name='Cem', last_name='Kaner', email='cem@kaner.com', preferred_language='en' )
_user_super_strong', first_name='Evert', last_name='Bäckström', email='cem@kaner.com', preferred_language='en' ) user.amr = 'very_strong_auth' return user @pytest.mark.django_db @pytest.fixture def user():
64
64
58
12
51
codepointtku/respa
resources/tests/conftest.py
Python
user
user
231
240
231
233
c2271a03ac7437cc346a2a700cb09edefa67fc2b
bigcode/the-stack
train
e0d94541ee630875e4dc3c1b
train
function
@pytest.fixture(params=[None, 'user', 'staff_user']) def all_user_types_api_client(request): api_client = APIClient() if request.param: api_client.force_authenticate(request.getfixturevalue(request.param)) return api_client
@pytest.fixture(params=[None, 'user', 'staff_user']) def all_user_types_api_client(request):
api_client = APIClient() if request.param: api_client.force_authenticate(request.getfixturevalue(request.param)) return api_client
.force_authenticate(user=staff_user) return api_client @pytest.fixture def user_api_client(user): api_client = APIClient() api_client.force_authenticate(user=user) return api_client @pytest.fixture(params=[None, 'user', 'staff_user']) def all_user_types_api_client(request):
64
64
51
21
42
codepointtku/respa
resources/tests/conftest.py
Python
all_user_types_api_client
all_user_types_api_client
34
39
34
35
3861dcff44f1ce39837443e20b494a3aef8413f2
bigcode/the-stack
train
f1c188bdeb46a0e5c5828fba
train
function
@pytest.mark.django_db @pytest.fixture def space_resource(space_resource_type): return Resource.objects.create(type=space_resource_type, authentication="none", name="resource")
@pytest.mark.django_db @pytest.fixture def space_resource(space_resource_type):
return Resource.objects.create(type=space_resource_type, authentication="none", name="resource")
api_rf(): return APIRequestFactory() @pytest.mark.django_db @pytest.fixture def space_resource_type(): return ResourceType.objects.get_or_create(id="test_space", name="test_space", main_type="space")[0] @pytest.mark.django_db @pytest.fixture def space_resource(space_resource_type):
64
64
35
16
48
codepointtku/respa
resources/tests/conftest.py
Python
space_resource
space_resource
53
56
53
55
1431085283ac920973c46efd23c56b673692c6b0
bigcode/the-stack
train
dd99762027c70e550c06a67a
train
function
@pytest.mark.django_db @pytest.fixture def resource_equipment(resource_in_unit, equipment): data = {'test_key': 'test_value'} resource_equipment = ResourceEquipment.objects.create( equipment=equipment, resource=resource_in_unit, data=data, description='test resource equipment', ...
@pytest.mark.django_db @pytest.fixture def resource_equipment(resource_in_unit, equipment):
data = {'test_key': 'test_value'} resource_equipment = ResourceEquipment.objects.create( equipment=equipment, resource=resource_in_unit, data=data, description='test resource equipment', ) return resource_equipment
return equipment @pytest.mark.django_db @pytest.fixture def equipment_alias(equipment): equipment_alias = EquipmentAlias.objects.create(name='test equipment alias', language='fi', equipment=equipment) return equipment_alias @pytest.mark.django_db @pytest.fixture def resource_equipment(resource_in_unit, equip...
64
64
71
19
44
codepointtku/respa
resources/tests/conftest.py
Python
resource_equipment
resource_equipment
206
216
206
208
c4ea7495f63af20918e29e263f3d5e2284af59dd
bigcode/the-stack
train
20cdeff88f65474a84a6557c
train
function
@pytest.mark.django_db @pytest.fixture def strong_resource(resource_with_opening_hours): resource_with_opening_hours.authentication = "strong" resource_with_opening_hours.save() return resource_with_opening_hours
@pytest.mark.django_db @pytest.fixture def strong_resource(resource_with_opening_hours):
resource_with_opening_hours.authentication = "strong" resource_with_opening_hours.save() return resource_with_opening_hours
Day.objects.create(period=p1, weekday=weekday, opens=datetime.time(8, 0), closes=datetime.time(18, 0)) resource_in_unit.update_opening_hours() return resource_in_unit @pytest.mark.django_db @pytest.fixture def strong_resource(resource_with_opening_hours):
64
64
45
18
45
codepointtku/respa
resources/tests/conftest.py
Python
strong_resource
strong_resource
154
159
154
156
223329debd8888c61c35949df71d6c17c5bdaa4d
bigcode/the-stack
train
474e0709435429d86aeba898
train
function
@pytest.fixture def api_client(): return APIClient()
@pytest.fixture def api_client():
return APIClient()
Type, Unit, Purpose, Day, Period from resources.models import Equipment, EquipmentAlias, ResourceEquipment, EquipmentCategory, TermsOfUse, ResourceGroup from resources.models import AccessibilityValue, AccessibilityViewpoint, ResourceAccessibility, UnitAccessibility from munigeo.models import Municipality @pytest.fixtu...
64
64
12
7
56
codepointtku/respa
resources/tests/conftest.py
Python
api_client
api_client
15
17
15
16
87642452db09c9d50ad55420e82eb225beb21ea3
bigcode/the-stack
train
1c5a682c633ae4bcfd11d00f
train
function
@pytest.mark.django_db @pytest.fixture def purpose(): return Purpose.objects.create(name='test purpose', id='test-purpose')
@pytest.mark.django_db @pytest.fixture def purpose():
return Purpose.objects.create(name='test purpose', id='test-purpose')
Manager', email='genie.manager@example.com', is_staff=True, is_general_admin=True, preferred_language='en' ) @pytest.mark.django_db @pytest.fixture def group(): return Group.objects.create(name='test group') @pytest.mark.django_db @pytest.fixture def purpose():
64
64
27
12
52
codepointtku/respa
resources/tests/conftest.py
Python
purpose
purpose
360
363
360
362
b401c28990f381b3f1f5c5d75becc6bb2a52dbef
bigcode/the-stack
train
ead47256b155993f3515f248
train
function
@pytest.fixture def accessibility_viewpoint_wheelchair(): vp = {"id": "10", "name_en": "I am a wheelchair user", "order_text": 10} return AccessibilityViewpoint.objects.create(**vp)
@pytest.fixture def accessibility_viewpoint_wheelchair():
vp = {"id": "10", "name_en": "I am a wheelchair user", "order_text": 10} return AccessibilityViewpoint.objects.create(**vp)
resource group 2' ) group.resources.set([resource_in_unit2]) return group @pytest.fixture def test_municipality(): municipality = Municipality.objects.create( id='foo', name='Foo' ) return municipality @pytest.fixture def accessibility_viewpoint_wheelchair():
64
64
48
11
52
codepointtku/respa
resources/tests/conftest.py
Python
accessibility_viewpoint_wheelchair
accessibility_viewpoint_wheelchair
394
397
394
395
ba016f5fc77a3fbfaacc5d598960d9eac1f31c01
bigcode/the-stack
train
ebbd6af180db317093bec74e
train
function
@pytest.mark.django_db @pytest.fixture def equipment_category(): return EquipmentCategory.objects.create( name='test equipment category' )
@pytest.mark.django_db @pytest.fixture def equipment_category():
return EquipmentCategory.objects.create( name='test equipment category' )
, weekday=date.weekday(), opens='12:00', closes='13:00') date = date + datetime.timedelta(days=1) Day.objects.create(period=period, weekday=date.weekday(), closed=True) return period @pytest.mark.django_db @pytest.fixture def equipment_category():
64
64
29
13
50
codepointtku/respa
resources/tests/conftest.py
Python
equipment_category
equipment_category
184
189
184
186
3e131486f295c2d72412c338f18a8c64971bb1a5
bigcode/the-stack
train
e1dc7f588115ae4b14a35b1d
train
function
@pytest.fixture def test_municipality(): municipality = Municipality.objects.create( id='foo', name='Foo' ) return municipality
@pytest.fixture def test_municipality():
municipality = Municipality.objects.create( id='foo', name='Foo' ) return municipality
group @pytest.fixture def resource_group2(resource_in_unit2): group = ResourceGroup.objects.create( identifier='test_group_2', name='Test resource group 2' ) group.resources.set([resource_in_unit2]) return group @pytest.fixture def test_municipality():
64
64
32
9
54
codepointtku/respa
resources/tests/conftest.py
Python
test_municipality
test_municipality
385
391
385
386
d16552c7f3020b070c5fd62bd740a92361448e79
bigcode/the-stack
train
34fc82f354a76d02057d8004
train
function
@pytest.mark.django_db @pytest.fixture def equipment(equipment_category): equipment = Equipment.objects.create(name='test equipment', category=equipment_category) return equipment
@pytest.mark.django_db @pytest.fixture def equipment(equipment_category):
equipment = Equipment.objects.create(name='test equipment', category=equipment_category) return equipment
Day.objects.create(period=period, weekday=date.weekday(), closed=True) return period @pytest.mark.django_db @pytest.fixture def equipment_category(): return EquipmentCategory.objects.create( name='test equipment category' ) @pytest.mark.django_db @pytest.fixture def equipm...
64
64
35
15
49
codepointtku/respa
resources/tests/conftest.py
Python
equipment
equipment
192
196
192
194
86f95ea74560d7bf752862ffcb8fe6099868f342
bigcode/the-stack
train
a294b232c8848275b2e77e3c
train
function
@pytest.fixture def accessibility_viewpoint_hearing(): vp = {"id": "20", "name_en": "I am hearing impaired", "order_text": 20} return AccessibilityViewpoint.objects.create(**vp)
@pytest.fixture def accessibility_viewpoint_hearing():
vp = {"id": "20", "name_en": "I am hearing impaired", "order_text": 20} return AccessibilityViewpoint.objects.create(**vp)
) return municipality @pytest.fixture def accessibility_viewpoint_wheelchair(): vp = {"id": "10", "name_en": "I am a wheelchair user", "order_text": 10} return AccessibilityViewpoint.objects.create(**vp) @pytest.fixture def accessibility_viewpoint_hearing():
64
64
46
10
54
codepointtku/respa
resources/tests/conftest.py
Python
accessibility_viewpoint_hearing
accessibility_viewpoint_hearing
400
403
400
401
ea29389d74ff5a7dd21f2b4572e4958eda6dee3c
bigcode/the-stack
train
f0e659636ac59c1b0490a62f
train
function
@pytest.mark.django_db @pytest.fixture def unit_manager_user(resource_in_unit): user = get_user_model().objects.create( username='test_manager_user', first_name='Inspector', last_name='Lestrade', email='lestrade@scotlandyard.co.uk', is_staff=True, preferred_language='...
@pytest.mark.django_db @pytest.fixture def unit_manager_user(resource_in_unit):
user = get_user_model().objects.create( username='test_manager_user', first_name='Inspector', last_name='Lestrade', email='lestrade@scotlandyard.co.uk', is_staff=True, preferred_language='en' ) user.unit_authorizations.create(subject=resource_in_unit.unit, lev...
='lestrade@scotlandyard.co.uk', is_staff=True, preferred_language='en' ) user.unit_authorizations.create(subject=resource_in_unit.unit, level=UnitAuthorizationLevel.admin) return user @pytest.mark.django_db @pytest.fixture def unit_manager_user(resource_in_unit):
64
64
96
17
46
codepointtku/respa
resources/tests/conftest.py
Python
unit_manager_user
unit_manager_user
296
308
296
298
cc36de01374c928632993e38d292fb5a5b2061d9
bigcode/the-stack
train
a34c2a2c7929dd3df56a36c9
train
function
@pytest.fixture def payment_terms(): return TermsOfUse.objects.create( name_fi='testimaksuehdot', name_en='test terms of payment', text_fi='kaikki on maksullista', text_en='everything is chargeable', terms_type=TermsOfUse.TERMS_TYPE_PAYMENT )
@pytest.fixture def payment_terms():
return TermsOfUse.objects.create( name_fi='testimaksuehdot', name_en='test terms of payment', text_fi='kaikki on maksullista', text_en='everything is chargeable', terms_type=TermsOfUse.TERMS_TYPE_PAYMENT )
.fixture def generic_terms(): return TermsOfUse.objects.create( name_fi='testikäyttöehdot', name_en='test terms of use', text_fi='kaikki on kielletty', text_en='everything is forbidden', ) @pytest.fixture def payment_terms():
64
64
72
7
57
codepointtku/respa
resources/tests/conftest.py
Python
payment_terms
payment_terms
84
92
84
85
d851154a73838008197b91b3357adaf00a7a74fb
bigcode/the-stack
train
ae15bc516583980da1e9d078
train
function
@pytest.fixture def resource_with_accessibility_data(resource_in_unit, accessibility_viewpoint_wheelchair, accessibility_viewpoint_hearing, accessibility_value_green, accessibility_value_red): """ Resource is wheelchair accessible, not hearin...
@pytest.fixture def resource_with_accessibility_data(resource_in_unit, accessibility_viewpoint_wheelchair, accessibility_viewpoint_hearing, accessibility_value_green, accessibility_value_red):
""" Resource is wheelchair accessible, not hearing accessible, unit is accessible to both """ ResourceAccessibility.objects.create( resource=resource_in_unit, viewpoint=accessibility_viewpoint_wheelchair, value=accessibility_value_green ) ResourceAccessibility.objects.create( ...
green', order=10) @pytest.fixture def accessibility_value_red(): return AccessibilityValue.objects.create(value='red', order=-10) @pytest.fixture def resource_with_accessibility_data(resource_in_unit, accessibility_viewpoint_wheelchair, accessibility_viewpoint_hearing, accessi...
64
64
195
36
28
codepointtku/respa
resources/tests/conftest.py
Python
resource_with_accessibility_data
resource_with_accessibility_data
416
441
416
419
69312b406c13599a0cc6f7f02410f4496495c3e0
bigcode/the-stack
train
da3ccbf9f639f66dc0257947
train
function
@pytest.mark.django_db @pytest.fixture def unit_admin_user(resource_in_unit): user = get_user_model().objects.create( username='test_admin_user', first_name='Inspector', last_name='Lestrade', email='lestrade@scotlandyard.co.uk', is_staff=True, preferred_language='en' ...
@pytest.mark.django_db @pytest.fixture def unit_admin_user(resource_in_unit):
user = get_user_model().objects.create( username='test_admin_user', first_name='Inspector', last_name='Lestrade', email='lestrade@scotlandyard.co.uk', is_staff=True, preferred_language='en' ) user.unit_authorizations.create(subject=resource_in_unit.unit, level...
='lestrade@scotlandyard.co.uk', is_staff=True, preferred_language='en' ) user.unit_authorizations.create(subject=resource_in_unit.unit, level=UnitAuthorizationLevel.admin) return user @pytest.mark.django_db @pytest.fixture def unit_admin_user(resource_in_unit):
64
64
96
17
46
codepointtku/respa
resources/tests/conftest.py
Python
unit_admin_user
unit_admin_user
281
293
281
283
a28390a07aa3b1213b2e6c2e0f33f017d04bdecb
bigcode/the-stack
train
51b0928d023816042d577b9b
train
function
@pytest.fixture def api_rf(): return APIRequestFactory()
@pytest.fixture def api_rf():
return APIRequestFactory()
) return api_client @pytest.fixture(params=[None, 'user', 'staff_user']) def all_user_types_api_client(request): api_client = APIClient() if request.param: api_client.force_authenticate(request.getfixturevalue(request.param)) return api_client @pytest.fixture def api_rf():
64
64
13
7
56
codepointtku/respa
resources/tests/conftest.py
Python
api_rf
api_rf
42
44
42
43
8f5bea2bd031da1229dd68e55240910a4a1459d0
bigcode/the-stack
train
51238aee8f3dc5b5b5c2ca58
train
function
@pytest.fixture def test_unit2(): return Unit.objects.create(name="unit 2", time_zone='Europe/Helsinki')
@pytest.fixture def test_unit2():
return Unit.objects.create(name="unit 2", time_zone='Europe/Helsinki')
def space_resource(space_resource_type): return Resource.objects.create(type=space_resource_type, authentication="none", name="resource") @pytest.mark.django_db @pytest.fixture def test_unit(): return Unit.objects.create(name="unit", time_zone='Europe/Helsinki') @pytest.fixture def test_unit2():
64
64
27
8
56
codepointtku/respa
resources/tests/conftest.py
Python
test_unit2
test_unit2
64
66
64
65
b31e64455bb78cfafd0600368275227a1a1e0ca3
bigcode/the-stack
train
9f930c1d07ecaf5052ee96a5
train
function
@pytest.mark.django_db @pytest.fixture def exceptional_period(resource_with_opening_hours): parent = resource_with_opening_hours.periods.first() period = Period.objects.create(start='2115-01-10', end='2115-01-12', resource=resource_with_opening_hours, ...
@pytest.mark.django_db @pytest.fixture def exceptional_period(resource_with_opening_hours):
parent = resource_with_opening_hours.periods.first() period = Period.objects.create(start='2115-01-10', end='2115-01-12', resource=resource_with_opening_hours, name='exceptional hours', exceptional=True, par...
@pytest.mark.django_db @pytest.fixture def strong_resource(resource_with_opening_hours): resource_with_opening_hours.authentication = "strong" resource_with_opening_hours.save() return resource_with_opening_hours @pytest.mark.django_db @pytest.fixture def exceptional_period(resource_with_opening_hours):
64
64
170
18
45
codepointtku/respa
resources/tests/conftest.py
Python
exceptional_period
exceptional_period
162
181
162
164
75e3b107cd9f093ce04fa2c2ce6af959b4a949b3
bigcode/the-stack
train
44c0976789ea0a19ef25f1bb
train
function
@pytest.mark.django_db @pytest.fixture def resource_in_unit(space_resource_type, test_unit, generic_terms, payment_terms): return Resource.objects.create( type=space_resource_type, authentication="none", name="resource in unit", unit=test_unit, max_reservations_per_user=1, ...
@pytest.mark.django_db @pytest.fixture def resource_in_unit(space_resource_type, test_unit, generic_terms, payment_terms):
return Resource.objects.create( type=space_resource_type, authentication="none", name="resource in unit", unit=test_unit, max_reservations_per_user=1, max_period=datetime.timedelta(hours=2), reservable=True, generic_terms=generic_terms, payment...
payment', text_fi='kaikki on maksullista', text_en='everything is chargeable', terms_type=TermsOfUse.TERMS_TYPE_PAYMENT ) @pytest.mark.django_db @pytest.fixture def resource_in_unit(space_resource_type, test_unit, generic_terms, payment_terms):
64
64
132
26
38
codepointtku/respa
resources/tests/conftest.py
Python
resource_in_unit
resource_in_unit
95
111
95
97
c29b07ab4353e912bf60cb5a731179b1874e73c4
bigcode/the-stack
train
96bd6ec576afdd7d2205087c
train
class
class TagResourcesRequest(RpcRequest): def __init__(self): RpcRequest.__init__(self, 'Vpc', '2016-04-28', 'TagResources','vpc') self.set_method('POST') if hasattr(self, "endpoint_map"): setattr(self, "endpoint_map", endpoint_data.getEndpointMap()) if hasattr(self, "endpoint_regional"): setattr(self, "e...
class TagResourcesRequest(RpcRequest):
def __init__(self): RpcRequest.__init__(self, 'Vpc', '2016-04-28', 'TagResources','vpc') self.set_method('POST') if hasattr(self, "endpoint_map"): setattr(self, "endpoint_map", endpoint_data.getEndpointMap()) if hasattr(self, "endpoint_regional"): setattr(self, "endpoint_regional", endpoint_data.getEndp...
the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # # http://www.apache.org/licenses/LICENSE-2.0 # # # Unless required by applicable law or agreed to in writing, # software distributed under the License i...
154
154
515
8
145
yndu13/aliyun-openapi-python-sdk
aliyun-python-sdk-vpc/aliyunsdkvpc/request/v20160428/TagResourcesRequest.py
Python
TagResourcesRequest
TagResourcesRequest
23
80
23
24
fd7db4812bdcdfce337c7fd58dfb942ba9d2005f
bigcode/the-stack
train
b9899b1e2b1bebff8a0ecd76
train
function
def data_exchange_arduino(arduino, rpm: str): """Writes the rpm values and then reads the state of the handbrake\n If the handbrake is pressed, the keyboard coorrespondent is pressed Args: arduino (Serial): the serial communication channel where the arduino is connected to rpm (str): the re...
def data_exchange_arduino(arduino, rpm: str):
"""Writes the rpm values and then reads the state of the handbrake\n If the handbrake is pressed, the keyboard coorrespondent is pressed Args: arduino (Serial): the serial communication channel where the arduino is connected to rpm (str): the revolutions per minute gotten from the selected ...
to connect """ #create comunication channel arduino = serial.Serial(port=port, baudrate=9600, timeout=0) print("Successfully created communication channel on port " + port) return arduino def data_exchange_arduino(arduino, rpm: str):
64
64
181
14
49
ricardo-quintela/SimRacingSetup
hanbrake_revLights/src/SerialComs.py
Python
data_exchange_arduino
data_exchange_arduino
55
76
55
55
c2b7405320e93e294950a249cb9771bc12184cdd
bigcode/the-stack
train
9de25479ecc02951befe8d93
train
function
def serial_ports(): """Takes a list of the available serial ports Returns ------- list A list constaining the available serial ports Raises ------ EnvironmentError If there is an error """ if sys.platform.startswith('win'): ports = ['COM%s' % (i + 1) for i i...
def serial_ports():
"""Takes a list of the available serial ports Returns ------- list A list constaining the available serial ports Raises ------ EnvironmentError If there is an error """ if sys.platform.startswith('win'): ports = ['COM%s' % (i + 1) for i in range(256)] el...
from glob import glob import sys import glob import serial import keyboard def serial_ports():
21
64
202
4
16
ricardo-quintela/SimRacingSetup
hanbrake_revLights/src/SerialComs.py
Python
serial_ports
serial_ports
7
38
7
7
d9d84120f1eea55e95cd007356b0da7a35f3de9e
bigcode/the-stack
train
1047687a864d7a7fcada66f6
train
function
def connect_arduino(port: str): """Connect to the arduino on the given serial port Args: port (str): the port to connect """ #create comunication channel arduino = serial.Serial(port=port, baudrate=9600, timeout=0) print("Successfully created communication channel on port " + port) ...
def connect_arduino(port: str):
"""Connect to the arduino on the given serial port Args: port (str): the port to connect """ #create comunication channel arduino = serial.Serial(port=port, baudrate=9600, timeout=0) print("Successfully created communication channel on port " + port) return arduino
: raise EnvironmentError('Unsupported platform') result = [] for port in ports: try: s = serial.Serial(port) s.close() result.append(port) except (OSError, serial.SerialException): pass return result def connect_arduino(port: str):
64
64
82
9
54
ricardo-quintela/SimRacingSetup
hanbrake_revLights/src/SerialComs.py
Python
connect_arduino
connect_arduino
41
52
41
41
98853d3c022b4716a8c45f518f994bebaf4a7a4a
bigcode/the-stack
train
d4d379c860d501ad5e95f1fa
train
class
class NamespacePodSubnetDriver(default_subnet.DefaultPodSubnetDriver): """Provides subnet for Pod port based on a Pod's namespace.""" def get_subnets(self, pod, project_id): pod_namespace = pod['metadata']['namespace'] subnet_id = self._get_namespace_subnet(pod_namespace) return {subne...
class NamespacePodSubnetDriver(default_subnet.DefaultPodSubnetDriver):
"""Provides subnet for Pod port based on a Pod's namespace.""" def get_subnets(self, pod, project_id): pod_namespace = pod['metadata']['namespace'] subnet_id = self._get_namespace_subnet(pod_namespace) return {subnet_id: default_subnet._get_subnet(subnet_id)} def _get_namespace_su...
www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and...
256
256
1,415
13
243
pliurh/kuryr-kubernetes
kuryr_kubernetes/controller/drivers/namespace_subnet.py
Python
NamespacePodSubnetDriver
NamespacePodSubnetDriver
40
210
40
40
685e84bde4703162efeea5b9990041b7f51857d3
bigcode/the-stack
train
7e81d6843a9ef1458dcd63c1
train
function
def find_file(path="~", file="LabRecorderCLI.exe") -> Union[Path, None]: """find a file recursively args ---- path:str the root folder file:str the file name returns ------- filepath: Union[Path, None] the path to the file or nothing """ path = P...
def find_file(path="~", file="LabRecorderCLI.exe") -> Union[Path, None]:
"""find a file recursively args ---- path:str the root folder file:str the file name returns ------- filepath: Union[Path, None] the path to the file or nothing """ path = Path(str(path)).expanduser().absolute() for i in path.glob("**/*"): ...
elif len(set(sids)) < len(streamargs): # the set contains unique source-ids multiple times raise ConnectionError("Some streams were selected multiple times") else: return sids def find_file(path="~", file="LabRecorderCLI.exe") -> Union[Path, None]:
64
64
110
21
42
jasmainak/pyliesl
liesl/files/labrecorder/manager.py
Python
find_file
find_file
53
71
53
53
6e5d9715aeb007c0518d52b8734ce5b38badd3ae
bigcode/the-stack
train
dc1782e49b8792c27d30181e
train
function
def validate(streamargs: List[dict]) -> Set[str]: """"checks whether all streams indicated by the streamargs are identifiable args ---- streamsargs: List[dict] a list of keyword-arguments as dictionary. Each entry identifies a specific stream. returns ------- streamids: Set[s...
def validate(streamargs: List[dict]) -> Set[str]:
""""checks whether all streams indicated by the streamargs are identifiable args ---- streamsargs: List[dict] a list of keyword-arguments as dictionary. Each entry identifies a specific stream. returns ------- streamids: Set[str] a set of validated unique stream ids ...
Created on Thu Jun 6 15:16:33 2019 @author: Robert Guggenberger """ import os from pathlib import Path from typing import List, Set, Union from liesl.streams.finder import open_streaminfo from liesl.streams._xmltodict import parse as xml_to_dict def validate(streamargs: List[dict]) -> Set[str]:
83
83
278
13
69
jasmainak/pyliesl
liesl/files/labrecorder/manager.py
Python
validate
validate
14
50
14
14
010e297f988acf96d6b15600f8c065123ca72013
bigcode/the-stack
train
2102308881f4fbfde19cf26e
train
class
class ParseSet(object): r1 = '^([1-9][0-9]{0,3})(?:-(1[0-2]|0[1-9]|[0-9])(?:-(3[01]|0[1-9]|[12][0-9]|[0-9]))?)?$' r2 = '^([-+]?(?:[1-9][0-9]*)?[0-9]{4})-(1[0-2]|0[1-9])-(3[01]|0[1-9]|[12][0-9])$' r3 = '^([1-9][0-9]{3})(?:(-)?(1[0-2]|0[1-9])(?:(?(2)-|)(3[01]|0[1-9]|[12][0-9]))?)?$' r4 = '^([1-9][0-9]{3})(?:-?([0...
class ParseSet(object):
r1 = '^([1-9][0-9]{0,3})(?:-(1[0-2]|0[1-9]|[0-9])(?:-(3[01]|0[1-9]|[12][0-9]|[0-9]))?)?$' r2 = '^([-+]?(?:[1-9][0-9]*)?[0-9]{4})-(1[0-2]|0[1-9])-(3[01]|0[1-9]|[12][0-9])$' r3 = '^([1-9][0-9]{3})(?:(-)?(1[0-2]|0[1-9])(?:(?(2)-|)(3[01]|0[1-9]|[12][0-9]))?)?$' r4 = '^([1-9][0-9]{3})(?:-?([0-2][0-9][1-9]))$' r5 =...
import re """Code to parse ISO8601 compliant date strings, with extensions; extended years are allowed, but only in the form +-YYYYYYY-MM-DD: months and days must be specified and separator must be used. These restrictions ensure that there can be no ambiguity regarding YYYYMMDD and YYYYDDD forms of the date in t...
220
252
842
5
215
cp4cds/cmip6_range_check_2
ddc_scripts/iso8601/p8601.py
Python
ParseSet
ParseSet
26
72
26
26
1f02121fd8eb4a87a75ca6e722985e9f57065155
bigcode/the-stack
train
ce313571b71998416783766a
train
class
class ParseOne(object): def __init__(self, ex, lab, ttl): self.ex = ex self.lab = lab self.ttl = ttl self.m = re.compile( self.ex ).match def __call__(self,ss): r = self.m(ss) if r == None: return None else: return r.groups()
class ParseOne(object):
def __init__(self, ex, lab, ttl): self.ex = ex self.lab = lab self.ttl = ttl self.m = re.compile( self.ex ).match def __call__(self,ss): r = self.m(ss) if r == None: return None else: return r.groups()
For backward compatibility, dates of the form Y-M-D aere also accepted; Updated from those posted in github discussion to make '-' optional in week format; - remove spurious brackets in core-ymd; - allow weeks 001-009 (blocked in previous form); """ class ParseOne(object):
64
64
83
5
59
cp4cds/cmip6_range_check_2
ddc_scripts/iso8601/p8601.py
Python
ParseOne
ParseOne
12
24
12
12
aa0e6ad7972daa8054b42b8abf1e75fd64473073
bigcode/the-stack
train
583b6867d506e185d12eb3a1
train
function
def main(): # load cfg assert (os.path.exists(args.config)) cfg = yaml.load(open(args.config, 'r'), Loader=yaml.Loader) cfg['trainer']['log_dir'] = os.path.join(cfg['exp_dir'], cfg['trainer']['log_dir']) cfg['trainer']['result_dir'] = os.path.join(cfg['exp_dir'], cfg['trainer']['result_dir']) ...
def main(): # load cfg
assert (os.path.exists(args.config)) cfg = yaml.load(open(args.config, 'r'), Loader=yaml.Loader) cfg['trainer']['log_dir'] = os.path.join(cfg['exp_dir'], cfg['trainer']['log_dir']) cfg['trainer']['result_dir'] = os.path.join(cfg['exp_dir'], cfg['trainer']['result_dir']) os.makedirs(cfg['trainer']['...
_logger(log_file): log_format = '%(asctime)s %(levelname)5s %(message)s' logging.basicConfig(level=logging.INFO, format=log_format, filename=log_file) console = logging.StreamHandler() console.setLevel(logging.INFO) console.setFormatter(logging.Formatter(log_format)) logging.getLogger(__name__...
95
95
317
9
86
yfthu/GUPNet
code/tools/train_val.py
Python
main
main
34
72
34
35
382b262a6c0482d1b7e591d4fe160368ea9594b3
bigcode/the-stack
train
94c472f3c29453b4e9bf1396
train
function
def create_logger(log_file): log_format = '%(asctime)s %(levelname)5s %(message)s' logging.basicConfig(level=logging.INFO, format=log_format, filename=log_file) console = logging.StreamHandler() console.setLevel(logging.INFO) console.setFormatter(logging.Formatter(log_format)) logging.getLogge...
def create_logger(log_file):
log_format = '%(asctime)s %(levelname)5s %(message)s' logging.basicConfig(level=logging.INFO, format=log_format, filename=log_file) console = logging.StreamHandler() console.setLevel(logging.INFO) console.setFormatter(logging.Formatter(log_format)) logging.getLogger(__name__).addHandler(consol...
Parser(description='implementation of GUPNet') parser.add_argument('-e', '--evaluate', dest='evaluate', action='store_true', help='evaluate model on validation set') parser.add_argument('--config', type=str, default = 'experiments/config.yaml') args = parser.parse_args() def create_logger(log_file):
64
64
88
6
58
yfthu/GUPNet
code/tools/train_val.py
Python
create_logger
create_logger
24
31
24
24
7af8860800457294110432a36cf445249b3a3403
bigcode/the-stack
train
8f3bf0b938ddab1ddde43beb
train
function
def getGcovFilterOptions(args): return { "sources": set([os.path.abspath(s) for s in args.sources]), #Make paths absolute, use set for fast lookups "include": args.includepost, "exclude": args.excludepost, }
def getGcovFilterOptions(args):
return { "sources": set([os.path.abspath(s) for s in args.sources]), #Make paths absolute, use set for fast lookups "include": args.includepost, "exclude": args.excludepost, }
def dumpToJson(intermediate, output): with open(output, "w") as f: json.dump(intermediate, f) def log(line): if not args.quiet: print("[{:.3f}s] {}".format(stopwatch(), line)) def getGcovFilterOptions(args):
64
64
62
8
56
aiuax/json
test/thirdparty/fastcov/fastcov.py
Python
getGcovFilterOptions
getGcovFilterOptions
286
291
286
286
2c5088531015e968ef31a13090a2c96bee33bb08
bigcode/the-stack
train
53377e3cc0b2e45f5bc60896
train
function
def gcovWorker(cwd, gcov, files, chunk, gcov_filter_options, branch_coverage): gcov_args = "-it" if branch_coverage: gcov_args += "b" p = subprocess.Popen([gcov, gcov_args] + chunk, cwd=cwd, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL) for line in iter(p.stdout.readline, b''): int...
def gcovWorker(cwd, gcov, files, chunk, gcov_filter_options, branch_coverage):
gcov_args = "-it" if branch_coverage: gcov_args += "b" p = subprocess.Popen([gcov, gcov_args] + chunk, cwd=cwd, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL) for line in iter(p.stdout.readline, b''): intermediate_json = json.loads(line.decode(sys.stdout.encoding)) intermedi...
gcda_files): if not gcda_files: gcda_files = glob.glob(os.path.join(os.path.abspath(cwd), "**/*.gcda"), recursive=True) return gcda_files def gcovWorker(cwd, gcov, files, chunk, gcov_filter_options, branch_coverage):
64
64
188
23
40
aiuax/json
test/thirdparty/fastcov/fastcov.py
Python
gcovWorker
gcovWorker
84
97
84
84
37d6ed3250126576f353b15ec2df9e74d3fad4f2
bigcode/the-stack
train
97fd9f6ec28ee8ca0e62f1c0
train
function
def processGcdas(cwd, gcov, jobs, gcda_files, gcov_filter_options, branch_coverage): chunk_size = max(MINIMUM_CHUNK_SIZE, int(len(gcda_files) / jobs) + 1) threads = [] intermediate_json_files = [] for chunk in chunks(gcda_files, chunk_size): t = threading.Thread(target=gcovWorker, args=(cwd, gc...
def processGcdas(cwd, gcov, jobs, gcda_files, gcov_filter_options, branch_coverage):
chunk_size = max(MINIMUM_CHUNK_SIZE, int(len(gcda_files) / jobs) + 1) threads = [] intermediate_json_files = [] for chunk in chunks(gcda_files, chunk_size): t = threading.Thread(target=gcovWorker, args=(cwd, gcov, intermediate_json_files, chunk, gcov_filter_options, branch_coverage)) th...
GCOVS_TOTAL.append(len(intermediate_json["files"])) GCOVS_SKIPPED.append(len(intermediate_json["files"])-len(intermediate_json_files)) p.wait() def processGcdas(cwd, gcov, jobs, gcda_files, gcov_filter_options, branch_coverage):
64
64
161
26
38
aiuax/json
test/thirdparty/fastcov/fastcov.py
Python
processGcdas
processGcdas
99
113
99
99
d748d31c663edfa34089f61b31e86913c934e37a
bigcode/the-stack
train
b9f5955187f82c1cbb979df9
train
function
def stopwatch(): """Return number of seconds since last time this was called""" global START_TIME end_time = time.time() delta = end_time - START_TIME START_TIME = end_time return delta
def stopwatch():
"""Return number of seconds since last time this was called""" global START_TIME end_time = time.time() delta = end_time - START_TIME START_TIME = end_time return delta
# Interesting metrics START_TIME = time.time() GCOVS_TOTAL = [] GCOVS_SKIPPED = [] def chunks(l, n): """Yield successive n-sized chunks from l.""" for i in range(0, len(l), n): yield l[i:i + n] def stopwatch():
64
64
50
3
61
aiuax/json
test/thirdparty/fastcov/fastcov.py
Python
stopwatch
stopwatch
44
50
44
44
dbf1440e15f3f9d4995b4d551efd86cb7a53b8e1
bigcode/the-stack
train
e37f2bf934cdc8de19f54cea
train
function
def chunks(l, n): """Yield successive n-sized chunks from l.""" for i in range(0, len(l), n): yield l[i:i + n]
def chunks(l, n):
"""Yield successive n-sized chunks from l.""" for i in range(0, len(l), n): yield l[i:i + n]
import argparse import threading import subprocess import multiprocessing MINIMUM_GCOV = (9,0,0) MINIMUM_CHUNK_SIZE = 5 # Interesting metrics START_TIME = time.time() GCOVS_TOTAL = [] GCOVS_SKIPPED = [] def chunks(l, n):
64
64
37
6
58
aiuax/json
test/thirdparty/fastcov/fastcov.py
Python
chunks
chunks
39
42
39
39
893acdcd54f261dee8fe40a921eb298aa72f2bb7
bigcode/the-stack
train
32c2b921a68a2c0d20bad015
train
function
def removeFiles(files): for file in files: os.remove(file)
def removeFiles(files):
for file in files: os.remove(file)
split("."))) def getGcovVersion(gcov): p = subprocess.Popen([gcov, "-v"], stdout=subprocess.PIPE) output = p.communicate()[0].decode('UTF-8') p.wait() return parseVersionFromLine(output.split("\n")[0]) def removeFiles(files):
64
64
16
5
59
aiuax/json
test/thirdparty/fastcov/fastcov.py
Python
removeFiles
removeFiles
67
69
67
67
4cca75ab1f55cb9451aa46b2e83f309872861bd2
bigcode/the-stack
train
809370c8e4986c57f0940bef
train
function
def distillFunction(function_raw, functions): function_name = function_raw["name"] if function_name not in functions: functions[function_name] = { "start_line": function_raw["start_line"], "execution_count": function_raw["execution_count"] } else: functions[fu...
def distillFunction(function_raw, functions):
function_name = function_raw["name"] if function_name not in functions: functions[function_name] = { "start_line": function_raw["start_line"], "execution_count": function_raw["execution_count"] } else: functions[function_name]["execution_count"] += function_ra...
args=(fastcov_json["sources"], chunk)) threads.append(t) t.start() log("Spawned %d threads each scanning at most %d source files" % (len(threads), chunk_size)) for t in threads: t.join() def distillFunction(function_raw, functions):
64
64
77
9
55
aiuax/json
test/thirdparty/fastcov/fastcov.py
Python
distillFunction
distillFunction
227
235
227
227
98be01f7e8d7b1384c192b11af345baea33745e7
bigcode/the-stack
train
94e2e1dda3054a41f67a31b1
train
function
def distillLine(line_raw, lines, branches): line_number = str(line_raw["line_number"]) if line_number not in lines: lines[line_number] = line_raw["count"] else: lines[line_number] += line_raw["count"] for i, branch in enumerate(line_raw["branches"]): if line_number not in branch...
def distillLine(line_raw, lines, branches):
line_number = str(line_raw["line_number"]) if line_number not in lines: lines[line_number] = line_raw["count"] else: lines[line_number] += line_raw["count"] for i, branch in enumerate(line_raw["branches"]): if line_number not in branches: branches[line_number] = [] ...
functions: functions[function_name] = { "start_line": function_raw["start_line"], "execution_count": function_raw["execution_count"] } else: functions[function_name]["execution_count"] += function_raw["execution_count"] def distillLine(line_raw, lines, branches):
64
64
140
11
53
aiuax/json
test/thirdparty/fastcov/fastcov.py
Python
distillLine
distillLine
237
251
237
237
de666f776bf4a6391ca2fe0d6dbe8b67ad56d380
bigcode/the-stack
train
f4337f557df41aff2ce52503
train
function
def getFilteredGcdaFiles(gcda_files, exclude): def excludeGcda(gcda): for ex in exclude: if ex in gcda: return False return True return list(filter(excludeGcda, gcda_files))
def getFilteredGcdaFiles(gcda_files, exclude):
def excludeGcda(gcda): for ex in exclude: if ex in gcda: return False return True return list(filter(excludeGcda, gcda_files))
stdout=subprocess.PIPE) output = p.communicate()[0].decode('UTF-8') p.wait() return parseVersionFromLine(output.split("\n")[0]) def removeFiles(files): for file in files: os.remove(file) def getFilteredGcdaFiles(gcda_files, exclude):
64
64
54
12
52
aiuax/json
test/thirdparty/fastcov/fastcov.py
Python
getFilteredGcdaFiles
getFilteredGcdaFiles
71
77
71
71
ee667285f7ba1c6f042b01e64301d45a8e21eb6d
bigcode/the-stack
train
2ec66a3c1a6a49409026e038
train
function
def dumpBranchCoverageToLcovInfo(f, branches): branch_miss = 0 for line_num, branch_counts in branches.items(): for i, count in enumerate(branch_counts): #Branch (<line number>, <block number>, <branch number>, <taken>) f.write("BRDA:%s,%d,%d,%d\n" % (line_num, int(i/2), i, coun...
def dumpBranchCoverageToLcovInfo(f, branches):
branch_miss = 0 for line_num, branch_counts in branches.items(): for i, count in enumerate(branch_counts): #Branch (<line number>, <block number>, <branch number>, <taken>) f.write("BRDA:%s,%d,%d,%d\n" % (line_num, int(i/2), i, count)) branch_miss += int(count == 0) ...
) def processGcovs(cwd, gcov_files, gcov_filter_options): files = [] for gcov in gcov_files: processGcov(cwd, gcov, files, gcov_filter_options) return files def dumpBranchCoverageToLcovInfo(f, branches):
64
64
146
12
51
aiuax/json
test/thirdparty/fastcov/fastcov.py
Python
dumpBranchCoverageToLcovInfo
dumpBranchCoverageToLcovInfo
146
154
146
146
8820eb37bf84b09ae032b501d31f2bdce1461abb
bigcode/the-stack
train
71a16373b84c0ac17de41228
train
function
def processGcov(cwd, gcov, files, gcov_filter_options): # Add absolute path gcov["file_abs"] = os.path.abspath(os.path.join(cwd, gcov["file"])) # If explicit sources were passed, check for match if gcov_filter_options["sources"]: if gcov["file_abs"] in gcov_filter_options["sources"]: ...
def processGcov(cwd, gcov, files, gcov_filter_options): # Add absolute path
gcov["file_abs"] = os.path.abspath(os.path.join(cwd, gcov["file"])) # If explicit sources were passed, check for match if gcov_filter_options["sources"]: if gcov["file_abs"] in gcov_filter_options["sources"]: files.append(gcov) return # Check include filter if gcov_filt...
%d gcov threads, each processing at most %d gcda files" % (len(threads), chunk_size)) for t in threads: t.join() return intermediate_json_files def processGcov(cwd, gcov, files, gcov_filter_options): # Add absolute path
64
64
174
23
40
aiuax/json
test/thirdparty/fastcov/fastcov.py
Python
processGcov
processGcov
115
138
115
116
7cb5c3b6301a11533bed24d0c8fe09521bd5c1f0
bigcode/the-stack
train
6b3f9e649854a743500cbc72
train
function
def parseVersionFromLine(version_str): """Given a string containing a dotted integer version, parse out integers and return as tuple""" version = re.search(r'(\d+\.\d+\.\d+)[^\.]', version_str) if not version: return (0,0,0) return tuple(map(int, version.group(1).split(".")))
def parseVersionFromLine(version_str):
"""Given a string containing a dotted integer version, parse out integers and return as tuple""" version = re.search(r'(\d+\.\d+\.\d+)[^\.]', version_str) if not version: return (0,0,0) return tuple(map(int, version.group(1).split(".")))
l[i:i + n] def stopwatch(): """Return number of seconds since last time this was called""" global START_TIME end_time = time.time() delta = end_time - START_TIME START_TIME = end_time return delta def parseVersionFromLine(version_str):
64
64
78
8
55
aiuax/json
test/thirdparty/fastcov/fastcov.py
Python
parseVersionFromLine
parseVersionFromLine
52
59
52
52
62b1e4d5d11590774053249ff0cf5fa75e17746d
bigcode/the-stack
train
08158d23a00d57fd0fab5545
train
function
def getGcovVersion(gcov): p = subprocess.Popen([gcov, "-v"], stdout=subprocess.PIPE) output = p.communicate()[0].decode('UTF-8') p.wait() return parseVersionFromLine(output.split("\n")[0])
def getGcovVersion(gcov):
p = subprocess.Popen([gcov, "-v"], stdout=subprocess.PIPE) output = p.communicate()[0].decode('UTF-8') p.wait() return parseVersionFromLine(output.split("\n")[0])
and return as tuple""" version = re.search(r'(\d+\.\d+\.\d+)[^\.]', version_str) if not version: return (0,0,0) return tuple(map(int, version.group(1).split("."))) def getGcovVersion(gcov):
64
64
56
8
56
aiuax/json
test/thirdparty/fastcov/fastcov.py
Python
getGcovVersion
getGcovVersion
61
65
61
61
313b990cbcbeda7f74acb43a4bc850067979575e
bigcode/the-stack
train
eed1e91dba61f2d76e01c525
train
function
def exclMarkerWorker(fastcov_sources, chunk): for source in chunk: # If there are no covered lines, skip if not fastcov_sources[source]["lines"]: continue start_line = 0 end_line = 0 with open(source) as f: for i, line in enumerate(f, 1): #Start enume...
def exclMarkerWorker(fastcov_sources, chunk):
for source in chunk: # If there are no covered lines, skip if not fastcov_sources[source]["lines"]: continue start_line = 0 end_line = 0 with open(source) as f: for i, line in enumerate(f, 1): #Start enumeration at line 1 if not "LCOV_...
, count)) #Line line_miss += int(count == 0) f.write("LF:%d\n" % len(data["lines"])) #Lines Found f.write("LH:%d\n" % (len(data["lines"]) - line_miss)) #Lines Hit f.write("end_of_record\n") def exclMarkerWorker(fastcov_sources, chunk):
83
83
278
11
72
aiuax/json
test/thirdparty/fastcov/fastcov.py
Python
exclMarkerWorker
exclMarkerWorker
180
212
180
180
4ae1890e24eebe41dab2a70b1e1a0797b92e1d17
bigcode/the-stack
train
e5fc395c6fe3e022fe8c29c7
train
function
def main(args): # Need at least gcov 9.0.0 because that's when gcov JSON and stdout streaming was introduced current_gcov_version = getGcovVersion(args.gcov) if current_gcov_version < MINIMUM_GCOV: sys.stderr.write("Minimum gcov version {} required, found {}\n".format(".".join(map(str, MINIMUM_GCOV)...
def main(args): # Need at least gcov 9.0.0 because that's when gcov JSON and stdout streaming was introduced
current_gcov_version = getGcovVersion(args.gcov) if current_gcov_version < MINIMUM_GCOV: sys.stderr.write("Minimum gcov version {} required, found {}\n".format(".".join(map(str, MINIMUM_GCOV)), ".".join(map(str, current_gcov_version)))) exit(1) # Get list of gcda files to process gcda_f...
{} } for source in report_raw: distillSource(source, report_json["sources"]) return report_json def dumpToJson(intermediate, output): with open(output, "w") as f: json.dump(intermediate, f) def log(line): if not args.quiet: print("[{:.3f}s] {}".format(stopwatch(), line))...
172
172
574
29
143
aiuax/json
test/thirdparty/fastcov/fastcov.py
Python
main
main
293
339
293
294
1fa712b77c01cb6f517f81f699a538bf5de3e9b2
bigcode/the-stack
train
c4036c7baf8210d44d44f321
train
function
def distillReport(report_raw): report_json = { "sources": {} } for source in report_raw: distillSource(source, report_json["sources"]) return report_json
def distillReport(report_raw):
report_json = { "sources": {} } for source in report_raw: distillSource(source, report_json["sources"]) return report_json
": {}, "lines": {}, } for function in source_raw["functions"]: distillFunction(function, sources[source_name]["functions"]) for line in source_raw["lines"]: distillLine(line, sources[source_name]["lines"], sources[source_name]["branches"]) def distillReport(report_raw):
64
64
42
7
57
aiuax/json
test/thirdparty/fastcov/fastcov.py
Python
distillReport
distillReport
268
276
268
268
68cae059b8d19278d1b4ac9936b5145beaccae59
bigcode/the-stack
train
b448e5f8f5b39211c5be2306
train
function
def getGcdaFiles(cwd, gcda_files): if not gcda_files: gcda_files = glob.glob(os.path.join(os.path.abspath(cwd), "**/*.gcda"), recursive=True) return gcda_files
def getGcdaFiles(cwd, gcda_files):
if not gcda_files: gcda_files = glob.glob(os.path.join(os.path.abspath(cwd), "**/*.gcda"), recursive=True) return gcda_files
FilteredGcdaFiles(gcda_files, exclude): def excludeGcda(gcda): for ex in exclude: if ex in gcda: return False return True return list(filter(excludeGcda, gcda_files)) def getGcdaFiles(cwd, gcda_files):
64
64
49
12
52
aiuax/json
test/thirdparty/fastcov/fastcov.py
Python
getGcdaFiles
getGcdaFiles
79
82
79
79
c93de2a5a9aee3e3b6912661ccc5962d647e4eff
bigcode/the-stack
train
bb4f247c74324ffb76d38327
train
function
def dumpToJson(intermediate, output): with open(output, "w") as f: json.dump(intermediate, f)
def dumpToJson(intermediate, output):
with open(output, "w") as f: json.dump(intermediate, f)
, sources[source_name]["lines"], sources[source_name]["branches"]) def distillReport(report_raw): report_json = { "sources": {} } for source in report_raw: distillSource(source, report_json["sources"]) return report_json def dumpToJson(intermediate, output):
64
64
28
9
54
aiuax/json
test/thirdparty/fastcov/fastcov.py
Python
dumpToJson
dumpToJson
278
280
278
278
2dc93bb63dbf9d3640559b128d2f886df991b620
bigcode/the-stack
train
6b1371b31a4dc951bd8fcbdc
train
function
def distillSource(source_raw, sources): source_name = source_raw["file_abs"] if source_name not in sources: sources[source_name] = { "functions": {}, "branches": {}, "lines": {}, } for function in source_raw["functions"]: distillFunction(function,...
def distillSource(source_raw, sources):
source_name = source_raw["file_abs"] if source_name not in sources: sources[source_name] = { "functions": {}, "branches": {}, "lines": {}, } for function in source_raw["functions"]: distillFunction(function, sources[source_name]["functions"]) ...
en = len(branches[line_number]) glen = len(line_raw["branches"]) if blen < glen: branches[line_number] += [0] * (glen - blen) branches[line_number][i] += branch["count"] def distillSource(source_raw, sources):
64
64
99
9
55
aiuax/json
test/thirdparty/fastcov/fastcov.py
Python
distillSource
distillSource
253
266
253
253
1c27331b5d6c3022f4b52b5baeb29de71e421aea
bigcode/the-stack
train
c79f52adf420e5da9b17e2b5
train
function
def log(line): if not args.quiet: print("[{:.3f}s] {}".format(stopwatch(), line))
def log(line):
if not args.quiet: print("[{:.3f}s] {}".format(stopwatch(), line))
= { "sources": {} } for source in report_raw: distillSource(source, report_json["sources"]) return report_json def dumpToJson(intermediate, output): with open(output, "w") as f: json.dump(intermediate, f) def log(line):
64
64
27
4
60
aiuax/json
test/thirdparty/fastcov/fastcov.py
Python
log
log
282
284
282
282
d2a24db86018e0156011db14b9f877332334e50b
bigcode/the-stack
train
6b07953f574d5f45939680be
train
function
def scanExclusionMarkers(fastcov_json, jobs): chunk_size = max(MINIMUM_CHUNK_SIZE, int(len(fastcov_json["sources"]) / jobs) + 1) threads = [] for chunk in chunks(list(fastcov_json["sources"].keys()), chunk_size): t = threading.Thread(target=exclMarkerWorker, args=(fastcov_json["sources"], chunk)) ...
def scanExclusionMarkers(fastcov_json, jobs):
chunk_size = max(MINIMUM_CHUNK_SIZE, int(len(fastcov_json["sources"]) / jobs) + 1) threads = [] for chunk in chunks(list(fastcov_json["sources"].keys()), chunk_size): t = threading.Thread(target=exclMarkerWorker, args=(fastcov_json["sources"], chunk)) threads.append(t) t.start() ...
in list(fastcov_sources[source][key].keys()): if int(line_num) <= end_line and int(line_num) >= start_line: del fastcov_sources[source][key][line_num] start_line = end_line = 0 def scanExclusionMarkers(fastcov_json, jobs):
64
64
129
12
51
aiuax/json
test/thirdparty/fastcov/fastcov.py
Python
scanExclusionMarkers
scanExclusionMarkers
214
225
214
214
8db2a6ad32be03b28c44f86e6530cb08298739f1
bigcode/the-stack
train
23d726663f6d8760b61617bf
train
function
def processGcovs(cwd, gcov_files, gcov_filter_options): files = [] for gcov in gcov_files: processGcov(cwd, gcov, files, gcov_filter_options) return files
def processGcovs(cwd, gcov_files, gcov_filter_options):
files = [] for gcov in gcov_files: processGcov(cwd, gcov, files, gcov_filter_options) return files
files.append(gcov) break return # Check exclude filter for ex in gcov_filter_options["exclude"]: if ex in gcov["file"]: return files.append(gcov) def processGcovs(cwd, gcov_files, gcov_filter_options):
64
64
51
17
47
aiuax/json
test/thirdparty/fastcov/fastcov.py
Python
processGcovs
processGcovs
140
144
140
140
3c446a06405a4321c39ade7b4d6568094a8eddc4
bigcode/the-stack
train
28c17e0f3bad7589a184cbea
train
function
def dumpToLcovInfo(fastcov_json, output): with open(output, "w") as f: for sf, data in fastcov_json["sources"].items(): f.write("SF:%s\n" % sf) #Source File fn_miss = 0 for function, fdata in data["functions"].items(): f.write("FN:%d,%s\n" % (fdata["start...
def dumpToLcovInfo(fastcov_json, output):
with open(output, "w") as f: for sf, data in fastcov_json["sources"].items(): f.write("SF:%s\n" % sf) #Source File fn_miss = 0 for function, fdata in data["functions"].items(): f.write("FN:%d,%s\n" % (fdata["start_line"], function)) #Function Sta...
("BRDA:%s,%d,%d,%d\n" % (line_num, int(i/2), i, count)) branch_miss += int(count == 0) f.write("BRF:%d\n" % len(branches)) #Branches Found f.write("BRH:%d\n" % (len(branches) - branch_miss)) #Branches Hit def dumpToLcovInfo(fastcov_json, output):
96
96
321
13
82
aiuax/json
test/thirdparty/fastcov/fastcov.py
Python
dumpToLcovInfo
dumpToLcovInfo
156
178
156
156
8eb85df0c23965cd10af9dff159c52a70c4bc694
bigcode/the-stack
train
5011ee801616e03049323de3
train
function
def build_resolver(uri, environ): if uri.startswith("http") and uri.endswith(".git"): return GitDataResolver(uri, environ) else: return FileDataResolver(uri)
def build_resolver(uri, environ):
if uri.startswith("http") and uri.endswith(".git"): return GitDataResolver(uri, environ) else: return FileDataResolver(uri)
os.path.abspath(filename) def get_filecontent(self, name): filename = self.get_filename(name=name) with open(filename, mode='rb') as f: return f.read() def get_directory(self, name): return self.get_filename(name=name) def build_resolver(uri, environ):
64
64
40
8
56
quacksawbones/galaxy-1
lib/galaxy/tool_util/verify/test_data.py
Python
build_resolver
build_resolver
57
61
57
57
28e8a9a686dad5d897ba6094c121a8c6ef4e2c55
bigcode/the-stack
train
45160058b684763b8754f825
train
class
class FileDataResolver: def __init__(self, file_dir): self.file_dir = file_dir def exists(self, filename): path = os.path.abspath(self.path(filename)) return os.path.exists(path) and in_directory(path, self.file_dir) def path(self, filename): return os.path.join(self.file_...
class FileDataResolver:
def __init__(self, file_dir): self.file_dir = file_dir def exists(self, filename): path = os.path.abspath(self.path(filename)) return os.path.exists(path) and in_directory(path, self.file_dir) def path(self, filename): return os.path.join(self.file_dir, filename)
f.read() def get_directory(self, name): return self.get_filename(name=name) def build_resolver(uri, environ): if uri.startswith("http") and uri.endswith(".git"): return GitDataResolver(uri, environ) else: return FileDataResolver(uri) class FileDataResolver:
64
64
74
5
59
quacksawbones/galaxy-1
lib/galaxy/tool_util/verify/test_data.py
Python
FileDataResolver
FileDataResolver
64
74
64
65
e8008209144fc9adb86c8773023f69af13060b9e
bigcode/the-stack
train
edc3cadee8338ce9243802f8
train
class
class GitDataResolver(FileDataResolver): def __init__(self, repository, environ): self.repository = repository self.updated = False repo_cache = environ.get("GALAXY_TEST_DATA_REPO_CACHE", "test-data-cache") m = hashlib.md5() m.update(smart_str(repository)) repo_path ...
class GitDataResolver(FileDataResolver):
def __init__(self, repository, environ): self.repository = repository self.updated = False repo_cache = environ.get("GALAXY_TEST_DATA_REPO_CACHE", "test-data-cache") m = hashlib.md5() m.update(smart_str(repository)) repo_path = os.path.join(repo_cache, m.hexdigest()) ...
uri.startswith("http") and uri.endswith(".git"): return GitDataResolver(uri, environ) else: return FileDataResolver(uri) class FileDataResolver: def __init__(self, file_dir): self.file_dir = file_dir def exists(self, filename): path = os.path.abspath(self.path(filename))...
112
112
376
8
104
quacksawbones/galaxy-1
lib/galaxy/tool_util/verify/test_data.py
Python
GitDataResolver
GitDataResolver
77
123
77
78
29b0ad1c39d25cbcbf99700f0107ba881bef4d5a
bigcode/the-stack
train
52b7f391d2a71014b87460a4
train
class
class TestDataResolver: __test__ = False # Prevent pytest from discovering this class (issue #12071) def __init__(self, file_dirs=None, env_var='GALAXY_TEST_FILE_DIR', environ=os.environ): if file_dirs is None: file_dirs = environ.get(env_var, None) if file_dirs is None: ...
class TestDataResolver:
__test__ = False # Prevent pytest from discovering this class (issue #12071) def __init__(self, file_dirs=None, env_var='GALAXY_TEST_FILE_DIR', environ=os.environ): if file_dirs is None: file_dirs = environ.get(env_var, None) if file_dirs is None: file_dirs = "test-data...
work-tree $dir --git-dir $dir/.git merge origin/master" ) UPDATE_FAILED_TEMPLATE = Template( "Warning failed to update test repository $dir - " "update stdout was [$stdout] and stderr was [$stderr]." ) LIST_SEP = re.compile(r"\s*,\s*") class TestDataResolver:
69
69
232
5
64
quacksawbones/galaxy-1
lib/galaxy/tool_util/verify/test_data.py
Python
TestDataResolver
TestDataResolver
27
54
27
27
781019a39d4bb608df8bc84d5282a2af8918f0c9
bigcode/the-stack
train
42387e4324b168e716ef4df4
train
function
@pytest.fixture(scope='session') def last_lineage(empty_lineage: lngmod.Level.Key) -> lngmod.Level.Key: """Lineage fixture.""" return empty_lineage
@pytest.fixture(scope='session') def last_lineage(empty_lineage: lngmod.Level.Key) -> lngmod.Level.Key:
"""Lineage fixture.""" return empty_lineage
.""" return project_lineage @pytest.fixture(scope='session') def empty_lineage() -> lngmod.Level.Key: """Lineage fixture.""" return lngmod.Level.Key('2') @pytest.fixture(scope='session') def last_lineage(empty_lineage: lngmod.Level.Key) -> lngmod.Level.Key:
64
64
37
25
39
mpearmain/forml
tests/runtime/conftest.py
Python
last_lineage
last_lineage
44
47
44
45
4558bc15c9a887eaaa34bf1eacb06976f4b1f24a
bigcode/the-stack
train
3bad6bc9c78d9f4dec2e9221
train
function
@pytest.fixture(scope='function') def valid_assets( project_name: prjmod.Level.Key, populated_lineage: lngmod.Level.Key, valid_generation: genmod.Level.Key, directory: rootmod.Level, ) -> access.Assets: """Lineage fixture.""" return access.Assets(project_name, populated_lineage, valid_generation...
@pytest.fixture(scope='function') def valid_assets( project_name: prjmod.Level.Key, populated_lineage: lngmod.Level.Key, valid_generation: genmod.Level.Key, directory: rootmod.Level, ) -> access.Assets:
"""Lineage fixture.""" return access.Assets(project_name, populated_lineage, valid_generation, directory)
Directory root fixture.""" return rootmod.Level(registry) @pytest.fixture(scope='function') def valid_assets( project_name: prjmod.Level.Key, populated_lineage: lngmod.Level.Key, valid_generation: genmod.Level.Key, directory: rootmod.Level, ) -> access.Assets:
64
64
75
52
12
mpearmain/forml
tests/runtime/conftest.py
Python
valid_assets
valid_assets
130
138
130
136
4a9185e024d3d04eef99ebd94c55fd80a143fc0a
bigcode/the-stack
train
343f0e0e231f2eadff8594e8
train
function
@pytest.fixture(scope='function') def directory(registry: persistent.Registry) -> rootmod.Level: """Directory root fixture.""" return rootmod.Level(registry)
@pytest.fixture(scope='function') def directory(registry: persistent.Registry) -> rootmod.Level:
"""Directory root fixture.""" return rootmod.Level(registry)
self, project: prjmod.Level.Key, lineage: lngmod.Level.Key, generation: genmod.Level.Key, tag: genmod.Tag ) -> None: raise NotImplementedError() return Registry() @pytest.fixture(scope='function') def directory(registry: persistent.Registry) -> rootmod.Level:
64
64
33
19
45
mpearmain/forml
tests/runtime/conftest.py
Python
directory
directory
124
127
124
125
3ef14f2430af2914dc839336d81081740c6d2a01
bigcode/the-stack
train
3d5b5d03a8b3b1e0b4f25b6a
train
function
@pytest.fixture(scope='session') def last_generation(valid_generation: genmod.Level.Key) -> genmod.Level.Key: """Generation fixture.""" return valid_generation
@pytest.fixture(scope='session') def last_generation(valid_generation: genmod.Level.Key) -> genmod.Level.Key:
"""Generation fixture.""" return valid_generation
.Key('2') @pytest.fixture(scope='session') def last_lineage(empty_lineage: lngmod.Level.Key) -> lngmod.Level.Key: """Lineage fixture.""" return empty_lineage @pytest.fixture(scope='session') def last_generation(valid_generation: genmod.Level.Key) -> genmod.Level.Key:
64
64
33
23
40
mpearmain/forml
tests/runtime/conftest.py
Python
last_generation
last_generation
50
53
50
51
15b3cf73a8fe010f2b91bb1c8b9a9faaaf5e7ee7
bigcode/the-stack
train
0a7fcf025c89ed128d9ecf06
train
function
@pytest.fixture(scope='session') def populated_lineage(project_lineage: lngmod.Level.Key) -> lngmod.Level.Key: """Lineage fixture.""" return project_lineage
@pytest.fixture(scope='session') def populated_lineage(project_lineage: lngmod.Level.Key) -> lngmod.Level.Key:
"""Lineage fixture.""" return project_lineage
import persistent, directory as dirmod, access from forml.runtime.asset.directory import root as rootmod, project as prjmod, lineage as lngmod, generation as genmod @pytest.fixture(scope='session') def populated_lineage(project_lineage: lngmod.Level.Key) -> lngmod.Level.Key:
64
64
37
25
38
mpearmain/forml
tests/runtime/conftest.py
Python
populated_lineage
populated_lineage
32
35
32
33
b229631f19bd07555c275a60db7b809db733c415
bigcode/the-stack
train
f8bac66499656d4b124481c1
train
function
@pytest.fixture(scope='function') def registry( project_name: prjmod.Level.Key, populated_lineage: lngmod.Level.Key, empty_lineage: lngmod.Level.Key, valid_generation: genmod.Level.Key, tag: genmod.Tag, states: typing.Mapping[uuid.UUID, bytes], project_package: distribution.Package, ) -> per...
@pytest.fixture(scope='function') def registry( project_name: prjmod.Level.Key, populated_lineage: lngmod.Level.Key, empty_lineage: lngmod.Level.Key, valid_generation: genmod.Level.Key, tag: genmod.Tag, states: typing.Mapping[uuid.UUID, bytes], project_package: distribution.Package, ) -> per...
"""Registry fixture.""" content = { project_name: { populated_lineage: (project_package, {valid_generation: (tag, tuple(states.values()))}), empty_lineage: (project_package, {}), } } class Registry(persistent.Registry): """Fixture registry implementation"...
@pytest.fixture(scope='session') def empty_lineage() -> lngmod.Level.Key: """Lineage fixture.""" return lngmod.Level.Key('2') @pytest.fixture(scope='session') def last_lineage(empty_lineage: lngmod.Level.Key) -> lngmod.Level.Key: """Lineage fixture.""" return empty_lineage @pytest.fixture(scope='ses...
180
180
601
78
101
mpearmain/forml
tests/runtime/conftest.py
Python
registry
registry
56
121
56
65
41d0f7d79c180c16e577861ea87e94b1d318f8f7
bigcode/the-stack
train
5ef17c928e2db5ddb3197791
train
function
@pytest.fixture(scope='session') def empty_lineage() -> lngmod.Level.Key: """Lineage fixture.""" return lngmod.Level.Key('2')
@pytest.fixture(scope='session') def empty_lineage() -> lngmod.Level.Key:
"""Lineage fixture.""" return lngmod.Level.Key('2')
lineage as lngmod, generation as genmod @pytest.fixture(scope='session') def populated_lineage(project_lineage: lngmod.Level.Key) -> lngmod.Level.Key: """Lineage fixture.""" return project_lineage @pytest.fixture(scope='session') def empty_lineage() -> lngmod.Level.Key:
64
64
32
17
46
mpearmain/forml
tests/runtime/conftest.py
Python
empty_lineage
empty_lineage
38
41
38
39
ad0acba53a9cbdb1ea984da3c5bf038090d5230d
bigcode/the-stack
train
c27eb195efdb3be64745280b
train
class
class ActionMatch(MatchBase): "Action match" ELEMENT_LOCAL_NAME = 'ActionMatch' ATTRIBUTE_DESIGNATOR_ELEMENT_LOCAL_NAME = 'ActionAttributeDesignator'
class ActionMatch(MatchBase):
"Action match" ELEMENT_LOCAL_NAME = 'ActionMatch' ATTRIBUTE_DESIGNATOR_ELEMENT_LOCAL_NAME = 'ActionAttributeDesignator'
SubjectMatch' ATTRIBUTE_DESIGNATOR_ELEMENT_LOCAL_NAME = 'SubjectAttributeDesignator' class ResourceMatch(MatchBase): "Resource Match" ELEMENT_LOCAL_NAME = 'ResourceMatch' ATTRIBUTE_DESIGNATOR_ELEMENT_LOCAL_NAME = 'ResourceAttributeDesignator' class ActionMatch(MatchBase):
63
64
37
7
56
cedadev/ndg_xacml
ndg/xacml/core/match.py
Python
ActionMatch
ActionMatch
362
365
362
362
429253c5c4ebcb177c919bcf863b9d54bdf18614
bigcode/the-stack
train
934e5061522db8c48eeb0884
train
class
class ResourceMatch(MatchBase): "Resource Match" ELEMENT_LOCAL_NAME = 'ResourceMatch' ATTRIBUTE_DESIGNATOR_ELEMENT_LOCAL_NAME = 'ResourceAttributeDesignator'
class ResourceMatch(MatchBase):
"Resource Match" ELEMENT_LOCAL_NAME = 'ResourceMatch' ATTRIBUTE_DESIGNATOR_ELEMENT_LOCAL_NAME = 'ResourceAttributeDesignator'
found. matchStatus = any(attrMatchStatusValues) return matchStatus class SubjectMatch(MatchBase): "Subject Match Type" ELEMENT_LOCAL_NAME = 'SubjectMatch' ATTRIBUTE_DESIGNATOR_ELEMENT_LOCAL_NAME = 'SubjectAttributeDesignator' class ResourceMatch(MatchBase):
62
64
36
7
55
cedadev/ndg_xacml
ndg/xacml/core/match.py
Python
ResourceMatch
ResourceMatch
356
359
356
356
4f148ac3e77434bc5a64f78f6244354d621aeb93
bigcode/the-stack
train
bb87ef84f2288eb7e9e9bcdf
train
class
class SubjectMatch(MatchBase): "Subject Match Type" ELEMENT_LOCAL_NAME = 'SubjectMatch' ATTRIBUTE_DESIGNATOR_ELEMENT_LOCAL_NAME = 'SubjectAttributeDesignator'
class SubjectMatch(MatchBase):
"Subject Match Type" ELEMENT_LOCAL_NAME = 'SubjectMatch' ATTRIBUTE_DESIGNATOR_ELEMENT_LOCAL_NAME = 'SubjectAttributeDesignator'
attribute value %r with match function ' 'Id %r', matchAttributeValue, requestAttributeValue, self.matchId) # Return true if a match was found. match...
64
64
38
7
56
cedadev/ndg_xacml
ndg/xacml/core/match.py
Python
SubjectMatch
SubjectMatch
350
353
350
350
3cbce453e4f53b16482d020087f1cc041e60904a
bigcode/the-stack
train
7bfe590aa5e5af552ded7109
train
class
class MatchBase(XacmlCoreBase): """Base class for representation of SubjectMatch, ResourceMatch, ActionMatch and EnvironmentMatch Target elements @cvar ELEMENT_LOCAL_NAME: XML Local Name of this element @type ELEMENT_LOCAL_NAME: string @cvar MATCH_ID_ATTRIB_NAME: XML attribute name for ma...
class MatchBase(XacmlCoreBase):
"""Base class for representation of SubjectMatch, ResourceMatch, ActionMatch and EnvironmentMatch Target elements @cvar ELEMENT_LOCAL_NAME: XML Local Name of this element @type ELEMENT_LOCAL_NAME: string @cvar MATCH_ID_ATTRIB_NAME: XML attribute name for match ID @type MATCH_ID_ATTRIB...
"""NDG Security Match type definition NERC DataGrid """ __author__ = "P J Kershaw" __date__ = "25/02/10" __copyright__ = "(C) 2010 Science and Technology Facilities Council" __contact__ = "Philip.Kershaw@stfc.ac.uk" __license__ = "BSD - see LICENSE file in top-level directory" __contact__ = "Philip.Kershaw@stfc.ac.uk"...
226
256
2,669
9
216
cedadev/ndg_xacml
ndg/xacml/core/match.py
Python
MatchBase
MatchBase
25
347
25
25
5bfb66f30174d12cddab518b47b40aeb0efdd31d
bigcode/the-stack
train
926bf2cae1f05d356a480db3
train
class
class EnvironmentMatch(MatchBase): "Environment Match" ELEMENT_LOCAL_NAME = 'EnvironmentMatch' ATTRIBUTE_DESIGNATOR_ELEMENT_LOCAL_NAME = 'EnvironmentAttributeDesignator'
class EnvironmentMatch(MatchBase):
"Environment Match" ELEMENT_LOCAL_NAME = 'EnvironmentMatch' ATTRIBUTE_DESIGNATOR_ELEMENT_LOCAL_NAME = 'EnvironmentAttributeDesignator'
'ResourceMatch' ATTRIBUTE_DESIGNATOR_ELEMENT_LOCAL_NAME = 'ResourceAttributeDesignator' class ActionMatch(MatchBase): "Action match" ELEMENT_LOCAL_NAME = 'ActionMatch' ATTRIBUTE_DESIGNATOR_ELEMENT_LOCAL_NAME = 'ActionAttributeDesignator' class EnvironmentMatch(MatchBase):
63
64
36
7
56
cedadev/ndg_xacml
ndg/xacml/core/match.py
Python
EnvironmentMatch
EnvironmentMatch
368
371
368
368
90185447297f29842d2301176fbdad5b800b1be5
bigcode/the-stack
train
de73d0f9fd8fe0a198b3b862
train
function
@pytest.mark.unit def test_setInputs_reaction_block(rxn_prop): assert degrees_of_freedom(rxn_prop.fs.unit) == 0
@pytest.mark.unit def test_setInputs_reaction_block(rxn_prop):
assert degrees_of_freedom(rxn_prop.fs.unit) == 0
.k_rxn, Var) assert isinstance(rxn_prop.fs.unit.OC_conv, Var) assert isinstance(rxn_prop.fs.unit.OC_conv_temp, Var) assert isinstance(rxn_prop.fs.unit.reaction_rate, Var) @pytest.mark.unit def test_setInputs_reaction_block(rxn_prop):
64
64
32
15
49
eslickj/idaes-pse
idaes/gas_solid_contactors/properties/oxygen_iron_OC_oxidation/tests/test_CLC_rxn_prop.py
Python
test_setInputs_reaction_block
test_setInputs_reaction_block
93
95
93
94
0bc61d3e59cf44e3bd2ff3c5d3c6fe2a4ee37356
bigcode/the-stack
train
10c8ae5b164e417454759b3f
train
function
@pytest.mark.unit def test_build_reaction_block(rxn_prop): assert isinstance(rxn_prop.fs.unit.k_rxn, Var) assert isinstance(rxn_prop.fs.unit.OC_conv, Var) assert isinstance(rxn_prop.fs.unit.OC_conv_temp, Var) assert isinstance(rxn_prop.fs.unit.reaction_rate, Var)
@pytest.mark.unit def test_build_reaction_block(rxn_prop):
assert isinstance(rxn_prop.fs.unit.k_rxn, Var) assert isinstance(rxn_prop.fs.unit.OC_conv, Var) assert isinstance(rxn_prop.fs.unit.OC_conv_temp, Var) assert isinstance(rxn_prop.fs.unit.reaction_rate, Var)
2O3"].fix(0.554) m.fs.solid_state_block.dens_mass_skeletal.fix(3125) m.fs.solid_state_block.temperature.fix(1183.15) # K return m @pytest.mark.unit def test_build_reaction_block(rxn_prop):
64
64
71
14
49
eslickj/idaes-pse
idaes/gas_solid_contactors/properties/oxygen_iron_OC_oxidation/tests/test_CLC_rxn_prop.py
Python
test_build_reaction_block
test_build_reaction_block
85
90
85
86
34a38f4ea17344584b80754fbb61035fb2536d08
bigcode/the-stack
train
5c47d1b1a07c52e339d9f12e
train
function
@pytest.mark.solver @pytest.mark.skipif(solver is None, reason="Solver not available") @pytest.mark.component def test_initialize(rxn_prop): initialization_tester( rxn_prop)
@pytest.mark.solver @pytest.mark.skipif(solver is None, reason="Solver not available") @pytest.mark.component def test_initialize(rxn_prop):
initialization_tester( rxn_prop)
) @pytest.mark.unit def test_setInputs_reaction_block(rxn_prop): assert degrees_of_freedom(rxn_prop.fs.unit) == 0 @pytest.mark.solver @pytest.mark.skipif(solver is None, reason="Solver not available") @pytest.mark.component def test_initialize(rxn_prop):
64
64
41
31
32
eslickj/idaes-pse
idaes/gas_solid_contactors/properties/oxygen_iron_OC_oxidation/tests/test_CLC_rxn_prop.py
Python
test_initialize
test_initialize
98
103
98
101
a13bdb77bdce4645bf45dd095236afe064b1fd74
bigcode/the-stack
train
b1d367fe4bc51e2ad58831ee
train
function
@pytest.fixture(scope="class") def rxn_prop(): m = ConcreteModel() m.fs = FlowsheetBlock(default={"dynamic": False}) # Set up thermo props and reaction props m.fs.solid_properties = SolidPhaseParameterBlock() m.fs.solid_state_block = m.fs.solid_properties.build_state_block( default={"parame...
@pytest.fixture(scope="class") def rxn_prop():
m = ConcreteModel() m.fs = FlowsheetBlock(default={"dynamic": False}) # Set up thermo props and reaction props m.fs.solid_properties = SolidPhaseParameterBlock() m.fs.solid_state_block = m.fs.solid_properties.build_state_block( default={"parameters": m.fs.solid_properties, ...
) from idaes.gas_solid_contactors.properties.oxygen_iron_OC_oxidation. \ gas_phase_thermo import GasPhaseParameterBlock from idaes.gas_solid_contactors.properties.oxygen_iron_OC_oxidation. \ solid_phase_thermo import SolidPhaseParameterBlock from idaes.gas_solid_contactors.properties.oxygen_iron_OC_oxidation. ...
125
125
417
11
114
eslickj/idaes-pse
idaes/gas_solid_contactors/properties/oxygen_iron_OC_oxidation/tests/test_CLC_rxn_prop.py
Python
rxn_prop
rxn_prop
45
82
45
46
af1a2a306509cc336d993b5106154007c46443ec
bigcode/the-stack
train
6439c3d8b26706c6e8abb661
train
function
@pytest.mark.solver @pytest.mark.skipif(solver is None, reason="Solver not available") @pytest.mark.component def test_solve(rxn_prop): assert hasattr(rxn_prop.fs.unit, "k_rxn") assert hasattr(rxn_prop.fs.unit, "OC_conv") assert hasattr(rxn_prop.fs.unit, "reaction_rate") results = solver.solve(rxn_pro...
@pytest.mark.solver @pytest.mark.skipif(solver is None, reason="Solver not available") @pytest.mark.component def test_solve(rxn_prop):
assert hasattr(rxn_prop.fs.unit, "k_rxn") assert hasattr(rxn_prop.fs.unit, "OC_conv") assert hasattr(rxn_prop.fs.unit, "reaction_rate") results = solver.solve(rxn_prop.fs.unit) # Check for optimal solution assert results.solver.termination_condition == \ TerminationCondition.optimal ...
(solver is None, reason="Solver not available") @pytest.mark.component def test_initialize(rxn_prop): initialization_tester( rxn_prop) @pytest.mark.solver @pytest.mark.skipif(solver is None, reason="Solver not available") @pytest.mark.component def test_solve(rxn_prop):
64
64
118
32
32
eslickj/idaes-pse
idaes/gas_solid_contactors/properties/oxygen_iron_OC_oxidation/tests/test_CLC_rxn_prop.py
Python
test_solve
test_solve
106
120
106
110
4e964be6e55f2697d8327226962c97a087182dca
bigcode/the-stack
train
f8df944efd5c60a0e3e00000
train
function
@pytest.mark.solver @pytest.mark.skipif(solver is None, reason="Solver not available") @pytest.mark.component def test_solution(rxn_prop): assert (pytest.approx(1, abs=1e-2) == rxn_prop.fs.unit.k_rxn['R1'].value) assert (pytest.approx(0, abs=1e-2) == rxn_prop.fs.unit.OC_conv.value) a...
@pytest.mark.solver @pytest.mark.skipif(solver is None, reason="Solver not available") @pytest.mark.component def test_solution(rxn_prop):
assert (pytest.approx(1, abs=1e-2) == rxn_prop.fs.unit.k_rxn['R1'].value) assert (pytest.approx(0, abs=1e-2) == rxn_prop.fs.unit.OC_conv.value) assert (pytest.approx(0, abs=1e-2) == rxn_prop.fs.unit.reaction_rate['R1'].value)
Check for optimal solution assert results.solver.termination_condition == \ TerminationCondition.optimal assert results.solver.status == SolverStatus.ok @pytest.mark.solver @pytest.mark.skipif(solver is None, reason="Solver not available") @pytest.mark.component def test_solution(rxn_prop):
64
64
123
31
32
eslickj/idaes-pse
idaes/gas_solid_contactors/properties/oxygen_iron_OC_oxidation/tests/test_CLC_rxn_prop.py
Python
test_solution
test_solution
123
132
123
126
f39a6d22aea2897258f3d0094bb6e26874a6c1d1
bigcode/the-stack
train
6d04ddf33f442e358693c78a
train
class
@attr_extensions.with_copy @attr.define(kw_only=True, repr=False, weakref_slot=False) class _GuildChannelFields: id: snowflakes.Snowflake = attr.field() name: typing.Optional[str] = attr.field() type: typing.Union[channel_models.ChannelType, int] = attr.field() guild_id: snowflakes.Snowflake = attr.fiel...
@attr_extensions.with_copy @attr.define(kw_only=True, repr=False, weakref_slot=False) class _GuildChannelFields:
id: snowflakes.Snowflake = attr.field() name: typing.Optional[str] = attr.field() type: typing.Union[channel_models.ChannelType, int] = attr.field() guild_id: snowflakes.Snowflake = attr.field() position: int = attr.field() permission_overwrites: typing.Dict[snowflakes.Snowflake, channel_models....
0 else None def _deserialize_max_age(seconds: int) -> typing.Optional[datetime.timedelta]: return datetime.timedelta(seconds=seconds) if seconds > 0 else None @attr_extensions.with_copy @attr.define(kw_only=True, repr=False, weakref_slot=False) class _GuildChannelFields:
64
64
144
28
35
Shinobou/hikari
hikari/impl/entity_factory.py
Python
_GuildChannelFields
_GuildChannelFields
99
109
99
101
16998dbe6fdeac701d718699aaa3ec8b56705ec2
bigcode/the-stack
train
31164f355e090c43ab72eff9
train
function
def _with_int_cast(cast: typing.Callable[[int], _ValueT]) -> typing.Callable[[typing.Any], _ValueT]: """Wrap a cast to ensure the value passed to it will first be cast to int.""" return lambda value: cast(int(value))
def _with_int_cast(cast: typing.Callable[[int], _ValueT]) -> typing.Callable[[typing.Any], _ValueT]:
"""Wrap a cast to ensure the value passed to it will first be cast to int.""" return lambda value: cast(int(value))
snowflakes.Snowflake, commands.OptionType.ROLE: snowflakes.Snowflake, commands.OptionType.MENTIONABLE: snowflakes.Snowflake, } def _with_int_cast(cast: typing.Callable[[int], _ValueT]) -> typing.Callable[[typing.Any], _ValueT]:
64
64
58
30
34
Shinobou/hikari
hikari/impl/entity_factory.py
Python
_with_int_cast
_with_int_cast
78
80
78
78
36c304131092506d6c142685611c87bbbd154c09
bigcode/the-stack
train
fd11b48c27a6dde93e9c6325
train
class
@attr_extensions.with_copy @attr.define(kw_only=True, repr=False, weakref_slot=False) class _GuildFields: id: snowflakes.Snowflake = attr.field() name: str = attr.field() icon_hash: str = attr.field() features: typing.List[typing.Union[guild_models.GuildFeature, str]] = attr.field() splash_hash: typ...
@attr_extensions.with_copy @attr.define(kw_only=True, repr=False, weakref_slot=False) class _GuildFields:
id: snowflakes.Snowflake = attr.field() name: str = attr.field() icon_hash: str = attr.field() features: typing.List[typing.Union[guild_models.GuildFeature, str]] = attr.field() splash_hash: typing.Optional[str] = attr.field() discovery_splash_hash: typing.Optional[str] = attr.field() owner_...
attr.field() is_nsfw: typing.Optional[bool] = attr.field() parent_id: typing.Optional[snowflakes.Snowflake] = attr.field() @attr_extensions.with_copy @attr.define(kw_only=True, repr=False, weakref_slot=False) class _IntegrationFields: id: snowflakes.Snowflake = attr.field() name: str = attr.field() ...
140
140
467
27
113
Shinobou/hikari
hikari/impl/entity_factory.py
Python
_GuildFields
_GuildFields
121
151
121
123
dbca3abb80669c8702ef92ddc52dd8675cb73a16
bigcode/the-stack
train
f6c3fe98f64b0dad390f574a
train
function
def _deserialize_day_timedelta(days: typing.Union[str, int]) -> datetime.timedelta: return datetime.timedelta(days=int(days))
def _deserialize_day_timedelta(days: typing.Union[str, int]) -> datetime.timedelta:
return datetime.timedelta(days=int(days))
to it will first be cast to int.""" return lambda value: cast(int(value)) def _deserialize_seconds_timedelta(seconds: typing.Union[str, int]) -> datetime.timedelta: return datetime.timedelta(seconds=int(seconds)) def _deserialize_day_timedelta(days: typing.Union[str, int]) -> datetime.timedelta:
64
64
27
19
45
Shinobou/hikari
hikari/impl/entity_factory.py
Python
_deserialize_day_timedelta
_deserialize_day_timedelta
87
88
87
87
d23b6309d281f576d2eeb48c546a9f1ce32f65c8
bigcode/the-stack
train
3d5de27f297281a32af5c57f
train
function
def _deserialize_max_age(seconds: int) -> typing.Optional[datetime.timedelta]: return datetime.timedelta(seconds=seconds) if seconds > 0 else None
def _deserialize_max_age(seconds: int) -> typing.Optional[datetime.timedelta]:
return datetime.timedelta(seconds=seconds) if seconds > 0 else None
imedelta(days: typing.Union[str, int]) -> datetime.timedelta: return datetime.timedelta(days=int(days)) def _deserialize_max_uses(age: int) -> typing.Optional[int]: return age if age > 0 else None def _deserialize_max_age(seconds: int) -> typing.Optional[datetime.timedelta]:
64
64
32
16
47
Shinobou/hikari
hikari/impl/entity_factory.py
Python
_deserialize_max_age
_deserialize_max_age
95
96
95
95
21b9388979993854efc9e7ee3d1ded7e72f1f23e
bigcode/the-stack
train
c6d7acbd77afac490c4a788f
train
function
def _deserialize_max_uses(age: int) -> typing.Optional[int]: return age if age > 0 else None
def _deserialize_max_uses(age: int) -> typing.Optional[int]:
return age if age > 0 else None
imedelta(seconds: typing.Union[str, int]) -> datetime.timedelta: return datetime.timedelta(seconds=int(seconds)) def _deserialize_day_timedelta(days: typing.Union[str, int]) -> datetime.timedelta: return datetime.timedelta(days=int(days)) def _deserialize_max_uses(age: int) -> typing.Optional[int]:
64
64
26
15
49
Shinobou/hikari
hikari/impl/entity_factory.py
Python
_deserialize_max_uses
_deserialize_max_uses
91
92
91
91
a935bf0edf7a23621a2b612ef95b1efcb257f6db
bigcode/the-stack
train
7f505740830365de7b3619d7
train
class
@attr_extensions.with_copy @attr.define(kw_only=True, repr=False, weakref_slot=False) class _IntegrationFields: id: snowflakes.Snowflake = attr.field() name: str = attr.field() type: typing.Union[guild_models.IntegrationType, str] = attr.field() account: guild_models.IntegrationAccount = attr.field()
@attr_extensions.with_copy @attr.define(kw_only=True, repr=False, weakref_slot=False) class _IntegrationFields:
id: snowflakes.Snowflake = attr.field() name: str = attr.field() type: typing.Union[guild_models.IntegrationType, str] = attr.field() account: guild_models.IntegrationAccount = attr.field()
] = attr.field() is_nsfw: typing.Optional[bool] = attr.field() parent_id: typing.Optional[snowflakes.Snowflake] = attr.field() @attr_extensions.with_copy @attr.define(kw_only=True, repr=False, weakref_slot=False) class _IntegrationFields:
64
64
78
27
37
Shinobou/hikari
hikari/impl/entity_factory.py
Python
_IntegrationFields
_IntegrationFields
112
118
112
114
2bf29465407f9770d88a963eae3204285ddf7801
bigcode/the-stack
train
f8ae8f4d70b2910da0055d6d
train
class
class EntityFactoryImpl(entity_factory.EntityFactory): """Standard implementation for a serializer/deserializer. This will convert objects to/from JSON compatible representations. """ __slots__: typing.Sequence[str] = ( "_app", "_audit_log_entry_converters", "_audit_log_event_m...
class EntityFactoryImpl(entity_factory.EntityFactory):
"""Standard implementation for a serializer/deserializer. This will convert objects to/from JSON compatible representations. """ __slots__: typing.Sequence[str] = ( "_app", "_audit_log_entry_converters", "_audit_log_event_mapping", "_command_mapping", "_componen...
.field() guild_id: typing.Optional[snowflakes.Snowflake] = attr.field() channel: typing.Optional[channel_models.PartialChannel] = attr.field() channel_id: snowflakes.Snowflake = attr.field() inviter: typing.Optional[user_models.User] = attr.field() target_user: typing.Optional[user_models.User] = at...
256
256
26,521
9
247
Shinobou/hikari
hikari/impl/entity_factory.py
Python
EntityFactoryImpl
EntityFactoryImpl
183
3,054
183
183
41b57d46e8ceff54fc067e53cfb96ec826eaa55d
bigcode/the-stack
train
9f2d0eae1b3cd00ae368916e
train
class
@attr_extensions.with_copy @attr.define(kw_only=True, repr=False, weakref_slot=False) class _UserFields: id: snowflakes.Snowflake = attr.field() discriminator: str = attr.field() username: str = attr.field() avatar_hash: str = attr.field() banner_hash: typing.Optional[str] = attr.field() accent_...
@attr_extensions.with_copy @attr.define(kw_only=True, repr=False, weakref_slot=False) class _UserFields:
id: snowflakes.Snowflake = attr.field() discriminator: str = attr.field() username: str = attr.field() avatar_hash: str = attr.field() banner_hash: typing.Optional[str] = attr.field() accent_color: typing.Optional[color_models.Color] = attr.field() is_bot: bool = attr.field() is_system: ...
Type, int, None] = attr.field() approximate_active_member_count: typing.Optional[int] = attr.field() approximate_member_count: typing.Optional[int] = attr.field() @attr_extensions.with_copy @attr.define(kw_only=True, repr=False, weakref_slot=False) class _UserFields:
64
64
108
27
37
Shinobou/hikari
hikari/impl/entity_factory.py
Python
_UserFields
_UserFields
170
180
170
172
003cc4f003ae3e219d398f10936f724d76387689
bigcode/the-stack
train
99a8c01c0f8e4d4fb3f11b91
train
class
@attr_extensions.with_copy @attr.define(kw_only=True, repr=False, weakref_slot=False) class _InviteFields: code: str = attr.field() guild: typing.Optional[invite_models.InviteGuild] = attr.field() guild_id: typing.Optional[snowflakes.Snowflake] = attr.field() channel: typing.Optional[channel_models.Part...
@attr_extensions.with_copy @attr.define(kw_only=True, repr=False, weakref_slot=False) class _InviteFields:
code: str = attr.field() guild: typing.Optional[invite_models.InviteGuild] = attr.field() guild_id: typing.Optional[snowflakes.Snowflake] = attr.field() channel: typing.Optional[channel_models.PartialChannel] = attr.field() channel_id: snowflakes.Snowflake = attr.field() inviter: typing.Optional...
.field() public_updates_channel_id: typing.Optional[snowflakes.Snowflake] = attr.field() nsfw_level: guild_models.GuildNSFWLevel = attr.field() @attr_extensions.with_copy @attr.define(kw_only=True, repr=False, weakref_slot=False) class _InviteFields:
64
64
188
27
37
Shinobou/hikari
hikari/impl/entity_factory.py
Python
_InviteFields
_InviteFields
154
167
154
156
38b8e199c5b511e73f49b4c3531e5c5d0e2bfb27
bigcode/the-stack
train
46ace5de66888069469e55fb
train
function
def _deserialize_seconds_timedelta(seconds: typing.Union[str, int]) -> datetime.timedelta: return datetime.timedelta(seconds=int(seconds))
def _deserialize_seconds_timedelta(seconds: typing.Union[str, int]) -> datetime.timedelta:
return datetime.timedelta(seconds=int(seconds))
], _ValueT]) -> typing.Callable[[typing.Any], _ValueT]: """Wrap a cast to ensure the value passed to it will first be cast to int.""" return lambda value: cast(int(value)) def _deserialize_seconds_timedelta(seconds: typing.Union[str, int]) -> datetime.timedelta:
64
64
27
19
45
Shinobou/hikari
hikari/impl/entity_factory.py
Python
_deserialize_seconds_timedelta
_deserialize_seconds_timedelta
83
84
83
83
07c438bdf851a2a8167f09e6c819fccd6ab1e238
bigcode/the-stack
train
ff30853f2a9b2d1f602653bd
train
function
def create_car(con, year, make, model, engine, eng_oil_wgt='', eng_oil_cap='', drain_plug_tq='', m_trans1_oil_wgt='', m_trans1_oil_cap='', m_trans2_oil_wgt='', m_trans2_oil_cap='', m_trans3_oil_wgt='', m_trans3_oil_cap='', a_trans1_oil_wgt='', a_trans1_oil_cap='', a_trans2_oil_wgt='', a_trans2_...
def create_car(con, year, make, model, engine, eng_oil_wgt='', eng_oil_cap='', drain_plug_tq='', m_trans1_oil_wgt='', m_trans1_oil_cap='', m_trans2_oil_wgt='', m_trans2_oil_cap='', m_trans3_oil_wgt='', m_trans3_oil_cap='', a_trans1_oil_wgt='', a_trans1_oil_cap='', a_trans2_oil_wgt='', a_trans2_...
sql = """ INSERT INTO cars (year, make, model, engine, eng_oil_wgt, eng_oil_cap, drain_plug_tq, m_trans1_oil_wgt, m_trans1_oil_cap, m_trans2_oil_wgt, m_trans2_oil_cap, m_trans3_oil_wgt, m_trans3_oil_cap, a_trans1_oil_wgt, a_trans1_oil_cap, a_trans2_oil_wgt, a_trans2_oil_cap, ...
def create_car(con, year, make, model, engine, eng_oil_wgt='', eng_oil_cap='', drain_plug_tq='', m_trans1_oil_wgt='', m_trans1_oil_cap='', m_trans2_oil_wgt='', m_trans2_oil_cap='', m_trans3_oil_wgt='', m_trans3_oil_cap='', a_trans1_oil_wgt='', a_trans1_oil_cap='', a_trans2_oil_wgt='', a_trans2_...
261
165
553
261
0
stephanGarland/oil_scraper
amsoil_db_utils.py
Python
create_car
create_car
16
50
16
30
7cb4fc0cf20d841febbca901bb4a9f2778df835f
bigcode/the-stack
train
38144bc24f280f59cd674afc
train
function
def db_connect(db_path=DEFAULT_PATH): con = sqlite3.connect(db_path) return con
def db_connect(db_path=DEFAULT_PATH):
con = sqlite3.connect(db_path) return con
# amsoil_db_utils.py # credit to http://stackabuse.com/a-sqlite-tutorial-with-python/ import os import sqlite3 DEFAULT_PATH = os.path.join(os.path.dirname(__file__), 'amsoil_database.sqlite3') def db_connect(db_path=DEFAULT_PATH):
61
64
23
10
51
stephanGarland/oil_scraper
amsoil_db_utils.py
Python
db_connect
db_connect
9
11
9
9
0ffbec9fc523ea8f7f7f75ea05b38371fa95f511
bigcode/the-stack
train
5aa2668079bb3822516d9dbe
train
function
def add_common_locales(features, lit_config, is_windows=False): # A list of locales needed by the test-suite. # The list uses the canonical name for the locale used in the test-suite # TODO: On Linux ISO8859 *may* needs to hyphenated. locales = [ ('en_US.UTF-8', 'English_United States.1252'), ...
def add_common_locales(features, lit_config, is_windows=False): # A list of locales needed by the test-suite. # The list uses the canonical name for the locale used in the test-suite # TODO: On Linux ISO8859 *may* needs to hyphenated.
locales = [ ('en_US.UTF-8', 'English_United States.1252'), ('fr_FR.UTF-8', 'French_France.1252'), ('ru_RU.UTF-8', 'Russian_Russia.1251'), ('zh_CN.UTF-8', 'Chinese_China.936'), ('fr_CA.ISO8859-1', 'French_Canada.1252'), ('cs_CZ.ISO8859-2', 'Czech_Czech Republic.1250') ...
finally: locale.setlocale(locale.LC_ALL, default_locale) def add_common_locales(features, lit_config, is_windows=False): # A list of locales needed by the test-suite. # The list uses the canonical name for the locale used in the test-suite # TODO: On Linux ISO8859 *may* needs to hyphenated.
76
76
254
61
15
vlaza/openenclave
3rdparty/libcxx/libcxx/utils/libcxx/test/target_info.py
Python
add_common_locales
add_common_locales
49
68
49
52
9bf8d882dc04089191c81d3387a851083356158c
bigcode/the-stack
train
16c8237eb0337eaa23fbe8af
train
class
class LinuxLocalTI(DefaultTargetInfo): def __init__(self, full_config): super(LinuxLocalTI, self).__init__(full_config) def platform(self): return 'linux' def platform_name(self): name, _, _ = platform.linux_distribution() # Some distros have spaces, e.g. 'SUSE Linux Enterp...
class LinuxLocalTI(DefaultTargetInfo):
def __init__(self, full_config): super(LinuxLocalTI, self).__init__(full_config) def platform(self): return 'linux' def platform_name(self): name, _, _ = platform.linux_distribution() # Some distros have spaces, e.g. 'SUSE Linux Enterprise Server' # lit features can...
X. # However __cxa_throw_bad_new_array_length doesn't get exported into # libc++ yet so we still need to explicitly link libc++abi when testing # libc++abi # See PR22654. if(self.full_config.get_lit_conf('name', '') == 'libc++abi'): return True # Don't link l...
202
202
674
8
194
vlaza/openenclave
3rdparty/libcxx/libcxx/utils/libcxx/test/target_info.py
Python
LinuxLocalTI
LinuxLocalTI
184
253
184
184
3f27e1fa6499fb4086f15e0c65ba9cdcbe67175c
bigcode/the-stack
train
25fdd15fbc02672a7d143b49
train
function
def test_locale(loc): assert loc is not None default_locale = locale.setlocale(locale.LC_ALL) try: locale.setlocale(locale.LC_ALL, loc) return True except locale.Error: return False finally: locale.setlocale(locale.LC_ALL, default_locale)
def test_locale(loc):
assert loc is not None default_locale = locale.setlocale(locale.LC_ALL) try: locale.setlocale(locale.LC_ALL, loc) return True except locale.Error: return False finally: locale.setlocale(locale.LC_ALL, default_locale)
xx_link_flags(self, flags): pass def configure_env(self, env): pass def allow_cxxabi_link(self): return True def add_sanitizer_features(self, sanitizer_type, features): pass def use_lit_shell_default(self): return False def test_locale(loc):
64
64
66
5
58
vlaza/openenclave
3rdparty/libcxx/libcxx/utils/libcxx/test/target_info.py
Python
test_locale
test_locale
37
46
37
37
bad6699daf08da8eb23e59312a8e0354ea7f2ae2
bigcode/the-stack
train
4829bbd4552b57f1c4c3fba7
train
class
class DarwinLocalTI(DefaultTargetInfo): def __init__(self, full_config): super(DarwinLocalTI, self).__init__(full_config) def is_host_macosx(self): name = subprocess.check_output(['sw_vers', '-productName']).strip() return name == "Mac OS X" def get_macosx_version(self): as...
class DarwinLocalTI(DefaultTargetInfo):
def __init__(self, full_config): super(DarwinLocalTI, self).__init__(full_config) def is_host_macosx(self): name = subprocess.check_output(['sw_vers', '-productName']).strip() return name == "Mac OS X" def get_macosx_version(self): assert self.is_host_macosx() versi...
, lit_config, is_windows=False): # A list of locales needed by the test-suite. # The list uses the canonical name for the locale used in the test-suite # TODO: On Linux ISO8859 *may* needs to hyphenated. locales = [ ('en_US.UTF-8', 'English_United States.1252'), ('fr_FR.UTF-8', 'French_F...
256
256
915
8
248
vlaza/openenclave
3rdparty/libcxx/libcxx/utils/libcxx/test/target_info.py
Python
DarwinLocalTI
DarwinLocalTI
71
170
71
71
93e8f927600f5d85407411179dbc9634b4ad9fa5
bigcode/the-stack
train
25a3cd4d4d701cf120e9be16
train
function
def make_target_info(full_config): default = "libcxx.test.target_info.LocalTI" info_str = full_config.get_lit_conf('target_info', default) if info_str != default: mod_path, _, info = info_str.rpartition('.') mod = importlib.import_module(mod_path) target_info = getattr(mod, info)(ful...
def make_target_info(full_config):
default = "libcxx.test.target_info.LocalTI" info_str = full_config.get_lit_conf('target_info', default) if info_str != default: mod_path, _, info = info_str.rpartition('.') mod = importlib.import_module(mod_path) target_info = getattr(mod, info)(full_config) full_config.lit_c...
, features): add_common_locales(features, self.full_config.lit_config, is_windows=True) def use_lit_shell_default(self): # Default to the internal shell on Windows, as bash on Windows is # usually very slow. return True def make_target_info(full_config):
64
64
184
7
56
vlaza/openenclave
3rdparty/libcxx/libcxx/utils/libcxx/test/target_info.py
Python
make_target_info
make_target_info
270
284
270
270
8e44dec2ec627f67f7a5bdee9367019163964279
bigcode/the-stack
train
413d5df3d9f4811d0868a0ff
train
class
class FreeBSDLocalTI(DefaultTargetInfo): def __init__(self, full_config): super(FreeBSDLocalTI, self).__init__(full_config) def add_locale_features(self, features): add_common_locales(features, self.full_config.lit_config) def add_cxx_link_flags(self, flags): flags += ['-lc', '-lm'...
class FreeBSDLocalTI(DefaultTargetInfo):
def __init__(self, full_config): super(FreeBSDLocalTI, self).__init__(full_config) def add_locale_features(self, features): add_common_locales(features, self.full_config.lit_config) def add_cxx_link_flags(self, flags): flags += ['-lc', '-lm', '-lpthread', '-lgcc_s', '-lcxxrt']
54. if(self.full_config.get_lit_conf('name', '') == 'libc++abi'): return True # Don't link libc++abi explicitly on OS X because the symbols # should be available in libc++ directly. return False class FreeBSDLocalTI(DefaultTargetInfo):
64
64
92
9
54
vlaza/openenclave
3rdparty/libcxx/libcxx/utils/libcxx/test/target_info.py
Python
FreeBSDLocalTI
FreeBSDLocalTI
173
181
173
173
018e398474d8df973f2a1470a5abcd3a386ba420
bigcode/the-stack
train