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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
664b3e726681991dc3fbf170 | train | function | @pytest.fixture
def inventory_factory(organization):
def factory(name, org=organization):
try:
inv = Inventory.objects.get(name=name, organization=org)
except Inventory.DoesNotExist:
inv = Inventory.objects.create(name=name, organization=org)
return inv
return fac... | @pytest.fixture
def inventory_factory(organization):
| def factory(name, org=organization):
try:
inv = Inventory.objects.get(name=name, organization=org)
except Inventory.DoesNotExist:
inv = Inventory.objects.create(name=name, organization=org)
return inv
return factory
| _path='inventory_file',
update_on_project_update=True,
inventory=inventory,
scm_last_revision=project.scm_revision)
with mock.patch('awx.main.models.unified_jobs.UnifiedJobTemplate.update'):
inv_src.save()
return inv_src
@pytest.fixture
def inventory_factory(organization):
| 64 | 64 | 62 | 9 | 54 | gitEdouble/awx | awx/main/tests/functional/conftest.py | Python | inventory_factory | inventory_factory | 336 | 344 | 336 | 337 | 7c0e9dbcce2feb198b02eb84a897c740a174f80d | bigcode/the-stack | train |
277a8b168cbb8dde094bc062 | train | function | @pytest.fixture
def scm_inventory_source(inventory, project):
inv_src = InventorySource(
name="test-scm-inv",
source_project=project,
source='scm',
source_path='inventory_file',
update_on_project_update=True,
inventory=inventory,
scm_last_revision=project.scm_... | @pytest.fixture
def scm_inventory_source(inventory, project):
| inv_src = InventorySource(
name="test-scm-inv",
source_project=project,
source='scm',
source_path='inventory_file',
update_on_project_update=True,
inventory=inventory,
scm_last_revision=project.scm_revision)
with mock.patch('awx.main.models.unified_jobs.Un... | organization=organization)
@pytest.fixture
def inventory(organization):
return organization.inventories.create(name="test-inv")
@pytest.fixture
def insights_inventory(inventory):
inventory.scm_type = 'insights'
inventory.save()
return inventory
@pytest.fixture
def scm_inventory_source(inventory, pr... | 64 | 64 | 97 | 12 | 51 | gitEdouble/awx | awx/main/tests/functional/conftest.py | Python | scm_inventory_source | scm_inventory_source | 321 | 333 | 321 | 322 | a32a4341ead36e6a0f13e7284cde789f8b18f5d9 | bigcode/the-stack | train |
5f01903e50f7844e436461bb | train | function | @pytest.fixture
def credentialtype_insights():
insights_type = CredentialType.defaults['insights']()
insights_type.save()
return insights_type
| @pytest.fixture
def credentialtype_insights():
| insights_type = CredentialType.defaults['insights']()
insights_type.save()
return insights_type
| _vault():
vault_type = CredentialType.defaults['vault']()
vault_type.save()
return vault_type
@pytest.fixture
def credentialtype_scm():
scm_type = CredentialType.defaults['scm']()
scm_type.save()
return scm_type
@pytest.fixture
def credentialtype_insights():
| 64 | 64 | 31 | 9 | 54 | gitEdouble/awx | awx/main/tests/functional/conftest.py | Python | credentialtype_insights | credentialtype_insights | 259 | 263 | 259 | 260 | d2e9d37867e00349ef6c57da575d9b23cf0e45f8 | bigcode/the-stack | train |
98ae78c2f3e3105356b847f1 | train | function | @pytest.fixture
def vault_credential(credentialtype_vault):
return Credential.objects.create(credential_type=credentialtype_vault, name='test-cred',
inputs={'vault_password': 'secret'})
| @pytest.fixture
def vault_credential(credentialtype_vault):
| return Credential.objects.create(credential_type=credentialtype_vault, name='test-cred',
inputs={'vault_password': 'secret'})
| ': 'secret'})
@pytest.fixture
def net_credential(credentialtype_net):
return Credential.objects.create(credential_type=credentialtype_net, name='test-cred',
inputs={'username': 'something', 'password': 'secret'})
@pytest.fixture
def vault_credential(credentialtype_vault):
| 63 | 64 | 42 | 13 | 50 | gitEdouble/awx | awx/main/tests/functional/conftest.py | Python | vault_credential | vault_credential | 278 | 281 | 278 | 279 | 4580edc1323697b5a09c606b92060a2be63918c4 | bigcode/the-stack | train |
76f10cf54d0297df0e0c40ff | train | function | @pytest.fixture
def organization(instance):
return Organization.objects.create(name="test-org", description="test-org-desc")
| @pytest.fixture
def organization(instance):
| return Organization.objects.create(name="test-org", description="test-org-desc")
| test-user-project-desc")
@pytest.fixture
def insights_project():
return Project.objects.create(name="test-insights-project", scm_type="insights")
@pytest.fixture
def instance(settings):
return Instance.objects.create(uuid=settings.SYSTEM_UUID, hostname="instance.example.org", capacity=100)
@pytest.fixture
d... | 64 | 64 | 23 | 7 | 57 | gitEdouble/awx | awx/main/tests/functional/conftest.py | Python | organization | organization | 219 | 221 | 219 | 220 | 7d4f34c5dd49ebc372faffa2165328a547efed22 | bigcode/the-stack | train |
e85d4891b6ed0e4bbf3cd083 | train | function | @pytest.fixture
def credentialtype_scm():
scm_type = CredentialType.defaults['scm']()
scm_type.save()
return scm_type
| @pytest.fixture
def credentialtype_scm():
| scm_type = CredentialType.defaults['scm']()
scm_type.save()
return scm_type
| .fixture
def credentialtype_net():
net = CredentialType.defaults['net']()
net.save()
return net
@pytest.fixture
def credentialtype_vault():
vault_type = CredentialType.defaults['vault']()
vault_type.save()
return vault_type
@pytest.fixture
def credentialtype_scm():
| 64 | 64 | 31 | 9 | 54 | gitEdouble/awx | awx/main/tests/functional/conftest.py | Python | credentialtype_scm | credentialtype_scm | 252 | 256 | 252 | 253 | 772dae3107c736d7b0ab9238499f2dfa46cc6b02 | bigcode/the-stack | train |
03bd4017cab34a58f3c6d49e | train | function | @pytest.fixture
def organizations(instance):
def rf(organization_count=1):
orgs = []
for i in xrange(0, organization_count):
o = Organization.objects.create(name="test-org-%d" % i, description="test-org-desc")
orgs.append(o)
return orgs
return rf
| @pytest.fixture
def organizations(instance):
| def rf(organization_count=1):
orgs = []
for i in xrange(0, organization_count):
o = Organization.objects.create(name="test-org-%d" % i, description="test-org-desc")
orgs.append(o)
return orgs
return rf
| ', False)
organization.auditor_role.members.add(ret)
organization.member_role.members.add(ret)
return ret
@pytest.fixture
def org_member(user, organization):
ret = user('org-member', False)
organization.member_role.members.add(ret)
return ret
@pytest.fixture
def organizations(instance):
| 64 | 64 | 69 | 7 | 56 | gitEdouble/awx | awx/main/tests/functional/conftest.py | Python | organizations | organizations | 436 | 444 | 436 | 437 | 1e92b9bd083165596a7098f05d286677ee3a7af3 | bigcode/the-stack | train |
0da7863411a591f6d6232197 | train | function | @pytest.fixture
def ad_hoc_command_factory(inventory, machine_credential, admin):
def factory(inventory=inventory, credential=machine_credential, initial_state='new', created_by=admin):
adhoc = AdHocCommand(
name='test-adhoc', inventory=inventory, credential=credential,
status=initia... | @pytest.fixture
def ad_hoc_command_factory(inventory, machine_credential, admin):
| def factory(inventory=inventory, credential=machine_credential, initial_state='new', created_by=admin):
adhoc = AdHocCommand(
name='test-adhoc', inventory=inventory, credential=credential,
status=initial_state, created_by=created_by
)
adhoc.save()
return adhoc... | fact_ansible_json():
return _fact_json('ansible')
@pytest.fixture
def fact_packages_json():
return _fact_json('packages')
@pytest.fixture
def fact_services_json():
return _fact_json('services')
@pytest.fixture
def ad_hoc_command_factory(inventory, machine_credential, admin):
| 64 | 64 | 94 | 18 | 46 | gitEdouble/awx | awx/main/tests/functional/conftest.py | Python | ad_hoc_command_factory | ad_hoc_command_factory | 657 | 666 | 657 | 658 | 468ec1bcf5a53a51c667689d6ab7edbcf8a82d25 | bigcode/the-stack | train |
98053caec2c9b5109a55dd4b | train | function | @pytest.fixture
def permissions():
return {
'admin':{'create':True, 'read':True, 'write':True,
'update':True, 'delete':True, 'scm_update':True, 'execute':True, 'use':True,},
'auditor':{'read':True, 'create':False, 'write':False,
'update':False, 'delete':False, 's... | @pytest.fixture
def permissions():
| return {
'admin':{'create':True, 'read':True, 'write':True,
'update':True, 'delete':True, 'scm_update':True, 'execute':True, 'use':True,},
'auditor':{'read':True, 'create':False, 'write':False,
'update':False, 'delete':False, 'scm_update':False, 'execute':False, ... | .fixture
def inventory_script(organization):
return CustomInventoryScript.objects.create(name='test inv script',
organization=organization,
script='#!/usr/bin/python')
@pytest.fixture
def host(group, inventory):
re... | 64 | 64 | 155 | 6 | 58 | gitEdouble/awx | awx/main/tests/functional/conftest.py | Python | permissions | permissions | 515 | 526 | 515 | 516 | 95013738e5f3125aaa17afe98f55cf880755765a | bigcode/the-stack | train |
8d53ccfa8eb7fea9b3b7a00a | train | function | @pytest.fixture
def team_member(user, team):
ret = user('team-member', False)
team.member_role.members.add(ret)
return ret
| @pytest.fixture
def team_member(user, team):
| ret = user('team-member', False)
team.member_role.members.add(ret)
return ret
| job_type='run',
project=project,
inventory=inventory,
name='deploy-job-template'
)
jt.credentials.add(credential)
return jt
@pytest.fixture
def team(organization):
return organization.teams.create(name='test-team')
@pytest.fixture
def team_member(user, team):
| 64 | 64 | 32 | 10 | 54 | gitEdouble/awx | awx/main/tests/functional/conftest.py | Python | team_member | team_member | 122 | 126 | 122 | 123 | 1f7ad1a741dd71dc473e8b6158374a7a1d109cfd | bigcode/the-stack | train |
5e158bcf6cba3e43d0563b09 | train | function | @pytest.fixture
def scm_credential(credentialtype_scm):
return Credential.objects.create(credential_type=credentialtype_scm, name='scm-cred',
inputs={'username': 'optimus', 'password': 'prime'})
| @pytest.fixture
def scm_credential(credentialtype_scm):
| return Credential.objects.create(credential_type=credentialtype_scm, name='scm-cred',
inputs={'username': 'optimus', 'password': 'prime'})
| @pytest.fixture
def machine_credential(credentialtype_ssh):
return Credential.objects.create(credential_type=credentialtype_ssh, name='machine-cred',
inputs={'username': 'test_user', 'password': 'pas4word'})
@pytest.fixture
def scm_credential(credentialtype_scm):
| 63 | 64 | 49 | 13 | 50 | gitEdouble/awx | awx/main/tests/functional/conftest.py | Python | scm_credential | scm_credential | 290 | 293 | 290 | 291 | cef6941125babec9bdabf332c678cb10cac709fb | bigcode/the-stack | train |
5db3f06cb12e6f2ac787088f | train | function | @pytest.fixture
def net_credential(credentialtype_net):
return Credential.objects.create(credential_type=credentialtype_net, name='test-cred',
inputs={'username': 'something', 'password': 'secret'})
| @pytest.fixture
def net_credential(credentialtype_net):
| return Credential.objects.create(credential_type=credentialtype_net, name='test-cred',
inputs={'username': 'something', 'password': 'secret'})
| ()
return insights_type
@pytest.fixture
def credential(credentialtype_aws):
return Credential.objects.create(credential_type=credentialtype_aws, name='test-cred',
inputs={'username': 'something', 'password': 'secret'})
@pytest.fixture
def net_credential(credentialtype_net)... | 63 | 64 | 45 | 12 | 51 | gitEdouble/awx | awx/main/tests/functional/conftest.py | Python | net_credential | net_credential | 272 | 275 | 272 | 273 | 66fdc50bacd1120908b584e3f05cec3206a03d16 | bigcode/the-stack | train |
565df0c34ea9d1eff7e7de58 | train | function | @pytest.fixture
def team(organization):
return organization.teams.create(name='test-team')
| @pytest.fixture
def team(organization):
| return organization.teams.create(name='test-team')
| .fixture
def deploy_jobtemplate(project, inventory, credential):
jt = JobTemplate.objects.create(
job_type='run',
project=project,
inventory=inventory,
name='deploy-job-template'
)
jt.credentials.add(credential)
return jt
@pytest.fixture
def team(organization):
| 64 | 64 | 19 | 8 | 55 | gitEdouble/awx | awx/main/tests/functional/conftest.py | Python | team | team | 117 | 119 | 117 | 118 | 78ae878a9322a21139cf1b04a3a5768acf3e78ee | bigcode/the-stack | train |
ec0515368bc3ded44596c237 | train | function | @pytest.fixture
def fact_services_json():
return _fact_json('services')
| @pytest.fixture
def fact_services_json():
| return _fact_json('services')
| s/%s.json' % (current_dir, module_name)) as f:
return json.load(f)
@pytest.fixture
def fact_ansible_json():
return _fact_json('ansible')
@pytest.fixture
def fact_packages_json():
return _fact_json('packages')
@pytest.fixture
def fact_services_json():
| 64 | 64 | 16 | 8 | 56 | gitEdouble/awx | awx/main/tests/functional/conftest.py | Python | fact_services_json | fact_services_json | 652 | 654 | 652 | 653 | 996a5a4ea588d70af203a2f1d65ebc3de5880403 | bigcode/the-stack | train |
614a71ae223a962795c970fb | train | function | @pytest.fixture
def insights_project():
return Project.objects.create(name="test-insights-project", scm_type="insights")
| @pytest.fixture
def insights_project():
| return Project.objects.create(name="test-insights-project", scm_type="insights")
| description for " + name,
organization=organization)
return t
return factory
@pytest.fixture
def user_project(user):
owner = user('owner')
return Project.objects.create(name="test-user-project", created_by=owner, description="test-user-project-desc")
@pytest.fix... | 64 | 64 | 25 | 7 | 57 | gitEdouble/awx | awx/main/tests/functional/conftest.py | Python | insights_project | insights_project | 209 | 211 | 209 | 210 | e42e0afd022192d0632aef749ae7aa382c3a4bb8 | bigcode/the-stack | train |
b3a7efc5067d29d3350023a3 | train | function | @pytest.fixture
def fact_ansible_json():
return _fact_json('ansible')
| @pytest.fixture
def fact_ansible_json():
| return _fact_json('ansible')
| return facts
return rf
def _fact_json(module_name):
current_dir = os.path.dirname(os.path.realpath(__file__))
with open('%s/%s.json' % (current_dir, module_name)) as f:
return json.load(f)
@pytest.fixture
def fact_ansible_json():
| 64 | 64 | 18 | 9 | 55 | gitEdouble/awx | awx/main/tests/functional/conftest.py | Python | fact_ansible_json | fact_ansible_json | 642 | 644 | 642 | 643 | fa8f378e5b1930b2300173c5c457edb1d94adc8a | bigcode/the-stack | train |
e41b7c2406bf661a9f0837e7 | train | function | @pytest.fixture
def credentialtype_net():
net = CredentialType.defaults['net']()
net.save()
return net
| @pytest.fixture
def credentialtype_net():
| net = CredentialType.defaults['net']()
net.save()
return net
| -desc")
@pytest.fixture
def credentialtype_ssh():
ssh = CredentialType.defaults['ssh']()
ssh.save()
return ssh
@pytest.fixture
def credentialtype_aws():
aws = CredentialType.defaults['aws']()
aws.save()
return aws
@pytest.fixture
def credentialtype_net():
| 64 | 64 | 26 | 8 | 55 | gitEdouble/awx | awx/main/tests/functional/conftest.py | Python | credentialtype_net | credentialtype_net | 238 | 242 | 238 | 239 | 5f3ea9cc7e882cb00c53b5a4d0f4cdd87b1040bb | bigcode/the-stack | train |
c65aa737e5da26d82846cc7c | train | function | @pytest.fixture
def job_template_labels(organization, job_template):
job_template.labels.create(name="label-1", organization=organization)
job_template.labels.create(name="label-2", organization=organization)
return job_template
| @pytest.fixture
def job_template_labels(organization, job_template):
| job_template.labels.create(name="label-1", organization=organization)
job_template.labels.create(name="label-2", organization=organization)
return job_template
| , created_by=created_by
)
adhoc.save()
return adhoc
return factory
@pytest.fixture
def job_template(organization):
jt = JobTemplate(name='test-job_template')
jt.save()
return jt
@pytest.fixture
def job_template_labels(organization, job_template):
| 64 | 64 | 48 | 13 | 50 | gitEdouble/awx | awx/main/tests/functional/conftest.py | Python | job_template_labels | job_template_labels | 677 | 682 | 677 | 678 | e6452684532aca04f10d1e4e1785fc8a276f1103 | bigcode/the-stack | train |
8d7178d5f93300f4128a2adf | train | function | @pytest.fixture
def check_jobtemplate(project, inventory, credential):
jt = JobTemplate.objects.create(
job_type='check',
project=project,
inventory=inventory,
name='check-job-template'
)
jt.credentials.add(credential)
return jt
| @pytest.fixture
def check_jobtemplate(project, inventory, credential):
| jt = JobTemplate.objects.create(
job_type='check',
project=project,
inventory=inventory,
name='check-job-template'
)
jt.credentials.add(credential)
return jt
| try:
user = User.objects.get(username=name)
except User.DoesNotExist:
user = User(username=name, is_superuser=is_superuser)
user.set_password(name)
user.save()
return user
return u
@pytest.fixture
def check_jobtemplate(project, inventory, crede... | 64 | 64 | 57 | 13 | 50 | gitEdouble/awx | awx/main/tests/functional/conftest.py | Python | check_jobtemplate | check_jobtemplate | 93 | 102 | 93 | 94 | 056f84ed0f57762acbb09dbd21418b78a0cd96c2 | bigcode/the-stack | train |
8bdb88637ff26a353d793b2d | train | function | @pytest.fixture
@mock.patch.object(Project, "update", lambda self, **kwargs: None)
def manual_project(instance, organization):
prj = Project.objects.create(name="test-manual-proj",
description="manual-proj-desc",
organization=organization,
... | @pytest.fixture
@mock.patch.object(Project, "update", lambda self, **kwargs: None)
def manual_project(instance, organization):
| prj = Project.objects.create(name="test-manual-proj",
description="manual-proj-desc",
organization=organization,
playbook_files=['helloworld.yml', 'alt-helloworld.yml'],
local_path='_9... | scm_revision='1234567890123456789012345678901234567890',
scm_url='localhost',
scm_type='git'
)
return prj
@pytest.fixture
@mock.patch.object(Project, "update", lambda self, **kwargs: None)
def manual_project(instance... | 64 | 64 | 87 | 27 | 36 | gitEdouble/awx | awx/main/tests/functional/conftest.py | Python | manual_project | manual_project | 156 | 165 | 156 | 158 | 4df22a9f550073f86e279e16e69a58ecfdd3064e | bigcode/the-stack | train |
5e1c0721686aa9340b85b85a | train | function | @pytest.fixture
def inventory_script(organization):
return CustomInventoryScript.objects.create(name='test inv script',
organization=organization,
script='#!/usr/bin/python')
| @pytest.fixture
def inventory_script(organization):
| return CustomInventoryScript.objects.create(name='test inv script',
organization=organization,
script='#!/usr/bin/python')
| :
return inventory.inventory_sources.get(name=name)
except Exception:
return inventory.inventory_sources.create(name=name, source=source)
return invsrc
@pytest.fixture
def inventory_update(inventory_source):
return InventoryUpdate.objects.create(inventory_source=inventory_sourc... | 64 | 64 | 35 | 9 | 55 | gitEdouble/awx | awx/main/tests/functional/conftest.py | Python | inventory_script | inventory_script | 503 | 507 | 503 | 504 | d2b8f6959d2462085f1b5eb798ad7bb0110baae2 | bigcode/the-stack | train |
afb9c18864a342cfa8130003 | train | function | @pytest.fixture
def fact_packages_json():
return _fact_json('packages')
| @pytest.fixture
def fact_packages_json():
| return _fact_json('packages')
| _dir = os.path.dirname(os.path.realpath(__file__))
with open('%s/%s.json' % (current_dir, module_name)) as f:
return json.load(f)
@pytest.fixture
def fact_ansible_json():
return _fact_json('ansible')
@pytest.fixture
def fact_packages_json():
| 64 | 64 | 16 | 8 | 56 | gitEdouble/awx | awx/main/tests/functional/conftest.py | Python | fact_packages_json | fact_packages_json | 647 | 649 | 647 | 648 | 985bb75b949ca1a93b716bcaf594ad1215a8e75e | bigcode/the-stack | train |
2992d527bc94f96ad409a04b | train | function | def get_db_prep_save(self, value, connection, **kwargs):
"""Convert our JSON object to a string before we save"""
if value is None and self.null:
return None
# default values come in as strings; only non-strings should be
# run through `dumps`
if not isinstance(value, six.string_types):
... | def get_db_prep_save(self, value, connection, **kwargs):
| """Convert our JSON object to a string before we save"""
if value is None and self.null:
return None
# default values come in as strings; only non-strings should be
# run through `dumps`
if not isinstance(value, six.string_types):
value = dumps(value)
return value
| encode(value)
# Taken from https://github.com/django-extensions/django-extensions/blob/54fe88df801d289882a79824be92d823ab7be33e/django_extensions/db/fields/json.py
def get_db_prep_save(self, value, connection, **kwargs):
| 64 | 64 | 85 | 15 | 48 | gitEdouble/awx | awx/main/tests/functional/conftest.py | Python | get_db_prep_save | get_db_prep_save | 721 | 730 | 721 | 721 | e9cab32229b7969d1a0cbd6911a0cb0cbbc146f5 | bigcode/the-stack | train |
7a9db4a4e3830a8f1d08fb45 | train | function | @pytest.fixture
def job_template_with_survey_passwords(job_template_with_survey_passwords_factory):
return job_template_with_survey_passwords_factory(persisted=True)
| @pytest.fixture
def job_template_with_survey_passwords(job_template_with_survey_passwords_factory):
| return job_template_with_survey_passwords_factory(persisted=True)
| ):
return Notification.objects.create(notification_template=notification_template,
status='successful',
notifications_sent=1,
notification_type='email',
recipie... | 64 | 64 | 35 | 20 | 44 | gitEdouble/awx | awx/main/tests/functional/conftest.py | Python | job_template_with_survey_passwords | job_template_with_survey_passwords | 380 | 382 | 380 | 381 | ce3ce5f6a60205051100a0d8a99dcf7efd958198 | bigcode/the-stack | train |
eae67d2751b09633ea3f24d1 | train | function | @pytest.fixture
def options():
return _request('options')
| @pytest.fixture
def options():
| return _request('options')
| return _request('get')
@pytest.fixture
def put():
return _request('put')
@pytest.fixture
def patch():
return _request('patch')
@pytest.fixture
def delete():
return _request('delete')
@pytest.fixture
def head():
return _request('head')
@pytest.fixture
def options():
| 64 | 64 | 13 | 6 | 58 | gitEdouble/awx | awx/main/tests/functional/conftest.py | Python | options | options | 608 | 610 | 608 | 609 | 68fbb115bb5bcede80d10ef145c9e68f11a1d11c | bigcode/the-stack | train |
b1b43d7e15db39ed72365b05 | train | function | @pytest.fixture
def patch():
return _request('patch')
| @pytest.fixture
def patch():
| return _request('patch')
| ', None), response.content, kwargs.get('data'))
return response
return rf
@pytest.fixture
def post():
return _request('post')
@pytest.fixture
def get():
return _request('get')
@pytest.fixture
def put():
return _request('put')
@pytest.fixture
def patch():
| 64 | 64 | 13 | 6 | 58 | gitEdouble/awx | awx/main/tests/functional/conftest.py | Python | patch | patch | 593 | 595 | 593 | 594 | d597eb63600a55454fe3acaf87e1a3dc4db0ad24 | bigcode/the-stack | train |
624820abc8f3f696f0ba647a | train | function | @pytest.fixture
def instance(settings):
return Instance.objects.create(uuid=settings.SYSTEM_UUID, hostname="instance.example.org", capacity=100)
| @pytest.fixture
def instance(settings):
| return Instance.objects.create(uuid=settings.SYSTEM_UUID, hostname="instance.example.org", capacity=100)
| (user):
owner = user('owner')
return Project.objects.create(name="test-user-project", created_by=owner, description="test-user-project-desc")
@pytest.fixture
def insights_project():
return Project.objects.create(name="test-insights-project", scm_type="insights")
@pytest.fixture
def instance(settings):
| 64 | 64 | 27 | 7 | 57 | gitEdouble/awx | awx/main/tests/functional/conftest.py | Python | instance | instance | 214 | 216 | 214 | 215 | 16698174639534a5c17c708374ce0ce6202ba452 | bigcode/the-stack | train |
08cee8662a9f6c9a3b7bbc61 | train | function | @pytest.fixture
def delete():
return _request('delete')
| @pytest.fixture
def delete():
| return _request('delete')
| response
return rf
@pytest.fixture
def post():
return _request('post')
@pytest.fixture
def get():
return _request('get')
@pytest.fixture
def put():
return _request('put')
@pytest.fixture
def patch():
return _request('patch')
@pytest.fixture
def delete():
| 64 | 64 | 13 | 6 | 58 | gitEdouble/awx | awx/main/tests/functional/conftest.py | Python | delete | delete | 598 | 600 | 598 | 599 | afca0604b79def1a03cc4f47c37cde3e7089fd2d | bigcode/the-stack | train |
48fcb38bfed2736fa6303feb | train | function | @pytest.fixture
def workflow_job_template(organization):
wjt = WorkflowJobTemplate(name='test-workflow_job_template', organization=organization)
wjt.save()
return wjt
| @pytest.fixture
def workflow_job_template(organization):
| wjt = WorkflowJobTemplate(name='test-workflow_job_template', organization=organization)
wjt.save()
return wjt
| .save()
return jt
@pytest.fixture
def job_template_labels(organization, job_template):
job_template.labels.create(name="label-1", organization=organization)
job_template.labels.create(name="label-2", organization=organization)
return job_template
@pytest.fixture
def workflow_job_template(organizatio... | 64 | 64 | 39 | 10 | 53 | gitEdouble/awx | awx/main/tests/functional/conftest.py | Python | workflow_job_template | workflow_job_template | 685 | 690 | 685 | 686 | 5bea45dd66a685eacc47c8ca6b665a61e9e76463 | bigcode/the-stack | train |
f6cd791802566c8e5c23bab7 | train | function | @pytest.fixture
def post():
return _request('post')
| @pytest.fixture
def post():
| return _request('post')
| '):
response.render()
__SWAGGER_REQUESTS__.setdefault(request.path, {})[
(request.method.lower(), response.status_code)
] = (response.get('Content-Type', None), response.content, kwargs.get('data'))
return response
return rf
@pytest.fixture
def post():
| 64 | 64 | 13 | 6 | 57 | gitEdouble/awx | awx/main/tests/functional/conftest.py | Python | post | post | 578 | 580 | 578 | 579 | 364666abffb811e809354da221f73b4b868a3ec9 | bigcode/the-stack | train |
a2cab1d8650bf06c278d3449 | train | function | @pytest.fixture
def put():
return _request('put')
| @pytest.fixture
def put():
| return _request('put')
| response.status_code)
] = (response.get('Content-Type', None), response.content, kwargs.get('data'))
return response
return rf
@pytest.fixture
def post():
return _request('post')
@pytest.fixture
def get():
return _request('get')
@pytest.fixture
def put():
| 64 | 64 | 13 | 6 | 58 | gitEdouble/awx | awx/main/tests/functional/conftest.py | Python | put | put | 588 | 590 | 588 | 589 | 1eaf17049a3b537097ffea02f76e4f3db98bacf7 | bigcode/the-stack | train |
e9412486933b77f8189d3603 | train | function | @pytest.fixture
def monkeypatch_jsonbfield_get_db_prep_save(mocker):
JSONField.get_db_prep_save = get_db_prep_save
| @pytest.fixture
def monkeypatch_jsonbfield_get_db_prep_save(mocker):
| JSONField.get_db_prep_save = get_db_prep_save
| return None
# default values come in as strings; only non-strings should be
# run through `dumps`
if not isinstance(value, six.string_types):
value = dumps(value)
return value
@pytest.fixture
def monkeypatch_jsonbfield_get_db_prep_save(mocker):
| 64 | 64 | 32 | 17 | 46 | gitEdouble/awx | awx/main/tests/functional/conftest.py | Python | monkeypatch_jsonbfield_get_db_prep_save | monkeypatch_jsonbfield_get_db_prep_save | 733 | 735 | 733 | 734 | 90a58170b74bf9664d7b947b9fdc50945594b071 | bigcode/the-stack | train |
b96060a122e7bf72005fecbd | train | function | @pytest.fixture
def insights_credential(credentialtype_insights):
return Credential.objects.create(credential_type=credentialtype_insights, name='insights-cred',
inputs={'username': 'morocco_mole', 'password': 'secret_squirrel'})
| @pytest.fixture
def insights_credential(credentialtype_insights):
| return Credential.objects.create(credential_type=credentialtype_insights, name='insights-cred',
inputs={'username': 'morocco_mole', 'password': 'secret_squirrel'})
| )
@pytest.fixture
def scm_credential(credentialtype_scm):
return Credential.objects.create(credential_type=credentialtype_scm, name='scm-cred',
inputs={'username': 'optimus', 'password': 'prime'})
@pytest.fixture
def insights_credential(credentialtype_insights):
| 63 | 64 | 53 | 13 | 50 | gitEdouble/awx | awx/main/tests/functional/conftest.py | Python | insights_credential | insights_credential | 296 | 299 | 296 | 297 | 8b65bd72b8e0d8d4e2678dc85b392bad447dfe67 | bigcode/the-stack | train |
6570ea88c29ef95999b91ac7 | train | function | @pytest.fixture
def notification_template_with_encrypt(organization):
return NotificationTemplate.objects.create(name='test-notification_template_with_encrypt',
organization=organization,
notification_type="slack",
... | @pytest.fixture
def notification_template_with_encrypt(organization):
| return NotificationTemplate.objects.create(name='test-notification_template_with_encrypt',
organization=organization,
notification_type="slack",
notification_configuration=dic... | @pytest.fixture
def notification_template(organization):
return NotificationTemplate.objects.create(name='test-notification_template',
organization=organization,
notification_type="webhook",
... | 64 | 64 | 55 | 11 | 53 | gitEdouble/awx | awx/main/tests/functional/conftest.py | Python | notification_template_with_encrypt | notification_template_with_encrypt | 361 | 367 | 361 | 362 | 2025c9534e93c3539de387a02df5642e63411f03 | bigcode/the-stack | train |
a95547c2360555e580baf1de | train | function | @pytest.fixture
def notification_template(organization):
return NotificationTemplate.objects.create(name='test-notification_template',
organization=organization,
notification_type="webhook",
... | @pytest.fixture
def notification_template(organization):
| return NotificationTemplate.objects.create(name='test-notification_template',
organization=organization,
notification_type="webhook",
notification_configuration=dict(url="http... | =org)
except Inventory.DoesNotExist:
inv = Inventory.objects.create(name=name, organization=org)
return inv
return factory
@pytest.fixture
def label(organization):
return organization.labels.create(name="test-label", description="test-label-desc")
@pytest.fixture
def notification_t... | 64 | 64 | 53 | 9 | 55 | gitEdouble/awx | awx/main/tests/functional/conftest.py | Python | notification_template | notification_template | 352 | 358 | 352 | 353 | 7b9abc67080d16a02138d55477cfa931ae54d974 | bigcode/the-stack | train |
e9df0159391f6cb66b335009 | train | function | @pytest.fixture
def project_factory(organization):
def factory(name):
try:
prj = Project.objects.get(name=name)
except Project.DoesNotExist:
prj = Project.objects.create(name=name,
description="description for " + name,
... | @pytest.fixture
def project_factory(organization):
| def factory(name):
try:
prj = Project.objects.get(name=name)
except Project.DoesNotExist:
prj = Project.objects.create(name=name,
description="description for " + name,
organization=organization... | .objects.create(name="test-manual-proj",
description="manual-proj-desc",
organization=organization,
playbook_files=['helloworld.yml', 'alt-helloworld.yml'],
local_path='_92__test_proj'
... | 64 | 64 | 69 | 9 | 54 | gitEdouble/awx | awx/main/tests/functional/conftest.py | Python | project_factory | project_factory | 168 | 179 | 168 | 169 | 6ce7f1547746bb8d3684d3378c2d593cbf25a611 | bigcode/the-stack | train |
e13cb73f851a7cd63324327b | train | function | @pytest.fixture
def job_template(organization):
jt = JobTemplate(name='test-job_template')
jt.save()
return jt
| @pytest.fixture
def job_template(organization):
| jt = JobTemplate(name='test-job_template')
jt.save()
return jt
| =admin):
adhoc = AdHocCommand(
name='test-adhoc', inventory=inventory, credential=credential,
status=initial_state, created_by=created_by
)
adhoc.save()
return adhoc
return factory
@pytest.fixture
def job_template(organization):
| 64 | 64 | 28 | 9 | 54 | gitEdouble/awx | awx/main/tests/functional/conftest.py | Python | job_template | job_template | 669 | 674 | 669 | 670 | 5132a8ab0b0fc6a1caebdaee91ec3cd9a586d511 | bigcode/the-stack | train |
959d63dab7faad29fdc513d8 | train | function | @pytest.fixture
def bob(user):
return user('bob', False)
| @pytest.fixture
def bob(user):
| return user('bob', False)
| ', True)
@pytest.fixture
def system_auditor(user):
u = user('an-auditor', False)
Role.singleton('system_auditor').members.add(u)
return u
@pytest.fixture
def alice(user):
return user('alice', False)
@pytest.fixture
def bob(user):
| 64 | 64 | 15 | 7 | 57 | gitEdouble/awx | awx/main/tests/functional/conftest.py | Python | bob | bob | 402 | 404 | 402 | 403 | cf8d4cd01d7e30116c11d5efc3d2cbddb7b5727f | bigcode/the-stack | train |
1b731bdf5eb1c46f94855156 | train | function | @pytest.fixture
def rando(user):
"Rando, the random user that doesn't have access to anything"
return user('rando', False)
| @pytest.fixture
def rando(user):
| "Rando, the random user that doesn't have access to anything"
return user('rando', False)
| user('an-auditor', False)
Role.singleton('system_auditor').members.add(u)
return u
@pytest.fixture
def alice(user):
return user('alice', False)
@pytest.fixture
def bob(user):
return user('bob', False)
@pytest.fixture
def rando(user):
| 64 | 64 | 32 | 8 | 56 | gitEdouble/awx | awx/main/tests/functional/conftest.py | Python | rando | rando | 407 | 410 | 407 | 408 | a01f40e190919f26590fcdcad9cb7aaa118387ba | bigcode/the-stack | train |
bbb295a838e096ef07a443d9 | train | function | @pytest.fixture
def org_admin(user, organization):
ret = user('org-admin', False)
organization.admin_role.members.add(ret)
organization.member_role.members.add(ret)
return ret
| @pytest.fixture
def org_admin(user, organization):
| ret = user('org-admin', False)
organization.admin_role.members.add(ret)
organization.member_role.members.add(ret)
return ret
| return user('alice', False)
@pytest.fixture
def bob(user):
return user('bob', False)
@pytest.fixture
def rando(user):
"Rando, the random user that doesn't have access to anything"
return user('rando', False)
@pytest.fixture
def org_admin(user, organization):
| 64 | 64 | 40 | 10 | 54 | gitEdouble/awx | awx/main/tests/functional/conftest.py | Python | org_admin | org_admin | 413 | 418 | 413 | 414 | 573e50e55d33f00662c6782104e9629cad46e80c | bigcode/the-stack | train |
edd355e5f33021c649e68d80 | train | function | def dumps(value):
return DjangoJSONEncoder().encode(value)
| def dumps(value):
| return DjangoJSONEncoder().encode(value)
| _factory(system_job_template, admin):
def factory(system_job_template=system_job_template, initial_state='new', created_by=admin):
return system_job_template.create_unified_job(_eager_fields={
'status': initial_state, 'created_by': created_by})
return factory
def dumps(value):
| 64 | 64 | 13 | 4 | 59 | gitEdouble/awx | awx/main/tests/functional/conftest.py | Python | dumps | dumps | 716 | 717 | 716 | 716 | 7da5692f2428dc15b2f098fcce2233b6940b3442 | bigcode/the-stack | train |
37b11b2b849c4a14a01af89b | train | function | @pytest.fixture
def inventory_source(inventory):
return InventorySource.objects.create(name='single-inv-src',
inventory=inventory, source='gce')
| @pytest.fixture
def inventory_source(inventory):
| return InventorySource.objects.create(name='single-inv-src',
inventory=inventory, source='gce')
| = group1.inventory.hosts.get_or_create(name=name)
if created:
group1.hosts.add(host)
hosts.append(host)
return hosts
return rf
@pytest.fixture
def group(inventory):
return inventory.groups.create(name='single-group')
@pytest.fixture
def inventory_source(invento... | 64 | 64 | 32 | 9 | 55 | gitEdouble/awx | awx/main/tests/functional/conftest.py | Python | inventory_source | inventory_source | 478 | 481 | 478 | 479 | 8756ee7c281ac82ba2ee8e4245180dcb01f9a447 | bigcode/the-stack | train |
5d36eefde69fbf7bf7ad219d | train | function | @pytest.fixture
def head():
return _request('head')
| @pytest.fixture
def head():
| return _request('head')
| return _request('post')
@pytest.fixture
def get():
return _request('get')
@pytest.fixture
def put():
return _request('put')
@pytest.fixture
def patch():
return _request('patch')
@pytest.fixture
def delete():
return _request('delete')
@pytest.fixture
def head():
| 64 | 64 | 13 | 6 | 58 | gitEdouble/awx | awx/main/tests/functional/conftest.py | Python | head | head | 603 | 605 | 603 | 604 | 394e95ba5469aff9f868389d61280c11645d855d | bigcode/the-stack | train |
40d7d1247e990249f78c5b01 | train | function | def _request(verb):
def rf(url, data_or_user=None, user=None, middleware=None, expect=None, **kwargs):
if type(data_or_user) is User and user is None:
user = data_or_user
elif 'data' not in kwargs:
kwargs['data'] = data_or_user
if 'format' not in kwargs and 'content_t... | def _request(verb):
| def rf(url, data_or_user=None, user=None, middleware=None, expect=None, **kwargs):
if type(data_or_user) is User and user is None:
user = data_or_user
elif 'data' not in kwargs:
kwargs['data'] = data_or_user
if 'format' not in kwargs and 'content_type' not in kwargs:
... | m_update':True, 'execute':True, 'use':True,},
'auditor':{'read':True, 'create':False, 'write':False,
'update':False, 'delete':False, 'scm_update':False, 'execute':False, 'use':False,},
'usage':{'read':False, 'create':False, 'write':False,
'update':False, 'delete':Fa... | 120 | 120 | 401 | 6 | 114 | gitEdouble/awx | awx/main/tests/functional/conftest.py | Python | _request | _request | 529 | 575 | 529 | 529 | ce09d6c874cdef71affd770d33427649515165fc | bigcode/the-stack | train |
8d8a1659a94196ac8ed919f5 | train | function | @pytest.fixture
def inventory(organization):
return organization.inventories.create(name="test-inv")
| @pytest.fixture
def inventory(organization):
| return organization.inventories.create(name="test-inv")
| '})
@pytest.fixture
def org_credential(organization, credentialtype_aws):
return Credential.objects.create(credential_type=credentialtype_aws, name='test-cred',
inputs={'username': 'something', 'password': 'secret'},
organization=organizati... | 64 | 64 | 21 | 8 | 56 | gitEdouble/awx | awx/main/tests/functional/conftest.py | Python | inventory | inventory | 309 | 311 | 309 | 310 | 094432eb9d99f8d8f39e5a2e45e1bab7a5adebe8 | bigcode/the-stack | train |
70104ce6dbc6544fdc8ac7a1 | train | function | @pytest.fixture
def org_credential(organization, credentialtype_aws):
return Credential.objects.create(credential_type=credentialtype_aws, name='test-cred',
inputs={'username': 'something', 'password': 'secret'},
organization=organization)
| @pytest.fixture
def org_credential(organization, credentialtype_aws):
| return Credential.objects.create(credential_type=credentialtype_aws, name='test-cred',
inputs={'username': 'something', 'password': 'secret'},
organization=organization)
| _credential(credentialtype_insights):
return Credential.objects.create(credential_type=credentialtype_insights, name='insights-cred',
inputs={'username': 'morocco_mole', 'password': 'secret_squirrel'})
@pytest.fixture
def org_credential(organization, credentialtype_aws):
| 63 | 64 | 54 | 15 | 48 | gitEdouble/awx | awx/main/tests/functional/conftest.py | Python | org_credential | org_credential | 302 | 306 | 302 | 303 | 08da760906d6ec1c17e74f69143ed9554ba9a4e1 | bigcode/the-stack | train |
718589f42f4e62105345d368 | train | function | @pytest.fixture
def team_factory(organization):
def factory(name):
try:
t = Team.objects.get(name=name)
except Team.DoesNotExist:
t = Team.objects.create(name=name,
description="description for " + name,
... | @pytest.fixture
def team_factory(organization):
| def factory(name):
try:
t = Team.objects.get(name=name)
except Team.DoesNotExist:
t = Team.objects.create(name=name,
description="description for " + name,
organization=organization)
return t
... | (job_template, admin):
def factory(job_template=job_template, initial_state='new', created_by=admin):
return job_template.create_unified_job(_eager_fields={
'status': initial_state, 'created_by': created_by})
return factory
@pytest.fixture
def team_factory(organization):
| 64 | 64 | 64 | 9 | 54 | gitEdouble/awx | awx/main/tests/functional/conftest.py | Python | team_factory | team_factory | 190 | 200 | 190 | 191 | 4cd12de18d2ce9fd25893f921359c1322b146728 | bigcode/the-stack | train |
a5b90b2263b7ff9819ff98e6 | train | function | @pytest.fixture
def system_auditor(user):
u = user('an-auditor', False)
Role.singleton('system_auditor').members.add(u)
return u
| @pytest.fixture
def system_auditor(user):
| u = user('an-auditor', False)
Role.singleton('system_auditor').members.add(u)
return u
| ='email subject')
@pytest.fixture
def job_template_with_survey_passwords(job_template_with_survey_passwords_factory):
return job_template_with_survey_passwords_factory(persisted=True)
@pytest.fixture
def admin(user):
return user('admin', True)
@pytest.fixture
def system_auditor(user):
| 64 | 64 | 39 | 10 | 54 | gitEdouble/awx | awx/main/tests/functional/conftest.py | Python | system_auditor | system_auditor | 390 | 394 | 390 | 391 | 1cee6dd7a31ea1687eef0ade0f666c0e3e20a370 | bigcode/the-stack | train |
eba6eda01209be7a35db044f | train | function | @pytest.fixture(scope="session", autouse=True)
def project_playbooks():
'''
Return playbook_files as playbooks for manual projects when testing.
'''
class PlaybooksMock(mock.PropertyMock):
def __get__(self, obj, obj_type):
return obj.playbook_files
mocked = mock.patch.object(Proj... | @pytest.fixture(scope="session", autouse=True)
def project_playbooks():
| '''
Return playbook_files as playbooks for manual projects when testing.
'''
class PlaybooksMock(mock.PropertyMock):
def __get__(self, obj, obj_type):
return obj.playbook_files
mocked = mock.patch.object(Project, 'playbooks', new_callable=PlaybooksMock)
mocked.start()
|
def team(organization):
return organization.teams.create(name='test-team')
@pytest.fixture
def team_member(user, team):
ret = user('team-member', False)
team.member_role.members.add(ret)
return ret
@pytest.fixture(scope="session", autouse=True)
def project_playbooks():
| 64 | 64 | 84 | 15 | 48 | gitEdouble/awx | awx/main/tests/functional/conftest.py | Python | project_playbooks | project_playbooks | 129 | 138 | 129 | 130 | 0baf58c4426b896e5b7d88a708f771275ea90469 | bigcode/the-stack | train |
fd9d9cb30a35defe83cd4811 | train | class | class StripeTests(OAuth2TestsMixin, TestCase):
provider_id = StripeProvider.id
def get_mocked_response(self):
return MockedResponse(200, """{
"id": "acct_sometestid",
"object": "account",
"business_logo": null,
"business_name": null,
"business_url": "te... | class StripeTests(OAuth2TestsMixin, TestCase):
| provider_id = StripeProvider.id
def get_mocked_response(self):
return MockedResponse(200, """{
"id": "acct_sometestid",
"object": "account",
"business_logo": null,
"business_name": null,
"business_url": "test.com",
"charges_enabled": true,
... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from allauth.socialaccount.tests import OAuth2TestsMixin
from allauth.tests import MockedResponse, TestCase
from .provider import StripeProvider
class StripeTests(OAuth2TestsMixin, TestCase):
| 59 | 94 | 316 | 12 | 46 | mina-gaid/scp | allauth/socialaccount/providers/stripe/tests.py | Python | StripeTests | StripeTests | 10 | 51 | 10 | 10 | e56c7983816f90074342f216bac971fa8dbd9875 | bigcode/the-stack | train |
97be301aaea7e7482d8dbe6e | train | function | def test_starmap(pool):
def f(*args):
return args
args = [tuple(range(i)) for i in range(100)]
assert pool.starmap(f, args) == args
assert pool.starmap(lambda x, y: x + y, zip([1, 2], [3, 4])) == [4, 6]
| def test_starmap(pool):
| def f(*args):
return args
args = [tuple(range(i)) for i in range(100)]
assert pool.starmap(f, args) == args
assert pool.starmap(lambda x, y: x + y, zip([1, 2], [3, 4])) == [4, 6]
| async_result = pool_4_processes.map_async(bad_func, range(100))
async_result.wait(10)
assert async_result.ready()
assert not async_result.successful()
with pytest.raises(Exception, match="test_map_async failure"):
async_result.get()
def test_starmap(pool):
| 64 | 64 | 80 | 7 | 57 | mgelbart/ray | python/ray/tests/test_multiprocessing.py | Python | test_starmap | test_starmap | 377 | 383 | 377 | 377 | 44a0299623b956ab9cf97262f09afff98236cdc1 | bigcode/the-stack | train |
9faee70b27fd409d9745799e | train | function | @pytest.mark.parametrize("use_iter", [True, False])
def test_imap_unordered(pool_4_processes, use_iter):
def f(args):
time.sleep(0.1 * random.random())
index = args[0]
err_indices = args[1]
if index in err_indices:
raise Exception("intentional failure")
return ind... | @pytest.mark.parametrize("use_iter", [True, False])
def test_imap_unordered(pool_4_processes, use_iter):
| def f(args):
time.sleep(0.1 * random.random())
index = args[0]
err_indices = args[1]
if index in err_indices:
raise Exception("intentional failure")
return index
error_indices = [2, 50, 98]
in_order = []
num_errors = 0
if use_iter:
imap_it... | ap_iterable, chunksize=11)
for i in range(100):
result = result_iter.next()
if i in error_indices:
assert isinstance(result, Exception)
else:
assert result == i
with pytest.raises(StopIteration):
result_iter.next()
@pytest.mark.parametrize("use_iter", [Tr... | 87 | 87 | 292 | 27 | 60 | mgelbart/ray | python/ray/tests/test_multiprocessing.py | Python | test_imap_unordered | test_imap_unordered | 498 | 531 | 498 | 499 | ae60019096fa1fd10f49192064696e5e58d7d6b0 | bigcode/the-stack | train |
7b740d43542aaf7e97854f1b | train | function | def test_map_async(pool_4_processes):
def f(args):
index, signal = args
ray.get(signal.wait.remote())
return index, os.getpid()
signal = SignalActor.remote()
async_result = pool_4_processes.map_async(f, [(i, signal) for i in range(1000)])
assert not async_result.ready()
with... | def test_map_async(pool_4_processes):
| def f(args):
index, signal = args
ray.get(signal.wait.remote())
return index, os.getpid()
signal = SignalActor.remote()
async_result = pool_4_processes.map_async(f, [(i, signal) for i in range(1000)])
assert not async_result.ready()
with pytest.raises(TimeoutError):
... | == index
pid_counts[pid] += 1
# Check that the functions are spread somewhat evenly.
for count in pid_counts.values():
assert count > 100
def bad_func(args):
raise Exception("test_map failure")
with pytest.raises(Exception, match="test_map failure"):
pool_4_processes.... | 90 | 90 | 302 | 10 | 80 | mgelbart/ray | python/ray/tests/test_multiprocessing.py | Python | test_map_async | test_map_async | 333 | 374 | 333 | 333 | 780e7ccc653472836851bedabf05e49ea84cb632 | bigcode/the-stack | train |
d590ec5b0b1cf1acbfeaae66 | train | function | def test_maxtasksperchild(shutdown_only):
def f(args):
return os.getpid()
pool = Pool(5, maxtasksperchild=1)
assert len(set(pool.map(f, range(20)))) == 20
pool.terminate()
pool.join()
| def test_maxtasksperchild(shutdown_only):
| def f(args):
return os.getpid()
pool = Pool(5, maxtasksperchild=1)
assert len(set(pool.map(f, range(20)))) == 20
pool.terminate()
pool.join()
| in order.
# NOTE: this could be flaky if the calls happened to finish in order due
# to the random sleeps, but it's very unlikely.
assert not all(in_order)
with pytest.raises(StopIteration):
result_iter.next()
def test_maxtasksperchild(shutdown_only):
| 64 | 64 | 62 | 11 | 53 | mgelbart/ray | python/ray/tests/test_multiprocessing.py | Python | test_maxtasksperchild | test_maxtasksperchild | 588 | 595 | 588 | 588 | a965bb6480ce8785964a6533389f926e70501c05 | bigcode/the-stack | train |
7a3480f2f5ee3d8872b0cc0e | train | function | def callback_test_helper(args):
"""
This is a helper function for the test_callbacks test. It must be placed
outside the test because Python's Multiprocessing library uses Pickle to
serialize functions, but Pickle cannot serialize local functions.
"""
time.sleep(0.1 * random.random())
index ... | def callback_test_helper(args):
| """
This is a helper function for the test_callbacks test. It must be placed
outside the test because Python's Multiprocessing library uses Pickle to
serialize functions, but Pickle cannot serialize local functions.
"""
time.sleep(0.1 * random.random())
index = args[0]
err_indices = args... | regular callback returned a list of all indices
for index in callback_results:
assert index in indices
indices.remove(index)
assert len(indices) == 0
else:
# Check that error callback returned a single exception
... | 64 | 64 | 99 | 6 | 58 | mgelbart/ray | python/ray/tests/test_multiprocessing.py | Python | callback_test_helper | callback_test_helper | 457 | 468 | 457 | 457 | 6ed5292afdea1399d1fab8095c82c9b8908fd6c7 | bigcode/the-stack | train |
354e49f6c68d61320a4a7fde | train | function | def test_close(pool_4_processes):
def f(signal):
ray.get(signal.wait.remote())
return "hello"
signal = SignalActor.remote()
result = pool_4_processes.map_async(f, [signal for _ in range(4)])
assert not result.ready()
pool_4_processes.close()
assert not result.ready()
# Sign... | def test_close(pool_4_processes):
| def f(signal):
ray.get(signal.wait.remote())
return "hello"
signal = SignalActor.remote()
result = pool_4_processes.map_async(f, [signal for _ in range(4)])
assert not result.ready()
pool_4_processes.close()
assert not result.ready()
# Signal the head of line tasks to finis... | .TemporaryDirectory() as dirname:
num_processes = 4
pool = Pool(processes=num_processes, initializer=init, initargs=(dirname,))
assert len(os.listdir(dirname)) == 4
pool.terminate()
pool.join()
def test_close(pool_4_processes):
| 64 | 64 | 146 | 9 | 55 | mgelbart/ray | python/ray/tests/test_multiprocessing.py | Python | test_close | test_close | 188 | 207 | 188 | 188 | 55b307696caedbf21964046dcebe8c018aea83ce | bigcode/the-stack | train |
092cf4c2fe45693a1fcc65ae | train | function | @pytest.fixture
def ray_start_1_cpu():
address_info = ray.init(num_cpus=1)
yield address_info
# The code after the yield will run as teardown code.
ray.shutdown()
| @pytest.fixture
def ray_start_1_cpu():
| address_info = ray.init(num_cpus=1)
yield address_info
# The code after the yield will run as teardown code.
ray.shutdown()
| ()
pool.join()
ray.shutdown()
@pytest.fixture
def pool_4_processes_python_multiprocessing_lib():
import multiprocessing as mp
pool = mp.Pool(processes=4)
yield pool
pool.terminate()
pool.join()
@pytest.fixture
def ray_start_1_cpu():
| 64 | 64 | 44 | 10 | 54 | mgelbart/ray | python/ray/tests/test_multiprocessing.py | Python | ray_start_1_cpu | ray_start_1_cpu | 55 | 60 | 55 | 56 | 5a5401331410d90e93747c82283237723816b9f3 | bigcode/the-stack | train |
60d975965a21c054c86dc354 | train | function | def test_task_to_actor_assignment(ray_start_4_cpu):
register_ray()
pause_time = 5
def worker_func(worker_id):
launch_time = time.time()
time.sleep(pause_time)
return worker_id, launch_time
num_workers = 4
output = []
with parallel_backend("ray", n_jobs=-1):
ou... | def test_task_to_actor_assignment(ray_start_4_cpu):
| register_ray()
pause_time = 5
def worker_func(worker_id):
launch_time = time.time()
time.sleep(pause_time)
return worker_id, launch_time
num_workers = 4
output = []
with parallel_backend("ray", n_jobs=-1):
output = Parallel()(
delayed(worker_func)(w... | :
return list(pool.map(poolit_a, range(2, 4, 1)))
result = poolit_b()
assert result == [[0.0, 1.0], [0.0, 1.0]]
def test_task_to_actor_assignment(ray_start_4_cpu):
| 63 | 64 | 183 | 12 | 51 | mgelbart/ray | python/ray/tests/test_multiprocessing.py | Python | test_task_to_actor_assignment | test_task_to_actor_assignment | 611 | 639 | 611 | 612 | 9baafa6f64642100a5b0f378289a490639a2f950 | bigcode/the-stack | train |
0a10691a97aa25a6bf24a0a8 | train | function | def test_apply(pool):
def f(arg1, arg2, kwarg1=None, kwarg2=None):
assert arg1 == 1
assert arg2 == 2
assert kwarg1 is None
assert kwarg2 == 3
return 1
assert pool.apply(f, (1, 2), {"kwarg2": 3}) == 1
with pytest.raises(AssertionError):
pool.apply(
... | def test_apply(pool):
| def f(arg1, arg2, kwarg1=None, kwarg2=None):
assert arg1 == 1
assert arg2 == 2
assert kwarg1 is None
assert kwarg2 == 3
return 1
assert pool.apply(f, (1, 2), {"kwarg2": 3}) == 1
with pytest.raises(AssertionError):
pool.apply(
f,
(
... | so check that join() returns
# even though the tasks should be blocked forever.
pool_4_processes.join()
result.wait(timeout=10)
assert result.ready()
assert not result.successful()
with pytest.raises(ray.exceptions.RayError):
result.get()
def test_apply(pool):
| 64 | 64 | 163 | 5 | 59 | mgelbart/ray | python/ray/tests/test_multiprocessing.py | Python | test_apply | test_apply | 229 | 250 | 229 | 229 | fffb8ade2321f0b7b4dbb95342521a7b483f78b8 | bigcode/the-stack | train |
7e23fc79ed3564e06adbb931 | train | function | def test_ray_init(shutdown_only):
def getpid(args):
return os.getpid()
def check_pool_size(pool, size):
args = [tuple() for _ in range(size)]
assert len(set(pool.map(getpid, args))) == size
# Check that starting a pool starts ray if not initialized.
pool = Pool(processes=2)
... | def test_ray_init(shutdown_only):
| def getpid(args):
return os.getpid()
def check_pool_size(pool, size):
args = [tuple() for _ in range(size)]
assert len(set(pool.map(getpid, args))) == size
# Check that starting a pool starts ray if not initialized.
pool = Pool(processes=2)
assert ray.is_initialized()
a... | ray.init(num_cpus=1)
yield address_info
# The code after the yield will run as teardown code.
ray.shutdown()
@pytest.fixture
def ray_start_4_cpu():
address_info = ray.init(num_cpus=4)
yield address_info
# The code after the yield will run as teardown code.
ray.shutdown()
def test_ray_init... | 82 | 82 | 276 | 8 | 74 | mgelbart/ray | python/ray/tests/test_multiprocessing.py | Python | test_ray_init | test_ray_init | 71 | 106 | 71 | 71 | e96874ab1c719510c8f733da18e1fcd93f3ee13b | bigcode/the-stack | train |
306ee7557ccc63a57ae48e5b | train | function | def test_terminate(pool_4_processes):
def f(signal):
return ray.get(signal.wait.remote())
signal = SignalActor.remote()
result = pool_4_processes.map_async(f, [signal for _ in range(4)])
assert not result.ready()
pool_4_processes.terminate()
# terminate() should interrupt pending tasks... | def test_terminate(pool_4_processes):
| def f(signal):
return ray.get(signal.wait.remote())
signal = SignalActor.remote()
result = pool_4_processes.map_async(f, [signal for _ in range(4)])
assert not result.ready()
pool_4_processes.terminate()
# terminate() should interrupt pending tasks, so check that join() returns
# e... | pool_4_processes.join()
# close() shouldn't interrupt pending tasks, so check that they succeeded.
result.wait(timeout=10)
assert result.ready()
assert result.successful()
assert result.get() == ["hello"] * 4
def test_terminate(pool_4_processes):
| 64 | 64 | 134 | 10 | 53 | mgelbart/ray | python/ray/tests/test_multiprocessing.py | Python | test_terminate | test_terminate | 210 | 226 | 210 | 210 | bf0ac6ed8911cbd0732f15ee5a83f007a188a11b | bigcode/the-stack | train |
a2636a1f536412e85ad315ff | train | function | def test_apply_async(pool):
def f(arg1, arg2, kwarg1=None, kwarg2=None):
assert arg1 == 1
assert arg2 == 2
assert kwarg1 is None
assert kwarg2 == 3
return 1
assert pool.apply_async(f, (1, 2), {"kwarg2": 3}).get() == 1
with pytest.raises(AssertionError):
pool.... | def test_apply_async(pool):
| def f(arg1, arg2, kwarg1=None, kwarg2=None):
assert arg1 == 1
assert arg2 == 2
assert kwarg1 is None
assert kwarg2 == 3
return 1
assert pool.apply_async(f, (1, 2), {"kwarg2": 3}).get() == 1
with pytest.raises(AssertionError):
pool.apply_async(
f,
... | is None
assert kwarg2 == 3
return 1
assert pool.apply(f, (1, 2), {"kwarg2": 3}) == 1
with pytest.raises(AssertionError):
pool.apply(
f,
(
2,
2,
),
{"kwarg2": 3},
)
with pytest.raises(Exception):... | 124 | 124 | 416 | 6 | 118 | mgelbart/ray | python/ray/tests/test_multiprocessing.py | Python | test_apply_async | test_apply_async | 253 | 307 | 253 | 253 | 1b75862e964e005c34c1acd710566e34931871c1 | bigcode/the-stack | train |
e0ec3dcd273676f9c6fb6c3d | train | function | @pytest.mark.parametrize("use_iter", [True, False])
def test_imap_timeout(pool_4_processes, use_iter):
def f(args):
index, wait_index, signal = args
time.sleep(0.1 * random.random())
if index == wait_index:
ray.get(signal.wait.remote())
return index
wait_index = 23
... | @pytest.mark.parametrize("use_iter", [True, False])
def test_imap_timeout(pool_4_processes, use_iter):
| def f(args):
index, wait_index, signal = args
time.sleep(0.1 * random.random())
if index == wait_index:
ray.get(signal.wait.remote())
return index
wait_index = 23
signal = SignalActor.remote()
if use_iter:
imap_iterable = iter([(index, wait_index, sig... | if isinstance(result, Exception):
in_order.append(True)
num_errors += 1
else:
in_order.append(result == i)
# Check that the results didn't come back all in order.
# NOTE: this could be flaky if the calls happened to finish in order due
# to the random sleeps, bu... | 128 | 128 | 427 | 26 | 102 | mgelbart/ray | python/ray/tests/test_multiprocessing.py | Python | test_imap_timeout | test_imap_timeout | 534 | 585 | 534 | 535 | 506930891b39fa7b3715fd4a19430862874534a6 | bigcode/the-stack | train |
f3524324216238552eb9423b | train | function | @pytest.fixture
def pool_4_processes():
pool = Pool(processes=4)
yield pool
pool.terminate()
pool.join()
ray.shutdown()
| @pytest.fixture
def pool_4_processes():
| pool = Pool(processes=4)
yield pool
pool.terminate()
pool.join()
ray.shutdown()
| .
if "RAY_ADDRESS" in os.environ:
del os.environ["RAY_ADDRESS"]
@pytest.fixture
def pool():
pool = Pool(processes=1)
yield pool
pool.terminate()
pool.join()
ray.shutdown()
@pytest.fixture
def pool_4_processes():
| 64 | 64 | 36 | 10 | 54 | mgelbart/ray | python/ray/tests/test_multiprocessing.py | Python | pool_4_processes | pool_4_processes | 36 | 42 | 36 | 37 | 2224081abc5cc6ca6d1a58d9e1ac30334488227d | bigcode/the-stack | train |
f80cf503e473a154e294cf40 | train | function | @pytest.mark.parametrize(
"ray_start_cluster",
[
{
"num_cpus": 1,
"num_nodes": 1,
"do_init": False,
}
],
indirect=True,
)
def test_connect_to_ray(ray_start_cluster):
def getpid(args):
return os.getpid()
def check_pool_size(pool, size):... | @pytest.mark.parametrize(
"ray_start_cluster",
[
{
"num_cpus": 1,
"num_nodes": 1,
"do_init": False,
}
],
indirect=True,
)
def test_connect_to_ray(ray_start_cluster):
| def getpid(args):
return os.getpid()
def check_pool_size(pool, size):
args = [tuple() for _ in range(size)]
assert len(set(pool.map(getpid, args))) == size
address = ray_start_cluster.address
# Use different numbers of CPUs to distinguish between starting a local
# ray clus... | pool.join()
ray.shutdown()
# Check that trying to start a pool on an existing ray cluster throws an
# error if there aren't enough CPUs for the number of processes.
ray.init(num_cpus=1)
assert ray.is_initialized()
with pytest.raises(ValueError):
Pool(processes=2)
assert int(ray.clu... | 140 | 140 | 468 | 56 | 84 | mgelbart/ray | python/ray/tests/test_multiprocessing.py | Python | test_connect_to_ray | test_connect_to_ray | 109 | 171 | 109 | 120 | 46b3048108887470b43c3be0c5c1c265a6634d99 | bigcode/the-stack | train |
390e64f3bad20d76969cf2a8 | train | function | def test_map(pool_4_processes):
def f(index):
return index, os.getpid()
results = pool_4_processes.map(f, range(1000))
assert len(results) == 1000
pid_counts = defaultdict(int)
for i, (index, pid) in enumerate(results):
assert i == index
pid_counts[pid] += 1
# Check th... | def test_map(pool_4_processes):
| def f(index):
return index, os.getpid()
results = pool_4_processes.map(f, range(1000))
assert len(results) == 1000
pid_counts = defaultdict(int)
for i, (index, pid) in enumerate(results):
assert i == index
pid_counts[pid] += 1
# Check that the functions are spread some... | ObjectRef with 0, causing the task to fail (divide by zero).
ray.get(signal.send.remote())
result.wait(timeout=10)
assert result.ready()
assert not result.successful()
with pytest.raises(ZeroDivisionError):
result.get()
def test_map(pool_4_processes):
| 64 | 64 | 151 | 9 | 55 | mgelbart/ray | python/ray/tests/test_multiprocessing.py | Python | test_map | test_map | 310 | 330 | 310 | 310 | c6e1803287dd9a56f355d687d2d47a003784d5b9 | bigcode/the-stack | train |
7491ac016f38f0f898fed41e | train | function | @pytest.mark.parametrize("use_iter", [True, False])
def test_imap(pool_4_processes, use_iter):
def f(args):
time.sleep(0.1 * random.random())
index = args[0]
err_indices = args[1]
if index in err_indices:
raise Exception("intentional failure")
return index
er... | @pytest.mark.parametrize("use_iter", [True, False])
def test_imap(pool_4_processes, use_iter):
| def f(args):
time.sleep(0.1 * random.random())
index = args[0]
err_indices = args[1]
if index in err_indices:
raise Exception("intentional failure")
return index
error_indices = [2, 50, 98]
if use_iter:
imap_iterable = iter([(index, error_indices)... | 1 * random.random())
index = args[0]
err_indices = args[1]
if index in err_indices:
raise Exception("intentional failure")
return index
@pytest.mark.parametrize("use_iter", [True, False])
def test_imap(pool_4_processes, use_iter):
| 64 | 64 | 209 | 25 | 38 | mgelbart/ray | python/ray/tests/test_multiprocessing.py | Python | test_imap | test_imap | 471 | 495 | 471 | 472 | d144d808d954953034a2868b72f95ecf46d5d606 | bigcode/the-stack | train |
79105c2d68bcdf42a28e9524 | train | function | def test_initializer(shutdown_only):
def init(dirname):
with open(os.path.join(dirname, str(os.getpid())), "w") as f:
print("hello", file=f)
with tempfile.TemporaryDirectory() as dirname:
num_processes = 4
pool = Pool(processes=num_processes, initializer=init, initargs=(dirn... | def test_initializer(shutdown_only):
| def init(dirname):
with open(os.path.join(dirname, str(os.getpid())), "w") as f:
print("hello", file=f)
with tempfile.TemporaryDirectory() as dirname:
num_processes = 4
pool = Pool(processes=num_processes, initializer=init, initargs=(dirname,))
assert len(os.listdir... | on an existing ray cluster throws an
# error if there aren't enough CPUs for the number of processes.
with pytest.raises(Exception):
Pool(processes=start_cpus + 1)
assert int(ray.cluster_resources()["CPU"]) == start_cpus
ray.shutdown()
def test_initializer(shutdown_only):
| 64 | 64 | 98 | 7 | 57 | mgelbart/ray | python/ray/tests/test_multiprocessing.py | Python | test_initializer | test_initializer | 174 | 185 | 174 | 174 | 93ea3ca534ca8595540f7d01dd35d24ac2218897 | bigcode/the-stack | train |
53c5bcc21c0f697b0f106627 | train | function | def test_deadlock_avoidance_in_recursive_tasks(ray_start_1_cpu):
def poolit_a(_):
with Pool(ray_address="auto") as pool:
return list(pool.map(math.sqrt, range(0, 2, 1)))
def poolit_b():
with Pool(ray_address="auto") as pool:
return list(pool.map(poolit_a, range(2, 4, 1))... | def test_deadlock_avoidance_in_recursive_tasks(ray_start_1_cpu):
| def poolit_a(_):
with Pool(ray_address="auto") as pool:
return list(pool.map(math.sqrt, range(0, 2, 1)))
def poolit_b():
with Pool(ray_address="auto") as pool:
return list(pool.map(poolit_a, range(2, 4, 1)))
result = poolit_b()
assert result == [[0.0, 1.0], [0.0... | (args):
return os.getpid()
pool = Pool(5, maxtasksperchild=1)
assert len(set(pool.map(f, range(20)))) == 20
pool.terminate()
pool.join()
def test_deadlock_avoidance_in_recursive_tasks(ray_start_1_cpu):
| 64 | 64 | 119 | 16 | 48 | mgelbart/ray | python/ray/tests/test_multiprocessing.py | Python | test_deadlock_avoidance_in_recursive_tasks | test_deadlock_avoidance_in_recursive_tasks | 598 | 608 | 598 | 598 | 6ebd1e66b3b9d1c622d5c8b871cee1645a5ada26 | bigcode/the-stack | train |
ea96b2cbdbb71e8a2d96dde9 | train | function | @pytest.fixture
def ray_start_4_cpu():
address_info = ray.init(num_cpus=4)
yield address_info
# The code after the yield will run as teardown code.
ray.shutdown()
| @pytest.fixture
def ray_start_4_cpu():
| address_info = ray.init(num_cpus=4)
yield address_info
# The code after the yield will run as teardown code.
ray.shutdown()
|
pool.terminate()
pool.join()
@pytest.fixture
def ray_start_1_cpu():
address_info = ray.init(num_cpus=1)
yield address_info
# The code after the yield will run as teardown code.
ray.shutdown()
@pytest.fixture
def ray_start_4_cpu():
| 64 | 64 | 44 | 10 | 54 | mgelbart/ray | python/ray/tests/test_multiprocessing.py | Python | ray_start_4_cpu | ray_start_4_cpu | 63 | 68 | 63 | 64 | 315402d8177d5b137a95dfe9d92017be8d5c4a9c | bigcode/the-stack | train |
851d963253eb13f68617cb54 | train | function | @pytest.fixture
def pool():
pool = Pool(processes=1)
yield pool
pool.terminate()
pool.join()
ray.shutdown()
| @pytest.fixture
def pool():
| pool = Pool(processes=1)
yield pool
pool.terminate()
pool.join()
ray.shutdown()
| JoinableQueue
from ray.util.joblib import register_ray
from joblib import parallel_backend, Parallel, delayed
def teardown_function(function):
# Delete environment variable if set.
if "RAY_ADDRESS" in os.environ:
del os.environ["RAY_ADDRESS"]
@pytest.fixture
def pool():
| 63 | 64 | 32 | 6 | 57 | mgelbart/ray | python/ray/tests/test_multiprocessing.py | Python | pool | pool | 27 | 33 | 27 | 28 | defa3d8cc04baddb3f1e14f58fe07eeb66e9f3ea | bigcode/the-stack | train |
b1119457481f98c90f017d51 | train | function | @pytest.fixture
def pool_4_processes_python_multiprocessing_lib():
import multiprocessing as mp
pool = mp.Pool(processes=4)
yield pool
pool.terminate()
pool.join()
| @pytest.fixture
def pool_4_processes_python_multiprocessing_lib():
| import multiprocessing as mp
pool = mp.Pool(processes=4)
yield pool
pool.terminate()
pool.join()
| pool.terminate()
pool.join()
ray.shutdown()
@pytest.fixture
def pool_4_processes():
pool = Pool(processes=4)
yield pool
pool.terminate()
pool.join()
ray.shutdown()
@pytest.fixture
def pool_4_processes_python_multiprocessing_lib():
| 64 | 64 | 45 | 15 | 49 | mgelbart/ray | python/ray/tests/test_multiprocessing.py | Python | pool_4_processes_python_multiprocessing_lib | pool_4_processes_python_multiprocessing_lib | 45 | 52 | 45 | 46 | 5c770bf09c8371a750c8f2fa05fc79dcceec8c70 | bigcode/the-stack | train |
ecbf67d73c2e30beab800ca4 | train | function | def test_callbacks(pool_4_processes, pool_4_processes_python_multiprocessing_lib):
Queue = JoinableQueue if platform.system() == "Windows" else queue.Queue
callback_queue = Queue()
def callback(result):
callback_queue.put(result)
def error_callback(error):
callback_queue.put(error)
... | def test_callbacks(pool_4_processes, pool_4_processes_python_multiprocessing_lib):
| Queue = JoinableQueue if platform.system() == "Windows" else queue.Queue
callback_queue = Queue()
def callback(result):
callback_queue.put(result)
def error_callback(error):
callback_queue.put(error)
# Will not error, check that callback is called.
result = pool_4_processes.ap... | = pool_4_processes.map_async(bad_func, range(100))
async_result.wait(10)
assert async_result.ready()
assert not async_result.successful()
with pytest.raises(Exception, match="test_map_async failure"):
async_result.get()
def test_starmap(pool):
def f(*args):
return args
args ... | 155 | 155 | 518 | 20 | 135 | mgelbart/ray | python/ray/tests/test_multiprocessing.py | Python | test_callbacks | test_callbacks | 386 | 454 | 386 | 386 | e4772102fb6362d5ab1826f38cb12123a365a0d8 | bigcode/the-stack | train |
2a71600871e2bd0c102fd7ff | train | function | def teardown_function(function):
# Delete environment variable if set.
if "RAY_ADDRESS" in os.environ:
del os.environ["RAY_ADDRESS"]
| def teardown_function(function):
# Delete environment variable if set.
| if "RAY_ADDRESS" in os.environ:
del os.environ["RAY_ADDRESS"]
| math
import ray
from ray._private.test_utils import SignalActor
from ray.util.multiprocessing import Pool, TimeoutError, JoinableQueue
from ray.util.joblib import register_ray
from joblib import parallel_backend, Parallel, delayed
def teardown_function(function):
# Delete environment variable if set.
| 64 | 64 | 33 | 13 | 50 | mgelbart/ray | python/ray/tests/test_multiprocessing.py | Python | teardown_function | teardown_function | 21 | 24 | 21 | 22 | 8d022bb5d609d317e73312e330338ae5188aaa79 | bigcode/the-stack | train |
9a98095175505f9a80394570 | train | class | class CPWHangerT(QComponent):
"""Generates a three pin (+) structure comprised of a primary two pin CPW transmission line,
and a secondary one pin neighboring CPW transmission line that is capacitively/inductively
coupled to the primary. Such a structure can be used, as an example, for generating
CPW re... | class CPWHangerT(QComponent):
| """Generates a three pin (+) structure comprised of a primary two pin CPW transmission line,
and a secondary one pin neighboring CPW transmission line that is capacitively/inductively
coupled to the primary. Such a structure can be used, as an example, for generating
CPW resonator hangars off of a trans... | # -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2021.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any... | 165 | 256 | 1,283 | 8 | 156 | lebinyu/qiskit-metal | qiskit_metal/qlibrary/connectors/cpw_hanger_t.py | Python | CPWHangerT | CPWHangerT | 20 | 153 | 20 | 20 | dfc212ebc020815f6941ebf9d35f8948e7bbd332 | bigcode/the-stack | train |
9544c62550304b42348330a9 | train | class | class AttributeUtilsTestCases(unittest.TestCase):
def test_get_attr_types_valid(self):
A = read_csv_metadata(path_a)
x = get_attr_types(A)
@raises(AssertionError)
def test_get_attr_types_invalid_df(self):
x = get_attr_types(None)
def test_get_attr_corres_valid_1(self):
... | class AttributeUtilsTestCases(unittest.TestCase):
| def test_get_attr_types_valid(self):
A = read_csv_metadata(path_a)
x = get_attr_types(A)
@raises(AssertionError)
def test_get_attr_types_invalid_df(self):
x = get_attr_types(None)
def test_get_attr_corres_valid_1(self):
A = read_csv_metadata(path_a)
B = read_csv... | import os
from nose.tools import *
import unittest
import pandas as pd
import six
from py_entitymatching.utils.generic_helper import get_install_path
from py_entitymatching.io.parsers import read_csv_metadata
from py_entitymatching.feature.simfunctions import get_sim_funs_for_matching
from py_entitymatching.feature.to... | 179 | 182 | 608 | 9 | 170 | anhaidgroup/py_entitymatching | py_entitymatching/tests/test_feature_attributeutils.py | Python | AttributeUtilsTestCases | AttributeUtilsTestCases | 21 | 94 | 21 | 21 | ccb95ef3d2bb8c9fd90aa9c1b7d19d5e184e6156 | bigcode/the-stack | train |
5b7cd294ed385e6809a17a87 | train | class | class Migration(migrations.Migration):
dependencies = [
('smartMoney_app', '0016_auto_20211018_1527'),
]
operations = [
migrations.RenameField(
model_name='budget',
old_name='date',
new_name='month',
),
]
| class Migration(migrations.Migration):
| dependencies = [
('smartMoney_app', '0016_auto_20211018_1527'),
]
operations = [
migrations.RenameField(
model_name='budget',
old_name='date',
new_name='month',
),
]
| # Generated by Django 3.2.4 on 2021-10-18 15:30
from django.db import migrations
class Migration(migrations.Migration):
| 36 | 64 | 63 | 7 | 28 | uca-pid/f-al-cuadrado-2021 | backend/smartMoney_project/smartMoney_app/migrations/0017_rename_date_budget_month.py | Python | Migration | Migration | 6 | 18 | 6 | 7 | 14aeefab78b705cb2728c9699d8bef920660c035 | bigcode/the-stack | train |
c0339192342f449956199bfb | train | class | class Resampler(object):
def __init__(self, obj, rule, **kwargs):
if not obj.known_divisions:
msg = ("Can only resample dataframes with known divisions\n"
"See dask.pydata.org/en/latest/dataframe-design.html#partitions\n"
"for more information.")
... | class Resampler(object):
| def __init__(self, obj, rule, **kwargs):
if not obj.known_divisions:
msg = ("Can only resample dataframes with known divisions\n"
"See dask.pydata.org/en/latest/dataframe-design.html#partitions\n"
"for more information.")
raise ValueError(msg)
... | == 'right':
newdivs = tempdivs + res
else:
newdivs = tempdivs
if g.label == 'right':
outdivs = tempdivs + rule
else:
outdivs = tempdivs
newdivs = newdivs.tolist()
outdivs = outdivs.tolist()
# Adjust ends
if newdivs[0] < divisions[0]:
newdivs[0] = di... | 250 | 250 | 835 | 5 | 245 | TryTestspace/dask | dask/dataframe/tseries/resample.py | Python | Resampler | Resampler | 86 | 188 | 86 | 86 | 0079044087cb6aa63a6c65c430f4310dcf2cb96e | bigcode/the-stack | train |
715919361a3619a788ebdb9f | train | function | def _resample(obj, rule, how, **kwargs):
resampler = Resampler(obj, rule, **kwargs)
if how is not None:
w = FutureWarning(("how in .resample() is deprecated "
"the new syntax is .resample(...)"
".{0}()").format(how))
warnings.warn(w)
... | def _resample(obj, rule, how, **kwargs):
| resampler = Resampler(obj, rule, **kwargs)
if how is not None:
w = FutureWarning(("how in .resample() is deprecated "
"the new syntax is .resample(...)"
".{0}()").format(how))
warnings.warn(w)
return getattr(resampler, how)()
retu... | _Resampler
else:
from pandas.tseries.resample import Resampler as pd_Resampler
def getnanos(rule):
try:
return getattr(rule, 'nanos', None)
except ValueError:
return None
def _resample(obj, rule, how, **kwargs):
| 64 | 64 | 89 | 13 | 50 | TryTestspace/dask | dask/dataframe/tseries/resample.py | Python | _resample | _resample | 26 | 34 | 26 | 26 | cf9b835caa88afc68ca60ef7f4b99c2186a56a43 | bigcode/the-stack | train |
790f9a514e8aa6c86cae9ab0 | train | function | def _resample_series(series, start, end, reindex_closed, rule,
resample_kwargs, how, fill_value, how_args, how_kwargs):
out = getattr(series.resample(rule, **resample_kwargs), how)(*how_args, **how_kwargs)
return out.reindex(pd.date_range(start, end, freq=rule,
... | def _resample_series(series, start, end, reindex_closed, rule,
resample_kwargs, how, fill_value, how_args, how_kwargs):
| out = getattr(series.resample(rule, **resample_kwargs), how)(*how_args, **how_kwargs)
return out.reindex(pd.date_range(start, end, freq=rule,
closed=reindex_closed,
name=out.index.name),
fill_value=fill_value)
| "
".{0}()").format(how))
warnings.warn(w)
return getattr(resampler, how)()
return resampler
def _resample_series(series, start, end, reindex_closed, rule,
resample_kwargs, how, fill_value, how_args, how_kwargs):
| 64 | 64 | 93 | 33 | 30 | TryTestspace/dask | dask/dataframe/tseries/resample.py | Python | _resample_series | _resample_series | 37 | 43 | 37 | 38 | f7830f56c3fcf161e7907b146933d6dc9c7b82a0 | bigcode/the-stack | train |
82d04513f920cc8440353d62 | train | function | def _resample_bin_and_out_divs(divisions, rule, closed='left', label='left'):
rule = pd.tseries.frequencies.to_offset(rule)
g = pd.Grouper(freq=rule, how='count', closed=closed, label=label)
# Determine bins to apply `how` to. Disregard labeling scheme.
divs = pd.Series(range(len(divisions)), index=div... | def _resample_bin_and_out_divs(divisions, rule, closed='left', label='left'):
| rule = pd.tseries.frequencies.to_offset(rule)
g = pd.Grouper(freq=rule, how='count', closed=closed, label=label)
# Determine bins to apply `how` to. Disregard labeling scheme.
divs = pd.Series(range(len(divisions)), index=divisions)
temp = divs.resample(rule, closed=closed, label='left').count()
... | )()
return resampler
def _resample_series(series, start, end, reindex_closed, rule,
resample_kwargs, how, fill_value, how_args, how_kwargs):
out = getattr(series.resample(rule, **resample_kwargs), how)(*how_args, **how_kwargs)
return out.reindex(pd.date_range(start, end, freq=rule,
... | 122 | 122 | 408 | 22 | 100 | TryTestspace/dask | dask/dataframe/tseries/resample.py | Python | _resample_bin_and_out_divs | _resample_bin_and_out_divs | 46 | 83 | 46 | 46 | b0ea941a16fc659f17acb2dff3a22b04ca12cc91 | bigcode/the-stack | train |
da904f0765c15e40edaca08f | train | function | def getnanos(rule):
try:
return getattr(rule, 'nanos', None)
except ValueError:
return None
| def getnanos(rule):
| try:
return getattr(rule, 'nanos', None)
except ValueError:
return None
| ...base import tokenize
from ...utils import derived_from
if PANDAS_VERSION >= '0.20.0':
from pandas.core.resample import Resampler as pd_Resampler
else:
from pandas.tseries.resample import Resampler as pd_Resampler
def getnanos(rule):
| 64 | 64 | 29 | 6 | 57 | TryTestspace/dask | dask/dataframe/tseries/resample.py | Python | getnanos | getnanos | 19 | 23 | 19 | 19 | 407c1fb9fc72f619525625d3f4adf1506c47bd76 | bigcode/the-stack | train |
7871a099c2553bca03cb43d5 | train | function | def get_model_file(model_name,
local_model_store_dir_path=os.path.join("~", ".mxnet", "models")):
"""
Return location for the pretrained on local file system. This function will download from online model zoo when
model cannot be found or has mismatch. The root directory will be created i... | def get_model_file(model_name,
local_model_store_dir_path=os.path.join("~", ".mxnet", "models")):
| """
Return location for the pretrained on local file system. This function will download from online model zoo when
model cannot be found or has mismatch. The root directory will be created if it doesn't exist.
Parameters
----------
model_name : str
Name of the model.
local_model_st... | f6d8ccdc758', 'v0.0.459'),
]}
imgclsmob_repo_url = 'https://github.com/osmr/imgclsmob'
def get_model_name_suffix_data(model_name):
if model_name not in _model_sha1:
raise ValueError("Pretrained model for {name} is not available.".format(name=model_name))
error, sha1_hash, repo_release_tag = _model_sh... | 136 | 136 | 456 | 27 | 108 | oliviaweng/imgclsmob | gluon/gluoncv2/models/model_store.py | Python | get_model_file | get_model_file | 613 | 665 | 613 | 614 | 3733663e627729c4af9fed97cc7355bb05a240db | bigcode/the-stack | train |
2b0ec0c4dc58a5bd60ee371a | train | function | def get_model_name_suffix_data(model_name):
if model_name not in _model_sha1:
raise ValueError("Pretrained model for {name} is not available.".format(name=model_name))
error, sha1_hash, repo_release_tag = _model_sha1[model_name]
return error, sha1_hash, repo_release_tag
| def get_model_name_suffix_data(model_name):
| if model_name not in _model_sha1:
raise ValueError("Pretrained model for {name} is not available.".format(name=model_name))
error, sha1_hash, repo_release_tag = _model_sha1[model_name]
return error, sha1_hash, repo_release_tag
| 6486', '024d1fafb7471572129ccbb07d662f6d8ccdc758', 'v0.0.459'),
]}
imgclsmob_repo_url = 'https://github.com/osmr/imgclsmob'
def get_model_name_suffix_data(model_name):
| 64 | 64 | 72 | 9 | 55 | oliviaweng/imgclsmob | gluon/gluoncv2/models/model_store.py | Python | get_model_name_suffix_data | get_model_name_suffix_data | 606 | 610 | 606 | 606 | 692fa9e764a8f42acf247cadc0fc6d6e4795d5bf | bigcode/the-stack | train |
af2a81bbc817684c69b7c4a1 | train | class | class Solution:
# @param points, a list of Points
# @return an integer
def maxPoints(self, points):
N = len(points)
if N <= 2:
return N
max_points = 2
for i in range(N-1):
p1 = points[i]
same = 1
verti = 0
slot = {}
... | class Solution:
# @param points, a list of Points
# @return an integer
| def maxPoints(self, points):
N = len(points)
if N <= 2:
return N
max_points = 2
for i in range(N-1):
p1 = points[i]
same = 1
verti = 0
slot = {}
max_slot = 0
for j in range(i+1, N):
p2... | maximum number of points that lie on the same straight line.
"""
# Definition for a point
# class Point:
# def __init__(self, a=0, b=0):
# self.x = a
# self.y = b
class Solution:
# @param points, a list of Points
# @return an integer
| 74 | 74 | 247 | 21 | 52 | cyandterry/Python-Study | Ninja/Leetcode/149_Max_Points_on_a_Line.py | Python | Solution | Solution | 11 | 38 | 11 | 13 | b93474a5c78eb12c0a897c60695b0736dacc844f | bigcode/the-stack | train |
ea61ca30e50ef1166aee983a | train | function | def symlink_other(src, dst):
os.symlink(src, dst)
| def symlink_other(src, dst):
| os.symlink(src, dst)
| import os
import subprocess
import sys
def symlink_win(src, dst):
subprocess.call(["mklink", dst, src])
def symlink_other(src, dst):
| 36 | 64 | 16 | 8 | 28 | yext/icbm | icbm/symlink.py | Python | symlink_other | symlink_other | 8 | 9 | 8 | 8 | b398fedc242563761a90df5ebd073746f1676265 | bigcode/the-stack | train |
345961bd296ce0d8a04964b5 | train | function | def symlink_win(src, dst):
subprocess.call(["mklink", dst, src])
| def symlink_win(src, dst):
| subprocess.call(["mklink", dst, src])
| import os
import subprocess
import sys
def symlink_win(src, dst):
| 17 | 64 | 19 | 8 | 8 | yext/icbm | icbm/symlink.py | Python | symlink_win | symlink_win | 5 | 6 | 5 | 5 | 5efc87c0abe15a79cfc3d05222e8ebce77c4c438 | bigcode/the-stack | train |
60e4fdfefd30be3185b121ea | train | class | class BuiltinDictFunctionTests(BuiltinFunctionTestCase, TranspileTestCase):
functions = ["dict"]
| class BuiltinDictFunctionTests(BuiltinFunctionTestCase, TranspileTestCase):
| functions = ["dict"]
| from .. utils import TranspileTestCase, BuiltinFunctionTestCase
class DictTests(TranspileTestCase):
pass
class BuiltinDictFunctionTests(BuiltinFunctionTestCase, TranspileTestCase):
| 44 | 64 | 23 | 17 | 26 | jacebrowning/voc | tests/builtins/test_dict.py | Python | BuiltinDictFunctionTests | BuiltinDictFunctionTests | 8 | 9 | 8 | 8 | 814fca8375eae661ce4c11cba8afa19acdeb08fc | bigcode/the-stack | train |
1e7e2b8423104ec831ea5237 | train | class | class DictTests(TranspileTestCase):
pass
| class DictTests(TranspileTestCase):
| pass
| from .. utils import TranspileTestCase, BuiltinFunctionTestCase
class DictTests(TranspileTestCase):
| 24 | 64 | 12 | 9 | 14 | jacebrowning/voc | tests/builtins/test_dict.py | Python | DictTests | DictTests | 4 | 5 | 4 | 4 | ca6dfac1b105d1f23f023b93bac916d878f42315 | bigcode/the-stack | train |
be7095aa6acf216908fac9af | train | class | class EFriendFlags(SteamIntEnum):
NONE = 0
Blocked = 1
FriendshipRequested = 2
Immediate = 4
ClanMember = 8
OnGameServer = 16
RequestingFriendship = 128
RequestingInfo = 256
Ignored = 512
IgnoredFriend = 1024
Suggested = 2048
ChatMember = 4096
FlagAll = 65535
| class EFriendFlags(SteamIntEnum):
| NONE = 0
Blocked = 1
FriendshipRequested = 2
Immediate = 4
ClanMember = 8
OnGameServer = 16
RequestingFriendship = 128
RequestingInfo = 256
Ignored = 512
IgnoredFriend = 1024
Suggested = 2048
ChatMember = 4096
FlagAll = 65535
| ClansOnlyFromFriends = 67108864
GlobalModerator = 134217728
ParentalSettings = 268435456
ThirdPartySupport = 536870912
NeedsSSANextSteamLogon = 1073741824
class EFriendFlags(SteamIntEnum):
| 64 | 64 | 106 | 9 | 54 | gosuai/steam | steam/enums/common.py | Python | EFriendFlags | EFriendFlags | 371 | 384 | 371 | 371 | bf320071e922b8d31751a9f79887a22c38b49f9b | bigcode/the-stack | train |
70abd175d96ae57b8c2b1134 | train | class | class EFriendRelationship(SteamIntEnum):
NONE = 0
Blocked = 1
RequestRecipient = 2
Friend = 3
RequestInitiator = 4
Ignored = 5
IgnoredFriend = 6
SuggestedFriend = 7
Max = 8
| class EFriendRelationship(SteamIntEnum):
| NONE = 0
Blocked = 1
RequestRecipient = 2
Friend = 3
RequestInitiator = 4
Ignored = 5
IgnoredFriend = 6
SuggestedFriend = 7
Max = 8
| 81"
Windows81 = 14
Win2012R2 = 15
# Win10 = 16 # obsolete "renamed to Windows10"
Windows10 = 16
WinMAX = 15
Max = 26
class EFriendRelationship(SteamIntEnum):
| 64 | 64 | 71 | 9 | 54 | gosuai/steam | steam/enums/common.py | Python | EFriendRelationship | EFriendRelationship | 324 | 333 | 324 | 324 | f6443e581ea03f84a35ebf9d3944f83b0eb1032f | bigcode/the-stack | train |
197067dd6a0a13203f0409dc | train | class | class EClientPersonaStateFlag(SteamIntEnum):
Status = 1
PlayerName = 2
QueryPort = 4
SourceID = 8
Presence = 16
Metadata = 32 # obsolete
LastSeen = 64
ClanInfo = 128
GameExtraInfo = 256
GameDataBlob = 512
ClanTag = 1024
Facebook = 2048
| class EClientPersonaStateFlag(SteamIntEnum):
| Status = 1
PlayerName = 2
QueryPort = 4
SourceID = 8
Presence = 16
Metadata = 32 # obsolete
LastSeen = 64
ClanInfo = 128
GameExtraInfo = 256
GameDataBlob = 512
ClanTag = 1024
Facebook = 2048
| to ClientTypeTenfoot"
ClientTypeTenfoot = 1024
# OnlineUsingVR = 2048 obsolete "renamed to ClientTypeVR"
ClientTypeVR = 2048
LaunchTypeGamepad = 4096
class EClientPersonaStateFlag(SteamIntEnum):
| 64 | 64 | 98 | 11 | 52 | gosuai/steam | steam/enums/common.py | Python | EClientPersonaStateFlag | EClientPersonaStateFlag | 413 | 425 | 413 | 413 | 0ec4551fee35f1217647fa37f208a361f2a1ced2 | bigcode/the-stack | train |
376d099ce4994e56a2e7e68f | train | class | class ELeaderboardDataRequest(SteamIntEnum):
Global = 0
GlobalAroundUser = 1
Friends = 2
Users = 3
| class ELeaderboardDataRequest(SteamIntEnum):
| Global = 0
GlobalAroundUser = 1
Friends = 2
Users = 3
| Metadata = 32 # obsolete
LastSeen = 64
ClanInfo = 128
GameExtraInfo = 256
GameDataBlob = 512
ClanTag = 1024
Facebook = 2048
class ELeaderboardDataRequest(SteamIntEnum):
| 64 | 64 | 36 | 10 | 53 | gosuai/steam | steam/enums/common.py | Python | ELeaderboardDataRequest | ELeaderboardDataRequest | 428 | 432 | 428 | 428 | 76d974099e903c4d1aac56b666bd0f3833775f22 | bigcode/the-stack | train |
f1f5b50216797607a5488990 | train | class | class EOSType(SteamIntEnum):
Unknown = -1
IOSUnknown = -600
AndroidUnknown = -500
UMQ = -400
PS3 = -300
MacOSUnknown = -102
MacOS104 = -101
MacOS105 = -100
MacOS1058 = -99
MacOS106 = -95
MacOS1063 = -94
MacOS1064_slgu = -93
MacOS1067 = -92
MacOS107 = -90
... | class EOSType(SteamIntEnum):
| Unknown = -1
IOSUnknown = -600
AndroidUnknown = -500
UMQ = -400
PS3 = -300
MacOSUnknown = -102
MacOS104 = -101
MacOS105 = -100
MacOS1058 = -99
MacOS106 = -95
MacOS1063 = -94
MacOS1064_slgu = -93
MacOS1067 = -92
MacOS107 = -90
MacOS108 = -89
MacOS109 =... | PublicTest = 80
SolrMgr = 81
BroadcastRelay = 82
BroadcastDirectory = 83
VideoManager = 84
TradeOffer = 85
BroadcastChat = 86
Phone = 87
AccountScore = 88
Support = 89
LogRequest = 90
LogWorker = 91
EmailDelivery = 92
InventoryManagement = 93
Auth = 94
StoreC... | 132 | 132 | 442 | 9 | 122 | gosuai/steam | steam/enums/common.py | Python | EOSType | EOSType | 259 | 321 | 259 | 259 | 308617b1723e102bcf4d82e2401d720dd9b2f569 | bigcode/the-stack | train |
5d2de2aae22ac45ba808fd24 | train | class | class EResult(SteamIntEnum):
Invalid = 0
OK = 1 #: success
Fail = 2 #: generic failure
NoConnection = 3 #: no/failed network connection
# NoConnectionRetry = 4 #: OBSOLETE - removed
InvalidPassword = 5 ... | class EResult(SteamIntEnum):
| Invalid = 0
OK = 1 #: success
Fail = 2 #: generic failure
NoConnection = 3 #: no/failed network connection
# NoConnectionRetry = 4 #: OBSOLETE - removed
InvalidPassword = 5 #: password/ticket i... | from steam.enums.base import SteamIntEnum
class EResult(SteamIntEnum):
| 17 | 256 | 1,924 | 8 | 8 | gosuai/steam | steam/enums/common.py | Python | EResult | EResult | 4 | 115 | 4 | 4 | c1109decf7632f61eaefd6b3976b38063b01deae | bigcode/the-stack | train |
5bfd378c624ec8b8786a8759 | train | class | class EServerType(SteamIntEnum):
Invalid = -1
First = 0
GM = 1
BUM = 2 # obsolete
AM = 3
BS = 4
VS = 5
ATS = 6
CM = 7
FBS = 8
BoxMonitor = 9
SS = 10
DRMS = 11
HubOBSOLETE = 12
Console = 13
PICS = 14
Client = 15
BootstrapOBSOLETE = 16
DP = 17
... | class EServerType(SteamIntEnum):
| Invalid = -1
First = 0
GM = 1
BUM = 2 # obsolete
AM = 3
BS = 4
VS = 5
ATS = 6
CM = 7
FBS = 8
BoxMonitor = 9
SS = 10
DRMS = 11
HubOBSOLETE = 12
Console = 13
PICS = 14
Client = 15
BootstrapOBSOLETE = 16
DP = 17
WG = 18
SM = 19
SLC = ... | 1 #: single user account
Multiseat = 2 #: multiseat (e.g. cybercafe) account
GameServer = 3 #: game server account
AnonGameServer = 4 #: anonymous game server account
Pending = 5 #: pending
ContentServer = 6 #: content server
Clan = 7
Chat = 8
ConsoleUser = 9 ... | 206 | 206 | 688 | 9 | 196 | gosuai/steam | steam/enums/common.py | Python | EServerType | EServerType | 155 | 256 | 155 | 155 | 949546ae964f06dd09040569675f79551db615a4 | bigcode/the-stack | train |
fed93fa6063228ac1a47616d | train | class | class ETwoFactorTokenType(SteamIntEnum):
NONE = 0
ValveMobileApp = 1
ThirdParty = 2
| class ETwoFactorTokenType(SteamIntEnum):
| NONE = 0
ValveMobileApp = 1
ThirdParty = 2
|
Numeric = 1
TimeSeconds = 2
TimeMilliSeconds = 3
class ELeaderboardUploadScoreMethod(SteamIntEnum):
NONE = 0
KeepBest = 1
ForceUpdate = 2
class ETwoFactorTokenType(SteamIntEnum):
| 64 | 64 | 32 | 11 | 52 | gosuai/steam | steam/enums/common.py | Python | ETwoFactorTokenType | ETwoFactorTokenType | 454 | 457 | 454 | 454 | efa41f4992167e291f286c07126e851755d0c843 | bigcode/the-stack | train |
ce66aa0c10332062efa19d38 | train | class | class ECurrencyCode(SteamIntEnum):
Invalid = 0
USD = 1
GBP = 2
EUR = 3
CHF = 4
RUB = 5
PLN = 6
BRL = 7
JPY = 8
NOK = 9
IDR = 10
MYR = 11
PHP = 12
SGD = 13
THB = 14
VND = 15
KRW = 16
TRY = 17
UAH = 18
MXN = 19
CAD = 20
AUD = 21
N... | class ECurrencyCode(SteamIntEnum):
| Invalid = 0
USD = 1
GBP = 2
EUR = 3
CHF = 4
RUB = 5
PLN = 6
BRL = 7
JPY = 8
NOK = 9
IDR = 10
MYR = 11
PHP = 12
SGD = 13
THB = 14
VND = 15
KRW = 16
TRY = 17
UAH = 18
MXN = 19
CAD = 20
AUD = 21
NZD = 22
CNY = 23
INR = 24
... | 12 #: No longer used
NoRankingDataUser = 13 #: No longer used
RankOutOfRange = 14 #: No longer used
RatelimitExceeded = 15 #: Join failed - to many join attempts in a very short period of time
class ECurrencyCode(SteamIntEnum):
| 70 | 70 | 234 | 9 | 60 | gosuai/steam | steam/enums/common.py | Python | ECurrencyCode | ECurrencyCode | 496 | 531 | 496 | 496 | 121d8020beeba17d35cc887e59d8d6458a726eff | bigcode/the-stack | train |
5067e91e2e22ea37fca2d862 | train | class | class EChatRoomEnterResponse(SteamIntEnum):
Success = 1 #: Success
DoesntExist = 2 #: Chat doesn't exist (probably closed)
NotAllowed = 3 #: General Denied - You don't have the permissions needed to join the chat
Full = 4 #: Chat room has reached its maxim... | class EChatRoomEnterResponse(SteamIntEnum):
| Success = 1 #: Success
DoesntExist = 2 #: Chat doesn't exist (probably closed)
NotAllowed = 3 #: General Denied - You don't have the permissions needed to join the chat
Full = 4 #: Chat room has reached its maximum size
Error = 5 #: Unex... | ban)
Disconnected = 10 #: user disconnected
HistoricalChat = 11 #: a chat message from user's chat history or offilne message
Reserved1 = 12 #: No longer used
Reserved2 = 13 #: No longer used
LinkBlocked = 14 #: a link was removed by the chat filter.
class EChatRo... | 86 | 86 | 287 | 11 | 75 | gosuai/steam | steam/enums/common.py | Python | EChatRoomEnterResponse | EChatRoomEnterResponse | 478 | 493 | 478 | 478 | 0c8538a4528316a25681957f64a7ce244b85bfa6 | bigcode/the-stack | train |
4e83c9e558a1909719ac453e | train | class | class EVanityUrlType(SteamIntEnum):
Individual = 1
Group = 2
GameGroup = 3
| class EVanityUrlType(SteamIntEnum):
| Individual = 1
Group = 2
GameGroup = 3
| , etc.
AnonUser = 10
Max = 11
class EInstanceFlag(SteamIntEnum):
MMSLobby = 0x20000
Lobby = 0x40000
Clan = 0x80000
class EVanityUrlType(SteamIntEnum):
| 64 | 64 | 29 | 10 | 53 | gosuai/steam | steam/enums/common.py | Python | EVanityUrlType | EVanityUrlType | 149 | 152 | 149 | 149 | 005de27a0bb26d0cbcf7a66b00e46bcf6e74e9d6 | bigcode/the-stack | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.