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
c27bc91f5283a4ba98b57f90
train
class
class StaffRoles(commands.Cog): """Provides commands for giving/taking away staff roles in a thread""" def __init__(self, bot): self.bot = bot self.db = bot.plugin_db.get_partition(self) @commands.group(aliases=["staffrole"], invoke_without_command=True) async def staff_role(self, ctx)...
class StaffRoles(commands.Cog):
"""Provides commands for giving/taking away staff roles in a thread""" def __init__(self, bot): self.bot = bot self.db = bot.plugin_db.get_partition(self) @commands.group(aliases=["staffrole"], invoke_without_command=True) async def staff_role(self, ctx): """Checks the staff ro...
import discord from core import checks from core.models import PermissionLevel from discord.ext import commands class StaffRoles(commands.Cog):
28
256
1,161
7
20
sourcery-ai-bot/pingpanapeng
staffrole/staffrole.py
Python
StaffRoles
StaffRoles
7
153
7
7
a43e649d46a4004fa51a5a1fa30c2b9b0f6c8944
bigcode/the-stack
train
69e3a1ede2d321d77bf5da78
train
class
class OrganizationValidatorTest(TestCase): def test_valid_organization(self): pralinefile = { 'organization': 'my_organization' } validate_organization(pralinefile) def test_invalid_organization_with_prefix(self): pralinefile = { 'organization': ...
class OrganizationValidatorTest(TestCase):
def test_valid_organization(self): pralinefile = { 'organization': 'my_organization' } validate_organization(pralinefile) def test_invalid_organization_with_prefix(self): pralinefile = { 'organization': '_my_organization' } ...
from praline.common.pralinefile.validation.organization_validator import validate_organization from praline.common.pralinefile.validation.validator import PralinefileValidationError from unittest import TestCase class OrganizationValidatorTest(TestCase):
44
64
186
7
36
dansandu/praline
sources/praline/common/pralinefile/validation/organization_validator_test.py
Python
OrganizationValidatorTest
OrganizationValidatorTest
6
33
6
6
b85c66ee64e4d58ea5c8bc7983860d8e316640e4
bigcode/the-stack
train
81f2b2828564de3069a99b47
train
class
class Server(object): def __init__(self, port): # Update the global settings for the HTTP server and engine cherrypy.config.update({'server.socket_host': "0.0.0.0", 'server.socket_port': int(port), 'server.thread_pool': 10, ...
class Server(object):
def __init__(self, port): # Update the global settings for the HTTP server and engine cherrypy.config.update({'server.socket_host': "0.0.0.0", 'server.socket_port': int(port), 'server.thread_pool': 10, 'e...
# coding=utf-8 """APIIR Server Class """ import cherrypy from apiir.app import App as Apiir class Server(object):
32
64
117
4
27
LSmith-Zenoscave/APIIR
apiir/server.py
Python
Server
Server
9
21
9
9
707d2745870c4c003bdb009b8422ac7fd2202282
bigcode/the-stack
train
3554f606d2c40a15b5a35e0c
train
function
def file_upload_echo(request): """ Simple view to echo back info about uploaded files for tests. """ r = dict((k, f.name) for k, f in request.FILES.items()) return HttpResponse(json.dumps(r))
def file_upload_echo(request):
""" Simple view to echo back info about uploaded files for tests. """ r = dict((k, f.name) for k, f in request.FILES.items()) return HttpResponse(json.dumps(r))
util.rmtree used elsewhere in the tests to clean up the # upload directory has been seen to choke on unicode # filenames on Windows.) obj.delete() os.unlink(full_name) if response: return response else: return HttpResponse('') def file_upload_echo(request):
63
64
51
6
58
benjaoming/django
tests/file_uploads/views.py
Python
file_upload_echo
file_upload_echo
91
96
91
91
adb4346036d06956af4503fb5f492b8f08645e11
bigcode/the-stack
train
00fd43df42afe353a6c9a0a1
train
function
def file_upload_unicode_name(request): # Check to see if unicode name came through properly. if not request.FILES['file_unicode'].name.endswith(UNICODE_FILENAME): return HttpResponseServerError() response = None # Check to make sure the exotic characters are preserved even # through file ...
def file_upload_unicode_name(request): # Check to see if unicode name came through properly.
if not request.FILES['file_unicode'].name.endswith(UNICODE_FILENAME): return HttpResponseServerError() response = None # Check to make sure the exotic characters are preserved even # through file save. uni_named_file = request.FILES['file_unicode'] obj = FileModel.objects.create(testfi...
large file to the database should succeed largefile = request.FILES['file_field2'] obj = FileModel() obj.testfile.save(largefile.name, largefile) return HttpResponse('') def file_upload_unicode_name(request): # Check to see if unicode name came through properly.
63
64
202
19
45
benjaoming/django
tests/file_uploads/views.py
Python
file_upload_unicode_name
file_upload_unicode_name
62
88
62
64
3622cd5469dad2420a06cdde00c0dfd757394fc7
bigcode/the-stack
train
985bec6c22d4861e50c55bf4
train
function
def file_upload_quota_broken(request): """ You can't change handlers after reading FILES; this view shouldn't work. """ response = file_upload_echo(request) request.upload_handlers.insert(0, QuotaUploadHandler()) return response
def file_upload_quota_broken(request):
""" You can't change handlers after reading FILES; this view shouldn't work. """ response = file_upload_echo(request) request.upload_handlers.insert(0, QuotaUploadHandler()) return response
f in request.FILES.items()) return HttpResponse(json.dumps(r)) def file_upload_quota(request): """ Dynamically add in an upload handler. """ request.upload_handlers.insert(0, QuotaUploadHandler()) return file_upload_echo(request) def file_upload_quota_broken(request):
64
64
53
9
55
benjaoming/django
tests/file_uploads/views.py
Python
file_upload_quota_broken
file_upload_quota_broken
115
121
115
115
ec9efecd01def4c5a4c349fcffb591e67eb3de36
bigcode/the-stack
train
d151ced4c68b78bf13049117
train
function
def file_upload_content_type_extra(request): """ Simple view to echo back extra content-type parameters. """ params = {} for file_name, uploadedfile in request.FILES.items(): params[file_name] = dict([ (k, smart_str(v)) for k, v in uploadedfile.content_type_extra.items() ...
def file_upload_content_type_extra(request):
""" Simple view to echo back extra content-type parameters. """ params = {} for file_name, uploadedfile in request.FILES.items(): params[file_name] = dict([ (k, smart_str(v)) for k, v in uploadedfile.content_type_extra.items() ]) return HttpResponse(json.dumps(params)...
): """ Check adding the file to the database will preserve the filename case. """ file = request.FILES['file_field'] obj = FileModel() obj.testfile.save(file.name, file) return HttpResponse('%d' % obj.pk) def file_upload_content_type_extra(request):
64
64
78
8
56
benjaoming/django
tests/file_uploads/views.py
Python
file_upload_content_type_extra
file_upload_content_type_extra
150
159
150
150
44cee5b997804a751f3eac94572708ec4466d351
bigcode/the-stack
train
a183f40ccc8069fd6ed89138
train
function
def file_upload_errors(request): request.upload_handlers.insert(0, ErroringUploadHandler()) return file_upload_echo(request)
def file_upload_errors(request):
request.upload_handlers.insert(0, ErroringUploadHandler()) return file_upload_echo(request)
""" Check the .getlist() function to ensure we receive the correct number of files. """ file_counts = {} for key in request.FILES.keys(): file_counts[key] = len(request.FILES.getlist(key)) return HttpResponse(json.dumps(file_counts)) def file_upload_errors(request):
64
64
26
6
58
benjaoming/django
tests/file_uploads/views.py
Python
file_upload_errors
file_upload_errors
135
137
135
135
78b0626fc4975542dde4f9a8fda8210895f1d5be
bigcode/the-stack
train
c09824094e921099f1a2cf64
train
function
def file_upload_fd_closing(request, access): if access == 't': request.FILES # Trigger file parsing. return HttpResponse('')
def file_upload_fd_closing(request, access):
if access == 't': request.FILES # Trigger file parsing. return HttpResponse('')
params = {} for file_name, uploadedfile in request.FILES.items(): params[file_name] = dict([ (k, smart_str(v)) for k, v in uploadedfile.content_type_extra.items() ]) return HttpResponse(json.dumps(params)) def file_upload_fd_closing(request, access):
64
64
32
10
54
benjaoming/django
tests/file_uploads/views.py
Python
file_upload_fd_closing
file_upload_fd_closing
162
165
162
162
1b2e73c59e5af1f9996a6298cfcc2be0cbd68115
bigcode/the-stack
train
d69800443d662e2bacdfa296
train
function
def file_upload_filename_case_view(request): """ Check adding the file to the database will preserve the filename case. """ file = request.FILES['file_field'] obj = FileModel() obj.testfile.save(file.name, file) return HttpResponse('%d' % obj.pk)
def file_upload_filename_case_view(request):
""" Check adding the file to the database will preserve the filename case. """ file = request.FILES['file_field'] obj = FileModel() obj.testfile.save(file.name, file) return HttpResponse('%d' % obj.pk)
key in request.FILES.keys(): file_counts[key] = len(request.FILES.getlist(key)) return HttpResponse(json.dumps(file_counts)) def file_upload_errors(request): request.upload_handlers.insert(0, ErroringUploadHandler()) return file_upload_echo(request) def file_upload_filename_case_view(request):
64
64
63
8
56
benjaoming/django
tests/file_uploads/views.py
Python
file_upload_filename_case_view
file_upload_filename_case_view
140
147
140
140
6ec9784e4f26758ffab57dfa3ec57365dc8f1529
bigcode/the-stack
train
abc2edbdf3ee97fcef12b235
train
function
def file_upload_view_verify(request): """ Use the sha digest hash to verify the uploaded contents. """ form_data = request.POST.copy() form_data.update(request.FILES) for key, value in form_data.items(): if key.endswith('_hash'): continue if key + '_hash' not in form...
def file_upload_view_verify(request):
""" Use the sha digest hash to verify the uploaded contents. """ form_data = request.POST.copy() form_data.update(request.FILES) for key, value in form_data.items(): if key.endswith('_hash'): continue if key + '_hash' not in form_data: continue su...
is posted, the dummy client should only post the file name, # not the full path. if os.path.dirname(form_data['file_field'].name) != '': return HttpResponseServerError() return HttpResponse('') else: return HttpResponseServerError() def file_upload_view_verify(request):
64
64
185
7
57
benjaoming/django
tests/file_uploads/views.py
Python
file_upload_view_verify
file_upload_view_verify
34
59
34
34
5927586d5c05a08292c76f4191093e8ad254f41e
bigcode/the-stack
train
c47b9fdd951dcaf5b46a5ac7
train
function
def file_upload_getlist_count(request): """ Check the .getlist() function to ensure we receive the correct number of files. """ file_counts = {} for key in request.FILES.keys(): file_counts[key] = len(request.FILES.getlist(key)) return HttpResponse(json.dumps(file_counts))
def file_upload_getlist_count(request):
""" Check the .getlist() function to ensure we receive the correct number of files. """ file_counts = {} for key in request.FILES.keys(): file_counts[key] = len(request.FILES.getlist(key)) return HttpResponse(json.dumps(file_counts))
_echo(request) def file_upload_quota_broken(request): """ You can't change handlers after reading FILES; this view shouldn't work. """ response = file_upload_echo(request) request.upload_handlers.insert(0, QuotaUploadHandler()) return response def file_upload_getlist_count(request):
64
64
67
8
55
benjaoming/django
tests/file_uploads/views.py
Python
file_upload_getlist_count
file_upload_getlist_count
124
132
124
124
1e741a496596fc41c3a081acd5966c5be7741897
bigcode/the-stack
train
a9339ff367c0273d12f94b35
train
function
def file_upload_echo_content(request): """ Simple view to echo back the content of uploaded files for tests. """ r = dict((k, f.read().decode('utf-8')) for k, f in request.FILES.items()) return HttpResponse(json.dumps(r))
def file_upload_echo_content(request):
""" Simple view to echo back the content of uploaded files for tests. """ r = dict((k, f.read().decode('utf-8')) for k, f in request.FILES.items()) return HttpResponse(json.dumps(r))
return HttpResponse('') def file_upload_echo(request): """ Simple view to echo back info about uploaded files for tests. """ r = dict((k, f.name) for k, f in request.FILES.items()) return HttpResponse(json.dumps(r)) def file_upload_echo_content(request):
64
64
59
7
57
benjaoming/django
tests/file_uploads/views.py
Python
file_upload_echo_content
file_upload_echo_content
99
104
99
99
07b9f3170dbdaa7e38ccf82798372ed62c97eca7
bigcode/the-stack
train
34fe4779912615abe82099cd
train
function
def file_upload_quota(request): """ Dynamically add in an upload handler. """ request.upload_handlers.insert(0, QuotaUploadHandler()) return file_upload_echo(request)
def file_upload_quota(request):
""" Dynamically add in an upload handler. """ request.upload_handlers.insert(0, QuotaUploadHandler()) return file_upload_echo(request)
_upload_echo_content(request): """ Simple view to echo back the content of uploaded files for tests. """ r = dict((k, f.read().decode('utf-8')) for k, f in request.FILES.items()) return HttpResponse(json.dumps(r)) def file_upload_quota(request):
64
64
40
7
57
benjaoming/django
tests/file_uploads/views.py
Python
file_upload_quota
file_upload_quota
107
112
107
107
c8511bda238a365f623c5ab7ff0010995df428e5
bigcode/the-stack
train
22997ab5be800267a6f102f8
train
function
def file_upload_view(request): """ Check that a file upload can be updated into the POST dictionary without going pear-shaped. """ form_data = request.POST.copy() form_data.update(request.FILES) if isinstance(form_data.get('file_field'), UploadedFile) and isinstance(form_data['name'], six.te...
def file_upload_view(request):
""" Check that a file upload can be updated into the POST dictionary without going pear-shaped. """ form_data = request.POST.copy() form_data.update(request.FILES) if isinstance(form_data.get('file_field'), UploadedFile) and isinstance(form_data['name'], six.text_type): # If a file i...
Response, HttpResponseServerError from django.utils import six from django.utils.encoding import force_bytes, smart_str from .models import FileModel from .tests import UNICODE_FILENAME, UPLOAD_TO from .uploadhandler import QuotaUploadHandler, ErroringUploadHandler def file_upload_view(request):
64
64
132
6
57
benjaoming/django
tests/file_uploads/views.py
Python
file_upload_view
file_upload_view
17
31
17
17
4959748a7d469ef92d68c22288b292c38f6c7865
bigcode/the-stack
train
9150705f14b84e44d63df647
train
function
def test_update_template(): update_template(old_var, '{}.nc.{}'.format(old_var, source_name)) config = SafeConfigParser() config.read(old_tmpl_file) assert_true(config.has_section(source_name))
def test_update_template():
update_template(old_var, '{}.nc.{}'.format(old_var, source_name)) config = SafeConfigParser() config.read(old_tmpl_file) assert_true(config.has_section(source_name))
assert_true(old_var in param['value']['choices']) def test_create_template(): update_template(new_var, '{}.nc.{}'.format(new_var, source_name)) config = SafeConfigParser() config.read(new_tmpl_file) assert_true(config.has_section(source_name)) def test_update_template():
64
64
47
5
59
permamodel/pbs-server
pbs_server/tests/test_variables.py
Python
test_update_template
test_update_template
64
68
64
64
ca370e9385b070b935d7e62ab9e155bf7e2c9acb
bigcode/the-stack
train
ad304ce972b9ff9b8c8b0dc7
train
function
def test_get_name(): name = get_name(variable_file) assert_equal(variable_name, name)
def test_get_name():
name = get_name(variable_file) assert_equal(variable_name, name)
_file, 'r') as fp: parameters = json.load(fp) def setup_module(): shutil.copy(old_tmpl_file, old_tmpl_file_copy) def teardown_module(): shutil.move(old_tmpl_file_copy, old_tmpl_file) os.remove(new_tmpl_file) def test_get_name():
64
64
21
5
59
permamodel/pbs-server
pbs_server/tests/test_variables.py
Python
test_get_name
test_get_name
39
41
39
39
514182bdc84bfa9c6d611cb476268fc0dabb8cfc
bigcode/the-stack
train
2c81335f3b9a6c914f5594c7
train
function
def test_update_parameters_pretest(): for param in parameters: if param['key'] == '_variable1': assert_false(new_var in param['value']['choices'])
def test_update_parameters_pretest():
for param in parameters: if param['key'] == '_variable1': assert_false(new_var in param['value']['choices'])
_tmpl_file, old_tmpl_file_copy) def teardown_module(): shutil.move(old_tmpl_file_copy, old_tmpl_file) os.remove(new_tmpl_file) def test_get_name(): name = get_name(variable_file) assert_equal(variable_name, name) def test_update_parameters_pretest():
64
64
36
7
57
permamodel/pbs-server
pbs_server/tests/test_variables.py
Python
test_update_parameters_pretest
test_update_parameters_pretest
44
47
44
44
2b7e63c77620d133be0e2096b01053770ed15131
bigcode/the-stack
train
2f8339b44ce949272f1787e0
train
function
def teardown_module(): shutil.move(old_tmpl_file_copy, old_tmpl_file) os.remove(new_tmpl_file)
def teardown_module():
shutil.move(old_tmpl_file_copy, old_tmpl_file) os.remove(new_tmpl_file)
'{}.cfg.tmpl'.format(new_var)) parameters_file = os.path.join(data_directory, 'parameters.json') with open(parameters_file, 'r') as fp: parameters = json.load(fp) def setup_module(): shutil.copy(old_tmpl_file, old_tmpl_file_copy) def teardown_module():
64
64
26
4
60
permamodel/pbs-server
pbs_server/tests/test_variables.py
Python
teardown_module
teardown_module
34
36
34
34
a33c1f58edca7bdd85355ded5a18d7a355b990eb
bigcode/the-stack
train
27f3d8ac59a3f3bbe7fef013
train
function
def test_update_parameters(): update_parameters(parameters, variables) for param in parameters: if param['key'] == '_variable1': assert_true(old_var in param['value']['choices'])
def test_update_parameters():
update_parameters(parameters, variables) for param in parameters: if param['key'] == '_variable1': assert_true(old_var in param['value']['choices'])
) def test_get_name(): name = get_name(variable_file) assert_equal(variable_name, name) def test_update_parameters_pretest(): for param in parameters: if param['key'] == '_variable1': assert_false(new_var in param['value']['choices']) def test_update_parameters():
63
64
41
5
58
permamodel/pbs-server
pbs_server/tests/test_variables.py
Python
test_update_parameters
test_update_parameters
50
54
50
50
a7767dbdf26b64126bbfc64a53966b25060fba52
bigcode/the-stack
train
c0f82abec220ad718917040c
train
function
def test_create_template(): update_template(new_var, '{}.nc.{}'.format(new_var, source_name)) config = SafeConfigParser() config.read(new_tmpl_file) assert_true(config.has_section(source_name))
def test_create_template():
update_template(new_var, '{}.nc.{}'.format(new_var, source_name)) config = SafeConfigParser() config.read(new_tmpl_file) assert_true(config.has_section(source_name))
'_variable1': assert_false(new_var in param['value']['choices']) def test_update_parameters(): update_parameters(parameters, variables) for param in parameters: if param['key'] == '_variable1': assert_true(old_var in param['value']['choices']) def test_create_template():
63
64
47
5
58
permamodel/pbs-server
pbs_server/tests/test_variables.py
Python
test_create_template
test_create_template
57
61
57
57
a74ae3a3c7fd21d248c7b17ef2730e1bd196b7a3
bigcode/the-stack
train
cff8aff8f320e9af7f371506
train
function
def setup_module(): shutil.copy(old_tmpl_file, old_tmpl_file_copy)
def setup_module():
shutil.copy(old_tmpl_file, old_tmpl_file_copy)
'.format(old_tmpl_file) new_tmpl_file = os.path.join(data_directory, '{}.cfg.tmpl'.format(new_var)) parameters_file = os.path.join(data_directory, 'parameters.json') with open(parameters_file, 'r') as fp: parameters = json.load(fp) def setup_module():
64
64
18
4
60
permamodel/pbs-server
pbs_server/tests/test_variables.py
Python
setup_module
setup_module
30
31
30
30
fabcb3bface8c628d7a4f33acb5b981aee8bf55d
bigcode/the-stack
train
72fbdfc2f89d34c18b0883ed
train
class
class AlgorithmID: name = "" short_name = "" value = "" type = "" dependence = "" # Initialises object with given parameters def __init__(self, name, value, alg_type, dependence): self.name = name self.short_name = utils.extract_alg_name(name) self.value = value ...
class AlgorithmID:
name = "" short_name = "" value = "" type = "" dependence = "" # Initialises object with given parameters def __init__(self, name, value, alg_type, dependence): self.name = name self.short_name = utils.extract_alg_name(name) self.value = value self.type = alg...
# -*- coding: utf-8 -*- from modules import utils # Class for internal representation of Algorithm IDs class AlgorithmID:
26
64
88
4
21
evolation/tpm2simulator
scripts/modules/part2_structures/tpm2_part2_structures_alg_ids.py
Python
AlgorithmID
AlgorithmID
7
20
7
7
5663e0cb6c42131b44dceee6df984b3182f14dfe
bigcode/the-stack
train
97f8710df94f33060f233614
train
class
class AlgorithmIDs: def __init__(self): self.tpm_alg_ids = dict() # Extract list of algorithm IDs for each algorithm type # Parameters: # table - internal representation of the table to extract algorithm IDs from def extract(self, table): # initialization self.tpm_alg_ids[...
class AlgorithmIDs:
def __init__(self): self.tpm_alg_ids = dict() # Extract list of algorithm IDs for each algorithm type # Parameters: # table - internal representation of the table to extract algorithm IDs from def extract(self, table): # initialization self.tpm_alg_ids['!ALG'] = [] ...
# -*- coding: utf-8 -*- from modules import utils # Class for internal representation of Algorithm IDs class AlgorithmID: name = "" short_name = "" value = "" type = "" dependence = "" # Initialises object with given parameters def __init__(self, name, value, alg_type, dependence): ...
128
256
1,022
4
123
evolation/tpm2simulator
scripts/modules/part2_structures/tpm2_part2_structures_alg_ids.py
Python
AlgorithmIDs
AlgorithmIDs
24
105
24
25
76a9e415ed121cabc550173acc7302db90390a09
bigcode/the-stack
train
c377949f65fca02e6756efdc
train
function
@pytest.mark.parametrize( argnames=["sensor"], argvalues=[ [lazy_fixture("pressure_sensor")], [lazy_fixture("capacitive_sensor")], [lazy_fixture("temperature_sensor")], [lazy_fixture("humidity_sensor")], ], ) async def test_receive_data_read( sensor: sensor_abc.AbstractAd...
@pytest.mark.parametrize( argnames=["sensor"], argvalues=[ [lazy_fixture("pressure_sensor")], [lazy_fixture("capacitive_sensor")], [lazy_fixture("temperature_sensor")], [lazy_fixture("humidity_sensor")], ], ) async def test_receive_data_read( sensor: sensor_abc.AbstractAd...
"""Test that data is received from the read function.""" def responder(node_id: NodeId, message: MessageDefinition) -> None: """Message responder.""" can_message_notifier.notify( ReadFromSensorResponse( payload=ReadFromSensorResponsePayload( senso...
@pytest.mark.parametrize( argnames=["sensor"], argvalues=[ [lazy_fixture("pressure_sensor")], [lazy_fixture("capacitive_sensor")], [lazy_fixture("temperature_sensor")], [lazy_fixture("humidity_sensor")], ], ) async def test_receive_data_read( sensor: sensor_abc.AbstractAd...
95
82
276
95
0
anuwrag/opentrons
hardware/tests/opentrons_hardware/sensors/test_sensor_drivers.py
Python
test_receive_data_read
test_receive_data_read
245
282
245
258
5781d1b57b43be8c8d6ea3a36df7c5aa098190c4
bigcode/the-stack
train
62923baa17681252e32b7938
train
function
@pytest.fixture def capacitive_sensor() -> fdc1004.CapacitiveSensor: """Fixture for capacitive sensor driver.""" return fdc1004.CapacitiveSensor()
@pytest.fixture def capacitive_sensor() -> fdc1004.CapacitiveSensor:
"""Fixture for capacitive sensor driver.""" return fdc1004.CapacitiveSensor()
.sensors.utils import SensorDataType @pytest.fixture def pressure_sensor() -> mmr920C04.PressureSensor: """Fixture for pressure sensor driver.""" return mmr920C04.PressureSensor() @pytest.fixture def capacitive_sensor() -> fdc1004.CapacitiveSensor:
64
64
38
18
46
anuwrag/opentrons
hardware/tests/opentrons_hardware/sensors/test_sensor_drivers.py
Python
capacitive_sensor
capacitive_sensor
44
47
44
45
bf4b76fc95988c02682a0ae6a3e7c84cc4dcb1c4
bigcode/the-stack
train
57ac25610319d308bc3a9176
train
function
@pytest.fixture def temperature_sensor() -> hdc2080.EnvironmentSensor: """Fixture for temperature sensor driver.""" return hdc2080.EnvironmentSensor(SensorType.temperature)
@pytest.fixture def temperature_sensor() -> hdc2080.EnvironmentSensor:
"""Fixture for temperature sensor driver.""" return hdc2080.EnvironmentSensor(SensorType.temperature)
return mmr920C04.PressureSensor() @pytest.fixture def capacitive_sensor() -> fdc1004.CapacitiveSensor: """Fixture for capacitive sensor driver.""" return fdc1004.CapacitiveSensor() @pytest.fixture def temperature_sensor() -> hdc2080.EnvironmentSensor:
64
64
36
15
49
anuwrag/opentrons
hardware/tests/opentrons_hardware/sensors/test_sensor_drivers.py
Python
temperature_sensor
temperature_sensor
50
53
50
51
781e7d8f802726c9f806237ccc1a0a58aadb5ca6
bigcode/the-stack
train
17238c64ff68c37356c5babb
train
function
@pytest.mark.parametrize( argnames=["sensor", "node", "message"], argvalues=[ [ lazy_fixture("pressure_sensor"), NodeId.pipette_left, BaselineSensorRequest( payload=BaselineSensorRequestPayload( sensor=SensorTypeField(SensorType.pre...
@pytest.mark.parametrize( argnames=["sensor", "node", "message"], argvalues=[ [ lazy_fixture("pressure_sensor"), NodeId.pipette_left, BaselineSensorRequest( payload=BaselineSensorRequestPayload( sensor=SensorTypeField(SensorType.pre...
"""Test that a polling function sends the expected message.""" messenger = mock.AsyncMock(spec=CanMessenger) await sensor.poll(messenger, node, 10) messenger.send.assert_called_once_with(node_id=node, message=message)
@pytest.mark.parametrize( argnames=["sensor", "node", "message"], argvalues=[ [ lazy_fixture("pressure_sensor"), NodeId.pipette_left, BaselineSensorRequest( payload=BaselineSensorRequestPayload( sensor=SensorTypeField(SensorType.pre...
191
72
241
191
0
anuwrag/opentrons
hardware/tests/opentrons_hardware/sensors/test_sensor_drivers.py
Python
test_polling
test_polling
62
95
62
91
40d47b82964df5d7ff80dd5fba0bc591cdc67ff5
bigcode/the-stack
train
4e7d37ef34141cb2206e6152
train
function
@pytest.mark.parametrize( argnames=["sensor"], argvalues=[[lazy_fixture("pressure_sensor")], [lazy_fixture("capacitive_sensor")]], ) async def test_threshold( sensor: sensor_abc.AbstractAdvancedSensor, mock_messenger: mock.AsyncMock, can_message_notifier: MockCanMessageNotifier, ) -> None: """Te...
@pytest.mark.parametrize( argnames=["sensor"], argvalues=[[lazy_fixture("pressure_sensor")], [lazy_fixture("capacitive_sensor")]], ) async def test_threshold( sensor: sensor_abc.AbstractAdvancedSensor, mock_messenger: mock.AsyncMock, can_message_notifier: MockCanMessageNotifier, ) -> None:
"""Test that data is received from the threshold function.""" def responder(node_id: NodeId, message: MessageDefinition) -> None: """Message responder.""" can_message_notifier.notify( SensorThresholdResponse( payload=SensorThresholdResponsePayload( ...
assert return_data == SensorDataType.build([0x100]) @pytest.mark.parametrize( argnames=["sensor"], argvalues=[[lazy_fixture("pressure_sensor")], [lazy_fixture("capacitive_sensor")]], ) async def test_threshold( sensor: sensor_abc.AbstractAdvancedSensor, mock_messenger: mock.AsyncMock, can_messag...
84
84
281
70
14
anuwrag/opentrons
hardware/tests/opentrons_hardware/sensors/test_sensor_drivers.py
Python
test_threshold
test_threshold
285
320
285
293
97e4fe33daff2bbabdfe1f93c614b9140af1afeb
bigcode/the-stack
train
c069037a876713e76ae819cf
train
function
@pytest.fixture def pressure_sensor() -> mmr920C04.PressureSensor: """Fixture for pressure sensor driver.""" return mmr920C04.PressureSensor()
@pytest.fixture def pressure_sensor() -> mmr920C04.PressureSensor:
"""Fixture for pressure sensor driver.""" return mmr920C04.PressureSensor()
, ReadFromSensorResponsePayload, SensorThresholdResponsePayload, ) from opentrons_hardware.firmware_bindings.messages.fields import SensorTypeField from opentrons_hardware.sensors.utils import SensorDataType @pytest.fixture def pressure_sensor() -> mmr920C04.PressureSensor:
64
64
38
18
45
anuwrag/opentrons
hardware/tests/opentrons_hardware/sensors/test_sensor_drivers.py
Python
pressure_sensor
pressure_sensor
38
41
38
39
6fac4702f1d1653131b8cbd5eb70971fd59f5f02
bigcode/the-stack
train
7608eada23852d7e7ea34fd4
train
function
@pytest.mark.parametrize( argnames=["sensor", "node", "message"], argvalues=[ [ lazy_fixture("pressure_sensor"), NodeId.pipette_left, WriteToSensorRequest( payload=WriteToSensorRequestPayload( sensor=SensorTypeField(SensorType.press...
@pytest.mark.parametrize( argnames=["sensor", "node", "message"], argvalues=[ [ lazy_fixture("pressure_sensor"), NodeId.pipette_left, WriteToSensorRequest( payload=WriteToSensorRequestPayload( sensor=SensorTypeField(SensorType.press...
"""Check that writing sensor data is successful.""" data = SensorDataType.build([0x2, 0x2, 0x0, 0x0]) messenger = mock.AsyncMock(spec=CanMessenger) await sensor.write(messenger, NodeId.pipette_left, data) messenger.send.assert_called_once_with(node_id=node, message=message)
@pytest.mark.parametrize( argnames=["sensor", "node", "message"], argvalues=[ [ lazy_fixture("pressure_sensor"), NodeId.pipette_left, WriteToSensorRequest( payload=WriteToSensorRequestPayload( sensor=SensorTypeField(SensorType.press...
389
140
468
389
0
anuwrag/opentrons
hardware/tests/opentrons_hardware/sensors/test_sensor_drivers.py
Python
test_write
test_write
136
188
136
183
19f7d638dfeaa2883b2ee6632a601e1012efc2e1
bigcode/the-stack
train
3527bcc4838c0b0b270b7efe
train
function
@pytest.mark.parametrize( argnames=["sensor", "node", "message"], argvalues=[ [ lazy_fixture("pressure_sensor"), NodeId.pipette_left, ReadFromSensorRequest( payload=ReadFromSensorRequestPayload( sensor=SensorTypeField(SensorType.pre...
@pytest.mark.parametrize( argnames=["sensor", "node", "message"], argvalues=[ [ lazy_fixture("pressure_sensor"), NodeId.pipette_left, ReadFromSensorRequest( payload=ReadFromSensorRequestPayload( sensor=SensorTypeField(SensorType.pre...
"""Test that a read function sends the expected message.""" messenger = mock.AsyncMock(spec=CanMessenger) await sensor.read(messenger, node, False) messenger.send.assert_called_once_with(node_id=node, message=message)
@pytest.mark.parametrize( argnames=["sensor", "node", "message"], argvalues=[ [ lazy_fixture("pressure_sensor"), NodeId.pipette_left, ReadFromSensorRequest( payload=ReadFromSensorRequestPayload( sensor=SensorTypeField(SensorType.pre...
293
102
342
293
0
anuwrag/opentrons
hardware/tests/opentrons_hardware/sensors/test_sensor_drivers.py
Python
test_read
test_read
191
242
191
238
305a0faad453b71de179467890a071aa6dfafb9c
bigcode/the-stack
train
dc1e907ae0802d1d80e2b75f
train
function
@pytest.fixture def humidity_sensor() -> hdc2080.EnvironmentSensor: """Fixture for humidity sensor driver.""" return hdc2080.EnvironmentSensor(SensorType.humidity)
@pytest.fixture def humidity_sensor() -> hdc2080.EnvironmentSensor:
"""Fixture for humidity sensor driver.""" return hdc2080.EnvironmentSensor(SensorType.humidity)
driver.""" return fdc1004.CapacitiveSensor() @pytest.fixture def temperature_sensor() -> hdc2080.EnvironmentSensor: """Fixture for temperature sensor driver.""" return hdc2080.EnvironmentSensor(SensorType.temperature) @pytest.fixture def humidity_sensor() -> hdc2080.EnvironmentSensor:
64
64
37
15
49
anuwrag/opentrons
hardware/tests/opentrons_hardware/sensors/test_sensor_drivers.py
Python
humidity_sensor
humidity_sensor
56
59
56
57
f20b1359af01b83bb734c94c59e981070d38d282
bigcode/the-stack
train
ca428668749b00189112ca88
train
function
@pytest.mark.parametrize( argnames=["sensor"], argvalues=[ [lazy_fixture("pressure_sensor")], [lazy_fixture("capacitive_sensor")], ], ) async def test_receive_data_polling( sensor: sensor_abc.AbstractAdvancedSensor, mock_messenger: mock.AsyncMock, can_message_notifier: MockCanMes...
@pytest.mark.parametrize( argnames=["sensor"], argvalues=[ [lazy_fixture("pressure_sensor")], [lazy_fixture("capacitive_sensor")], ], ) async def test_receive_data_polling( sensor: sensor_abc.AbstractAdvancedSensor, mock_messenger: mock.AsyncMock, can_message_notifier: MockCanMes...
"""Test that data is received from the polling function.""" def responder(node_id: NodeId, message: MessageDefinition) -> None: """Message responder.""" can_message_notifier.notify( ReadFromSensorResponse( payload=ReadFromSensorResponsePayload( se...
@pytest.mark.parametrize( argnames=["sensor"], argvalues=[ [lazy_fixture("pressure_sensor")], [lazy_fixture("capacitive_sensor")], ], ) async def test_receive_data_polling( sensor: sensor_abc.AbstractAdvancedSensor, mock_messenger: mock.AsyncMock, can_message_notifier: MockCanMes...
78
77
257
78
0
anuwrag/opentrons
hardware/tests/opentrons_hardware/sensors/test_sensor_drivers.py
Python
test_receive_data_polling
test_receive_data_polling
98
133
98
109
32047a6d5175672d60e8860ee36e6caa9dc44859
bigcode/the-stack
train
6d79e53eaa44f300d08e2314
train
class
class Migration(migrations.Migration): dependencies = [ ('core', '0002_tag'), ] operations = [ migrations.CreateModel( name='Ingredient', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ...
class Migration(migrations.Migration):
dependencies = [ ('core', '0002_tag'), ] operations = [ migrations.CreateModel( name='Ingredient', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(ma...
# Generated by Django 2.1.15 on 2020-05-22 23:26 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration):
51
64
103
7
43
alanclaros/recipe-app-api
app/core/migrations/0003_ingredient.py
Python
Migration
Migration
8
23
8
9
b604dc7b3b148d47c88091d2254e4e7111112386
bigcode/the-stack
train
6471ec59b1f5ea583875eaa9
train
function
def execute_many(script, tuples, database_path, message="data", method=2, debug=True): start, end = None, None if debug: start = time.time() print("\nInserting {} ...".format(message)) conn = sqlite3.connect(database_path) cur = conn.cursor() if method == 1: cur.executemany...
def execute_many(script, tuples, database_path, message="data", method=2, debug=True):
start, end = None, None if debug: start = time.time() print("\nInserting {} ...".format(message)) conn = sqlite3.connect(database_path) cur = conn.cursor() if method == 1: cur.executemany(script, tuples) else: for item in tuples: try: ...
import sqlite3 import time def execute_many(script, tuples, database_path, message="data", method=2, debug=True):
28
64
159
21
6
enaky/covid-visualizer
apps/PythonBackendApi/db_updater/utils/db_utils.py
Python
execute_many
execute_many
5
29
5
5
ae25882aab4f6e5188b0016f2dc025d2a53b6f7d
bigcode/the-stack
train
3ab3105efe1926154b9bc859
train
function
def execute_script(db_path, script_path, message="", debug=True): start, end = None, None if debug: start = time.time() print("\n*** STARTING SCRIPT FOR {} ***".format(message.upper())) conn = sqlite3.connect(db_path) cur = conn.cursor() try: with open(script_path, "r") as ...
def execute_script(db_path, script_path, message="", debug=True):
start, end = None, None if debug: start = time.time() print("\n*** STARTING SCRIPT FOR {} ***".format(message.upper())) conn = sqlite3.connect(db_path) cur = conn.cursor() try: with open(script_path, "r") as script_file: cur.executescript(script_file.read()) ...
conn.cursor() row = cur.execute(script, tuples).fetchall() conn.close() if debug: end = time.time() print("Finished querying {} in {} seconds".format(message, end - start)) return row def execute_script(db_path, script_path, message="", debug=True):
64
64
141
14
49
enaky/covid-visualizer
apps/PythonBackendApi/db_updater/utils/db_utils.py
Python
execute_script
execute_script
48
67
48
48
87e23670ddcada0e6b1dff61b5d8d117ca705ae1
bigcode/the-stack
train
a5bff09d4f4053c5fa904643
train
function
def query(script, tuples, database_path, message="data", debug=False): start, end = None, None if debug: start = time.time() print("\nQuerying {} ...".format(message)) conn = sqlite3.connect(database_path) cur = conn.cursor() row = cur.execute(script, tuples).fetchall() conn.clo...
def query(script, tuples, database_path, message="data", debug=False):
start, end = None, None if debug: start = time.time() print("\nQuerying {} ...".format(message)) conn = sqlite3.connect(database_path) cur = conn.cursor() row = cur.execute(script, tuples).fetchall() conn.close() if debug: end = time.time() print("Finished qu...
e: print(item) continue raise e conn.commit() conn.close() if debug: end = time.time() print("Finished inserting {} in {} seconds".format(message, end - start)) def query(script, tuples, database_path, message="data", debug=False):
64
64
109
16
48
enaky/covid-visualizer
apps/PythonBackendApi/db_updater/utils/db_utils.py
Python
query
query
32
45
32
32
151f6de685a3b89dec4bfe770dad99018e9d7125
bigcode/the-stack
train
242016e7f98109a3489cb081
train
function
def delete_data(db_path, tables=[], debug=True): start, end = None, None if debug: start = time.time() print("\nDeleting data from languages ...") conn = sqlite3.connect(db_path) cur = conn.cursor() for table in tables: cur.execute(" DELETE FROM {} ".format(table)) conn...
def delete_data(db_path, tables=[], debug=True):
start, end = None, None if debug: start = time.time() print("\nDeleting data from languages ...") conn = sqlite3.connect(db_path) cur = conn.cursor() for table in tables: cur.execute(" DELETE FROM {} ".format(table)) conn.commit() conn.close() if debug: ...
()) except sqlite3.OperationalError as e: print(e) finally: conn.commit() conn.close() if debug: end = time.time() print("Finished {} in {} seconds".format(message.upper(), end - start)) def delete_data(db_path, tables=[], debug=True):
64
64
105
11
53
enaky/covid-visualizer
apps/PythonBackendApi/db_updater/utils/db_utils.py
Python
delete_data
delete_data
70
86
70
70
70bcebeea219a922e163591d4e74d018f2a082fd
bigcode/the-stack
train
43bfcf56bffd42ed338ce178
train
class
class CDSRetriever(FileSource): sphinxdoc = """ CDSRetriever """ def __init__(self, dataset, *args, **kwargs): super().__init__() assert isinstance(dataset, str) if len(args): assert len(args) == 1 assert isinstance(args[0], dict) assert not...
class CDSRetriever(FileSource):
sphinxdoc = """ CDSRetriever """ def __init__(self, dataset, *args, **kwargs): super().__init__() assert isinstance(dataset, str) if len(args): assert len(args) == 1 assert isinstance(args[0], dict) assert not kwargs kwargs = args...
2222-0123456789ab", title="API key", hidden=True, validate=r"\d+:[\-0-9a-f]+", ), ] rcfile = "~/.cdsapirc" def save(self, input, file): yaml.dump(input, file, default_flow_style=False) def client(): prompt = CDSAPIKeyPrompt() prompt.check() ...
154
154
515
6
148
pmaciel/climetlab
climetlab/sources/cds.py
Python
CDSRetriever
CDSRetriever
67
145
67
68
8f08ffa1b5fa065ee297d87575722436743ca303
bigcode/the-stack
train
76f0ee66961d734dc46b153a
train
function
def client(): prompt = CDSAPIKeyPrompt() prompt.check() try: return cdsapi.Client() except Exception as e: if ".cdsapirc" in str(e): prompt.ask_user_and_save() return cdsapi.Client() raise
def client():
prompt = CDSAPIKeyPrompt() prompt.check() try: return cdsapi.Client() except Exception as e: if ".cdsapirc" in str(e): prompt.ask_user_and_save() return cdsapi.Client() raise
", title="API key", hidden=True, validate=r"\d+:[\-0-9a-f]+", ), ] rcfile = "~/.cdsapirc" def save(self, input, file): yaml.dump(input, file, default_flow_style=False) def client():
64
64
57
3
61
pmaciel/climetlab
climetlab/sources/cds.py
Python
client
client
47
58
47
47
9f4db4a428cda77fc85cc7f5ab0287a329c2aeee
bigcode/the-stack
train
096e4b683f46ca3cbbabc7bb
train
class
class CDSAPIKeyPrompt(APIKeyPrompt): register_or_sign_in_url = "https://cds.climate.copernicus.eu/" retrieve_api_key_url = "https://cds.climate.copernicus.eu/api-how-to" prompts = [ dict( name="url", default="https://cds.climate.copernicus.eu/api/v2", title="API ...
class CDSAPIKeyPrompt(APIKeyPrompt):
register_or_sign_in_url = "https://cds.climate.copernicus.eu/" retrieve_api_key_url = "https://cds.climate.copernicus.eu/api-how-to" prompts = [ dict( name="url", default="https://cds.climate.copernicus.eu/api/v2", title="API url", validate=r"http.?:/...
submit to any jurisdiction. # import cdsapi import yaml from climetlab.core.thread import SoftThreadPool from climetlab.decorators import normalize from climetlab.utils import tqdm from .file import FileSource from .prompt import APIKeyPrompt class CDSAPIKeyPrompt(APIKeyPrompt):
64
64
188
9
54
pmaciel/climetlab
climetlab/sources/cds.py
Python
CDSAPIKeyPrompt
CDSAPIKeyPrompt
21
44
21
21
07c35585b61d8495c546eda1a1c27c52270582d2
bigcode/the-stack
train
7bcb618732992b27f28ddb88
train
class
class TestIdDocumentsFromUrl(FormRecognizerTest): @FormRecognizerPreparer() @recorded_by_proxy def test_polling_interval(self, formrecognizer_test_endpoint, formrecognizer_test_api_key, **kwargs): set_bodiless_matcher() client = FormRecognizerClient(formrecognizer_test_endpoint, AzureKeyCre...
class TestIdDocumentsFromUrl(FormRecognizerTest): @FormRecognizerPreparer() @recorded_by_proxy
def test_polling_interval(self, formrecognizer_test_endpoint, formrecognizer_test_api_key, **kwargs): set_bodiless_matcher() client = FormRecognizerClient(formrecognizer_test_endpoint, AzureKeyCredential(formrecognizer_test_api_key), polling_interval=7) assert client._client._config.polling_...
# coding=utf-8 # ------------------------------------ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # ------------------------------------ import pytest import functools from datetime import date from devtools_testutils import recorded_by_proxy, set_bodiless_matcher from azure.core.credentia...
186
256
995
24
162
moovy2/azure-sdk-for-python
sdk/formrecognizer/azure-ai-formrecognizer/tests/test_identity_documents_from_url.py
Python
TestIdDocumentsFromUrl
TestIdDocumentsFromUrl
22
123
22
25
3cbdf6053b828f023ca91f700b36e542dabc561b
bigcode/the-stack
train
65832a3ae78ba2cebcbfcbd8
train
class
class Post(BaseModel): message: str = Field( ..., description='Message in markdown format. See markdown support for more details.', ) postTs: Optional[datetime] = Field(None, description='Timestamp of the post.') from_: basic.Uuid = Field( ..., alias='from', descr...
class Post(BaseModel):
message: str = Field( ..., description='Message in markdown format. See markdown support for more details.', ) postTs: Optional[datetime] = Field(None, description='Timestamp of the post.') from_: basic.Uuid = Field( ..., alias='from', description='ID of User (reg...
.json # timestamp: 2021-10-31T21:55:34+00:00 from __future__ import annotations from datetime import datetime from typing import List, Optional from pydantic import BaseModel, Field from ...type import basic class Post(BaseModel):
64
64
87
5
58
inspire99/OpenMetadata
ingestion/src/metadata/generated/schema/entity/feed/thread.py
Python
Post
Post
15
25
15
15
80726f4e62cbd4dec5d32af1151ab0cad78cfa76
bigcode/the-stack
train
26ccb8d1743827efac146352
train
class
class Thread(BaseModel): id: basic.Uuid = Field( ..., description='Unique identifier that identifies an entity instance.' ) href: Optional[basic.Href] = Field( None, description='Link to the resource corresponding to this entity.' ) threadTs: Optional[basic.DateTime] = Field( ...
class Thread(BaseModel):
id: basic.Uuid = Field( ..., description='Unique identifier that identifies an entity instance.' ) href: Optional[basic.Href] = Field( None, description='Link to the resource corresponding to this entity.' ) threadTs: Optional[basic.DateTime] = Field( None, description='Times...
details.', ) postTs: Optional[datetime] = Field(None, description='Timestamp of the post.') from_: basic.Uuid = Field( ..., alias='from', description='ID of User (regular user or a bot) posting the message.', ) class Thread(BaseModel):
64
64
183
5
59
inspire99/OpenMetadata
ingestion/src/metadata/generated/schema/entity/feed/thread.py
Python
Thread
Thread
28
46
28
28
e9470e09e29910eb9217aaaccdc3cf64157f4b5d
bigcode/the-stack
train
258768e219108104d7e1100c
train
class
class ExpressRouteCircuit(pulumi.CustomResource): def __init__(__self__, resource_name: str, opts: Optional[pulumi.ResourceOptions] = None, allow_classic_operations: Optional[pulumi.Input[bool]] = None, authorizations: Optional[pulumi.Input[Sequenc...
class ExpressRouteCircuit(pulumi.CustomResource):
def __init__(__self__, resource_name: str, opts: Optional[pulumi.ResourceOptions] = None, allow_classic_operations: Optional[pulumi.Input[bool]] = None, authorizations: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['ExpressRouteCircu...
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi SDK Generator. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union from ... import _utilities, _tables from...
112
256
3,172
10
102
pulumi/pulumi-azure-nextgen
sdk/python/pulumi_azure_nextgen/network/v20170301/express_route_circuit.py
Python
ExpressRouteCircuit
ExpressRouteCircuit
17
258
17
17
118290b7713ef9bfe00ee0b02b78b9d66628ea9b
bigcode/the-stack
train
875bb9bafa7fae0cddd51fe8
train
class
class CommitDetails(object): """NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. """ """ Attributes: swagger_types (dict): The key is attribute name and the value is attribute type. attribute_map (dict...
class CommitDetails(object):
"""NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. """ """ Attributes: swagger_types (dict): The key is attribute name and the value is attribute type. attribute_map (dict): The key is attribute name ...
# coding: utf-8 """ Octopus Server API No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501 OpenAPI spec version: 2019.6.7+Branch.tags-2019.6.7.Sha.aa18dc6809953218c66f57eff7d26481d9b23d6a Generated by: https://github.com/swagger-api...
127
256
915
5
121
cvent/octopus-deploy-api-client
octopus_deploy_swagger_client/models/commit_details.py
Python
CommitDetails
CommitDetails
20
167
20
20
f3b6a4679d598c7c3354aaf33dfc23e8bb76b427
bigcode/the-stack
train
f0aafe526e6a7ea57fefddd7
train
function
def DadosTupla(Lista): T = () Soma = L[0]+L[1]+L[2]+L[3]+L[4] Media = Soma / 5 Menor = L[0] if L[1] < L[0] and L[1] < L[2] and L[1] < L[3] and L[1] < L[4]: Menor = L[1] elif L[2] < L[0] and L[2] < L[1] and L[2] < L[3] and L[2] < L[4]: Menor = L[2] elif L[3] < L[0] and L[...
def DadosTupla(Lista):
T = () Soma = L[0]+L[1]+L[2]+L[3]+L[4] Media = Soma / 5 Menor = L[0] if L[1] < L[0] and L[1] < L[2] and L[1] < L[3] and L[1] < L[4]: Menor = L[1] elif L[2] < L[0] and L[2] < L[1] and L[2] < L[3] and L[2] < L[4]: Menor = L[2] elif L[3] < L[0] and L[3] < L[1] and L[3] < L[...
elementos nela contidos. Considere que nessa lista ocorram apenas números reais. Escreva um programa para testar essa função, exibindo na tela os resultados. Neste exercício, evite utilizar as funções prontas existentes no Python, como sum, min e max. """ L = [] Cont = 1 print("=*"*20) print("Você deve digitar 5 nú...
147
147
491
7
139
Alex-Francisco/Python-3
Exercicios_propostos_56.py
Python
DadosTupla
DadosTupla
21
48
21
21
d5f5d07e2147d88456c288825309979304cacad7
bigcode/the-stack
train
405e90a26d11218583496d9a
train
class
class NotificationEventPublisher(Model): """NotificationEventPublisher. :param id: :type id: str :param subscription_management_info: :type subscription_management_info: :class:`SubscriptionManagement <notification.v4_1.models.SubscriptionManagement>` :param url: :type url: str """ ...
class NotificationEventPublisher(Model):
"""NotificationEventPublisher. :param id: :type id: str :param subscription_management_info: :type subscription_management_info: :class:`SubscriptionManagement <notification.v4_1.models.SubscriptionManagement>` :param url: :type url: str """ _attribute_map = { 'id': {'key':...
reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- # Generated file, DO NOT EDIT # Changes may cause incorrect behavior and will be lost if the code is regenerated. # ---...
64
64
178
6
57
kenkuo/azure-devops-python-api
vsts/vsts/notification/v4_1/models/notification_event_publisher.py
Python
NotificationEventPublisher
NotificationEventPublisher
12
33
12
12
5adb10024fe6ad87321ae5868cbc1e8730fa7377
bigcode/the-stack
train
3bdc683858a45578e98335f1
train
class
class BaseHandler(webapp2.RequestHandler): @webapp2.cached_property def jinja2(self): # Returns a Jinja2 renderer cached in the app registry. return jinja2.get_jinja2(app=self.app) def render_response(self, _template, **context): # Renders a template and writes the result to the re...
class BaseHandler(webapp2.RequestHandler): @webapp2.cached_property
def jinja2(self): # Returns a Jinja2 renderer cached in the app registry. return jinja2.get_jinja2(app=self.app) def render_response(self, _template, **context): # Renders a template and writes the result to the response. rv = self.jinja2.render_template(_template, **context) ...
#-*- encoding: utf-8 -*- import webapp2 from webapp2_extras import jinja2 class BaseHandler(webapp2.RequestHandler): @webapp2.cached_property
42
64
98
17
24
lucasnascimento/oi-professor
controllers/base.py
Python
BaseHandler
BaseHandler
7
17
7
9
c62870268fbf8a6eb6ee75f6f35838978c508966
bigcode/the-stack
train
1f2cb717863d267991d38187
train
class
class Migration(migrations.Migration): dependencies = [ ('menus', '0003_menucategory_show_in_menu'), ] operations = [ migrations.AddField( model_name='menu', name='variations_display_style', field=models.IntegerField(choices=[(1, 'Mini card'), (2, 'List'...
class Migration(migrations.Migration):
dependencies = [ ('menus', '0003_menucategory_show_in_menu'), ] operations = [ migrations.AddField( model_name='menu', name='variations_display_style', field=models.IntegerField(choices=[(1, 'Mini card'), (2, 'List')], default=1), ), ]
# Generated by Django 3.1.7 on 2021-03-21 02:14 from django.db import migrations, models class Migration(migrations.Migration):
38
64
81
7
30
tiagocordeiro/gomenu
menus/migrations/0004_menu_variations_display_style.py
Python
Migration
Migration
6
18
6
7
e8d75d6dbdd96ffd323ad56dce93a4d307c851f2
bigcode/the-stack
train
b303f5dbf5d9df6d9d5ea179
train
function
def create(kernel): result = Intangible() result.template = "object/draft_schematic/clothing/shared_clothing_ith_dress_formal_04.iff" result.attribute_template_id = -1 result.stfName("string_id_table","") #### BEGIN MODIFICATIONS #### #### END MODIFICATIONS #### return result
def create(kernel):
result = Intangible() result.template = "object/draft_schematic/clothing/shared_clothing_ith_dress_formal_04.iff" result.attribute_template_id = -1 result.stfName("string_id_table","") #### BEGIN MODIFICATIONS #### #### END MODIFICATIONS #### return result
#### NOTICE: THIS FILE IS AUTOGENERATED #### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY #### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES from swgpy.object import * def create(kernel):
46
64
73
4
42
obi-two/GameServer
data/scripts/templates/object/draft_schematic/clothing/shared_clothing_ith_dress_formal_04.py
Python
create
create
7
17
7
7
ae471353b91d9f65317589020cd1346ac0ad8f4e
bigcode/the-stack
train
b304a1b5c21f3b927f0d3021
train
class
@ti.data_oriented class Voxelizer: def __init__(self, res, dx, precision=ti.f64, padding=3): assert len(res) == 3 self.res = res self.dx = dx self.inv_dx = 1 / self.dx self.voxels = ti.var(ti.i32, shape=res) assert precision in [ti.f32, ti.f64] self.precision ...
@ti.data_oriented class Voxelizer:
def __init__(self, res, dx, precision=ti.f64, padding=3): assert len(res) == 3 self.res = res self.dx = dx self.inv_dx = 1 / self.dx self.voxels = ti.var(ti.i32, shape=res) assert precision in [ti.f32, ti.f64] self.precision = precision self.padding = ...
import taichi as ti import numpy as np @ti.func def cross2d(a, b): return a[0] * b[1] - a[1] * b[0] @ti.func def inside_ccw(p, a, b, c): return cross2d(a - p, b - p) >= 0 and cross2d( b - p, c - p) >= 0 and cross2d(c - p, a - p) >= 0 @ti.data_oriented class Voxelizer:
120
256
1,003
11
108
LewisOrton/taichi_elements_houdini
engine/voxelizer.py
Python
Voxelizer
Voxelizer
15
106
15
16
37daa80e163b25dfdb0bf4810767e94ceb96cf66
bigcode/the-stack
train
2ea43cc542423f8994e85e78
train
function
@ti.func def inside_ccw(p, a, b, c): return cross2d(a - p, b - p) >= 0 and cross2d( b - p, c - p) >= 0 and cross2d(c - p, a - p) >= 0
@ti.func def inside_ccw(p, a, b, c):
return cross2d(a - p, b - p) >= 0 and cross2d( b - p, c - p) >= 0 and cross2d(c - p, a - p) >= 0
import taichi as ti import numpy as np @ti.func def cross2d(a, b): return a[0] * b[1] - a[1] * b[0] @ti.func def inside_ccw(p, a, b, c):
60
64
65
16
44
LewisOrton/taichi_elements_houdini
engine/voxelizer.py
Python
inside_ccw
inside_ccw
10
13
10
11
4a5749784ce771abf305359786dba2f2b3171aca
bigcode/the-stack
train
35e86e4a7997a578c7ed8c3a
train
function
@ti.func def cross2d(a, b): return a[0] * b[1] - a[1] * b[0]
@ti.func def cross2d(a, b):
return a[0] * b[1] - a[1] * b[0]
import taichi as ti import numpy as np @ti.func def cross2d(a, b):
23
64
33
12
10
LewisOrton/taichi_elements_houdini
engine/voxelizer.py
Python
cross2d
cross2d
5
7
5
6
d400a3dbf20074811601f74efd17bcda3366822c
bigcode/the-stack
train
42404ce7bcceac6f2901d696
train
class
class MuLaw(Node): def __init__(self, mu=255, needs=None): super(MuLaw, self).__init__(needs=needs) self.mu = mu def _process(self, data): yield mu_law(data, mu=self.mu)
class MuLaw(Node):
def __init__(self, mu=255, needs=None): super(MuLaw, self).__init__(needs=needs) self.mu = mu def _process(self, data): yield mu_law(data, mu=self.mu)
return scaled def unit_scale(x, axis=None): scaled = x - x.min(axis=axis, keepdims=True) mx = scaled.max(axis=axis, keepdims=True) scaled = np.divide(scaled, mx, where=max != 0) return scaled class MuLaw(Node):
64
64
58
5
58
FelixAbrahamsson/zounds
zounds/loudness/loudness.py
Python
MuLaw
MuLaw
56
62
56
56
7a5008a0f3f7a4813a1ed83d639e0ce8e5e1eb6d
bigcode/the-stack
train
7abcf90a358ff758737c1213
train
function
def mu_law(x, mu=255): s = np.sign(x) x = np.abs(x) return s * (np.log(1 + (mu * x)) / np.log(1 + mu))
def mu_law(x, mu=255):
s = np.sign(x) x = np.abs(x) return s * (np.log(1 + (mu * x)) / np.log(1 + mu))
.sign(x) * np.log(np.abs(x) + 1) def inverse_log_modulus(x): return (np.exp(np.abs(x)) - 1) * np.sign(x) def decibel(x): return 20 * np.log10(x) def mu_law(x, mu=255):
64
64
47
10
54
FelixAbrahamsson/zounds
zounds/loudness/loudness.py
Python
mu_law
mu_law
18
21
18
18
5b169e8fcbeb915af2a2f6f16f24b4fbc0f7a535
bigcode/the-stack
train
27f0de69a4b37f36b32b9cb3
train
function
def inverse_log_modulus(x): return (np.exp(np.abs(x)) - 1) * np.sign(x)
def inverse_log_modulus(x):
return (np.exp(np.abs(x)) - 1) * np.sign(x)
import numpy as np from featureflow import Node def log_modulus(x): return np.sign(x) * np.log(np.abs(x) + 1) def inverse_log_modulus(x):
42
64
25
7
35
FelixAbrahamsson/zounds
zounds/loudness/loudness.py
Python
inverse_log_modulus
inverse_log_modulus
10
11
10
10
bf115ba8f889f6178f91c3c14ab57993192c1384
bigcode/the-stack
train
83733988e594ca022bba3e5e
train
class
class LogModulus(Node): def __init__(self, factor=1, needs=None): super(LogModulus, self).__init__(needs=needs) self.factor = factor def _process(self, data): yield log_modulus(data * self.factor)
class LogModulus(Node):
def __init__(self, factor=1, needs=None): super(LogModulus, self).__init__(needs=needs) self.factor = factor def _process(self, data): yield log_modulus(data * self.factor)
class MuLaw(Node): def __init__(self, mu=255, needs=None): super(MuLaw, self).__init__(needs=needs) self.mu = mu def _process(self, data): yield mu_law(data, mu=self.mu) class LogModulus(Node):
64
64
58
6
58
FelixAbrahamsson/zounds
zounds/loudness/loudness.py
Python
LogModulus
LogModulus
65
71
65
65
42f2dfd05da5611a4e1109158c6b9f512259b276
bigcode/the-stack
train
d08147b7d9cb8826520a6b9a
train
function
def decibel(x): return 20 * np.log10(x)
def decibel(x):
return 20 * np.log10(x)
import numpy as np from featureflow import Node def log_modulus(x): return np.sign(x) * np.log(np.abs(x) + 1) def inverse_log_modulus(x): return (np.exp(np.abs(x)) - 1) * np.sign(x) def decibel(x):
64
64
15
5
59
FelixAbrahamsson/zounds
zounds/loudness/loudness.py
Python
decibel
decibel
14
15
14
14
f0a51b05cead4ea974bf9137b1a7fcbc39ab3796
bigcode/the-stack
train
914018ec04bf4e33c98f1792
train
function
def log_modulus(x): return np.sign(x) * np.log(np.abs(x) + 1)
def log_modulus(x):
return np.sign(x) * np.log(np.abs(x) + 1)
import numpy as np from featureflow import Node def log_modulus(x):
18
64
23
6
11
FelixAbrahamsson/zounds
zounds/loudness/loudness.py
Python
log_modulus
log_modulus
6
7
6
6
657e9442075de3070b4d093b3a24859fd8e6ac0c
bigcode/the-stack
train
8e22bd81e84df80f71bedd22
train
function
def inverse_mu_law(x, mu=255): s = np.sign(x) x = np.abs(x) x *= np.log(1 + mu) x = (np.exp(x) - 1) / mu return x * s
def inverse_mu_law(x, mu=255):
s = np.sign(x) x = np.abs(x) x *= np.log(1 + mu) x = (np.exp(x) - 1) / mu return x * s
* np.log10(x) def mu_law(x, mu=255): s = np.sign(x) x = np.abs(x) return s * (np.log(1 + (mu * x)) / np.log(1 + mu)) def inverse_mu_law(x, mu=255):
64
64
56
11
53
FelixAbrahamsson/zounds
zounds/loudness/loudness.py
Python
inverse_mu_law
inverse_mu_law
24
29
24
24
9a012e7f346dcc09adbdbe6a04928aa7155d2451
bigcode/the-stack
train
a4b841f72dbf42a2066f9907
train
function
def instance_scale(x, axis=-1, epsilon=1e-8, return_maxes=False): mx = np.abs(x).max(axis=axis, keepdims=True) scaled = x / (mx + epsilon) if return_maxes: return mx, scaled else: return scaled
def instance_scale(x, axis=-1, epsilon=1e-8, return_maxes=False):
mx = np.abs(x).max(axis=axis, keepdims=True) scaled = x / (mx + epsilon) if return_maxes: return mx, scaled else: return scaled
] indices = np.argmax(x, axis=axis).astype(np.float32) indices /= float(n_categories) indices = (indices - 0.5) * 2 return indices def instance_scale(x, axis=-1, epsilon=1e-8, return_maxes=False):
64
64
66
21
42
FelixAbrahamsson/zounds
zounds/loudness/loudness.py
Python
instance_scale
instance_scale
40
46
40
40
7e415e4461d60c784a25e7c751d21cc0dcd94201
bigcode/the-stack
train
bb005795502c6c4af02d7017
train
function
def inverse_one_hot(x, axis=-1): n_categories = x.shape[axis] indices = np.argmax(x, axis=axis).astype(np.float32) indices /= float(n_categories) indices = (indices - 0.5) * 2 return indices
def inverse_one_hot(x, axis=-1):
n_categories = x.shape[axis] indices = np.argmax(x, axis=axis).astype(np.float32) indices /= float(n_categories) indices = (indices - 0.5) * 2 return indices
_mu_law(x, mu=255): s = np.sign(x) x = np.abs(x) x *= np.log(1 + mu) x = (np.exp(x) - 1) / mu return x * s def inverse_one_hot(x, axis=-1):
64
64
61
10
53
FelixAbrahamsson/zounds
zounds/loudness/loudness.py
Python
inverse_one_hot
inverse_one_hot
32
37
32
32
ba51d78e5ec5f5501b3d2d9d0994b5fe0e99dd62
bigcode/the-stack
train
0073f7819ede78c840bc895a
train
function
def unit_scale(x, axis=None): scaled = x - x.min(axis=axis, keepdims=True) mx = scaled.max(axis=axis, keepdims=True) scaled = np.divide(scaled, mx, where=max != 0) return scaled
def unit_scale(x, axis=None):
scaled = x - x.min(axis=axis, keepdims=True) mx = scaled.max(axis=axis, keepdims=True) scaled = np.divide(scaled, mx, where=max != 0) return scaled
=1e-8, return_maxes=False): mx = np.abs(x).max(axis=axis, keepdims=True) scaled = x / (mx + epsilon) if return_maxes: return mx, scaled else: return scaled def unit_scale(x, axis=None):
64
64
56
8
55
FelixAbrahamsson/zounds
zounds/loudness/loudness.py
Python
unit_scale
unit_scale
49
53
49
49
c28dbe76fb1ecc749321c4b8bf9dc5e0f876b811
bigcode/the-stack
train
5021d938f5aa66af43de996d
train
class
class Migration(migrations.Migration): dependencies = [ ('labour', '0013_signup_time_confirmation_requested'), ] operations = [ migrations.AlterField( model_name='signup', name='job_categories_accepted', field=models.ManyToManyField(help_text='Teht\xe4v\...
class Migration(migrations.Migration):
dependencies = [ ('labour', '0013_signup_time_confirmation_requested'), ] operations = [ migrations.AlterField( model_name='signup', name='job_categories_accepted', field=models.ManyToManyField(help_text='Teht\xe4v\xe4alueet, joilla hyv\xe4ksytty vapaaeht...
# -*- coding: utf-8 -*- from django.db import migrations, models class Migration(migrations.Migration):
24
64
215
7
16
Siikakala/kompassi
labour/migrations/0014_auto_20151108_1906.py
Python
Migration
Migration
7
19
7
8
138f26f66bf426e0f7e00fd065a1cd599baec841
bigcode/the-stack
train
0618adafa33e94cf6be6f996
train
function
def lables_patchs(train_labels_list,test_lables_list): #裁剪lables图片 print("=== PROCESSING train_lables and test_lables ===") # 读取文件名字 # train_lables = [] # test_lables = [] # for line in train_labels_list: # line_data = line.strip('\n') # line_data = line_data.split(".")[0] + ".png" ...
def lables_patchs(train_labels_list,test_lables_list): #裁剪lables图片
print("=== PROCESSING train_lables and test_lables ===") # 读取文件名字 # train_lables = [] # test_lables = [] # for line in train_labels_list: # line_data = line.strip('\n') # line_data = line_data.split(".")[0] + ".png" # train_lables.append(line_data) # # for line in te...
ate(train_samples), total=len(train_samples), desc="Saving train samples"): io.imsave('{}/{}.png'.format(basic_path+"train", i), sample) tqdm.write("training set: done") for i, sample in tqdm(enumerate(test_samples), total=len(test_samples), desc="Saving test samples"): io.imsave('{}/{}.png'.fo...
139
139
464
20
119
xiaoguoguo2018/mmesg
VMyfiles/454.py
Python
lables_patchs
lables_patchs
183
222
183
183
76233f76981f82371741162117e3b75e1cd58825
bigcode/the-stack
train
6e7935087e08295294a9431b
train
function
def get_trainAndtest_List(): test_irrg_label_list = [] test_irrg_list = [] train_irrg_list = [] train_irrg_label_list = [] with open(train_txt, 'r') as f: my_data = f.readlines() for line in my_data: line_data = line.strip('\n') train_irrg_list.append(line_dat...
def get_trainAndtest_List():
test_irrg_label_list = [] test_irrg_list = [] train_irrg_list = [] train_irrg_label_list = [] with open(train_txt, 'r') as f: my_data = f.readlines() for line in my_data: line_data = line.strip('\n') train_irrg_list.append(line_data) line_data = li...
_im in os.listdir(image_path): if (id == t_im.split('potsdam_')[1].split('_IRRG')[0]): list_for_file.append(t_im) test_image.write('{}\n'.format(t_im)) break test_image.close() def get_trainAndtest_List():
64
64
205
7
57
xiaoguoguo2018/mmesg
VMyfiles/454.py
Python
get_trainAndtest_List
get_trainAndtest_List
73
94
73
73
111b6a04760676bae4020316c31dbd1b1d6e89d8
bigcode/the-stack
train
51eb5c4b9a4a6dafd137da91
train
function
def image_patchs(train_list,test_list): print("=== PROCESSING train dateset and test dateset ===") # # 读取文件名字 # train_name = [] # test_name = [] # with open(train_txt, 'r') as f: # my_data = f.readlines() # for line in my_data: # line_data = line.strip('\n') # ...
def image_patchs(train_list,test_list):
print("=== PROCESSING train dateset and test dateset ===") # # 读取文件名字 # train_name = [] # test_name = [] # with open(train_txt, 'r') as f: # my_data = f.readlines() # for line in my_data: # line_data = line.strip('\n') # train_name.append(line_data) # ...
angles in deg). 要执行的旋转(角度为度) Returns: array list: list of augmented patches 增强的补丁的列表 """ transformed_patches = [patch] for angle in rotations: transformed_patches.append(skimage.img_as_ubyte(skimage.transform.rotate(patch, angle))) if flip: transformed_patches.append(np.flipu...
139
139
466
9
129
xiaoguoguo2018/mmesg
VMyfiles/454.py
Python
image_patchs
image_patchs
138
180
138
138
f058728b9a725ec3654b7f81b10420a06e9e6800
bigcode/the-stack
train
5fd4ab9d071d43b7ed96fc07
train
function
def generate_trainAndtest_txt(): train_ids = [] remove_tfw_file(labels_train_path) remove_tfw_file(image_path) for t_im in os.listdir(labels_train_path): train_ids.append(t_im.split('potsdam_')[1].split("_label")[0]) print(train_ids) print(len(train_ids)) test_ids = [] all_ids ...
def generate_trainAndtest_txt():
train_ids = [] remove_tfw_file(labels_train_path) remove_tfw_file(image_path) for t_im in os.listdir(labels_train_path): train_ids.append(t_im.split('potsdam_')[1].split("_label")[0]) print(train_ids) print(len(train_ids)) test_ids = [] all_ids = [] # 取出所有的图片编号 for t_im in...
parameters patch_size = (256, 256) # 滑动窗口的大小 step_size = 256 ROTATIONS = [90, 180, 270] # 旋转 FLIPS = [True, True] # 翻转 def remove_tfw_file(path): for im in os.listdir(path): if im.split(".")[-1] == "tfw": os.remove(path + "//" + im) # 删除tfw文件 def generate_trainAndtest_txt():
111
111
370
7
103
xiaoguoguo2018/mmesg
VMyfiles/454.py
Python
generate_trainAndtest_txt
generate_trainAndtest_txt
31
71
31
31
04f6a70b54d353e8477a01381f0e7fe92e2c5eaa
bigcode/the-stack
train
c75c1ce4d45d89bf2cc1a34e
train
function
def sliding_window(image, stride=320, window_size=(320, 320)): """Extract patches according to a sliding window.根据一个滑动窗口提取补丁 Args: image (numpy array): The image to be processed.要处理的图像 stride (int, optional): The sliding window stride (defaults to 10px). 动窗口的跨度(默认为10px) window_size(int, ...
def sliding_window(image, stride=320, window_size=(320, 320)):
"""Extract patches according to a sliding window.根据一个滑动窗口提取补丁 Args: image (numpy array): The image to be processed.要处理的图像 stride (int, optional): The sliding window stride (defaults to 10px). 动窗口的跨度(默认为10px) window_size(int, int, optional): The patch size (defaults to (20,20)).补丁大小(默认为(2...
label.tif" test_irrg_label_list.append(line_data) return train_irrg_list,train_irrg_label_list,test_irrg_list,test_irrg_label_list # function for generating patches 生成补丁的函数,裁剪图片 def sliding_window(image, stride=320, window_size=(320, 320)):
69
69
232
17
51
xiaoguoguo2018/mmesg
VMyfiles/454.py
Python
sliding_window
sliding_window
97
114
97
97
f896b539c5a277ef34cbe119b082cc18a143867a
bigcode/the-stack
train
b5f65ea57355c71ee12fd29c
train
function
def transform(patch, flip=False, mirror=False, rotations=[]): """Perform data augmentation on a patch. 对一个补丁进行数据增强 Args: patch (numpy array): The patch to be processed. 要处理的补丁 flip (bool, optional): Up/down symetry. 上/下对称 mirror (bool, optional): left/right symetry. 左/右对称 rotati...
def transform(patch, flip=False, mirror=False, rotations=[]):
"""Perform data augmentation on a patch. 对一个补丁进行数据增强 Args: patch (numpy array): The patch to be processed. 要处理的补丁 flip (bool, optional): Up/down symetry. 上/下对称 mirror (bool, optional): left/right symetry. 左/右对称 rotations (int list, optional) : rotations to perform (angles in deg...
], y:y + window_size[1]] if new_patch.shape[:2] == window_size: patches.append(new_patch) return patches # function for generating transforms 用于生成变换的函数,数据增强,根据需要调用 def transform(patch, flip=False, mirror=False, rotations=[]):
64
64
211
14
49
xiaoguoguo2018/mmesg
VMyfiles/454.py
Python
transform
transform
117
134
117
117
9b920c3126bb09af5aedc7507d30a6311b9deda2
bigcode/the-stack
train
9e20d22a7f58a4de3059bef0
train
function
def remove_tfw_file(path): for im in os.listdir(path): if im.split(".")[-1] == "tfw": os.remove(path + "//" + im) # 删除tfw文件
def remove_tfw_file(path):
for im in os.listdir(path): if im.split(".")[-1] == "tfw": os.remove(path + "//" + im) # 删除tfw文件
patch_size = (256, 256) # 滑动窗口的大小 step_size = 256 ROTATIONS = [90, 180, 270] # 旋转 FLIPS = [True, True] # 翻转 def remove_tfw_file(path):
64
64
46
7
56
xiaoguoguo2018/mmesg
VMyfiles/454.py
Python
remove_tfw_file
remove_tfw_file
26
29
26
26
fe60b6074461303d9b7baf6129104317eebf5ebf
bigcode/the-stack
train
0b28ff602e08f770073d6c29
train
function
def run_dc_down(args: argparse.Namespace): # Always add remove orphans flag since we can create orphans through enable/disable flags return _run_docker_compose_internal(args, ['down', '--remove-orphans'])
def run_dc_down(args: argparse.Namespace): # Always add remove orphans flag since we can create orphans through enable/disable flags
return _run_docker_compose_internal(args, ['down', '--remove-orphans'])
_internal(args, docker_compose_args) def run_dc_config(args: argparse.Namespace): return _run_docker_compose_internal(args, ['config'], no_network=True) def run_dc_down(args: argparse.Namespace): # Always add remove orphans flag since we can create orphans through enable/disable flags
64
64
48
29
35
adobe/pydc-control
pydc_control/commands.py
Python
run_dc_down
run_dc_down
170
172
170
171
1a8a78ad1a1fee40536f794abc27e42852a246d4
bigcode/the-stack
train
cdd31e5d724b413232896679
train
function
def run_dc_pull_config(args: argparse.Namespace): config_service = Service.find_config() if not config_service: raise KnownException('A config target service is not defined, please define one to pull configuration') if not config_service.is_enabled(args): raise KnownException('Cannot pull co...
def run_dc_pull_config(args: argparse.Namespace):
config_service = Service.find_config() if not config_service: raise KnownException('A config target service is not defined, please define one to pull configuration') if not config_service.is_enabled(args): raise KnownException('Cannot pull configuration when using the real config service') ...
can create orphans through enable/disable flags return _run_docker_compose_internal(args, ['down', '--remove-orphans']) def run_dc_pull(args: argparse.Namespace): return _run_docker_compose_internal(args, ['pull']) def run_dc_pull_config(args: argparse.Namespace):
63
64
87
10
53
adobe/pydc-control
pydc_control/commands.py
Python
run_dc_pull_config
run_dc_pull_config
179
185
179
179
a1ee35ad3526a1c6fac9d87f44b755addae9be45
bigcode/the-stack
train
99bb5d2afb422e8016213e85
train
function
def run_dc_config(args: argparse.Namespace): return _run_docker_compose_internal(args, ['config'], no_network=True)
def run_dc_config(args: argparse.Namespace):
return _run_docker_compose_internal(args, ['config'], no_network=True)
_file_path): docker_compose_utils.init_docker_compose(args, dev_projects, no_network=True) docker_compose_args.extend(docker_utils.read_services_from_dc(dc_file_path)) return _run_docker_compose_internal(args, docker_compose_args) def run_dc_config(args: argparse.Namespace):
64
64
27
9
55
adobe/pydc-control
pydc_control/commands.py
Python
run_dc_config
run_dc_config
166
167
166
166
27a2ef3ddfa6662b6e25020b417afd606a39720a
bigcode/the-stack
train
1fb8977f6959b4146fed93ba
train
function
def run_dc_init(args: argparse.Namespace): dev_projects = _get_dev_projects(args) docker_compose_utils.init_docker_compose(args, dev_projects) return os.EX_OK
def run_dc_init(args: argparse.Namespace):
dev_projects = _get_dev_projects(args) docker_compose_utils.init_docker_compose(args, dev_projects) return os.EX_OK
): values = list(f'{key}={value}' for key, value in build_args.items()) else: values = build_args result = [] for value in values: result.extend(['--build-arg', value]) return result def run_dc_init(args: argparse.Namespace):
64
64
40
9
54
adobe/pydc-control
pydc_control/commands.py
Python
run_dc_init
run_dc_init
139
142
139
139
82508afbb095b9ae4a4ef89d7accb746b7383a6d
bigcode/the-stack
train
33081d33365b2551e48c7d06
train
function
def run_checkout(args: argparse.Namespace): # pylint: disable=too-many-branches if args.all_projects or not args.dev_project_names: projects = Project.find_all() else: projects = _get_dev_projects(args) if len(projects) == 0: raise KnownException('There are no projects available,...
def run_checkout(args: argparse.Namespace): # pylint: disable=too-many-branches
if args.all_projects or not args.dev_project_names: projects = Project.find_all() else: projects = _get_dev_projects(args) if len(projects) == 0: raise KnownException('There are no projects available, please set projects') parent_dir = os.path.realpath(os.path.join(config.get_ba...
_docker_compose_internal(args, ['up', '--force-recreate']) def get_repo_status(args: argparse.Namespace): if args.all_projects or not args.dev_project_names: projects = Project.find_all() else: projects = _get_dev_projects(args) if len(projects) == 0: raise KnownException('There ar...
189
189
633
19
170
adobe/pydc-control
pydc_control/commands.py
Python
run_checkout
run_checkout
227
284
227
228
cb812457a2852977f1599243a8427f10115ade78
bigcode/the-stack
train
cdff12e49f3918969f6af40a
train
function
def _run_docker_compose_internal(args: argparse.Namespace, docker_compose_args: List[str], no_network: bool = False): dev_projects = _get_dev_projects(args) docker_compose_utils.init_docker_compose(args, dev_projects, no_network=no_network) return _run_docker_compose_with_projects(args, dev_projects, docker...
def _run_docker_compose_internal(args: argparse.Namespace, docker_compose_args: List[str], no_network: bool = False):
dev_projects = _get_dev_projects(args) docker_compose_utils.init_docker_compose(args, dev_projects, no_network=no_network) return _run_docker_compose_with_projects(args, dev_projects, docker_compose_args)
not in core_service_names, all_services)) commands.extend(all_services) log.get_logger().info(f'Calling {" ".join(commands)}') return call_commands(commands) def _run_docker_compose_internal(args: argparse.Namespace, docker_compose_args: List[str], no_network: bool = False):
64
64
78
28
36
adobe/pydc-control
pydc_control/commands.py
Python
_run_docker_compose_internal
_run_docker_compose_internal
119
122
119
119
754ddf19210a5e3b5af89220278f86e89eb9c426
bigcode/the-stack
train
99f8336dca5259bb5cb9b030
train
function
def run_docker_compose(args: argparse.Namespace): return _run_docker_compose_internal(args, args.docker_compose_args)
def run_docker_compose(args: argparse.Namespace):
return _run_docker_compose_internal(args, args.docker_compose_args)
.extend(['--build-arg', value]) return result def run_dc_init(args: argparse.Namespace): dev_projects = _get_dev_projects(args) docker_compose_utils.init_docker_compose(args, dev_projects) return os.EX_OK def run_docker_compose(args: argparse.Namespace):
64
64
29
11
52
adobe/pydc-control
pydc_control/commands.py
Python
run_docker_compose
run_docker_compose
145
146
145
145
05c19c6a63b021f69b7243d15db5ee71abdabef2
bigcode/the-stack
train
d93967d9eb961f13315660ba
train
function
def run_dc_stop(args: argparse.Namespace): return _run_docker_compose_internal(args, ['stop'])
def run_dc_stop(args: argparse.Namespace):
return _run_docker_compose_internal(args, ['stop'])
pull configuration when using the real config service') return _run_docker_compose_internal(args, ['pull', config_service.dc_name]) def run_dc_rm(args: argparse.Namespace): return _run_docker_compose_internal(args, ['rm', '--force']) def run_dc_stop(args: argparse.Namespace):
63
64
23
9
54
adobe/pydc-control
pydc_control/commands.py
Python
run_dc_stop
run_dc_stop
192
193
192
192
ed312f0ee65efd56ff87825a5d44d48ac293cd85
bigcode/the-stack
train
bf93865c4693c31e8b77f040
train
function
def run_dc_build(args: argparse.Namespace): docker_compose_args = ['build'] if args.no_cache: docker_compose_args.append('--no-cache') docker_compose_args.extend(_get_cli_build_args(config.get_dc_build_args())) if args.dev_project_names and not args.all_projects: dev_projects = _get_dev_...
def run_dc_build(args: argparse.Namespace):
docker_compose_args = ['build'] if args.no_cache: docker_compose_args.append('--no-cache') docker_compose_args.extend(_get_cli_build_args(config.get_dc_build_args())) if args.dev_project_names and not args.all_projects: dev_projects = _get_dev_projects(args) for project in dev_pr...
get_dev_projects(args) docker_compose_utils.init_docker_compose(args, dev_projects) return os.EX_OK def run_docker_compose(args: argparse.Namespace): return _run_docker_compose_internal(args, args.docker_compose_args) def run_dc_build(args: argparse.Namespace):
64
64
196
9
55
adobe/pydc-control
pydc_control/commands.py
Python
run_dc_build
run_dc_build
149
163
149
149
785626c132df471cf07008a167c8f9fd49ccb3a1
bigcode/the-stack
train
f16205f6ec666ae8e673a331
train
function
def _wait_for_open_ports(service: Service) -> None: log.get_logger().info(f'Waiting for ports to be open and available on container {service.container_name}') open_ports = None while not open_ports: open_ports = docker_utils.get_open_ports(service.container_name) if not open_ports: ...
def _wait_for_open_ports(service: Service) -> None:
log.get_logger().info(f'Waiting for ports to be open and available on container {service.container_name}') open_ports = None while not open_ports: open_ports = docker_utils.get_open_ports(service.container_name) if not open_ports: log.get_logger().debug(f'Waiting for ports to be ...
import signal import subprocess import time from typing import Dict, List, Optional, Union from . import config, docker_compose_utils, docker_utils, log from .data import Project, Service from .exceptions import KnownException def _wait_for_open_ports(service: Service) -> None:
64
64
213
13
50
adobe/pydc-control
pydc_control/commands.py
Python
_wait_for_open_ports
_wait_for_open_ports
21
39
21
21
534690f8539deba2076ea5198acfd0fffe99cdf2
bigcode/the-stack
train
cdccc621bd9c848ec1548c5e
train
function
def _get_cli_build_args(build_args: Optional[Union[Dict[str, str], List[str]]]) -> List[str]: if not build_args: return [] if isinstance(build_args, dict): values = list(f'{key}={value}' for key, value in build_args.items()) else: values = build_args result = [] for value in...
def _get_cli_build_args(build_args: Optional[Union[Dict[str, str], List[str]]]) -> List[str]:
if not build_args: return [] if isinstance(build_args, dict): values = list(f'{key}={value}' for key, value in build_args.items()) else: values = build_args result = [] for value in values: result.extend(['--build-arg', value]) return result
_compose_utils.init_docker_compose(args, dev_projects, no_network=no_network) return _run_docker_compose_with_projects(args, dev_projects, docker_compose_args) def _get_cli_build_args(build_args: Optional[Union[Dict[str, str], List[str]]]) -> List[str]:
64
64
97
26
38
adobe/pydc-control
pydc_control/commands.py
Python
_get_cli_build_args
_get_cli_build_args
125
136
125
125
98cf6261efaf172b434748ba0a300800609f2766
bigcode/the-stack
train
9e8f7894e1dd3fb421711e54
train
function
def run_dc_up_detach(args: argparse.Namespace): return _run_docker_compose_internal(args, ['up', '--detach'])
def run_dc_up_detach(args: argparse.Namespace):
return _run_docker_compose_internal(args, ['up', '--detach'])
', '--force']) def run_dc_stop(args: argparse.Namespace): return _run_docker_compose_internal(args, ['stop']) def run_dc_up(args: argparse.Namespace): return _run_docker_compose_internal(args, ['up']) def run_dc_up_detach(args: argparse.Namespace):
63
64
28
11
52
adobe/pydc-control
pydc_control/commands.py
Python
run_dc_up_detach
run_dc_up_detach
200
201
200
200
814ea6f41dd0d835350b8bc15be64f0a03126b5f
bigcode/the-stack
train
c2f18b8d6869a402b3611815
train
function
def run_dc_rm(args: argparse.Namespace): return _run_docker_compose_internal(args, ['rm', '--force'])
def run_dc_rm(args: argparse.Namespace):
return _run_docker_compose_internal(args, ['rm', '--force'])
service is not defined, please define one to pull configuration') if not config_service.is_enabled(args): raise KnownException('Cannot pull configuration when using the real config service') return _run_docker_compose_internal(args, ['pull', config_service.dc_name]) def run_dc_rm(args: argparse.Namespa...
64
64
26
9
55
adobe/pydc-control
pydc_control/commands.py
Python
run_dc_rm
run_dc_rm
188
189
188
188
db140269ea63e9b455d6f6d11f6b14cf55ea8eec
bigcode/the-stack
train
eb5006ceda14907bb9d0e9e8
train
function
def _run_docker_compose_with_projects( args: argparse.Namespace, dev_projects: List[Project], docker_compose_args: List[str] ) -> int: # Always use the same project name to allow containers to be started/stopped from any repo commands = ['docker-compose', '-p', config.get_dc_project()] commands.exte...
def _run_docker_compose_with_projects( args: argparse.Namespace, dev_projects: List[Project], docker_compose_args: List[str] ) -> int: # Always use the same project name to allow containers to be started/stopped from any repo
commands = ['docker-compose', '-p', config.get_dc_project()] commands.extend(['-f', config.get_docker_compose_path()]) for project in dev_projects: commands.extend(['-f', os.path.join(project.path, config.DOCKER_COMPOSE_FILE)]) commands.extend(docker_compose_args) # Only do this if we are b...
open_ports.items(): log.get_logger().debug( f'Waiting for port {host_port} (container port {container_port}) ' f'to be open for container {service.container_name}' ) while not docker_utils.is_port_open(host_port): log.get_logger().debu...
210
210
702
55
155
adobe/pydc-control
pydc_control/commands.py
Python
_run_docker_compose_with_projects
_run_docker_compose_with_projects
47
116
47
50
fadb7ad49bb53d2b16f3ee4197f755ba0cfab161
bigcode/the-stack
train
143228c85f30a3dea2c40f8b
train
function
def get_repo_status(args: argparse.Namespace): if args.all_projects or not args.dev_project_names: projects = Project.find_all() else: projects = _get_dev_projects(args) if len(projects) == 0: raise KnownException('There are no projects available, please set projects') log.get_l...
def get_repo_status(args: argparse.Namespace):
if args.all_projects or not args.dev_project_names: projects = Project.find_all() else: projects = _get_dev_projects(args) if len(projects) == 0: raise KnownException('There are no projects available, please set projects') log.get_logger().info(f'Getting the git status for {len(...
ach(args: argparse.Namespace): return _run_docker_compose_internal(args, ['up', '--detach']) def run_dc_up_recreate(args: argparse.Namespace): return _run_docker_compose_internal(args, ['up', '--force-recreate']) def get_repo_status(args: argparse.Namespace):
63
64
154
9
54
adobe/pydc-control
pydc_control/commands.py
Python
get_repo_status
get_repo_status
208
224
208
208
7dda11af3f5fa430daf181881370b63c10268801
bigcode/the-stack
train
13a52408b29391ea831c6ed1
train
function
def call_commands(commands: List[str]) -> int: """ Calls the commands given, waits for the result, and returns the exit code. Stdout and stderr are not redirected and are printed directly to the console. This also handles keyboard interrupts correctly. :param commands: The commands to run as arguments t...
def call_commands(commands: List[str]) -> int:
""" Calls the commands given, waits for the result, and returns the exit code. Stdout and stderr are not redirected and are printed directly to the console. This also handles keyboard interrupts correctly. :param commands: The commands to run as arguments to subprocess.Popen :return: The exit code o...
}:{org}/{project.directory}.git'] exit_code = subprocess.call(command, cwd=project.path) if exit_code: log.get_logger().warning(f'There was a problem adding remote {remote} in project {project.name}') return result def call_commands(commands: List[str]) -> int:
64
64
160
11
52
adobe/pydc-control
pydc_control/commands.py
Python
call_commands
call_commands
287
302
287
287
975d17e81f5bab80961f7929d34137552643d6a5
bigcode/the-stack
train
98759369c9e5ae247cbd45f1
train
function
def run_dc_pull(args: argparse.Namespace): return _run_docker_compose_internal(args, ['pull'])
def run_dc_pull(args: argparse.Namespace):
return _run_docker_compose_internal(args, ['pull'])
config'], no_network=True) def run_dc_down(args: argparse.Namespace): # Always add remove orphans flag since we can create orphans through enable/disable flags return _run_docker_compose_internal(args, ['down', '--remove-orphans']) def run_dc_pull(args: argparse.Namespace):
63
64
23
9
54
adobe/pydc-control
pydc_control/commands.py
Python
run_dc_pull
run_dc_pull
175
176
175
175
7b1da930ce2461f27ee5e8344fc5b73c447e658f
bigcode/the-stack
train
1be3ebf35370d1680366f0e2
train
function
def run_dc_up_recreate(args: argparse.Namespace): return _run_docker_compose_internal(args, ['up', '--force-recreate'])
def run_dc_up_recreate(args: argparse.Namespace):
return _run_docker_compose_internal(args, ['up', '--force-recreate'])
def run_dc_up(args: argparse.Namespace): return _run_docker_compose_internal(args, ['up']) def run_dc_up_detach(args: argparse.Namespace): return _run_docker_compose_internal(args, ['up', '--detach']) def run_dc_up_recreate(args: argparse.Namespace):
63
64
30
11
52
adobe/pydc-control
pydc_control/commands.py
Python
run_dc_up_recreate
run_dc_up_recreate
204
205
204
204
0ca9ded392207bdbcc2f6d5c01053bfc94daaf42
bigcode/the-stack
train
fad977cf8ffa573e0e4b764b
train
function
def _get_dev_projects(args: argparse.Namespace) -> List[Project]: # Filter the projects by the list of passed in project names return list(project for project in Project.find_all() if project.name in args.dev_project_names)
def _get_dev_projects(args: argparse.Namespace) -> List[Project]: # Filter the projects by the list of passed in project names
return list(project for project in Project.find_all() if project.name in args.dev_project_names)
time.sleep(0.1) for port, path in service.wait_for_ports.items(): docker_utils.check_port(service.container_name, open_ports[port], path) def _get_dev_projects(args: argparse.Namespace) -> List[Project]: # Filter the projects by the list of passed in project names
64
64
49
29
35
adobe/pydc-control
pydc_control/commands.py
Python
_get_dev_projects
_get_dev_projects
42
44
42
43
731f971d777e241f430da170e13fdf134dc39484
bigcode/the-stack
train
6cfcfbeb7a34993342fd1d6a
train
function
def run_dc_up(args: argparse.Namespace): return _run_docker_compose_internal(args, ['up'])
def run_dc_up(args: argparse.Namespace):
return _run_docker_compose_internal(args, ['up'])
_service.dc_name]) def run_dc_rm(args: argparse.Namespace): return _run_docker_compose_internal(args, ['rm', '--force']) def run_dc_stop(args: argparse.Namespace): return _run_docker_compose_internal(args, ['stop']) def run_dc_up(args: argparse.Namespace):
63
64
23
9
54
adobe/pydc-control
pydc_control/commands.py
Python
run_dc_up
run_dc_up
196
197
196
196
fdb1298ea7f854b87afebe5eef1d36be460c0be8
bigcode/the-stack
train
9eee0f141ea56ae010dc066a
train
class
class QtImageControls(QtBaseImageControls): """Qt view and controls for the napari Image layer. Parameters ---------- layer : napari.layers.Image An instance of a napari Image layer. Attributes ---------- attenuationSlider : qtpy.QtWidgets.QSlider Slider controlling attenua...
class QtImageControls(QtBaseImageControls):
"""Qt view and controls for the napari Image layer. Parameters ---------- layer : napari.layers.Image An instance of a napari Image layer. Attributes ---------- attenuationSlider : qtpy.QtWidgets.QSlider Slider controlling attenuation rate for `attenuated_mip` mode. att...
from qtpy.QtCore import Qt from qtpy.QtWidgets import QComboBox, QHBoxLayout, QLabel, QSlider from ...layers.image._image_constants import ( Interpolation, Interpolation3D, Rendering, ) from .qt_image_base_layer import QtBaseImageControls class QtImageControls(QtBaseImageControls):
71
256
2,299
9
61
yinawang28/napari
napari/_qt/layers/qt_image_layer.py
Python
QtImageControls
QtImageControls
12
276
12
12
574a7bc7d174969fd16deebefa6db7134ef1cccf
bigcode/the-stack
train
60834eb2c06c9320f4a20fb3
train
function
def main(): # Funcion main queryTool = Pantalla() return 0
def main(): # Funcion main
queryTool = Pantalla() return 0
Pantalla_AST(self.window) def open_Reporte(self): # Abre la pantalla de los reportes de errores windowTableS = Pantalla_Error( self.window, self.lexicalErrors, self.sintacticErrors, self.semanticErrors ) def main(): # Funcion main
64
64
20
8
56
Yadira-Ferrer/tytus
parser/team29/UI/PantallaPrincipal.py
Python
main
main
158
160
158
158
132ba8d5fa4f946a424a702ac195474aa36c3edf
bigcode/the-stack
train
caee0356bc3176c31ccf55fd
train
class
class Pantalla: def __init__(self): self.lexicalErrors = list() self.sintacticErrors = list() self.semanticErrors = list() self.postgreSQL = list() self.inicializarScreen() def inicializarScreen(self): # inicializacion de la pantalla self.window = Tk() ...
class Pantalla:
def __init__(self): self.lexicalErrors = list() self.sintacticErrors = list() self.semanticErrors = list() self.postgreSQL = list() self.inicializarScreen() def inicializarScreen(self): # inicializacion de la pantalla self.window = Tk() self.windo...
from sys import path from os.path import dirname as dir path.append(dir(path[0])) from tkinter import ttk import tkinter as tk from tkinter import * from ui.Pantalla_TS import * from ui.Pantalla_AST import * from ui.Pantalla_Error import * import tkinter.messagebox from analizer import grammar class Pantalla:
73
256
1,296
4
68
Yadira-Ferrer/tytus
parser/team29/UI/PantallaPrincipal.py
Python
Pantalla
Pantalla
15
155
15
15
20fe04f6fde73fa75a358ff5393f19e1c4f8e4c7
bigcode/the-stack
train
e6b078ca8ea9a6b7a5f05454
train
class
class Spectrum(SciPro): '''Spectrum data''' def __init__(self, x = None, y = None, ytype = 'lin', xtype = 'wl'): SciPro.__init__(self, x, y, ytype = ytype, xtype = 'lin', dtype=double) self.xtype = xtype def copy(self): return Spectrum( self.x.copy(), self.y.copy(), ytype=self.ytype, xtype=self.xtype) def ...
class Spectrum(SciPro):
'''Spectrum data''' def __init__(self, x = None, y = None, ytype = 'lin', xtype = 'wl'): SciPro.__init__(self, x, y, ytype = ytype, xtype = 'lin', dtype=double) self.xtype = xtype def copy(self): return Spectrum( self.x.copy(), self.y.copy(), ytype=self.ytype, xtype=self.xtype) def fromwl(self, wl = None, ...
# -*- coding: utf-8 -*- from .scipro import SciPro from numpy import arange, array, append, int32, double, linspace, select, diff,interp,where,zeros,log10 from scipy import integrate from numpy.fft import * from .constants import * class Spectrum(SciPro):
69
256
1,343
6
63
galilley/scipro
spectrum.py
Python
Spectrum
Spectrum
10
135
10
10
d99f00929fb39516071ff2ee484356c126fa93a6
bigcode/the-stack
train
0a01787cd5537348e67d9cee
train
class
@find_js_tests class NodeTestCase(WatchmanTestCase.TempDirPerTestMixin, unittest.TestCase): attempt = 0 def setAttemptNumber(self, attempt: int) -> None: """enable flaky test retry""" self.attempt = attempt @unittest.skipIf( yarn_bin is None or node_bin is None, "yarn/node not corr...
@find_js_tests class NodeTestCase(WatchmanTestCase.TempDirPerTestMixin, unittest.TestCase):
attempt = 0 def setAttemptNumber(self, attempt: int) -> None: """enable flaky test retry""" self.attempt = attempt @unittest.skipIf( yarn_bin is None or node_bin is None, "yarn/node not correctly installed" ) def runTest(self) -> None: env = os.environ.copy() ...
def make_class(jsfile): # Define a new class that derives from the input class. # This has to be a function otherwise jsfile captures # the value from the last iteration of the glob loop. class JSTest(test_class): def getCommandArgs(self): ...
159
159
532
24
134
fp-forks/watchman
watchman/integration/test_nodejs.py
Python
NodeTestCase
NodeTestCase
65
130
65
66
803e79059cdf7684f6fe17079430c5a72fac295b
bigcode/the-stack
train
ad117ae077f7ce3d7756c731
train
function
def find_js_tests(test_class) -> None: """ A decorator function used to create a class per JavaScript test script """ # We do some rather hacky things here to define new test class types # in our caller's scope. This is needed so that the unittest TestLoader # will find the subclasses we defin...
def find_js_tests(test_class) -> None:
""" A decorator function used to create a class per JavaScript test script """ # We do some rather hacky things here to define new test class types # in our caller's scope. This is needed so that the unittest TestLoader # will find the subclasses we define. # pyre-fixme[16]: Optional type ...
re import shutil import signal import subprocess import unittest from watchman.integration.lib import Interrupt, WatchmanInstance, WatchmanTestCase from watchman.integration.lib.node import node_bin, yarn_bin WATCHMAN_SRC_DIR: str = os.environ.get("WATCHMAN_SRC_DIR", os.getcwd()) THIS_DIR = os.path.join(WATCHMAN_SR...
88
88
294
10
78
fp-forks/watchman
watchman/integration/test_nodejs.py
Python
find_js_tests
find_js_tests
26
62
26
26
86e5cedeaf4291f02794d76c76c4052753780190
bigcode/the-stack
train
3918f094ef89817047cf3379
train
function
@question_proc('choice-yesno', 'choice-yesnocomment', 'choice-yesnodontknow') def question_yesno(request, question, runinfo, errors): key = "question_%s" % question.number key2 = "question_%s_comment" % question.number val = request.POST.get(key, None) cmt = request.POST.get(key2, '') qtype = questi...
@question_proc('choice-yesno', 'choice-yesnocomment', 'choice-yesnodontknow') def question_yesno(request, question, runinfo, errors):
key = "question_%s" % question.number key2 = "question_%s_comment" % question.number val = request.POST.get(key, None) cmt = request.POST.get(key2, '') qtype = question.get_type() cd = question.getcheckdict() jstriggers = [] if qtype == 'choice-yesnocomment': hascomment = True ...
from django.core.exceptions import ValidationError from general.utils import validate_email from phonenumber_field.validators import validate_international_phonenumber from questionnaire import * from questionnaire.models import Answer from django.utils.translation import ugettext as _ from json import dumps @question_...
89
156
521
38
50
affan2/ed-questionnaire
questionnaire/qprocessors/simple.py
Python
question_yesno
question_yesno
10
70
10
11
234c205c17d5eefec6dbe1a4f492fe51137f3840
bigcode/the-stack
train