blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
7.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
378
8.64k
id
stringlengths
44
44
length_bytes
int64
505
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.88k
prompted_full_text
stringlengths
565
12.5k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
5.05k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
snapshot_total_rows
int64
75.8k
75.8k
solution
stringlengths
242
8.3k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
e022d1c38b7ae99228b04a60e8d822d739f5c3fb
[ "try:\n uid = force_text(urlsafe_base64_decode(attrs['uidb64']))\n user = User.objects.get(pk=uid)\nexcept (TypeError, ValueError, OverflowError, User.DoesNotExist):\n user = None\nif not user or not account_activation_token.check_token(user, attrs['token']):\n raise serializers.ValidationError('Invalid...
<|body_start_0|> try: uid = force_text(urlsafe_base64_decode(attrs['uidb64'])) user = User.objects.get(pk=uid) except (TypeError, ValueError, OverflowError, User.DoesNotExist): user = None if not user or not account_activation_token.check_token(user, attrs['to...
Serializer for account confirmation feature. Confirmation link http(s)://domain/uidb64/token/ is generated after successful registration. uidb64: user id in base64 encoding token: user token created after registration
AccountConfirmationSerializer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AccountConfirmationSerializer: """Serializer for account confirmation feature. Confirmation link http(s)://domain/uidb64/token/ is generated after successful registration. uidb64: user id in base64 encoding token: user token created after registration""" def validate(self, attrs): ""...
stack_v2_sparse_classes_75kplus_train_002500
6,320
no_license
[ { "docstring": "Validate uidb64 and token are bound to the same user.", "name": "validate", "signature": "def validate(self, attrs)" }, { "docstring": "Setting is_active field to True, make the account active.", "name": "save", "signature": "def save(self, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_050313
Implement the Python class `AccountConfirmationSerializer` described below. Class description: Serializer for account confirmation feature. Confirmation link http(s)://domain/uidb64/token/ is generated after successful registration. uidb64: user id in base64 encoding token: user token created after registration Metho...
Implement the Python class `AccountConfirmationSerializer` described below. Class description: Serializer for account confirmation feature. Confirmation link http(s)://domain/uidb64/token/ is generated after successful registration. uidb64: user id in base64 encoding token: user token created after registration Metho...
4cbf70e66c49087498b6bf58971ad58b8330994d
<|skeleton|> class AccountConfirmationSerializer: """Serializer for account confirmation feature. Confirmation link http(s)://domain/uidb64/token/ is generated after successful registration. uidb64: user id in base64 encoding token: user token created after registration""" def validate(self, attrs): ""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AccountConfirmationSerializer: """Serializer for account confirmation feature. Confirmation link http(s)://domain/uidb64/token/ is generated after successful registration. uidb64: user id in base64 encoding token: user token created after registration""" def validate(self, attrs): """Validate uid...
the_stack_v2_python_sparse
ETWeb/accounts/api/serializers.py
adarsharegmi/employeeMS
train
1
d1b44ca52c4023bd2e955b51da5a13d1a4488c55
[ "self.name = 'ec'\nself._n_e = n_e\nself.targets = targets\nself.ssa = ssa\nspectral_pars = get_spectral_parameters_from_n_e(self._n_e, backend='sherpa', modelname=self.name)\nemission_region_pars = make_emission_region_parameters_dict('ec', backend='sherpa', modelname=self.name)\ntargets_pars = make_targets_parame...
<|body_start_0|> self.name = 'ec' self._n_e = n_e self.targets = targets self.ssa = ssa spectral_pars = get_spectral_parameters_from_n_e(self._n_e, backend='sherpa', modelname=self.name) emission_region_pars = make_emission_region_parameters_dict('ec', backend='sherpa', m...
ExternalComptonRegriddableModel1D
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExternalComptonRegriddableModel1D: def __init__(self, n_e, targets, ssa=False): """sherpa wrapper for a source emitting Synchrotron, SSC, and EC on a list of targets. Parameters ---------- n_e : `~agnpy.spectra.ElectronDistribution` electron distribution to be used for this modelling tar...
stack_v2_sparse_classes_75kplus_train_002501
14,627
permissive
[ { "docstring": "sherpa wrapper for a source emitting Synchrotron, SSC, and EC on a list of targets. Parameters ---------- n_e : `~agnpy.spectra.ElectronDistribution` electron distribution to be used for this modelling targets : list of strings [\"blr\", \"dt\"] targets to be considered for external Compton typi...
4
stack_v2_sparse_classes_30k_train_050529
Implement the Python class `ExternalComptonRegriddableModel1D` described below. Class description: Implement the ExternalComptonRegriddableModel1D class. Method signatures and docstrings: - def __init__(self, n_e, targets, ssa=False): sherpa wrapper for a source emitting Synchrotron, SSC, and EC on a list of targets....
Implement the Python class `ExternalComptonRegriddableModel1D` described below. Class description: Implement the ExternalComptonRegriddableModel1D class. Method signatures and docstrings: - def __init__(self, n_e, targets, ssa=False): sherpa wrapper for a source emitting Synchrotron, SSC, and EC on a list of targets....
b72c94fa5c205284e0e3ee7a37072f3ccfc97c7b
<|skeleton|> class ExternalComptonRegriddableModel1D: def __init__(self, n_e, targets, ssa=False): """sherpa wrapper for a source emitting Synchrotron, SSC, and EC on a list of targets. Parameters ---------- n_e : `~agnpy.spectra.ElectronDistribution` electron distribution to be used for this modelling tar...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ExternalComptonRegriddableModel1D: def __init__(self, n_e, targets, ssa=False): """sherpa wrapper for a source emitting Synchrotron, SSC, and EC on a list of targets. Parameters ---------- n_e : `~agnpy.spectra.ElectronDistribution` electron distribution to be used for this modelling targets : list of...
the_stack_v2_python_sparse
agnpy/fit/sherpa_wrapper.py
cosimoNigro/agnpy
train
49
e1880ad05e6eb8e04a90d77deebb111cd5ce871c
[ "self.ago_string = listing.get('config_specified_ago_string')\nself.city = listing.get('city')\nself.cluster_expansion_url = listing.get('cluster_expansion_url')\nself.company = listing.get('company_name')\nself.description = listing.get('description_clip') if listing.get('description_clip') else ''\nself.descripti...
<|body_start_0|> self.ago_string = listing.get('config_specified_ago_string') self.city = listing.get('city') self.cluster_expansion_url = listing.get('cluster_expansion_url') self.company = listing.get('company_name') self.description = listing.get('description_clip') if listing...
Job object to store job information.
Job
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Job: """Job object to store job information.""" def __init__(self, listing, bridge_search_query): """Initialize a Job object.""" <|body_0|> def is_new(self): """Returns true if job is less than a specified number of days old.""" <|body_1|> <|end_skeleton...
stack_v2_sparse_classes_75kplus_train_002502
5,331
no_license
[ { "docstring": "Initialize a Job object.", "name": "__init__", "signature": "def __init__(self, listing, bridge_search_query)" }, { "docstring": "Returns true if job is less than a specified number of days old.", "name": "is_new", "signature": "def is_new(self)" } ]
2
stack_v2_sparse_classes_30k_train_026487
Implement the Python class `Job` described below. Class description: Job object to store job information. Method signatures and docstrings: - def __init__(self, listing, bridge_search_query): Initialize a Job object. - def is_new(self): Returns true if job is less than a specified number of days old.
Implement the Python class `Job` described below. Class description: Job object to store job information. Method signatures and docstrings: - def __init__(self, listing, bridge_search_query): Initialize a Job object. - def is_new(self): Returns true if job is less than a specified number of days old. <|skeleton|> cl...
da3073eec6d676dfe0164502b80d2a1c75e89575
<|skeleton|> class Job: """Job object to store job information.""" def __init__(self, listing, bridge_search_query): """Initialize a Job object.""" <|body_0|> def is_new(self): """Returns true if job is less than a specified number of days old.""" <|body_1|> <|end_skeleton...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Job: """Job object to store job information.""" def __init__(self, listing, bridge_search_query): """Initialize a Job object.""" self.ago_string = listing.get('config_specified_ago_string') self.city = listing.get('city') self.cluster_expansion_url = listing.get('cluster_e...
the_stack_v2_python_sparse
web-serpng/code/serpng/jobs/services/search/job.py
alyago/django-web
train
0
b03d8e77889d78d07471cbc646ced16102682277
[ "value = '<div>'\nclase = 'actions'\nurl_cont = './' + str(obj.id_tipo_item)\nid_tipo = UrlParser.parse_id(request.url, 'tipositems')\nif id_tipo:\n url_cont = '../' + str(obj.id_tipo_item)\nif UrlParser.parse_nombre(request.url, 'post_buscar'):\n url_cont = '../' + str(obj.id_tipo_item)\npp = PoseePermiso('r...
<|body_start_0|> value = '<div>' clase = 'actions' url_cont = './' + str(obj.id_tipo_item) id_tipo = UrlParser.parse_id(request.url, 'tipositems') if id_tipo: url_cont = '../' + str(obj.id_tipo_item) if UrlParser.parse_nombre(request.url, 'post_buscar'): ...
TipoItemTableFiller
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TipoItemTableFiller: def __actions__(self, obj): """Links de acciones para un registro dado""" <|body_0|> def _do_get_provider_count_and_objs(self, id_fase=None, id_tipo=None, **kw): """Se muestra la lista de tipos de item para la fase en cuestión""" <|body_1...
stack_v2_sparse_classes_75kplus_train_002503
21,979
no_license
[ { "docstring": "Links de acciones para un registro dado", "name": "__actions__", "signature": "def __actions__(self, obj)" }, { "docstring": "Se muestra la lista de tipos de item para la fase en cuestión", "name": "_do_get_provider_count_and_objs", "signature": "def _do_get_provider_coun...
2
stack_v2_sparse_classes_30k_train_021314
Implement the Python class `TipoItemTableFiller` described below. Class description: Implement the TipoItemTableFiller class. Method signatures and docstrings: - def __actions__(self, obj): Links de acciones para un registro dado - def _do_get_provider_count_and_objs(self, id_fase=None, id_tipo=None, **kw): Se muestr...
Implement the Python class `TipoItemTableFiller` described below. Class description: Implement the TipoItemTableFiller class. Method signatures and docstrings: - def __actions__(self, obj): Links de acciones para un registro dado - def _do_get_provider_count_and_objs(self, id_fase=None, id_tipo=None, **kw): Se muestr...
997531e130d1951b483f4a6a67f2df7467cd9fd1
<|skeleton|> class TipoItemTableFiller: def __actions__(self, obj): """Links de acciones para un registro dado""" <|body_0|> def _do_get_provider_count_and_objs(self, id_fase=None, id_tipo=None, **kw): """Se muestra la lista de tipos de item para la fase en cuestión""" <|body_1...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TipoItemTableFiller: def __actions__(self, obj): """Links de acciones para un registro dado""" value = '<div>' clase = 'actions' url_cont = './' + str(obj.id_tipo_item) id_tipo = UrlParser.parse_id(request.url, 'tipositems') if id_tipo: url_cont = '....
the_stack_v2_python_sparse
lpm/controllers/tipoitem.py
jorgeramirez/LPM
train
1
6a68650d966d969a7c94ce5fd26414d6f7fe2cf7
[ "times = -(-len(B) // len(A))\nfor i in range(2):\n if B in A * (times + i):\n return times + i\nreturn -1", "al = len(A)\nbl = len(B)\nif bl <= al:\n if len(A.replace(B, '')) != al:\n return 1\n elif len((A * 2).replace(B, '')) != 2 * al:\n return 2\n else:\n return -1\nel...
<|body_start_0|> times = -(-len(B) // len(A)) for i in range(2): if B in A * (times + i): return times + i return -1 <|end_body_0|> <|body_start_1|> al = len(A) bl = len(B) if bl <= al: if len(A.replace(B, '')) != al: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def repeatedStringMatch_1(self, A, B): """:type A: str :type B: str :rtype: int 206ms""" <|body_0|> def repeatedStringMatch(self, A, B): """:type A: str :type B: str :rtype: int 499ms""" <|body_1|> <|end_skeleton|> <|body_start_0|> times =...
stack_v2_sparse_classes_75kplus_train_002504
1,654
no_license
[ { "docstring": ":type A: str :type B: str :rtype: int 206ms", "name": "repeatedStringMatch_1", "signature": "def repeatedStringMatch_1(self, A, B)" }, { "docstring": ":type A: str :type B: str :rtype: int 499ms", "name": "repeatedStringMatch", "signature": "def repeatedStringMatch(self, ...
2
stack_v2_sparse_classes_30k_val_002879
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def repeatedStringMatch_1(self, A, B): :type A: str :type B: str :rtype: int 206ms - def repeatedStringMatch(self, A, B): :type A: str :type B: str :rtype: int 499ms
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def repeatedStringMatch_1(self, A, B): :type A: str :type B: str :rtype: int 206ms - def repeatedStringMatch(self, A, B): :type A: str :type B: str :rtype: int 499ms <|skeleton|...
679a2b246b8b6bb7fc55ed1c8096d3047d6d4461
<|skeleton|> class Solution: def repeatedStringMatch_1(self, A, B): """:type A: str :type B: str :rtype: int 206ms""" <|body_0|> def repeatedStringMatch(self, A, B): """:type A: str :type B: str :rtype: int 499ms""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def repeatedStringMatch_1(self, A, B): """:type A: str :type B: str :rtype: int 206ms""" times = -(-len(B) // len(A)) for i in range(2): if B in A * (times + i): return times + i return -1 def repeatedStringMatch(self, A, B): "...
the_stack_v2_python_sparse
RepeatedStringMatch_686.py
953250587/leetcode-python
train
2
04b36993816d3dc4dd4677e53d65f2e4e1bfc992
[ "display = NanpyCharDisplay(self.mudpi, config)\nif display:\n node = self.extension.nodes[config['node']]\n if node:\n display.node = node\n self.add_component(display)\n else:\n raise MudPiError(f\"Nanpy node {config['node']} not found trying to connect {config['key']}.\")\nreturn Tr...
<|body_start_0|> display = NanpyCharDisplay(self.mudpi, config) if display: node = self.extension.nodes[config['node']] if node: display.node = node self.add_component(display) else: raise MudPiError(f"Nanpy node {config...
Interface
[ "BSD-4-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Interface: def load(self, config): """Load Nanpy display components from configs""" <|body_0|> def validate(self, config): """Validate the Nanpy display config""" <|body_1|> <|end_skeleton|> <|body_start_0|> display = NanpyCharDisplay(self.mudpi, co...
stack_v2_sparse_classes_75kplus_train_002505
5,336
permissive
[ { "docstring": "Load Nanpy display components from configs", "name": "load", "signature": "def load(self, config)" }, { "docstring": "Validate the Nanpy display config", "name": "validate", "signature": "def validate(self, config)" } ]
2
stack_v2_sparse_classes_30k_train_047269
Implement the Python class `Interface` described below. Class description: Implement the Interface class. Method signatures and docstrings: - def load(self, config): Load Nanpy display components from configs - def validate(self, config): Validate the Nanpy display config
Implement the Python class `Interface` described below. Class description: Implement the Interface class. Method signatures and docstrings: - def load(self, config): Load Nanpy display components from configs - def validate(self, config): Validate the Nanpy display config <|skeleton|> class Interface: def load(...
fb206b1136f529c7197f1e6b29629ed05630d377
<|skeleton|> class Interface: def load(self, config): """Load Nanpy display components from configs""" <|body_0|> def validate(self, config): """Validate the Nanpy display config""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Interface: def load(self, config): """Load Nanpy display components from configs""" display = NanpyCharDisplay(self.mudpi, config) if display: node = self.extension.nodes[config['node']] if node: display.node = node self.add_compo...
the_stack_v2_python_sparse
mudpi/extensions/nanpy/char_display.py
mistasp0ck/mudpi-core
train
0
d50c138a63f88fd0f10ea7701b215792431be025
[ "if os.path.exists(file):\n self.file = file\nelse:\n sys.exit('Invalid or missing file.')\nself.delimiter = delimiter", "counter = 0\ncounter_snv = 0\ncounter_indel = 0\ncounter_indel_triplet = 0\nwith open(self.file) as file_p:\n variant_reader = csv.DictReader(file_p, delimiter=self.delimiter)\n fo...
<|body_start_0|> if os.path.exists(file): self.file = file else: sys.exit('Invalid or missing file.') self.delimiter = delimiter <|end_body_0|> <|body_start_1|> counter = 0 counter_snv = 0 counter_indel = 0 counter_indel_triplet = 0 ...
The Variants class to handle the variants.tsv file.
Variants
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Variants: """The Variants class to handle the variants.tsv file.""" def __init__(self, file, delimiter='\t'): """Initialize the object with the variants.tsv file""" <|body_0|> def get_total_variants(self, indel=True): """A method that parses the iVar variants fil...
stack_v2_sparse_classes_75kplus_train_002506
2,703
permissive
[ { "docstring": "Initialize the object with the variants.tsv file", "name": "__init__", "signature": "def __init__(self, file, delimiter='\\t')" }, { "docstring": "A method that parses the iVar variants file and returns the total number of variants. Arguments: * indel: a boolean to determine whet...
2
stack_v2_sparse_classes_30k_train_016776
Implement the Python class `Variants` described below. Class description: The Variants class to handle the variants.tsv file. Method signatures and docstrings: - def __init__(self, file, delimiter='\t'): Initialize the object with the variants.tsv file - def get_total_variants(self, indel=True): A method that parses ...
Implement the Python class `Variants` described below. Class description: The Variants class to handle the variants.tsv file. Method signatures and docstrings: - def __init__(self, file, delimiter='\t'): Initialize the object with the variants.tsv file - def get_total_variants(self, indel=True): A method that parses ...
9f81f4bda3d1581e666fedebb9f31b066ceefb70
<|skeleton|> class Variants: """The Variants class to handle the variants.tsv file.""" def __init__(self, file, delimiter='\t'): """Initialize the object with the variants.tsv file""" <|body_0|> def get_total_variants(self, indel=True): """A method that parses the iVar variants fil...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Variants: """The Variants class to handle the variants.tsv file.""" def __init__(self, file, delimiter='\t'): """Initialize the object with the variants.tsv file""" if os.path.exists(file): self.file = file else: sys.exit('Invalid or missing file.') ...
the_stack_v2_python_sparse
parser/ncov/parser/Variants.py
connor-lab/ncov-tools
train
3
17a66a715d80643625a3a165067f4002c28641f4
[ "self.username = username\nself.password = password\nself.et_build_version = et_build_version\nself.title = title\nself.space = space\nself.parent_page = parent_page", "generator = auto_testing_CI.CI3_module.confluence.generate_build_report_for_all_testings.GenerateAllReports(self.username, self.password, self.et...
<|body_start_0|> self.username = username self.password = password self.et_build_version = et_build_version self.title = title self.space = space self.parent_page = parent_page <|end_body_0|> <|body_start_1|> generator = auto_testing_CI.CI3_module.confluence.gene...
Collect all testing reports and update them to the Confluence
CollectAllReportsAndUpdateToConfluence
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CollectAllReportsAndUpdateToConfluence: """Collect all testing reports and update them to the Confluence""" def __init__(self, username, password, et_build_version, title, space, parent_page): """:param username: string username to connect with Confulence then create/update testing r...
stack_v2_sparse_classes_75kplus_train_002507
1,844
no_license
[ { "docstring": ":param username: string username to connect with Confulence then create/update testing reports :param password: string password to the above username: :param et_build_version: string the current Errata Tool version of the build, like 3354 and so on :param title: string the title of the testing r...
2
stack_v2_sparse_classes_30k_train_016137
Implement the Python class `CollectAllReportsAndUpdateToConfluence` described below. Class description: Collect all testing reports and update them to the Confluence Method signatures and docstrings: - def __init__(self, username, password, et_build_version, title, space, parent_page): :param username: string usernam...
Implement the Python class `CollectAllReportsAndUpdateToConfluence` described below. Class description: Collect all testing reports and update them to the Confluence Method signatures and docstrings: - def __init__(self, username, password, et_build_version, title, space, parent_page): :param username: string usernam...
4d9e3e68c826ea44a6ddbbf72f18d54e68f6aa43
<|skeleton|> class CollectAllReportsAndUpdateToConfluence: """Collect all testing reports and update them to the Confluence""" def __init__(self, username, password, et_build_version, title, space, parent_page): """:param username: string username to connect with Confulence then create/update testing r...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CollectAllReportsAndUpdateToConfluence: """Collect all testing reports and update them to the Confluence""" def __init__(self, username, password, et_build_version, title, space, parent_page): """:param username: string username to connect with Confulence then create/update testing reports :param...
the_stack_v2_python_sparse
CI3_module/confluence/collect_all_reports_and_update_to_confluence.py
testcara/CI_3
train
0
be630830af53ef6855daaba6fb9247e991ad63a9
[ "request = self.context['request']\npath = self.context['view'].kwargs.get('path')\nreturn reverse('filebrowserpath', request=request, kwargs={'path': path})", "request = self.context['request']\npath = self.context['view'].kwargs.get('path')\nreturn reverse('filebrowserpathfile-list', request=request, kwargs={'p...
<|body_start_0|> request = self.context['request'] path = self.context['view'].kwargs.get('path') return reverse('filebrowserpath', request=request, kwargs={'path': path}) <|end_body_0|> <|body_start_1|> request = self.context['request'] path = self.context['view'].kwargs.get('p...
FileBrowserPathSerializer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FileBrowserPathSerializer: def get_url(self, obj): """Overriden to get the url of the path.""" <|body_0|> def get_files(self, obj): """Custom method to get the hyperlink to the list of files directly under the path.""" <|body_1|> <|end_skeleton|> <|body_sta...
stack_v2_sparse_classes_75kplus_train_002508
2,034
permissive
[ { "docstring": "Overriden to get the url of the path.", "name": "get_url", "signature": "def get_url(self, obj)" }, { "docstring": "Custom method to get the hyperlink to the list of files directly under the path.", "name": "get_files", "signature": "def get_files(self, obj)" } ]
2
stack_v2_sparse_classes_30k_train_024825
Implement the Python class `FileBrowserPathSerializer` described below. Class description: Implement the FileBrowserPathSerializer class. Method signatures and docstrings: - def get_url(self, obj): Overriden to get the url of the path. - def get_files(self, obj): Custom method to get the hyperlink to the list of file...
Implement the Python class `FileBrowserPathSerializer` described below. Class description: Implement the FileBrowserPathSerializer class. Method signatures and docstrings: - def get_url(self, obj): Overriden to get the url of the path. - def get_files(self, obj): Custom method to get the hyperlink to the list of file...
20d3eedf20610af9182f6cca8db8f0b3546b5336
<|skeleton|> class FileBrowserPathSerializer: def get_url(self, obj): """Overriden to get the url of the path.""" <|body_0|> def get_files(self, obj): """Custom method to get the hyperlink to the list of files directly under the path.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FileBrowserPathSerializer: def get_url(self, obj): """Overriden to get the url of the path.""" request = self.context['request'] path = self.context['view'].kwargs.get('path') return reverse('filebrowserpath', request=request, kwargs={'path': path}) def get_files(self, obj...
the_stack_v2_python_sparse
chris_backend/filebrowser/serializers.py
FNNDSC/ChRIS_ultron_backEnd
train
36
92858f4c6c8b2f078572f95837dccfd0bf4b6cfa
[ "self.component_name = component_name\nself.component_type = component_type\nself.indent = None if ndjson else 4\nself.separators = (',', ':') if ndjson else (', ', ': ')\nsuper(StructuredFormatter, self).__init__()", "data: Dict[str, Union[str, List[str]]] = {'timestamp': datetime.utcnow().isoformat(), 'message'...
<|body_start_0|> self.component_name = component_name self.component_type = component_type self.indent = None if ndjson else 4 self.separators = (',', ':') if ndjson else (', ', ': ') super(StructuredFormatter, self).__init__() <|end_body_0|> <|body_start_1|> data: Dict[...
StructuredFormatter is a Formatter for structured logging. LogRecord objects are formatted as JSON. Under the default configuration, a StructuredFormatter will render these as NDJSON (http://ndjson.org/)
StructuredFormatter
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StructuredFormatter: """StructuredFormatter is a Formatter for structured logging. LogRecord objects are formatted as JSON. Under the default configuration, a StructuredFormatter will render these as NDJSON (http://ndjson.org/)""" def __init__(self, component_name: Optional[str]=None, compon...
stack_v2_sparse_classes_75kplus_train_002509
3,202
permissive
[ { "docstring": "Create a StructuredFormatter object. component_name: Optional[str] - The name of the software component component_type: Optional[str] - The type of the software component ndjson: bool - Output as NDJSON; defaults to True.", "name": "__init__", "signature": "def __init__(self, component_n...
2
stack_v2_sparse_classes_30k_train_032555
Implement the Python class `StructuredFormatter` described below. Class description: StructuredFormatter is a Formatter for structured logging. LogRecord objects are formatted as JSON. Under the default configuration, a StructuredFormatter will render these as NDJSON (http://ndjson.org/) Method signatures and docstri...
Implement the Python class `StructuredFormatter` described below. Class description: StructuredFormatter is a Formatter for structured logging. LogRecord objects are formatted as JSON. Under the default configuration, a StructuredFormatter will render these as NDJSON (http://ndjson.org/) Method signatures and docstri...
12719efa84be2281debe98a18c69bbe7a6d0f399
<|skeleton|> class StructuredFormatter: """StructuredFormatter is a Formatter for structured logging. LogRecord objects are formatted as JSON. Under the default configuration, a StructuredFormatter will render these as NDJSON (http://ndjson.org/)""" def __init__(self, component_name: Optional[str]=None, compon...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class StructuredFormatter: """StructuredFormatter is a Formatter for structured logging. LogRecord objects are formatted as JSON. Under the default configuration, a StructuredFormatter will render these as NDJSON (http://ndjson.org/)""" def __init__(self, component_name: Optional[str]=None, component_type: Opt...
the_stack_v2_python_sparse
lta/log_format.py
blinkdog/lta
train
0
57afabfaf156351e8508aa1f86d0a664f6549914
[ "if not root:\n return False\nif not root.left and (not root.right):\n return root.val == sum\nreturn self.hasPathSum(root.left, sum - root.val) or self.hasPathSum(root.right, sum - root.val)", "if not root:\n return False\nstack = [(root.val, root)]\nwhile stack:\n value, node = stack.pop()\n if n...
<|body_start_0|> if not root: return False if not root.left and (not root.right): return root.val == sum return self.hasPathSum(root.left, sum - root.val) or self.hasPathSum(root.right, sum - root.val) <|end_body_0|> <|body_start_1|> if not root: retu...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def hasPathSum(self, root: TreeNode, sum: int) -> bool: """递归 到某个节点时,判断其是否是叶子节点并且值是否等于sum 若不是,则递归判断左右子树 注: 递归判断时,需要减去当前root的值""" <|body_0|> def hasPathSum_1(self, root: TreeNode, sum: int) -> bool: """迭代 每次把之前节点的值加起来""" <|body_1|> <|end_skeleton|> ...
stack_v2_sparse_classes_75kplus_train_002510
1,824
no_license
[ { "docstring": "递归 到某个节点时,判断其是否是叶子节点并且值是否等于sum 若不是,则递归判断左右子树 注: 递归判断时,需要减去当前root的值", "name": "hasPathSum", "signature": "def hasPathSum(self, root: TreeNode, sum: int) -> bool" }, { "docstring": "迭代 每次把之前节点的值加起来", "name": "hasPathSum_1", "signature": "def hasPathSum_1(self, root: TreeNod...
2
stack_v2_sparse_classes_30k_train_005809
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hasPathSum(self, root: TreeNode, sum: int) -> bool: 递归 到某个节点时,判断其是否是叶子节点并且值是否等于sum 若不是,则递归判断左右子树 注: 递归判断时,需要减去当前root的值 - def hasPathSum_1(self, root: TreeNode, sum: int) -> b...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hasPathSum(self, root: TreeNode, sum: int) -> bool: 递归 到某个节点时,判断其是否是叶子节点并且值是否等于sum 若不是,则递归判断左右子树 注: 递归判断时,需要减去当前root的值 - def hasPathSum_1(self, root: TreeNode, sum: int) -> b...
3508e1ce089131b19603c3206aab4cf43023bb19
<|skeleton|> class Solution: def hasPathSum(self, root: TreeNode, sum: int) -> bool: """递归 到某个节点时,判断其是否是叶子节点并且值是否等于sum 若不是,则递归判断左右子树 注: 递归判断时,需要减去当前root的值""" <|body_0|> def hasPathSum_1(self, root: TreeNode, sum: int) -> bool: """迭代 每次把之前节点的值加起来""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def hasPathSum(self, root: TreeNode, sum: int) -> bool: """递归 到某个节点时,判断其是否是叶子节点并且值是否等于sum 若不是,则递归判断左右子树 注: 递归判断时,需要减去当前root的值""" if not root: return False if not root.left and (not root.right): return root.val == sum return self.hasPathSum(root...
the_stack_v2_python_sparse
algorithm/leetcode/tree/17-路径总和.py
lxconfig/UbuntuCode_bak
train
0
e295d5f0cdad55195150c6f0cff1042453777252
[ "if self.iterations in ['infinite']:\n while True:\n project = self.implement(project=project, **kwargs)\nelse:\n for iteration in range(self.iterations):\n project = self.implement(project=project, **kwargs)\nreturn project", "if self.parameters:\n parameters = self.parameters\n paramet...
<|body_start_0|> if self.iterations in ['infinite']: while True: project = self.implement(project=project, **kwargs) else: for iteration in range(self.iterations): project = self.implement(project=project, **kwargs) return project <|end_bod...
Base class for parts of a sourdough Workflow. Args: name (str): designates the name of a class instance that is used for internal referencing throughout siMpLify. For example, if a siMpLify instance needs options from a Settings instance, 'name' should match the appropriate section name in a Settings instance. Defaults...
SimpleProcess
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SimpleProcess: """Base class for parts of a sourdough Workflow. Args: name (str): designates the name of a class instance that is used for internal referencing throughout siMpLify. For example, if a siMpLify instance needs options from a Settings instance, 'name' should match the appropriate sect...
stack_v2_sparse_classes_75kplus_train_002511
32,679
permissive
[ { "docstring": "[summary] Args: project (sourdough.Project): [description] Returns: sourdough.Project: [description]", "name": "execute", "signature": "def execute(self, project: sourdough.Project, **kwargs) -> sourdough.Project" }, { "docstring": "[summary] Args: project (sourdough.Project): [d...
2
stack_v2_sparse_classes_30k_train_049109
Implement the Python class `SimpleProcess` described below. Class description: Base class for parts of a sourdough Workflow. Args: name (str): designates the name of a class instance that is used for internal referencing throughout siMpLify. For example, if a siMpLify instance needs options from a Settings instance, '...
Implement the Python class `SimpleProcess` described below. Class description: Base class for parts of a sourdough Workflow. Args: name (str): designates the name of a class instance that is used for internal referencing throughout siMpLify. For example, if a siMpLify instance needs options from a Settings instance, '...
5302da8bf4944ac518d22cc37c181e5a09baaabe
<|skeleton|> class SimpleProcess: """Base class for parts of a sourdough Workflow. Args: name (str): designates the name of a class instance that is used for internal referencing throughout siMpLify. For example, if a siMpLify instance needs options from a Settings instance, 'name' should match the appropriate sect...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SimpleProcess: """Base class for parts of a sourdough Workflow. Args: name (str): designates the name of a class instance that is used for internal referencing throughout siMpLify. For example, if a siMpLify instance needs options from a Settings instance, 'name' should match the appropriate section name in a...
the_stack_v2_python_sparse
simplify/core/components.py
WithPrecedent/simplify
train
1
07b96c93f87a7ee435316625171e7f7271168ba5
[ "super().__init__()\nself.attention = AttentionLayer(config)\nself.conv = ConvLayer(config)\nself.classify_layer = nn.Linear(config.qa_conv_out_channel * 3, 2, bias=True)", "embedded_value = self.attention(x, token_type_ids)\nconcat_output = self.conv(embedded_value)\nlogits = self.classify_layer(concat_output)\n...
<|body_start_0|> super().__init__() self.attention = AttentionLayer(config) self.conv = ConvLayer(config) self.classify_layer = nn.Linear(config.qa_conv_out_channel * 3, 2, bias=True) <|end_body_0|> <|body_start_1|> embedded_value = self.attention(x, token_type_ids) conc...
QA conv head with attention
QAConvHeadWithAttention
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QAConvHeadWithAttention: """QA conv head with attention""" def __init__(self, config): """Args: config (ModelArguments): ModelArguments""" <|body_0|> def forward(self, x, token_type_ids): """Args: x (torch.Tensor): Head input token_type_ids (torch.Tensor): Token ...
stack_v2_sparse_classes_75kplus_train_002512
2,582
permissive
[ { "docstring": "Args: config (ModelArguments): ModelArguments", "name": "__init__", "signature": "def __init__(self, config)" }, { "docstring": "Args: x (torch.Tensor): Head input token_type_ids (torch.Tensor): Token type ids of input_ids Returns: torch.Tensor: output logits (batch_size * max_se...
2
stack_v2_sparse_classes_30k_train_048236
Implement the Python class `QAConvHeadWithAttention` described below. Class description: QA conv head with attention Method signatures and docstrings: - def __init__(self, config): Args: config (ModelArguments): ModelArguments - def forward(self, x, token_type_ids): Args: x (torch.Tensor): Head input token_type_ids (...
Implement the Python class `QAConvHeadWithAttention` described below. Class description: QA conv head with attention Method signatures and docstrings: - def __init__(self, config): Args: config (ModelArguments): ModelArguments - def forward(self, x, token_type_ids): Args: x (torch.Tensor): Head input token_type_ids (...
ea60d7a7b0f22c9e2e3b71d1d80cc2f00805e3fa
<|skeleton|> class QAConvHeadWithAttention: """QA conv head with attention""" def __init__(self, config): """Args: config (ModelArguments): ModelArguments""" <|body_0|> def forward(self, x, token_type_ids): """Args: x (torch.Tensor): Head input token_type_ids (torch.Tensor): Token ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class QAConvHeadWithAttention: """QA conv head with attention""" def __init__(self, config): """Args: config (ModelArguments): ModelArguments""" super().__init__() self.attention = AttentionLayer(config) self.conv = ConvLayer(config) self.classify_layer = nn.Linear(confi...
the_stack_v2_python_sparse
solution/reader/architectures/modeling_heads.py
boostcampaitech2/mrc-level2-nlp-14
train
7
df47a704453146077e9bead3fea13a260001fa80
[ "requested_size = Size(0, 0)\nfor child in children:\n requested_size |= child.requested_size\nreturn requested_size", "for child in cells:\n cell_size = SizeAllocation((0, 0), allocated_size.size)\n child.allocateSize(cell_size)" ]
<|body_start_0|> requested_size = Size(0, 0) for child in children: requested_size |= child.requested_size return requested_size <|end_body_0|> <|body_start_1|> for child in cells: cell_size = SizeAllocation((0, 0), allocated_size.size) child.allocate...
A WindowLayout manages only one cell and sets its position to (0, 0). The idea of a window is that the children they contain have their position relative to that window and not the screen or anything else. The WindowLayout layout is made for Bin objects: objects that have only one cell. Therefore, the position of the c...
WindowLayout
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WindowLayout: """A WindowLayout manages only one cell and sets its position to (0, 0). The idea of a window is that the children they contain have their position relative to that window and not the screen or anything else. The WindowLayout layout is made for Bin objects: objects that have only on...
stack_v2_sparse_classes_75kplus_train_002513
1,173
no_license
[ { "docstring": "Return the max.", "name": "requestSize", "signature": "def requestSize(self, children)" }, { "docstring": "Windows subtract their position from the child's position. As a result, the position of the child is always (0, 0).", "name": "allocateSize", "signature": "def alloc...
2
null
Implement the Python class `WindowLayout` described below. Class description: A WindowLayout manages only one cell and sets its position to (0, 0). The idea of a window is that the children they contain have their position relative to that window and not the screen or anything else. The WindowLayout layout is made for...
Implement the Python class `WindowLayout` described below. Class description: A WindowLayout manages only one cell and sets its position to (0, 0). The idea of a window is that the children they contain have their position relative to that window and not the screen or anything else. The WindowLayout layout is made for...
69cab98eed820c52e5e7e99dd3abe67286821e68
<|skeleton|> class WindowLayout: """A WindowLayout manages only one cell and sets its position to (0, 0). The idea of a window is that the children they contain have their position relative to that window and not the screen or anything else. The WindowLayout layout is made for Bin objects: objects that have only on...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class WindowLayout: """A WindowLayout manages only one cell and sets its position to (0, 0). The idea of a window is that the children they contain have their position relative to that window and not the screen or anything else. The WindowLayout layout is made for Bin objects: objects that have only one cell. There...
the_stack_v2_python_sparse
src/pynguin/layout/windowlayout.py
Niriel/pynguin
train
1
369a3bda6190d22bc2b60b448833673d54ca405d
[ "self.key = key\nself._set_key_parms(['type'])\nself._set_prhb_parms(['type'])", "if 'conf' not in self.__dict__:\n self.conf = self.get_view_obj(self.key)\nreturn self.conf.get('type')" ]
<|body_start_0|> self.key = key self._set_key_parms(['type']) self._set_prhb_parms(['type']) <|end_body_0|> <|body_start_1|> if 'conf' not in self.__dict__: self.conf = self.get_view_obj(self.key) return self.conf.get('type') <|end_body_1|>
WorkFlowEvalConfig
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WorkFlowEvalConfig: def __init__(self, key=None): """init key variable :param key: :return:""" <|body_0|> def get_eval_type(self): """get eval type ( regression, classification.. ) :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.key = ...
stack_v2_sparse_classes_75kplus_train_002514
632
permissive
[ { "docstring": "init key variable :param key: :return:", "name": "__init__", "signature": "def __init__(self, key=None)" }, { "docstring": "get eval type ( regression, classification.. ) :return:", "name": "get_eval_type", "signature": "def get_eval_type(self)" } ]
2
stack_v2_sparse_classes_30k_train_054393
Implement the Python class `WorkFlowEvalConfig` described below. Class description: Implement the WorkFlowEvalConfig class. Method signatures and docstrings: - def __init__(self, key=None): init key variable :param key: :return: - def get_eval_type(self): get eval type ( regression, classification.. ) :return:
Implement the Python class `WorkFlowEvalConfig` described below. Class description: Implement the WorkFlowEvalConfig class. Method signatures and docstrings: - def __init__(self, key=None): init key variable :param key: :return: - def get_eval_type(self): get eval type ( regression, classification.. ) :return: <|ske...
6ad2fbc7384e4dbe7e3e63bdb44c8ce0387f4b7f
<|skeleton|> class WorkFlowEvalConfig: def __init__(self, key=None): """init key variable :param key: :return:""" <|body_0|> def get_eval_type(self): """get eval type ( regression, classification.. ) :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class WorkFlowEvalConfig: def __init__(self, key=None): """init key variable :param key: :return:""" self.key = key self._set_key_parms(['type']) self._set_prhb_parms(['type']) def get_eval_type(self): """get eval type ( regression, classification.. ) :return:""" ...
the_stack_v2_python_sparse
master/workflow/evalconf/workflow_evalconf.py
yurimkoo/tensormsa
train
1
86a23761fe225c0ed5b4ff994425ba711939678e
[ "self.name = 'ext_grad'\nself.scaler = scaler\nself.batch_size = batch_size", "grads = mainloop.grads\n'\\n for p, g in grads.items():\\n grads[p] = g / self.batch_size\\n g_norm = 0.\\n for g in grads.values():\\n g_norm += (g**2).sum()\\n '\ng_norm = 0.0\nfor p,...
<|body_start_0|> self.name = 'ext_grad' self.scaler = scaler self.batch_size = batch_size <|end_body_0|> <|body_start_1|> grads = mainloop.grads '\n for p, g in grads.items():\n grads[p] = g / self.batch_size\n g_norm = 0.\n for g in grads.values(...
GradientClipping
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GradientClipping: def __init__(self, scaler=5, batch_size=1): """.. todo:: WRITEME""" <|body_0|> def exe(self, mainloop): """.. todo:: WRITEME""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.name = 'ext_grad' self.scaler = scaler ...
stack_v2_sparse_classes_75kplus_train_002515
8,905
no_license
[ { "docstring": ".. todo:: WRITEME", "name": "__init__", "signature": "def __init__(self, scaler=5, batch_size=1)" }, { "docstring": ".. todo:: WRITEME", "name": "exe", "signature": "def exe(self, mainloop)" } ]
2
stack_v2_sparse_classes_30k_train_028345
Implement the Python class `GradientClipping` described below. Class description: Implement the GradientClipping class. Method signatures and docstrings: - def __init__(self, scaler=5, batch_size=1): .. todo:: WRITEME - def exe(self, mainloop): .. todo:: WRITEME
Implement the Python class `GradientClipping` described below. Class description: Implement the GradientClipping class. Method signatures and docstrings: - def __init__(self, scaler=5, batch_size=1): .. todo:: WRITEME - def exe(self, mainloop): .. todo:: WRITEME <|skeleton|> class GradientClipping: def __init__...
94fe4208f6450d603d37e5a376dc85d988c9f639
<|skeleton|> class GradientClipping: def __init__(self, scaler=5, batch_size=1): """.. todo:: WRITEME""" <|body_0|> def exe(self, mainloop): """.. todo:: WRITEME""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GradientClipping: def __init__(self, scaler=5, batch_size=1): """.. todo:: WRITEME""" self.name = 'ext_grad' self.scaler = scaler self.batch_size = batch_size def exe(self, mainloop): """.. todo:: WRITEME""" grads = mainloop.grads '\n for p, ...
the_stack_v2_python_sparse
cle/train/ext.py
kyunghyuncho/cle
train
1
4e4983b22a77a1b1b2e49d0b769a275e4683f201
[ "if len(lipids) != len(ref_rt) or len(lipids) != len(meas_rt):\n m = 'RTCalibration: __init__: lipids, ref_rt, and meas_rt must all be the same length ({}, {}, {})'\n raise ValueError(m.format(len(lipids), len(ref_rt), len(meas_rt)))\nself.meas_rt, self.ref_rt, self.lipids = (list(t) for t in zip(*sorted(zip(...
<|body_start_0|> if len(lipids) != len(ref_rt) or len(lipids) != len(meas_rt): m = 'RTCalibration: __init__: lipids, ref_rt, and meas_rt must all be the same length ({}, {}, {})' raise ValueError(m.format(len(lipids), len(ref_rt), len(meas_rt))) self.meas_rt, self.ref_rt, self.li...
RTCalibration description: An object for performing HILIC retention time calibration
RTCalibration
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RTCalibration: """RTCalibration description: An object for performing HILIC retention time calibration""" def __init__(self, lipids, meas_rt, ref_rt): """RTCalibration.__init__ description: Stores lists of lipid calibrants and their reference/measured retention times, lists are sorte...
stack_v2_sparse_classes_75kplus_train_002516
5,954
permissive
[ { "docstring": "RTCalibration.__init__ description: Stores lists of lipid calibrants and their reference/measured retention times, lists are sorted together by measured retention time parameters: lipids (list(str)) -- lipid calibrants meas_rt (list(float)) -- measured retention times ref_rt (list(float)) -- ref...
4
stack_v2_sparse_classes_30k_val_002295
Implement the Python class `RTCalibration` described below. Class description: RTCalibration description: An object for performing HILIC retention time calibration Method signatures and docstrings: - def __init__(self, lipids, meas_rt, ref_rt): RTCalibration.__init__ description: Stores lists of lipid calibrants and ...
Implement the Python class `RTCalibration` described below. Class description: RTCalibration description: An object for performing HILIC retention time calibration Method signatures and docstrings: - def __init__(self, lipids, meas_rt, ref_rt): RTCalibration.__init__ description: Stores lists of lipid calibrants and ...
c7c3b72d4549a1a9937f287f3b314eff8e7ed054
<|skeleton|> class RTCalibration: """RTCalibration description: An object for performing HILIC retention time calibration""" def __init__(self, lipids, meas_rt, ref_rt): """RTCalibration.__init__ description: Stores lists of lipid calibrants and their reference/measured retention times, lists are sorte...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RTCalibration: """RTCalibration description: An object for performing HILIC retention time calibration""" def __init__(self, lipids, meas_rt, ref_rt): """RTCalibration.__init__ description: Stores lists of lipid calibrants and their reference/measured retention times, lists are sorted together by...
the_stack_v2_python_sparse
lipydomics/identification/rt_calibration.py
kaitlin-rempfert/lipydomics
train
0
f04b963678034be216f3d1ca4e27e56e795926cb
[ "for track_data_sample in data_samples:\n video_data_samples = track_data_sample['video_data_samples']\n ori_video_len = video_data_samples[0].ori_video_length\n if ori_video_len == len(video_data_samples):\n self.process_video(video_data_samples)\n else:\n self.process_image(video_data_sa...
<|body_start_0|> for track_data_sample in data_samples: video_data_samples = track_data_sample['video_data_samples'] ori_video_len = video_data_samples[0].ori_video_length if ori_video_len == len(video_data_samples): self.process_video(video_data_samples) ...
Base class for a metric in video task. The metric first processes each batch of data_samples and predictions, and appends the processed results to the results list. Then it collects all results together from all ranks if distributed training is used. Finally, it computes the metrics of the entire dataset. A subclass of...
BaseVideoMetric
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseVideoMetric: """Base class for a metric in video task. The metric first processes each batch of data_samples and predictions, and appends the processed results to the results list. Then it collects all results together from all ranks if distributed training is used. Finally, it computes the m...
stack_v2_sparse_classes_75kplus_train_002517
6,513
permissive
[ { "docstring": "Process one batch of data samples and predictions. The processed results should be stored in ``self.results``, which will be used to compute the metrics when all batches have been processed. Args: data_batch (dict): A batch of data from the dataloader. data_samples (Sequence[dict]): A batch of d...
2
stack_v2_sparse_classes_30k_train_012686
Implement the Python class `BaseVideoMetric` described below. Class description: Base class for a metric in video task. The metric first processes each batch of data_samples and predictions, and appends the processed results to the results list. Then it collects all results together from all ranks if distributed train...
Implement the Python class `BaseVideoMetric` described below. Class description: Base class for a metric in video task. The metric first processes each batch of data_samples and predictions, and appends the processed results to the results list. Then it collects all results together from all ranks if distributed train...
f78af7785ada87f1ced75a2313746e4ba3149760
<|skeleton|> class BaseVideoMetric: """Base class for a metric in video task. The metric first processes each batch of data_samples and predictions, and appends the processed results to the results list. Then it collects all results together from all ranks if distributed training is used. Finally, it computes the m...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BaseVideoMetric: """Base class for a metric in video task. The metric first processes each batch of data_samples and predictions, and appends the processed results to the results list. Then it collects all results together from all ranks if distributed training is used. Finally, it computes the metrics of the...
the_stack_v2_python_sparse
mmdet/evaluation/metrics/base_video_metric.py
wencheng256/mmdetection
train
0
631de2942d6f0b78ea75799a7cdf87ae27958f39
[ "super().__init__()\nif not isinstance(volumes, Volumes):\n raise ValueError(\"'volumes' have to be an instance of the 'Volumes' class.\")\nself._volumes = volumes\nself._sample_mode = sample_mode", "world2local = self._volumes.get_world_to_local_coords_transform().get_matrix()\ndirections_transform_matrix = e...
<|body_start_0|> super().__init__() if not isinstance(volumes, Volumes): raise ValueError("'volumes' have to be an instance of the 'Volumes' class.") self._volumes = volumes self._sample_mode = sample_mode <|end_body_0|> <|body_start_1|> world2local = self._volumes.g...
A module to sample a batch of volumes `Volumes` at 3D points sampled along projection rays.
VolumeSampler
[ "MIT", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VolumeSampler: """A module to sample a batch of volumes `Volumes` at 3D points sampled along projection rays.""" def __init__(self, volumes: Volumes, sample_mode: str='bilinear') -> None: """Args: volumes: An instance of the `Volumes` class representing a batch of volumes that are be...
stack_v2_sparse_classes_75kplus_train_002518
17,111
permissive
[ { "docstring": "Args: volumes: An instance of the `Volumes` class representing a batch of volumes that are being rendered. sample_mode: Defines the algorithm used to sample the volumetric voxel grid. Can be either \"bilinear\" or \"nearest\".", "name": "__init__", "signature": "def __init__(self, volume...
3
stack_v2_sparse_classes_30k_train_015072
Implement the Python class `VolumeSampler` described below. Class description: A module to sample a batch of volumes `Volumes` at 3D points sampled along projection rays. Method signatures and docstrings: - def __init__(self, volumes: Volumes, sample_mode: str='bilinear') -> None: Args: volumes: An instance of the `V...
Implement the Python class `VolumeSampler` described below. Class description: A module to sample a batch of volumes `Volumes` at 3D points sampled along projection rays. Method signatures and docstrings: - def __init__(self, volumes: Volumes, sample_mode: str='bilinear') -> None: Args: volumes: An instance of the `V...
a3d99cab6bf5eb69be8d5eb48895da6edd859565
<|skeleton|> class VolumeSampler: """A module to sample a batch of volumes `Volumes` at 3D points sampled along projection rays.""" def __init__(self, volumes: Volumes, sample_mode: str='bilinear') -> None: """Args: volumes: An instance of the `Volumes` class representing a batch of volumes that are be...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class VolumeSampler: """A module to sample a batch of volumes `Volumes` at 3D points sampled along projection rays.""" def __init__(self, volumes: Volumes, sample_mode: str='bilinear') -> None: """Args: volumes: An instance of the `Volumes` class representing a batch of volumes that are being rendered....
the_stack_v2_python_sparse
pytorch3d/renderer/implicit/renderer.py
facebookresearch/pytorch3d
train
7,964
2e063e64cb40c8bb17694cfa47e4dd61338e6d70
[ "self.value_list = value_list\nself.function = function\nself.name = name if isinstance(name, str) else str(name)", "if self.function.value == 1:\n return self.get_truth_or(restaurant)\nelif self.function.value == 0:\n return self.get_truth_and(restaurant)\nelif self.function.value == -1:\n if self.value...
<|body_start_0|> self.value_list = value_list self.function = function self.name = name if isinstance(name, str) else str(name) <|end_body_0|> <|body_start_1|> if self.function.value == 1: return self.get_truth_or(restaurant) elif self.function.value == 0: ...
Feature
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Feature: def __init__(self, name, value_list: list, function: Function): """Initialises a new Feature that can be used as antecedent for an Implication. A Feature has multiple FeatureValues or Features that are united with a Function (logical operator) An example of a Feature is: A && B,...
stack_v2_sparse_classes_75kplus_train_002519
16,699
no_license
[ { "docstring": "Initialises a new Feature that can be used as antecedent for an Implication. A Feature has multiple FeatureValues or Features that are united with a Function (logical operator) An example of a Feature is: A && B, where A/B can be a Feature or a FeatureValue Parameters ---------- name : str the n...
4
null
Implement the Python class `Feature` described below. Class description: Implement the Feature class. Method signatures and docstrings: - def __init__(self, name, value_list: list, function: Function): Initialises a new Feature that can be used as antecedent for an Implication. A Feature has multiple FeatureValues or...
Implement the Python class `Feature` described below. Class description: Implement the Feature class. Method signatures and docstrings: - def __init__(self, name, value_list: list, function: Function): Initialises a new Feature that can be used as antecedent for an Implication. A Feature has multiple FeatureValues or...
152027e4be258f77cb082a5c5a3cc72013c93ca4
<|skeleton|> class Feature: def __init__(self, name, value_list: list, function: Function): """Initialises a new Feature that can be used as antecedent for an Implication. A Feature has multiple FeatureValues or Features that are united with a Function (logical operator) An example of a Feature is: A && B,...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Feature: def __init__(self, name, value_list: list, function: Function): """Initialises a new Feature that can be used as antecedent for an Implication. A Feature has multiple FeatureValues or Features that are united with a Function (logical operator) An example of a Feature is: A && B, where A/B can...
the_stack_v2_python_sparse
implication_classes.py
GuidoBekkers/textClassifier
train
1
ace172f63a77ad562b78c539a092ae3791b8ae7d
[ "if name == 'BaseModel':\n return super(PropertiedClassWithDjango, cls).__new__(cls, name, bases, attrs)\nnew_class = super(PropertiedClassWithDjango, cls).__new__(cls, name, bases, attrs)\nnew_class._meta = ModelOptions(new_class)\nnew_class.objects = ModelManager(new_class)\nnew_class._default_manager = new_cl...
<|body_start_0|> if name == 'BaseModel': return super(PropertiedClassWithDjango, cls).__new__(cls, name, bases, attrs) new_class = super(PropertiedClassWithDjango, cls).__new__(cls, name, bases, attrs) new_class._meta = ModelOptions(new_class) new_class.objects = ModelManager...
Metaclass for the combined Django + App Engine model class. This metaclass inherits from db.PropertiedClass in the appengine library. This metaclass has two additional purposes: 1) Register each model class created with Django (the parent class will take care of registering it with the appengine libraries). 2) Add the ...
PropertiedClassWithDjango
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PropertiedClassWithDjango: """Metaclass for the combined Django + App Engine model class. This metaclass inherits from db.PropertiedClass in the appengine library. This metaclass has two additional purposes: 1) Register each model class created with Django (the parent class will take care of regi...
stack_v2_sparse_classes_75kplus_train_002520
6,077
permissive
[ { "docstring": "Creates a combined appengine and Django model. The resulting model will be known to both the appengine libraries and Django.", "name": "__new__", "signature": "def __new__(cls, name, bases, attrs)" }, { "docstring": "Initialises the list of Django properties. This method takes ca...
2
stack_v2_sparse_classes_30k_train_028370
Implement the Python class `PropertiedClassWithDjango` described below. Class description: Metaclass for the combined Django + App Engine model class. This metaclass inherits from db.PropertiedClass in the appengine library. This metaclass has two additional purposes: 1) Register each model class created with Django (...
Implement the Python class `PropertiedClassWithDjango` described below. Class description: Metaclass for the combined Django + App Engine model class. This metaclass inherits from db.PropertiedClass in the appengine library. This metaclass has two additional purposes: 1) Register each model class created with Django (...
f7582ac0944932455e99cf54643c553e7641225c
<|skeleton|> class PropertiedClassWithDjango: """Metaclass for the combined Django + App Engine model class. This metaclass inherits from db.PropertiedClass in the appengine library. This metaclass has two additional purposes: 1) Register each model class created with Django (the parent class will take care of regi...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PropertiedClassWithDjango: """Metaclass for the combined Django + App Engine model class. This metaclass inherits from db.PropertiedClass in the appengine library. This metaclass has two additional purposes: 1) Register each model class created with Django (the parent class will take care of registering it wi...
the_stack_v2_python_sparse
appengine_django/models.py
babybunny/rebuildingtogethercaptain
train
5
4a0978c96700ce9bed0eab343272b9747366f6a1
[ "cleaned_data = self.cleaned_data\nitem = cleaned_data.get('item')\nlocation = cleaned_data.get('location')\ntype = cleaned_data.get('type')\nif not item:\n raise forms.ValidationError(self.error_messages['item_error'], code='item_error')\nif not location:\n raise forms.ValidationError(self.error_messages['lo...
<|body_start_0|> cleaned_data = self.cleaned_data item = cleaned_data.get('item') location = cleaned_data.get('location') type = cleaned_data.get('type') if not item: raise forms.ValidationError(self.error_messages['item_error'], code='item_error') if not loca...
Form for items' movements
ItemMoveForm
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ItemMoveForm: """Form for items' movements""" def clean_quantity(self): """Method to clean quantity""" <|body_0|> def __init__(self, *args, **kwargs): """Method for initial values and functions""" <|body_1|> <|end_skeleton|> <|body_start_0|> cle...
stack_v2_sparse_classes_75kplus_train_002521
8,200
permissive
[ { "docstring": "Method to clean quantity", "name": "clean_quantity", "signature": "def clean_quantity(self)" }, { "docstring": "Method for initial values and functions", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_026974
Implement the Python class `ItemMoveForm` described below. Class description: Form for items' movements Method signatures and docstrings: - def clean_quantity(self): Method to clean quantity - def __init__(self, *args, **kwargs): Method for initial values and functions
Implement the Python class `ItemMoveForm` described below. Class description: Form for items' movements Method signatures and docstrings: - def clean_quantity(self): Method to clean quantity - def __init__(self, *args, **kwargs): Method for initial values and functions <|skeleton|> class ItemMoveForm: """Form fo...
f3f8354bf164fcfe86d597cdbc28b0e3b7b73bd1
<|skeleton|> class ItemMoveForm: """Form for items' movements""" def clean_quantity(self): """Method to clean quantity""" <|body_0|> def __init__(self, *args, **kwargs): """Method for initial values and functions""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ItemMoveForm: """Form for items' movements""" def clean_quantity(self): """Method to clean quantity""" cleaned_data = self.cleaned_data item = cleaned_data.get('item') location = cleaned_data.get('location') type = cleaned_data.get('type') if not item: ...
the_stack_v2_python_sparse
seshat/stock/forms.py
XecusM/SESHAT
train
0
9427d6600bbc0fed4ba2078f66cff819d9ba124a
[ "self.npart = npart\nself.ndim = ndim\nself.bounds = bounds", "if self.bounds == None:\n self.swarm = np.random.random((self.npart, self.ndim))\nelse:\n self.swarm = np.zeros((self.npart, self.ndim))\n lo = self.bounds.Lower()\n hi = self.bounds.Upper()\n for i in range(self.npart):\n for j ...
<|body_start_0|> self.npart = npart self.ndim = ndim self.bounds = bounds <|end_body_0|> <|body_start_1|> if self.bounds == None: self.swarm = np.random.random((self.npart, self.ndim)) else: self.swarm = np.zeros((self.npart, self.ndim)) lo = ...
Initialize a swarm uniformly
RandomInitializer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RandomInitializer: """Initialize a swarm uniformly""" def __init__(self, npart=10, ndim=3, bounds=None): """Constructor""" <|body_0|> def InitializeSwarm(self): """Return a randomly initialized swarm""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_002522
1,422
permissive
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, npart=10, ndim=3, bounds=None)" }, { "docstring": "Return a randomly initialized swarm", "name": "InitializeSwarm", "signature": "def InitializeSwarm(self)" } ]
2
stack_v2_sparse_classes_30k_train_013492
Implement the Python class `RandomInitializer` described below. Class description: Initialize a swarm uniformly Method signatures and docstrings: - def __init__(self, npart=10, ndim=3, bounds=None): Constructor - def InitializeSwarm(self): Return a randomly initialized swarm
Implement the Python class `RandomInitializer` described below. Class description: Initialize a swarm uniformly Method signatures and docstrings: - def __init__(self, npart=10, ndim=3, bounds=None): Constructor - def InitializeSwarm(self): Return a randomly initialized swarm <|skeleton|> class RandomInitializer: ...
5445b6f90ab49339ca0fdb71e98d44e6827c95a8
<|skeleton|> class RandomInitializer: """Initialize a swarm uniformly""" def __init__(self, npart=10, ndim=3, bounds=None): """Constructor""" <|body_0|> def InitializeSwarm(self): """Return a randomly initialized swarm""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RandomInitializer: """Initialize a swarm uniformly""" def __init__(self, npart=10, ndim=3, bounds=None): """Constructor""" self.npart = npart self.ndim = ndim self.bounds = bounds def InitializeSwarm(self): """Return a randomly initialized swarm""" if ...
the_stack_v2_python_sparse
RandomInitializer.py
dayoladejo/SwarmOptimization
train
0
9cdb059585a0c8cc794f4e7c24d6d7a451e7e21b
[ "population_size = param_value(graph, parameters, Parameter.POPULATION_SIZE)\nno_of_processes = param_value(graph, parameters, Parameter.NO_OF_PROCESSES)\nindividuals = generate_individuals(graph, parameters)\npopulations = []\nchunks = ChainChunkFactory._list_chunks(individuals, population_size, no_of_processes)\n...
<|body_start_0|> population_size = param_value(graph, parameters, Parameter.POPULATION_SIZE) no_of_processes = param_value(graph, parameters, Parameter.NO_OF_PROCESSES) individuals = generate_individuals(graph, parameters) populations = [] chunks = ChainChunkFactory._list_chunks(...
ChainChunkFactory
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ChainChunkFactory: def create(graph: Graph, parameters: Dict[str, Any]=None) -> Optional[List[Population]]: """Returns a list of no_of_processes populations that have approximately population_size / no_of_processes individuals.""" <|body_0|> def _list_chunks(individuals: Lis...
stack_v2_sparse_classes_75kplus_train_002523
5,463
permissive
[ { "docstring": "Returns a list of no_of_processes populations that have approximately population_size / no_of_processes individuals.", "name": "create", "signature": "def create(graph: Graph, parameters: Dict[str, Any]=None) -> Optional[List[Population]]" }, { "docstring": "Splits a list into eq...
2
stack_v2_sparse_classes_30k_train_048663
Implement the Python class `ChainChunkFactory` described below. Class description: Implement the ChainChunkFactory class. Method signatures and docstrings: - def create(graph: Graph, parameters: Dict[str, Any]=None) -> Optional[List[Population]]: Returns a list of no_of_processes populations that have approximately p...
Implement the Python class `ChainChunkFactory` described below. Class description: Implement the ChainChunkFactory class. Method signatures and docstrings: - def create(graph: Graph, parameters: Dict[str, Any]=None) -> Optional[List[Population]]: Returns a list of no_of_processes populations that have approximately p...
69f0242aceb47fc383d0e56077f08b2b061273b5
<|skeleton|> class ChainChunkFactory: def create(graph: Graph, parameters: Dict[str, Any]=None) -> Optional[List[Population]]: """Returns a list of no_of_processes populations that have approximately population_size / no_of_processes individuals.""" <|body_0|> def _list_chunks(individuals: Lis...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ChainChunkFactory: def create(graph: Graph, parameters: Dict[str, Any]=None) -> Optional[List[Population]]: """Returns a list of no_of_processes populations that have approximately population_size / no_of_processes individuals.""" population_size = param_value(graph, parameters, Parameter.POPU...
the_stack_v2_python_sparse
python/mage/graph_coloring_module/components/chain_chunk.py
gitbuda/mage
train
0
33be6e97c6a62b3b1f24ae91a504f2b1da9170e1
[ "self.K = k\nself.X = self.file_to_vec(filename)\nself.SIZE, self.dimension = self.X.shape\nself.weights = [1.0 / k] * (k - 1)\nself.weights.append(1.0 - sum(self.weights))\nself.mu = self.X[[random.randint(1, self.SIZE) for x in range(self.K)]]\nself.sigma = [np.identity(self.dimension) for i in range(k)]\nself.p_...
<|body_start_0|> self.K = k self.X = self.file_to_vec(filename) self.SIZE, self.dimension = self.X.shape self.weights = [1.0 / k] * (k - 1) self.weights.append(1.0 - sum(self.weights)) self.mu = self.X[[random.randint(1, self.SIZE) for x in range(self.K)]] self.si...
GMM
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GMM: def __init__(self, k=2, filename='2gaussian.txt'): """:param k: int number of gaussian mixture :param filename: FILENAMES for the data file""" <|body_0|> def file_to_vec(filename): """:type filename: string take FILENAMES and converts to numpy vectors""" ...
stack_v2_sparse_classes_75kplus_train_002524
4,712
no_license
[ { "docstring": ":param k: int number of gaussian mixture :param filename: FILENAMES for the data file", "name": "__init__", "signature": "def __init__(self, k=2, filename='2gaussian.txt')" }, { "docstring": ":type filename: string take FILENAMES and converts to numpy vectors", "name": "file_...
5
stack_v2_sparse_classes_30k_train_033762
Implement the Python class `GMM` described below. Class description: Implement the GMM class. Method signatures and docstrings: - def __init__(self, k=2, filename='2gaussian.txt'): :param k: int number of gaussian mixture :param filename: FILENAMES for the data file - def file_to_vec(filename): :type filename: string...
Implement the Python class `GMM` described below. Class description: Implement the GMM class. Method signatures and docstrings: - def __init__(self, k=2, filename='2gaussian.txt'): :param k: int number of gaussian mixture :param filename: FILENAMES for the data file - def file_to_vec(filename): :type filename: string...
ab455e0f236e63e19f5d222f48bbfc9c83338b6b
<|skeleton|> class GMM: def __init__(self, k=2, filename='2gaussian.txt'): """:param k: int number of gaussian mixture :param filename: FILENAMES for the data file""" <|body_0|> def file_to_vec(filename): """:type filename: string take FILENAMES and converts to numpy vectors""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GMM: def __init__(self, k=2, filename='2gaussian.txt'): """:param k: int number of gaussian mixture :param filename: FILENAMES for the data file""" self.K = k self.X = self.file_to_vec(filename) self.SIZE, self.dimension = self.X.shape self.weights = [1.0 / k] * (k - 1)...
the_stack_v2_python_sparse
HW2/gmm.py
malliksunkara/Unsupervised-ML
train
0
cb45201393807138cd6afb8704970b72f6b2267a
[ "self.source: str = source\nself.content: str = content\nself.is_error: bool = is_error", "pad = len(self.source) if len(self.source) > source_len else source_len\ncolor_code = '\\x1b[31;1m' if self.is_error and colorize else ''\nreset_code = '\\x1b[0m' if self.is_error and colorize else ''\nreturn f'[ {self.sour...
<|body_start_0|> self.source: str = source self.content: str = content self.is_error: bool = is_error <|end_body_0|> <|body_start_1|> pad = len(self.source) if len(self.source) > source_len else source_len color_code = '\x1b[31;1m' if self.is_error and colorize else '' r...
Helper class for managing messages.
Message
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Message: """Helper class for managing messages.""" def __init__(self, source: str, content: str, is_error: bool=False) -> None: """Initialize a Message object. Args: source: The source of the message, eg 'dftimewolf' or a runtime name. content: The content of the message. is_error: T...
stack_v2_sparse_classes_75kplus_train_002525
17,020
permissive
[ { "docstring": "Initialize a Message object. Args: source: The source of the message, eg 'dftimewolf' or a runtime name. content: The content of the message. is_error: True if the message is an error message, False otherwise.", "name": "__init__", "signature": "def __init__(self, source: str, content: s...
2
stack_v2_sparse_classes_30k_train_038310
Implement the Python class `Message` described below. Class description: Helper class for managing messages. Method signatures and docstrings: - def __init__(self, source: str, content: str, is_error: bool=False) -> None: Initialize a Message object. Args: source: The source of the message, eg 'dftimewolf' or a runti...
Implement the Python class `Message` described below. Class description: Helper class for managing messages. Method signatures and docstrings: - def __init__(self, source: str, content: str, is_error: bool=False) -> None: Initialize a Message object. Args: source: The source of the message, eg 'dftimewolf' or a runti...
bcea85b1ce7a0feb2aa28b5be4fc6ae124e8ca3c
<|skeleton|> class Message: """Helper class for managing messages.""" def __init__(self, source: str, content: str, is_error: bool=False) -> None: """Initialize a Message object. Args: source: The source of the message, eg 'dftimewolf' or a runtime name. content: The content of the message. is_error: T...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Message: """Helper class for managing messages.""" def __init__(self, source: str, content: str, is_error: bool=False) -> None: """Initialize a Message object. Args: source: The source of the message, eg 'dftimewolf' or a runtime name. content: The content of the message. is_error: True if the me...
the_stack_v2_python_sparse
dftimewolf/cli/curses_display_manager.py
log2timeline/dftimewolf
train
248
c5b9268498dbe86bc0cad1bb43c5aa751520dd76
[ "\"\"\"\n 解法2:动态规划。\n a[j] += [a[j-i] + [i]]\n \"\"\"\nA = [[[]]] + [[] for i in range(target)]\nfor c in candidates:\n for n in range(c, target + 1):\n A[n] += [comb + [c] for comb in A[n - c]]\nreturn A[target]\n'\\n 组合总和 II\\n 给定一个数组\\xa0candidates\\xa0和一个目标数\\xa0target\\xa0,...
<|body_start_0|> """ 解法2:动态规划。 a[j] += [a[j-i] + [i]] """ A = [[[]]] + [[] for i in range(target)] for c in candidates: for n in range(c, target + 1): A[n] += [comb + [c] for comb in A[n - c]] return A[target] ...
组合总和 I 给定一个无重复元素的数组 candidates 和一个目标数 target ,找出 candidates 中所有可以使数字和为 target 的组合。 candidates 中的数字可以无限制重复被选取。 说明: 所有数字(包括 target)都是正整数。 解集不能包含重复的组合。 示例 1: 输入: candidates = [2,3,6,7], target = 7, 所求解集为: [ [7], [2,2,3] ] 示例 2: 输入: candidates = [2,3,5], target = 8, 所求解集为: [ [2,2,2,2], [2,3,3], [3,5] ] 链接:https://leetcode-...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """组合总和 I 给定一个无重复元素的数组 candidates 和一个目标数 target ,找出 candidates 中所有可以使数字和为 target 的组合。 candidates 中的数字可以无限制重复被选取。 说明: 所有数字(包括 target)都是正整数。 解集不能包含重复的组合。 示例 1: 输入: candidates = [2,3,6,7], target = 7, 所求解集为: [ [7], [2,2,3] ] 示例 2: 输入: candidates = [2,3,5], target = 8, 所求解集为: [ [2,2,2,2], [...
stack_v2_sparse_classes_75kplus_train_002526
7,247
no_license
[ { "docstring": "解法1:回溯+剪枝", "name": "combinationSum", "signature": "def combinationSum(self, candidates: list, target: int) -> list" }, { "docstring": "解法1:回溯,同1的解法1", "name": "combinationSum2", "signature": "def combinationSum2(self, candidates: list, target: int) -> list" }, { ...
4
stack_v2_sparse_classes_30k_train_039661
Implement the Python class `Solution` described below. Class description: 组合总和 I 给定一个无重复元素的数组 candidates 和一个目标数 target ,找出 candidates 中所有可以使数字和为 target 的组合。 candidates 中的数字可以无限制重复被选取。 说明: 所有数字(包括 target)都是正整数。 解集不能包含重复的组合。 示例 1: 输入: candidates = [2,3,6,7], target = 7, 所求解集为: [ [7], [2,2,3] ] 示例 2: 输入: candidates = [2,...
Implement the Python class `Solution` described below. Class description: 组合总和 I 给定一个无重复元素的数组 candidates 和一个目标数 target ,找出 candidates 中所有可以使数字和为 target 的组合。 candidates 中的数字可以无限制重复被选取。 说明: 所有数字(包括 target)都是正整数。 解集不能包含重复的组合。 示例 1: 输入: candidates = [2,3,6,7], target = 7, 所求解集为: [ [7], [2,2,3] ] 示例 2: 输入: candidates = [2,...
ad25281be49dfb9de211ba324b398e946e49025d
<|skeleton|> class Solution: """组合总和 I 给定一个无重复元素的数组 candidates 和一个目标数 target ,找出 candidates 中所有可以使数字和为 target 的组合。 candidates 中的数字可以无限制重复被选取。 说明: 所有数字(包括 target)都是正整数。 解集不能包含重复的组合。 示例 1: 输入: candidates = [2,3,6,7], target = 7, 所求解集为: [ [7], [2,2,3] ] 示例 2: 输入: candidates = [2,3,5], target = 8, 所求解集为: [ [2,2,2,2], [...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: """组合总和 I 给定一个无重复元素的数组 candidates 和一个目标数 target ,找出 candidates 中所有可以使数字和为 target 的组合。 candidates 中的数字可以无限制重复被选取。 说明: 所有数字(包括 target)都是正整数。 解集不能包含重复的组合。 示例 1: 输入: candidates = [2,3,6,7], target = 7, 所求解集为: [ [7], [2,2,3] ] 示例 2: 输入: candidates = [2,3,5], target = 8, 所求解集为: [ [2,2,2,2], [2,3,3], [3,5]...
the_stack_v2_python_sparse
人生苦短/组合总和(1-4).py
Jsonlmy/leetcode
train
0
604c426677bef406b1e6851c6fc60321b3f8583b
[ "self.payment_facilitator_code = payment_facilitator_code\nself.code = code\nself.name = name\nself.merchant_category_code = merchant_category_code\nself.document = document\nself.mtype = mtype\nself.phone = phone\nself.address = address", "if dictionary is None:\n return None\npayment_facilitator_code = dicti...
<|body_start_0|> self.payment_facilitator_code = payment_facilitator_code self.code = code self.name = name self.merchant_category_code = merchant_category_code self.document = document self.mtype = mtype self.phone = phone self.address = address <|end_bod...
Implementation of the 'CreateSubMerchantRequest' model. SubMerchant Attributes: payment_facilitator_code (string): Payment Facilitator Code code (string): Code name (string): Name merchant_category_code (string): Merchant Category Code document (string): Document number. Only numbers, no special characters. mtype (stri...
CreateSubMerchantRequest
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CreateSubMerchantRequest: """Implementation of the 'CreateSubMerchantRequest' model. SubMerchant Attributes: payment_facilitator_code (string): Payment Facilitator Code code (string): Code name (string): Name merchant_category_code (string): Merchant Category Code document (string): Document numb...
stack_v2_sparse_classes_75kplus_train_002527
3,482
permissive
[ { "docstring": "Constructor for the CreateSubMerchantRequest class", "name": "__init__", "signature": "def __init__(self, payment_facilitator_code=None, code=None, name=None, merchant_category_code=None, document=None, mtype=None, phone=None, address=None)" }, { "docstring": "Creates an instance...
2
null
Implement the Python class `CreateSubMerchantRequest` described below. Class description: Implementation of the 'CreateSubMerchantRequest' model. SubMerchant Attributes: payment_facilitator_code (string): Payment Facilitator Code code (string): Code name (string): Name merchant_category_code (string): Merchant Categor...
Implement the Python class `CreateSubMerchantRequest` described below. Class description: Implementation of the 'CreateSubMerchantRequest' model. SubMerchant Attributes: payment_facilitator_code (string): Payment Facilitator Code code (string): Code name (string): Name merchant_category_code (string): Merchant Categor...
95c80c35dd57bb2a238faeaf30d1e3b4544d2298
<|skeleton|> class CreateSubMerchantRequest: """Implementation of the 'CreateSubMerchantRequest' model. SubMerchant Attributes: payment_facilitator_code (string): Payment Facilitator Code code (string): Code name (string): Name merchant_category_code (string): Merchant Category Code document (string): Document numb...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CreateSubMerchantRequest: """Implementation of the 'CreateSubMerchantRequest' model. SubMerchant Attributes: payment_facilitator_code (string): Payment Facilitator Code code (string): Code name (string): Name merchant_category_code (string): Merchant Category Code document (string): Document number. Only numb...
the_stack_v2_python_sparse
mundiapi/models/create_sub_merchant_request.py
mundipagg/MundiAPI-PYTHON
train
10
68fbd986055ee502f867c05d45835f5956ef2b8f
[ "self.registeredPlates = open('registeredPlates.txt').read().splitlines()\nif string in self.registeredPlates:\n return True\nelse:\n return False", "self.restrictedWords = open('restrictedWords.txt').read().splitlines()\nif string in self.restrictedWords:\n return True\nelse:\n return False", "self...
<|body_start_0|> self.registeredPlates = open('registeredPlates.txt').read().splitlines() if string in self.registeredPlates: return True else: return False <|end_body_0|> <|body_start_1|> self.restrictedWords = open('restrictedWords.txt').read().splitlines() ...
check
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class check: def registered(self, string): """Checks if string is in registered plates file; returns boolean""" <|body_0|> def restricted(self, string): """Checks if string is in restricted plates file; returns boolean""" <|body_1|> def word(self, string): ...
stack_v2_sparse_classes_75kplus_train_002528
3,194
permissive
[ { "docstring": "Checks if string is in registered plates file; returns boolean", "name": "registered", "signature": "def registered(self, string)" }, { "docstring": "Checks if string is in restricted plates file; returns boolean", "name": "restricted", "signature": "def restricted(self, ...
3
stack_v2_sparse_classes_30k_train_006650
Implement the Python class `check` described below. Class description: Implement the check class. Method signatures and docstrings: - def registered(self, string): Checks if string is in registered plates file; returns boolean - def restricted(self, string): Checks if string is in restricted plates file; returns bool...
Implement the Python class `check` described below. Class description: Implement the check class. Method signatures and docstrings: - def registered(self, string): Checks if string is in registered plates file; returns boolean - def restricted(self, string): Checks if string is in restricted plates file; returns bool...
af04f91e14492d0ddfe7b5ad00e0652e609ca1b5
<|skeleton|> class check: def registered(self, string): """Checks if string is in registered plates file; returns boolean""" <|body_0|> def restricted(self, string): """Checks if string is in restricted plates file; returns boolean""" <|body_1|> def word(self, string): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class check: def registered(self, string): """Checks if string is in registered plates file; returns boolean""" self.registeredPlates = open('registeredPlates.txt').read().splitlines() if string in self.registeredPlates: return True else: return False def...
the_stack_v2_python_sparse
Code/Pygame Based/20140326/carPlateRegistrationSystem.py
creatingcrap/PythonPlate
train
0
962b8bec9d0698d111d953a2c4e75714a096d68a
[ "self.device = device\nself.type = 0\nself.code = 0\nself.checksum = 0\nself.hdr_length = 0", "icmph = unpack('!BBH', packet)\nself.type = icmph[0]\nself.code = icmph[1]\nself.checksum = icmph[2]\nself.hdr_length = self.DEFAULT_LENGTH" ]
<|body_start_0|> self.device = device self.type = 0 self.code = 0 self.checksum = 0 self.hdr_length = 0 <|end_body_0|> <|body_start_1|> icmph = unpack('!BBH', packet) self.type = icmph[0] self.code = icmph[1] self.checksum = icmph[2] self....
Description : class to store the details of ICMP protocol sample packet structure 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Code | Checksum | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | unuse...
IcmpHeader
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IcmpHeader: """Description : class to store the details of ICMP protocol sample packet structure 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Code | Checksum | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+...
stack_v2_sparse_classes_75kplus_train_002529
1,704
no_license
[ { "docstring": "Description : Initialize the ICMP header details", "name": "__init__", "signature": "def __init__(self, device)" }, { "docstring": "Description : Assigns values to the ICMP header class attributes from the details present in the given packet input_param : packet - packet received...
2
null
Implement the Python class `IcmpHeader` described below. Class description: Description : class to store the details of ICMP protocol sample packet structure 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Code | Checksu...
Implement the Python class `IcmpHeader` described below. Class description: Description : class to store the details of ICMP protocol sample packet structure 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Code | Checksu...
eb5c852b993ddf3e8516705f0252de41e771e731
<|skeleton|> class IcmpHeader: """Description : class to store the details of ICMP protocol sample packet structure 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Code | Checksum | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class IcmpHeader: """Description : class to store the details of ICMP protocol sample packet structure 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Code | Checksum | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...
the_stack_v2_python_sparse
manager/sniffer/icmp.py
Rk85/Network-Packet-Analyzer
train
0
4d33ad0395c2e3ae536a9bf6fdabf98487323eed
[ "self.utils = NSGA2Utils(problem, num_of_individuals, num_of_tour_particips, tournament_prob, crossover_param, mutation_param)\nself.population = None\nself.num_of_generations = num_of_generations\nself.on_generation_finished = []\nself.num_of_individuals = num_of_individuals", "self.population = self.utils.creat...
<|body_start_0|> self.utils = NSGA2Utils(problem, num_of_individuals, num_of_tour_particips, tournament_prob, crossover_param, mutation_param) self.population = None self.num_of_generations = num_of_generations self.on_generation_finished = [] self.num_of_individuals = num_of_ind...
This class manages the evolutionary process of the NSGA-II algorithm.
Evolution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Evolution: """This class manages the evolutionary process of the NSGA-II algorithm.""" def __init__(self, problem, num_of_generations=1000, num_of_individuals=100, num_of_tour_particips=2, tournament_prob=0.9, crossover_param=2, mutation_param=5): """Initialize an instance of the Evo...
stack_v2_sparse_classes_75kplus_train_002530
5,047
no_license
[ { "docstring": "Initialize an instance of the Evolution class. :param problem: The problem to optimize. :param num_of_generations: The number of generations the algorithm will evolve. :param num_of_individuals: The number of individuals (solutions) in each generation. :param num_of_tour_particips: The number of...
2
stack_v2_sparse_classes_30k_train_044870
Implement the Python class `Evolution` described below. Class description: This class manages the evolutionary process of the NSGA-II algorithm. Method signatures and docstrings: - def __init__(self, problem, num_of_generations=1000, num_of_individuals=100, num_of_tour_particips=2, tournament_prob=0.9, crossover_para...
Implement the Python class `Evolution` described below. Class description: This class manages the evolutionary process of the NSGA-II algorithm. Method signatures and docstrings: - def __init__(self, problem, num_of_generations=1000, num_of_individuals=100, num_of_tour_particips=2, tournament_prob=0.9, crossover_para...
5411b64acc15a0613881e91c74d65874457bdb48
<|skeleton|> class Evolution: """This class manages the evolutionary process of the NSGA-II algorithm.""" def __init__(self, problem, num_of_generations=1000, num_of_individuals=100, num_of_tour_particips=2, tournament_prob=0.9, crossover_param=2, mutation_param=5): """Initialize an instance of the Evo...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Evolution: """This class manages the evolutionary process of the NSGA-II algorithm.""" def __init__(self, problem, num_of_generations=1000, num_of_individuals=100, num_of_tour_particips=2, tournament_prob=0.9, crossover_param=2, mutation_param=5): """Initialize an instance of the Evolution class....
the_stack_v2_python_sparse
NSGA2/nsga2/evolution.py
RioKKH/pytools
train
0
026fd71ee32b75fc492dd3de03f900cbd24733b8
[ "pygame.mixer.pre_init(44100, -16, 1, 512)\npygame.init()\nctypes.windll.user32.SetProcessDPIAware()\nself.settings = Settings()\nself.screen = pygame.display.set_mode((self.settings.screen_width, self.settings.screen_height))\npygame.display.set_caption(self.settings.caption)\nself.main_menu = True\nself.play_game...
<|body_start_0|> pygame.mixer.pre_init(44100, -16, 1, 512) pygame.init() ctypes.windll.user32.SetProcessDPIAware() self.settings = Settings() self.screen = pygame.display.set_mode((self.settings.screen_width, self.settings.screen_height)) pygame.display.set_caption(self.s...
A class representing the game.
Game
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Game: """A class representing the game.""" def __init__(self): """Initialize game.""" <|body_0|> def run_game(self): """Main function for Space Invaders.""" <|body_1|> <|end_skeleton|> <|body_start_0|> pygame.mixer.pre_init(44100, -16, 1, 512) ...
stack_v2_sparse_classes_75kplus_train_002531
3,861
permissive
[ { "docstring": "Initialize game.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Main function for Space Invaders.", "name": "run_game", "signature": "def run_game(self)" } ]
2
stack_v2_sparse_classes_30k_train_033664
Implement the Python class `Game` described below. Class description: A class representing the game. Method signatures and docstrings: - def __init__(self): Initialize game. - def run_game(self): Main function for Space Invaders.
Implement the Python class `Game` described below. Class description: A class representing the game. Method signatures and docstrings: - def __init__(self): Initialize game. - def run_game(self): Main function for Space Invaders. <|skeleton|> class Game: """A class representing the game.""" def __init__(sel...
fad971bc651065138f51f94c4ddecdbb1cd20e86
<|skeleton|> class Game: """A class representing the game.""" def __init__(self): """Initialize game.""" <|body_0|> def run_game(self): """Main function for Space Invaders.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Game: """A class representing the game.""" def __init__(self): """Initialize game.""" pygame.mixer.pre_init(44100, -16, 1, 512) pygame.init() ctypes.windll.user32.SetProcessDPIAware() self.settings = Settings() self.screen = pygame.display.set_mode((self.se...
the_stack_v2_python_sparse
space_invaders.py
hlynurstef/Space_Invaders
train
0
2ded63d2dacd7fb8907bf91bade7a0e05c80a321
[ "handler_names = provider_config.get_authentication_handlers() if provider_config else []\nself._authn_handlers = []\nfrom vmware.vapi.lib.load import dynamic_import\nfor handler_name in handler_names:\n handler_constructor = dynamic_import(handler_name)\n if handler_constructor is None:\n raise Import...
<|body_start_0|> handler_names = provider_config.get_authentication_handlers() if provider_config else [] self._authn_handlers = [] from vmware.vapi.lib.load import dynamic_import for handler_name in handler_names: handler_constructor = dynamic_import(handler_name) ...
AuthenticationFilter in API Provider chain enforces the authentication schemes specified in the authentication metadata file
AuthenticationFilter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AuthenticationFilter: """AuthenticationFilter in API Provider chain enforces the authentication schemes specified in the authentication metadata file""" def __init__(self, next_provider=None, provider_config=None): """Initialize AuthenticationFilter :type next_provider: :class:`vmwar...
stack_v2_sparse_classes_75kplus_train_002532
5,195
no_license
[ { "docstring": "Initialize AuthenticationFilter :type next_provider: :class:`vmware.vapi.core.ApiProvider` :param next_provider: API Provider to invoke the requests :type provider_config: :class:`vmware.vapi.settings.config.ProviderConfig` or :class:`None` :param provider_config: Provider configuration object",...
2
null
Implement the Python class `AuthenticationFilter` described below. Class description: AuthenticationFilter in API Provider chain enforces the authentication schemes specified in the authentication metadata file Method signatures and docstrings: - def __init__(self, next_provider=None, provider_config=None): Initializ...
Implement the Python class `AuthenticationFilter` described below. Class description: AuthenticationFilter in API Provider chain enforces the authentication schemes specified in the authentication metadata file Method signatures and docstrings: - def __init__(self, next_provider=None, provider_config=None): Initializ...
5d395700ab3d0d1d45b497e48beab8c366fca9f5
<|skeleton|> class AuthenticationFilter: """AuthenticationFilter in API Provider chain enforces the authentication schemes specified in the authentication metadata file""" def __init__(self, next_provider=None, provider_config=None): """Initialize AuthenticationFilter :type next_provider: :class:`vmwar...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AuthenticationFilter: """AuthenticationFilter in API Provider chain enforces the authentication schemes specified in the authentication metadata file""" def __init__(self, next_provider=None, provider_config=None): """Initialize AuthenticationFilter :type next_provider: :class:`vmware.vapi.core.A...
the_stack_v2_python_sparse
alexa-program/vmware/vapi/security/authentication_filter.py
taromurata/TDP2018_VMCAPI
train
1
9e21d192e5ad693d294d851a235a2eb90007d0ed
[ "super(CustomRNN, self).__init__()\nself.hidden_size = hidden_size\nself.rnn_type = rnn_type\nself.vocab_size = vocab_size\nself.num_layers = num_layers\nself.rnn = nn.ModuleList()\nif rnn_type == 'basic_rnn':\n layer = BasicRNNCell\nelif rnn_type == 'lstm_rnn':\n layer = LSTMCell\nelse:\n print('Enter val...
<|body_start_0|> super(CustomRNN, self).__init__() self.hidden_size = hidden_size self.rnn_type = rnn_type self.vocab_size = vocab_size self.num_layers = num_layers self.rnn = nn.ModuleList() if rnn_type == 'basic_rnn': layer = BasicRNNCell eli...
CustomRNN
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CustomRNN: def __init__(self, vocab_size, hidden_size, num_layers=1, rnn_type='basic_rnn'): """Creates an recurrent neural network of type {basic_rnn, lstm_rnn} basic_rnn is an rnn whose layers implement a tanH activation function lstm_rnn is ann rnn whose layers implement an LSTM cell A...
stack_v2_sparse_classes_75kplus_train_002533
3,688
no_license
[ { "docstring": "Creates an recurrent neural network of type {basic_rnn, lstm_rnn} basic_rnn is an rnn whose layers implement a tanH activation function lstm_rnn is ann rnn whose layers implement an LSTM cell Arguments --------- vocab_size: (int), the number of unique characters in the corpus. This is the number...
2
stack_v2_sparse_classes_30k_train_006644
Implement the Python class `CustomRNN` described below. Class description: Implement the CustomRNN class. Method signatures and docstrings: - def __init__(self, vocab_size, hidden_size, num_layers=1, rnn_type='basic_rnn'): Creates an recurrent neural network of type {basic_rnn, lstm_rnn} basic_rnn is an rnn whose lay...
Implement the Python class `CustomRNN` described below. Class description: Implement the CustomRNN class. Method signatures and docstrings: - def __init__(self, vocab_size, hidden_size, num_layers=1, rnn_type='basic_rnn'): Creates an recurrent neural network of type {basic_rnn, lstm_rnn} basic_rnn is an rnn whose lay...
ca5d01dab5ba58a93b224541569c5ad2b3d943ed
<|skeleton|> class CustomRNN: def __init__(self, vocab_size, hidden_size, num_layers=1, rnn_type='basic_rnn'): """Creates an recurrent neural network of type {basic_rnn, lstm_rnn} basic_rnn is an rnn whose layers implement a tanH activation function lstm_rnn is ann rnn whose layers implement an LSTM cell A...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CustomRNN: def __init__(self, vocab_size, hidden_size, num_layers=1, rnn_type='basic_rnn'): """Creates an recurrent neural network of type {basic_rnn, lstm_rnn} basic_rnn is an rnn whose layers implement a tanH activation function lstm_rnn is ann rnn whose layers implement an LSTM cell Arguments -----...
the_stack_v2_python_sparse
create_rnn.py
zhangjoe99/basic-rnn
train
0
9d471cab4d3b138c0493f73a0809a48361e25f96
[ "self.capcity = capacity\nself.map = {}\nself.head = DNode(None)\nself.tail = self.head\nself.exist = 0", "curNode = self.map.get(key)\nif curNode:\n tailNode = self.tail\n if curNode != tailNode:\n curNode.next.pre = curNode.pre\n curNode.pre.next = curNode.next\n tailNode.next = curNo...
<|body_start_0|> self.capcity = capacity self.map = {} self.head = DNode(None) self.tail = self.head self.exist = 0 <|end_body_0|> <|body_start_1|> curNode = self.map.get(key) if curNode: tailNode = self.tail if curNode != tailNode: ...
LRUCache
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: None""" <|body_2|> <|end_s...
stack_v2_sparse_classes_75kplus_train_002534
2,099
no_license
[ { "docstring": ":type capacity: int", "name": "__init__", "signature": "def __init__(self, capacity)" }, { "docstring": ":type key: int :rtype: int", "name": "get", "signature": "def get(self, key)" }, { "docstring": ":type key: int :type value: int :rtype: None", "name": "pu...
3
null
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: None
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: None <|sk...
bc67562b010397f74a2d97ced1c7863566370861
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: None""" <|body_2|> <|end_s...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LRUCache: def __init__(self, capacity): """:type capacity: int""" self.capcity = capacity self.map = {} self.head = DNode(None) self.tail = self.head self.exist = 0 def get(self, key): """:type key: int :rtype: int""" curNode = self.map.get(...
the_stack_v2_python_sparse
Design/146_LRU Cache.py
Mercyzzz/MercyLeetcode
train
1
218b5ab3a2cbdb4f1c36aee62630c2320a7ca86c
[ "try:\n book = BookInfo.objects.get(pk=pk)\nexcept BookInfo.DoesNotExist:\n return HttpResponse(status=404)\nreturn JsonResponse({'id': book.id, 'name': book.name, 'pub_date': book.pub_date, 'read_count': book.read_count, 'comment_count': book.comment_count})", "try:\n book = BookInfo.objects.get(pk=pk)\...
<|body_start_0|> try: book = BookInfo.objects.get(pk=pk) except BookInfo.DoesNotExist: return HttpResponse(status=404) return JsonResponse({'id': book.id, 'name': book.name, 'pub_date': book.pub_date, 'read_count': book.read_count, 'comment_count': book.comment_count}) <|...
BookAPIView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BookAPIView: def get(self, request, pk): """获取单个图书信息 路由: GET /books/<pk>/ url中则需要设置books/(?P<pk>d+)/""" <|body_0|> def put(self, request, pk): """修改图书信息 路由: PUT /books/<pk>""" <|body_1|> def delete(self, request, pk): """删除图书 路由: DELETE /books/<p...
stack_v2_sparse_classes_75kplus_train_002535
4,279
permissive
[ { "docstring": "获取单个图书信息 路由: GET /books/<pk>/ url中则需要设置books/(?P<pk>d+)/", "name": "get", "signature": "def get(self, request, pk)" }, { "docstring": "修改图书信息 路由: PUT /books/<pk>", "name": "put", "signature": "def put(self, request, pk)" }, { "docstring": "删除图书 路由: DELETE /books/<...
3
stack_v2_sparse_classes_30k_train_030693
Implement the Python class `BookAPIView` described below. Class description: Implement the BookAPIView class. Method signatures and docstrings: - def get(self, request, pk): 获取单个图书信息 路由: GET /books/<pk>/ url中则需要设置books/(?P<pk>d+)/ - def put(self, request, pk): 修改图书信息 路由: PUT /books/<pk> - def delete(self, request, pk...
Implement the Python class `BookAPIView` described below. Class description: Implement the BookAPIView class. Method signatures and docstrings: - def get(self, request, pk): 获取单个图书信息 路由: GET /books/<pk>/ url中则需要设置books/(?P<pk>d+)/ - def put(self, request, pk): 修改图书信息 路由: PUT /books/<pk> - def delete(self, request, pk...
771a3f44c5d0e9a7be1118b84ca89cd34c3d7293
<|skeleton|> class BookAPIView: def get(self, request, pk): """获取单个图书信息 路由: GET /books/<pk>/ url中则需要设置books/(?P<pk>d+)/""" <|body_0|> def put(self, request, pk): """修改图书信息 路由: PUT /books/<pk>""" <|body_1|> def delete(self, request, pk): """删除图书 路由: DELETE /books/<p...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BookAPIView: def get(self, request, pk): """获取单个图书信息 路由: GET /books/<pk>/ url中则需要设置books/(?P<pk>d+)/""" try: book = BookInfo.objects.get(pk=pk) except BookInfo.DoesNotExist: return HttpResponse(status=404) return JsonResponse({'id': book.id, 'name': book...
the_stack_v2_python_sparse
19Django_Advanced/day01to06/demo/DRF/views.py
mumudexiaomuwu/Python24
train
1
b8478d11bf8717ef0a79b8a88249fdf45e629821
[ "self.name = name\nself.description = description\nself.config_scheme = config_scheme\nself.default_config = default_config\nself.default_cron = default_cron\nself.default_activated = default_activated\nself.args = args\nself.kwargs = kwargs", "from gengine.app.registries import get_task_registry\nget_task_regist...
<|body_start_0|> self.name = name self.description = description self.config_scheme = config_scheme self.default_config = default_config self.default_cron = default_cron self.default_activated = default_activated self.args = args self.kwargs = kwargs <|end...
EngineTask
[ "MIT", "ZPL-2.1", "Apache-2.0", "BSD-3-Clause-Modification", "LGPL-2.0-or-later" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EngineTask: def __init__(self, name, description, config_scheme, default_config, default_cron, default_activated, *args, **kwargs): """Constructor just here to accept parameters for decorator""" <|body_0|> def __call__(self, wrapped): """Attach the decorator with Ven...
stack_v2_sparse_classes_75kplus_train_002536
2,888
permissive
[ { "docstring": "Constructor just here to accept parameters for decorator", "name": "__init__", "signature": "def __init__(self, name, description, config_scheme, default_config, default_cron, default_activated, *args, **kwargs)" }, { "docstring": "Attach the decorator with Venusian", "name":...
2
stack_v2_sparse_classes_30k_train_005905
Implement the Python class `EngineTask` described below. Class description: Implement the EngineTask class. Method signatures and docstrings: - def __init__(self, name, description, config_scheme, default_config, default_cron, default_activated, *args, **kwargs): Constructor just here to accept parameters for decorat...
Implement the Python class `EngineTask` described below. Class description: Implement the EngineTask class. Method signatures and docstrings: - def __init__(self, name, description, config_scheme, default_config, default_cron, default_activated, *args, **kwargs): Constructor just here to accept parameters for decorat...
b82a900f2f4a43cea463853e36d6f8237c7f255e
<|skeleton|> class EngineTask: def __init__(self, name, description, config_scheme, default_config, default_cron, default_activated, *args, **kwargs): """Constructor just here to accept parameters for decorator""" <|body_0|> def __call__(self, wrapped): """Attach the decorator with Ven...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EngineTask: def __init__(self, name, description, config_scheme, default_config, default_cron, default_activated, *args, **kwargs): """Constructor just here to accept parameters for decorator""" self.name = name self.description = description self.config_scheme = config_scheme ...
the_stack_v2_python_sparse
gengine/app/tasksystem.py
ActiDoo/gamification-engine
train
413
907b93d07ed8e48bdf7b0666f76df96068f0b849
[ "if user is not None and user.is_superuser and with_superuser:\n return self\nfilters_prefix = ''\nif self.model._meta.label == 'flow.Storage':\n filters_prefix = 'data__'\nfilters = dict()\nif user:\n filters['user'] = models.Q(**{f'{filters_prefix}permission_group__permissions__user': user, f'{filters_pr...
<|body_start_0|> if user is not None and user.is_superuser and with_superuser: return self filters_prefix = '' if self.model._meta.label == 'flow.Storage': filters_prefix = 'data__' filters = dict() if user: filters['user'] = models.Q(**{f'{fil...
Queryset with methods that simlify filtering by permissions.
PermissionQuerySet
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PermissionQuerySet: """Queryset with methods that simlify filtering by permissions.""" def _filter_by_permission(self, user: Optional[User], groups: models.QuerySet, permission: Permission, public: bool=True, with_superuser: bool=True) -> models.QuerySet: """Filter queryset by permis...
stack_v2_sparse_classes_75kplus_train_002537
19,789
permissive
[ { "docstring": "Filter queryset by permissions. This is a generic method that is called in public methods. :attr user: the user which permissions should be considered. :attr groups: the groups which permissions should be considered. :attr permission: the lowest permission entity must have. :attr public: when Tr...
3
stack_v2_sparse_classes_30k_train_039792
Implement the Python class `PermissionQuerySet` described below. Class description: Queryset with methods that simlify filtering by permissions. Method signatures and docstrings: - def _filter_by_permission(self, user: Optional[User], groups: models.QuerySet, permission: Permission, public: bool=True, with_superuser:...
Implement the Python class `PermissionQuerySet` described below. Class description: Queryset with methods that simlify filtering by permissions. Method signatures and docstrings: - def _filter_by_permission(self, user: Optional[User], groups: models.QuerySet, permission: Permission, public: bool=True, with_superuser:...
25c0c45235ef37beb45c1af4c917fbbae6282016
<|skeleton|> class PermissionQuerySet: """Queryset with methods that simlify filtering by permissions.""" def _filter_by_permission(self, user: Optional[User], groups: models.QuerySet, permission: Permission, public: bool=True, with_superuser: bool=True) -> models.QuerySet: """Filter queryset by permis...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PermissionQuerySet: """Queryset with methods that simlify filtering by permissions.""" def _filter_by_permission(self, user: Optional[User], groups: models.QuerySet, permission: Permission, public: bool=True, with_superuser: bool=True) -> models.QuerySet: """Filter queryset by permissions. This i...
the_stack_v2_python_sparse
resolwe/permissions/models.py
genialis/resolwe
train
35
dd8d7728fa8286c059073c039bc8787a14839764
[ "self._vm = vm\nself.func_code = code\nself.func_name = self.__name__ = name or code.co_name\nself.func_defaults = tuple(defaults)\nself.func_globals = globs\nself.func_locals = self._vm.frame.f_locals\nself.__dict__ = {}\nself.func_closure = closure\nself.__doc__ = code.co_consts[0] if code.co_consts else None\nkw...
<|body_start_0|> self._vm = vm self.func_code = code self.func_name = self.__name__ = name or code.co_name self.func_defaults = tuple(defaults) self.func_globals = globs self.func_locals = self._vm.frame.f_locals self.__dict__ = {} self.func_closure = clos...
Create a realistic function object, defining the things the interpreter expects.
Function
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Function: """Create a realistic function object, defining the things the interpreter expects.""" def __init__(self, name, code, globs, defaults, closure, vm): """You don't need to follow this closely to understand the interpreter.""" <|body_0|> def __call__(self, *args, ...
stack_v2_sparse_classes_75kplus_train_002538
9,627
permissive
[ { "docstring": "You don't need to follow this closely to understand the interpreter.", "name": "__init__", "signature": "def __init__(self, name, code, globs, defaults, closure, vm)" }, { "docstring": "When calling a Function, make a new frame and run it.", "name": "__call__", "signature...
2
stack_v2_sparse_classes_30k_train_019492
Implement the Python class `Function` described below. Class description: Create a realistic function object, defining the things the interpreter expects. Method signatures and docstrings: - def __init__(self, name, code, globs, defaults, closure, vm): You don't need to follow this closely to understand the interpret...
Implement the Python class `Function` described below. Class description: Create a realistic function object, defining the things the interpreter expects. Method signatures and docstrings: - def __init__(self, name, code, globs, defaults, closure, vm): You don't need to follow this closely to understand the interpret...
4f5bdab86c71f503ac3ca7fbf5f81a615e323759
<|skeleton|> class Function: """Create a realistic function object, defining the things the interpreter expects.""" def __init__(self, name, code, globs, defaults, closure, vm): """You don't need to follow this closely to understand the interpreter.""" <|body_0|> def __call__(self, *args, ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Function: """Create a realistic function object, defining the things the interpreter expects.""" def __init__(self, name, code, globs, defaults, closure, vm): """You don't need to follow this closely to understand the interpreter.""" self._vm = vm self.func_code = code sel...
the_stack_v2_python_sparse
python_advance/about_pyhton/simple_interpreter/interpreter_3.py
Dustyposa/goSpider
train
66
bc99bedaceb1954fb9b593b696182d8fe5d3ac82
[ "super(pnl_mult_mechanism, self).__init__()\nself.n_causes = ncauses\nself.points = points\nself.noise_function = noise_function\nself.noise_coeff = noise_coeff\nself.f1 = lambda x: np.log(np.sum(x, axis=1))\nself.f2 = lambda x: np.exp(x)", "effect = np.zeros((self.points, 1))\nself.noise = self.noise_coeff * sel...
<|body_start_0|> super(pnl_mult_mechanism, self).__init__() self.n_causes = ncauses self.points = points self.noise_function = noise_function self.noise_coeff = noise_coeff self.f1 = lambda x: np.log(np.sum(x, axis=1)) self.f2 = lambda x: np.exp(x) <|end_body_0|> ...
Post-Nonlinear model using a exp and log as the non-linearities. This results in a multiplicative model.
pnl_mult_mechanism
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class pnl_mult_mechanism: """Post-Nonlinear model using a exp and log as the non-linearities. This results in a multiplicative model.""" def __init__(self, ncauses, points, noise_function, noise_coeff=0.4): """Init the mechanism.""" <|body_0|> def __call__(self, causes): ...
stack_v2_sparse_classes_75kplus_train_002539
32,235
permissive
[ { "docstring": "Init the mechanism.", "name": "__init__", "signature": "def __init__(self, ncauses, points, noise_function, noise_coeff=0.4)" }, { "docstring": "Run the mechanism.", "name": "__call__", "signature": "def __call__(self, causes)" } ]
2
null
Implement the Python class `pnl_mult_mechanism` described below. Class description: Post-Nonlinear model using a exp and log as the non-linearities. This results in a multiplicative model. Method signatures and docstrings: - def __init__(self, ncauses, points, noise_function, noise_coeff=0.4): Init the mechanism. - d...
Implement the Python class `pnl_mult_mechanism` described below. Class description: Post-Nonlinear model using a exp and log as the non-linearities. This results in a multiplicative model. Method signatures and docstrings: - def __init__(self, ncauses, points, noise_function, noise_coeff=0.4): Init the mechanism. - d...
c3428c7e919c4332d7421706e641c74ff7f095cd
<|skeleton|> class pnl_mult_mechanism: """Post-Nonlinear model using a exp and log as the non-linearities. This results in a multiplicative model.""" def __init__(self, ncauses, points, noise_function, noise_coeff=0.4): """Init the mechanism.""" <|body_0|> def __call__(self, causes): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class pnl_mult_mechanism: """Post-Nonlinear model using a exp and log as the non-linearities. This results in a multiplicative model.""" def __init__(self, ncauses, points, noise_function, noise_coeff=0.4): """Init the mechanism.""" super(pnl_mult_mechanism, self).__init__() self.n_caus...
the_stack_v2_python_sparse
data/generation/causal_mechanisms.py
jcai-sc/dcdi
train
0
99671453a9064b94bbb2be4df38348e3e447ccf6
[ "left = 0\nright = len(numbers) - 1\nwhile left < right:\n num_sum = numbers[left] + numbers[right]\n if num_sum == target:\n return [left + 1, right + 1]\n if num_sum < target:\n left += 1\n else:\n right -= 1\nreturn [-1, -1]", "num_dict = dict()\nfor index, num in enumerate(num...
<|body_start_0|> left = 0 right = len(numbers) - 1 while left < right: num_sum = numbers[left] + numbers[right] if num_sum == target: return [left + 1, right + 1] if num_sum < target: left += 1 else: ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def twoSum(self, numbers, target): """Time complexity: O(n) Space complexity: O(1) This approach will only work for sorted arr :type numbers: List[int] :type target: int :rtype: List[int]""" <|body_0|> def twoSum_approach2(self, numbers, target): """Time an...
stack_v2_sparse_classes_75kplus_train_002540
1,967
permissive
[ { "docstring": "Time complexity: O(n) Space complexity: O(1) This approach will only work for sorted arr :type numbers: List[int] :type target: int :rtype: List[int]", "name": "twoSum", "signature": "def twoSum(self, numbers, target)" }, { "docstring": "Time and space complexity: O(n) This appro...
2
stack_v2_sparse_classes_30k_train_027274
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def twoSum(self, numbers, target): Time complexity: O(n) Space complexity: O(1) This approach will only work for sorted arr :type numbers: List[int] :type target: int :rtype: Lis...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def twoSum(self, numbers, target): Time complexity: O(n) Space complexity: O(1) This approach will only work for sorted arr :type numbers: List[int] :type target: int :rtype: Lis...
c7e5b6692ad6772b38de8be029bddf0e273e0bce
<|skeleton|> class Solution: def twoSum(self, numbers, target): """Time complexity: O(n) Space complexity: O(1) This approach will only work for sorted arr :type numbers: List[int] :type target: int :rtype: List[int]""" <|body_0|> def twoSum_approach2(self, numbers, target): """Time an...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def twoSum(self, numbers, target): """Time complexity: O(n) Space complexity: O(1) This approach will only work for sorted arr :type numbers: List[int] :type target: int :rtype: List[int]""" left = 0 right = len(numbers) - 1 while left < right: num_sum = n...
the_stack_v2_python_sparse
arr_str/two_sum_sorted_arr.py
mantoshkumar1/interview_preparation
train
1
72a42ce091c0aa7848c546124b383abd8b2bed97
[ "super().__init__()\nself.in_channels = in_channels\nself.out_channels = out_channels\nself.conv1_1 = nn.Sequential(*[nn.Conv2d(in_channels, in_channels, kernel_size=3, padding=1), nn.PReLU()] * 2)\nself.down1 = nn.Conv2d(in_channels, in_channels * 2, kernel_size=3, stride=2, padding=1)\nself.conv2_1 = nn.Sequentia...
<|body_start_0|> super().__init__() self.in_channels = in_channels self.out_channels = out_channels self.conv1_1 = nn.Sequential(*[nn.Conv2d(in_channels, in_channels, kernel_size=3, padding=1), nn.PReLU()] * 2) self.down1 = nn.Conv2d(in_channels, in_channels * 2, kernel_size=3, s...
Down-up block (DUB) for :class:`DIDN` model as implemented in [1]_. References ---------- .. [1] Yu, Songhyun, et al. “Deep Iterative Down-Up CNN for Image Denoising.” 2019 IEEE/CVF Conference on Computer Vision and Pattern Recognition Workshops (CVPRW), 2019, pp. 2095–103. IEEE Xplore, https://doi.org/10.1109/CVPRW.20...
DUB
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DUB: """Down-up block (DUB) for :class:`DIDN` model as implemented in [1]_. References ---------- .. [1] Yu, Songhyun, et al. “Deep Iterative Down-Up CNN for Image Denoising.” 2019 IEEE/CVF Conference on Computer Vision and Pattern Recognition Workshops (CVPRW), 2019, pp. 2095–103. IEEE Xplore, h...
stack_v2_sparse_classes_75kplus_train_002541
12,259
permissive
[ { "docstring": "Inits :class:`DUB`. Parameters ---------- in_channels: int Number of input channels. out_channels: int Number of output channels.", "name": "__init__", "signature": "def __init__(self, in_channels: int, out_channels: int)" }, { "docstring": "Pads input to height and width dimensi...
4
stack_v2_sparse_classes_30k_train_050985
Implement the Python class `DUB` described below. Class description: Down-up block (DUB) for :class:`DIDN` model as implemented in [1]_. References ---------- .. [1] Yu, Songhyun, et al. “Deep Iterative Down-Up CNN for Image Denoising.” 2019 IEEE/CVF Conference on Computer Vision and Pattern Recognition Workshops (CVP...
Implement the Python class `DUB` described below. Class description: Down-up block (DUB) for :class:`DIDN` model as implemented in [1]_. References ---------- .. [1] Yu, Songhyun, et al. “Deep Iterative Down-Up CNN for Image Denoising.” 2019 IEEE/CVF Conference on Computer Vision and Pattern Recognition Workshops (CVP...
2a4c29342bc52a404aae097bc2654fb4323e1ac8
<|skeleton|> class DUB: """Down-up block (DUB) for :class:`DIDN` model as implemented in [1]_. References ---------- .. [1] Yu, Songhyun, et al. “Deep Iterative Down-Up CNN for Image Denoising.” 2019 IEEE/CVF Conference on Computer Vision and Pattern Recognition Workshops (CVPRW), 2019, pp. 2095–103. IEEE Xplore, h...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DUB: """Down-up block (DUB) for :class:`DIDN` model as implemented in [1]_. References ---------- .. [1] Yu, Songhyun, et al. “Deep Iterative Down-Up CNN for Image Denoising.” 2019 IEEE/CVF Conference on Computer Vision and Pattern Recognition Workshops (CVPRW), 2019, pp. 2095–103. IEEE Xplore, https://doi.or...
the_stack_v2_python_sparse
direct/nn/didn/didn.py
NKI-AI/direct
train
151
d6e38f29f64dd6bca4ef3fbd1af87e04f30ac82d
[ "self.min_sigma = min_sigma\nself.max_sigma = max_sigma\nself.threshold = threshold", "img = img_as_float(img_array)\npeaks = blob_dog(img, min_sigma=self.min_sigma, max_sigma=self.max_sigma, threshold=self.threshold)\npeaks = peaks[:, [0, 1]] = peaks[:, [1, 0]]\nreturn peaks" ]
<|body_start_0|> self.min_sigma = min_sigma self.max_sigma = max_sigma self.threshold = threshold <|end_body_0|> <|body_start_1|> img = img_as_float(img_array) peaks = blob_dog(img, min_sigma=self.min_sigma, max_sigma=self.max_sigma, threshold=self.threshold) peaks = pea...
A class using difference of gaussian to find peaks. It uses skimage blob_dog internally. ... Attributes ---------- min_sigma (float) max_sigma (int) threshold (float)
PeakFinderDifferenceOfGaussian
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PeakFinderDifferenceOfGaussian: """A class using difference of gaussian to find peaks. It uses skimage blob_dog internally. ... Attributes ---------- min_sigma (float) max_sigma (int) threshold (float)""" def __init__(self, min_sigma=0.75, max_sigma=3, threshold=0.1): """For more det...
stack_v2_sparse_classes_75kplus_train_002542
4,440
permissive
[ { "docstring": "For more detailed information about the parameters in the constructor refer to blob_dog from skimage.feature. Args: min_sigma (float, optional): Defaults to 0.75. max_sigma (int, optional): Defaults to 3. threshold (float, optional): Defaults to 0.1.", "name": "__init__", "signature": "d...
2
stack_v2_sparse_classes_30k_train_046315
Implement the Python class `PeakFinderDifferenceOfGaussian` described below. Class description: A class using difference of gaussian to find peaks. It uses skimage blob_dog internally. ... Attributes ---------- min_sigma (float) max_sigma (int) threshold (float) Method signatures and docstrings: - def __init__(self, ...
Implement the Python class `PeakFinderDifferenceOfGaussian` described below. Class description: A class using difference of gaussian to find peaks. It uses skimage blob_dog internally. ... Attributes ---------- min_sigma (float) max_sigma (int) threshold (float) Method signatures and docstrings: - def __init__(self, ...
1358c9817150316be4de6093212ce2f71059d472
<|skeleton|> class PeakFinderDifferenceOfGaussian: """A class using difference of gaussian to find peaks. It uses skimage blob_dog internally. ... Attributes ---------- min_sigma (float) max_sigma (int) threshold (float)""" def __init__(self, min_sigma=0.75, max_sigma=3, threshold=0.1): """For more det...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PeakFinderDifferenceOfGaussian: """A class using difference of gaussian to find peaks. It uses skimage blob_dog internally. ... Attributes ---------- min_sigma (float) max_sigma (int) threshold (float)""" def __init__(self, min_sigma=0.75, max_sigma=3, threshold=0.1): """For more detailed informa...
the_stack_v2_python_sparse
situr/registration/peak_finder.py
13hannes11/situr
train
0
10b71fa8bdcf6b8cd492f95f819d3ec6154053f0
[ "target = RegistrationForm({'email': 'test@example.com', 'password1': 'pw1', 'password2': 'invalid'})\nresult = target.is_valid()\nself.assertFalse(result)", "target = RegistrationForm({'email': 'test@example.com', 'password1': 'passwd', 'password2': 'passwd'})\nresult = target.is_valid()\nself.assertTrue(result)...
<|body_start_0|> target = RegistrationForm({'email': 'test@example.com', 'password1': 'pw1', 'password2': 'invalid'}) result = target.is_valid() self.assertFalse(result) <|end_body_0|> <|body_start_1|> target = RegistrationForm({'email': 'test@example.com', 'password1': 'passwd', 'passw...
RegistrationFormTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RegistrationFormTest: def test_form_invalid_if_password2_not_equal_to_password1(self): """Form should not validate if password1 != password2.""" <|body_0|> def test_form_valid_if_password2_equals_password1(self): """Form should validate if password1 == password2, no ...
stack_v2_sparse_classes_75kplus_train_002543
1,866
no_license
[ { "docstring": "Form should not validate if password1 != password2.", "name": "test_form_invalid_if_password2_not_equal_to_password1", "signature": "def test_form_invalid_if_password2_not_equal_to_password1(self)" }, { "docstring": "Form should validate if password1 == password2, no other errors...
3
stack_v2_sparse_classes_30k_train_027201
Implement the Python class `RegistrationFormTest` described below. Class description: Implement the RegistrationFormTest class. Method signatures and docstrings: - def test_form_invalid_if_password2_not_equal_to_password1(self): Form should not validate if password1 != password2. - def test_form_valid_if_password2_eq...
Implement the Python class `RegistrationFormTest` described below. Class description: Implement the RegistrationFormTest class. Method signatures and docstrings: - def test_form_invalid_if_password2_not_equal_to_password1(self): Form should not validate if password1 != password2. - def test_form_valid_if_password2_eq...
41281b6343b457721dc60df88cf6593497f73574
<|skeleton|> class RegistrationFormTest: def test_form_invalid_if_password2_not_equal_to_password1(self): """Form should not validate if password1 != password2.""" <|body_0|> def test_form_valid_if_password2_equals_password1(self): """Form should validate if password1 == password2, no ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RegistrationFormTest: def test_form_invalid_if_password2_not_equal_to_password1(self): """Form should not validate if password1 != password2.""" target = RegistrationForm({'email': 'test@example.com', 'password1': 'pw1', 'password2': 'invalid'}) result = target.is_valid() self....
the_stack_v2_python_sparse
src/polishedpagessite/polishedpages/tests.py
platinumazure/polishedpagessite
train
0
2bcc26ffb1c27bcaf985127d8bdbf6d8b001b5a6
[ "assert isinstance(radicand, Fixed)\nassert radicand.signed is False\nself.radicand = radicand\nself.root = radicand.with_bits(0)\nself.root_squared = self.root * self.root\nself.remainder = radicand.with_bits(0) - self.root_squared\nself.log2_radix = log2_radix\nself.current_shift = self.root.bit_width", "if sel...
<|body_start_0|> assert isinstance(radicand, Fixed) assert radicand.signed is False self.radicand = radicand self.root = radicand.with_bits(0) self.root_squared = self.root * self.root self.remainder = radicand.with_bits(0) - self.root_squared self.log2_radix = lo...
Fixed-point Square-Root/Remainder. :attribute radicand: the radicand :attribute root: the square root :attribute root_squared: the square of ``root`` :attribute remainder: the remainder :attribute log2_radix: the base-2 log of the operation radix. The number of bits of root that are calculated per pipeline stage. :attr...
FixedSqrt
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FixedSqrt: """Fixed-point Square-Root/Remainder. :attribute radicand: the radicand :attribute root: the square root :attribute root_squared: the square of ``root`` :attribute remainder: the remainder :attribute log2_radix: the base-2 log of the operation radix. The number of bits of root that are...
stack_v2_sparse_classes_75kplus_train_002544
30,970
no_license
[ { "docstring": "Create an FixedSqrt. :param radicand: the radicand. :param log2_radix: the base-2 log of the operation radix. The number of bits of root that are calculated per pipeline stage.", "name": "__init__", "signature": "def __init__(self, radicand, log2_radix=3)" }, { "docstring": "Calc...
3
null
Implement the Python class `FixedSqrt` described below. Class description: Fixed-point Square-Root/Remainder. :attribute radicand: the radicand :attribute root: the square root :attribute root_squared: the square of ``root`` :attribute remainder: the remainder :attribute log2_radix: the base-2 log of the operation rad...
Implement the Python class `FixedSqrt` described below. Class description: Fixed-point Square-Root/Remainder. :attribute radicand: the radicand :attribute root: the square root :attribute root_squared: the square of ``root`` :attribute remainder: the remainder :attribute log2_radix: the base-2 log of the operation rad...
0cdf4be4df5c0fbae476442c1a91b0e8140e2104
<|skeleton|> class FixedSqrt: """Fixed-point Square-Root/Remainder. :attribute radicand: the radicand :attribute root: the square root :attribute root_squared: the square of ``root`` :attribute remainder: the remainder :attribute log2_radix: the base-2 log of the operation radix. The number of bits of root that are...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FixedSqrt: """Fixed-point Square-Root/Remainder. :attribute radicand: the radicand :attribute root: the square root :attribute root_squared: the square of ``root`` :attribute remainder: the remainder :attribute log2_radix: the base-2 log of the operation radix. The number of bits of root that are calculated p...
the_stack_v2_python_sparse
src/ieee754/div_rem_sqrt_rsqrt/algorithm.py
ChipFlow/ieee754fpu
train
0
a1f1bd251c00e0d0a305201824497f2a57718bcd
[ "hashmap = {}\nmax_len, dp = (0, 0)\nfor idx, x in enumerate(s):\n last_idx = hashmap.get(x, -1)\n hashmap[x] = idx\n if dp < idx - last_idx:\n dp += 1\n else:\n dp = idx - last_idx\n max_len = max(max_len, dp)\nreturn max_len", "hashmap = {}\nstart, max_len = (0, 0)\nfor idx, x in en...
<|body_start_0|> hashmap = {} max_len, dp = (0, 0) for idx, x in enumerate(s): last_idx = hashmap.get(x, -1) hashmap[x] = idx if dp < idx - last_idx: dp += 1 else: dp = idx - last_idx max_len = max(max_le...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def lengthOfLongestSubstring(self, s: str) -> int: """动态规划""" <|body_0|> def lengthOfLongestSubstringSlidingWindows(self, s: str) -> int: """滑动窗口""" <|body_1|> def lengthOfLongestSubstringSlidingWindows2(self, s: str) -> int: """滑动窗口(优化...
stack_v2_sparse_classes_75kplus_train_002545
3,304
no_license
[ { "docstring": "动态规划", "name": "lengthOfLongestSubstring", "signature": "def lengthOfLongestSubstring(self, s: str) -> int" }, { "docstring": "滑动窗口", "name": "lengthOfLongestSubstringSlidingWindows", "signature": "def lengthOfLongestSubstringSlidingWindows(self, s: str) -> int" }, { ...
3
stack_v2_sparse_classes_30k_train_028847
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lengthOfLongestSubstring(self, s: str) -> int: 动态规划 - def lengthOfLongestSubstringSlidingWindows(self, s: str) -> int: 滑动窗口 - def lengthOfLongestSubstringSlidingWindows2(self...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lengthOfLongestSubstring(self, s: str) -> int: 动态规划 - def lengthOfLongestSubstringSlidingWindows(self, s: str) -> int: 滑动窗口 - def lengthOfLongestSubstringSlidingWindows2(self...
52756b30e9d51794591aca030bc918e707f473f1
<|skeleton|> class Solution: def lengthOfLongestSubstring(self, s: str) -> int: """动态规划""" <|body_0|> def lengthOfLongestSubstringSlidingWindows(self, s: str) -> int: """滑动窗口""" <|body_1|> def lengthOfLongestSubstringSlidingWindows2(self, s: str) -> int: """滑动窗口(优化...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def lengthOfLongestSubstring(self, s: str) -> int: """动态规划""" hashmap = {} max_len, dp = (0, 0) for idx, x in enumerate(s): last_idx = hashmap.get(x, -1) hashmap[x] = idx if dp < idx - last_idx: dp += 1 e...
the_stack_v2_python_sparse
3.无重复字符的最长子串/solution.py
QtTao/daily_leetcode
train
0
f9253e6a9ac773fb0e52eee3ed8bc848ce0e7e0d
[ "self.first_name = first_name\nself.last_name = last_name\nself.middle_name = middle_name\nself.fullname = fullname\nself.address = address\nself.address_2 = address_2\nself.city = city\nself.postal_code = postal_code\nself.gender = gender\nself.raw_json = raw_json\nself.request_id = request_id\nself.additional_pro...
<|body_start_0|> self.first_name = first_name self.last_name = last_name self.middle_name = middle_name self.fullname = fullname self.address = address self.address_2 = address_2 self.city = city self.postal_code = postal_code self.gender = gender ...
Implementation of the 'Person.OfficialPersonRegistryResponse' model. TODO: type model description here. Attributes: first_name (string): TODO: type description here. last_name (string): TODO: type description here. middle_name (string): TODO: type description here. fullname (string): TODO: type description here. addres...
PersonOfficialPersonRegistryResponse
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PersonOfficialPersonRegistryResponse: """Implementation of the 'Person.OfficialPersonRegistryResponse' model. TODO: type model description here. Attributes: first_name (string): TODO: type description here. last_name (string): TODO: type description here. middle_name (string): TODO: type descript...
stack_v2_sparse_classes_75kplus_train_002546
4,269
permissive
[ { "docstring": "Constructor for the PersonOfficialPersonRegistryResponse class", "name": "__init__", "signature": "def __init__(self, first_name=None, last_name=None, middle_name=None, fullname=None, address=None, address_2=None, city=None, postal_code=None, gender=None, raw_json=None, request_id=None, ...
2
stack_v2_sparse_classes_30k_train_028949
Implement the Python class `PersonOfficialPersonRegistryResponse` described below. Class description: Implementation of the 'Person.OfficialPersonRegistryResponse' model. TODO: type model description here. Attributes: first_name (string): TODO: type description here. last_name (string): TODO: type description here. mi...
Implement the Python class `PersonOfficialPersonRegistryResponse` described below. Class description: Implementation of the 'Person.OfficialPersonRegistryResponse' model. TODO: type model description here. Attributes: first_name (string): TODO: type description here. last_name (string): TODO: type description here. mi...
fa3918a6c54ea0eedb9146578645b7eb1755b642
<|skeleton|> class PersonOfficialPersonRegistryResponse: """Implementation of the 'Person.OfficialPersonRegistryResponse' model. TODO: type model description here. Attributes: first_name (string): TODO: type description here. last_name (string): TODO: type description here. middle_name (string): TODO: type descript...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PersonOfficialPersonRegistryResponse: """Implementation of the 'Person.OfficialPersonRegistryResponse' model. TODO: type model description here. Attributes: first_name (string): TODO: type description here. last_name (string): TODO: type description here. middle_name (string): TODO: type description here. ful...
the_stack_v2_python_sparse
idfy_rest_client/models/person_official_person_registry_response.py
dealflowteam/Idfy
train
0
f527802f5029eb6b7c7ff35199a6b244b815717b
[ "if not EditDefaultRightPermission.can() and (not EditSpecialRightPermission.can()):\n if current_user.id == profile_id:\n permissions = {action.value: True for action in DEFAULT_ACTIONS}\n permissions.update({p.name: p.is_allowed for p in current_user.permissions_backref.all() if p.is_allowed or A...
<|body_start_0|> if not EditDefaultRightPermission.can() and (not EditSpecialRightPermission.can()): if current_user.id == profile_id: permissions = {action.value: True for action in DEFAULT_ACTIONS} permissions.update({p.name: p.is_allowed for p in current_user.permi...
ProfilePermissionResource
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProfilePermissionResource: def get(self, profile_id): """Get profile permissions * User can view all **their allowed** permissions * User with permission to **"edit default rights"** can view user permissions from **default list** * User with permission to **"edit special rights"** can v...
stack_v2_sparse_classes_75kplus_train_002547
5,086
permissive
[ { "docstring": "Get profile permissions * User can view all **their allowed** permissions * User with permission to **\"edit default rights\"** can view user permissions from **default list** * User with permission to **\"edit special rights\"** can view user permissions from **special list**", "name": "get...
2
stack_v2_sparse_classes_30k_train_023232
Implement the Python class `ProfilePermissionResource` described below. Class description: Implement the ProfilePermissionResource class. Method signatures and docstrings: - def get(self, profile_id): Get profile permissions * User can view all **their allowed** permissions * User with permission to **"edit default r...
Implement the Python class `ProfilePermissionResource` described below. Class description: Implement the ProfilePermissionResource class. Method signatures and docstrings: - def get(self, profile_id): Get profile permissions * User can view all **their allowed** permissions * User with permission to **"edit default r...
dce87ffe395ae4bd08b47f28e07594e1889da819
<|skeleton|> class ProfilePermissionResource: def get(self, profile_id): """Get profile permissions * User can view all **their allowed** permissions * User with permission to **"edit default rights"** can view user permissions from **default list** * User with permission to **"edit special rights"** can v...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ProfilePermissionResource: def get(self, profile_id): """Get profile permissions * User can view all **their allowed** permissions * User with permission to **"edit default rights"** can view user permissions from **default list** * User with permission to **"edit special rights"** can view user permi...
the_stack_v2_python_sparse
src/backend/app/api/public/profiles/profile/profile_permissions.py
aimanow/sft
train
0
d2fa83480e237acc950312da0f4d2398ab49f3d1
[ "self.results['status'] = 1\nself.results['data'] = 'this is a plate!'\nreturn jsonify(self.results)", "args = self._pop_args(args, arglist=['plateid'])\nplate, results = _getPlate(plateid, nocubes=True, **args)\nself.update_results(results)\nif not isinstance(plate, type(None)):\n platedict = {'plateid': plat...
<|body_start_0|> self.results['status'] = 1 self.results['data'] = 'this is a plate!' return jsonify(self.results) <|end_body_0|> <|body_start_1|> args = self._pop_args(args, arglist=['plateid']) plate, results = _getPlate(plateid, nocubes=True, **args) self.update_resul...
Class describing API calls related to plates.
PlateView
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PlateView: """Class describing API calls related to plates.""" def index(self): """Returns general maps info .. :quickref: Plate; Get general plate info :form release: the release of MaNGA data :resjson int status: status of response. 1 if good, -1 if bad. :resjson string error: erro...
stack_v2_sparse_classes_75kplus_train_002548
6,678
permissive
[ { "docstring": "Returns general maps info .. :quickref: Plate; Get general plate info :form release: the release of MaNGA data :resjson int status: status of response. 1 if good, -1 if bad. :resjson string error: error message, null if None :resjson json inconfig: json of incoming configuration :resjson json ut...
3
null
Implement the Python class `PlateView` described below. Class description: Class describing API calls related to plates. Method signatures and docstrings: - def index(self): Returns general maps info .. :quickref: Plate; Get general plate info :form release: the release of MaNGA data :resjson int status: status of re...
Implement the Python class `PlateView` described below. Class description: Class describing API calls related to plates. Method signatures and docstrings: - def index(self): Returns general maps info .. :quickref: Plate; Get general plate info :form release: the release of MaNGA data :resjson int status: status of re...
db4c536a65fb2f16fee05a4f34996a7fd35f0527
<|skeleton|> class PlateView: """Class describing API calls related to plates.""" def index(self): """Returns general maps info .. :quickref: Plate; Get general plate info :form release: the release of MaNGA data :resjson int status: status of response. 1 if good, -1 if bad. :resjson string error: erro...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PlateView: """Class describing API calls related to plates.""" def index(self): """Returns general maps info .. :quickref: Plate; Get general plate info :form release: the release of MaNGA data :resjson int status: status of response. 1 if good, -1 if bad. :resjson string error: error message, nu...
the_stack_v2_python_sparse
python/marvin/api/plate.py
sdss/marvin
train
56
ad112c043252fb4975bd1393214c294bfbb27f78
[ "self.mount_a.run_shell(['mkdir', 'subdir'])\nself.assertEqual(self.mount_a.getfattr('./subdir', 'ceph.quota.max_files'), None)\nself.assertEqual(self.mount_b.getfattr('./subdir', 'ceph.quota.max_files'), None)\nself.mount_a.setfattr('./subdir', 'ceph.quota.max_files', '10')\nself.assertEqual(self.mount_a.getfattr(...
<|body_start_0|> self.mount_a.run_shell(['mkdir', 'subdir']) self.assertEqual(self.mount_a.getfattr('./subdir', 'ceph.quota.max_files'), None) self.assertEqual(self.mount_b.getfattr('./subdir', 'ceph.quota.max_files'), None) self.mount_a.setfattr('./subdir', 'ceph.quota.max_files', '10')...
TestQuota
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestQuota: def test_remote_update_getfattr(self): """That quota changes made from one client are visible to another client looking at ceph.quota xattrs""" <|body_0|> def test_remote_update_df(self): """That when a client modifies the quota on a directory used as anot...
stack_v2_sparse_classes_75kplus_train_002549
3,808
permissive
[ { "docstring": "That quota changes made from one client are visible to another client looking at ceph.quota xattrs", "name": "test_remote_update_getfattr", "signature": "def test_remote_update_getfattr(self)" }, { "docstring": "That when a client modifies the quota on a directory used as another...
3
stack_v2_sparse_classes_30k_train_011121
Implement the Python class `TestQuota` described below. Class description: Implement the TestQuota class. Method signatures and docstrings: - def test_remote_update_getfattr(self): That quota changes made from one client are visible to another client looking at ceph.quota xattrs - def test_remote_update_df(self): Tha...
Implement the Python class `TestQuota` described below. Class description: Implement the TestQuota class. Method signatures and docstrings: - def test_remote_update_getfattr(self): That quota changes made from one client are visible to another client looking at ceph.quota xattrs - def test_remote_update_df(self): Tha...
6a0747b6b79f5ca814afca6cefeb45f52fb9a509
<|skeleton|> class TestQuota: def test_remote_update_getfattr(self): """That quota changes made from one client are visible to another client looking at ceph.quota xattrs""" <|body_0|> def test_remote_update_df(self): """That when a client modifies the quota on a directory used as anot...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestQuota: def test_remote_update_getfattr(self): """That quota changes made from one client are visible to another client looking at ceph.quota xattrs""" self.mount_a.run_shell(['mkdir', 'subdir']) self.assertEqual(self.mount_a.getfattr('./subdir', 'ceph.quota.max_files'), None) ...
the_stack_v2_python_sparse
qa/tasks/cephfs/test_quota.py
SrinivasaBharath/ceph-1
train
0
0edde025936976aa089bd6cf642279cdd08c7033
[ "super().__init__()\nself.image = None\nself.name = ''\nself.color = ''\nself.screen = chess_game.screen\nself.x, self.y = (0.0, 0.0)", "self.rect = self.image.get_rect()\nself.rect.topleft = (self.x, self.y)\nself.screen.blit(self.image, self.rect)" ]
<|body_start_0|> super().__init__() self.image = None self.name = '' self.color = '' self.screen = chess_game.screen self.x, self.y = (0.0, 0.0) <|end_body_0|> <|body_start_1|> self.rect = self.image.get_rect() self.rect.topleft = (self.x, self.y) ...
Represents a chess piece.
Piece
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Piece: """Represents a chess piece.""" def __init__(self, chess_game): """Initialize attributes to represent a ches piece.""" <|body_0|> def blitme(self): """Draw the piece at its current location.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_002550
2,009
permissive
[ { "docstring": "Initialize attributes to represent a ches piece.", "name": "__init__", "signature": "def __init__(self, chess_game)" }, { "docstring": "Draw the piece at its current location.", "name": "blitme", "signature": "def blitme(self)" } ]
2
stack_v2_sparse_classes_30k_train_018428
Implement the Python class `Piece` described below. Class description: Represents a chess piece. Method signatures and docstrings: - def __init__(self, chess_game): Initialize attributes to represent a ches piece. - def blitme(self): Draw the piece at its current location.
Implement the Python class `Piece` described below. Class description: Represents a chess piece. Method signatures and docstrings: - def __init__(self, chess_game): Initialize attributes to represent a ches piece. - def blitme(self): Draw the piece at its current location. <|skeleton|> class Piece: """Represents...
2cb4b45dd14a230aa0e800042e893f8dfb23beda
<|skeleton|> class Piece: """Represents a chess piece.""" def __init__(self, chess_game): """Initialize attributes to represent a ches piece.""" <|body_0|> def blitme(self): """Draw the piece at its current location.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Piece: """Represents a chess piece.""" def __init__(self, chess_game): """Initialize attributes to represent a ches piece.""" super().__init__() self.image = None self.name = '' self.color = '' self.screen = chess_game.screen self.x, self.y = (0.0, ...
the_stack_v2_python_sparse
MY_REPOS/Lambda-Resource-Static-Assets/2-resources/BLOG/Python/pcc_2e-master/beyond_pcc/chess_game/chess_set.py
bgoonz/UsefulResourceRepo2.0
train
10
03196855ad0052f6a2694db96c11224dafa9a81d
[ "if not hasattr(cls, '_instance'):\n with cls._instance_lock:\n if not hasattr(cls, '_instance'):\n cls._instance = object.__new__(cls)\nreturn cls._instance", "self.common = Common()\ntry:\n log_path = self.common.get_result_path('result.log')\n self.logger = logging.getLogger()\n s...
<|body_start_0|> if not hasattr(cls, '_instance'): with cls._instance_lock: if not hasattr(cls, '_instance'): cls._instance = object.__new__(cls) return cls._instance <|end_body_0|> <|body_start_1|> self.common = Common() try: ...
Log
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Log: def __new__(cls, *args, **kwargs): """单例模式(支持多线程)""" <|body_0|> def __init__(self): """配置日志数据""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not hasattr(cls, '_instance'): with cls._instance_lock: if not hasattr(...
stack_v2_sparse_classes_75kplus_train_002551
6,658
no_license
[ { "docstring": "单例模式(支持多线程)", "name": "__new__", "signature": "def __new__(cls, *args, **kwargs)" }, { "docstring": "配置日志数据", "name": "__init__", "signature": "def __init__(self)" } ]
2
null
Implement the Python class `Log` described below. Class description: Implement the Log class. Method signatures and docstrings: - def __new__(cls, *args, **kwargs): 单例模式(支持多线程) - def __init__(self): 配置日志数据
Implement the Python class `Log` described below. Class description: Implement the Log class. Method signatures and docstrings: - def __new__(cls, *args, **kwargs): 单例模式(支持多线程) - def __init__(self): 配置日志数据 <|skeleton|> class Log: def __new__(cls, *args, **kwargs): """单例模式(支持多线程)""" <|body_0|> ...
c6f1f8cef08107b6a791b7be16b008677cac69ba
<|skeleton|> class Log: def __new__(cls, *args, **kwargs): """单例模式(支持多线程)""" <|body_0|> def __init__(self): """配置日志数据""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Log: def __new__(cls, *args, **kwargs): """单例模式(支持多线程)""" if not hasattr(cls, '_instance'): with cls._instance_lock: if not hasattr(cls, '_instance'): cls._instance = object.__new__(cls) return cls._instance def __init__(self): ...
the_stack_v2_python_sparse
NT/common/log.py
lm2579250/auto_test_python
train
0
a380af8b06f859908c3182ff1eaffe3a48b14fff
[ "self.n_sent = 1\nself.data = data\nself.empty = False\nagg_func = lambda s: [(w, p, t) for w, p, t in zip(s['Word'].values.tolist(), s['POS'].values.tolist(), s['Tag'].values.tolist())]\nself.grouped = self.data.groupby('Sentence #').apply(agg_func)\nself.sentences = [s for s in self.grouped]", "try:\n s = se...
<|body_start_0|> self.n_sent = 1 self.data = data self.empty = False agg_func = lambda s: [(w, p, t) for w, p, t in zip(s['Word'].values.tolist(), s['POS'].values.tolist(), s['Tag'].values.tolist())] self.grouped = self.data.groupby('Sentence #').apply(agg_func) self.sent...
SentenceGetter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SentenceGetter: def __init__(self, data): """Args: data is the pandas.DataFrame which contains the above dataset""" <|body_0|> def get_next(self): """Return one sentence""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.n_sent = 1 self.da...
stack_v2_sparse_classes_75kplus_train_002552
6,255
no_license
[ { "docstring": "Args: data is the pandas.DataFrame which contains the above dataset", "name": "__init__", "signature": "def __init__(self, data)" }, { "docstring": "Return one sentence", "name": "get_next", "signature": "def get_next(self)" } ]
2
stack_v2_sparse_classes_30k_train_021746
Implement the Python class `SentenceGetter` described below. Class description: Implement the SentenceGetter class. Method signatures and docstrings: - def __init__(self, data): Args: data is the pandas.DataFrame which contains the above dataset - def get_next(self): Return one sentence
Implement the Python class `SentenceGetter` described below. Class description: Implement the SentenceGetter class. Method signatures and docstrings: - def __init__(self, data): Args: data is the pandas.DataFrame which contains the above dataset - def get_next(self): Return one sentence <|skeleton|> class SentenceGe...
bf09d7700766706ff27b83ef68de6dc5e77f90aa
<|skeleton|> class SentenceGetter: def __init__(self, data): """Args: data is the pandas.DataFrame which contains the above dataset""" <|body_0|> def get_next(self): """Return one sentence""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SentenceGetter: def __init__(self, data): """Args: data is the pandas.DataFrame which contains the above dataset""" self.n_sent = 1 self.data = data self.empty = False agg_func = lambda s: [(w, p, t) for w, p, t in zip(s['Word'].values.tolist(), s['POS'].values.tolist()...
the_stack_v2_python_sparse
icd10_model.py
mfshiu/ner_bilstm
train
0
da94067534fe0d909b4cddfb4a5d47467b9dd595
[ "global COMPANY_CONN\ncursor = None\ntry:\n cursor = COMPANY_CONN.cursor(buffered=True, dictionary=True)\n sql = 'INSERT INTO lie_goods' + '(cat_id, items_id, goods_sn, goods_name, brand_id,' + 'min_buynum, goods_desc) ' + 'VALUES(%(cat_id)s, %(items_id)s, %(goods_sn)s,%(goods_name)s, %(brand_id)s, %(min_buyn...
<|body_start_0|> global COMPANY_CONN cursor = None try: cursor = COMPANY_CONN.cursor(buffered=True, dictionary=True) sql = 'INSERT INTO lie_goods' + '(cat_id, items_id, goods_sn, goods_name, brand_id,' + 'min_buynum, goods_desc) ' + 'VALUES(%(cat_id)s, %(items_id)s, %(goo...
LieGoods
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LieGoods: def addLieGoods(cls, lieGoods): """method: addLieGoods params: lieGoods-type: LieGoods""" <|body_0|> def get_goods_id_by_goods_sn(cls, goods_sn_md5): """method: get_goods_id_by_goods_sn params: goods_sn_md5-type: str return: goods_id return-type: int""" ...
stack_v2_sparse_classes_75kplus_train_002553
13,174
no_license
[ { "docstring": "method: addLieGoods params: lieGoods-type: LieGoods", "name": "addLieGoods", "signature": "def addLieGoods(cls, lieGoods)" }, { "docstring": "method: get_goods_id_by_goods_sn params: goods_sn_md5-type: str return: goods_id return-type: int", "name": "get_goods_id_by_goods_sn"...
2
stack_v2_sparse_classes_30k_train_034354
Implement the Python class `LieGoods` described below. Class description: Implement the LieGoods class. Method signatures and docstrings: - def addLieGoods(cls, lieGoods): method: addLieGoods params: lieGoods-type: LieGoods - def get_goods_id_by_goods_sn(cls, goods_sn_md5): method: get_goods_id_by_goods_sn params: go...
Implement the Python class `LieGoods` described below. Class description: Implement the LieGoods class. Method signatures and docstrings: - def addLieGoods(cls, lieGoods): method: addLieGoods params: lieGoods-type: LieGoods - def get_goods_id_by_goods_sn(cls, goods_sn_md5): method: get_goods_id_by_goods_sn params: go...
1e49a6e13ea4b11427f47999c13a609be9ae3ecf
<|skeleton|> class LieGoods: def addLieGoods(cls, lieGoods): """method: addLieGoods params: lieGoods-type: LieGoods""" <|body_0|> def get_goods_id_by_goods_sn(cls, goods_sn_md5): """method: get_goods_id_by_goods_sn params: goods_sn_md5-type: str return: goods_id return-type: int""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LieGoods: def addLieGoods(cls, lieGoods): """method: addLieGoods params: lieGoods-type: LieGoods""" global COMPANY_CONN cursor = None try: cursor = COMPANY_CONN.cursor(buffered=True, dictionary=True) sql = 'INSERT INTO lie_goods' + '(cat_id, items_id, go...
the_stack_v2_python_sparse
rsonline/server/db/company/mysql_client.py
yunhao-qing/PythonScrapy
train
0
1a55c6789e5d75c60c38e232bfa5b6b43938252d
[ "if len(s) < 2:\n return s\nss = s + '#' + s[::-1]\nlength, M = (0, len(ss))\ni, lps = (1, [0] * M)\nwhile i < M:\n if ss[i] == ss[length]:\n length += 1\n lps[i] = length\n i += 1\n elif length == 0:\n lps[i] = 0\n i += 1\n else:\n length = lps[length - 1]\nret...
<|body_start_0|> if len(s) < 2: return s ss = s + '#' + s[::-1] length, M = (0, len(ss)) i, lps = (1, [0] * M) while i < M: if ss[i] == ss[length]: length += 1 lps[i] = length i += 1 elif length =...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def shortestPalindrome(self, s): """:type s: str :rtype: str""" <|body_0|> def shortestPalindrome2(self, s): """:type s: str :rtype: str""" <|body_1|> <|end_skeleton|> <|body_start_0|> if len(s) < 2: return s ss = s + '...
stack_v2_sparse_classes_75kplus_train_002554
2,505
no_license
[ { "docstring": ":type s: str :rtype: str", "name": "shortestPalindrome", "signature": "def shortestPalindrome(self, s)" }, { "docstring": ":type s: str :rtype: str", "name": "shortestPalindrome2", "signature": "def shortestPalindrome2(self, s)" } ]
2
stack_v2_sparse_classes_30k_train_039348
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def shortestPalindrome(self, s): :type s: str :rtype: str - def shortestPalindrome2(self, s): :type s: str :rtype: str
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def shortestPalindrome(self, s): :type s: str :rtype: str - def shortestPalindrome2(self, s): :type s: str :rtype: str <|skeleton|> class Solution: def shortestPalindrome(s...
635af6e22aa8eef8e7920a585d43a45a891a8157
<|skeleton|> class Solution: def shortestPalindrome(self, s): """:type s: str :rtype: str""" <|body_0|> def shortestPalindrome2(self, s): """:type s: str :rtype: str""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def shortestPalindrome(self, s): """:type s: str :rtype: str""" if len(s) < 2: return s ss = s + '#' + s[::-1] length, M = (0, len(ss)) i, lps = (1, [0] * M) while i < M: if ss[i] == ss[length]: length += 1 ...
the_stack_v2_python_sparse
code214ShortestPalindrome.py
cybelewang/leetcode-python
train
0
8163dd216eceb76b5ecaf1e6019d25e96bf65901
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn KubernetesNamespaceEvidence()", "from .alert_evidence import AlertEvidence\nfrom .dictionary import Dictionary\nfrom .kubernetes_cluster_evidence import KubernetesClusterEvidence\nfrom .alert_evidence import AlertEvidence\nfrom .dictio...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return KubernetesNamespaceEvidence() <|end_body_0|> <|body_start_1|> from .alert_evidence import AlertEvidence from .dictionary import Dictionary from .kubernetes_cluster_evidence impor...
KubernetesNamespaceEvidence
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KubernetesNamespaceEvidence: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> KubernetesNamespaceEvidence: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value a...
stack_v2_sparse_classes_75kplus_train_002555
2,916
permissive
[ { "docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: KubernetesNamespaceEvidence", "name": "create_from_discriminator_value", "signature": "def create_from_discr...
3
null
Implement the Python class `KubernetesNamespaceEvidence` described below. Class description: Implement the KubernetesNamespaceEvidence class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> KubernetesNamespaceEvidence: Creates a new instance of the appr...
Implement the Python class `KubernetesNamespaceEvidence` described below. Class description: Implement the KubernetesNamespaceEvidence class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> KubernetesNamespaceEvidence: Creates a new instance of the appr...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class KubernetesNamespaceEvidence: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> KubernetesNamespaceEvidence: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value a...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class KubernetesNamespaceEvidence: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> KubernetesNamespaceEvidence: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the ...
the_stack_v2_python_sparse
msgraph/generated/models/security/kubernetes_namespace_evidence.py
microsoftgraph/msgraph-sdk-python
train
135
48b9789fb5808e7e8fe03e2b8c2c7fa1f47145ce
[ "response = requests.get(cls.search_url, params=query, allow_redirects=False)\n_response_error_handler(response.status_code, response.text)\nreturn response.json()", "res: [Dict] = []\nfor page_num in range(num_of_pages):\n query['page'] = page_num\n page = cls.execute_query(query)\n for dct in page['dat...
<|body_start_0|> response = requests.get(cls.search_url, params=query, allow_redirects=False) _response_error_handler(response.status_code, response.text) return response.json() <|end_body_0|> <|body_start_1|> res: [Dict] = [] for page_num in range(num_of_pages): que...
Rapid7 vulnerability database Search API ETL utilities.
Search
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Search: """Rapid7 vulnerability database Search API ETL utilities.""" def execute_query(cls, query: Dict) -> Dict: """Executes API query by sending a request to API and extracting the result as a python data structure :param query: free form text :return: Data as dictionary""" ...
stack_v2_sparse_classes_75kplus_train_002556
5,775
permissive
[ { "docstring": "Executes API query by sending a request to API and extracting the result as a python data structure :param query: free form text :return: Data as dictionary", "name": "execute_query", "signature": "def execute_query(cls, query: Dict) -> Dict" }, { "docstring": "Iterates over avai...
4
stack_v2_sparse_classes_30k_train_046119
Implement the Python class `Search` described below. Class description: Rapid7 vulnerability database Search API ETL utilities. Method signatures and docstrings: - def execute_query(cls, query: Dict) -> Dict: Executes API query by sending a request to API and extracting the result as a python data structure :param qu...
Implement the Python class `Search` described below. Class description: Rapid7 vulnerability database Search API ETL utilities. Method signatures and docstrings: - def execute_query(cls, query: Dict) -> Dict: Executes API query by sending a request to API and extracting the result as a python data structure :param qu...
718d15ca36c57231bb89df0aebc53d0210db400c
<|skeleton|> class Search: """Rapid7 vulnerability database Search API ETL utilities.""" def execute_query(cls, query: Dict) -> Dict: """Executes API query by sending a request to API and extracting the result as a python data structure :param query: free form text :return: Data as dictionary""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Search: """Rapid7 vulnerability database Search API ETL utilities.""" def execute_query(cls, query: Dict) -> Dict: """Executes API query by sending a request to API and extracting the result as a python data structure :param query: free form text :return: Data as dictionary""" response = ...
the_stack_v2_python_sparse
plugins/rapid7_vulndb/komand_rapid7_vulndb/util/extract.py
rapid7/insightconnect-plugins
train
61
6b04bb6d719f32a86b1bc83ce357179226385ced
[ "self.kl_weight = 1e-08\nself.num_hypotheses = num_hypotheses\nself.outputs = outputs\nif weights is None:\n self.weights = [1.0] * len(self.outputs)\nelse:\n self.weights = weights\nif stats is not None and len(stats) > 0:\n if len(stats) == 1:\n stats = stats * self.num_hypotheses\n self.st...
<|body_start_0|> self.kl_weight = 1e-08 self.num_hypotheses = num_hypotheses self.outputs = outputs if weights is None: self.weights = [1.0] * len(self.outputs) else: self.weights = weights if stats is not None and len(stats) > 0: if le...
This version of the MHP loss assumes that it will receive multiple outputs.
MhpLossWithShape
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MhpLossWithShape: """This version of the MHP loss assumes that it will receive multiple outputs.""" def __init__(self, num_hypotheses, outputs, weights=None, loss='mse', avg_weight=0.05, stats=[]): """Parameters: ----------- num_hypotheses: number of hypotheses outputs: length of eac...
stack_v2_sparse_classes_75kplus_train_002557
7,780
permissive
[ { "docstring": "Parameters: ----------- num_hypotheses: number of hypotheses outputs: length of each output weights: None or vector of weights for each target loss: loss function or vector of loss function names to use (keras) avg_weight: amount of weight to give to average loss across all hypotheses stats: mea...
2
stack_v2_sparse_classes_30k_train_037468
Implement the Python class `MhpLossWithShape` described below. Class description: This version of the MHP loss assumes that it will receive multiple outputs. Method signatures and docstrings: - def __init__(self, num_hypotheses, outputs, weights=None, loss='mse', avg_weight=0.05, stats=[]): Parameters: ----------- nu...
Implement the Python class `MhpLossWithShape` described below. Class description: This version of the MHP loss assumes that it will receive multiple outputs. Method signatures and docstrings: - def __init__(self, num_hypotheses, outputs, weights=None, loss='mse', avg_weight=0.05, stats=[]): Parameters: ----------- nu...
be5c12f9d0e9d7078e6a5c283d3be059e7f3d040
<|skeleton|> class MhpLossWithShape: """This version of the MHP loss assumes that it will receive multiple outputs.""" def __init__(self, num_hypotheses, outputs, weights=None, loss='mse', avg_weight=0.05, stats=[]): """Parameters: ----------- num_hypotheses: number of hypotheses outputs: length of eac...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MhpLossWithShape: """This version of the MHP loss assumes that it will receive multiple outputs.""" def __init__(self, num_hypotheses, outputs, weights=None, loss='mse', avg_weight=0.05, stats=[]): """Parameters: ----------- num_hypotheses: number of hypotheses outputs: length of each output weig...
the_stack_v2_python_sparse
costar_models/python/costar_models/mhp_loss.py
lk-greenbird/costar_plan
train
0
2c53abd0954b5f913b94224c855276f3677095e3
[ "str2int = np.zeros((row, column))\nline = 0\nfor idx, value in enumerate(maze):\n if (idx != 0) & (value == '\\n'):\n line = line + 1\n elif value == '.':\n str2int[line][idx % (column + 1) - 1] = 1\nreturn str2int", "int2str = ''\nx, y = maze.shape\nfor i in range(0, x):\n for j in range(...
<|body_start_0|> str2int = np.zeros((row, column)) line = 0 for idx, value in enumerate(maze): if (idx != 0) & (value == '\n'): line = line + 1 elif value == '.': str2int[line][idx % (column + 1) - 1] = 1 return str2int <|end_body_0...
conversor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class conversor: def conv_str2int(row, column, maze): """Function to convert string to int. We have big string with * | breakline caracter is very hard to see how to process this format (not impossible) but more difficult to see. Args: row (int): number of line (use number without subtract as ...
stack_v2_sparse_classes_75kplus_train_002558
2,464
no_license
[ { "docstring": "Function to convert string to int. We have big string with * | breakline caracter is very hard to see how to process this format (not impossible) but more difficult to see. Args: row (int): number of line (use number without subtract as index) column (int): number of column (use number without s...
2
stack_v2_sparse_classes_30k_train_021965
Implement the Python class `conversor` described below. Class description: Implement the conversor class. Method signatures and docstrings: - def conv_str2int(row, column, maze): Function to convert string to int. We have big string with * | breakline caracter is very hard to see how to process this format (not impos...
Implement the Python class `conversor` described below. Class description: Implement the conversor class. Method signatures and docstrings: - def conv_str2int(row, column, maze): Function to convert string to int. We have big string with * | breakline caracter is very hard to see how to process this format (not impos...
71fca6995e19930ecc56aff297c35a3a4228b6ce
<|skeleton|> class conversor: def conv_str2int(row, column, maze): """Function to convert string to int. We have big string with * | breakline caracter is very hard to see how to process this format (not impossible) but more difficult to see. Args: row (int): number of line (use number without subtract as ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class conversor: def conv_str2int(row, column, maze): """Function to convert string to int. We have big string with * | breakline caracter is very hard to see how to process this format (not impossible) but more difficult to see. Args: row (int): number of line (use number without subtract as index) column ...
the_stack_v2_python_sparse
tools/conversor.py
giovanedemorais/pac_man_intelligence
train
0
e6fcededbfd5e5af9392bc246fc7de3efdcfaff1
[ "strategy = Strategy.objects.get(pk=pk)\nstrategy = Strategy.describe_strategies([strategy], verbose=Strategy.MAX_VERBOSE)[0]\nreturn Response({'data': {'strategy': strategy}})", "strategy = Strategy.objects.get(pk=pk)\nserializer = StrategyCreateUpdateSerializer(strategy, data=request.data, partial=True, context...
<|body_start_0|> strategy = Strategy.objects.get(pk=pk) strategy = Strategy.describe_strategies([strategy], verbose=Strategy.MAX_VERBOSE)[0] return Response({'data': {'strategy': strategy}}) <|end_body_0|> <|body_start_1|> strategy = Strategy.objects.get(pk=pk) serializer = Stra...
SingleStrategyAPIView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SingleStrategyAPIView: def get(request, pk): """获取策略详情""" <|body_0|> def put(request, pk): """修改策略""" <|body_1|> def delete(request, pk): """删除策略""" <|body_2|> <|end_skeleton|> <|body_start_0|> strategy = Strategy.objects.get(pk...
stack_v2_sparse_classes_75kplus_train_002559
9,461
no_license
[ { "docstring": "获取策略详情", "name": "get", "signature": "def get(request, pk)" }, { "docstring": "修改策略", "name": "put", "signature": "def put(request, pk)" }, { "docstring": "删除策略", "name": "delete", "signature": "def delete(request, pk)" } ]
3
stack_v2_sparse_classes_30k_train_030812
Implement the Python class `SingleStrategyAPIView` described below. Class description: Implement the SingleStrategyAPIView class. Method signatures and docstrings: - def get(request, pk): 获取策略详情 - def put(request, pk): 修改策略 - def delete(request, pk): 删除策略
Implement the Python class `SingleStrategyAPIView` described below. Class description: Implement the SingleStrategyAPIView class. Method signatures and docstrings: - def get(request, pk): 获取策略详情 - def put(request, pk): 修改策略 - def delete(request, pk): 删除策略 <|skeleton|> class SingleStrategyAPIView: def get(reques...
bb85b52598d68956bde8756c8321ade7b8479ba7
<|skeleton|> class SingleStrategyAPIView: def get(request, pk): """获取策略详情""" <|body_0|> def put(request, pk): """修改策略""" <|body_1|> def delete(request, pk): """删除策略""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SingleStrategyAPIView: def get(request, pk): """获取策略详情""" strategy = Strategy.objects.get(pk=pk) strategy = Strategy.describe_strategies([strategy], verbose=Strategy.MAX_VERBOSE)[0] return Response({'data': {'strategy': strategy}}) def put(request, pk): """修改策略""" ...
the_stack_v2_python_sparse
curd_test/configure/views.py
huiiiuh/huihuiproject
train
0
1d5ececaad97388d14212fe9610474b2f6773501
[ "requests_store = RequestJsonStore()\nrequests_store.empty_store()\nkeys_store = KeysJsonStore()\nkeys_store.empty_store()\nmy_manager = AccessManager()\nprint('one')\nmy_manager.request_access_code('05270358T', 'Pedro Martin', 'Resident', 'uc3m@gmail.com', 0)\nprint('two')\nmy_manager.request_access_code('87654123...
<|body_start_0|> requests_store = RequestJsonStore() requests_store.empty_store() keys_store = KeysJsonStore() keys_store.empty_store() my_manager = AccessManager() print('one') my_manager.request_access_code('05270358T', 'Pedro Martin', 'Resident', 'uc3m@gmail.co...
Test class for testing get_access_key
TestAccessManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestAccessManager: """Test class for testing get_access_key""" def setUpClass(cls) -> None: """Removing the Stores and creating required AccessRequest for testing""" <|body_0|> def test_parametrized_cases_tests(self): """Parametrized cases read from testingCases_...
stack_v2_sparse_classes_75kplus_train_002560
2,525
no_license
[ { "docstring": "Removing the Stores and creating required AccessRequest for testing", "name": "setUpClass", "signature": "def setUpClass(cls) -> None" }, { "docstring": "Parametrized cases read from testingCases_RF1.csv", "name": "test_parametrized_cases_tests", "signature": "def test_pa...
2
stack_v2_sparse_classes_30k_train_007660
Implement the Python class `TestAccessManager` described below. Class description: Test class for testing get_access_key Method signatures and docstrings: - def setUpClass(cls) -> None: Removing the Stores and creating required AccessRequest for testing - def test_parametrized_cases_tests(self): Parametrized cases re...
Implement the Python class `TestAccessManager` described below. Class description: Test class for testing get_access_key Method signatures and docstrings: - def setUpClass(cls) -> None: Removing the Stores and creating required AccessRequest for testing - def test_parametrized_cases_tests(self): Parametrized cases re...
113c49682a63736666b95d423d9b26ab3e35d980
<|skeleton|> class TestAccessManager: """Test class for testing get_access_key""" def setUpClass(cls) -> None: """Removing the Stores and creating required AccessRequest for testing""" <|body_0|> def test_parametrized_cases_tests(self): """Parametrized cases read from testingCases_...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestAccessManager: """Test class for testing get_access_key""" def setUpClass(cls) -> None: """Removing the Stores and creating required AccessRequest for testing""" requests_store = RequestJsonStore() requests_store.empty_store() keys_store = KeysJsonStore() keys_...
the_stack_v2_python_sparse
src/unittest/python/test_get_access_key_tests.py
ncoress/G80.T7.FP
train
0
530401e131941f75c3b56d95fe57b246761f270d
[ "super().__init__()\nself.name = 'session-' + secrets.token_hex(16)\nself.port = random.randint(1024, 65535)\nself.api_instance.create_namespaced_pod(body={'apiVersion': 'v1', 'kind': 'Pod', 'metadata': {'name': self.name}, 'spec': {'containers': [{'name': 'executa', 'image': 'stencila/executa', 'args': ['executa',...
<|body_start_0|> super().__init__() self.name = 'session-' + secrets.token_hex(16) self.port = random.randint(1024, 65535) self.api_instance.create_namespaced_pod(body={'apiVersion': 'v1', 'kind': 'Pod', 'metadata': {'name': self.name}, 'spec': {'containers': [{'name': 'executa', 'image'...
Runs a session as a pod in a Kubernetes cluster. This class in intended for scalably provisioning untrusted sessions. It uses the K8s API to create a new pod inside a cluster, possible the same cluster this process is in.
KubernetesSession
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KubernetesSession: """Runs a session as a pod in a Kubernetes cluster. This class in intended for scalably provisioning untrusted sessions. It uses the K8s API to create a new pod inside a cluster, possible the same cluster this process is in.""" def __init__(self): """Create a sessi...
stack_v2_sparse_classes_75kplus_train_002561
3,424
permissive
[ { "docstring": "Create a session.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Start the session.", "name": "start", "signature": "def start(self)" }, { "docstring": "Stop the session.", "name": "stop", "signature": "def stop(self)" } ]
3
stack_v2_sparse_classes_30k_train_035010
Implement the Python class `KubernetesSession` described below. Class description: Runs a session as a pod in a Kubernetes cluster. This class in intended for scalably provisioning untrusted sessions. It uses the K8s API to create a new pod inside a cluster, possible the same cluster this process is in. Method signat...
Implement the Python class `KubernetesSession` described below. Class description: Runs a session as a pod in a Kubernetes cluster. This class in intended for scalably provisioning untrusted sessions. It uses the K8s API to create a new pod inside a cluster, possible the same cluster this process is in. Method signat...
47c6377ccbfe8576b35854053d726537e533e78c
<|skeleton|> class KubernetesSession: """Runs a session as a pod in a Kubernetes cluster. This class in intended for scalably provisioning untrusted sessions. It uses the K8s API to create a new pod inside a cluster, possible the same cluster this process is in.""" def __init__(self): """Create a sessi...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class KubernetesSession: """Runs a session as a pod in a Kubernetes cluster. This class in intended for scalably provisioning untrusted sessions. It uses the K8s API to create a new pod inside a cluster, possible the same cluster this process is in.""" def __init__(self): """Create a session.""" ...
the_stack_v2_python_sparse
worker/jobs/session/kubernetes_session.py
gxf1986/hub
train
0
3733e3552366139eaa276f01fcf12ba402b615d2
[ "self.hass = hass\nself.webhook_id = webhook_id\nself.support_confirm = support_confirm\nself._send_message = send_message\nself.on_teardown = on_teardown\nself.pending_confirms: dict[str, dict] = {}", "if not self.support_confirm:\n self._send_message(data)\n return\nconfirm_id = random_uuid_hex()\ndata['h...
<|body_start_0|> self.hass = hass self.webhook_id = webhook_id self.support_confirm = support_confirm self._send_message = send_message self.on_teardown = on_teardown self.pending_confirms: dict[str, dict] = {} <|end_body_0|> <|body_start_1|> if not self.support_...
Class that represents a push channel.
PushChannel
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PushChannel: """Class that represents a push channel.""" def __init__(self, hass: HomeAssistant, webhook_id: str, support_confirm: bool, send_message: Callable[[dict], None], on_teardown: Callable[[], None]) -> None: """Initialize a local push channel.""" <|body_0|> def ...
stack_v2_sparse_classes_75kplus_train_002562
2,897
permissive
[ { "docstring": "Initialize a local push channel.", "name": "__init__", "signature": "def __init__(self, hass: HomeAssistant, webhook_id: str, support_confirm: bool, send_message: Callable[[dict], None], on_teardown: Callable[[], None]) -> None" }, { "docstring": "Send a push notification.", ...
4
stack_v2_sparse_classes_30k_train_007522
Implement the Python class `PushChannel` described below. Class description: Class that represents a push channel. Method signatures and docstrings: - def __init__(self, hass: HomeAssistant, webhook_id: str, support_confirm: bool, send_message: Callable[[dict], None], on_teardown: Callable[[], None]) -> None: Initial...
Implement the Python class `PushChannel` described below. Class description: Class that represents a push channel. Method signatures and docstrings: - def __init__(self, hass: HomeAssistant, webhook_id: str, support_confirm: bool, send_message: Callable[[dict], None], on_teardown: Callable[[], None]) -> None: Initial...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class PushChannel: """Class that represents a push channel.""" def __init__(self, hass: HomeAssistant, webhook_id: str, support_confirm: bool, send_message: Callable[[dict], None], on_teardown: Callable[[], None]) -> None: """Initialize a local push channel.""" <|body_0|> def ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PushChannel: """Class that represents a push channel.""" def __init__(self, hass: HomeAssistant, webhook_id: str, support_confirm: bool, send_message: Callable[[dict], None], on_teardown: Callable[[], None]) -> None: """Initialize a local push channel.""" self.hass = hass self.web...
the_stack_v2_python_sparse
homeassistant/components/mobile_app/push_notification.py
home-assistant/core
train
35,501
b725f242753dfb7e4e8a2df4e17c5f10d28b939a
[ "self.gateway = gateway\nself.status = status\nself.pgid = pgid\nself.created_at = created_at\nself.updated_at = updated_at", "if dictionary is None:\n return None\ngateway = dictionary.get('gateway')\nstatus = dictionary.get('status')\npgid = dictionary.get('pgid')\ncreated_at = dictionary.get('created_at')\n...
<|body_start_0|> self.gateway = gateway self.status = status self.pgid = pgid self.created_at = created_at self.updated_at = updated_at <|end_body_0|> <|body_start_1|> if dictionary is None: return None gateway = dictionary.get('gateway') stat...
Implementation of the 'GetGatewayRecipientResponse' model. Information about the recipient on the gateway Attributes: gateway (string): Gateway name status (string): Status of the recipient on the gateway pgid (string): Recipient id on the gateway created_at (string): Creation date updated_at (string): Last update date
GetGatewayRecipientResponse
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GetGatewayRecipientResponse: """Implementation of the 'GetGatewayRecipientResponse' model. Information about the recipient on the gateway Attributes: gateway (string): Gateway name status (string): Status of the recipient on the gateway pgid (string): Recipient id on the gateway created_at (strin...
stack_v2_sparse_classes_75kplus_train_002563
2,328
permissive
[ { "docstring": "Constructor for the GetGatewayRecipientResponse class", "name": "__init__", "signature": "def __init__(self, gateway=None, status=None, pgid=None, created_at=None, updated_at=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionar...
2
null
Implement the Python class `GetGatewayRecipientResponse` described below. Class description: Implementation of the 'GetGatewayRecipientResponse' model. Information about the recipient on the gateway Attributes: gateway (string): Gateway name status (string): Status of the recipient on the gateway pgid (string): Recipi...
Implement the Python class `GetGatewayRecipientResponse` described below. Class description: Implementation of the 'GetGatewayRecipientResponse' model. Information about the recipient on the gateway Attributes: gateway (string): Gateway name status (string): Status of the recipient on the gateway pgid (string): Recipi...
95c80c35dd57bb2a238faeaf30d1e3b4544d2298
<|skeleton|> class GetGatewayRecipientResponse: """Implementation of the 'GetGatewayRecipientResponse' model. Information about the recipient on the gateway Attributes: gateway (string): Gateway name status (string): Status of the recipient on the gateway pgid (string): Recipient id on the gateway created_at (strin...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GetGatewayRecipientResponse: """Implementation of the 'GetGatewayRecipientResponse' model. Information about the recipient on the gateway Attributes: gateway (string): Gateway name status (string): Status of the recipient on the gateway pgid (string): Recipient id on the gateway created_at (string): Creation ...
the_stack_v2_python_sparse
mundiapi/models/get_gateway_recipient_response.py
mundipagg/MundiAPI-PYTHON
train
10
063d8012ff430f51f55f6ab2552261a2e0f0d1de
[ "payment = order.payments.first() or self.create_pending_payment(order)\nif order_id or authorization:\n payment.data['capture'] = {'order_id': order_id or '', 'authorization': authorization or {}, 'method': self.key}\n payment.save()\nreturn payment", "payment = self.get_or_create_pending_payment(order, or...
<|body_start_0|> payment = order.payments.first() or self.create_pending_payment(order) if order_id or authorization: payment.data['capture'] = {'order_id': order_id or '', 'authorization': authorization or {}, 'method': self.key} payment.save() return payment <|end_body_...
Single payment processor Processes Paypal's single payment. A single payment means the client has authorized & executed the payment. We receive an authorization code that we check back with Paypal. If the authorization is confirmed by Paypal, the SinglePaymentProcessor updates Plata's payment status to OrderPayment.PRO...
SinglePaymentProcessor
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SinglePaymentProcessor: """Single payment processor Processes Paypal's single payment. A single payment means the client has authorized & executed the payment. We receive an authorization code that we check back with Paypal. If the authorization is confirmed by Paypal, the SinglePaymentProcessor ...
stack_v2_sparse_classes_75kplus_train_002564
3,820
permissive
[ { "docstring": "retrieve order, or create pending Retrieve the first payment known for this order, or create a pending payment. Stores the order_id and authorization data. :param order: Plata order instance :param order_id: Paypal provider order id :param authorization: Paypal provider authorization", "name...
2
stack_v2_sparse_classes_30k_train_007764
Implement the Python class `SinglePaymentProcessor` described below. Class description: Single payment processor Processes Paypal's single payment. A single payment means the client has authorized & executed the payment. We receive an authorization code that we check back with Paypal. If the authorization is confirmed...
Implement the Python class `SinglePaymentProcessor` described below. Class description: Single payment processor Processes Paypal's single payment. A single payment means the client has authorized & executed the payment. We receive an authorization code that we check back with Paypal. If the authorization is confirmed...
b6abdd7d26f0d4d4acd2c9bef0c593b874ba5b0c
<|skeleton|> class SinglePaymentProcessor: """Single payment processor Processes Paypal's single payment. A single payment means the client has authorized & executed the payment. We receive an authorization code that we check back with Paypal. If the authorization is confirmed by Paypal, the SinglePaymentProcessor ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SinglePaymentProcessor: """Single payment processor Processes Paypal's single payment. A single payment means the client has authorized & executed the payment. We receive an authorization code that we check back with Paypal. If the authorization is confirmed by Paypal, the SinglePaymentProcessor updates Plata...
the_stack_v2_python_sparse
platarestapi/processor/paypal/single.py
miraculixx/plata-restapi
train
0
77c065cc5c558fc27d58151be4e0989edba647b5
[ "login_page.LoginPage(self.driver).login()\nsleep(2)\nlandlord_nav_page.LandlordNavPage(self.driver).Iamlandlord()\nsleep(2)\nlandlord_nav_page.LandlordNavPage(self.driver).close_weiChat()\nsleep(2)\nlandlord_nav_page.LandlordNavPage(self.driver).roommanager()\npo = landlord_online_editdata.LandlordOnlineEditdata(s...
<|body_start_0|> login_page.LoginPage(self.driver).login() sleep(2) landlord_nav_page.LandlordNavPage(self.driver).Iamlandlord() sleep(2) landlord_nav_page.LandlordNavPage(self.driver).close_weiChat() sleep(2) landlord_nav_page.LandlordNavPage(self.driver).roomman...
房源图片
TestEditdataFypic
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestEditdataFypic: """房源图片""" def test_del_pic(self): """修改房源图片——上传图片和删除图片""" <|body_0|> def test_setcover(self): """设为封面""" <|body_1|> <|end_skeleton|> <|body_start_0|> login_page.LoginPage(self.driver).login() sleep(2) landlord...
stack_v2_sparse_classes_75kplus_train_002565
2,282
permissive
[ { "docstring": "修改房源图片——上传图片和删除图片", "name": "test_del_pic", "signature": "def test_del_pic(self)" }, { "docstring": "设为封面", "name": "test_setcover", "signature": "def test_setcover(self)" } ]
2
stack_v2_sparse_classes_30k_test_000597
Implement the Python class `TestEditdataFypic` described below. Class description: 房源图片 Method signatures and docstrings: - def test_del_pic(self): 修改房源图片——上传图片和删除图片 - def test_setcover(self): 设为封面
Implement the Python class `TestEditdataFypic` described below. Class description: 房源图片 Method signatures and docstrings: - def test_del_pic(self): 修改房源图片——上传图片和删除图片 - def test_setcover(self): 设为封面 <|skeleton|> class TestEditdataFypic: """房源图片""" def test_del_pic(self): """修改房源图片——上传图片和删除图片""" ...
192c70c49a8e9e072b9d0d0136f02c653c589410
<|skeleton|> class TestEditdataFypic: """房源图片""" def test_del_pic(self): """修改房源图片——上传图片和删除图片""" <|body_0|> def test_setcover(self): """设为封面""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestEditdataFypic: """房源图片""" def test_del_pic(self): """修改房源图片——上传图片和删除图片""" login_page.LoginPage(self.driver).login() sleep(2) landlord_nav_page.LandlordNavPage(self.driver).Iamlandlord() sleep(2) landlord_nav_page.LandlordNavPage(self.driver).close_weiCh...
the_stack_v2_python_sparse
mayi/test_case/test_online_editdata_fypic.py
18701016443/mayi
train
0
b81479e07e4a219a7544010865d1c7fdb4e5f399
[ "add_cat('test', 1, 1)\nadd_cat('temp', 1, 1)\nadd_cat('tmp', 1, 1)\nadd_cat('tmp test temp', 1, 1)\nresponse = self.client.get(reverse('index'))\nself.assertEqual(response.status_code, 200)\nself.assertContains(response, 'tmp test temp')\nnum_cats = len(response.context['categories'])\nself.assertEqual(num_cats, 4...
<|body_start_0|> add_cat('test', 1, 1) add_cat('temp', 1, 1) add_cat('tmp', 1, 1) add_cat('tmp test temp', 1, 1) response = self.client.get(reverse('index')) self.assertEqual(response.status_code, 200) self.assertContains(response, 'tmp test temp') num_cat...
IndexViewTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IndexViewTests: def test_index_view_with_categories(self): """Check that appropriate categories load :return:""" <|body_0|> def test_index_view_with_no_categories(self): """If no categories exist, an appropriate message should be displayed :return:""" <|body_...
stack_v2_sparse_classes_75kplus_train_002566
2,727
no_license
[ { "docstring": "Check that appropriate categories load :return:", "name": "test_index_view_with_categories", "signature": "def test_index_view_with_categories(self)" }, { "docstring": "If no categories exist, an appropriate message should be displayed :return:", "name": "test_index_view_with...
2
stack_v2_sparse_classes_30k_train_025820
Implement the Python class `IndexViewTests` described below. Class description: Implement the IndexViewTests class. Method signatures and docstrings: - def test_index_view_with_categories(self): Check that appropriate categories load :return: - def test_index_view_with_no_categories(self): If no categories exist, an ...
Implement the Python class `IndexViewTests` described below. Class description: Implement the IndexViewTests class. Method signatures and docstrings: - def test_index_view_with_categories(self): Check that appropriate categories load :return: - def test_index_view_with_no_categories(self): If no categories exist, an ...
205207086c570e6feba887f958d536d029386757
<|skeleton|> class IndexViewTests: def test_index_view_with_categories(self): """Check that appropriate categories load :return:""" <|body_0|> def test_index_view_with_no_categories(self): """If no categories exist, an appropriate message should be displayed :return:""" <|body_...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class IndexViewTests: def test_index_view_with_categories(self): """Check that appropriate categories load :return:""" add_cat('test', 1, 1) add_cat('temp', 1, 1) add_cat('tmp', 1, 1) add_cat('tmp test temp', 1, 1) response = self.client.get(reverse('index')) ...
the_stack_v2_python_sparse
moneykatz/tests.py
flycal6/moneykatz_django
train
0
1702641cb99fbc8e9025526995d600323caa8558
[ "if not args:\n args = ('',)\napps = self.catalog_apps(cherrypy.tree.apps, args[0] == 'all')\nif cherrypy.request.wants == 'org':\n checklist = (f'- [ ] {name}' for name, _, _ in apps)\n return '\\n'.join(checklist).encode()\nreturn cherrypy.engine.publish('jinja:render', 'apps/homepage/homepage.jinja.html...
<|body_start_0|> if not args: args = ('',) apps = self.catalog_apps(cherrypy.tree.apps, args[0] == 'all') if cherrypy.request.wants == 'org': checklist = (f'- [ ] {name}' for name, _, _ in apps) return '\n'.join(checklist).encode() return cherrypy.engi...
Controller
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Controller: def GET(self, *args: str, **_kwargs: str) -> bytes: """List all available applications. Apps can be excluded from this list by setting show_on_homepage to False.""" <|body_0|> def catalog_apps(apps: Dict[str, cherrypy.Application], show_all: bool=True) -> List[Tu...
stack_v2_sparse_classes_75kplus_train_002567
2,402
no_license
[ { "docstring": "List all available applications. Apps can be excluded from this list by setting show_on_homepage to False.", "name": "GET", "signature": "def GET(self, *args: str, **_kwargs: str) -> bytes" }, { "docstring": "Extract app summaries from module docstrings.", "name": "catalog_ap...
2
stack_v2_sparse_classes_30k_test_000509
Implement the Python class `Controller` described below. Class description: Implement the Controller class. Method signatures and docstrings: - def GET(self, *args: str, **_kwargs: str) -> bytes: List all available applications. Apps can be excluded from this list by setting show_on_homepage to False. - def catalog_a...
Implement the Python class `Controller` described below. Class description: Implement the Controller class. Method signatures and docstrings: - def GET(self, *args: str, **_kwargs: str) -> bytes: List all available applications. Apps can be excluded from this list by setting show_on_homepage to False. - def catalog_a...
7129415303b94d5d10b2c29ec432f0c7d41cc651
<|skeleton|> class Controller: def GET(self, *args: str, **_kwargs: str) -> bytes: """List all available applications. Apps can be excluded from this list by setting show_on_homepage to False.""" <|body_0|> def catalog_apps(apps: Dict[str, cherrypy.Application], show_all: bool=True) -> List[Tu...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Controller: def GET(self, *args: str, **_kwargs: str) -> bytes: """List all available applications. Apps can be excluded from this list by setting show_on_homepage to False.""" if not args: args = ('',) apps = self.catalog_apps(cherrypy.tree.apps, args[0] == 'all') ...
the_stack_v2_python_sparse
apps/homepage/main.py
lovett/medley
train
6
b4b000182b765577a6d2c7877a957308a03ab302
[ "self.init_lr = init_lr\nself.gamma = gamma\nself.iter_steps = iter_steps", "lr = self.init_lr\nfor iter_step in self.iter_steps:\n if iter >= iter_step:\n lr *= self.gamma\nreturn lr" ]
<|body_start_0|> self.init_lr = init_lr self.gamma = gamma self.iter_steps = iter_steps <|end_body_0|> <|body_start_1|> lr = self.init_lr for iter_step in self.iter_steps: if iter >= iter_step: lr *= self.gamma return lr <|end_body_1|>
StepScheduler Step decay
StepScheduler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StepScheduler: """StepScheduler Step decay""" def __init__(self, init_lr, gamma, iter_steps): """Args: init_lr (float): Initial learning rate. gamma (float): Multiplier. iter_steps (list of int): Iteration at which gamma is multiplied. Example: StepScheduler(0.1, 0.1, [150000, 300000...
stack_v2_sparse_classes_75kplus_train_002568
5,375
permissive
[ { "docstring": "Args: init_lr (float): Initial learning rate. gamma (float): Multiplier. iter_steps (list of int): Iteration at which gamma is multiplied. Example: StepScheduler(0.1, 0.1, [150000, 300000, 400000])", "name": "__init__", "signature": "def __init__(self, init_lr, gamma, iter_steps)" }, ...
2
stack_v2_sparse_classes_30k_train_009135
Implement the Python class `StepScheduler` described below. Class description: StepScheduler Step decay Method signatures and docstrings: - def __init__(self, init_lr, gamma, iter_steps): Args: init_lr (float): Initial learning rate. gamma (float): Multiplier. iter_steps (list of int): Iteration at which gamma is mul...
Implement the Python class `StepScheduler` described below. Class description: StepScheduler Step decay Method signatures and docstrings: - def __init__(self, init_lr, gamma, iter_steps): Args: init_lr (float): Initial learning rate. gamma (float): Multiplier. iter_steps (list of int): Iteration at which gamma is mul...
93211d0f322d76efc48cfcf27decae7bd818f923
<|skeleton|> class StepScheduler: """StepScheduler Step decay""" def __init__(self, init_lr, gamma, iter_steps): """Args: init_lr (float): Initial learning rate. gamma (float): Multiplier. iter_steps (list of int): Iteration at which gamma is multiplied. Example: StepScheduler(0.1, 0.1, [150000, 300000...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class StepScheduler: """StepScheduler Step decay""" def __init__(self, init_lr, gamma, iter_steps): """Args: init_lr (float): Initial learning rate. gamma (float): Multiplier. iter_steps (list of int): Iteration at which gamma is multiplied. Example: StepScheduler(0.1, 0.1, [150000, 300000, 400000])"""...
the_stack_v2_python_sparse
python/src/nnabla/utils/learning_rate_scheduler.py
Pandinosaurus/nnabla
train
1
3b305228466db9f22342c60928ef3ebe285a69ba
[ "super(NN2, self).__init__()\nself.conv1 = nn.Conv2d(1, 10, kernel_size=3)\nself.conv2 = nn.Conv2d(10, 20, kernel_size=3)\nself.conv2_drop = nn.Dropout2d()\nself.fc1 = nn.Linear(20 * 2 * 2, 50)\nself.fc2 = nn.Linear(50, 10)\nself.fc3 = nn.Linear(100, 30)\nself.fc4 = nn.Linear(30, 20)\nself.fc5 = nn.Linear(20, 10)\n...
<|body_start_0|> super(NN2, self).__init__() self.conv1 = nn.Conv2d(1, 10, kernel_size=3) self.conv2 = nn.Conv2d(10, 20, kernel_size=3) self.conv2_drop = nn.Dropout2d() self.fc1 = nn.Linear(20 * 2 * 2, 50) self.fc2 = nn.Linear(50, 10) self.fc3 = nn.Linear(100, 30)...
Implementation of Neural Network: with 2 subnetwork architecture to learn the additional information besides the targets 2 convulational and 6 linear layers, ReLU activation function applied Functions: - forward: feeding the specified network with the data x in the forward pass
NN2
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NN2: """Implementation of Neural Network: with 2 subnetwork architecture to learn the additional information besides the targets 2 convulational and 6 linear layers, ReLU activation function applied Functions: - forward: feeding the specified network with the data x in the forward pass""" de...
stack_v2_sparse_classes_75kplus_train_002569
3,129
permissive
[ { "docstring": "Defining the functions to be used in building the neural nets' architecture", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "The forward pass iterates through the 2d data and for each applies the network to learn both the digits' classes and targets. Arg...
2
stack_v2_sparse_classes_30k_train_028991
Implement the Python class `NN2` described below. Class description: Implementation of Neural Network: with 2 subnetwork architecture to learn the additional information besides the targets 2 convulational and 6 linear layers, ReLU activation function applied Functions: - forward: feeding the specified network with th...
Implement the Python class `NN2` described below. Class description: Implementation of Neural Network: with 2 subnetwork architecture to learn the additional information besides the targets 2 convulational and 6 linear layers, ReLU activation function applied Functions: - forward: feeding the specified network with th...
2ca233821616d38de104caed259118cc48b3fa11
<|skeleton|> class NN2: """Implementation of Neural Network: with 2 subnetwork architecture to learn the additional information besides the targets 2 convulational and 6 linear layers, ReLU activation function applied Functions: - forward: feeding the specified network with the data x in the forward pass""" de...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NN2: """Implementation of Neural Network: with 2 subnetwork architecture to learn the additional information besides the targets 2 convulational and 6 linear layers, ReLU activation function applied Functions: - forward: feeding the specified network with the data x in the forward pass""" def __init__(se...
the_stack_v2_python_sparse
Projects/Project1/nets/NN2.py
Shamanga/deeplearning
train
0
f77064d1595449bce1e7e0d78ddf2b0230403105
[ "LayoutItem.__init__(self, dom, parent_element, north_arrow_object, mxd, arc_doc)\nself.dom = dom\nself.parent_element = parent_element\nself.north_arrow_object = north_arrow_object\nself.mxd = mxd\nself.arc_doc = arc_doc", "border = self.north_arrow_object.Border\nbackground = self.north_arrow_object.Background\...
<|body_start_0|> LayoutItem.__init__(self, dom, parent_element, north_arrow_object, mxd, arc_doc) self.dom = dom self.parent_element = parent_element self.north_arrow_object = north_arrow_object self.mxd = mxd self.arc_doc = arc_doc <|end_body_0|> <|body_start_1|> ...
NorthArrowElement
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NorthArrowElement: def __init__(self, dom, parent_element, north_arrow_object, mxd, arc_doc): """This function creates a NorthArrow-item :param dom: the Document Object Model :param parent_element: the main layout element, where to put the layout-items :param north_arrow_object: the nort...
stack_v2_sparse_classes_75kplus_train_002570
2,222
permissive
[ { "docstring": "This function creates a NorthArrow-item :param dom: the Document Object Model :param parent_element: the main layout element, where to put the layout-items :param north_arrow_object: the northArrow as ArcObject :param mxd: the arcpy mxd-document :param arc_doc: the ArcObject IMxDocument", "n...
2
null
Implement the Python class `NorthArrowElement` described below. Class description: Implement the NorthArrowElement class. Method signatures and docstrings: - def __init__(self, dom, parent_element, north_arrow_object, mxd, arc_doc): This function creates a NorthArrow-item :param dom: the Document Object Model :param ...
Implement the Python class `NorthArrowElement` described below. Class description: Implement the NorthArrowElement class. Method signatures and docstrings: - def __init__(self, dom, parent_element, north_arrow_object, mxd, arc_doc): This function creates a NorthArrow-item :param dom: the Document Object Model :param ...
cd0aa5f533194c85cf6e098fadc079ea61b63fce
<|skeleton|> class NorthArrowElement: def __init__(self, dom, parent_element, north_arrow_object, mxd, arc_doc): """This function creates a NorthArrow-item :param dom: the Document Object Model :param parent_element: the main layout element, where to put the layout-items :param north_arrow_object: the nort...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NorthArrowElement: def __init__(self, dom, parent_element, north_arrow_object, mxd, arc_doc): """This function creates a NorthArrow-item :param dom: the Document Object Model :param parent_element: the main layout element, where to put the layout-items :param north_arrow_object: the northArrow as ArcO...
the_stack_v2_python_sparse
layout/northArrowElement.py
avaldeon/mapqonverter
train
0
e9b8e24fe6ad82416d65ccf6a39742bf7257fbeb
[ "if base == tgt:\n a = tmp[:]\n lst.append(a)\n return\nfor i in xrange(depth, len(ref)):\n if base + ref[i] <= tgt:\n tmp.append(ref[i])\n self.CS(base + ref[i], tgt, lst, ref, tmp, i)\n tmp.pop()", "candidates.sort()\nres, tmp = ([], [])\nself.CS(0, target, res, candidates, tmp,...
<|body_start_0|> if base == tgt: a = tmp[:] lst.append(a) return for i in xrange(depth, len(ref)): if base + ref[i] <= tgt: tmp.append(ref[i]) self.CS(base + ref[i], tgt, lst, ref, tmp, i) tmp.pop() <|end_bod...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def CS(self, base, tgt, lst, ref, tmp, depth): """base: value already calculated tgt: target number lst: result List ref: candidates List tmp: one answer depth: 到了第几个数""" <|body_0|> def combinationSum(self, candidates, target): """:type candidates: List[int...
stack_v2_sparse_classes_75kplus_train_002571
3,337
no_license
[ { "docstring": "base: value already calculated tgt: target number lst: result List ref: candidates List tmp: one answer depth: 到了第几个数", "name": "CS", "signature": "def CS(self, base, tgt, lst, ref, tmp, depth)" }, { "docstring": ":type candidates: List[int] :type target: int :rtype: List[List[in...
2
stack_v2_sparse_classes_30k_train_017749
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def CS(self, base, tgt, lst, ref, tmp, depth): base: value already calculated tgt: target number lst: result List ref: candidates List tmp: one answer depth: 到了第几个数 - def combina...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def CS(self, base, tgt, lst, ref, tmp, depth): base: value already calculated tgt: target number lst: result List ref: candidates List tmp: one answer depth: 到了第几个数 - def combina...
507ed2efeff7818ca9cf53a8ee7fb80d3c530d67
<|skeleton|> class Solution: def CS(self, base, tgt, lst, ref, tmp, depth): """base: value already calculated tgt: target number lst: result List ref: candidates List tmp: one answer depth: 到了第几个数""" <|body_0|> def combinationSum(self, candidates, target): """:type candidates: List[int...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def CS(self, base, tgt, lst, ref, tmp, depth): """base: value already calculated tgt: target number lst: result List ref: candidates List tmp: one answer depth: 到了第几个数""" if base == tgt: a = tmp[:] lst.append(a) return for i in xrange(depth...
the_stack_v2_python_sparse
Leetcode/Backtracking/#39-Combination Sum/main.py
qizongjun/Algorithms-1
train
0
58c903cd2492d29938bb5ec575c8b8bfae6a729f
[ "self.__logger = log(self.__class__.__name__)\nself.symbols = []\ns = self.symbolFactory(geoType, graduation.symbol(), layerTransparency)\nself.symbols.append(s)\nself.field = field\nself.label = str(graduation.label())\nself.value = str(graduation.lowerValue()) + ' - ' + str(graduation.upperValue())\nself.lowValue...
<|body_start_0|> self.__logger = log(self.__class__.__name__) self.symbols = [] s = self.symbolFactory(geoType, graduation.symbol(), layerTransparency) self.symbols.append(s) self.field = field self.label = str(graduation.label()) self.value = str(graduation.lower...
Graduated renderer class
graduated
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class graduated: """Graduated renderer class""" def __init__(self, geoType, field, graduation, layerTransparency): """Initialise the symbol range :param geoType: Layer.geometryType() GeometryType of the layer. :type geoType: GeometryType e.g. QGis.WKBPolygon :param field: Name of the attri...
stack_v2_sparse_classes_75kplus_train_002572
36,198
permissive
[ { "docstring": "Initialise the symbol range :param geoType: Layer.geometryType() GeometryType of the layer. :type geoType: GeometryType e.g. QGis.WKBPolygon :param field: Name of the attribute field used in the symbology :type field: str :param graduation: The graduation range object. :type graduation: QgsRende...
3
stack_v2_sparse_classes_30k_train_051139
Implement the Python class `graduated` described below. Class description: Graduated renderer class Method signatures and docstrings: - def __init__(self, geoType, field, graduation, layerTransparency): Initialise the symbol range :param geoType: Layer.geometryType() GeometryType of the layer. :type geoType: Geometry...
Implement the Python class `graduated` described below. Class description: Graduated renderer class Method signatures and docstrings: - def __init__(self, geoType, field, graduation, layerTransparency): Initialise the symbol range :param geoType: Layer.geometryType() GeometryType of the layer. :type geoType: Geometry...
aa3733f2cc0e52ca70b93bc55d5f8f7059b73e31
<|skeleton|> class graduated: """Graduated renderer class""" def __init__(self, geoType, field, graduation, layerTransparency): """Initialise the symbol range :param geoType: Layer.geometryType() GeometryType of the layer. :type geoType: GeometryType e.g. QGis.WKBPolygon :param field: Name of the attri...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class graduated: """Graduated renderer class""" def __init__(self, geoType, field, graduation, layerTransparency): """Initialise the symbol range :param geoType: Layer.geometryType() GeometryType of the layer. :type geoType: GeometryType e.g. QGis.WKBPolygon :param field: Name of the attribute field us...
the_stack_v2_python_sparse
symbology.py
Real-Currents/d3MapRenderer
train
0
868a99cf61cbf050fcf871009d097b549a06d0af
[ "self.logger = log.get_logger(__name__, os.path.join(log_directory, 'parseAndPopulate.log'))\nself.file_name = file_name\nself.yang_modules: dict[str, Module] = {}", "key = f'{yang.name}@{yang.revision}/{yang.organization}'\nself.logger.debug(f'Module {key} parsed')\nif key in self.yang_modules:\n self.yang_mo...
<|body_start_0|> self.logger = log.get_logger(__name__, os.path.join(log_directory, 'parseAndPopulate.log')) self.file_name = file_name self.yang_modules: dict[str, Module] = {} <|end_body_0|> <|body_start_1|> key = f'{yang.name}@{yang.revision}/{yang.organization}' self.logger....
A dumper for yang module metadata.
Dumper
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Dumper: """A dumper for yang module metadata.""" def __init__(self, log_directory: str, file_name: str): """Arguments: :param log_directory: (str) directory where the log file is saved :param file_name: (str) name of the file to which the modules are dumped""" <|body_0|> ...
stack_v2_sparse_classes_75kplus_train_002573
12,099
permissive
[ { "docstring": "Arguments: :param log_directory: (str) directory where the log file is saved :param file_name: (str) name of the file to which the modules are dumped", "name": "__init__", "signature": "def __init__(self, log_directory: str, file_name: str)" }, { "docstring": "Add a module's data...
4
null
Implement the Python class `Dumper` described below. Class description: A dumper for yang module metadata. Method signatures and docstrings: - def __init__(self, log_directory: str, file_name: str): Arguments: :param log_directory: (str) directory where the log file is saved :param file_name: (str) name of the file t...
Implement the Python class `Dumper` described below. Class description: A dumper for yang module metadata. Method signatures and docstrings: - def __init__(self, log_directory: str, file_name: str): Arguments: :param log_directory: (str) directory where the log file is saved :param file_name: (str) name of the file t...
fa393721824e4d30704405132b08f4c01cbde6c1
<|skeleton|> class Dumper: """A dumper for yang module metadata.""" def __init__(self, log_directory: str, file_name: str): """Arguments: :param log_directory: (str) directory where the log file is saved :param file_name: (str) name of the file to which the modules are dumped""" <|body_0|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Dumper: """A dumper for yang module metadata.""" def __init__(self, log_directory: str, file_name: str): """Arguments: :param log_directory: (str) directory where the log file is saved :param file_name: (str) name of the file to which the modules are dumped""" self.logger = log.get_logger...
the_stack_v2_python_sparse
parseAndPopulate/dumper.py
YangCatalog/backend
train
3
e7262655819394e3f313bdf5f6601c2d8632a94f
[ "super().__init__()\nif filename is not None:\n self.readFile(filename)", "types = {'flashPortionHistoryID': np.int64, 'flashPortionID': str, 'flashID': str, 'nullTime': str, 'time': str, 'lat': np.float, 'lon': np.float, 'alt': np.float, 'type': str, 'amp': np.float}\npdArgs = {'skiprows': 1, 'chunksize': 100...
<|body_start_0|> super().__init__() if filename is not None: self.readFile(filename) <|end_body_0|> <|body_start_1|> types = {'flashPortionHistoryID': np.int64, 'flashPortionID': str, 'flashID': str, 'nullTime': str, 'time': str, 'lat': np.float, 'lon': np.float, 'alt': np.float, 't...
Class to handle Earth Networks Total Lightning Network data. Many of the following are not attributes of the class, but are columns in the underlying Dataframe. But, you can access them as you would an attribute.... Attributes ----------- _data : Dataframe The underlying data. A "real" attribute of the class. flashID :...
ENTLN
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ENTLN: """Class to handle Earth Networks Total Lightning Network data. Many of the following are not attributes of the class, but are columns in the underlying Dataframe. But, you can access them as you would an attribute.... Attributes ----------- _data : Dataframe The underlying data. A "real" ...
stack_v2_sparse_classes_75kplus_train_002574
7,079
no_license
[ { "docstring": "If you don't provide a file name, you'll have to call :meth:`readFile` yourself to actually do anything useful. Parameters ---------- filename : str The file name to be read in.", "name": "__init__", "signature": "def __init__(self, filename=None)" }, { "docstring": "Given a file...
2
stack_v2_sparse_classes_30k_train_019883
Implement the Python class `ENTLN` described below. Class description: Class to handle Earth Networks Total Lightning Network data. Many of the following are not attributes of the class, but are columns in the underlying Dataframe. But, you can access them as you would an attribute.... Attributes ----------- _data : D...
Implement the Python class `ENTLN` described below. Class description: Class to handle Earth Networks Total Lightning Network data. Many of the following are not attributes of the class, but are columns in the underlying Dataframe. But, you can access them as you would an attribute.... Attributes ----------- _data : D...
67f98b5d96ad26407efe98d4303a7d0b084bf06b
<|skeleton|> class ENTLN: """Class to handle Earth Networks Total Lightning Network data. Many of the following are not attributes of the class, but are columns in the underlying Dataframe. But, you can access them as you would an attribute.... Attributes ----------- _data : Dataframe The underlying data. A "real" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ENTLN: """Class to handle Earth Networks Total Lightning Network data. Many of the following are not attributes of the class, but are columns in the underlying Dataframe. But, you can access them as you would an attribute.... Attributes ----------- _data : Dataframe The underlying data. A "real" attribute of ...
the_stack_v2_python_sparse
pyltg/core/entln.py
safelysparky/pyltg
train
0
bac662a2ecfdd80a4b669b79de86cc2363323e0c
[ "server, validation_resources = self._create_server()\nif CONF.validation.run_validation:\n linux_client = remote_client.RemoteClient(self.get_server_ip(server, validation_resources), self.image_ssh_user, self.image_ssh_password, validation_resources['keypair']['private_key'], server=server, servers_client=self....
<|body_start_0|> server, validation_resources = self._create_server() if CONF.validation.run_validation: linux_client = remote_client.RemoteClient(self.get_server_ip(server, validation_resources), self.image_ssh_user, self.image_ssh_password, validation_resources['keypair']['private_key'], s...
Test attaching volume to server
AttachVolumeTestJSON
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AttachVolumeTestJSON: """Test attaching volume to server""" def test_attach_detach_volume(self): """Test attaching and detaching volume from server Stop and Start a server with an attached volume, ensuring that the volume remains attached.""" <|body_0|> def test_list_get...
stack_v2_sparse_classes_75kplus_train_002575
23,311
permissive
[ { "docstring": "Test attaching and detaching volume from server Stop and Start a server with an attached volume, ensuring that the volume remains attached.", "name": "test_attach_detach_volume", "signature": "def test_attach_detach_volume(self)" }, { "docstring": "Test listing and getting volume...
2
stack_v2_sparse_classes_30k_train_032263
Implement the Python class `AttachVolumeTestJSON` described below. Class description: Test attaching volume to server Method signatures and docstrings: - def test_attach_detach_volume(self): Test attaching and detaching volume from server Stop and Start a server with an attached volume, ensuring that the volume remai...
Implement the Python class `AttachVolumeTestJSON` described below. Class description: Test attaching volume to server Method signatures and docstrings: - def test_attach_detach_volume(self): Test attaching and detaching volume from server Stop and Start a server with an attached volume, ensuring that the volume remai...
3932a799e620a20d7abf7b89e21b520683a1809b
<|skeleton|> class AttachVolumeTestJSON: """Test attaching volume to server""" def test_attach_detach_volume(self): """Test attaching and detaching volume from server Stop and Start a server with an attached volume, ensuring that the volume remains attached.""" <|body_0|> def test_list_get...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AttachVolumeTestJSON: """Test attaching volume to server""" def test_attach_detach_volume(self): """Test attaching and detaching volume from server Stop and Start a server with an attached volume, ensuring that the volume remains attached.""" server, validation_resources = self._create_se...
the_stack_v2_python_sparse
tempest/api/compute/volumes/test_attach_volume.py
openstack/tempest
train
270
8ed236b3786393e0614b3e3b51ebed760f928cfb
[ "self._model = dict()\nself._ngram = 1\nself._epsilon = sppasPerplexity.DEFAULT_EPSILON\nself.set_model(model)\nself.set_ngram(ngram)", "eps = float(eps)\nif eps < 0.0 or eps > 0.1:\n raise InsideIntervalError(eps, 0.0, 0.1)\nif self._model is not None:\n p_min = round(min((proba for proba in self._model.va...
<|body_start_0|> self._model = dict() self._ngram = 1 self._epsilon = sppasPerplexity.DEFAULT_EPSILON self.set_model(model) self.set_ngram(ngram) <|end_body_0|> <|body_start_1|> eps = float(eps) if eps < 0.0 or eps > 0.1: raise InsideIntervalError(eps...
Perplexity estimator. :author: Brigitte Bigi :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :contact: develop@sppas.org :license: GPL, v3 :copyright: Copyright (C) 2011-2018 Brigitte Bigi Perplexity is a measurement of how well a probability distribution or probability model predicts a sample. Th...
sppasPerplexity
[ "MIT", "GFDL-1.1-or-later", "GPL-3.0-only", "GPL-3.0-or-later" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class sppasPerplexity: """Perplexity estimator. :author: Brigitte Bigi :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :contact: develop@sppas.org :license: GPL, v3 :copyright: Copyright (C) 2011-2018 Brigitte Bigi Perplexity is a measurement of how well a probability distribution...
stack_v2_sparse_classes_75kplus_train_002576
6,620
permissive
[ { "docstring": "Create a Perplexity instance with a list of symbols. :param model: (dict) a dictionary with key=item, value=probability :param ngram: (int) the n value, in the range 1..8", "name": "__init__", "signature": "def __init__(self, model, ngram=1)" }, { "docstring": "Set a value for ep...
5
stack_v2_sparse_classes_30k_val_000207
Implement the Python class `sppasPerplexity` described below. Class description: Perplexity estimator. :author: Brigitte Bigi :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :contact: develop@sppas.org :license: GPL, v3 :copyright: Copyright (C) 2011-2018 Brigitte Bigi Perplexity is a measurement...
Implement the Python class `sppasPerplexity` described below. Class description: Perplexity estimator. :author: Brigitte Bigi :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :contact: develop@sppas.org :license: GPL, v3 :copyright: Copyright (C) 2011-2018 Brigitte Bigi Perplexity is a measurement...
3167b65f576abcc27a8767d24c274a04712bd948
<|skeleton|> class sppasPerplexity: """Perplexity estimator. :author: Brigitte Bigi :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :contact: develop@sppas.org :license: GPL, v3 :copyright: Copyright (C) 2011-2018 Brigitte Bigi Perplexity is a measurement of how well a probability distribution...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class sppasPerplexity: """Perplexity estimator. :author: Brigitte Bigi :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :contact: develop@sppas.org :license: GPL, v3 :copyright: Copyright (C) 2011-2018 Brigitte Bigi Perplexity is a measurement of how well a probability distribution or probabili...
the_stack_v2_python_sparse
sppas/sppas/src/calculus/infotheory/perplexity.py
mirfan899/MTTS
train
0
9bea97f082fa6abee64e2d9cc400ac36880a3655
[ "list_c = []\nfor index, item in enumerate(S):\n if C == item:\n list_c.append(index)\nlist_return = []\nfor index, item in enumerate(S):\n list_dif = []\n for dif in list_c:\n list_dif.append(abs(index - dif))\n list_return.append(min(list_dif))\nreturn list_return", "list_c = []\nfor i...
<|body_start_0|> list_c = [] for index, item in enumerate(S): if C == item: list_c.append(index) list_return = [] for index, item in enumerate(S): list_dif = [] for dif in list_c: list_dif.append(abs(index - dif)) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def shortestToChar(self, S, C): """:type S: str :type C: str :rtype: List[int]""" <|body_0|> def shortestToChar2(self, S, C): """:type S: str :type C: str :rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|> list_c = [] ...
stack_v2_sparse_classes_75kplus_train_002577
1,081
no_license
[ { "docstring": ":type S: str :type C: str :rtype: List[int]", "name": "shortestToChar", "signature": "def shortestToChar(self, S, C)" }, { "docstring": ":type S: str :type C: str :rtype: List[int]", "name": "shortestToChar2", "signature": "def shortestToChar2(self, S, C)" } ]
2
stack_v2_sparse_classes_30k_train_023938
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def shortestToChar(self, S, C): :type S: str :type C: str :rtype: List[int] - def shortestToChar2(self, S, C): :type S: str :type C: str :rtype: List[int]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def shortestToChar(self, S, C): :type S: str :type C: str :rtype: List[int] - def shortestToChar2(self, S, C): :type S: str :type C: str :rtype: List[int] <|skeleton|> class Sol...
f777f0224f188a787457c418fa3331c1e92d13e5
<|skeleton|> class Solution: def shortestToChar(self, S, C): """:type S: str :type C: str :rtype: List[int]""" <|body_0|> def shortestToChar2(self, S, C): """:type S: str :type C: str :rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def shortestToChar(self, S, C): """:type S: str :type C: str :rtype: List[int]""" list_c = [] for index, item in enumerate(S): if C == item: list_c.append(index) list_return = [] for index, item in enumerate(S): list_dif...
the_stack_v2_python_sparse
let821.py
fredfeng0326/LeetCode
train
3
99450ced7e4c106cabf7ef9ec30fd8835b4f84a2
[ "super(AdamWeightDecayOptimizer, self).__init__(False, name)\nself.learning_rate = learning_rate\nself.weight_decay_rate = weight_decay_rate\nself.beta_1 = beta_1\nself.beta_2 = beta_2\nself.epsilon = epsilon\nself.exclude_from_weight_decay = exclude_from_weight_decay", "assignments = []\nfor grad, param in grads...
<|body_start_0|> super(AdamWeightDecayOptimizer, self).__init__(False, name) self.learning_rate = learning_rate self.weight_decay_rate = weight_decay_rate self.beta_1 = beta_1 self.beta_2 = beta_2 self.epsilon = epsilon self.exclude_from_weight_decay = exclude_fro...
A basic Adam optimizer that includes "correct" L2 weight decay.
AdamWeightDecayOptimizer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdamWeightDecayOptimizer: """A basic Adam optimizer that includes "correct" L2 weight decay.""" def __init__(self, learning_rate, weight_decay_rate=0.0, beta_1=0.9, beta_2=0.999, epsilon=1e-06, exclude_from_weight_decay=None, name='AdamWeightDecayOptimizer'): """Constructs a AdamWeig...
stack_v2_sparse_classes_75kplus_train_002578
16,787
no_license
[ { "docstring": "Constructs a AdamWeightDecayOptimizer.", "name": "__init__", "signature": "def __init__(self, learning_rate, weight_decay_rate=0.0, beta_1=0.9, beta_2=0.999, epsilon=1e-06, exclude_from_weight_decay=None, name='AdamWeightDecayOptimizer')" }, { "docstring": "See base class.", ...
4
stack_v2_sparse_classes_30k_test_002081
Implement the Python class `AdamWeightDecayOptimizer` described below. Class description: A basic Adam optimizer that includes "correct" L2 weight decay. Method signatures and docstrings: - def __init__(self, learning_rate, weight_decay_rate=0.0, beta_1=0.9, beta_2=0.999, epsilon=1e-06, exclude_from_weight_decay=None...
Implement the Python class `AdamWeightDecayOptimizer` described below. Class description: A basic Adam optimizer that includes "correct" L2 weight decay. Method signatures and docstrings: - def __init__(self, learning_rate, weight_decay_rate=0.0, beta_1=0.9, beta_2=0.999, epsilon=1e-06, exclude_from_weight_decay=None...
7be89d283b4f0572b47ba0150647080976e5928f
<|skeleton|> class AdamWeightDecayOptimizer: """A basic Adam optimizer that includes "correct" L2 weight decay.""" def __init__(self, learning_rate, weight_decay_rate=0.0, beta_1=0.9, beta_2=0.999, epsilon=1e-06, exclude_from_weight_decay=None, name='AdamWeightDecayOptimizer'): """Constructs a AdamWeig...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AdamWeightDecayOptimizer: """A basic Adam optimizer that includes "correct" L2 weight decay.""" def __init__(self, learning_rate, weight_decay_rate=0.0, beta_1=0.9, beta_2=0.999, epsilon=1e-06, exclude_from_weight_decay=None, name='AdamWeightDecayOptimizer'): """Constructs a AdamWeightDecayOptimi...
the_stack_v2_python_sparse
model/utils.py
SangMyeongWoh/mass_raw_tf1
train
0
9b90606d3456f8603f6db3ae0aea5585b0173077
[ "picking_obj = self.pool.get('stock.picking')\nseq_obj_name = self._name\nvals['name'] = self.pool.get('ir.sequence').get(cr, user, seq_obj_name)\nnew_id = picking_obj.create(cr, user, vals, context)\nreturn new_id", "picking_obj = self.pool.get('stock.picking')\nwrite_boolean = picking_obj.write(cr, uid, ids, va...
<|body_start_0|> picking_obj = self.pool.get('stock.picking') seq_obj_name = self._name vals['name'] = self.pool.get('ir.sequence').get(cr, user, seq_obj_name) new_id = picking_obj.create(cr, user, vals, context) return new_id <|end_body_0|> <|body_start_1|> picking_obj ...
stock_picking_out
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class stock_picking_out: def create(self, cr, user, vals, context=None): """Override create to call create of stock.picking""" <|body_0|> def write(self, cr, uid, ids, vals, context=None): """Override write to call write of stock.picking""" <|body_1|> <|end_skelet...
stack_v2_sparse_classes_75kplus_train_002579
17,898
no_license
[ { "docstring": "Override create to call create of stock.picking", "name": "create", "signature": "def create(self, cr, user, vals, context=None)" }, { "docstring": "Override write to call write of stock.picking", "name": "write", "signature": "def write(self, cr, uid, ids, vals, context=...
2
stack_v2_sparse_classes_30k_train_047224
Implement the Python class `stock_picking_out` described below. Class description: Implement the stock_picking_out class. Method signatures and docstrings: - def create(self, cr, user, vals, context=None): Override create to call create of stock.picking - def write(self, cr, uid, ids, vals, context=None): Override wr...
Implement the Python class `stock_picking_out` described below. Class description: Implement the stock_picking_out class. Method signatures and docstrings: - def create(self, cr, user, vals, context=None): Override create to call create of stock.picking - def write(self, cr, uid, ids, vals, context=None): Override wr...
0b997095c260d58b026440967fea3a202bef7efb
<|skeleton|> class stock_picking_out: def create(self, cr, user, vals, context=None): """Override create to call create of stock.picking""" <|body_0|> def write(self, cr, uid, ids, vals, context=None): """Override write to call write of stock.picking""" <|body_1|> <|end_skelet...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class stock_picking_out: def create(self, cr, user, vals, context=None): """Override create to call create of stock.picking""" picking_obj = self.pool.get('stock.picking') seq_obj_name = self._name vals['name'] = self.pool.get('ir.sequence').get(cr, user, seq_obj_name) new_id...
the_stack_v2_python_sparse
v_7/NISS/shamil_v3/stock_oc/model/stock.py
musabahmed/baba
train
0
9e2d322cb9719fde8286510f62034d0149e75876
[ "ret = []\nstk = collections.deque()\nwhile root is not None or len(stk) > 0:\n if root is not None:\n ret.append(str(root.val))\n stk.append(root)\n root = root.left\n else:\n root = stk.pop()\n root = root.right\nreturn ' '.join(ret)", "def insert(root, val):\n pre = ...
<|body_start_0|> ret = [] stk = collections.deque() while root is not None or len(stk) > 0: if root is not None: ret.append(str(root.val)) stk.append(root) root = root.left else: root = stk.pop() ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_75kplus_train_002580
2,336
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_val_001056
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
9190d3d178f1733aa226973757ee7e045b7bab00
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" ret = [] stk = collections.deque() while root is not None or len(stk) > 0: if root is not None: ret.append(str(root.val)) stk....
the_stack_v2_python_sparse
SerializeAndDeserializeBST.py
ellinx/LC-python
train
1
b22daa7f7a70b6536b155a86a2f36f8e9cdb12e0
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn Acl()", "from .access_type import AccessType\nfrom .acl_type import AclType\nfrom .access_type import AccessType\nfrom .acl_type import AclType\nfields: Dict[str, Callable[[Any], None]] = {'accessType': lambda n: setattr(self, 'access_...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return Acl() <|end_body_0|> <|body_start_1|> from .access_type import AccessType from .acl_type import AclType from .access_type import AccessType from .acl_type import AclType ...
Acl
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Acl: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Acl: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: Acl""" <|b...
stack_v2_sparse_classes_75kplus_train_002581
3,338
permissive
[ { "docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: Acl", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_value(parse_nod...
3
stack_v2_sparse_classes_30k_train_028210
Implement the Python class `Acl` described below. Class description: Implement the Acl class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Acl: Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse n...
Implement the Python class `Acl` described below. Class description: Implement the Acl class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Acl: Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse n...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class Acl: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Acl: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: Acl""" <|b...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Acl: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Acl: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: Acl""" if not parse_node...
the_stack_v2_python_sparse
msgraph/generated/models/external_connectors/acl.py
microsoftgraph/msgraph-sdk-python
train
135
d01ee51a5c177eb4089f6f2f03824c2bc03a329c
[ "trial_questionpaper = self.get(quiz_id=original_quiz_id)\nfixed_ques = trial_questionpaper.get_ordered_questions()\ntrial_questions = {'fixed_questions': fixed_ques, 'random_questions': trial_questionpaper.random_questions.all()}\ntrial_questionpaper.pk = None\ntrial_questionpaper.save()\nreturn (trial_questionpap...
<|body_start_0|> trial_questionpaper = self.get(quiz_id=original_quiz_id) fixed_ques = trial_questionpaper.get_ordered_questions() trial_questions = {'fixed_questions': fixed_ques, 'random_questions': trial_questionpaper.random_questions.all()} trial_questionpaper.pk = None trial...
QuestionPaperManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QuestionPaperManager: def _create_trial_from_questionpaper(self, original_quiz_id): """Creates a copy of the original questionpaper""" <|body_0|> def create_trial_paper_to_test_questions(self, trial_quiz, questions_list): """Creates a trial question paper to test sel...
stack_v2_sparse_classes_75kplus_train_002582
39,625
no_license
[ { "docstring": "Creates a copy of the original questionpaper", "name": "_create_trial_from_questionpaper", "signature": "def _create_trial_from_questionpaper(self, original_quiz_id)" }, { "docstring": "Creates a trial question paper to test selected questions", "name": "create_trial_paper_to...
3
null
Implement the Python class `QuestionPaperManager` described below. Class description: Implement the QuestionPaperManager class. Method signatures and docstrings: - def _create_trial_from_questionpaper(self, original_quiz_id): Creates a copy of the original questionpaper - def create_trial_paper_to_test_questions(self...
Implement the Python class `QuestionPaperManager` described below. Class description: Implement the QuestionPaperManager class. Method signatures and docstrings: - def _create_trial_from_questionpaper(self, original_quiz_id): Creates a copy of the original questionpaper - def create_trial_paper_to_test_questions(self...
16c742d20fcfc220e0e8c7fe3ebade54c516dcf4
<|skeleton|> class QuestionPaperManager: def _create_trial_from_questionpaper(self, original_quiz_id): """Creates a copy of the original questionpaper""" <|body_0|> def create_trial_paper_to_test_questions(self, trial_quiz, questions_list): """Creates a trial question paper to test sel...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class QuestionPaperManager: def _create_trial_from_questionpaper(self, original_quiz_id): """Creates a copy of the original questionpaper""" trial_questionpaper = self.get(quiz_id=original_quiz_id) fixed_ques = trial_questionpaper.get_ordered_questions() trial_questions = {'fixed_que...
the_stack_v2_python_sparse
preassesment/models.py
ajayradiantinfonet/lms
train
0
e7328d03f5696e1e2f9556deafc134bada5772aa
[ "if not await get_data_from_req(self.request).samples.has_right(sample_id, self.request['client'], SampleRight.read):\n raise InsufficientRights\ntry:\n sample = await get_data_from_req(self.request).samples.get(sample_id)\nexcept ResourceNotFoundError:\n raise NotFound\nreturn json_response(sample)", "i...
<|body_start_0|> if not await get_data_from_req(self.request).samples.has_right(sample_id, self.request['client'], SampleRight.read): raise InsufficientRights try: sample = await get_data_from_req(self.request).samples.get(sample_id) except ResourceNotFoundError: ...
SampleView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SampleView: async def get(self, sample_id: str, /) -> Union[r200[GetSampleResponse], r403, r404]: """Get a sample. Fetches the details for a sample. Status Codes: 200: Successful operation 400: Invalid query""" <|body_0|> async def patch(self, sample_id: str, /, data: Update...
stack_v2_sparse_classes_75kplus_train_002583
29,048
permissive
[ { "docstring": "Get a sample. Fetches the details for a sample. Status Codes: 200: Successful operation 400: Invalid query", "name": "get", "signature": "async def get(self, sample_id: str, /) -> Union[r200[GetSampleResponse], r403, r404]" }, { "docstring": "Update a sample. Updates a sample usi...
3
stack_v2_sparse_classes_30k_train_008744
Implement the Python class `SampleView` described below. Class description: Implement the SampleView class. Method signatures and docstrings: - async def get(self, sample_id: str, /) -> Union[r200[GetSampleResponse], r403, r404]: Get a sample. Fetches the details for a sample. Status Codes: 200: Successful operation ...
Implement the Python class `SampleView` described below. Class description: Implement the SampleView class. Method signatures and docstrings: - async def get(self, sample_id: str, /) -> Union[r200[GetSampleResponse], r403, r404]: Get a sample. Fetches the details for a sample. Status Codes: 200: Successful operation ...
1d17d2ba570cf5487e7514bec29250a5b368bb0a
<|skeleton|> class SampleView: async def get(self, sample_id: str, /) -> Union[r200[GetSampleResponse], r403, r404]: """Get a sample. Fetches the details for a sample. Status Codes: 200: Successful operation 400: Invalid query""" <|body_0|> async def patch(self, sample_id: str, /, data: Update...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SampleView: async def get(self, sample_id: str, /) -> Union[r200[GetSampleResponse], r403, r404]: """Get a sample. Fetches the details for a sample. Status Codes: 200: Successful operation 400: Invalid query""" if not await get_data_from_req(self.request).samples.has_right(sample_id, self.requ...
the_stack_v2_python_sparse
virtool/samples/api.py
virtool/virtool
train
45
e04541ffaf3fd42fb9eafd1b284fd6c1cdff0f20
[ "super(Pan, self).__init__(image=Pan.image, x=games.mouse.x, bottom=games.screen.height)\nself.score = games.Text(value=0, size=25, color=color.black, top=5, right=games.screen.width - 10)\ngames.screen.add(self.score)", "self.x = games.mouse.x\nif self.left < 0:\n self.left = 0\nif self.right > games.screen.w...
<|body_start_0|> super(Pan, self).__init__(image=Pan.image, x=games.mouse.x, bottom=games.screen.height) self.score = games.Text(value=0, size=25, color=color.black, top=5, right=games.screen.width - 10) games.screen.add(self.score) <|end_body_0|> <|body_start_1|> self.x = games.mouse.x...
Сковорода, в которую игрок может ловить падающий бургер.
Pan
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Pan: """Сковорода, в которую игрок может ловить падающий бургер.""" def __init__(self): """Инициализирует объект Рап и создает объект Text для отображения счета""" <|body_0|> def update(self): """Передвигает объект по горизонтали""" <|body_1|> def ch...
stack_v2_sparse_classes_75kplus_train_002584
5,097
no_license
[ { "docstring": "Инициализирует объект Рап и создает объект Text для отображения счета", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Передвигает объект по горизонтали", "name": "update", "signature": "def update(self)" }, { "docstring": "Проверяет, пой...
3
stack_v2_sparse_classes_30k_train_009342
Implement the Python class `Pan` described below. Class description: Сковорода, в которую игрок может ловить падающий бургер. Method signatures and docstrings: - def __init__(self): Инициализирует объект Рап и создает объект Text для отображения счета - def update(self): Передвигает объект по горизонтали - def check_...
Implement the Python class `Pan` described below. Class description: Сковорода, в которую игрок может ловить падающий бургер. Method signatures and docstrings: - def __init__(self): Инициализирует объект Рап и создает объект Text для отображения счета - def update(self): Передвигает объект по горизонтали - def check_...
19244b259eec779381c5deb348d2ddf5f439a364
<|skeleton|> class Pan: """Сковорода, в которую игрок может ловить падающий бургер.""" def __init__(self): """Инициализирует объект Рап и создает объект Text для отображения счета""" <|body_0|> def update(self): """Передвигает объект по горизонтали""" <|body_1|> def ch...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Pan: """Сковорода, в которую игрок может ловить падающий бургер.""" def __init__(self): """Инициализирует объект Рап и создает объект Text для отображения счета""" super(Pan, self).__init__(image=Pan.image, x=games.mouse.x, bottom=games.screen.height) self.score = games.Text(value...
the_stack_v2_python_sparse
Graphics/burger_panic.py
kononenkoie/CS50_examples_PYTHON
train
0
b04296dcd2aee21189dbd8245f8be756ea711409
[ "self.type = 'Optim'\nself.date = ''\nself.modules = []\nself.minmax = 'min'\nself.objective = ['cl']\nself.driver = 'COBYLA'\nself.save_iter = 1\nself.max_iter = 200\nself.tol = 0.001\nself.doedriver = 'uniform'\nself.samplesnb = 3\nself.doe_file = ''\nself.user_config = '../Optimisation/Default_config.csv'\nself....
<|body_start_0|> self.type = 'Optim' self.date = '' self.modules = [] self.minmax = 'min' self.objective = ['cl'] self.driver = 'COBYLA' self.save_iter = 1 self.max_iter = 200 self.tol = 0.001 self.doedriver = 'uniform' self.samples...
Setup the routine to launch in Openmdao.
Routine
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Routine: """Setup the routine to launch in Openmdao.""" def __init__(self): """Define default main parameters.""" <|body_0|> def get_user_inputs(self, tixi): """Take user inputs from the GUI.""" <|body_1|> <|end_skeleton|> <|body_start_0|> self....
stack_v2_sparse_classes_75kplus_train_002585
19,812
permissive
[ { "docstring": "Define default main parameters.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Take user inputs from the GUI.", "name": "get_user_inputs", "signature": "def get_user_inputs(self, tixi)" } ]
2
stack_v2_sparse_classes_30k_train_044759
Implement the Python class `Routine` described below. Class description: Setup the routine to launch in Openmdao. Method signatures and docstrings: - def __init__(self): Define default main parameters. - def get_user_inputs(self, tixi): Take user inputs from the GUI.
Implement the Python class `Routine` described below. Class description: Setup the routine to launch in Openmdao. Method signatures and docstrings: - def __init__(self): Define default main parameters. - def get_user_inputs(self, tixi): Take user inputs from the GUI. <|skeleton|> class Routine: """Setup the rout...
3cc211507caab176a76213e442238abfa43afa42
<|skeleton|> class Routine: """Setup the routine to launch in Openmdao.""" def __init__(self): """Define default main parameters.""" <|body_0|> def get_user_inputs(self, tixi): """Take user inputs from the GUI.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Routine: """Setup the routine to launch in Openmdao.""" def __init__(self): """Define default main parameters.""" self.type = 'Optim' self.date = '' self.modules = [] self.minmax = 'min' self.objective = ['cl'] self.driver = 'COBYLA' self.sa...
the_stack_v2_python_sparse
ceasiompy/Optimisation/func/optimfunctions.py
schneo/CEASIOMpy
train
0
628a9332b03ada0a770325ba6fe7bda689c4a831
[ "assert isinstance(node, NodeDefinition)\nself._node = node\nself.rules = list()", "if not closure is None:\n assert Tool.isCallable(closure)\n self.rules.append(closure)\n return self\nself.rules.append(ExprBuilder(self._node))\nreturn self.rules[-1]" ]
<|body_start_0|> assert isinstance(node, NodeDefinition) self._node = node self.rules = list() <|end_body_0|> <|body_start_1|> if not closure is None: assert Tool.isCallable(closure) self.rules.append(closure) return self self.rules.append(Exp...
This class builds validation conditions. @author Christophe Coevoet <stof@notk.org>
ValidationBuilder
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ValidationBuilder: """This class builds validation conditions. @author Christophe Coevoet <stof@notk.org>""" def __init__(self, node): """Constructor @param node: NodeDefinition The related node""" <|body_0|> def rule(self, closure=None): """Registers a closure t...
stack_v2_sparse_classes_75kplus_train_002586
40,265
permissive
[ { "docstring": "Constructor @param node: NodeDefinition The related node", "name": "__init__", "signature": "def __init__(self, node)" }, { "docstring": "Registers a closure to run as normalization or an expression builder to build it if null is provided. @param closure: callable @return: ExprBu...
2
null
Implement the Python class `ValidationBuilder` described below. Class description: This class builds validation conditions. @author Christophe Coevoet <stof@notk.org> Method signatures and docstrings: - def __init__(self, node): Constructor @param node: NodeDefinition The related node - def rule(self, closure=None): ...
Implement the Python class `ValidationBuilder` described below. Class description: This class builds validation conditions. @author Christophe Coevoet <stof@notk.org> Method signatures and docstrings: - def __init__(self, node): Constructor @param node: NodeDefinition The related node - def rule(self, closure=None): ...
4b40f042f8096eb59d2c85524981a4a5262364cb
<|skeleton|> class ValidationBuilder: """This class builds validation conditions. @author Christophe Coevoet <stof@notk.org>""" def __init__(self, node): """Constructor @param node: NodeDefinition The related node""" <|body_0|> def rule(self, closure=None): """Registers a closure t...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ValidationBuilder: """This class builds validation conditions. @author Christophe Coevoet <stof@notk.org>""" def __init__(self, node): """Constructor @param node: NodeDefinition The related node""" assert isinstance(node, NodeDefinition) self._node = node self.rules = list...
the_stack_v2_python_sparse
src/pymfony/component/config/definition/builder.py
pymfony/pymfony
train
1
8fa95c869dfbd447b514faa456200ee97fc9ce5c
[ "if serialized != None:\n self.root = simplejson.loads(serialized)\nelse:\n self.root = {}\nself._cache = {}", "if node is None:\n node = self.root\nreturn simplejson.dumps(node, ensure_ascii=False)", "if type(path) != tuple:\n raise AttributeError('Path of type tuple required (path was %s)' % (path...
<|body_start_0|> if serialized != None: self.root = simplejson.loads(serialized) else: self.root = {} self._cache = {} <|end_body_0|> <|body_start_1|> if node is None: node = self.root return simplejson.dumps(node, ensure_ascii=False) <|end_bo...
AttrTree
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AttrTree: def __init__(self, serialized=None): """Initialize a tree object. if serialized is set, the tree is initialized based on a tree object it expects in JSON format.""" <|body_0|> def serialize(self, node=None): """Returns a JSON-dump-formatted representation o...
stack_v2_sparse_classes_75kplus_train_002587
2,078
no_license
[ { "docstring": "Initialize a tree object. if serialized is set, the tree is initialized based on a tree object it expects in JSON format.", "name": "__init__", "signature": "def __init__(self, serialized=None)" }, { "docstring": "Returns a JSON-dump-formatted representation of the tree.", "n...
4
stack_v2_sparse_classes_30k_train_012600
Implement the Python class `AttrTree` described below. Class description: Implement the AttrTree class. Method signatures and docstrings: - def __init__(self, serialized=None): Initialize a tree object. if serialized is set, the tree is initialized based on a tree object it expects in JSON format. - def serialize(sel...
Implement the Python class `AttrTree` described below. Class description: Implement the AttrTree class. Method signatures and docstrings: - def __init__(self, serialized=None): Initialize a tree object. if serialized is set, the tree is initialized based on a tree object it expects in JSON format. - def serialize(sel...
d49d48923a1e88cc94254f2fb66a4f1dc74d3480
<|skeleton|> class AttrTree: def __init__(self, serialized=None): """Initialize a tree object. if serialized is set, the tree is initialized based on a tree object it expects in JSON format.""" <|body_0|> def serialize(self, node=None): """Returns a JSON-dump-formatted representation o...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AttrTree: def __init__(self, serialized=None): """Initialize a tree object. if serialized is set, the tree is initialized based on a tree object it expects in JSON format.""" if serialized != None: self.root = simplejson.loads(serialized) else: self.root = {} ...
the_stack_v2_python_sparse
attr_tree.py
mixerlabs/util
train
2
4a0521e733d7580ef3eba6519f3e26a369b68637
[ "super().__init__()\nself.unpooling = unpooling\nself.kernel_size = kernel_size\nself.dec_l1 = SphericalChebBNPoolConcat(512, 512, laps[1], self.unpooling, self.kernel_size)\nself.dec_l2 = SphericalChebBNPoolConcat(512, 256, laps[2], self.unpooling, self.kernel_size)\nself.dec_l3 = SphericalChebBNPoolConcat(256, 12...
<|body_start_0|> super().__init__() self.unpooling = unpooling self.kernel_size = kernel_size self.dec_l1 = SphericalChebBNPoolConcat(512, 512, laps[1], self.unpooling, self.kernel_size) self.dec_l2 = SphericalChebBNPoolConcat(512, 256, laps[2], self.unpooling, self.kernel_size) ...
The decoder of the Spherical UNet.
Decoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Decoder: """The decoder of the Spherical UNet.""" def __init__(self, unpooling, laps, kernel_size): """Initialization. Args: unpooling (:obj:`torch.nn.Module`): The unpooling object. laps (list): List of laplacians.""" <|body_0|> def forward(self, x_enc0, x_enc1, x_enc2,...
stack_v2_sparse_classes_75kplus_train_002588
41,403
no_license
[ { "docstring": "Initialization. Args: unpooling (:obj:`torch.nn.Module`): The unpooling object. laps (list): List of laplacians.", "name": "__init__", "signature": "def __init__(self, unpooling, laps, kernel_size)" }, { "docstring": "Forward Pass. Args: x_enc* (:obj:`torch.Tensor`): input tensor...
2
stack_v2_sparse_classes_30k_train_021104
Implement the Python class `Decoder` described below. Class description: The decoder of the Spherical UNet. Method signatures and docstrings: - def __init__(self, unpooling, laps, kernel_size): Initialization. Args: unpooling (:obj:`torch.nn.Module`): The unpooling object. laps (list): List of laplacians. - def forwa...
Implement the Python class `Decoder` described below. Class description: The decoder of the Spherical UNet. Method signatures and docstrings: - def __init__(self, unpooling, laps, kernel_size): Initialization. Args: unpooling (:obj:`torch.nn.Module`): The unpooling object. laps (list): List of laplacians. - def forwa...
7e55a422588c1d1e00f35a3d3a3ff896cce59e18
<|skeleton|> class Decoder: """The decoder of the Spherical UNet.""" def __init__(self, unpooling, laps, kernel_size): """Initialization. Args: unpooling (:obj:`torch.nn.Module`): The unpooling object. laps (list): List of laplacians.""" <|body_0|> def forward(self, x_enc0, x_enc1, x_enc2,...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Decoder: """The decoder of the Spherical UNet.""" def __init__(self, unpooling, laps, kernel_size): """Initialization. Args: unpooling (:obj:`torch.nn.Module`): The unpooling object. laps (list): List of laplacians.""" super().__init__() self.unpooling = unpooling self.ker...
the_stack_v2_python_sparse
generated/test_deepsphere_deepsphere_pytorch.py
jansel/pytorch-jit-paritybench
train
35
9459da75311c991c93dbf96ffebf399ec11f5916
[ "super().__init__(game, neural_net, args, MCTS, DefaultAlphaZeroPlayer)\nif run_name is None:\n run_name = datetime.now().strftime('%Y%m%d-%H%M%S')\nself.log_dir = f'out/logs/AlphaZero/{self.neural_net.architecture}/' + run_name\nself.file_writer = tf.summary.create_file_writer(self.log_dir + '/metrics')\nself.f...
<|body_start_0|> super().__init__(game, neural_net, args, MCTS, DefaultAlphaZeroPlayer) if run_name is None: run_name = datetime.now().strftime('%Y%m%d-%H%M%S') self.log_dir = f'out/logs/AlphaZero/{self.neural_net.architecture}/' + run_name self.file_writer = tf.summary.creat...
Implement base Coach class to define proper data-batch sampling procedures and logging objects.
AlphaZeroCoach
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AlphaZeroCoach: """Implement base Coach class to define proper data-batch sampling procedures and logging objects.""" def __init__(self, game, neural_net, args: DotDict, run_name: typing.Optional[str]=None) -> None: """Initialize the class for self-play. This inherited method initial...
stack_v2_sparse_classes_75kplus_train_002589
3,434
permissive
[ { "docstring": "Initialize the class for self-play. This inherited method initializes tensorboard logging. The super class is initialized with the proper search engine and agent-interface. (MCTS, AlphaZeroPlayer) :param game: Game Implementation of Game class for environment logic. :param neural_net: AlphaNeura...
2
stack_v2_sparse_classes_30k_test_002713
Implement the Python class `AlphaZeroCoach` described below. Class description: Implement base Coach class to define proper data-batch sampling procedures and logging objects. Method signatures and docstrings: - def __init__(self, game, neural_net, args: DotDict, run_name: typing.Optional[str]=None) -> None: Initiali...
Implement the Python class `AlphaZeroCoach` described below. Class description: Implement base Coach class to define proper data-batch sampling procedures and logging objects. Method signatures and docstrings: - def __init__(self, game, neural_net, args: DotDict, run_name: typing.Optional[str]=None) -> None: Initiali...
78478c6a8a0f0e0e740159236d6cbb30a9396f5a
<|skeleton|> class AlphaZeroCoach: """Implement base Coach class to define proper data-batch sampling procedures and logging objects.""" def __init__(self, game, neural_net, args: DotDict, run_name: typing.Optional[str]=None) -> None: """Initialize the class for self-play. This inherited method initial...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AlphaZeroCoach: """Implement base Coach class to define proper data-batch sampling procedures and logging objects.""" def __init__(self, game, neural_net, args: DotDict, run_name: typing.Optional[str]=None) -> None: """Initialize the class for self-play. This inherited method initializes tensorbo...
the_stack_v2_python_sparse
AlphaZero/AlphaCoach.py
frankbryce/muzero
train
1
c047775f02c6f9a4b46bf701e8baea7b6b79f7c4
[ "sum_square = sum([pow(x[i] - y[i], 2) for i in xrange(len(x))])\nscore = 1 / (1 + sqrt(sum_square))\nreturn score", "n = len(x)\nvals = range(n)\nsum_x = sum([float(x[i]) for i in vals])\nsum_y = sum([float(y[i]) for i in vals])\nsum_x_square = sum([x[i] ** 2.0 for i in vals])\nsum_y_square = sum([y[i] ** 2.0 fo...
<|body_start_0|> sum_square = sum([pow(x[i] - y[i], 2) for i in xrange(len(x))]) score = 1 / (1 + sqrt(sum_square)) return score <|end_body_0|> <|body_start_1|> n = len(x) vals = range(n) sum_x = sum([float(x[i]) for i in vals]) sum_y = sum([float(y[i]) for i in ...
Various algorithms to calculate similarity score
Similarity
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Similarity: """Various algorithms to calculate similarity score""" def euclidean(self, x, y): """Calculates euclidean score between two lists of same length""" <|body_0|> def pearson(self, x, y): """Calculates pearson correlation coefficient between two lists of ...
stack_v2_sparse_classes_75kplus_train_002590
951
permissive
[ { "docstring": "Calculates euclidean score between two lists of same length", "name": "euclidean", "signature": "def euclidean(self, x, y)" }, { "docstring": "Calculates pearson correlation coefficient between two lists of same length", "name": "pearson", "signature": "def pearson(self, ...
2
stack_v2_sparse_classes_30k_train_025205
Implement the Python class `Similarity` described below. Class description: Various algorithms to calculate similarity score Method signatures and docstrings: - def euclidean(self, x, y): Calculates euclidean score between two lists of same length - def pearson(self, x, y): Calculates pearson correlation coefficient ...
Implement the Python class `Similarity` described below. Class description: Various algorithms to calculate similarity score Method signatures and docstrings: - def euclidean(self, x, y): Calculates euclidean score between two lists of same length - def pearson(self, x, y): Calculates pearson correlation coefficient ...
58000e48b4196ee0a07233eb3038d31732ca4040
<|skeleton|> class Similarity: """Various algorithms to calculate similarity score""" def euclidean(self, x, y): """Calculates euclidean score between two lists of same length""" <|body_0|> def pearson(self, x, y): """Calculates pearson correlation coefficient between two lists of ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Similarity: """Various algorithms to calculate similarity score""" def euclidean(self, x, y): """Calculates euclidean score between two lists of same length""" sum_square = sum([pow(x[i] - y[i], 2) for i in xrange(len(x))]) score = 1 / (1 + sqrt(sum_square)) return score ...
the_stack_v2_python_sparse
Recommendation-System/classes/similarity.py
kinshuk4/kaggle-solutions
train
1
5f88fc41f2c324b042f3e5cb856b695f0d0c8fa0
[ "tf.logging.info('Creating MultiHeadDQNAgent with following parameters:')\ntf.logging.info('\\t num_heads: %d', num_heads)\ntf.logging.info('\\t transform_strategy: %s', transform_strategy)\ntf.logging.info('\\t num_convex_combinations: %d', num_convex_combinations)\ntf.logging.info('\\t init_checkpoint_dir: %s', i...
<|body_start_0|> tf.logging.info('Creating MultiHeadDQNAgent with following parameters:') tf.logging.info('\t num_heads: %d', num_heads) tf.logging.info('\t transform_strategy: %s', transform_strategy) tf.logging.info('\t num_convex_combinations: %d', num_convex_combinations) tf....
DQN agent with multiple heads.
MultiHeadDQNAgent
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiHeadDQNAgent: """DQN agent with multiple heads.""" def __init__(self, sess, num_actions, num_heads=1, transform_strategy='IDENTITY', num_convex_combinations=1, network=atari_helpers.MultiHeadQNetwork, init_checkpoint_dir=None, **kwargs): """Initializes the agent and constructs t...
stack_v2_sparse_classes_75kplus_train_002591
5,707
permissive
[ { "docstring": "Initializes the agent and constructs the components of its graph. Args: sess: tf.Session, for executing ops. num_actions: int, number of actions the agent can take at any state. num_heads: int, Number of heads per action output of the Q function. transform_strategy: str, Possible options include...
4
stack_v2_sparse_classes_30k_train_004474
Implement the Python class `MultiHeadDQNAgent` described below. Class description: DQN agent with multiple heads. Method signatures and docstrings: - def __init__(self, sess, num_actions, num_heads=1, transform_strategy='IDENTITY', num_convex_combinations=1, network=atari_helpers.MultiHeadQNetwork, init_checkpoint_di...
Implement the Python class `MultiHeadDQNAgent` described below. Class description: DQN agent with multiple heads. Method signatures and docstrings: - def __init__(self, sess, num_actions, num_heads=1, transform_strategy='IDENTITY', num_convex_combinations=1, network=atari_helpers.MultiHeadQNetwork, init_checkpoint_di...
6f7f4d55af077b7f27648d8b970cf1558c3e791d
<|skeleton|> class MultiHeadDQNAgent: """DQN agent with multiple heads.""" def __init__(self, sess, num_actions, num_heads=1, transform_strategy='IDENTITY', num_convex_combinations=1, network=atari_helpers.MultiHeadQNetwork, init_checkpoint_dir=None, **kwargs): """Initializes the agent and constructs t...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MultiHeadDQNAgent: """DQN agent with multiple heads.""" def __init__(self, sess, num_actions, num_heads=1, transform_strategy='IDENTITY', num_convex_combinations=1, network=atari_helpers.MultiHeadQNetwork, init_checkpoint_dir=None, **kwargs): """Initializes the agent and constructs the components...
the_stack_v2_python_sparse
batch_rl/multi_head/multi_head_dqn_agent.py
google-research/batch_rl
train
484
e0764768d0223253f5b731c708b8922ab74d8968
[ "self.logger = logging.getLogger('SMBO')\nself.incumbent = None\nself.scenario = scenario\nself.config_space = scenario.cs\nself.stats = stats\nself.initial_design = initial_design\nself.runhistory = runhistory\nself.rh2EPM = runhistory2epm\nself.intensifier = intensifier\nself.aggregate_func = aggregate_func\nself...
<|body_start_0|> self.logger = logging.getLogger('SMBO') self.incumbent = None self.scenario = scenario self.config_space = scenario.cs self.stats = stats self.initial_design = initial_design self.runhistory = runhistory self.rh2EPM = runhistory2epm ...
PCSMBOSigmoidRandomSearch
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PCSMBOSigmoidRandomSearch: def __init__(self, scenario: Scenario, stats: Stats, initial_design: InitialDesign, runhistory: RunHistory, runhistory2epm: AbstractRunHistory2EPM, intensifier: Intensifier, aggregate_func: callable, num_run: int, model: RandomForestWithInstances, rng: np.random.Random...
stack_v2_sparse_classes_75kplus_train_002592
13,167
no_license
[ { "docstring": "Interface that contains the main Bayesian optimization loop Parameters ---------- scenario: smac.scenario.scenario.Scenario Scenario object stats: Stats statistics object with configuration budgets initial_design: InitialDesign initial sampling design runhistory: RunHistory runhistory with all r...
2
stack_v2_sparse_classes_30k_train_002226
Implement the Python class `PCSMBOSigmoidRandomSearch` described below. Class description: Implement the PCSMBOSigmoidRandomSearch class. Method signatures and docstrings: - def __init__(self, scenario: Scenario, stats: Stats, initial_design: InitialDesign, runhistory: RunHistory, runhistory2epm: AbstractRunHistory2E...
Implement the Python class `PCSMBOSigmoidRandomSearch` described below. Class description: Implement the PCSMBOSigmoidRandomSearch class. Method signatures and docstrings: - def __init__(self, scenario: Scenario, stats: Stats, initial_design: InitialDesign, runhistory: RunHistory, runhistory2epm: AbstractRunHistory2E...
0a6e8719438a3f510e0aaeda19c14dd8005d8c65
<|skeleton|> class PCSMBOSigmoidRandomSearch: def __init__(self, scenario: Scenario, stats: Stats, initial_design: InitialDesign, runhistory: RunHistory, runhistory2epm: AbstractRunHistory2EPM, intensifier: Intensifier, aggregate_func: callable, num_run: int, model: RandomForestWithInstances, rng: np.random.Random...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PCSMBOSigmoidRandomSearch: def __init__(self, scenario: Scenario, stats: Stats, initial_design: InitialDesign, runhistory: RunHistory, runhistory2epm: AbstractRunHistory2EPM, intensifier: Intensifier, aggregate_func: callable, num_run: int, model: RandomForestWithInstances, rng: np.random.RandomState, select_...
the_stack_v2_python_sparse
pc_smac/pc_smbo/pc_smbo.py
jtuyls/pc_smac
train
0
fe41227834695fdd301389de35bdcae17b541183
[ "def _dot(x, y):\n if isinstance(x, SS.SparseVariable):\n return SS.structured_dot(x, y)\n else:\n return TT.dot(x, y)\n\ndef weight(n):\n return 'w' if len(self.inputs) == 1 else 'w_{}'.format(n)\nxws = ((inputs[n], self.find(weight(n))) for n in self.inputs)\npre = sum((_dot(x, w) for x, w ...
<|body_start_0|> def _dot(x, y): if isinstance(x, SS.SparseVariable): return SS.structured_dot(x, y) else: return TT.dot(x, y) def weight(n): return 'w' if len(self.inputs) == 1 else 'w_{}'.format(n) xws = ((inputs[n], self.fin...
A feedforward neural network layer performs a transform of its input. More precisely, feedforward layers as implemented here perform an affine transformation of their input, followed by a potentially nonlinear "activation" function performed elementwise on the transformed input. Feedforward layers are the fundamental b...
Feedforward
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Feedforward: """A feedforward neural network layer performs a transform of its input. More precisely, feedforward layers as implemented here perform an affine transformation of their input, followed by a potentially nonlinear "activation" function performed elementwise on the transformed input. F...
stack_v2_sparse_classes_75kplus_train_002593
8,072
permissive
[ { "docstring": "Transform the inputs for this layer into an output for the layer. Parameters ---------- inputs : dict of Theano expressions Symbolic inputs to this layer, given as a dictionary mapping string names to Theano expressions. See :func:`Layer.connect`. Returns ------- outputs : dict of Theano express...
2
stack_v2_sparse_classes_30k_train_010980
Implement the Python class `Feedforward` described below. Class description: A feedforward neural network layer performs a transform of its input. More precisely, feedforward layers as implemented here perform an affine transformation of their input, followed by a potentially nonlinear "activation" function performed ...
Implement the Python class `Feedforward` described below. Class description: A feedforward neural network layer performs a transform of its input. More precisely, feedforward layers as implemented here perform an affine transformation of their input, followed by a potentially nonlinear "activation" function performed ...
06b5b6f5de05220702f34c943f309d8188010b57
<|skeleton|> class Feedforward: """A feedforward neural network layer performs a transform of its input. More precisely, feedforward layers as implemented here perform an affine transformation of their input, followed by a potentially nonlinear "activation" function performed elementwise on the transformed input. F...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Feedforward: """A feedforward neural network layer performs a transform of its input. More precisely, feedforward layers as implemented here perform an affine transformation of their input, followed by a potentially nonlinear "activation" function performed elementwise on the transformed input. Feedforward la...
the_stack_v2_python_sparse
code/seq2seq_graph/src/theanets-0.6.1/theanets/layers/feedforward.py
scylla/masters_thesis
train
2
11ef01f03025f4049d8a9c4b631680f48a632216
[ "self.operands: List[Operand] = list(operands)\nfor i in range(len(self.operands)):\n self.operands[i] = Operand.validate_operand(self.operands[i])\nsuper().__init__()", "incomplete_expression = False\nfor operand in self.operands:\n if not issubclass(type(operand), Operand):\n raise RuntimeError(f'O...
<|body_start_0|> self.operands: List[Operand] = list(operands) for i in range(len(self.operands)): self.operands[i] = Operand.validate_operand(self.operands[i]) super().__init__() <|end_body_0|> <|body_start_1|> incomplete_expression = False for operand in self.opera...
Or operator class for filtering JumpStart content.
Or
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Or: """Or operator class for filtering JumpStart content.""" def __init__(self, *operands: Union[Operand, str]) -> None: """Instantiates Or object. Args: operands (Operand): Operand for Or-ing. Raises: RuntimeError: If the operands cannot be validated.""" <|body_0|> def ...
stack_v2_sparse_classes_75kplus_train_002594
16,623
permissive
[ { "docstring": "Instantiates Or object. Args: operands (Operand): Operand for Or-ing. Raises: RuntimeError: If the operands cannot be validated.", "name": "__init__", "signature": "def __init__(self, *operands: Union[Operand, str]) -> None" }, { "docstring": "Evaluates operator. Raises: RuntimeE...
3
stack_v2_sparse_classes_30k_train_012923
Implement the Python class `Or` described below. Class description: Or operator class for filtering JumpStart content. Method signatures and docstrings: - def __init__(self, *operands: Union[Operand, str]) -> None: Instantiates Or object. Args: operands (Operand): Operand for Or-ing. Raises: RuntimeError: If the oper...
Implement the Python class `Or` described below. Class description: Or operator class for filtering JumpStart content. Method signatures and docstrings: - def __init__(self, *operands: Union[Operand, str]) -> None: Instantiates Or object. Args: operands (Operand): Operand for Or-ing. Raises: RuntimeError: If the oper...
8d5d7fd8ae1a917ed3e2b988d5e533bce244fd85
<|skeleton|> class Or: """Or operator class for filtering JumpStart content.""" def __init__(self, *operands: Union[Operand, str]) -> None: """Instantiates Or object. Args: operands (Operand): Operand for Or-ing. Raises: RuntimeError: If the operands cannot be validated.""" <|body_0|> def ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Or: """Or operator class for filtering JumpStart content.""" def __init__(self, *operands: Union[Operand, str]) -> None: """Instantiates Or object. Args: operands (Operand): Operand for Or-ing. Raises: RuntimeError: If the operands cannot be validated.""" self.operands: List[Operand] = li...
the_stack_v2_python_sparse
src/sagemaker/jumpstart/filters.py
aws/sagemaker-python-sdk
train
2,050
bc0209c31b5ff4c086589c6d9b173bc56ec20580
[ "super().__init__()\nself.in_channels = channels\nself.filter_channels = filter_channels\nself.kernel_size = kernel_size\nself.dropout_rate = dropout_rate\nself.drop = torch.nn.Dropout(dropout_rate)\nself.conv_1 = torch.nn.Conv1d(channels, filter_channels, kernel_size, padding=kernel_size // 2)\nself.norm_1 = Layer...
<|body_start_0|> super().__init__() self.in_channels = channels self.filter_channels = filter_channels self.kernel_size = kernel_size self.dropout_rate = dropout_rate self.drop = torch.nn.Dropout(dropout_rate) self.conv_1 = torch.nn.Conv1d(channels, filter_channel...
DurationPredictor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DurationPredictor: def __init__(self, channels, filter_channels, kernel_size, dropout_rate, global_channels=0): """Initialize duration predictor module. Args: channels (int): Number of input channels. filter_channels (int): Number of filter channels. kernel_size (int): Size of the convol...
stack_v2_sparse_classes_75kplus_train_002595
2,729
permissive
[ { "docstring": "Initialize duration predictor module. Args: channels (int): Number of input channels. filter_channels (int): Number of filter channels. kernel_size (int): Size of the convolutional kernel. dropout_rate (float): Dropout rate. global_channels (int, optional): Number of global conditioning channels...
2
null
Implement the Python class `DurationPredictor` described below. Class description: Implement the DurationPredictor class. Method signatures and docstrings: - def __init__(self, channels, filter_channels, kernel_size, dropout_rate, global_channels=0): Initialize duration predictor module. Args: channels (int): Number ...
Implement the Python class `DurationPredictor` described below. Class description: Implement the DurationPredictor class. Method signatures and docstrings: - def __init__(self, channels, filter_channels, kernel_size, dropout_rate, global_channels=0): Initialize duration predictor module. Args: channels (int): Number ...
bcd20948db7846ee523443ef9fd78c7a1248c95e
<|skeleton|> class DurationPredictor: def __init__(self, channels, filter_channels, kernel_size, dropout_rate, global_channels=0): """Initialize duration predictor module. Args: channels (int): Number of input channels. filter_channels (int): Number of filter channels. kernel_size (int): Size of the convol...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DurationPredictor: def __init__(self, channels, filter_channels, kernel_size, dropout_rate, global_channels=0): """Initialize duration predictor module. Args: channels (int): Number of input channels. filter_channels (int): Number of filter channels. kernel_size (int): Size of the convolutional kernel...
the_stack_v2_python_sparse
espnet2/gan_svs/vits/duration_predictor.py
espnet/espnet
train
7,242
1a789202b316c5f420bdb0b95847af9fded6dbd0
[ "dp = np.zeros(len(nums))\nlength = 0\nfor num in nums:\n i = self.binary_search(nums, 0, length, num)\n if i < 0:\n i = -(i + 1)\n dp[i] = num\n if i + 1 > length:\n length = i + 1\nreturn length", "if r >= l:\n mid = int(l + (r - l) / 2)\n if nums[mid] == x:\n return mid\n...
<|body_start_0|> dp = np.zeros(len(nums)) length = 0 for num in nums: i = self.binary_search(nums, 0, length, num) if i < 0: i = -(i + 1) dp[i] = num if i + 1 > length: length = i + 1 return length <|end_body...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def length_of_LIS(self, nums: List[int]) -> int: """最长增数组 Args: nums:数组 Returns: 数组长度""" <|body_0|> def binary_search(self, nums: List[int], l: int, r: int, x: int): """二分查找 Args: nums: 输入数组 l: 开始下标 r: 结束下标 x: 要查找的数 Returns: 要查找数的下标""" <|body_1|> ...
stack_v2_sparse_classes_75kplus_train_002596
2,886
permissive
[ { "docstring": "最长增数组 Args: nums:数组 Returns: 数组长度", "name": "length_of_LIS", "signature": "def length_of_LIS(self, nums: List[int]) -> int" }, { "docstring": "二分查找 Args: nums: 输入数组 l: 开始下标 r: 结束下标 x: 要查找的数 Returns: 要查找数的下标", "name": "binary_search", "signature": "def binary_search(self, ...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def length_of_LIS(self, nums: List[int]) -> int: 最长增数组 Args: nums:数组 Returns: 数组长度 - def binary_search(self, nums: List[int], l: int, r: int, x: int): 二分查找 Args: nums: 输入数组 l: 开始...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def length_of_LIS(self, nums: List[int]) -> int: 最长增数组 Args: nums:数组 Returns: 数组长度 - def binary_search(self, nums: List[int], l: int, r: int, x: int): 二分查找 Args: nums: 输入数组 l: 开始...
50f35eef6a0ad63173efed10df3c835b1dceaa3f
<|skeleton|> class Solution: def length_of_LIS(self, nums: List[int]) -> int: """最长增数组 Args: nums:数组 Returns: 数组长度""" <|body_0|> def binary_search(self, nums: List[int], l: int, r: int, x: int): """二分查找 Args: nums: 输入数组 l: 开始下标 r: 结束下标 x: 要查找的数 Returns: 要查找数的下标""" <|body_1|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def length_of_LIS(self, nums: List[int]) -> int: """最长增数组 Args: nums:数组 Returns: 数组长度""" dp = np.zeros(len(nums)) length = 0 for num in nums: i = self.binary_search(nums, 0, length, num) if i < 0: i = -(i + 1) dp[i] ...
the_stack_v2_python_sparse
src/leetcodepython/array/longest_increasing_subsequence_300.py
zhangyu345293721/leetcode
train
101
c9b26b95d1890e17806162f3c42619bfc8f4636c
[ "header('Access-Control-Allow-Origin', ctx.env.get('HTTP_ORIGIN'))\nheader('Access-Control-Allow-Headers', ctx.env.get('HTTP_ACCESS_CONTROL_REQUEST_HEADERS'))\nheader('Access-Control-Allow-Methods', '*')\nheader('Access-Control-Allow-Credentials', 'true')\nheader('Access-Control-Expose-Headers', 'X-Rucio-Auth-Token...
<|body_start_0|> header('Access-Control-Allow-Origin', ctx.env.get('HTTP_ORIGIN')) header('Access-Control-Allow-Headers', ctx.env.get('HTTP_ACCESS_CONTROL_REQUEST_HEADERS')) header('Access-Control-Allow-Methods', '*') header('Access-Control-Allow-Credentials', 'true') header('Acc...
Request a challenge token for SSH authentication
SSHChallengeToken
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SSHChallengeToken: """Request a challenge token for SSH authentication""" def OPTIONS(self): """HTTP Success: 200 OK Allow cross-site scripting. Explicit for Authentication.""" <|body_0|> def GET(self): """HTTP Success: 200 OK HTTP Error: 401 Unauthorized :param ...
stack_v2_sparse_classes_75kplus_train_002597
18,732
permissive
[ { "docstring": "HTTP Success: 200 OK Allow cross-site scripting. Explicit for Authentication.", "name": "OPTIONS", "signature": "def OPTIONS(self)" }, { "docstring": "HTTP Success: 200 OK HTTP Error: 401 Unauthorized :param Rucio-Account: Account identifier as a string. :param Rucio-AppID: Appli...
2
stack_v2_sparse_classes_30k_train_021106
Implement the Python class `SSHChallengeToken` described below. Class description: Request a challenge token for SSH authentication Method signatures and docstrings: - def OPTIONS(self): HTTP Success: 200 OK Allow cross-site scripting. Explicit for Authentication. - def GET(self): HTTP Success: 200 OK HTTP Error: 401...
Implement the Python class `SSHChallengeToken` described below. Class description: Request a challenge token for SSH authentication Method signatures and docstrings: - def OPTIONS(self): HTTP Success: 200 OK Allow cross-site scripting. Explicit for Authentication. - def GET(self): HTTP Success: 200 OK HTTP Error: 401...
355a997a5ea213c427a5d841ab151ceb01073eb4
<|skeleton|> class SSHChallengeToken: """Request a challenge token for SSH authentication""" def OPTIONS(self): """HTTP Success: 200 OK Allow cross-site scripting. Explicit for Authentication.""" <|body_0|> def GET(self): """HTTP Success: 200 OK HTTP Error: 401 Unauthorized :param ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SSHChallengeToken: """Request a challenge token for SSH authentication""" def OPTIONS(self): """HTTP Success: 200 OK Allow cross-site scripting. Explicit for Authentication.""" header('Access-Control-Allow-Origin', ctx.env.get('HTTP_ORIGIN')) header('Access-Control-Allow-Headers',...
the_stack_v2_python_sparse
lib/rucio/web/rest/webpy/v1/authentication.py
pujanm/rucio
train
1
ceba0d60df7913255f7a2af9a0c5a667f4df4183
[ "this_dir, this_filename = os.path.split(__file__)\ncylinderpath = Filename.fromOsSpecific(os.path.join(this_dir, 'geomprim', 'cylinder.egg'))\nconepath = Filename.fromOsSpecific(os.path.join(this_dir, 'geomprim', 'sphere.egg'))\nboxpath = Filename.fromOsSpecific(os.path.join(this_dir, 'geomprim', 'box.egg'))\nself...
<|body_start_0|> this_dir, this_filename = os.path.split(__file__) cylinderpath = Filename.fromOsSpecific(os.path.join(this_dir, 'geomprim', 'cylinder.egg')) conepath = Filename.fromOsSpecific(os.path.join(this_dir, 'geomprim', 'sphere.egg')) boxpath = Filename.fromOsSpecific(os.path.joi...
use class to preload files and generate various models
PandaGeomGen
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PandaGeomGen: """use class to preload files and generate various models""" def __init__(self): """prepload the files the models will be instanceTo nodepaths to avoid frequent disk access""" <|body_0|> def gendumbbell(self, spos=None, epos=None, length=None, thickness=1.5...
stack_v2_sparse_classes_75kplus_train_002598
31,568
no_license
[ { "docstring": "prepload the files the models will be instanceTo nodepaths to avoid frequent disk access", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "generate a dumbbell to plot the stick model of a robot the function is essentially a copy of pandaplotutils/pandageo...
3
stack_v2_sparse_classes_30k_train_034115
Implement the Python class `PandaGeomGen` described below. Class description: use class to preload files and generate various models Method signatures and docstrings: - def __init__(self): prepload the files the models will be instanceTo nodepaths to avoid frequent disk access - def gendumbbell(self, spos=None, epos=...
Implement the Python class `PandaGeomGen` described below. Class description: use class to preload files and generate various models Method signatures and docstrings: - def __init__(self): prepload the files the models will be instanceTo nodepaths to avoid frequent disk access - def gendumbbell(self, spos=None, epos=...
60e24c28a6b39621a235187483d9a13cbbffe987
<|skeleton|> class PandaGeomGen: """use class to preload files and generate various models""" def __init__(self): """prepload the files the models will be instanceTo nodepaths to avoid frequent disk access""" <|body_0|> def gendumbbell(self, spos=None, epos=None, length=None, thickness=1.5...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PandaGeomGen: """use class to preload files and generate various models""" def __init__(self): """prepload the files the models will be instanceTo nodepaths to avoid frequent disk access""" this_dir, this_filename = os.path.split(__file__) cylinderpath = Filename.fromOsSpecific(os...
the_stack_v2_python_sparse
pandaplotutils/pandageom.py
wanweiwei07/pyhiro
train
7
a8ccf4183d5e013b468afff2b5b6e33994844f31
[ "super().__init__(process_manager, msg_queue)\nself.srf02 = srf02\nself.distance_threshold = distance_threshold\nself.near_obstacle_threshold = near_obstacle_threshold\nself.interval = interval\nself.addr_list = addr_list\nself.smoothing_coeff = 0.75\nself.max_distance = 50\nfor addr in self.addr_list:\n self.st...
<|body_start_0|> super().__init__(process_manager, msg_queue) self.srf02 = srf02 self.distance_threshold = distance_threshold self.near_obstacle_threshold = near_obstacle_threshold self.interval = interval self.addr_list = addr_list self.smoothing_coeff = 0.75 ...
超音波センサ(Srf02)を操作するクラス
Srf02Node
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Srf02Node: """超音波センサ(Srf02)を操作するクラス""" def __init__(self, process_manager, msg_queue, srf02, distance_threshold=15, near_obstacle_threshold=5, interval=0.5, addr_list=[112]): """コンストラクタ""" <|body_0|> def update(self): """入力を処理して状態を更新""" <|body_1|> <|end_...
stack_v2_sparse_classes_75kplus_train_002599
3,473
no_license
[ { "docstring": "コンストラクタ", "name": "__init__", "signature": "def __init__(self, process_manager, msg_queue, srf02, distance_threshold=15, near_obstacle_threshold=5, interval=0.5, addr_list=[112])" }, { "docstring": "入力を処理して状態を更新", "name": "update", "signature": "def update(self)" } ]
2
stack_v2_sparse_classes_30k_train_023952
Implement the Python class `Srf02Node` described below. Class description: 超音波センサ(Srf02)を操作するクラス Method signatures and docstrings: - def __init__(self, process_manager, msg_queue, srf02, distance_threshold=15, near_obstacle_threshold=5, interval=0.5, addr_list=[112]): コンストラクタ - def update(self): 入力を処理して状態を更新
Implement the Python class `Srf02Node` described below. Class description: 超音波センサ(Srf02)を操作するクラス Method signatures and docstrings: - def __init__(self, process_manager, msg_queue, srf02, distance_threshold=15, near_obstacle_threshold=5, interval=0.5, addr_list=[112]): コンストラクタ - def update(self): 入力を処理して状態を更新 <|skele...
a4659621011c87c9d9a97d63223aab51cbdd6e67
<|skeleton|> class Srf02Node: """超音波センサ(Srf02)を操作するクラス""" def __init__(self, process_manager, msg_queue, srf02, distance_threshold=15, near_obstacle_threshold=5, interval=0.5, addr_list=[112]): """コンストラクタ""" <|body_0|> def update(self): """入力を処理して状態を更新""" <|body_1|> <|end_...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Srf02Node: """超音波センサ(Srf02)を操作するクラス""" def __init__(self, process_manager, msg_queue, srf02, distance_threshold=15, near_obstacle_threshold=5, interval=0.5, addr_list=[112]): """コンストラクタ""" super().__init__(process_manager, msg_queue) self.srf02 = srf02 self.distance_thresh...
the_stack_v2_python_sparse
robot_lib/srf02_node.py
sterngerlach/raspi-robot
train
1