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
208d4e7a5f3ab74212b164d3fd746f25e7ec0962
[ "row = structures.flatMap(LigandInteractionFingerprint(interactionFilter))\nnullable = False\nfields = [StructField('structureChainId', StringType(), nullable), StructField('queryLigandId', StringType(), nullable), StructField('queryLigandNumber', StringType(), nullable), StructField('queryLigandChainId', StringTyp...
<|body_start_0|> row = structures.flatMap(LigandInteractionFingerprint(interactionFilter)) nullable = False fields = [StructField('structureChainId', StringType(), nullable), StructField('queryLigandId', StringType(), nullable), StructField('queryLigandNumber', StringType(), nullable), StructFie...
InteractionFingerprinter
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InteractionFingerprinter: def get_ligand_polymer_interactions(structures, interactionFilter): """Returns a dataset of ligand - macromolecule interacting residues. The dataset contains the following columns: - structureChainId - pdbId.chainName of chain that interacts with ligand - queryL...
stack_v2_sparse_classes_75kplus_train_070800
4,790
permissive
[ { "docstring": "Returns a dataset of ligand - macromolecule interacting residues. The dataset contains the following columns: - structureChainId - pdbId.chainName of chain that interacts with ligand - queryLigandId - id of ligand from PDB chemical component dictionary - queryLigandNumber - group number of ligan...
2
stack_v2_sparse_classes_30k_train_026486
Implement the Python class `InteractionFingerprinter` described below. Class description: Implement the InteractionFingerprinter class. Method signatures and docstrings: - def get_ligand_polymer_interactions(structures, interactionFilter): Returns a dataset of ligand - macromolecule interacting residues. The dataset ...
Implement the Python class `InteractionFingerprinter` described below. Class description: Implement the InteractionFingerprinter class. Method signatures and docstrings: - def get_ligand_polymer_interactions(structures, interactionFilter): Returns a dataset of ligand - macromolecule interacting residues. The dataset ...
9a3244a329a62e4e450d3e0f3f2dc93f45b4a453
<|skeleton|> class InteractionFingerprinter: def get_ligand_polymer_interactions(structures, interactionFilter): """Returns a dataset of ligand - macromolecule interacting residues. The dataset contains the following columns: - structureChainId - pdbId.chainName of chain that interacts with ligand - queryL...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class InteractionFingerprinter: def get_ligand_polymer_interactions(structures, interactionFilter): """Returns a dataset of ligand - macromolecule interacting residues. The dataset contains the following columns: - structureChainId - pdbId.chainName of chain that interacts with ligand - queryLigandId - id o...
the_stack_v2_python_sparse
mmtfPyspark/interactions/interactionFingerprinter.py
sbl-sdsc/mmtf-pyspark
train
66
4220448ae0824ab4198aff3545480525d61f5f43
[ "if not root:\n return False\nstack = []\nstack.append((root, root.val))\nwhile stack:\n curNode, curSum = stack.pop()\n if not curNode.left and (not curNode.right) and (curSum == sum):\n return True\n if curNode.right:\n stack.append((curNode.right, curSum + curNode.right.val))\n if cu...
<|body_start_0|> if not root: return False stack = [] stack.append((root, root.val)) while stack: curNode, curSum = stack.pop() if not curNode.left and (not curNode.right) and (curSum == sum): return True if curNode.right: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def hasPathSum(self, root, sum): """:type root: TreeNode :type sum: int :rtype: bool 使用DFS,每次迭代更深的层次,最后迭代到叶子节点验证和目标值是否相等""" <|body_0|> def hasPathSum1(self, root, sum): """使用递归直接找出结果""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not r...
stack_v2_sparse_classes_75kplus_train_070801
2,490
no_license
[ { "docstring": ":type root: TreeNode :type sum: int :rtype: bool 使用DFS,每次迭代更深的层次,最后迭代到叶子节点验证和目标值是否相等", "name": "hasPathSum", "signature": "def hasPathSum(self, root, sum)" }, { "docstring": "使用递归直接找出结果", "name": "hasPathSum1", "signature": "def hasPathSum1(self, root, sum)" } ]
2
stack_v2_sparse_classes_30k_train_004099
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hasPathSum(self, root, sum): :type root: TreeNode :type sum: int :rtype: bool 使用DFS,每次迭代更深的层次,最后迭代到叶子节点验证和目标值是否相等 - def hasPathSum1(self, root, sum): 使用递归直接找出结果
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hasPathSum(self, root, sum): :type root: TreeNode :type sum: int :rtype: bool 使用DFS,每次迭代更深的层次,最后迭代到叶子节点验证和目标值是否相等 - def hasPathSum1(self, root, sum): 使用递归直接找出结果 <|skeleton|>...
9687f8e743a8b6396fff192f22b5256d1025f86b
<|skeleton|> class Solution: def hasPathSum(self, root, sum): """:type root: TreeNode :type sum: int :rtype: bool 使用DFS,每次迭代更深的层次,最后迭代到叶子节点验证和目标值是否相等""" <|body_0|> def hasPathSum1(self, root, sum): """使用递归直接找出结果""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def hasPathSum(self, root, sum): """:type root: TreeNode :type sum: int :rtype: bool 使用DFS,每次迭代更深的层次,最后迭代到叶子节点验证和目标值是否相等""" if not root: return False stack = [] stack.append((root, root.val)) while stack: curNode, curSum = stack.pop() ...
the_stack_v2_python_sparse
2017/tree/Path_Sum.py
buhuipao/LeetCode
train
5
f70ed00cf128e878bbbcc66563038b1dfa630cde
[ "emails = clean_addresses(self.data['emails'])\nif not len(emails):\n raise ValidationError('No Valid Addresses Found')\nemail_string = [formataddr(entry) for entry in emails]\nreturn email_string", "is_staff = self.cleaned_data.get('is_staff', False)\nis_superuser = self.cleaned_data.get('is_superuser', False...
<|body_start_0|> emails = clean_addresses(self.data['emails']) if not len(emails): raise ValidationError('No Valid Addresses Found') email_string = [formataddr(entry) for entry in emails] return email_string <|end_body_0|> <|body_start_1|> is_staff = self.cleaned_dat...
Form for inviting a user.
InviteForm
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InviteForm: """Form for inviting a user.""" def clean_emails(self): """Clean up email field to only include symantically valid addresses""" <|body_0|> def save(self): """Save the form.""" <|body_1|> <|end_skeleton|> <|body_start_0|> emails = cle...
stack_v2_sparse_classes_75kplus_train_070802
8,878
permissive
[ { "docstring": "Clean up email field to only include symantically valid addresses", "name": "clean_emails", "signature": "def clean_emails(self)" }, { "docstring": "Save the form.", "name": "save", "signature": "def save(self)" } ]
2
stack_v2_sparse_classes_30k_train_023414
Implement the Python class `InviteForm` described below. Class description: Form for inviting a user. Method signatures and docstrings: - def clean_emails(self): Clean up email field to only include symantically valid addresses - def save(self): Save the form.
Implement the Python class `InviteForm` described below. Class description: Form for inviting a user. Method signatures and docstrings: - def clean_emails(self): Clean up email field to only include symantically valid addresses - def save(self): Save the form. <|skeleton|> class InviteForm: """Form for inviting ...
a56c0f89df82694bf5db32a04d8b092974791972
<|skeleton|> class InviteForm: """Form for inviting a user.""" def clean_emails(self): """Clean up email field to only include symantically valid addresses""" <|body_0|> def save(self): """Save the form.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class InviteForm: """Form for inviting a user.""" def clean_emails(self): """Clean up email field to only include symantically valid addresses""" emails = clean_addresses(self.data['emails']) if not len(emails): raise ValidationError('No Valid Addresses Found') email...
the_stack_v2_python_sparse
open_connect/accounts/forms.py
ofa/connect
train
66
783b5af64f8425565c15878fb78b6f0afe80d7bf
[ "if context is None:\n context = {}\nif paymentorder_ids is None:\n paymentorder_ids = []\nsession = ConnectorSession(cr, uid, context=context)\nname = self._name\nvalues = {'post_job_uuid': None}\n_logger.info(u'{0} jobs for processing payment orders have been created.'.format(len(paymentorder_ids)))\nfor pa...
<|body_start_0|> if context is None: context = {} if paymentorder_ids is None: paymentorder_ids = [] session = ConnectorSession(cr, uid, context=context) name = self._name values = {'post_job_uuid': None} _logger.info(u'{0} jobs for processing paym...
We modify the payment.order to allow delayed processing.
PaymentOrder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PaymentOrder: """We modify the payment.order to allow delayed processing.""" def _delay_paymentorder_marked(self, cr, uid, eta=None, paymentorder_ids=None, context=None): """Create a job for every payment order marked for batch processing. If some payment.orders already have a job, t...
stack_v2_sparse_classes_75kplus_train_070803
7,945
no_license
[ { "docstring": "Create a job for every payment order marked for batch processing. If some payment.orders already have a job, they are skipped.", "name": "_delay_paymentorder_marked", "signature": "def _delay_paymentorder_marked(self, cr, uid, eta=None, paymentorder_ids=None, context=None)" }, { ...
4
null
Implement the Python class `PaymentOrder` described below. Class description: We modify the payment.order to allow delayed processing. Method signatures and docstrings: - def _delay_paymentorder_marked(self, cr, uid, eta=None, paymentorder_ids=None, context=None): Create a job for every payment order marked for batch...
Implement the Python class `PaymentOrder` described below. Class description: We modify the payment.order to allow delayed processing. Method signatures and docstrings: - def _delay_paymentorder_marked(self, cr, uid, eta=None, paymentorder_ids=None, context=None): Create a job for every payment order marked for batch...
a359060d67d3049ffad0946b65691a73738f0ebf
<|skeleton|> class PaymentOrder: """We modify the payment.order to allow delayed processing.""" def _delay_paymentorder_marked(self, cr, uid, eta=None, paymentorder_ids=None, context=None): """Create a job for every payment order marked for batch processing. If some payment.orders already have a job, t...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PaymentOrder: """We modify the payment.order to allow delayed processing.""" def _delay_paymentorder_marked(self, cr, uid, eta=None, paymentorder_ids=None, context=None): """Create a job for every payment order marked for batch processing. If some payment.orders already have a job, they are skipp...
the_stack_v2_python_sparse
sepa_direct_debit_confirm/models/payment_order.py
shouyejing/civicrm_connector
train
0
a4256fa20a9b6c8e68b981c18d63913ef670d3ae
[ "elements = []\nseen = set()\nfor x in iterable:\n if x not in seen:\n elements.append(x)\n seen.add(x)\nreturn super(FiniteEnumeratedSet, cls).__classcall__(cls, tuple(elements), facade)", "Parent.__init__(self, facade=facade, category=(Posets(), FiniteEnumeratedSets()))\nself._elements = elemen...
<|body_start_0|> elements = [] seen = set() for x in iterable: if x not in seen: elements.append(x) seen.add(x) return super(FiniteEnumeratedSet, cls).__classcall__(cls, tuple(elements), facade) <|end_body_0|> <|body_start_1|> Parent._...
Totally ordered finite set. This is a finite enumerated set assuming that the elements are ordered based upon their rank (i.e. their position in the set). INPUT: - ``elements`` -- A list of elements in the set - ``facade`` -- (default: ``True``) if ``True``, a facade is used; it should be set to ``False`` if the elemen...
TotallyOrderedFiniteSet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TotallyOrderedFiniteSet: """Totally ordered finite set. This is a finite enumerated set assuming that the elements are ordered based upon their rank (i.e. their position in the set). INPUT: - ``elements`` -- A list of elements in the set - ``facade`` -- (default: ``True``) if ``True``, a facade i...
stack_v2_sparse_classes_75kplus_train_070804
10,047
no_license
[ { "docstring": "Standard trick to expand the iterable upon input, and guarantees unique representation, independently of the type of the iterable. See ``UniqueRepresentation``. TESTS:: sage: S1 = TotallyOrderedFiniteSet([1, 2, 3]) sage: S2 = TotallyOrderedFiniteSet((1, 2, 3)) sage: S3 = TotallyOrderedFiniteSet(...
4
stack_v2_sparse_classes_30k_train_005737
Implement the Python class `TotallyOrderedFiniteSet` described below. Class description: Totally ordered finite set. This is a finite enumerated set assuming that the elements are ordered based upon their rank (i.e. their position in the set). INPUT: - ``elements`` -- A list of elements in the set - ``facade`` -- (def...
Implement the Python class `TotallyOrderedFiniteSet` described below. Class description: Totally ordered finite set. This is a finite enumerated set assuming that the elements are ordered based upon their rank (i.e. their position in the set). INPUT: - ``elements`` -- A list of elements in the set - ``facade`` -- (def...
0d9eacbf74e2acffefde93e39f8bcbec745cdaba
<|skeleton|> class TotallyOrderedFiniteSet: """Totally ordered finite set. This is a finite enumerated set assuming that the elements are ordered based upon their rank (i.e. their position in the set). INPUT: - ``elements`` -- A list of elements in the set - ``facade`` -- (default: ``True``) if ``True``, a facade i...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TotallyOrderedFiniteSet: """Totally ordered finite set. This is a finite enumerated set assuming that the elements are ordered based upon their rank (i.e. their position in the set). INPUT: - ``elements`` -- A list of elements in the set - ``facade`` -- (default: ``True``) if ``True``, a facade is used; it sh...
the_stack_v2_python_sparse
sage/src/sage/sets/totally_ordered_finite_set.py
bopopescu/geosci
train
0
e16ad8a32182404f3929cd0dac108427602598ad
[ "logging.info(messages.FUN_STARTS.format(fname()))\nimport dbma\nredis_systemd_config_template = Path(dbma.__file__).parent / 'static/cnfs/redisd.service.jinja'\nif not redis_systemd_config_template.exists():\n msg = \"redis systemd config file '' not exists .\".format(redis_systemd_config_template)\n logging...
<|body_start_0|> logging.info(messages.FUN_STARTS.format(fname())) import dbma redis_systemd_config_template = Path(dbma.__file__).parent / 'static/cnfs/redisd.service.jinja' if not redis_systemd_config_template.exists(): msg = "redis systemd config file '' not exists .".form...
RedisSystemdConfig
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RedisSystemdConfig: def render_config(self): """沉浸 Redis 的 Systemd 配置文件 Exceptions: ----------- RedisConfigTemplateFileNotExistsException""" <|body_0|> def generate_systemd_config(self): """生成 systemd 配置文件""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_070805
2,310
no_license
[ { "docstring": "沉浸 Redis 的 Systemd 配置文件 Exceptions: ----------- RedisConfigTemplateFileNotExistsException", "name": "render_config", "signature": "def render_config(self)" }, { "docstring": "生成 systemd 配置文件", "name": "generate_systemd_config", "signature": "def generate_systemd_config(se...
2
stack_v2_sparse_classes_30k_train_008739
Implement the Python class `RedisSystemdConfig` described below. Class description: Implement the RedisSystemdConfig class. Method signatures and docstrings: - def render_config(self): 沉浸 Redis 的 Systemd 配置文件 Exceptions: ----------- RedisConfigTemplateFileNotExistsException - def generate_systemd_config(self): 生成 sys...
Implement the Python class `RedisSystemdConfig` described below. Class description: Implement the RedisSystemdConfig class. Method signatures and docstrings: - def render_config(self): 沉浸 Redis 的 Systemd 配置文件 Exceptions: ----------- RedisConfigTemplateFileNotExistsException - def generate_systemd_config(self): 生成 sys...
3d92fbac91d561c91789f425330fdbb9b41f62bd
<|skeleton|> class RedisSystemdConfig: def render_config(self): """沉浸 Redis 的 Systemd 配置文件 Exceptions: ----------- RedisConfigTemplateFileNotExistsException""" <|body_0|> def generate_systemd_config(self): """生成 systemd 配置文件""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RedisSystemdConfig: def render_config(self): """沉浸 Redis 的 Systemd 配置文件 Exceptions: ----------- RedisConfigTemplateFileNotExistsException""" logging.info(messages.FUN_STARTS.format(fname())) import dbma redis_systemd_config_template = Path(dbma.__file__).parent / 'static/cnfs/r...
the_stack_v2_python_sparse
dbma/components/redis/systemd.py
Neeky/dbm-agent
train
183
92561b31d8872db13af3217f7398f30e0364540c
[ "self.memoize = dict()\nself.x = x\nself.y = y", "ret = self.memoize.get((i, j))\nif ret is None:\n ret = self.memoize[i, j] = len(self.x) - i if not j < len(self.y) else len(self.y) - j if not i < len(self.x) else self.compute(i + 1, j + 1) if self.x[i] == self.y[j] else 1 + min(self.compute(i + 1, j), self.c...
<|body_start_0|> self.memoize = dict() self.x = x self.y = y <|end_body_0|> <|body_start_1|> ret = self.memoize.get((i, j)) if ret is None: ret = self.memoize[i, j] = len(self.x) - i if not j < len(self.y) else len(self.y) - j if not i < len(self.x) else self.compute...
The :py:class:`LevenshteinDistance` class is used to implement the memoization used by the :py:func:`levenshtein_distance` function.
LevenshteinDistance
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LevenshteinDistance: """The :py:class:`LevenshteinDistance` class is used to implement the memoization used by the :py:func:`levenshtein_distance` function.""" def __init__(self, x: str, y: str): """Constructor. Args: x (str): The left operand. y (str): The right operand.""" ...
stack_v2_sparse_classes_75kplus_train_070806
2,789
permissive
[ { "docstring": "Constructor. Args: x (str): The left operand. y (str): The right operand.", "name": "__init__", "signature": "def __init__(self, x: str, y: str)" }, { "docstring": "Computes the `Levenshtein distance <https://en.wikipedia.org/wiki/Levenshtein_distance>`__, with memoization. Args:...
2
null
Implement the Python class `LevenshteinDistance` described below. Class description: The :py:class:`LevenshteinDistance` class is used to implement the memoization used by the :py:func:`levenshtein_distance` function. Method signatures and docstrings: - def __init__(self, x: str, y: str): Constructor. Args: x (str): ...
Implement the Python class `LevenshteinDistance` described below. Class description: The :py:class:`LevenshteinDistance` class is used to implement the memoization used by the :py:func:`levenshtein_distance` function. Method signatures and docstrings: - def __init__(self, x: str, y: str): Constructor. Args: x (str): ...
707f2df32ede7d9a992ea217a4791da34f13e138
<|skeleton|> class LevenshteinDistance: """The :py:class:`LevenshteinDistance` class is used to implement the memoization used by the :py:func:`levenshtein_distance` function.""" def __init__(self, x: str, y: str): """Constructor. Args: x (str): The left operand. y (str): The right operand.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LevenshteinDistance: """The :py:class:`LevenshteinDistance` class is used to implement the memoization used by the :py:func:`levenshtein_distance` function.""" def __init__(self, x: str, y: str): """Constructor. Args: x (str): The left operand. y (str): The right operand.""" self.memoize ...
the_stack_v2_python_sparse
src/pybgl/levenshtein_distance.py
nokia/PyBGL
train
12
ffe9dea314dd6227979c7d435704bab832fd39c6
[ "pages = self.for_slot(slot, barcamp=barcamp)\nif len(indexes) != pages.count():\n raise PageError('length of indexes (%s) does not match amount of pages (%s)' % (len(indexes), pages.count()))\npages = list(pages)\nfor page in pages:\n if page.index not in indexes:\n raise PageError('page with index %s...
<|body_start_0|> pages = self.for_slot(slot, barcamp=barcamp) if len(indexes) != pages.count(): raise PageError('length of indexes (%s) does not match amount of pages (%s)' % (len(indexes), pages.count())) pages = list(pages) for page in pages: if page.index not i...
Pages
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Pages: def reorder_slot(self, slot, indexes, barcamp=None): """reorders a slot. You give it the slot id in ``slot`` and the new sequence order in indexes in form of a list. Passing in [2,3,1] will reorder the existing pages in this order""" <|body_0|> def add_to_slot(self, s...
stack_v2_sparse_classes_75kplus_train_070807
4,171
permissive
[ { "docstring": "reorders a slot. You give it the slot id in ``slot`` and the new sequence order in indexes in form of a list. Passing in [2,3,1] will reorder the existing pages in this order", "name": "reorder_slot", "signature": "def reorder_slot(self, slot, indexes, barcamp=None)" }, { "docstr...
5
stack_v2_sparse_classes_30k_train_012616
Implement the Python class `Pages` described below. Class description: Implement the Pages class. Method signatures and docstrings: - def reorder_slot(self, slot, indexes, barcamp=None): reorders a slot. You give it the slot id in ``slot`` and the new sequence order in indexes in form of a list. Passing in [2,3,1] wi...
Implement the Python class `Pages` described below. Class description: Implement the Pages class. Method signatures and docstrings: - def reorder_slot(self, slot, indexes, barcamp=None): reorders a slot. You give it the slot id in ``slot`` and the new sequence order in indexes in form of a list. Passing in [2,3,1] wi...
9b45664e46c451b2cbe00bb55583b043e769083d
<|skeleton|> class Pages: def reorder_slot(self, slot, indexes, barcamp=None): """reorders a slot. You give it the slot id in ``slot`` and the new sequence order in indexes in form of a list. Passing in [2,3,1] will reorder the existing pages in this order""" <|body_0|> def add_to_slot(self, s...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Pages: def reorder_slot(self, slot, indexes, barcamp=None): """reorders a slot. You give it the slot id in ``slot`` and the new sequence order in indexes in form of a list. Passing in [2,3,1] will reorder the existing pages in this order""" pages = self.for_slot(slot, barcamp=barcamp) ...
the_stack_v2_python_sparse
camper/db/pages.py
comlounge/camper
train
14
4ab35e555150b23128d97d194bd5872016191f6f
[ "self.models = models\nself.datasets = datasets\nself.default_model_to_split_mapping = default_model_to_split_mapping", "if model_to_split_mapping is None:\n model_to_split_mapping = self.default_model_to_split_mapping\nif model_to_split_mapping is None:\n raise TypeError('At least one of self.default_model...
<|body_start_0|> self.models = models self.datasets = datasets self.default_model_to_split_mapping = default_model_to_split_mapping <|end_body_0|> <|body_start_1|> if model_to_split_mapping is None: model_to_split_mapping = self.default_model_to_split_mapping if mode...
Interface to dispatch Model objects, Dataset objects, and any additional objects required, to Signal objects.
InformationSource
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InformationSource: """Interface to dispatch Model objects, Dataset objects, and any additional objects required, to Signal objects.""" def __init__(self, models: List[Model], datasets: List[Dataset], default_model_to_split_mapping: List[Tuple[int, str, str, str]]=None): """Constructo...
stack_v2_sparse_classes_75kplus_train_070808
3,778
permissive
[ { "docstring": "Constructor Args: models: List of models to be queried. datasets: List of datasets to be queried. default_model_to_split_mapping: List of tuples, indicating how each model should query the dataset. More specifically, for model #i: default_model_to_split_mapping[i][0] contains the index of the da...
2
stack_v2_sparse_classes_30k_train_014478
Implement the Python class `InformationSource` described below. Class description: Interface to dispatch Model objects, Dataset objects, and any additional objects required, to Signal objects. Method signatures and docstrings: - def __init__(self, models: List[Model], datasets: List[Dataset], default_model_to_split_m...
Implement the Python class `InformationSource` described below. Class description: Interface to dispatch Model objects, Dataset objects, and any additional objects required, to Signal objects. Method signatures and docstrings: - def __init__(self, models: List[Model], datasets: List[Dataset], default_model_to_split_m...
663ed23def423241edc7132be927e17cc416ac46
<|skeleton|> class InformationSource: """Interface to dispatch Model objects, Dataset objects, and any additional objects required, to Signal objects.""" def __init__(self, models: List[Model], datasets: List[Dataset], default_model_to_split_mapping: List[Tuple[int, str, str, str]]=None): """Constructo...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class InformationSource: """Interface to dispatch Model objects, Dataset objects, and any additional objects required, to Signal objects.""" def __init__(self, models: List[Model], datasets: List[Dataset], default_model_to_split_mapping: List[Tuple[int, str, str, str]]=None): """Constructor Args: model...
the_stack_v2_python_sparse
privacy_meter/information_source.py
privacytrustlab/ml_privacy_meter
train
484
19e6bcc257b4e3b615654a185661b80da8d7688e
[ "data = {'email': self.email, 'id': self.id, 'create_time': str(self.create_time)}\nvalue = signing.dumps(data, key=key, salt=salt, compress=compress)\nreturn value", "try:\n value = signing.loads(hash_string, key=key, salt=salt, max_age=max_age)\n return value\nexcept signing.BadSignature:\n return Fals...
<|body_start_0|> data = {'email': self.email, 'id': self.id, 'create_time': str(self.create_time)} value = signing.dumps(data, key=key, salt=salt, compress=compress) return value <|end_body_0|> <|body_start_1|> try: value = signing.loads(hash_string, key=key, salt=salt, max_...
Email Subscribe Model
SubscribeModel
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SubscribeModel: """Email Subscribe Model""" def generate_hash(self, key=None, salt='django.core.signing', compress=False): """Generate url safe hash for Subscribe Email objects.""" <|body_0|> def unsign_hash(hash_string, key=None, salt='django.core.signing', max_age=None...
stack_v2_sparse_classes_75kplus_train_070809
1,845
permissive
[ { "docstring": "Generate url safe hash for Subscribe Email objects.", "name": "generate_hash", "signature": "def generate_hash(self, key=None, salt='django.core.signing', compress=False)" }, { "docstring": "Unsign hash for Subscribe Email objects.", "name": "unsign_hash", "signature": "d...
2
stack_v2_sparse_classes_30k_train_042208
Implement the Python class `SubscribeModel` described below. Class description: Email Subscribe Model Method signatures and docstrings: - def generate_hash(self, key=None, salt='django.core.signing', compress=False): Generate url safe hash for Subscribe Email objects. - def unsign_hash(hash_string, key=None, salt='dj...
Implement the Python class `SubscribeModel` described below. Class description: Email Subscribe Model Method signatures and docstrings: - def generate_hash(self, key=None, salt='django.core.signing', compress=False): Generate url safe hash for Subscribe Email objects. - def unsign_hash(hash_string, key=None, salt='dj...
b8a0e4952644144b31168f9a4ac8e743933d87c7
<|skeleton|> class SubscribeModel: """Email Subscribe Model""" def generate_hash(self, key=None, salt='django.core.signing', compress=False): """Generate url safe hash for Subscribe Email objects.""" <|body_0|> def unsign_hash(hash_string, key=None, salt='django.core.signing', max_age=None...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SubscribeModel: """Email Subscribe Model""" def generate_hash(self, key=None, salt='django.core.signing', compress=False): """Generate url safe hash for Subscribe Email objects.""" data = {'email': self.email, 'id': self.id, 'create_time': str(self.create_time)} value = signing.du...
the_stack_v2_python_sparse
handypackages/subscribe/models.py
roundium/django-handypackages
train
1
b20c07118efd6f48d1a54ef1f6ebb8eb150d7cac
[ "if cls.instance is None:\n cls.instance = super().__new__(cls)\nreturn cls.instance", "if not MusicPlayer.init_flag:\n print('初始化音乐播放器')\n MusicPlayer.init_flag = True" ]
<|body_start_0|> if cls.instance is None: cls.instance = super().__new__(cls) return cls.instance <|end_body_0|> <|body_start_1|> if not MusicPlayer.init_flag: print('初始化音乐播放器') MusicPlayer.init_flag = True <|end_body_1|>
MusicPlayer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MusicPlayer: def __new__(cls, *args, **kwargs): """重写创建方法""" <|body_0|> def __init__(self): """重写初始化方法""" <|body_1|> <|end_skeleton|> <|body_start_0|> if cls.instance is None: cls.instance = super().__new__(cls) return cls.instan...
stack_v2_sparse_classes_75kplus_train_070810
2,738
no_license
[ { "docstring": "重写创建方法", "name": "__new__", "signature": "def __new__(cls, *args, **kwargs)" }, { "docstring": "重写初始化方法", "name": "__init__", "signature": "def __init__(self)" } ]
2
stack_v2_sparse_classes_30k_train_053713
Implement the Python class `MusicPlayer` described below. Class description: Implement the MusicPlayer class. Method signatures and docstrings: - def __new__(cls, *args, **kwargs): 重写创建方法 - def __init__(self): 重写初始化方法
Implement the Python class `MusicPlayer` described below. Class description: Implement the MusicPlayer class. Method signatures and docstrings: - def __new__(cls, *args, **kwargs): 重写创建方法 - def __init__(self): 重写初始化方法 <|skeleton|> class MusicPlayer: def __new__(cls, *args, **kwargs): """重写创建方法""" ...
a4a1ae34daaa2764ee8d7005f414772c12d90c6a
<|skeleton|> class MusicPlayer: 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 MusicPlayer: def __new__(cls, *args, **kwargs): """重写创建方法""" if cls.instance is None: cls.instance = super().__new__(cls) return cls.instance def __init__(self): """重写初始化方法""" if not MusicPlayer.init_flag: print('初始化音乐播放器') Music...
the_stack_v2_python_sparse
02_面向对象/py_09_单例模式.py
sunweiye12/python-BasicLearning
train
0
3c97afd04c89080e44b74f9142464ac11cd81a10
[ "if len(symbols) % 2 == 1:\n return False\nstack = []\nfor symbol in symbols:\n if symbol == '(' or symbol == '[' or symbol == '{':\n stack.append(symbol)\n else:\n if len(stack) == 0:\n return False\n popped = stack.pop()\n if popped == '(' and symbol != ')':\n ...
<|body_start_0|> if len(symbols) % 2 == 1: return False stack = [] for symbol in symbols: if symbol == '(' or symbol == '[' or symbol == '{': stack.append(symbol) else: if len(stack) == 0: return False ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isValid(self, symbols): """:type symbols: str :rtype: bool""" <|body_0|> def isValid(self, s): """:type s: str :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> if len(symbols) % 2 == 1: return False stac...
stack_v2_sparse_classes_75kplus_train_070811
2,501
no_license
[ { "docstring": ":type symbols: str :rtype: bool", "name": "isValid", "signature": "def isValid(self, symbols)" }, { "docstring": ":type s: str :rtype: bool", "name": "isValid", "signature": "def isValid(self, s)" } ]
2
stack_v2_sparse_classes_30k_train_042283
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isValid(self, symbols): :type symbols: str :rtype: bool - def isValid(self, s): :type s: str :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isValid(self, symbols): :type symbols: str :rtype: bool - def isValid(self, s): :type s: str :rtype: bool <|skeleton|> class Solution: def isValid(self, symbols): ...
844f502da4d6fb9cd69cf0a1ef71da3385a4d2b4
<|skeleton|> class Solution: def isValid(self, symbols): """:type symbols: str :rtype: bool""" <|body_0|> def isValid(self, s): """:type s: str :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def isValid(self, symbols): """:type symbols: str :rtype: bool""" if len(symbols) % 2 == 1: return False stack = [] for symbol in symbols: if symbol == '(' or symbol == '[' or symbol == '{': stack.append(symbol) else...
the_stack_v2_python_sparse
20-valid_parentheses.py
stevestar888/leetcode-problems
train
2
d6666d2dfcc704e84187acb2e5273263f76c8de8
[ "self.patterns = patterns\nself.edges = []\nself.nodes = dict()\nself.stringPath = []\nself.sequence = ''", "for pattern in self.patterns:\n for otherPattern in self.patterns:\n if pattern[1:] == otherPattern[:-1]:\n self.edges.append((pattern, otherPattern))", "self.findEdges()\nfor edge i...
<|body_start_0|> self.patterns = patterns self.edges = [] self.nodes = dict() self.stringPath = [] self.sequence = '' <|end_body_0|> <|body_start_1|> for pattern in self.patterns: for otherPattern in self.patterns: if pattern[1:] == otherPatte...
The class Graph takes a set of DNA sequences of size k and constructs the nodes and edges needed to generate the sequence composition. It contains five separate functions in addition to def __init__(). The only function called in main() is the method printString(), which calls on the other methods (more information pro...
Graph
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Graph: """The class Graph takes a set of DNA sequences of size k and constructs the nodes and edges needed to generate the sequence composition. It contains five separate functions in addition to def __init__(). The only function called in main() is the method printString(), which calls on the ot...
stack_v2_sparse_classes_75kplus_train_070812
8,076
no_license
[ { "docstring": "The initialization method for the class Graph. Takes a list of DNA sequences of size k, 'patterns', which will then be used to create the attributes self.edges and self.nodes. Assumes the strings contained within the list of patterns are all the same size. Attributes: self.patterns # list set to...
6
stack_v2_sparse_classes_30k_train_037110
Implement the Python class `Graph` described below. Class description: The class Graph takes a set of DNA sequences of size k and constructs the nodes and edges needed to generate the sequence composition. It contains five separate functions in addition to def __init__(). The only function called in main() is the meth...
Implement the Python class `Graph` described below. Class description: The class Graph takes a set of DNA sequences of size k and constructs the nodes and edges needed to generate the sequence composition. It contains five separate functions in addition to def __init__(). The only function called in main() is the meth...
205e38dccf95d4be43ed542e46c2265689ca2cdf
<|skeleton|> class Graph: """The class Graph takes a set of DNA sequences of size k and constructs the nodes and edges needed to generate the sequence composition. It contains five separate functions in addition to def __init__(). The only function called in main() is the method printString(), which calls on the ot...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Graph: """The class Graph takes a set of DNA sequences of size k and constructs the nodes and edges needed to generate the sequence composition. It contains five separate functions in addition to def __init__(). The only function called in main() is the method printString(), which calls on the other methods (...
the_stack_v2_python_sparse
problem14.py
tianap/bme-205
train
0
03bbbba0487e93c2bf22a69f862bdc2dc79e7c38
[ "l = len(matrix)\nif l < 2:\n return\nfor row in range(l - 1):\n for col in range(row + 1, l):\n matrix[row][col], matrix[col][row] = (matrix[col][row], matrix[row][col])\nfor row in matrix:\n row.reverse()", "l = len(matrix)\nif l < 2:\n return\nfor row in range(l // 2):\n for col in range(...
<|body_start_0|> l = len(matrix) if l < 2: return for row in range(l - 1): for col in range(row + 1, l): matrix[row][col], matrix[col][row] = (matrix[col][row], matrix[row][col]) for row in matrix: row.reverse() <|end_body_0|> <|body_s...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def rotate2(self, matrix: List[List[int]]) -> None: """Do not return anything, modify matrix in-place instead.""" <|body_0|> def rotate(self, matrix: List[List[int]]) -> None: """Do not return anything, modify matrix in-place instead.""" <|body_1|> ...
stack_v2_sparse_classes_75kplus_train_070813
1,218
no_license
[ { "docstring": "Do not return anything, modify matrix in-place instead.", "name": "rotate2", "signature": "def rotate2(self, matrix: List[List[int]]) -> None" }, { "docstring": "Do not return anything, modify matrix in-place instead.", "name": "rotate", "signature": "def rotate(self, mat...
2
stack_v2_sparse_classes_30k_train_020202
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rotate2(self, matrix: List[List[int]]) -> None: Do not return anything, modify matrix in-place instead. - def rotate(self, matrix: List[List[int]]) -> None: Do not return any...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rotate2(self, matrix: List[List[int]]) -> None: Do not return anything, modify matrix in-place instead. - def rotate(self, matrix: List[List[int]]) -> None: Do not return any...
1239b805a819e4512860a6507b332636941ff3e9
<|skeleton|> class Solution: def rotate2(self, matrix: List[List[int]]) -> None: """Do not return anything, modify matrix in-place instead.""" <|body_0|> def rotate(self, matrix: List[List[int]]) -> None: """Do not return anything, modify matrix in-place instead.""" <|body_1|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def rotate2(self, matrix: List[List[int]]) -> None: """Do not return anything, modify matrix in-place instead.""" l = len(matrix) if l < 2: return for row in range(l - 1): for col in range(row + 1, l): matrix[row][col], matrix[c...
the_stack_v2_python_sparse
Top_100_Liked_Questions/48._Rotate_Image/solution.py
hkim150/Leetcode-Problems
train
1
6cb67faefac501ee5692d41f1cc6a50b5876ec44
[ "if '.' not in task:\n task = '.'.join(__name__.split('.')[:-1]) + '.' + task.capitalize() + 'Task'\nreturn Resolver()(task)", "if 'args' in config:\n args = config.pop('args')\n action = config['action']\n if action:\n if isinstance(action, list):\n config['action'] = [Partial.creat...
<|body_start_0|> if '.' not in task: task = '.'.join(__name__.split('.')[:-1]) + '.' + task.capitalize() + 'Task' return Resolver()(task) <|end_body_0|> <|body_start_1|> if 'args' in config: args = config.pop('args') action = config['action'] if a...
Task factory. Creates new Task instances.
TaskFactory
[ "Apache-2.0", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TaskFactory: """Task factory. Creates new Task instances.""" def get(task): """Gets a new instance of task class. Args: task: Task instance class Returns: Task class""" <|body_0|> def create(config, task): """Creates a new Task instance. Args: config: Task config...
stack_v2_sparse_classes_75kplus_train_070814
2,200
permissive
[ { "docstring": "Gets a new instance of task class. Args: task: Task instance class Returns: Task class", "name": "get", "signature": "def get(task)" }, { "docstring": "Creates a new Task instance. Args: config: Task configuration task: Task instance class Returns: Task", "name": "create", ...
2
null
Implement the Python class `TaskFactory` described below. Class description: Task factory. Creates new Task instances. Method signatures and docstrings: - def get(task): Gets a new instance of task class. Args: task: Task instance class Returns: Task class - def create(config, task): Creates a new Task instance. Args...
Implement the Python class `TaskFactory` described below. Class description: Task factory. Creates new Task instances. Method signatures and docstrings: - def get(task): Gets a new instance of task class. Args: task: Task instance class Returns: Task class - def create(config, task): Creates a new Task instance. Args...
789a4555cb60ee9cdfa69afae5a5236d197e2b07
<|skeleton|> class TaskFactory: """Task factory. Creates new Task instances.""" def get(task): """Gets a new instance of task class. Args: task: Task instance class Returns: Task class""" <|body_0|> def create(config, task): """Creates a new Task instance. Args: config: Task config...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TaskFactory: """Task factory. Creates new Task instances.""" def get(task): """Gets a new instance of task class. Args: task: Task instance class Returns: Task class""" if '.' not in task: task = '.'.join(__name__.split('.')[:-1]) + '.' + task.capitalize() + 'Task' ret...
the_stack_v2_python_sparse
src/python/txtai/workflow/task/factory.py
neuml/txtai
train
4,804
b818cecb50bb19d072b179b4d6f6fc102b11f2cf
[ "if not root:\n return\nif root:\n root.left, root.right = (root.right, root.left)\n self.invertTree(root.left)\n self.invertTree(root.right)\nreturn root", "if not root:\n return\nif root:\n queue = [root]\n while queue:\n temp = queue.pop(0)\n temp.left, temp.right = (temp.rig...
<|body_start_0|> if not root: return if root: root.left, root.right = (root.right, root.left) self.invertTree(root.left) self.invertTree(root.right) return root <|end_body_0|> <|body_start_1|> if not root: return if roo...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def invertTree(self, root): """:type root: TreeNode :rtype: TreeNode 你已经打败了那个90%谷歌工程师都用的软件的开发者了 递归就是深度优先的遍历方式,非常简单""" <|body_0|> def invertTree_stack(self, root): """:param root: :return: 队列对应的就是广度优先的搜索方式 每次弹出的,都是待处理的值;动态更新的,也是待处理的值 那么我要维护一个队列,每次让待处理的值弹出 第一...
stack_v2_sparse_classes_75kplus_train_070815
1,637
no_license
[ { "docstring": ":type root: TreeNode :rtype: TreeNode 你已经打败了那个90%谷歌工程师都用的软件的开发者了 递归就是深度优先的遍历方式,非常简单", "name": "invertTree", "signature": "def invertTree(self, root)" }, { "docstring": ":param root: :return: 队列对应的就是广度优先的搜索方式 每次弹出的,都是待处理的值;动态更新的,也是待处理的值 那么我要维护一个队列,每次让待处理的值弹出 第一次肯定是弹出根节点,交换其左右节点 好,...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def invertTree(self, root): :type root: TreeNode :rtype: TreeNode 你已经打败了那个90%谷歌工程师都用的软件的开发者了 递归就是深度优先的遍历方式,非常简单 - def invertTree_stack(self, root): :param root: :return: 队列对应的就是广...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def invertTree(self, root): :type root: TreeNode :rtype: TreeNode 你已经打败了那个90%谷歌工程师都用的软件的开发者了 递归就是深度优先的遍历方式,非常简单 - def invertTree_stack(self, root): :param root: :return: 队列对应的就是广...
d13d658762e11c1fcb004b43319236f8852429d9
<|skeleton|> class Solution: def invertTree(self, root): """:type root: TreeNode :rtype: TreeNode 你已经打败了那个90%谷歌工程师都用的软件的开发者了 递归就是深度优先的遍历方式,非常简单""" <|body_0|> def invertTree_stack(self, root): """:param root: :return: 队列对应的就是广度优先的搜索方式 每次弹出的,都是待处理的值;动态更新的,也是待处理的值 那么我要维护一个队列,每次让待处理的值弹出 第一...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def invertTree(self, root): """:type root: TreeNode :rtype: TreeNode 你已经打败了那个90%谷歌工程师都用的软件的开发者了 递归就是深度优先的遍历方式,非常简单""" if not root: return if root: root.left, root.right = (root.right, root.left) self.invertTree(root.left) self.i...
the_stack_v2_python_sparse
week03/翻转二叉树.py
Ares-debugger/Frontend-01-Template
train
0
4380bb6366fcb206205af5758f11ae8b49c5573c
[ "units = _get_test_data_dir('crash-corpus')\ncoverage_dir = _make_coverage_dir(tmp_path)\nprofraw_file = os.path.join(coverage_dir, 'test_crash.profraw')\ncrashes_dir = _make_crashes_dir(tmp_path)\nrun_coverage.do_coverage_run(self.COVERAGE_BINARY_PATH, units, profraw_file, crashes_dir)\nassert os.listdir(crashes_d...
<|body_start_0|> units = _get_test_data_dir('crash-corpus') coverage_dir = _make_coverage_dir(tmp_path) profraw_file = os.path.join(coverage_dir, 'test_crash.profraw') crashes_dir = _make_crashes_dir(tmp_path) run_coverage.do_coverage_run(self.COVERAGE_BINARY_PATH, units, profraw...
Integration tests for run_coverage.py
TestIntegrationRunCoverage
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestIntegrationRunCoverage: """Integration tests for run_coverage.py""" def test_integration_do_coverage_run_crash(self, tmp_path): """Test that do_coverage_run returns crashing inputs.""" <|body_0|> def test_integration_do_coverage_run_no_crash(self, tmp_path): ...
stack_v2_sparse_classes_75kplus_train_070816
4,054
permissive
[ { "docstring": "Test that do_coverage_run returns crashing inputs.", "name": "test_integration_do_coverage_run_crash", "signature": "def test_integration_do_coverage_run_crash(self, tmp_path)" }, { "docstring": "Test that do_coverage_run doesn't return crashing inputs when there are none.", ...
3
stack_v2_sparse_classes_30k_train_024886
Implement the Python class `TestIntegrationRunCoverage` described below. Class description: Integration tests for run_coverage.py Method signatures and docstrings: - def test_integration_do_coverage_run_crash(self, tmp_path): Test that do_coverage_run returns crashing inputs. - def test_integration_do_coverage_run_no...
Implement the Python class `TestIntegrationRunCoverage` described below. Class description: Integration tests for run_coverage.py Method signatures and docstrings: - def test_integration_do_coverage_run_crash(self, tmp_path): Test that do_coverage_run returns crashing inputs. - def test_integration_do_coverage_run_no...
ff8ef0c6da62268521061a432c5b9e228c2f53dc
<|skeleton|> class TestIntegrationRunCoverage: """Integration tests for run_coverage.py""" def test_integration_do_coverage_run_crash(self, tmp_path): """Test that do_coverage_run returns crashing inputs.""" <|body_0|> def test_integration_do_coverage_run_no_crash(self, tmp_path): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestIntegrationRunCoverage: """Integration tests for run_coverage.py""" def test_integration_do_coverage_run_crash(self, tmp_path): """Test that do_coverage_run returns crashing inputs.""" units = _get_test_data_dir('crash-corpus') coverage_dir = _make_coverage_dir(tmp_path) ...
the_stack_v2_python_sparse
experiment/measurer/test_run_coverage.py
google/fuzzbench
train
1,005
a62603223a5b094fab78054ad5e96eb2c276dda1
[ "if self.request.user.groups.filter(name=WELLS_EDIT_ROLE).exists():\n qs = Well.objects.all()\nelse:\n qs = Well.objects.all().exclude(well_publication_status='Unpublished')\nreturn qs", "qs = self.get_queryset()\nlocations = self.filter_queryset(qs)\ncount = locations.count()\nif count > MAX_LOCATION_COUNT...
<|body_start_0|> if self.request.user.groups.filter(name=WELLS_EDIT_ROLE).exists(): qs = Well.objects.all() else: qs = Well.objects.all().exclude(well_publication_status='Unpublished') return qs <|end_body_0|> <|body_start_1|> qs = self.get_queryset() loc...
returns well locations for a given search get: returns a list of wells with locations only
WellLocationListAPIViewV1
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WellLocationListAPIViewV1: """returns well locations for a given search get: returns a list of wells with locations only""" def get_queryset(self): """Excludes Unpublished wells for users without edit permissions""" <|body_0|> def get(self, request, **kwargs): ""...
stack_v2_sparse_classes_75kplus_train_070817
32,335
permissive
[ { "docstring": "Excludes Unpublished wells for users without edit permissions", "name": "get_queryset", "signature": "def get_queryset(self)" }, { "docstring": "cancels request if too many wells are found", "name": "get", "signature": "def get(self, request, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_050789
Implement the Python class `WellLocationListAPIViewV1` described below. Class description: returns well locations for a given search get: returns a list of wells with locations only Method signatures and docstrings: - def get_queryset(self): Excludes Unpublished wells for users without edit permissions - def get(self...
Implement the Python class `WellLocationListAPIViewV1` described below. Class description: returns well locations for a given search get: returns a list of wells with locations only Method signatures and docstrings: - def get_queryset(self): Excludes Unpublished wells for users without edit permissions - def get(self...
6be3701a8e0085d0c6fa199b2672b7f9f1266a03
<|skeleton|> class WellLocationListAPIViewV1: """returns well locations for a given search get: returns a list of wells with locations only""" def get_queryset(self): """Excludes Unpublished wells for users without edit permissions""" <|body_0|> def get(self, request, **kwargs): ""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class WellLocationListAPIViewV1: """returns well locations for a given search get: returns a list of wells with locations only""" def get_queryset(self): """Excludes Unpublished wells for users without edit permissions""" if self.request.user.groups.filter(name=WELLS_EDIT_ROLE).exists(): ...
the_stack_v2_python_sparse
app/backend/wells/views.py
bcgov/gwells
train
39
3e6789e9aff938c881029586e4e977144a670deb
[ "self.experiment_run_ids = experiment_run_ids\nself.lang_codes_to_evaluate = lang_codes_to_evaluate\nself.performance = {}\nevaluators = []\nfor experiment_run_id in experiment_run_ids:\n if validation_set_file_name == None:\n eval_obj = Evaluator(experiment_run_id, lang_codes_to_evaluate, vocabulary_size...
<|body_start_0|> self.experiment_run_ids = experiment_run_ids self.lang_codes_to_evaluate = lang_codes_to_evaluate self.performance = {} evaluators = [] for experiment_run_id in experiment_run_ids: if validation_set_file_name == None: eval_obj = Evalua...
Class that encapsulates the evaluation framework for all experiment runs (different parameter combinations) for a given experiment identifier (same dataset)
Multirun_evaluator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Multirun_evaluator: """Class that encapsulates the evaluation framework for all experiment runs (different parameter combinations) for a given experiment identifier (same dataset)""" def __init__(self, experiment_run_ids, lang_codes_to_evaluate, vocabulary_size, test_set_flag, target_concept...
stack_v2_sparse_classes_75kplus_train_070818
29,120
no_license
[ { "docstring": "Initialized by an iterable of the desired experiment run ids, and an iterable of languages that need to be evaluated", "name": "__init__", "signature": "def __init__(self, experiment_run_ids, lang_codes_to_evaluate, vocabulary_size, test_set_flag, target_concepts_suffix, validation_set_f...
4
null
Implement the Python class `Multirun_evaluator` described below. Class description: Class that encapsulates the evaluation framework for all experiment runs (different parameter combinations) for a given experiment identifier (same dataset) Method signatures and docstrings: - def __init__(self, experiment_run_ids, la...
Implement the Python class `Multirun_evaluator` described below. Class description: Class that encapsulates the evaluation framework for all experiment runs (different parameter combinations) for a given experiment identifier (same dataset) Method signatures and docstrings: - def __init__(self, experiment_run_ids, la...
a5ecc38a793bf487552ee43cf641f252899ce2f6
<|skeleton|> class Multirun_evaluator: """Class that encapsulates the evaluation framework for all experiment runs (different parameter combinations) for a given experiment identifier (same dataset)""" def __init__(self, experiment_run_ids, lang_codes_to_evaluate, vocabulary_size, test_set_flag, target_concept...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Multirun_evaluator: """Class that encapsulates the evaluation framework for all experiment runs (different parameter combinations) for a given experiment identifier (same dataset)""" def __init__(self, experiment_run_ids, lang_codes_to_evaluate, vocabulary_size, test_set_flag, target_concepts_suffix, val...
the_stack_v2_python_sparse
Cr5/src/evaluator.py
fruttasecca/jobs_scraping
train
2
678eac4361b5fc5fc64fb0fa09106dda9f00b893
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn ManagedAppOperation()", "from .entity import Entity\nfrom .entity import Entity\nfields: Dict[str, Callable[[Any], None]] = {'displayName': lambda n: setattr(self, 'display_name', n.get_str_value()), 'lastModifiedDateTime': lambda n: s...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return ManagedAppOperation() <|end_body_0|> <|body_start_1|> from .entity import Entity from .entity import Entity fields: Dict[str, Callable[[Any], None]] = {'displayName': lambda n: s...
Represents an operation applied against an app registration.
ManagedAppOperation
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ManagedAppOperation: """Represents an operation applied against an app registration.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ManagedAppOperation: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: ...
stack_v2_sparse_classes_75kplus_train_070819
2,793
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: ManagedAppOperation", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator...
3
stack_v2_sparse_classes_30k_train_008302
Implement the Python class `ManagedAppOperation` described below. Class description: Represents an operation applied against an app registration. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ManagedAppOperation: Creates a new instance of the appropri...
Implement the Python class `ManagedAppOperation` described below. Class description: Represents an operation applied against an app registration. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ManagedAppOperation: Creates a new instance of the appropri...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class ManagedAppOperation: """Represents an operation applied against an app registration.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ManagedAppOperation: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ManagedAppOperation: """Represents an operation applied against an app registration.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ManagedAppOperation: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse nod...
the_stack_v2_python_sparse
msgraph/generated/models/managed_app_operation.py
microsoftgraph/msgraph-sdk-python
train
135
d9e557ec3e189281715e55d81fa18c5f3dcfe623
[ "super().__init__()\nif dim == 1:\n conv = nn.Conv1d\n bn = nn.BatchNorm1d\nelif dim == 2:\n conv = nn.Conv2d\n bn = nn.BatchNorm2d\nelse:\n raise ValueError\nif not isinstance(out_channels, (list, tuple)):\n out_channels = [out_channels]\nlayers = []\nfor oc in out_channels:\n layers.extend([c...
<|body_start_0|> super().__init__() if dim == 1: conv = nn.Conv1d bn = nn.BatchNorm1d elif dim == 2: conv = nn.Conv2d bn = nn.BatchNorm2d else: raise ValueError if not isinstance(out_channels, (list, tuple)): ...
SharedMLP Module, comprising Conv2d, BatchNorm and ReLU blocks.
SharedMLP
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SharedMLP: """SharedMLP Module, comprising Conv2d, BatchNorm and ReLU blocks.""" def __init__(self, in_channels, out_channels, dim=1): """Constructor for SharedMLP Block. Args: in_channels: Number of input channels. out_channels: Number of output channels. dim: Input dimension""" ...
stack_v2_sparse_classes_75kplus_train_070820
22,879
permissive
[ { "docstring": "Constructor for SharedMLP Block. Args: in_channels: Number of input channels. out_channels: Number of output channels. dim: Input dimension", "name": "__init__", "signature": "def __init__(self, in_channels, out_channels, dim=1)" }, { "docstring": "Forward pass for SharedMLP Args...
2
stack_v2_sparse_classes_30k_train_042034
Implement the Python class `SharedMLP` described below. Class description: SharedMLP Module, comprising Conv2d, BatchNorm and ReLU blocks. Method signatures and docstrings: - def __init__(self, in_channels, out_channels, dim=1): Constructor for SharedMLP Block. Args: in_channels: Number of input channels. out_channel...
Implement the Python class `SharedMLP` described below. Class description: SharedMLP Module, comprising Conv2d, BatchNorm and ReLU blocks. Method signatures and docstrings: - def __init__(self, in_channels, out_channels, dim=1): Constructor for SharedMLP Block. Args: in_channels: Number of input channels. out_channel...
51482281dc180786e7563c73c12ac5df89289748
<|skeleton|> class SharedMLP: """SharedMLP Module, comprising Conv2d, BatchNorm and ReLU blocks.""" def __init__(self, in_channels, out_channels, dim=1): """Constructor for SharedMLP Block. Args: in_channels: Number of input channels. out_channels: Number of output channels. dim: Input dimension""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SharedMLP: """SharedMLP Module, comprising Conv2d, BatchNorm and ReLU blocks.""" def __init__(self, in_channels, out_channels, dim=1): """Constructor for SharedMLP Block. Args: in_channels: Number of input channels. out_channels: Number of output channels. dim: Input dimension""" super()....
the_stack_v2_python_sparse
ml3d/torch/models/pvcnn.py
CosmosHua/Open3D-ML
train
0
d893dad3bbaa52c74201ff88fbc3bb8be5eaec3a
[ "self.max_value = 0\nself.max_weight = 0\nmemo = {}\n\ndef _recur_func(i, sw, sv):\n if i == n or sw == w:\n self.max_value = max(sv, self.max_value)\n self.max_weight = max(sw, self.max_weight)\n return\n item = (i, sw)\n if item in memo and memo[item] > sv:\n return\n memo[...
<|body_start_0|> self.max_value = 0 self.max_weight = 0 memo = {} def _recur_func(i, sw, sv): if i == n or sw == w: self.max_value = max(sv, self.max_value) self.max_weight = max(sw, self.max_weight) return item = (...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def knapsack(self, weights, values, n, w): """先用回溯算法+备忘录的方式来解决""" <|body_0|> def knapsack2(self, weights, values, n, w): """动态规划解法""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.max_value = 0 self.max_weight = 0 memo ...
stack_v2_sparse_classes_75kplus_train_070821
2,559
no_license
[ { "docstring": "先用回溯算法+备忘录的方式来解决", "name": "knapsack", "signature": "def knapsack(self, weights, values, n, w)" }, { "docstring": "动态规划解法", "name": "knapsack2", "signature": "def knapsack2(self, weights, values, n, w)" } ]
2
stack_v2_sparse_classes_30k_train_031298
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def knapsack(self, weights, values, n, w): 先用回溯算法+备忘录的方式来解决 - def knapsack2(self, weights, values, n, w): 动态规划解法
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def knapsack(self, weights, values, n, w): 先用回溯算法+备忘录的方式来解决 - def knapsack2(self, weights, values, n, w): 动态规划解法 <|skeleton|> class Solution: def knapsack(self, weights, va...
cbdb055bfdf34ce2e143ab10af90372422984008
<|skeleton|> class Solution: def knapsack(self, weights, values, n, w): """先用回溯算法+备忘录的方式来解决""" <|body_0|> def knapsack2(self, weights, values, n, w): """动态规划解法""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def knapsack(self, weights, values, n, w): """先用回溯算法+备忘录的方式来解决""" self.max_value = 0 self.max_weight = 0 memo = {} def _recur_func(i, sw, sv): if i == n or sw == w: self.max_value = max(sv, self.max_value) self.max_...
the_stack_v2_python_sparse
32_dynamic_01package.py
turbobin/algorithm_learning
train
0
805aa8692198787f918b28aa48ad964fb0fafb7e
[ "l = 0\nr = len(List) - 1\nif l > r:\n return None\nif l == r:\n return TreeNode(List[l])\nif (l + r) % 2 == 0:\n mid = int((l + r) / 2)\nelse:\n mid = int((l + r) / 2) + 1\nroot = TreeNode(List[mid])\nroot.left = self.build_tree(List[:mid])\nroot.right = self.build_tree(List[mid + 1:])\nreturn root", ...
<|body_start_0|> l = 0 r = len(List) - 1 if l > r: return None if l == r: return TreeNode(List[l]) if (l + r) % 2 == 0: mid = int((l + r) / 2) else: mid = int((l + r) / 2) + 1 root = TreeNode(List[mid]) root....
二叉树结构类
BinaryTree
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BinaryTree: """二叉树结构类""" def build_tree(self, List): """构建一棵平衡二叉树,数组必须为排序好地数组,才能使得是平衡二叉树""" <|body_0|> def PrintFromTopToBottom(self, root): """从上往下打印二叉树——层序遍历""" <|body_1|> <|end_skeleton|> <|body_start_0|> l = 0 r = len(List) - 1 ...
stack_v2_sparse_classes_75kplus_train_070822
2,320
no_license
[ { "docstring": "构建一棵平衡二叉树,数组必须为排序好地数组,才能使得是平衡二叉树", "name": "build_tree", "signature": "def build_tree(self, List)" }, { "docstring": "从上往下打印二叉树——层序遍历", "name": "PrintFromTopToBottom", "signature": "def PrintFromTopToBottom(self, root)" } ]
2
stack_v2_sparse_classes_30k_train_047720
Implement the Python class `BinaryTree` described below. Class description: 二叉树结构类 Method signatures and docstrings: - def build_tree(self, List): 构建一棵平衡二叉树,数组必须为排序好地数组,才能使得是平衡二叉树 - def PrintFromTopToBottom(self, root): 从上往下打印二叉树——层序遍历
Implement the Python class `BinaryTree` described below. Class description: 二叉树结构类 Method signatures and docstrings: - def build_tree(self, List): 构建一棵平衡二叉树,数组必须为排序好地数组,才能使得是平衡二叉树 - def PrintFromTopToBottom(self, root): 从上往下打印二叉树——层序遍历 <|skeleton|> class BinaryTree: """二叉树结构类""" def build_tree(self, List): ...
4e4f739402b95691f6c91411da26d7d3bfe042b6
<|skeleton|> class BinaryTree: """二叉树结构类""" def build_tree(self, List): """构建一棵平衡二叉树,数组必须为排序好地数组,才能使得是平衡二叉树""" <|body_0|> def PrintFromTopToBottom(self, root): """从上往下打印二叉树——层序遍历""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BinaryTree: """二叉树结构类""" def build_tree(self, List): """构建一棵平衡二叉树,数组必须为排序好地数组,才能使得是平衡二叉树""" l = 0 r = len(List) - 1 if l > r: return None if l == r: return TreeNode(List[l]) if (l + r) % 2 == 0: mid = int((l + r) / 2) ...
the_stack_v2_python_sparse
Big大话数据结构/tree树结构/4、层序遍历.py
hugechuanqi/Algorithms-and-Data-Structures
train
3
c110498e102aebfbc90fba86602a541e5d5ceb29
[ "self.p = p\nfrom sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing\nself.ring = PolynomialRing(FiniteField(p), 'x')\nif use_database:\n C = sage.databases.conway.ConwayPolynomials()\n self.nodes = {n: self.ring(C.polynomial(p, n)) for n in C.degrees(p)}\nelse:\n self.nodes = {}", "...
<|body_start_0|> self.p = p from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing self.ring = PolynomialRing(FiniteField(p), 'x') if use_database: C = sage.databases.conway.ConwayPolynomials() self.nodes = {n: self.ring(C.polynomial(p, n)) f...
A pseudo-Conway lattice over a given finite prime field. The Conway polynomial `f_n` of degree `n` over `\\Bold{F}_p` is defined by the following four conditions: - `f_n` is irreducible. - In the quotient field `\\Bold{F}_p[x]/(f_n)`, the element `x\\bmod f_n` generates the multiplicative group. - The minimal polynomia...
PseudoConwayLattice
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PseudoConwayLattice: """A pseudo-Conway lattice over a given finite prime field. The Conway polynomial `f_n` of degree `n` over `\\Bold{F}_p` is defined by the following four conditions: - `f_n` is irreducible. - In the quotient field `\\Bold{F}_p[x]/(f_n)`, the element `x\\bmod f_n` generates th...
stack_v2_sparse_classes_75kplus_train_070823
18,867
no_license
[ { "docstring": "TESTS:: sage: from sage.rings.finite_rings.conway_polynomials import PseudoConwayLattice sage: PCL = PseudoConwayLattice(3) sage: PCL.polynomial(3) x^3 + 2*x + 1 sage: PCL = PseudoConwayLattice(5, use_database=False) sage: PCL.polynomial(12) x^12 + 4*x^11 + 2*x^10 + 4*x^9 + 2*x^8 + 2*x^7 + 4*x^6...
3
stack_v2_sparse_classes_30k_train_002453
Implement the Python class `PseudoConwayLattice` described below. Class description: A pseudo-Conway lattice over a given finite prime field. The Conway polynomial `f_n` of degree `n` over `\\Bold{F}_p` is defined by the following four conditions: - `f_n` is irreducible. - In the quotient field `\\Bold{F}_p[x]/(f_n)`,...
Implement the Python class `PseudoConwayLattice` described below. Class description: A pseudo-Conway lattice over a given finite prime field. The Conway polynomial `f_n` of degree `n` over `\\Bold{F}_p` is defined by the following four conditions: - `f_n` is irreducible. - In the quotient field `\\Bold{F}_p[x]/(f_n)`,...
0d9eacbf74e2acffefde93e39f8bcbec745cdaba
<|skeleton|> class PseudoConwayLattice: """A pseudo-Conway lattice over a given finite prime field. The Conway polynomial `f_n` of degree `n` over `\\Bold{F}_p` is defined by the following four conditions: - `f_n` is irreducible. - In the quotient field `\\Bold{F}_p[x]/(f_n)`, the element `x\\bmod f_n` generates th...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PseudoConwayLattice: """A pseudo-Conway lattice over a given finite prime field. The Conway polynomial `f_n` of degree `n` over `\\Bold{F}_p` is defined by the following four conditions: - `f_n` is irreducible. - In the quotient field `\\Bold{F}_p[x]/(f_n)`, the element `x\\bmod f_n` generates the multiplicat...
the_stack_v2_python_sparse
sage/src/sage/rings/finite_rings/conway_polynomials.py
bopopescu/geosci
train
0
f5629e682fd4bc02a02a90ffed28960461a4f6c6
[ "event = rdfvalue.AuditEvent(user=self.token.username, action='CLIENT_APPROVAL_REQUEST', client=self.client_id, description=self.args.reason)\nflow.Events.PublishEvent('Audit', event, token=self.token)\nreturn self.ApprovalUrnBuilder(self.client_id.Path(), self.token.username, self.args.reason)", "client = aff4.F...
<|body_start_0|> event = rdfvalue.AuditEvent(user=self.token.username, action='CLIENT_APPROVAL_REQUEST', client=self.client_id, description=self.args.reason) flow.Events.PublishEvent('Audit', event, token=self.token) return self.ApprovalUrnBuilder(self.client_id.Path(), self.token.username, self...
A flow to request approval to access a client.
RequestClientApprovalFlow
[ "Apache-2.0", "DOC" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RequestClientApprovalFlow: """A flow to request approval to access a client.""" def BuildApprovalUrn(self): """Builds approval object urn.""" <|body_0|> def BuildSubjectTitle(self): """Returns the string with subject's title.""" <|body_1|> <|end_skeleton...
stack_v2_sparse_classes_75kplus_train_070824
28,119
permissive
[ { "docstring": "Builds approval object urn.", "name": "BuildApprovalUrn", "signature": "def BuildApprovalUrn(self)" }, { "docstring": "Returns the string with subject's title.", "name": "BuildSubjectTitle", "signature": "def BuildSubjectTitle(self)" } ]
2
stack_v2_sparse_classes_30k_train_024318
Implement the Python class `RequestClientApprovalFlow` described below. Class description: A flow to request approval to access a client. Method signatures and docstrings: - def BuildApprovalUrn(self): Builds approval object urn. - def BuildSubjectTitle(self): Returns the string with subject's title.
Implement the Python class `RequestClientApprovalFlow` described below. Class description: A flow to request approval to access a client. Method signatures and docstrings: - def BuildApprovalUrn(self): Builds approval object urn. - def BuildSubjectTitle(self): Returns the string with subject's title. <|skeleton|> cl...
ba1648b97a76f844ffb8e1891cc9e2680f9b1c6e
<|skeleton|> class RequestClientApprovalFlow: """A flow to request approval to access a client.""" def BuildApprovalUrn(self): """Builds approval object urn.""" <|body_0|> def BuildSubjectTitle(self): """Returns the string with subject's title.""" <|body_1|> <|end_skeleton...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RequestClientApprovalFlow: """A flow to request approval to access a client.""" def BuildApprovalUrn(self): """Builds approval object urn.""" event = rdfvalue.AuditEvent(user=self.token.username, action='CLIENT_APPROVAL_REQUEST', client=self.client_id, description=self.args.reason) ...
the_stack_v2_python_sparse
lib/aff4_objects/security.py
defaultnamehere/grr
train
3
ec26c73f2ab189b55b53dbdfcf44d4b890a40935
[ "self.kekule_smiles = kekule_smiles\nself.all_bonds_explicit = all_bonds_explicit\nself.all_hs_explicit = all_hs_explicit\nself.sanitize = sanitize\nself.seed = seed\nif self.seed > -1:\n np.random.seed(self.seed)", "molecule = Chem.MolFromSmiles(smiles, sanitize=self.sanitize)\nif molecule is None:\n logge...
<|body_start_0|> self.kekule_smiles = kekule_smiles self.all_bonds_explicit = all_bonds_explicit self.all_hs_explicit = all_hs_explicit self.sanitize = sanitize self.seed = seed if self.seed > -1: np.random.seed(self.seed) <|end_body_0|> <|body_start_1|> ...
Augment a SMILES string, according to Bjerrum (2017).
Augment
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Augment: """Augment a SMILES string, according to Bjerrum (2017).""" def __init__(self, kekule_smiles: bool=False, all_bonds_explicit: bool=False, all_hs_explicit: bool=False, sanitize: bool=True, seed: int=-1) -> None: """NOTE: These parameter need to be passed down to the enumerato...
stack_v2_sparse_classes_75kplus_train_070825
22,008
permissive
[ { "docstring": "NOTE: These parameter need to be passed down to the enumerator.", "name": "__init__", "signature": "def __init__(self, kekule_smiles: bool=False, all_bonds_explicit: bool=False, all_hs_explicit: bool=False, sanitize: bool=True, seed: int=-1) -> None" }, { "docstring": "Apply the ...
2
stack_v2_sparse_classes_30k_train_049681
Implement the Python class `Augment` described below. Class description: Augment a SMILES string, according to Bjerrum (2017). Method signatures and docstrings: - def __init__(self, kekule_smiles: bool=False, all_bonds_explicit: bool=False, all_hs_explicit: bool=False, sanitize: bool=True, seed: int=-1) -> None: NOTE...
Implement the Python class `Augment` described below. Class description: Augment a SMILES string, according to Bjerrum (2017). Method signatures and docstrings: - def __init__(self, kekule_smiles: bool=False, all_bonds_explicit: bool=False, all_hs_explicit: bool=False, sanitize: bool=True, seed: int=-1) -> None: NOTE...
27ca3f8c5b5463cd081be5abdea04f5bfa076f39
<|skeleton|> class Augment: """Augment a SMILES string, according to Bjerrum (2017).""" def __init__(self, kekule_smiles: bool=False, all_bonds_explicit: bool=False, all_hs_explicit: bool=False, sanitize: bool=True, seed: int=-1) -> None: """NOTE: These parameter need to be passed down to the enumerato...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Augment: """Augment a SMILES string, according to Bjerrum (2017).""" def __init__(self, kekule_smiles: bool=False, all_bonds_explicit: bool=False, all_hs_explicit: bool=False, sanitize: bool=True, seed: int=-1) -> None: """NOTE: These parameter need to be passed down to the enumerator.""" ...
the_stack_v2_python_sparse
pytoda/smiles/transforms.py
PaccMann/paccmann_datasets
train
22
8f0bbc34988ebf846f7f91066194765d192b3d87
[ "super().__init__()\nself.streams: list[TS] = []\nself._finish = finish", "isarr = await Interface.gather(*(s.process(size) for s in self.streams))\ntotal = np.zeros((max((0, *(len(arr) for arr in isarr))), self.prop.channels), self.prop.dtype)\nfor arr in isarr:\n total[:len(arr)] += arr\nreturn total", "aw...
<|body_start_0|> super().__init__() self.streams: list[TS] = [] self._finish = finish <|end_body_0|> <|body_start_1|> isarr = await Interface.gather(*(s.process(size) for s in self.streams)) total = np.zeros((max((0, *(len(arr) for arr in isarr))), self.prop.channels), self.prop...
Mixer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Mixer: def __init__(self, finish: bool=False): """Combines muliple tracks to play over each other""" <|body_0|> async def read(self, size: int) -> np.ndarray: """Combine the previous Track/Stream's processed data""" <|body_1|> async def open(self, proper...
stack_v2_sparse_classes_75kplus_train_070826
7,975
permissive
[ { "docstring": "Combines muliple tracks to play over each other", "name": "__init__", "signature": "def __init__(self, finish: bool=False)" }, { "docstring": "Combine the previous Track/Stream's processed data", "name": "read", "signature": "async def read(self, size: int) -> np.ndarray"...
6
null
Implement the Python class `Mixer` described below. Class description: Implement the Mixer class. Method signatures and docstrings: - def __init__(self, finish: bool=False): Combines muliple tracks to play over each other - async def read(self, size: int) -> np.ndarray: Combine the previous Track/Stream's processed d...
Implement the Python class `Mixer` described below. Class description: Implement the Mixer class. Method signatures and docstrings: - def __init__(self, finish: bool=False): Combines muliple tracks to play over each other - async def read(self, size: int) -> np.ndarray: Combine the previous Track/Stream's processed d...
5cf6b3a80d80a5cc69bea5431a29731dd6b39d76
<|skeleton|> class Mixer: def __init__(self, finish: bool=False): """Combines muliple tracks to play over each other""" <|body_0|> async def read(self, size: int) -> np.ndarray: """Combine the previous Track/Stream's processed data""" <|body_1|> async def open(self, proper...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Mixer: def __init__(self, finish: bool=False): """Combines muliple tracks to play over each other""" super().__init__() self.streams: list[TS] = [] self._finish = finish async def read(self, size: int) -> np.ndarray: """Combine the previous Track/Stream's processed...
the_stack_v2_python_sparse
audio/stream.py
TWoolhouse/Libraries
train
1
4da0d84e1b1df00e7ac8a6c85880a3d77a67174b
[ "nums_len = len(nums)\nmin_sublen = nums_len + 1\nsubnums_sum = [[0 for _ in range(nums_len)] for _ in range(nums_len)]\nfor i in range(nums_len - 1, -1, -1):\n for j in range(nums_len - 1, i - 1, -1):\n if i == j:\n subnums_sum[i][i] = nums[i]\n else:\n subnums_sum[i][j] = su...
<|body_start_0|> nums_len = len(nums) min_sublen = nums_len + 1 subnums_sum = [[0 for _ in range(nums_len)] for _ in range(nums_len)] for i in range(nums_len - 1, -1, -1): for j in range(nums_len - 1, i - 1, -1): if i == j: subnums_sum[i][i...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minSubArrayLen(self, s: int, nums: List[int]) -> int: """note:给定一个含有 n 个正整数的数组和一个正整数 s ,找出该数组中满足其和 ≥ s 的长度最小的连续子数组,并返回其长度。如果不存在符合条件的连续子数组,返回 0。 :param s: :param nums: :return:""" <|body_0|> def minSubArrayLen2(self, s: int, nums: List[int]) -> int: """n...
stack_v2_sparse_classes_75kplus_train_070827
3,156
no_license
[ { "docstring": "note:给定一个含有 n 个正整数的数组和一个正整数 s ,找出该数组中满足其和 ≥ s 的长度最小的连续子数组,并返回其长度。如果不存在符合条件的连续子数组,返回 0。 :param s: :param nums: :return:", "name": "minSubArrayLen", "signature": "def minSubArrayLen(self, s: int, nums: List[int]) -> int" }, { "docstring": "note:给定一个含有 n 个正整数的数组和一个正整数 s ,找出该数组中满足其和 ...
3
stack_v2_sparse_classes_30k_train_000094
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minSubArrayLen(self, s: int, nums: List[int]) -> int: note:给定一个含有 n 个正整数的数组和一个正整数 s ,找出该数组中满足其和 ≥ s 的长度最小的连续子数组,并返回其长度。如果不存在符合条件的连续子数组,返回 0。 :param s: :param nums: :return: -...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minSubArrayLen(self, s: int, nums: List[int]) -> int: note:给定一个含有 n 个正整数的数组和一个正整数 s ,找出该数组中满足其和 ≥ s 的长度最小的连续子数组,并返回其长度。如果不存在符合条件的连续子数组,返回 0。 :param s: :param nums: :return: -...
f7421522c437c952698736dbac8fb7ac6c0b8b88
<|skeleton|> class Solution: def minSubArrayLen(self, s: int, nums: List[int]) -> int: """note:给定一个含有 n 个正整数的数组和一个正整数 s ,找出该数组中满足其和 ≥ s 的长度最小的连续子数组,并返回其长度。如果不存在符合条件的连续子数组,返回 0。 :param s: :param nums: :return:""" <|body_0|> def minSubArrayLen2(self, s: int, nums: List[int]) -> int: """n...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def minSubArrayLen(self, s: int, nums: List[int]) -> int: """note:给定一个含有 n 个正整数的数组和一个正整数 s ,找出该数组中满足其和 ≥ s 的长度最小的连续子数组,并返回其长度。如果不存在符合条件的连续子数组,返回 0。 :param s: :param nums: :return:""" nums_len = len(nums) min_sublen = nums_len + 1 subnums_sum = [[0 for _ in range(nums_...
the_stack_v2_python_sparse
leetcode/daily_question/20200628_min_subarray_len.py
whitepaper2/data_beauty
train
0
584177dca817881156c740650306bde4ebe57790
[ "self.redis_key = redis_marc_key\nself.redis_server = redis_server\nraw_skos = open(skos, 'rb').read()\nself.skos = etree.XML(raw_skos)", "for member in ordered_collection:\n marc_field = match.find('{%s}datafield' % ns.MARC)\n if not marc_field:\n marc_field = match.find('{%s}fixedfield' % ns.MARC)\...
<|body_start_0|> self.redis_key = redis_marc_key self.redis_server = redis_server raw_skos = open(skos, 'rb').read() self.skos = etree.XML(raw_skos) <|end_body_0|> <|body_start_1|> for member in ordered_collection: marc_field = match.find('{%s}datafield' % ns.MARC) ...
MARCSKOSMapper
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MARCSKOSMapper: def __init__(self, redis_marc_key, redis_server, skos): """:param redis_marc_key: Redis MARC key, unique Redis key for MARC record that is being mapped to FRBR entities :param redis_server: Redis server :param skos: SKOS filename""" <|body_0|> def processOrde...
stack_v2_sparse_classes_75kplus_train_070828
10,193
permissive
[ { "docstring": ":param redis_marc_key: Redis MARC key, unique Redis key for MARC record that is being mapped to FRBR entities :param redis_server: Redis server :param skos: SKOS filename", "name": "__init__", "signature": "def __init__(self, redis_marc_key, redis_server, skos)" }, { "docstring":...
5
stack_v2_sparse_classes_30k_test_001711
Implement the Python class `MARCSKOSMapper` described below. Class description: Implement the MARCSKOSMapper class. Method signatures and docstrings: - def __init__(self, redis_marc_key, redis_server, skos): :param redis_marc_key: Redis MARC key, unique Redis key for MARC record that is being mapped to FRBR entities ...
Implement the Python class `MARCSKOSMapper` described below. Class description: Implement the MARCSKOSMapper class. Method signatures and docstrings: - def __init__(self, redis_marc_key, redis_server, skos): :param redis_marc_key: Redis MARC key, unique Redis key for MARC record that is being mapped to FRBR entities ...
c11441311034fdda4b9c1d0a9bd152fdea32d94b
<|skeleton|> class MARCSKOSMapper: def __init__(self, redis_marc_key, redis_server, skos): """:param redis_marc_key: Redis MARC key, unique Redis key for MARC record that is being mapped to FRBR entities :param redis_server: Redis server :param skos: SKOS filename""" <|body_0|> def processOrde...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MARCSKOSMapper: def __init__(self, redis_marc_key, redis_server, skos): """:param redis_marc_key: Redis MARC key, unique Redis key for MARC record that is being mapped to FRBR entities :param redis_server: Redis server :param skos: SKOS filename""" self.redis_key = redis_marc_key self....
the_stack_v2_python_sparse
parsers/marc2frbr_rda.py
jermnelson/FRBR-Redis-Datastore
train
4
8c6c7b820e394fb0f2ebbd4c3eb37090ca3d68a7
[ "if not is_string(pattern):\n raise ValueError('Pattern argument must be a string')\nself._pattern = pattern\nself._regex = re.compile(pattern) if pattern is not None else None", "value = super(StringPatternParser, self).parse(value)\nif not self._regex.match(value):\n raise ValueParsingError(u\"String valu...
<|body_start_0|> if not is_string(pattern): raise ValueError('Pattern argument must be a string') self._pattern = pattern self._regex = re.compile(pattern) if pattern is not None else None <|end_body_0|> <|body_start_1|> value = super(StringPatternParser, self).parse(value) ...
String parser using a regular expression pattern.
StringPatternParser
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StringPatternParser: """String parser using a regular expression pattern.""" def __init__(self, pattern): """Initialize a new instance of StringPatternParser class. :param pattern: Regular expression which string's value must conform to :type pattern: RegEx""" <|body_0|> ...
stack_v2_sparse_classes_75kplus_train_070829
23,409
permissive
[ { "docstring": "Initialize a new instance of StringPatternParser class. :param pattern: Regular expression which string's value must conform to :type pattern: RegEx", "name": "__init__", "signature": "def __init__(self, pattern)" }, { "docstring": "Parse a string value using the specified regula...
2
stack_v2_sparse_classes_30k_train_048118
Implement the Python class `StringPatternParser` described below. Class description: String parser using a regular expression pattern. Method signatures and docstrings: - def __init__(self, pattern): Initialize a new instance of StringPatternParser class. :param pattern: Regular expression which string's value must c...
Implement the Python class `StringPatternParser` described below. Class description: String parser using a regular expression pattern. Method signatures and docstrings: - def __init__(self, pattern): Initialize a new instance of StringPatternParser class. :param pattern: Regular expression which string's value must c...
662cc7e0721d0153857c8c17a37e2a6df86f8ce6
<|skeleton|> class StringPatternParser: """String parser using a regular expression pattern.""" def __init__(self, pattern): """Initialize a new instance of StringPatternParser class. :param pattern: Regular expression which string's value must conform to :type pattern: RegEx""" <|body_0|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class StringPatternParser: """String parser using a regular expression pattern.""" def __init__(self, pattern): """Initialize a new instance of StringPatternParser class. :param pattern: Regular expression which string's value must conform to :type pattern: RegEx""" if not is_string(pattern): ...
the_stack_v2_python_sparse
core/util/webpub_manifest_parser/core/parsers.py
NYPL-Simplified/circulation
train
20
d856dd7db84fdb183edd3a28032cc3b24702e9a9
[ "super().__init__()\nself.timestep = timestep\nself.uuid = uuid\nself.mode = mode\nself.expectedvalue = randomparameters[0]\nself.variance = randomparameters[1]\nself.frequency = frequency\nself.gain = gain\nself.targetposition = targetposition\nself.listeningprobes = listeningprobes", "time.sleep(random.uniform(...
<|body_start_0|> super().__init__() self.timestep = timestep self.uuid = uuid self.mode = mode self.expectedvalue = randomparameters[0] self.variance = randomparameters[1] self.frequency = frequency self.gain = gain self.targetposition = targetposi...
MeasuresGenerator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MeasuresGenerator: def __init__(self, timestep, uuid, mode, randomparameters, frequency, gain, targetposition, listeningprobes): """Constructor""" <|body_0|> def run(self): """Overwrite run method with the measures generator behave.""" <|body_1|> def enq...
stack_v2_sparse_classes_75kplus_train_070830
9,035
no_license
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, timestep, uuid, mode, randomparameters, frequency, gain, targetposition, listeningprobes)" }, { "docstring": "Overwrite run method with the measures generator behave.", "name": "run", "signature": "def run...
4
null
Implement the Python class `MeasuresGenerator` described below. Class description: Implement the MeasuresGenerator class. Method signatures and docstrings: - def __init__(self, timestep, uuid, mode, randomparameters, frequency, gain, targetposition, listeningprobes): Constructor - def run(self): Overwrite run method ...
Implement the Python class `MeasuresGenerator` described below. Class description: Implement the MeasuresGenerator class. Method signatures and docstrings: - def __init__(self, timestep, uuid, mode, randomparameters, frequency, gain, targetposition, listeningprobes): Constructor - def run(self): Overwrite run method ...
a6c6a6421f7f1996b417d4b570ac539886df43ce
<|skeleton|> class MeasuresGenerator: def __init__(self, timestep, uuid, mode, randomparameters, frequency, gain, targetposition, listeningprobes): """Constructor""" <|body_0|> def run(self): """Overwrite run method with the measures generator behave.""" <|body_1|> def enq...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MeasuresGenerator: def __init__(self, timestep, uuid, mode, randomparameters, frequency, gain, targetposition, listeningprobes): """Constructor""" super().__init__() self.timestep = timestep self.uuid = uuid self.mode = mode self.expectedvalue = randomparameters...
the_stack_v2_python_sparse
miso_beacon_demo/measures_generator.py
Albertojuanse/miso_beacon
train
0
95e4d1b7f8a6965e0aa7ba1dfad1c51865b11ec9
[ "conversion_imports.check()\nsuper().__init__(remove_numeric_tables=remove_numeric_tables, valid_languages=valid_languages, id_hash_keys=id_hash_keys, progress_bar=progress_bar)\nself.remove_code_snippets = remove_code_snippets\nself.extract_headlines = extract_headlines\nself.add_frontmatter_to_meta = add_frontmat...
<|body_start_0|> conversion_imports.check() super().__init__(remove_numeric_tables=remove_numeric_tables, valid_languages=valid_languages, id_hash_keys=id_hash_keys, progress_bar=progress_bar) self.remove_code_snippets = remove_code_snippets self.extract_headlines = extract_headlines ...
MarkdownConverter
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MarkdownConverter: def __init__(self, remove_numeric_tables: bool=False, valid_languages: Optional[List[str]]=None, id_hash_keys: Optional[List[str]]=None, progress_bar: bool=True, remove_code_snippets: bool=True, extract_headlines: bool=False, add_frontmatter_to_meta: bool=False): """:p...
stack_v2_sparse_classes_75kplus_train_070831
6,131
permissive
[ { "docstring": ":param remove_numeric_tables: Not applicable. :param valid_languages: Not applicable. :param id_hash_keys: Generate the document ID from a custom list of strings that refer to the document's attributes. To make sure you don't have duplicate documents in your DocumentStore if texts are not unique...
3
stack_v2_sparse_classes_30k_train_038754
Implement the Python class `MarkdownConverter` described below. Class description: Implement the MarkdownConverter class. Method signatures and docstrings: - def __init__(self, remove_numeric_tables: bool=False, valid_languages: Optional[List[str]]=None, id_hash_keys: Optional[List[str]]=None, progress_bar: bool=True...
Implement the Python class `MarkdownConverter` described below. Class description: Implement the MarkdownConverter class. Method signatures and docstrings: - def __init__(self, remove_numeric_tables: bool=False, valid_languages: Optional[List[str]]=None, id_hash_keys: Optional[List[str]]=None, progress_bar: bool=True...
5f1256ac7e5734c2ea481e72cb7e02c34baf8c43
<|skeleton|> class MarkdownConverter: def __init__(self, remove_numeric_tables: bool=False, valid_languages: Optional[List[str]]=None, id_hash_keys: Optional[List[str]]=None, progress_bar: bool=True, remove_code_snippets: bool=True, extract_headlines: bool=False, add_frontmatter_to_meta: bool=False): """:p...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MarkdownConverter: def __init__(self, remove_numeric_tables: bool=False, valid_languages: Optional[List[str]]=None, id_hash_keys: Optional[List[str]]=None, progress_bar: bool=True, remove_code_snippets: bool=True, extract_headlines: bool=False, add_frontmatter_to_meta: bool=False): """:param remove_nu...
the_stack_v2_python_sparse
haystack/nodes/file_converter/markdown.py
deepset-ai/haystack
train
10,599
be44dd07365bc7b545def11d9cc4288f6a0eef02
[ "self.messages = messages\nself.source_permissions = permissions\nself.testable_permissions_map = {}\nif permissions:\n for permission in GetTestablePermissions(iam_client, messages, resource):\n self.testable_permissions_map[permission.name] = permission", "testing_permissions = []\nfor permission in s...
<|body_start_0|> self.messages = messages self.source_permissions = permissions self.testable_permissions_map = {} if permissions: for permission in GetTestablePermissions(iam_client, messages, resource): self.testable_permissions_map[permission.name] = permis...
Get different kinds of permissions list from permissions provided. Attributes: messages: The iam messages. source_permissions: A list of permissions to inspect. testable_permissions_map: A dict maps from permissions name string to Permission message provided by the API.
PermissionsHelper
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PermissionsHelper: """Get different kinds of permissions list from permissions provided. Attributes: messages: The iam messages. source_permissions: A list of permissions to inspect. testable_permissions_map: A dict maps from permissions name string to Permission message provided by the API.""" ...
stack_v2_sparse_classes_75kplus_train_070832
5,171
permissive
[ { "docstring": "Create a PermissionsHelper object. To get the testable permissions for the given resource and store as a dict. Args: iam_client: The iam client. messages: The iam messages. resource: Resource reference for the project/organization whose permissions are being inspected. permissions: A list of per...
6
stack_v2_sparse_classes_30k_test_001095
Implement the Python class `PermissionsHelper` described below. Class description: Get different kinds of permissions list from permissions provided. Attributes: messages: The iam messages. source_permissions: A list of permissions to inspect. testable_permissions_map: A dict maps from permissions name string to Permi...
Implement the Python class `PermissionsHelper` described below. Class description: Get different kinds of permissions list from permissions provided. Attributes: messages: The iam messages. source_permissions: A list of permissions to inspect. testable_permissions_map: A dict maps from permissions name string to Permi...
85bb264e273568b5a0408f733b403c56373e2508
<|skeleton|> class PermissionsHelper: """Get different kinds of permissions list from permissions provided. Attributes: messages: The iam messages. source_permissions: A list of permissions to inspect. testable_permissions_map: A dict maps from permissions name string to Permission message provided by the API.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PermissionsHelper: """Get different kinds of permissions list from permissions provided. Attributes: messages: The iam messages. source_permissions: A list of permissions to inspect. testable_permissions_map: A dict maps from permissions name string to Permission message provided by the API.""" def __ini...
the_stack_v2_python_sparse
google-cloud-sdk/lib/googlecloudsdk/api_lib/iam/util.py
bopopescu/socialliteapp
train
0
9606f016b37b2952441428714b13aca6895d55a8
[ "q = collections.deque()\nq.append(root)\nres = []\nif not root:\n return ''\nwhile q:\n node = q.popleft()\n if not node:\n res.append('#')\n else:\n res.append(str(node.val))\n q.append(node.left)\n q.append(node.right)\nwhile res[-1] == '#':\n res.pop()\nreturn ' '.join...
<|body_start_0|> q = collections.deque() q.append(root) res = [] if not root: return '' while q: node = q.popleft() if not node: res.append('#') else: res.append(str(node.val)) q.appen...
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_070833
2,251
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_train_020319
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:...
e890bd480de93418ce10867085b52137be2caa7a
<|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""" q = collections.deque() q.append(root) res = [] if not root: return '' while q: node = q.popleft() if not node: ...
the_stack_v2_python_sparse
python/297.py
LichAmnesia/LeetCode
train
0
eca51f7f2dfce5a3929aa62eb301ba058f9a4fab
[ "self.limited_company_submitting_information()\nactual = self.driver.find_element_by_class_name('el-input__inner').is_enabled()\nself.assertTrue(actual)\nlogger.info('断言')", "self.limited_partnership_submission()\nactual = self.driver.find_element_by_class_name('el-input__inner').is_enabled()\nself.assertTrue(act...
<|body_start_0|> self.limited_company_submitting_information() actual = self.driver.find_element_by_class_name('el-input__inner').is_enabled() self.assertTrue(actual) logger.info('断言') <|end_body_0|> <|body_start_1|> self.limited_partnership_submission() actual = self.dr...
Register
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Register: def test_case01(self): """直客购买有限注册提交资料""" <|body_0|> def test_case02(self): """直客购买有限合伙注册提交资料""" <|body_1|> def test_case03(self): """直客购买个人独资注册提交资料""" <|body_2|> <|end_skeleton|> <|body_start_0|> self.limited_company_...
stack_v2_sparse_classes_75kplus_train_070834
1,213
no_license
[ { "docstring": "直客购买有限注册提交资料", "name": "test_case01", "signature": "def test_case01(self)" }, { "docstring": "直客购买有限合伙注册提交资料", "name": "test_case02", "signature": "def test_case02(self)" }, { "docstring": "直客购买个人独资注册提交资料", "name": "test_case03", "signature": "def test_cas...
3
null
Implement the Python class `Register` described below. Class description: Implement the Register class. Method signatures and docstrings: - def test_case01(self): 直客购买有限注册提交资料 - def test_case02(self): 直客购买有限合伙注册提交资料 - def test_case03(self): 直客购买个人独资注册提交资料
Implement the Python class `Register` described below. Class description: Implement the Register class. Method signatures and docstrings: - def test_case01(self): 直客购买有限注册提交资料 - def test_case02(self): 直客购买有限合伙注册提交资料 - def test_case03(self): 直客购买个人独资注册提交资料 <|skeleton|> class Register: def test_case01(self): ...
cf92e8e81ceb5cb67217bf36993cf94fe470fd0b
<|skeleton|> class Register: def test_case01(self): """直客购买有限注册提交资料""" <|body_0|> def test_case02(self): """直客购买有限合伙注册提交资料""" <|body_1|> def test_case03(self): """直客购买个人独资注册提交资料""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Register: def test_case01(self): """直客购买有限注册提交资料""" self.limited_company_submitting_information() actual = self.driver.find_element_by_class_name('el-input__inner').is_enabled() self.assertTrue(actual) logger.info('断言') def test_case02(self): """直客购买有限合伙注册提...
the_stack_v2_python_sparse
hhr/case/qiantai/test_register.py
aixin2000/Test_Scripts
train
0
54d6176378b1eb8ffbaccc3418d212a6be389e56
[ "def backtrack(nums, temp_list, result):\n if len(temp_list) == len(nums):\n result.append(list(temp_list))\n else:\n for num in nums:\n if num not in temp_list:\n temp_list.append(num)\n backtrack(nums, temp_list, result)\n temp_list.pop()...
<|body_start_0|> def backtrack(nums, temp_list, result): if len(temp_list) == len(nums): result.append(list(temp_list)) else: for num in nums: if num not in temp_list: temp_list.append(num) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def permute(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_0|> def permute_2(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|> <|body_start_0|> def backtrack(nums, temp_li...
stack_v2_sparse_classes_75kplus_train_070835
1,439
no_license
[ { "docstring": ":type nums: List[int] :rtype: List[List[int]]", "name": "permute", "signature": "def permute(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: List[List[int]]", "name": "permute_2", "signature": "def permute_2(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_009027
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def permute(self, nums): :type nums: List[int] :rtype: List[List[int]] - def permute_2(self, nums): :type nums: List[int] :rtype: List[List[int]]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def permute(self, nums): :type nums: List[int] :rtype: List[List[int]] - def permute_2(self, nums): :type nums: List[int] :rtype: List[List[int]] <|skeleton|> class Solution: ...
9d9e0c08992ef7dbd9ac517821faa9de17f49b0e
<|skeleton|> class Solution: def permute(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_0|> def permute_2(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def permute(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" def backtrack(nums, temp_list, result): if len(temp_list) == len(nums): result.append(list(temp_list)) else: for num in nums: if nu...
the_stack_v2_python_sparse
046-permutations.py
floydchenchen/leetcode
train
0
4366ef216a7383c88c88f4902e1acd388b14b45c
[ "records = {}\nfor i, n in enumerate(nums):\n if n not in records:\n records[n] = i\n else:\n if i - records[n] <= k:\n return True\n records[n] = i\nreturn False", "if k > len(nums):\n k = len(nums)\nprint('@', k)\ni = 0\nwhile i < len(nums):\n j = i + 1\n while j <...
<|body_start_0|> records = {} for i, n in enumerate(nums): if n not in records: records[n] = i else: if i - records[n] <= k: return True records[n] = i return False <|end_body_0|> <|body_start_1|> ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def containsNearbyDuplicate(self, nums, k): """:type nums: List[int] :type k: int :rtype: bool""" <|body_0|> def containsNearbyDuplicate_TLE(self, nums, k): """:type nums: List[int] :type k: int :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_s...
stack_v2_sparse_classes_75kplus_train_070836
1,687
no_license
[ { "docstring": ":type nums: List[int] :type k: int :rtype: bool", "name": "containsNearbyDuplicate", "signature": "def containsNearbyDuplicate(self, nums, k)" }, { "docstring": ":type nums: List[int] :type k: int :rtype: bool", "name": "containsNearbyDuplicate_TLE", "signature": "def con...
2
stack_v2_sparse_classes_30k_train_021016
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def containsNearbyDuplicate(self, nums, k): :type nums: List[int] :type k: int :rtype: bool - def containsNearbyDuplicate_TLE(self, nums, k): :type nums: List[int] :type k: int :...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def containsNearbyDuplicate(self, nums, k): :type nums: List[int] :type k: int :rtype: bool - def containsNearbyDuplicate_TLE(self, nums, k): :type nums: List[int] :type k: int :...
e60ba45fe2f2e5e3b3abfecec3db76f5ce1fde59
<|skeleton|> class Solution: def containsNearbyDuplicate(self, nums, k): """:type nums: List[int] :type k: int :rtype: bool""" <|body_0|> def containsNearbyDuplicate_TLE(self, nums, k): """:type nums: List[int] :type k: int :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def containsNearbyDuplicate(self, nums, k): """:type nums: List[int] :type k: int :rtype: bool""" records = {} for i, n in enumerate(nums): if n not in records: records[n] = i else: if i - records[n] <= k: ...
the_stack_v2_python_sparse
src/lt_219.py
oxhead/CodingYourWay
train
0
15a6fb3d487d1de8eeacf6b37a3dba6b462ac162
[ "self.subclass = subclass\nself.shape = shape\nself.order = order\nself.dtype = dtype\nself.allow_mmap = allow_mmap", "buffersize = max(16 * 1024 ** 2 // array.itemsize, 1)\nif array.dtype.hasobject:\n pickle.dump(array, pickler.file_handle, protocol=2)\nelse:\n for chunk in pickler.np.nditer(array, flags=[...
<|body_start_0|> self.subclass = subclass self.shape = shape self.order = order self.dtype = dtype self.allow_mmap = allow_mmap <|end_body_0|> <|body_start_1|> buffersize = max(16 * 1024 ** 2 // array.itemsize, 1) if array.dtype.hasobject: pickle.dump...
An object to be persisted instead of numpy arrays. This object is used to hack into the pickle machinery and read numpy array data from our custom persistence format. More precisely, this object is used for: * carrying the information of the persisted array: subclass, shape, order, dtype. Those ndarray metadata are use...
NumpyArrayWrapper
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumpyArrayWrapper: """An object to be persisted instead of numpy arrays. This object is used to hack into the pickle machinery and read numpy array data from our custom persistence format. More precisely, this object is used for: * carrying the information of the persisted array: subclass, shape,...
stack_v2_sparse_classes_75kplus_train_070837
23,222
permissive
[ { "docstring": "Constructor. Store the useful information for later.", "name": "__init__", "signature": "def __init__(self, subclass, shape, order, dtype, allow_mmap=False)" }, { "docstring": "Write array bytes to pickler file handle. This function is an adaptation of the numpy write_array funct...
5
stack_v2_sparse_classes_30k_train_036087
Implement the Python class `NumpyArrayWrapper` described below. Class description: An object to be persisted instead of numpy arrays. This object is used to hack into the pickle machinery and read numpy array data from our custom persistence format. More precisely, this object is used for: * carrying the information o...
Implement the Python class `NumpyArrayWrapper` described below. Class description: An object to be persisted instead of numpy arrays. This object is used to hack into the pickle machinery and read numpy array data from our custom persistence format. More precisely, this object is used for: * carrying the information o...
f5042e35b945aded77b23470ead62d7eacefde92
<|skeleton|> class NumpyArrayWrapper: """An object to be persisted instead of numpy arrays. This object is used to hack into the pickle machinery and read numpy array data from our custom persistence format. More precisely, this object is used for: * carrying the information of the persisted array: subclass, shape,...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NumpyArrayWrapper: """An object to be persisted instead of numpy arrays. This object is used to hack into the pickle machinery and read numpy array data from our custom persistence format. More precisely, this object is used for: * carrying the information of the persisted array: subclass, shape, order, dtype...
the_stack_v2_python_sparse
contrib/python/scikit-learn/py2/sklearn/externals/joblib/numpy_pickle.py
catboost/catboost
train
8,012
26bfb13903c0aa13bdfaa0ac495acf968c7119e7
[ "pinned_until = request.session.get(PINNING_KEY, False)\nif pinned_until and pinned_until > datetime.now():\n pinning.pin_thread()", "if pinning.db_was_written():\n pinned_until = datetime.now() + timedelta(seconds=PINNING_SECONDS)\n request.session[PINNING_KEY] = pinned_until\n pinning.clear_db_write...
<|body_start_0|> pinned_until = request.session.get(PINNING_KEY, False) if pinned_until and pinned_until > datetime.now(): pinning.pin_thread() <|end_body_0|> <|body_start_1|> if pinning.db_was_written(): pinned_until = datetime.now() + timedelta(seconds=PINNING_SECONDS)...
Middleware to support the PinningMixin. Sets a session variable if there was a database write, which will direct that user's subsequent reads to the master database.
PinningSessionMiddleware
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PinningSessionMiddleware: """Middleware to support the PinningMixin. Sets a session variable if there was a database write, which will direct that user's subsequent reads to the master database.""" def process_request(self, request): """Set the thread's pinning flag according to the ...
stack_v2_sparse_classes_75kplus_train_070838
30,374
no_license
[ { "docstring": "Set the thread's pinning flag according to the presence of the session variable.", "name": "process_request", "signature": "def process_request(self, request)" }, { "docstring": "If there was a write to the db, set the session variable to enable pinning. If the variable already e...
2
null
Implement the Python class `PinningSessionMiddleware` described below. Class description: Middleware to support the PinningMixin. Sets a session variable if there was a database write, which will direct that user's subsequent reads to the master database. Method signatures and docstrings: - def process_request(self, ...
Implement the Python class `PinningSessionMiddleware` described below. Class description: Middleware to support the PinningMixin. Sets a session variable if there was a database write, which will direct that user's subsequent reads to the master database. Method signatures and docstrings: - def process_request(self, ...
0ac6653219c2701c13c508c5c4fc9bc3437eea06
<|skeleton|> class PinningSessionMiddleware: """Middleware to support the PinningMixin. Sets a session variable if there was a database write, which will direct that user's subsequent reads to the master database.""" def process_request(self, request): """Set the thread's pinning flag according to the ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PinningSessionMiddleware: """Middleware to support the PinningMixin. Sets a session variable if there was a database write, which will direct that user's subsequent reads to the master database.""" def process_request(self, request): """Set the thread's pinning flag according to the presence of t...
the_stack_v2_python_sparse
repoData/bkonkle-django-balancer/allPythonContent.py
aCoffeeYin/pyreco
train
0
933c17fa7a81e3805b9e3c86a4cc5973c6159718
[ "try:\n return json_encode(packet.get_dict())\nexcept Exception as e:\n logger.debug('can not serialize packet to text: %s' % e)\n return None", "if 'code' not in data or not data['code']:\n raise Exception('packet data must contain non-empty \"code\" field')\nif len(data['code'].split(':')) != 2:\n ...
<|body_start_0|> try: return json_encode(packet.get_dict()) except Exception as e: logger.debug('can not serialize packet to text: %s' % e) return None <|end_body_0|> <|body_start_1|> if 'code' not in data or not data['code']: raise Exception('pac...
Класс сериализации/десериализации сообщений.
Converter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Converter: """Класс сериализации/десериализации сообщений.""" def serialize(cls, packet): """Превращает пакет в текст. @param message: dmgame.packets.outcoming.OutcomingPacket @return: string""" <|body_0|> def _check_packet_data(cls, data): """Проверяет корректно...
stack_v2_sparse_classes_75kplus_train_070839
2,353
no_license
[ { "docstring": "Превращает пакет в текст. @param message: dmgame.packets.outcoming.OutcomingPacket @return: string", "name": "serialize", "signature": "def serialize(cls, packet)" }, { "docstring": "Проверяет корректность данных пакета. @param data: dict", "name": "_check_packet_data", "...
4
stack_v2_sparse_classes_30k_train_042425
Implement the Python class `Converter` described below. Class description: Класс сериализации/десериализации сообщений. Method signatures and docstrings: - def serialize(cls, packet): Превращает пакет в текст. @param message: dmgame.packets.outcoming.OutcomingPacket @return: string - def _check_packet_data(cls, data)...
Implement the Python class `Converter` described below. Class description: Класс сериализации/десериализации сообщений. Method signatures and docstrings: - def serialize(cls, packet): Превращает пакет в текст. @param message: dmgame.packets.outcoming.OutcomingPacket @return: string - def _check_packet_data(cls, data)...
c1d6f129ce321b9bfa448442a33ac89eb0ccd3ee
<|skeleton|> class Converter: """Класс сериализации/десериализации сообщений.""" def serialize(cls, packet): """Превращает пакет в текст. @param message: dmgame.packets.outcoming.OutcomingPacket @return: string""" <|body_0|> def _check_packet_data(cls, data): """Проверяет корректно...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Converter: """Класс сериализации/десериализации сообщений.""" def serialize(cls, packet): """Превращает пакет в текст. @param message: dmgame.packets.outcoming.OutcomingPacket @return: string""" try: return json_encode(packet.get_dict()) except Exception as e: ...
the_stack_v2_python_sparse
dmgame/servers/ws/converter.py
micdm/dmgame-server
train
0
edcad38e1b330747c4d586116a7d859f0c1fce8c
[ "logging.info('Creating Delg model, gem_power %d, embedding_layer_dim %d', gem_power, embedding_layer_dim)\nsuper(Delg, self).__init__(block3_strides=block3_strides, name=name, pooling='gem', gem_power=gem_power, embedding_layer=True, embedding_layer_dim=embedding_layer_dim, use_dim_reduction=use_dim_reduction, red...
<|body_start_0|> logging.info('Creating Delg model, gem_power %d, embedding_layer_dim %d', gem_power, embedding_layer_dim) super(Delg, self).__init__(block3_strides=block3_strides, name=name, pooling='gem', gem_power=gem_power, embedding_layer=True, embedding_layer_dim=embedding_layer_dim, use_dim_reduc...
Instantiates Keras DELG model using ResNet50 as backbone. This class implements the [DELG](https://arxiv.org/abs/2001.05027) model for extracting local and global features from images. The same attention layer is trained as in the DELF model. In addition, the extraction of global features is trained using GeMPooling, a...
Delg
[ "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Delg: """Instantiates Keras DELG model using ResNet50 as backbone. This class implements the [DELG](https://arxiv.org/abs/2001.05027) model for extracting local and global features from images. The same attention layer is trained as in the DELF model. In addition, the extraction of global feature...
stack_v2_sparse_classes_75kplus_train_070840
7,641
permissive
[ { "docstring": "Initialization of DELG model. Args: block3_strides: bool, whether to add strides to the output of block3. name: str, name to identify model. gem_power: float, GeM power parameter. embedding_layer_dim : int, dimension of the embedding layer. scale_factor_init: float. arcface_margin: float, ArcFac...
3
stack_v2_sparse_classes_30k_train_045569
Implement the Python class `Delg` described below. Class description: Instantiates Keras DELG model using ResNet50 as backbone. This class implements the [DELG](https://arxiv.org/abs/2001.05027) model for extracting local and global features from images. The same attention layer is trained as in the DELF model. In add...
Implement the Python class `Delg` described below. Class description: Instantiates Keras DELG model using ResNet50 as backbone. This class implements the [DELG](https://arxiv.org/abs/2001.05027) model for extracting local and global features from images. The same attention layer is trained as in the DELF model. In add...
6fc53292b1d3ce3c0340ce724c2c11c77e663d27
<|skeleton|> class Delg: """Instantiates Keras DELG model using ResNet50 as backbone. This class implements the [DELG](https://arxiv.org/abs/2001.05027) model for extracting local and global features from images. The same attention layer is trained as in the DELF model. In addition, the extraction of global feature...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Delg: """Instantiates Keras DELG model using ResNet50 as backbone. This class implements the [DELG](https://arxiv.org/abs/2001.05027) model for extracting local and global features from images. The same attention layer is trained as in the DELF model. In addition, the extraction of global features is trained ...
the_stack_v2_python_sparse
models/research/delf/delf/python/training/model/delg_model.py
aboerzel/German_License_Plate_Recognition
train
34
19491073df7989263280c95fef79a02710ed19df
[ "self.lei = lei\nself.entity = entity\nself.registration = registration\nself.extension = extension\nself.additional_properties = additional_properties", "if dictionary is None:\n return None\nlei = dictionary.get('Lei')\nentity = idfy_rest_client.models.lei_entity.LeiEntity.from_dictionary(dictionary.get('Ent...
<|body_start_0|> self.lei = lei self.entity = entity self.registration = registration self.extension = extension self.additional_properties = additional_properties <|end_body_0|> <|body_start_1|> if dictionary is None: return None lei = dictionary.get...
Implementation of the 'LeiRecord' model. TODO: type model description here. Attributes: lei (string): TODO: type description here. entity (LeiEntity): TODO: type description here. registration (LeiRegistration): TODO: type description here. extension (LeiExtension): TODO: type description here.
LeiRecord
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LeiRecord: """Implementation of the 'LeiRecord' model. TODO: type model description here. Attributes: lei (string): TODO: type description here. entity (LeiEntity): TODO: type description here. registration (LeiRegistration): TODO: type description here. extension (LeiExtension): TODO: type descr...
stack_v2_sparse_classes_75kplus_train_070841
2,958
permissive
[ { "docstring": "Constructor for the LeiRecord class", "name": "__init__", "signature": "def __init__(self, lei=None, entity=None, registration=None, extension=None, additional_properties={})" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A ...
2
stack_v2_sparse_classes_30k_train_024461
Implement the Python class `LeiRecord` described below. Class description: Implementation of the 'LeiRecord' model. TODO: type model description here. Attributes: lei (string): TODO: type description here. entity (LeiEntity): TODO: type description here. registration (LeiRegistration): TODO: type description here. ext...
Implement the Python class `LeiRecord` described below. Class description: Implementation of the 'LeiRecord' model. TODO: type model description here. Attributes: lei (string): TODO: type description here. entity (LeiEntity): TODO: type description here. registration (LeiRegistration): TODO: type description here. ext...
fa3918a6c54ea0eedb9146578645b7eb1755b642
<|skeleton|> class LeiRecord: """Implementation of the 'LeiRecord' model. TODO: type model description here. Attributes: lei (string): TODO: type description here. entity (LeiEntity): TODO: type description here. registration (LeiRegistration): TODO: type description here. extension (LeiExtension): TODO: type descr...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LeiRecord: """Implementation of the 'LeiRecord' model. TODO: type model description here. Attributes: lei (string): TODO: type description here. entity (LeiEntity): TODO: type description here. registration (LeiRegistration): TODO: type description here. extension (LeiExtension): TODO: type description here."...
the_stack_v2_python_sparse
idfy_rest_client/models/lei_record.py
dealflowteam/Idfy
train
0
8c1dced38cbc06192a2178c53ff8c2d17ce7bfa5
[ "size = len(a)\nleft = [1] * size\nright = [1] * size\nresult = [1] * size\nfor i in range(1, size):\n left[i] = left[i - 1] * a[i - 1]\nfor i in range(size - 2, -1, -1):\n right[i] = right[i + 1] * a[i + 1]\nfor i in range(size):\n result[i] = left[i] * right[i]\nreturn result", "size = len(a)\nleft = [...
<|body_start_0|> size = len(a) left = [1] * size right = [1] * size result = [1] * size for i in range(1, size): left[i] = left[i - 1] * a[i - 1] for i in range(size - 2, -1, -1): right[i] = right[i + 1] * a[i + 1] for i in range(size): ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def constructArr(self, a: List[int]) -> List[int]: """限制:不能用除法,直接称复杂度太高,左右乘积数组循环次数:3层,2层,1层 本质:本质就是两个dp数组,分别维护 i 左侧、右侧的乘积和。前缀积和后缀积""" <|body_0|> def constructArr1(self, a: List[int]) -> List[int]: """优化循环次数:2层""" <|body_1|> def constructArr2(se...
stack_v2_sparse_classes_75kplus_train_070842
2,664
permissive
[ { "docstring": "限制:不能用除法,直接称复杂度太高,左右乘积数组循环次数:3层,2层,1层 本质:本质就是两个dp数组,分别维护 i 左侧、右侧的乘积和。前缀积和后缀积", "name": "constructArr", "signature": "def constructArr(self, a: List[int]) -> List[int]" }, { "docstring": "优化循环次数:2层", "name": "constructArr1", "signature": "def constructArr1(self, a: List[in...
3
stack_v2_sparse_classes_30k_train_024874
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def constructArr(self, a: List[int]) -> List[int]: 限制:不能用除法,直接称复杂度太高,左右乘积数组循环次数:3层,2层,1层 本质:本质就是两个dp数组,分别维护 i 左侧、右侧的乘积和。前缀积和后缀积 - def constructArr1(self, a: List[int]) -> List[in...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def constructArr(self, a: List[int]) -> List[int]: 限制:不能用除法,直接称复杂度太高,左右乘积数组循环次数:3层,2层,1层 本质:本质就是两个dp数组,分别维护 i 左侧、右侧的乘积和。前缀积和后缀积 - def constructArr1(self, a: List[int]) -> List[in...
e8a1c6cae6547cbcb6e8494be6df685f3e7c837c
<|skeleton|> class Solution: def constructArr(self, a: List[int]) -> List[int]: """限制:不能用除法,直接称复杂度太高,左右乘积数组循环次数:3层,2层,1层 本质:本质就是两个dp数组,分别维护 i 左侧、右侧的乘积和。前缀积和后缀积""" <|body_0|> def constructArr1(self, a: List[int]) -> List[int]: """优化循环次数:2层""" <|body_1|> def constructArr2(se...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def constructArr(self, a: List[int]) -> List[int]: """限制:不能用除法,直接称复杂度太高,左右乘积数组循环次数:3层,2层,1层 本质:本质就是两个dp数组,分别维护 i 左侧、右侧的乘积和。前缀积和后缀积""" size = len(a) left = [1] * size right = [1] * size result = [1] * size for i in range(1, size): left[i] = ...
the_stack_v2_python_sparse
lcof/66-gou-jian-cheng-ji-shu-zu-lcof.py
yuenliou/leetcode
train
0
c67313f7bb82800b3cb146706b074697b48d5207
[ "self.size = size\nself.elements = deque()\nself.sum = 0", "self.elements.append(val)\nself.sum += val\nif len(self.elements) > self.size:\n self.sum -= self.elements.popleft()\nreturn self.sum / len(self.elements)" ]
<|body_start_0|> self.size = size self.elements = deque() self.sum = 0 <|end_body_0|> <|body_start_1|> self.elements.append(val) self.sum += val if len(self.elements) > self.size: self.sum -= self.elements.popleft() return self.sum / len(self.elements...
MovingAverage
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MovingAverage: def __init__(self, size): """Initialize your data structure here. :type size: int""" <|body_0|> def next(self, val): """:type val: int :rtype: float""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.size = size self.element...
stack_v2_sparse_classes_75kplus_train_070843
738
permissive
[ { "docstring": "Initialize your data structure here. :type size: int", "name": "__init__", "signature": "def __init__(self, size)" }, { "docstring": ":type val: int :rtype: float", "name": "next", "signature": "def next(self, val)" } ]
2
null
Implement the Python class `MovingAverage` described below. Class description: Implement the MovingAverage class. Method signatures and docstrings: - def __init__(self, size): Initialize your data structure here. :type size: int - def next(self, val): :type val: int :rtype: float
Implement the Python class `MovingAverage` described below. Class description: Implement the MovingAverage class. Method signatures and docstrings: - def __init__(self, size): Initialize your data structure here. :type size: int - def next(self, val): :type val: int :rtype: float <|skeleton|> class MovingAverage: ...
ba84c192fb9995dd48ddc6d81c3153488dd3c698
<|skeleton|> class MovingAverage: def __init__(self, size): """Initialize your data structure here. :type size: int""" <|body_0|> def next(self, val): """:type val: int :rtype: float""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MovingAverage: def __init__(self, size): """Initialize your data structure here. :type size: int""" self.size = size self.elements = deque() self.sum = 0 def next(self, val): """:type val: int :rtype: float""" self.elements.append(val) self.sum += v...
the_stack_v2_python_sparse
Python/moving-average-from-data-stream.py
phucle2411/LeetCode
train
0
a6e49435a7bb7fc4b9e730165702362efb175732
[ "if rowIndex == 0:\n return [1]\nprev = self.getRow(rowIndex - 1)\nreturn [1] + [prev[i] + prev[i + 1] for i in range(rowIndex - 1)] + [1]", "row = [1]\nfor row_num in range(1, rowIndex + 1):\n temp = [None for _ in range(row_num + 1)]\n temp[0], temp[-1] = (1, 1)\n for i in range(1, row_num):\n ...
<|body_start_0|> if rowIndex == 0: return [1] prev = self.getRow(rowIndex - 1) return [1] + [prev[i] + prev[i + 1] for i in range(rowIndex - 1)] + [1] <|end_body_0|> <|body_start_1|> row = [1] for row_num in range(1, rowIndex + 1): temp = [None for _ in r...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def getRow(self, rowIndex): """:type rowIndex: int :rtype: List[int]""" <|body_0|> def getRow(self, rowIndex): """:type rowIndex: int :rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|> if rowIndex == 0: return [1...
stack_v2_sparse_classes_75kplus_train_070844
836
no_license
[ { "docstring": ":type rowIndex: int :rtype: List[int]", "name": "getRow", "signature": "def getRow(self, rowIndex)" }, { "docstring": ":type rowIndex: int :rtype: List[int]", "name": "getRow", "signature": "def getRow(self, rowIndex)" } ]
2
stack_v2_sparse_classes_30k_train_038628
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getRow(self, rowIndex): :type rowIndex: int :rtype: List[int] - def getRow(self, rowIndex): :type rowIndex: int :rtype: List[int]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getRow(self, rowIndex): :type rowIndex: int :rtype: List[int] - def getRow(self, rowIndex): :type rowIndex: int :rtype: List[int] <|skeleton|> class Solution: def getRo...
a509b383a42f54313970168d9faa11f088f18708
<|skeleton|> class Solution: def getRow(self, rowIndex): """:type rowIndex: int :rtype: List[int]""" <|body_0|> def getRow(self, rowIndex): """:type rowIndex: int :rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def getRow(self, rowIndex): """:type rowIndex: int :rtype: List[int]""" if rowIndex == 0: return [1] prev = self.getRow(rowIndex - 1) return [1] + [prev[i] + prev[i + 1] for i in range(rowIndex - 1)] + [1] def getRow(self, rowIndex): """:type ...
the_stack_v2_python_sparse
0119_Pascal's_Triangle_II.py
bingli8802/leetcode
train
0
4e9d8a0b09eba4d2e126876ae1307596d589a959
[ "if not self._root:\n self._root = self._Node(key)\nelse:\n node = self._root\n parent = None\n while node:\n parent = node\n if key == node.key:\n break\n node = node.left if key < node.key else node.right\n if key == parent.key:\n parent._count += 1\n elif ...
<|body_start_0|> if not self._root: self._root = self._Node(key) else: node = self._root parent = None while node: parent = node if key == node.key: break node = node.left if key < node.ke...
Represents a Binary Search Tree with duplicate keys.
BinarySearchTreeDupKeys
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BinarySearchTreeDupKeys: """Represents a Binary Search Tree with duplicate keys.""" def insert(self, key): """Inserts ``key`` in the tree.""" <|body_0|> def delete(self, key, delete_all=False): """Deletes key ``key`` from the tree. :param delete_all: If true, del...
stack_v2_sparse_classes_75kplus_train_070845
1,832
permissive
[ { "docstring": "Inserts ``key`` in the tree.", "name": "insert", "signature": "def insert(self, key)" }, { "docstring": "Deletes key ``key`` from the tree. :param delete_all: If true, deletes all the duplicate keys. Else deletes only a single occurrence of the key.", "name": "delete", "s...
2
stack_v2_sparse_classes_30k_val_002580
Implement the Python class `BinarySearchTreeDupKeys` described below. Class description: Represents a Binary Search Tree with duplicate keys. Method signatures and docstrings: - def insert(self, key): Inserts ``key`` in the tree. - def delete(self, key, delete_all=False): Deletes key ``key`` from the tree. :param del...
Implement the Python class `BinarySearchTreeDupKeys` described below. Class description: Represents a Binary Search Tree with duplicate keys. Method signatures and docstrings: - def insert(self, key): Inserts ``key`` in the tree. - def delete(self, key, delete_all=False): Deletes key ``key`` from the tree. :param del...
7e2e024cc55d7eb2ee2d205c912e184f1d32cfdf
<|skeleton|> class BinarySearchTreeDupKeys: """Represents a Binary Search Tree with duplicate keys.""" def insert(self, key): """Inserts ``key`` in the tree.""" <|body_0|> def delete(self, key, delete_all=False): """Deletes key ``key`` from the tree. :param delete_all: If true, del...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BinarySearchTreeDupKeys: """Represents a Binary Search Tree with duplicate keys.""" def insert(self, key): """Inserts ``key`` in the tree.""" if not self._root: self._root = self._Node(key) else: node = self._root parent = None while...
the_stack_v2_python_sparse
ds/tree/binary_search_tree_with_dup.py
farnasirim/zahlen
train
0
e19012aa155c41da420c6a572cd2bc6aa2e9dfd8
[ "npts = len(pts)\nh = ncfs // 2\ncfs = {}\nfor n in range(-h, h + 1):\n cn = 0\n for iw in range(npts):\n w = iw / npts\n fw = complex(*pts[iw])\n cn += fw * cmath.exp(-1j * n * w * wo)\n cn /= npts\n cfs[n] = cn\nreturn cfs", "ncfs = len(cfs)\nh = npts // 2\npts = []\nfor it in r...
<|body_start_0|> npts = len(pts) h = ncfs // 2 cfs = {} for n in range(-h, h + 1): cn = 0 for iw in range(npts): w = iw / npts fw = complex(*pts[iw]) cn += fw * cmath.exp(-1j * n * w * wo) cn /= npts ...
Fourier
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Fourier: def transform(pts, ncfs, wo=2 * math.pi): """Apply the true fourier transform by returning a dictionary of the coefficients.""" <|body_0|> def inverseTransform(cfs, npts, wo=2 * math.pi): """Apply the true fourier inverse transform by returning the list of t...
stack_v2_sparse_classes_75kplus_train_070846
12,806
no_license
[ { "docstring": "Apply the true fourier transform by returning a dictionary of the coefficients.", "name": "transform", "signature": "def transform(pts, ncfs, wo=2 * math.pi)" }, { "docstring": "Apply the true fourier inverse transform by returning the list of the points.", "name": "inverseTr...
3
null
Implement the Python class `Fourier` described below. Class description: Implement the Fourier class. Method signatures and docstrings: - def transform(pts, ncfs, wo=2 * math.pi): Apply the true fourier transform by returning a dictionary of the coefficients. - def inverseTransform(cfs, npts, wo=2 * math.pi): Apply t...
Implement the Python class `Fourier` described below. Class description: Implement the Fourier class. Method signatures and docstrings: - def transform(pts, ncfs, wo=2 * math.pi): Apply the true fourier transform by returning a dictionary of the coefficients. - def inverseTransform(cfs, npts, wo=2 * math.pi): Apply t...
ebfcaaf4a028eddb36bbc99184eb3f7a86eb24ed
<|skeleton|> class Fourier: def transform(pts, ncfs, wo=2 * math.pi): """Apply the true fourier transform by returning a dictionary of the coefficients.""" <|body_0|> def inverseTransform(cfs, npts, wo=2 * math.pi): """Apply the true fourier inverse transform by returning the list of t...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Fourier: def transform(pts, ncfs, wo=2 * math.pi): """Apply the true fourier transform by returning a dictionary of the coefficients.""" npts = len(pts) h = ncfs // 2 cfs = {} for n in range(-h, h + 1): cn = 0 for iw in range(npts): ...
the_stack_v2_python_sparse
Game Structure/geometry/version4/myfouriervf.py
MarcPartensky/Python-Games
train
2
42914637a58c9b2509dc8d1e541b0a1aee3af026
[ "self.mhdr = mhdr\nself.appeui = appeui\nself.deveui = deveui\nself.devnonce = devnonce\nself.mic = mic", "if len(data) != 23:\n raise DecodeError()\nappeui, deveui, devnonce, mic = struct.unpack('<QQHL', data[1:])\nm = JoinRequestMessage(mhdr, appeui, deveui, devnonce, mic)\nreturn m", "data = self.mhdr.enc...
<|body_start_0|> self.mhdr = mhdr self.appeui = appeui self.deveui = deveui self.devnonce = devnonce self.mic = mic <|end_body_0|> <|body_start_1|> if len(data) != 23: raise DecodeError() appeui, deveui, devnonce, mic = struct.unpack('<QQHL', data[1:]...
A LoRa Join Request message. The join request message contains the AppEUI and DevEUI of the end device, followed by a Nonce of 2 octets (devnonce). Attributes: mhdr (MACHeader): MAC header object. appeui (int): Application identifer. deveui (int): Global end device EUI. devnonce (int): Device nonce. mic (int): Message ...
JoinRequestMessage
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JoinRequestMessage: """A LoRa Join Request message. The join request message contains the AppEUI and DevEUI of the end device, followed by a Nonce of 2 octets (devnonce). Attributes: mhdr (MACHeader): MAC header object. appeui (int): Application identifer. deveui (int): Global end device EUI. dev...
stack_v2_sparse_classes_75kplus_train_070847
26,915
permissive
[ { "docstring": "JoinRequestMessage initialisation method.", "name": "__init__", "signature": "def __init__(self, mhdr, appeui, deveui, devnonce, mic)" }, { "docstring": "Create a MACJoinRequestMessage object from binary representation. Args: mhdr (MACHeader): MAC header object. data (str): UDP p...
3
stack_v2_sparse_classes_30k_train_005175
Implement the Python class `JoinRequestMessage` described below. Class description: A LoRa Join Request message. The join request message contains the AppEUI and DevEUI of the end device, followed by a Nonce of 2 octets (devnonce). Attributes: mhdr (MACHeader): MAC header object. appeui (int): Application identifer. d...
Implement the Python class `JoinRequestMessage` described below. Class description: A LoRa Join Request message. The join request message contains the AppEUI and DevEUI of the end device, followed by a Nonce of 2 octets (devnonce). Attributes: mhdr (MACHeader): MAC header object. appeui (int): Application identifer. d...
add5a1129296dca6db55b7980c0c1091f1ca80aa
<|skeleton|> class JoinRequestMessage: """A LoRa Join Request message. The join request message contains the AppEUI and DevEUI of the end device, followed by a Nonce of 2 octets (devnonce). Attributes: mhdr (MACHeader): MAC header object. appeui (int): Application identifer. deveui (int): Global end device EUI. dev...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class JoinRequestMessage: """A LoRa Join Request message. The join request message contains the AppEUI and DevEUI of the end device, followed by a Nonce of 2 octets (devnonce). Attributes: mhdr (MACHeader): MAC header object. appeui (int): Application identifer. deveui (int): Global end device EUI. devnonce (int): ...
the_stack_v2_python_sparse
floranet/lora/mac.py
chengzhongkai/floranet
train
0
ffae65390e1f5c80af783ea5af643ea17f47249a
[ "request_data = request.get_json()\nBrandValidators.validate(request_data)\nrequest_data = request_data_strip(request_data)\nrequest_data['name'] = request_data['name'].lower()\nnew_brand = Brand(**request_data)\nnew_brand.save()\nbrand_schema = BrandSchema()\nbrand_data = brand_schema.dump(new_brand)\nsuccess_resp...
<|body_start_0|> request_data = request.get_json() BrandValidators.validate(request_data) request_data = request_data_strip(request_data) request_data['name'] = request_data['name'].lower() new_brand = Brand(**request_data) new_brand.save() brand_schema = BrandSch...
" Resource class for brand endpoints
BrandResource
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BrandResource: """" Resource class for brand endpoints""" def post(self): """Endpoint to create the brand""" <|body_0|> def get(self): """Endpoint to get all brands""" <|body_1|> <|end_skeleton|> <|body_start_0|> request_data = request.get_json(...
stack_v2_sparse_classes_75kplus_train_070848
3,777
no_license
[ { "docstring": "Endpoint to create the brand", "name": "post", "signature": "def post(self)" }, { "docstring": "Endpoint to get all brands", "name": "get", "signature": "def get(self)" } ]
2
stack_v2_sparse_classes_30k_train_032859
Implement the Python class `BrandResource` described below. Class description: " Resource class for brand endpoints Method signatures and docstrings: - def post(self): Endpoint to create the brand - def get(self): Endpoint to get all brands
Implement the Python class `BrandResource` described below. Class description: " Resource class for brand endpoints Method signatures and docstrings: - def post(self): Endpoint to create the brand - def get(self): Endpoint to get all brands <|skeleton|> class BrandResource: """" Resource class for brand endpoint...
931ef50cb81201fe5ce2f5d40200cec7813f7f41
<|skeleton|> class BrandResource: """" Resource class for brand endpoints""" def post(self): """Endpoint to create the brand""" <|body_0|> def get(self): """Endpoint to get all brands""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BrandResource: """" Resource class for brand endpoints""" def post(self): """Endpoint to create the brand""" request_data = request.get_json() BrandValidators.validate(request_data) request_data = request_data_strip(request_data) request_data['name'] = request_data...
the_stack_v2_python_sparse
api/views/brand.py
Paccy10/flask-ecommerce-api
train
5
a4f816845455f3aad09ef86032f40916d0658d26
[ "if not root:\n return ''\nnodes = []\nstack = []\nnode = root\nwhile len(stack) > 0 or node:\n if not node:\n node = stack.pop().right\n while node:\n nodes.append(str(node.val))\n stack.append(node)\n node = node.left\n nodes.append('None')\nreturn ','.join(nodes)", "if d...
<|body_start_0|> if not root: return '' nodes = [] stack = [] node = root while len(stack) > 0 or node: if not node: node = stack.pop().right while node: nodes.append(str(node.val)) stack.append(n...
序列化是将一个数据结构或者对象转换为连续的比特位的操作,进而可以将转换后的数据存储在一个文件或者内存中, 同时也可以通过网络传输到另一个计算机环境,采取相反方式重构得到原数据。 请设计一个算法来实现二叉树的序列化与反序列化。这里不限定你的序列 / 反序列化算法执行逻辑, 你只需要保证一个二叉树可以被序列化为一个字符串并且将这个字符串反序列化为原始的树结构。
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: """序列化是将一个数据结构或者对象转换为连续的比特位的操作,进而可以将转换后的数据存储在一个文件或者内存中, 同时也可以通过网络传输到另一个计算机环境,采取相反方式重构得到原数据。 请设计一个算法来实现二叉树的序列化与反序列化。这里不限定你的序列 / 反序列化算法执行逻辑, 你只需要保证一个二叉树可以被序列化为一个字符串并且将这个字符串反序列化为原始的树结构。""" def serialize(self, root): """Encodes a tree to a single string. 前序遍历,用None顶替空节点 :type root...
stack_v2_sparse_classes_75kplus_train_070849
2,061
no_license
[ { "docstring": "Encodes a tree to a single string. 前序遍历,用None顶替空节点 :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":...
2
stack_v2_sparse_classes_30k_train_017659
Implement the Python class `Codec` described below. Class description: 序列化是将一个数据结构或者对象转换为连续的比特位的操作,进而可以将转换后的数据存储在一个文件或者内存中, 同时也可以通过网络传输到另一个计算机环境,采取相反方式重构得到原数据。 请设计一个算法来实现二叉树的序列化与反序列化。这里不限定你的序列 / 反序列化算法执行逻辑, 你只需要保证一个二叉树可以被序列化为一个字符串并且将这个字符串反序列化为原始的树结构。 Method signatures and docstrings: - def serialize(self, root): Enco...
Implement the Python class `Codec` described below. Class description: 序列化是将一个数据结构或者对象转换为连续的比特位的操作,进而可以将转换后的数据存储在一个文件或者内存中, 同时也可以通过网络传输到另一个计算机环境,采取相反方式重构得到原数据。 请设计一个算法来实现二叉树的序列化与反序列化。这里不限定你的序列 / 反序列化算法执行逻辑, 你只需要保证一个二叉树可以被序列化为一个字符串并且将这个字符串反序列化为原始的树结构。 Method signatures and docstrings: - def serialize(self, root): Enco...
dae77e21032ea5a59b9942f8a37e8c14566b5224
<|skeleton|> class Codec: """序列化是将一个数据结构或者对象转换为连续的比特位的操作,进而可以将转换后的数据存储在一个文件或者内存中, 同时也可以通过网络传输到另一个计算机环境,采取相反方式重构得到原数据。 请设计一个算法来实现二叉树的序列化与反序列化。这里不限定你的序列 / 反序列化算法执行逻辑, 你只需要保证一个二叉树可以被序列化为一个字符串并且将这个字符串反序列化为原始的树结构。""" def serialize(self, root): """Encodes a tree to a single string. 前序遍历,用None顶替空节点 :type root...
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. 前序遍历,用None顶替空节点 :type root: TreeNode :r...
the_stack_v2_python_sparse
297. 二叉树的序列化与反序列化
jony0113/leetcode
train
0
6275dc5b3e69f32e1dd2d05bc0fdcab58853f841
[ "if _dict[key] is not None and len(_dict[key]) != 0:\n if _dict[key][0] is not None:\n _dict[key] = ' '.join(_dict[key])\n _dict[key] += insert\nreturn _dict", "josa = [j1]\nfor i in range(len(list_) - 1):\n if list_[i] is not None and list_[i + 1] is not None:\n if list_[i] == list_[i ...
<|body_start_0|> if _dict[key] is not None and len(_dict[key]) != 0: if _dict[key][0] is not None: _dict[key] = ' '.join(_dict[key]) _dict[key] += insert return _dict <|end_body_0|> <|body_start_1|> josa = [j1] for i in range(len(list_) - 1): ...
BaseEditor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseEditor: def join_dict(self, _dict: dict, key: str, insert: str='') -> dict: """딕셔너리의 value 값 리스트에 담긴 string들을 join합니다. before : dict = { 'key' : ['val1', 'val2', 'val3'] } after : dict = { 'key' : 'val1 val2 val3' + insert } :param _dict: 딕셔너리 :param key: 키값 :param insert: 추가로 삽입할 말 ...
stack_v2_sparse_classes_75kplus_train_070850
1,754
permissive
[ { "docstring": "딕셔너리의 value 값 리스트에 담긴 string들을 join합니다. before : dict = { 'key' : ['val1', 'val2', 'val3'] } after : dict = { 'key' : 'val1 val2 val3' + insert } :param _dict: 딕셔너리 :param key: 키값 :param insert: 추가로 삽입할 말 :return: 수정된 딕셔너리", "name": "join_dict", "signature": "def join_dict(self, _dict: d...
2
stack_v2_sparse_classes_30k_train_046945
Implement the Python class `BaseEditor` described below. Class description: Implement the BaseEditor class. Method signatures and docstrings: - def join_dict(self, _dict: dict, key: str, insert: str='') -> dict: 딕셔너리의 value 값 리스트에 담긴 string들을 join합니다. before : dict = { 'key' : ['val1', 'val2', 'val3'] } after : dict ...
Implement the Python class `BaseEditor` described below. Class description: Implement the BaseEditor class. Method signatures and docstrings: - def join_dict(self, _dict: dict, key: str, insert: str='') -> dict: 딕셔너리의 value 값 리스트에 담긴 string들을 join합니다. before : dict = { 'key' : ['val1', 'val2', 'val3'] } after : dict ...
544857e4ac1c71b18f1e44f11f7ab41766e75de8
<|skeleton|> class BaseEditor: def join_dict(self, _dict: dict, key: str, insert: str='') -> dict: """딕셔너리의 value 값 리스트에 담긴 string들을 join합니다. before : dict = { 'key' : ['val1', 'val2', 'val3'] } after : dict = { 'key' : 'val1 val2 val3' + insert } :param _dict: 딕셔너리 :param key: 키값 :param insert: 추가로 삽입할 말 ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BaseEditor: def join_dict(self, _dict: dict, key: str, insert: str='') -> dict: """딕셔너리의 value 값 리스트에 담긴 string들을 join합니다. before : dict = { 'key' : ['val1', 'val2', 'val3'] } after : dict = { 'key' : 'val1 val2 val3' + insert } :param _dict: 딕셔너리 :param key: 키값 :param insert: 추가로 삽입할 말 :return: 수정된 딕...
the_stack_v2_python_sparse
kocrawl/editor/base_editor.py
vicjung/kocrawl
train
0
0d6258b345e401a85be48827f221395fdb052aa8
[ "credentials = super().validate(attrs)\nfunc = getattr(self, credentials.get('way'))\nfunc(**credentials)\nreturn attrs", "try:\n User.objects.get(email=kwargs.pop('email'))\nexcept User.DoesNotExist:\n raise serializers.ValidationError('邮箱不存在')", "try:\n Consumer.consumer_.get(phone=kwargs.pop('phone'...
<|body_start_0|> credentials = super().validate(attrs) func = getattr(self, credentials.get('way')) func(**credentials) return attrs <|end_body_0|> <|body_start_1|> try: User.objects.get(email=kwargs.pop('email')) except User.DoesNotExist: raise s...
找回密码序列化器
RetrieveCodeSerializer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RetrieveCodeSerializer: """找回密码序列化器""" def validate(self, attrs): """在基类验证函数基础在进一步验证""" <|body_0|> def email(self, **kwargs): """验证邮箱""" <|body_1|> def phone(self, **kwargs): """验证手机""" <|body_2|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_070851
2,670
permissive
[ { "docstring": "在基类验证函数基础在进一步验证", "name": "validate", "signature": "def validate(self, attrs)" }, { "docstring": "验证邮箱", "name": "email", "signature": "def email(self, **kwargs)" }, { "docstring": "验证手机", "name": "phone", "signature": "def phone(self, **kwargs)" } ]
3
stack_v2_sparse_classes_30k_train_049514
Implement the Python class `RetrieveCodeSerializer` described below. Class description: 找回密码序列化器 Method signatures and docstrings: - def validate(self, attrs): 在基类验证函数基础在进一步验证 - def email(self, **kwargs): 验证邮箱 - def phone(self, **kwargs): 验证手机
Implement the Python class `RetrieveCodeSerializer` described below. Class description: 找回密码序列化器 Method signatures and docstrings: - def validate(self, attrs): 在基类验证函数基础在进一步验证 - def email(self, **kwargs): 验证邮箱 - def phone(self, **kwargs): 验证手机 <|skeleton|> class RetrieveCodeSerializer: """找回密码序列化器""" def va...
13cb59130d15e782f78bc5148409bef0f1c516e0
<|skeleton|> class RetrieveCodeSerializer: """找回密码序列化器""" def validate(self, attrs): """在基类验证函数基础在进一步验证""" <|body_0|> def email(self, **kwargs): """验证邮箱""" <|body_1|> def phone(self, **kwargs): """验证手机""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RetrieveCodeSerializer: """找回密码序列化器""" def validate(self, attrs): """在基类验证函数基础在进一步验证""" credentials = super().validate(attrs) func = getattr(self, credentials.get('way')) func(**credentials) return attrs def email(self, **kwargs): """验证邮箱""" tr...
the_stack_v2_python_sparse
user_app/serializers/verification_serializers.py
lmyfzx/Django-Mall
train
0
8d3034a2b3f3220e65a039febf1d1b72aede189a
[ "self.logger = logging.getLogger(type(self).__name__)\nself._mysql_helper = MySQLHelper(houisng_price_db_connection)\nself._table_name = table_name", "sql = 'SELECT date_time, city, avg(value) FROM {table_name} WHERE date_time<=%(date_end)s AND date_time>=%(date_begin)s AND city=%(city_name)s GROUP BY date_time, ...
<|body_start_0|> self.logger = logging.getLogger(type(self).__name__) self._mysql_helper = MySQLHelper(houisng_price_db_connection) self._table_name = table_name <|end_body_0|> <|body_start_1|> sql = 'SELECT date_time, city, avg(value) FROM {table_name} WHERE date_time<=%(date_end)s AND...
The dao layer for houisng price in Mysql
HousingPriceMysqlDao
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HousingPriceMysqlDao: """The dao layer for houisng price in Mysql""" def __init__(self, table_name): """:param table_name:""" <|body_0|> def get_city_housing_price(self, date_end, date_begin, city_name): """get the sql result by date_time and city_name :param dat...
stack_v2_sparse_classes_75kplus_train_070852
4,712
no_license
[ { "docstring": ":param table_name:", "name": "__init__", "signature": "def __init__(self, table_name)" }, { "docstring": "get the sql result by date_time and city_name :param date_end: :param date_begin: :param city_name: :return:", "name": "get_city_housing_price", "signature": "def get...
5
stack_v2_sparse_classes_30k_train_002798
Implement the Python class `HousingPriceMysqlDao` described below. Class description: The dao layer for houisng price in Mysql Method signatures and docstrings: - def __init__(self, table_name): :param table_name: - def get_city_housing_price(self, date_end, date_begin, city_name): get the sql result by date_time and...
Implement the Python class `HousingPriceMysqlDao` described below. Class description: The dao layer for houisng price in Mysql Method signatures and docstrings: - def __init__(self, table_name): :param table_name: - def get_city_housing_price(self, date_end, date_begin, city_name): get the sql result by date_time and...
281640594cc5f6161c7d5e1f93b0dc2c23ea8b4e
<|skeleton|> class HousingPriceMysqlDao: """The dao layer for houisng price in Mysql""" def __init__(self, table_name): """:param table_name:""" <|body_0|> def get_city_housing_price(self, date_end, date_begin, city_name): """get the sql result by date_time and city_name :param dat...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class HousingPriceMysqlDao: """The dao layer for houisng price in Mysql""" def __init__(self, table_name): """:param table_name:""" self.logger = logging.getLogger(type(self).__name__) self._mysql_helper = MySQLHelper(houisng_price_db_connection) self._table_name = table_name ...
the_stack_v2_python_sparse
dao/mysql/housing_price_mysql.py
mqsee/data_monitor
train
0
2d7cfcb4b22e3b76139aa2e15e6782f478d2556f
[ "if port is None:\n port = 8080\nself._redirect_uri = REDIRECT_URI.format(port if port else 8080)\nself._auth_url = fn_opts.get('auth_url')\nself._token_url = fn_opts.get('token_url')\nself._client_id = fn_opts.get('client_id')\nself._client_secret = fn_opts.get('client_secret')\nself._refresh_token = fn_opts.ge...
<|body_start_0|> if port is None: port = 8080 self._redirect_uri = REDIRECT_URI.format(port if port else 8080) self._auth_url = fn_opts.get('auth_url') self._token_url = fn_opts.get('token_url') self._client_id = fn_opts.get('client_id') self._client_secret = ...
Class Responsible for handling OAuth2 authorization/authentication.
OAuth2Flow
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OAuth2Flow: """Class Responsible for handling OAuth2 authorization/authentication.""" def __init__(self, fn_opts, crsf_token=None, port=None): """:param fn_opts: The app.config values for the app.(str) :param crsf_token: Secret used in requests to make request more secure.(str)""" ...
stack_v2_sparse_classes_75kplus_train_070853
5,128
permissive
[ { "docstring": ":param fn_opts: The app.config values for the app.(str) :param crsf_token: Secret used in requests to make request more secure.(str)", "name": "__init__", "signature": "def __init__(self, fn_opts, crsf_token=None, port=None)" }, { "docstring": "Get the OAuth2 authorization url fo...
5
stack_v2_sparse_classes_30k_train_025292
Implement the Python class `OAuth2Flow` described below. Class description: Class Responsible for handling OAuth2 authorization/authentication. Method signatures and docstrings: - def __init__(self, fn_opts, crsf_token=None, port=None): :param fn_opts: The app.config values for the app.(str) :param crsf_token: Secret...
Implement the Python class `OAuth2Flow` described below. Class description: Class Responsible for handling OAuth2 authorization/authentication. Method signatures and docstrings: - def __init__(self, fn_opts, crsf_token=None, port=None): :param fn_opts: The app.config values for the app.(str) :param crsf_token: Secret...
6878c78b94eeca407998a41ce8db2cc00f2b6758
<|skeleton|> class OAuth2Flow: """Class Responsible for handling OAuth2 authorization/authentication.""" def __init__(self, fn_opts, crsf_token=None, port=None): """:param fn_opts: The app.config values for the app.(str) :param crsf_token: Secret used in requests to make request more secure.(str)""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class OAuth2Flow: """Class Responsible for handling OAuth2 authorization/authentication.""" def __init__(self, fn_opts, crsf_token=None, port=None): """:param fn_opts: The app.config values for the app.(str) :param crsf_token: Secret used in requests to make request more secure.(str)""" if port...
the_stack_v2_python_sparse
oauth-utils/oauth_utils/lib/oauth2flow.py
ibmresilient/resilient-community-apps
train
81
2bd6a5b6804b37d8349b5cf1512d564ac77dcf6d
[ "super(BcombCombiner, self).__init__(prob_estimators=prob_estimators, verbose=verbose)\nself.k = k\nself.s = s\nself.beta = beta\nself.bcomb_prior_log_prob = None\nself.prev_word2id = {}", "if self.bcomb_prior_log_prob is None or self.prev_word2id != word2id:\n self.bcomb_prior_log_prob = self.get_prior_log_pr...
<|body_start_0|> super(BcombCombiner, self).__init__(prob_estimators=prob_estimators, verbose=verbose) self.k = k self.s = s self.beta = beta self.bcomb_prior_log_prob = None self.prev_word2id = {} <|end_body_0|> <|body_start_1|> if self.bcomb_prior_log_prob is N...
BcombCombiner
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BcombCombiner: def __init__(self, prob_estimators: List[BaseProbEstimator], k: float=4.0, s: float=1.05, beta: float=0.0, verbose: bool=False): """Combines models predictions with the log-probs that comes from embedding similarity scores according to the formula :math:`P(w|C, T) \\propto...
stack_v2_sparse_classes_75kplus_train_070854
12,750
permissive
[ { "docstring": "Combines models predictions with the log-probs that comes from embedding similarity scores according to the formula :math:`P(w|C, T) \\\\propto \\\\displaystyle \\\\frac{P(w|C)P(w|T)}{P(w)^\\\\beta}`, where :math:`\\\\beta` -- is a parameter controlling how we penalize frequent words and :math:`...
4
stack_v2_sparse_classes_30k_val_002739
Implement the Python class `BcombCombiner` described below. Class description: Implement the BcombCombiner class. Method signatures and docstrings: - def __init__(self, prob_estimators: List[BaseProbEstimator], k: float=4.0, s: float=1.05, beta: float=0.0, verbose: bool=False): Combines models predictions with the lo...
Implement the Python class `BcombCombiner` described below. Class description: Implement the BcombCombiner class. Method signatures and docstrings: - def __init__(self, prob_estimators: List[BaseProbEstimator], k: float=4.0, s: float=1.05, beta: float=0.0, verbose: bool=False): Combines models predictions with the lo...
c87f67e5fe51fc8307b5d5ff8f404f202f17ab5e
<|skeleton|> class BcombCombiner: def __init__(self, prob_estimators: List[BaseProbEstimator], k: float=4.0, s: float=1.05, beta: float=0.0, verbose: bool=False): """Combines models predictions with the log-probs that comes from embedding similarity scores according to the formula :math:`P(w|C, T) \\propto...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BcombCombiner: def __init__(self, prob_estimators: List[BaseProbEstimator], k: float=4.0, s: float=1.05, beta: float=0.0, verbose: bool=False): """Combines models predictions with the log-probs that comes from embedding similarity scores according to the formula :math:`P(w|C, T) \\propto \\displaystyl...
the_stack_v2_python_sparse
lexsubgen/prob_estimators/combiner.py
agoel00/LexSubGen
train
0
104dc9cb531b21dd63016f1d021dfc242b2ae043
[ "self.imageDim = imageDim\nself.imageWidth = imageDim.width\nself.imageHeight = imageDim.height\nself.xstepSize = xstepSize\nself.ystepSize = ystepSize\nself.patchSizeWidth = patchDim.width\nself.patchSizeHeight = patchDim.height\nself.cachedBoundingBoxes = {}\nself.cachedPixelMaps = {}", "if scaleFactor in self....
<|body_start_0|> self.imageDim = imageDim self.imageWidth = imageDim.width self.imageHeight = imageDim.height self.xstepSize = xstepSize self.ystepSize = ystepSize self.patchSizeWidth = patchDim.width self.patchSizeHeight = patchDim.height self.cachedBound...
BoundingBoxes
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BoundingBoxes: def __init__(self, imageDim, xstepSize, ystepSize, patchDim): """Initialize bounding box base sizes""" <|body_0|> def getBoundingBoxes(self, scaleFactor): """Get different bounding boxes at given scaleFactor""" <|body_1|> def pixelMapToRem...
stack_v2_sparse_classes_75kplus_train_070855
3,448
no_license
[ { "docstring": "Initialize bounding box base sizes", "name": "__init__", "signature": "def __init__(self, imageDim, xstepSize, ystepSize, patchDim)" }, { "docstring": "Get different bounding boxes at given scaleFactor", "name": "getBoundingBoxes", "signature": "def getBoundingBoxes(self,...
3
stack_v2_sparse_classes_30k_train_045523
Implement the Python class `BoundingBoxes` described below. Class description: Implement the BoundingBoxes class. Method signatures and docstrings: - def __init__(self, imageDim, xstepSize, ystepSize, patchDim): Initialize bounding box base sizes - def getBoundingBoxes(self, scaleFactor): Get different bounding boxes...
Implement the Python class `BoundingBoxes` described below. Class description: Implement the BoundingBoxes class. Method signatures and docstrings: - def __init__(self, imageDim, xstepSize, ystepSize, patchDim): Initialize bounding box base sizes - def getBoundingBoxes(self, scaleFactor): Get different bounding boxes...
b0bcfc0b753215bf56a437b8caf0faf48ed72ee4
<|skeleton|> class BoundingBoxes: def __init__(self, imageDim, xstepSize, ystepSize, patchDim): """Initialize bounding box base sizes""" <|body_0|> def getBoundingBoxes(self, scaleFactor): """Get different bounding boxes at given scaleFactor""" <|body_1|> def pixelMapToRem...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BoundingBoxes: def __init__(self, imageDim, xstepSize, ystepSize, patchDim): """Initialize bounding box base sizes""" self.imageDim = imageDim self.imageWidth = imageDim.width self.imageHeight = imageDim.height self.xstepSize = xstepSize self.ystepSize = ystepSi...
the_stack_v2_python_sparse
Logo/PipelineMath/BoundingBoxes.py
zigvu/khajuri
train
0
8c27c5d2120a807c67819de7ea6cbfcd48e4ecf6
[ "where = kwargs.get('where', '{}')\nwhere = json.loads(where)\nreturn CityInfo(where=where)", "city = kwargs.get('city', '')\ntype = kwargs.get('type', '')\nreturn City(city=city, type=type)" ]
<|body_start_0|> where = kwargs.get('where', '{}') where = json.loads(where) return CityInfo(where=where) <|end_body_0|> <|body_start_1|> city = kwargs.get('city', '') type = kwargs.get('type', '') return City(city=city, type=type) <|end_body_1|>
CityConfigService
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CityConfigService: def get_cityinfo(self, **kwargs): """城市详细信息服务 :param kwargs: @where string 筛选条件 (缓存key) name: 模糊查询 id: [] sell_db: 1(旧), 2(新) rent_db: 1(旧), 2(新) city_level: 1,2,3,4,5,6 is_b: True is_sell: True is_apartment: True is_newhouse: True is_rent: True :return:""" <|b...
stack_v2_sparse_classes_75kplus_train_070856
2,364
no_license
[ { "docstring": "城市详细信息服务 :param kwargs: @where string 筛选条件 (缓存key) name: 模糊查询 id: [] sell_db: 1(旧), 2(新) rent_db: 1(旧), 2(新) city_level: 1,2,3,4,5,6 is_b: True is_sell: True is_apartment: True is_newhouse: True is_rent: True :return:", "name": "get_cityinfo", "signature": "def get_cityinfo(self, **kwarg...
2
stack_v2_sparse_classes_30k_train_041515
Implement the Python class `CityConfigService` described below. Class description: Implement the CityConfigService class. Method signatures and docstrings: - def get_cityinfo(self, **kwargs): 城市详细信息服务 :param kwargs: @where string 筛选条件 (缓存key) name: 模糊查询 id: [] sell_db: 1(旧), 2(新) rent_db: 1(旧), 2(新) city_level: 1,2,3...
Implement the Python class `CityConfigService` described below. Class description: Implement the CityConfigService class. Method signatures and docstrings: - def get_cityinfo(self, **kwargs): 城市详细信息服务 :param kwargs: @where string 筛选条件 (缓存key) name: 模糊查询 id: [] sell_db: 1(旧), 2(新) rent_db: 1(旧), 2(新) city_level: 1,2,3...
7c145c2eff0d4b8efb2b106de29a8c1e89d7a7fd
<|skeleton|> class CityConfigService: def get_cityinfo(self, **kwargs): """城市详细信息服务 :param kwargs: @where string 筛选条件 (缓存key) name: 模糊查询 id: [] sell_db: 1(旧), 2(新) rent_db: 1(旧), 2(新) city_level: 1,2,3,4,5,6 is_b: True is_sell: True is_apartment: True is_newhouse: True is_rent: True :return:""" <|b...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CityConfigService: def get_cityinfo(self, **kwargs): """城市详细信息服务 :param kwargs: @where string 筛选条件 (缓存key) name: 模糊查询 id: [] sell_db: 1(旧), 2(新) rent_db: 1(旧), 2(新) city_level: 1,2,3,4,5,6 is_b: True is_sell: True is_apartment: True is_newhouse: True is_rent: True :return:""" where = kwargs.ge...
the_stack_v2_python_sparse
zhuge/apps/config/CityConfig.py
wlyehbd/common
train
0
1b17b27932453f6a43c6c11535d26cec86bd8c68
[ "left = [5, 6, 7, 11, 12, 13, 15, 17]\nright = [2, 3, 4, 8, 9, 10, 14, 16]\nlr = left + right\nrl = right + left\npoints2d = person.points2d.copy()\npoints2d[lr] = points2d[rl]\nnew_person = Person2d(person.cid, person.cam, points2d)\nreturn new_person", "self.cid = cid\nself.cam = cam\nself.believe = get_believe...
<|body_start_0|> left = [5, 6, 7, 11, 12, 13, 15, 17] right = [2, 3, 4, 8, 9, 10, 14, 16] lr = left + right rl = right + left points2d = person.points2d.copy() points2d[lr] = points2d[rl] new_person = Person2d(person.cid, person.cam, points2d) return new_p...
Person2d
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Person2d: def flip_lr(person): """creates a new person with left and right flipped :param person: {Person2d} :return:""" <|body_0|> def __init__(self, cid, cam, points2d, noundistort=False): """:param cid :param cam: {Camera} :param points2d: distorted points :param ...
stack_v2_sparse_classes_75kplus_train_070857
11,074
permissive
[ { "docstring": "creates a new person with left and right flipped :param person: {Person2d} :return:", "name": "flip_lr", "signature": "def flip_lr(person)" }, { "docstring": ":param cid :param cam: {Camera} :param points2d: distorted points :param noundistort: if True do not undistort", "nam...
3
stack_v2_sparse_classes_30k_train_030497
Implement the Python class `Person2d` described below. Class description: Implement the Person2d class. Method signatures and docstrings: - def flip_lr(person): creates a new person with left and right flipped :param person: {Person2d} :return: - def __init__(self, cid, cam, points2d, noundistort=False): :param cid :...
Implement the Python class `Person2d` described below. Class description: Implement the Person2d class. Method signatures and docstrings: - def flip_lr(person): creates a new person with left and right flipped :param person: {Person2d} :return: - def __init__(self, cid, cam, points2d, noundistort=False): :param cid :...
33eb107490e17d51301d6b22e4f5b93ab6a11cf3
<|skeleton|> class Person2d: def flip_lr(person): """creates a new person with left and right flipped :param person: {Person2d} :return:""" <|body_0|> def __init__(self, cid, cam, points2d, noundistort=False): """:param cid :param cam: {Camera} :param points2d: distorted points :param ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Person2d: def flip_lr(person): """creates a new person with left and right flipped :param person: {Person2d} :return:""" left = [5, 6, 7, 11, 12, 13, 15, 17] right = [2, 3, 4, 8, 9, 10, 14, 16] lr = left + right rl = right + left points2d = person.points2d.copy(...
the_stack_v2_python_sparse
mvpose/baseline/hypothesis.py
jutanke/mvpose
train
4
0693e07f1d656d3ee5221afb92fab3bf92dc6a61
[ "if isinstance(exception, (exceptions.NotAuthorized, exceptions.NotAuthenticated)):\n response = http.HttpResponseRedirect(settings.LOGOUT_URL)\n msg = 'Session expired'\n LOG.debug(msg + 'for user %s', request.user.id)\n utils.add_logout_reason(request, response, msg)\n response.set_cookie('logout_r...
<|body_start_0|> if isinstance(exception, (exceptions.NotAuthorized, exceptions.NotAuthenticated)): response = http.HttpResponseRedirect(settings.LOGOUT_URL) msg = 'Session expired' LOG.debug(msg + 'for user %s', request.user.id) utils.add_logout_reason(request, r...
Redirect to logout instead of login when user is not authenticated, to make sure that session cookie is deleted. Also redirect to login using get_full_path() instead of path only.
CustomHorizonMiddleware
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CustomHorizonMiddleware: """Redirect to logout instead of login when user is not authenticated, to make sure that session cookie is deleted. Also redirect to login using get_full_path() instead of path only.""" def process_exception(self, request, exception): """Catches internal Hori...
stack_v2_sparse_classes_75kplus_train_070858
10,523
permissive
[ { "docstring": "Catches internal Horizon exception classes such as NotAuthorized, NotFound and Http302 and handles them gracefully.", "name": "process_exception", "signature": "def process_exception(self, request, exception)" }, { "docstring": "Adds data necessary for Horizon to function to the ...
2
null
Implement the Python class `CustomHorizonMiddleware` described below. Class description: Redirect to logout instead of login when user is not authenticated, to make sure that session cookie is deleted. Also redirect to login using get_full_path() instead of path only. Method signatures and docstrings: - def process_e...
Implement the Python class `CustomHorizonMiddleware` described below. Class description: Redirect to logout instead of login when user is not authenticated, to make sure that session cookie is deleted. Also redirect to login using get_full_path() instead of path only. Method signatures and docstrings: - def process_e...
66aa375ae42af4c4ab7df851f45b8e90ece9e7b1
<|skeleton|> class CustomHorizonMiddleware: """Redirect to logout instead of login when user is not authenticated, to make sure that session cookie is deleted. Also redirect to login using get_full_path() instead of path only.""" def process_exception(self, request, exception): """Catches internal Hori...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CustomHorizonMiddleware: """Redirect to logout instead of login when user is not authenticated, to make sure that session cookie is deleted. Also redirect to login using get_full_path() instead of path only.""" def process_exception(self, request, exception): """Catches internal Horizon exception...
the_stack_v2_python_sparse
openstack_dashboard/fiware_middleware/middleware.py
ging/horizon
train
6
d04995e55c2d6125504097bc090dfbdf42994686
[ "super().__init__()\nself.confidence = 1.0 - smoothing\nself.smoothing = smoothing\nself.cls = num_classes\nself.dim = dim", "assert 0 <= self.smoothing < 1\npred = pred.log_softmax(dim=self.dim)\nwith torch.no_grad():\n true_dist = torch.zeros_like(pred)\n true_dist.fill_(self.smoothing / (self.cls - 1))\n...
<|body_start_0|> super().__init__() self.confidence = 1.0 - smoothing self.smoothing = smoothing self.cls = num_classes self.dim = dim <|end_body_0|> <|body_start_1|> assert 0 <= self.smoothing < 1 pred = pred.log_softmax(dim=self.dim) with torch.no_grad(...
Cross Entropy with Label Smoothing. Attributes: num_classes (int): Number of target classes. smoothing (float, optional): Smoothing fraction constant, in the range (0.0, 1.0). Defaults to 0.1. dim (int, optional): Dimension across which to apply loss. Defaults to -1.
LabelSmoothingLoss
[ "GPL-1.0-or-later", "MIT", "Apache-2.0", "BSD-2-Clause", "BSD-3-Clause", "LicenseRef-scancode-generic-cla", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LabelSmoothingLoss: """Cross Entropy with Label Smoothing. Attributes: num_classes (int): Number of target classes. smoothing (float, optional): Smoothing fraction constant, in the range (0.0, 1.0). Defaults to 0.1. dim (int, optional): Dimension across which to apply loss. Defaults to -1.""" ...
stack_v2_sparse_classes_75kplus_train_070859
3,691
permissive
[ { "docstring": "Initializer for LabelSmoothingLoss. Args: num_classes (int): Number of target classes. smoothing (float, optional): Smoothing fraction constant, in the range (0.0, 1.0). Defaults to 0.1. dim (int, optional): Dimension across which to apply loss. Defaults to -1.", "name": "__init__", "sig...
2
stack_v2_sparse_classes_30k_train_016492
Implement the Python class `LabelSmoothingLoss` described below. Class description: Cross Entropy with Label Smoothing. Attributes: num_classes (int): Number of target classes. smoothing (float, optional): Smoothing fraction constant, in the range (0.0, 1.0). Defaults to 0.1. dim (int, optional): Dimension across whic...
Implement the Python class `LabelSmoothingLoss` described below. Class description: Cross Entropy with Label Smoothing. Attributes: num_classes (int): Number of target classes. smoothing (float, optional): Smoothing fraction constant, in the range (0.0, 1.0). Defaults to 0.1. dim (int, optional): Dimension across whic...
92acc188d3a0f634de58463b6676e70df83ef808
<|skeleton|> class LabelSmoothingLoss: """Cross Entropy with Label Smoothing. Attributes: num_classes (int): Number of target classes. smoothing (float, optional): Smoothing fraction constant, in the range (0.0, 1.0). Defaults to 0.1. dim (int, optional): Dimension across which to apply loss. Defaults to -1.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LabelSmoothingLoss: """Cross Entropy with Label Smoothing. Attributes: num_classes (int): Number of target classes. smoothing (float, optional): Smoothing fraction constant, in the range (0.0, 1.0). Defaults to 0.1. dim (int, optional): Dimension across which to apply loss. Defaults to -1.""" def __init_...
the_stack_v2_python_sparse
PyTorch/dev/cv/image_classification/Keyword-MLP_ID2441_for_PyTorch/utils/loss.py
Ascend/ModelZoo-PyTorch
train
23
0fde82fa51f2463647eb054116d6946d9ab79cf5
[ "reviews = list()\nresp = req.get(banks_url + '/banks/top/')\nsoup = BeautifulSoup(resp.text, 'lxml')\ntop_20_banks = soup.find_all('tr')[3:23]\nfor bank in top_20_banks:\n link = str(bank.find('a')).split('\"')[1]\n reviews.append(banks_url + link + page)\nreturn reviews", "print('Собираем позитивные и нег...
<|body_start_0|> reviews = list() resp = req.get(banks_url + '/banks/top/') soup = BeautifulSoup(resp.text, 'lxml') top_20_banks = soup.find_all('tr')[3:23] for bank in top_20_banks: link = str(bank.find('a')).split('"')[1] reviews.append(banks_url + link ...
Parsing positive, negative comments, hotlines from minfin.com.ua and positive comments from about.pumb.ua
ReviewsURLScraper
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReviewsURLScraper: """Parsing positive, negative comments, hotlines from minfin.com.ua and positive comments from about.pumb.ua""" def get_reviews_url(banks_url=None, page=None): """Get list of top 20 banks list from minfin.com.ua :param banks_url: link of main page :param page: stri...
stack_v2_sparse_classes_75kplus_train_070860
3,394
no_license
[ { "docstring": "Get list of top 20 banks list from minfin.com.ua :param banks_url: link of main page :param page: string :return: list of banks links", "name": "get_reviews_url", "signature": "def get_reviews_url(banks_url=None, page=None)" }, { "docstring": "Parsing list of positive and negativ...
4
stack_v2_sparse_classes_30k_train_014076
Implement the Python class `ReviewsURLScraper` described below. Class description: Parsing positive, negative comments, hotlines from minfin.com.ua and positive comments from about.pumb.ua Method signatures and docstrings: - def get_reviews_url(banks_url=None, page=None): Get list of top 20 banks list from minfin.com...
Implement the Python class `ReviewsURLScraper` described below. Class description: Parsing positive, negative comments, hotlines from minfin.com.ua and positive comments from about.pumb.ua Method signatures and docstrings: - def get_reviews_url(banks_url=None, page=None): Get list of top 20 banks list from minfin.com...
46e29554dc6433f608baa6132edd5ce89ef8d942
<|skeleton|> class ReviewsURLScraper: """Parsing positive, negative comments, hotlines from minfin.com.ua and positive comments from about.pumb.ua""" def get_reviews_url(banks_url=None, page=None): """Get list of top 20 banks list from minfin.com.ua :param banks_url: link of main page :param page: stri...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ReviewsURLScraper: """Parsing positive, negative comments, hotlines from minfin.com.ua and positive comments from about.pumb.ua""" def get_reviews_url(banks_url=None, page=None): """Get list of top 20 banks list from minfin.com.ua :param banks_url: link of main page :param page: string :return: l...
the_stack_v2_python_sparse
parser/pos_and_neg.py
YuliaChornenko/model-classification
train
0
43f93369b333b14b7c69602864ba8bb91977a010
[ "sql = ' '.join(['SELECT id, cat_id, question, options, answer', 'FROM quiz WHERE', placeholder_update(['id'])])\ncur = self.get_cursor()\nrow = cur.execute(sql, [id]).fetchone() or []\nreturn row", "sql = 'SELECT id, cat_id, question, options, answer FROM quiz'\ncur = self.get_cursor()\nrow = cur.execute(sql).fe...
<|body_start_0|> sql = ' '.join(['SELECT id, cat_id, question, options, answer', 'FROM quiz WHERE', placeholder_update(['id'])]) cur = self.get_cursor() row = cur.execute(sql, [id]).fetchone() or [] return row <|end_body_0|> <|body_start_1|> sql = 'SELECT id, cat_id, question, o...
>>> row = read().one(id: int) -> sqlite3.Row >>> print(row['id'], row['cat_id'], row['question'], row['options'], row['answer']) Returns a sqlite3.Row passing an integer ID >>> rows = read().all() -> list >>> for row in rows: >>> print(row['id'], row['cat_id'], row['question'], row['options'], row['answer']) Returns a ...
read
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class read: """>>> row = read().one(id: int) -> sqlite3.Row >>> print(row['id'], row['cat_id'], row['question'], row['options'], row['answer']) Returns a sqlite3.Row passing an integer ID >>> rows = read().all() -> list >>> for row in rows: >>> print(row['id'], row['cat_id'], row['question'], row['opti...
stack_v2_sparse_classes_75kplus_train_070861
3,504
no_license
[ { "docstring": ">>> row = read().one(id: int) -> sqlite3.Row >>> print(row['id'], row['cat_id'], row['question'], row['options'], row['answer']) Returns a sqlite3.Row passing an integer ID", "name": "one", "signature": "def one(self, id)" }, { "docstring": ">>> rows = read().all() -> list >>> fo...
2
null
Implement the Python class `read` described below. Class description: >>> row = read().one(id: int) -> sqlite3.Row >>> print(row['id'], row['cat_id'], row['question'], row['options'], row['answer']) Returns a sqlite3.Row passing an integer ID >>> rows = read().all() -> list >>> for row in rows: >>> print(row['id'], ro...
Implement the Python class `read` described below. Class description: >>> row = read().one(id: int) -> sqlite3.Row >>> print(row['id'], row['cat_id'], row['question'], row['options'], row['answer']) Returns a sqlite3.Row passing an integer ID >>> rows = read().all() -> list >>> for row in rows: >>> print(row['id'], ro...
b4ee681837add64b039afda3dfc286995199288a
<|skeleton|> class read: """>>> row = read().one(id: int) -> sqlite3.Row >>> print(row['id'], row['cat_id'], row['question'], row['options'], row['answer']) Returns a sqlite3.Row passing an integer ID >>> rows = read().all() -> list >>> for row in rows: >>> print(row['id'], row['cat_id'], row['question'], row['opti...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class read: """>>> row = read().one(id: int) -> sqlite3.Row >>> print(row['id'], row['cat_id'], row['question'], row['options'], row['answer']) Returns a sqlite3.Row passing an integer ID >>> rows = read().all() -> list >>> for row in rows: >>> print(row['id'], row['cat_id'], row['question'], row['options'], row['a...
the_stack_v2_python_sparse
src/models/quiz.py
Otumian-empire/py-quiz
train
0
d5d1e963093b4086cf4517ac939fecbd29695909
[ "startTime = datetime.datetime.now()\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('alanbur_aquan_erj826_jcaluag', 'alanbur_aquan_erj826_jcaluag')\ncollection = repo.alanbur_aquan_erj826_jcaluag.SFaccidents\nrepo.dropCollection('alanbur_aquan_erj826_jcaluag.timeAggregateSF')\nrepo.creat...
<|body_start_0|> startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('alanbur_aquan_erj826_jcaluag', 'alanbur_aquan_erj826_jcaluag') collection = repo.alanbur_aquan_erj826_jcaluag.SFaccidents repo.dropCollection('ala...
timeAggregateSF
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class timeAggregateSF: def execute(trial=False): """Retrieve crime incident report information from Boston.""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing everything happening in this ...
stack_v2_sparse_classes_75kplus_train_070862
3,791
no_license
[ { "docstring": "Retrieve crime incident report information from Boston.", "name": "execute", "signature": "def execute(trial=False)" }, { "docstring": "Create the provenance document describing everything happening in this script. Each run of the script will generate a new document describing th...
2
stack_v2_sparse_classes_30k_train_020174
Implement the Python class `timeAggregateSF` described below. Class description: Implement the timeAggregateSF class. Method signatures and docstrings: - def execute(trial=False): Retrieve crime incident report information from Boston. - def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): Cre...
Implement the Python class `timeAggregateSF` described below. Class description: Implement the timeAggregateSF class. Method signatures and docstrings: - def execute(trial=False): Retrieve crime incident report information from Boston. - def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): Cre...
97e72731ffadbeae57d7a332decd58706e7c08de
<|skeleton|> class timeAggregateSF: def execute(trial=False): """Retrieve crime incident report information from Boston.""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing everything happening in this ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class timeAggregateSF: def execute(trial=False): """Retrieve crime incident report information from Boston.""" startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('alanbur_aquan_erj826_jcaluag', 'alanbur_aquan_erj826_jca...
the_stack_v2_python_sparse
alanbur_aquan_erj826_jcaluag/timeAggregateSF.py
ROODAY/course-2017-fal-proj
train
3
6569928ec365d308428cee7f38552d188ac905ad
[ "wx.ListCtrl.__init__(self, parent, id, pos, size, style, name=name)\nself.SetUpFilter(filter, only)\nself.Language = select", "lang = self.GetLanguage()\nself.filter, self.only = (filter, only)\nself.icons, self.choices, self.langs = CreateLanguagesResourceLists(filter, only)\nself.AssignImageList(self.icons, wx...
<|body_start_0|> wx.ListCtrl.__init__(self, parent, id, pos, size, style, name=name) self.SetUpFilter(filter, only) self.Language = select <|end_body_0|> <|body_start_1|> lang = self.GetLanguage() self.filter, self.only = (filter, only) self.icons, self.choices, self.lan...
:class:`wx.ListCtrl` derived control that displays languages and flags
LanguageListCtrl
[ "MIT", "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LanguageListCtrl: """:class:`wx.ListCtrl` derived control that displays languages and flags""" def __init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.LC_REPORT | wx.LC_NO_HEADER | wx.LC_SINGLE_SEL, filter=LC_AVAILABLE, only=(), select=None, name='langu...
stack_v2_sparse_classes_75kplus_train_070863
15,512
permissive
[ { "docstring": "Default class constructor. :param `parent`: Parent window. Must not be ``None``. :type `parent`: wx.Window :param `id`: Window identifier. The value ``ID_ANY`` indicates a default value. :type `id`: int :param `pos`: Window position. If ``DefaultPosition`` is specified then a default position is...
4
stack_v2_sparse_classes_30k_train_046598
Implement the Python class `LanguageListCtrl` described below. Class description: :class:`wx.ListCtrl` derived control that displays languages and flags Method signatures and docstrings: - def __init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.LC_REPORT | wx.LC_NO_HEADER | wx.L...
Implement the Python class `LanguageListCtrl` described below. Class description: :class:`wx.ListCtrl` derived control that displays languages and flags Method signatures and docstrings: - def __init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.LC_REPORT | wx.LC_NO_HEADER | wx.L...
c21d9abf56e1756fa8073ccc3547ec9a85d83e2a
<|skeleton|> class LanguageListCtrl: """:class:`wx.ListCtrl` derived control that displays languages and flags""" def __init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.LC_REPORT | wx.LC_NO_HEADER | wx.LC_SINGLE_SEL, filter=LC_AVAILABLE, only=(), select=None, name='langu...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LanguageListCtrl: """:class:`wx.ListCtrl` derived control that displays languages and flags""" def __init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.LC_REPORT | wx.LC_NO_HEADER | wx.LC_SINGLE_SEL, filter=LC_AVAILABLE, only=(), select=None, name='languagelistctrl')...
the_stack_v2_python_sparse
venv/Lib/site-packages/wx/lib/langlistctrl.py
saleguas/deskOrg
train
3
0d51a587d0e721efa6423b6fc817f8675729a145
[ "self.objectid = ObjectId()\nself.assertIsNone(self.objectid.Key)\nself.assertEqual(self.objectid.Name, '')\nsetattr(self.objectid, 'Key', 12)\nself.assertEqual(self.objectid.Key, 12)\nsetattr(self.objectid, 'Name', 'what is up')\nself.assertEqual(self.objectid.Name, 'what is up')", "self.objectid = ObjectId('kic...
<|body_start_0|> self.objectid = ObjectId() self.assertIsNone(self.objectid.Key) self.assertEqual(self.objectid.Name, '') setattr(self.objectid, 'Key', 12) self.assertEqual(self.objectid.Key, 12) setattr(self.objectid, 'Name', 'what is up') self.assertEqual(self.o...
ObectIdTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ObectIdTests: def test_epmty_constructor(self): """Автор: Краснов Д.В.""" <|body_0|> def test_filled_constructor_1(self): """Автор: Краснов Д.В.""" <|body_1|> def test_filled_constructor_2(self): """Автор: Краснов Д.В.""" <|body_2|> <|en...
stack_v2_sparse_classes_75kplus_train_070864
20,083
no_license
[ { "docstring": "Автор: Краснов Д.В.", "name": "test_epmty_constructor", "signature": "def test_epmty_constructor(self)" }, { "docstring": "Автор: Краснов Д.В.", "name": "test_filled_constructor_1", "signature": "def test_filled_constructor_1(self)" }, { "docstring": "Автор: Красн...
3
stack_v2_sparse_classes_30k_train_007834
Implement the Python class `ObectIdTests` described below. Class description: Implement the ObectIdTests class. Method signatures and docstrings: - def test_epmty_constructor(self): Автор: Краснов Д.В. - def test_filled_constructor_1(self): Автор: Краснов Д.В. - def test_filled_constructor_2(self): Автор: Краснов Д.В...
Implement the Python class `ObectIdTests` described below. Class description: Implement the ObectIdTests class. Method signatures and docstrings: - def test_epmty_constructor(self): Автор: Краснов Д.В. - def test_filled_constructor_1(self): Автор: Краснов Д.В. - def test_filled_constructor_2(self): Автор: Краснов Д.В...
5559275accbfda0cb75c8c90d79090c10524e815
<|skeleton|> class ObectIdTests: def test_epmty_constructor(self): """Автор: Краснов Д.В.""" <|body_0|> def test_filled_constructor_1(self): """Автор: Краснов Д.В.""" <|body_1|> def test_filled_constructor_2(self): """Автор: Краснов Д.В.""" <|body_2|> <|en...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ObectIdTests: def test_epmty_constructor(self): """Автор: Краснов Д.В.""" self.objectid = ObjectId() self.assertIsNone(self.objectid.Key) self.assertEqual(self.objectid.Name, '') setattr(self.objectid, 'Key', 12) self.assertEqual(self.objectid.Key, 12) s...
the_stack_v2_python_sparse
test_api/other_classes.py
4l1fe/miscellaneous
train
0
5294ee568636c3dc387b2c2f7186d35834ea9a32
[ "serializer_class = NotificationSerializer(data=request.data)\ntry:\n request.data._mutable = True\nexcept AttributeError:\n pass\nif serializer_class.is_valid():\n template_id = NotificationTemplate.objects.get(name__icontains=request.data.get('template_name')).id\n notification_type_id = NotificationT...
<|body_start_0|> serializer_class = NotificationSerializer(data=request.data) try: request.data._mutable = True except AttributeError: pass if serializer_class.is_valid(): template_id = NotificationTemplate.objects.get(name__icontains=request.data.get(...
This class is for REST apis related to Notification service.
NotificationViewSet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NotificationViewSet: """This class is for REST apis related to Notification service.""" def create(self, request): """To create a new notification. :param request: :return:""" <|body_0|> def retrieve(self, request, pk=None): """To retrieve all notifications for s...
stack_v2_sparse_classes_75kplus_train_070865
4,479
no_license
[ { "docstring": "To create a new notification. :param request: :return:", "name": "create", "signature": "def create(self, request)" }, { "docstring": "To retrieve all notifications for specific user. :param request: :return:", "name": "retrieve", "signature": "def retrieve(self, request,...
3
stack_v2_sparse_classes_30k_train_007871
Implement the Python class `NotificationViewSet` described below. Class description: This class is for REST apis related to Notification service. Method signatures and docstrings: - def create(self, request): To create a new notification. :param request: :return: - def retrieve(self, request, pk=None): To retrieve al...
Implement the Python class `NotificationViewSet` described below. Class description: This class is for REST apis related to Notification service. Method signatures and docstrings: - def create(self, request): To create a new notification. :param request: :return: - def retrieve(self, request, pk=None): To retrieve al...
bf93575668230588e42e17943f0b3c3813a52d73
<|skeleton|> class NotificationViewSet: """This class is for REST apis related to Notification service.""" def create(self, request): """To create a new notification. :param request: :return:""" <|body_0|> def retrieve(self, request, pk=None): """To retrieve all notifications for s...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NotificationViewSet: """This class is for REST apis related to Notification service.""" def create(self, request): """To create a new notification. :param request: :return:""" serializer_class = NotificationSerializer(data=request.data) try: request.data._mutable = Tru...
the_stack_v2_python_sparse
api/views.py
aditya-neosoft/email-notification
train
0
7108fd1b4af632bbd854dd1d5e893f4204eac383
[ "labels = StockItemLabel.objects.all()\nself.assertTrue(labels.count() > 0)\nlabels = StockLocationLabel.objects.all()\nself.assertTrue(labels.count() > 0)", "item_dir = os.path.join(settings.MEDIA_ROOT, 'label', 'inventree', 'stockitem')\nfiles = os.listdir(item_dir)\nself.assertTrue(len(files) > 0)\nloc_dir = o...
<|body_start_0|> labels = StockItemLabel.objects.all() self.assertTrue(labels.count() > 0) labels = StockLocationLabel.objects.all() self.assertTrue(labels.count() > 0) <|end_body_0|> <|body_start_1|> item_dir = os.path.join(settings.MEDIA_ROOT, 'label', 'inventree', 'stockitem'...
LabelTest
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LabelTest: def _test_default_labels(self): """Test that the default label templates are copied across""" <|body_0|> def _test_default_files(self): """Test that label files exist in the MEDIA directory""" <|body_1|> def test_filters(self): """Test...
stack_v2_sparse_classes_75kplus_train_070866
1,834
permissive
[ { "docstring": "Test that the default label templates are copied across", "name": "_test_default_labels", "signature": "def _test_default_labels(self)" }, { "docstring": "Test that label files exist in the MEDIA directory", "name": "_test_default_files", "signature": "def _test_default_f...
3
stack_v2_sparse_classes_30k_train_044357
Implement the Python class `LabelTest` described below. Class description: Implement the LabelTest class. Method signatures and docstrings: - def _test_default_labels(self): Test that the default label templates are copied across - def _test_default_files(self): Test that label files exist in the MEDIA directory - de...
Implement the Python class `LabelTest` described below. Class description: Implement the LabelTest class. Method signatures and docstrings: - def _test_default_labels(self): Test that the default label templates are copied across - def _test_default_files(self): Test that label files exist in the MEDIA directory - de...
2a0ea66f6591756eeb62da28d24daec3ad4209e8
<|skeleton|> class LabelTest: def _test_default_labels(self): """Test that the default label templates are copied across""" <|body_0|> def _test_default_files(self): """Test that label files exist in the MEDIA directory""" <|body_1|> def test_filters(self): """Test...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LabelTest: def _test_default_labels(self): """Test that the default label templates are copied across""" labels = StockItemLabel.objects.all() self.assertTrue(labels.count() > 0) labels = StockLocationLabel.objects.all() self.assertTrue(labels.count() > 0) def _tes...
the_stack_v2_python_sparse
InvenTree/label/tests.py
MedShift/InvenTree
train
0
dc1142923677edfab4b4ab2ba05f74047ac215f9
[ "self.r = 1\nself.dim = 1\nself.aux = 0\ndimension = Dimension(int(sup_lim), 0, None)\nself.first = dimension\nself.last = dimension\nself.r = (dimension.sup_lim + 1) * self.r", "dimension = Dimension(int(sup_lim), 0, None)\nself.last.next = dimension\nself.last = dimension\nself.r = (dimension.sup_lim + 1) * sel...
<|body_start_0|> self.r = 1 self.dim = 1 self.aux = 0 dimension = Dimension(int(sup_lim), 0, None) self.first = dimension self.last = dimension self.r = (dimension.sup_lim + 1) * self.r <|end_body_0|> <|body_start_1|> dimension = Dimension(int(sup_lim), 0...
Clase DimensionList Lista encadenada que utiliza objetos tipo Dimension como nodos
DimensionList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DimensionList: """Clase DimensionList Lista encadenada que utiliza objetos tipo Dimension como nodos""" def __init__(self, sup_lim): """Inicializador de clase DimensionList args: sup_lim -- tamaño de dimensión con la que sera inicializada la lista""" <|body_0|> def add_d...
stack_v2_sparse_classes_75kplus_train_070867
2,292
no_license
[ { "docstring": "Inicializador de clase DimensionList args: sup_lim -- tamaño de dimensión con la que sera inicializada la lista", "name": "__init__", "signature": "def __init__(self, sup_lim)" }, { "docstring": "Método utilidad que permite añadir dimensiones a la lista que mantiene esta clase ar...
4
stack_v2_sparse_classes_30k_train_011980
Implement the Python class `DimensionList` described below. Class description: Clase DimensionList Lista encadenada que utiliza objetos tipo Dimension como nodos Method signatures and docstrings: - def __init__(self, sup_lim): Inicializador de clase DimensionList args: sup_lim -- tamaño de dimensión con la que sera i...
Implement the Python class `DimensionList` described below. Class description: Clase DimensionList Lista encadenada que utiliza objetos tipo Dimension como nodos Method signatures and docstrings: - def __init__(self, sup_lim): Inicializador de clase DimensionList args: sup_lim -- tamaño de dimensión con la que sera i...
d56896df7014680271615e99e52545468fe1c139
<|skeleton|> class DimensionList: """Clase DimensionList Lista encadenada que utiliza objetos tipo Dimension como nodos""" def __init__(self, sup_lim): """Inicializador de clase DimensionList args: sup_lim -- tamaño de dimensión con la que sera inicializada la lista""" <|body_0|> def add_d...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DimensionList: """Clase DimensionList Lista encadenada que utiliza objetos tipo Dimension como nodos""" def __init__(self, sup_lim): """Inicializador de clase DimensionList args: sup_lim -- tamaño de dimensión con la que sera inicializada la lista""" self.r = 1 self.dim = 1 ...
the_stack_v2_python_sparse
dimension.py
Alejandro-Valdes/Frida
train
4
c71d9516f60cb9d3ed7cb470db58a7e8db83a4de
[ "if len(nums) == 0:\n return -1\nif len(nums) == 1 and nums[0] != target:\n return -1\nn = len(nums)\nleft = 0\nright = n - 1\nwhile left < right:\n mid = left + (right - left) // 2\n if nums[mid] > nums[right]:\n left = mid + 1\n else:\n right = mid\nt = left\nprint(t)\nleft = 0\nright...
<|body_start_0|> if len(nums) == 0: return -1 if len(nums) == 1 and nums[0] != target: return -1 n = len(nums) left = 0 right = n - 1 while left < right: mid = left + (right - left) // 2 if nums[mid] > nums[right]: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def search(self, nums, target): """思路: 可以连续使用二分查找,二分查找找出旋转点,再在两侧分别进行二分查找,找到目标值""" <|body_0|> def searchOpt(self, nums, target): """不用先找出旋转的点,直接在二分查找的基础上修改 l_mid_][_mid_r,根据mid划分为四个区域,l-mid, mid-r可以直接二分,另外两个要不断缩小范围""" <|body_1|> <|end_skeleton|> <|...
stack_v2_sparse_classes_75kplus_train_070868
2,650
no_license
[ { "docstring": "思路: 可以连续使用二分查找,二分查找找出旋转点,再在两侧分别进行二分查找,找到目标值", "name": "search", "signature": "def search(self, nums, target)" }, { "docstring": "不用先找出旋转的点,直接在二分查找的基础上修改 l_mid_][_mid_r,根据mid划分为四个区域,l-mid, mid-r可以直接二分,另外两个要不断缩小范围", "name": "searchOpt", "signature": "def searchOpt(self, num...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def search(self, nums, target): 思路: 可以连续使用二分查找,二分查找找出旋转点,再在两侧分别进行二分查找,找到目标值 - def searchOpt(self, nums, target): 不用先找出旋转的点,直接在二分查找的基础上修改 l_mid_][_mid_r,根据mid划分为四个区域,l-mid, mid-r可...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def search(self, nums, target): 思路: 可以连续使用二分查找,二分查找找出旋转点,再在两侧分别进行二分查找,找到目标值 - def searchOpt(self, nums, target): 不用先找出旋转的点,直接在二分查找的基础上修改 l_mid_][_mid_r,根据mid划分为四个区域,l-mid, mid-r可...
95dddb78bccd169d9d219a473627361fe739ab5e
<|skeleton|> class Solution: def search(self, nums, target): """思路: 可以连续使用二分查找,二分查找找出旋转点,再在两侧分别进行二分查找,找到目标值""" <|body_0|> def searchOpt(self, nums, target): """不用先找出旋转的点,直接在二分查找的基础上修改 l_mid_][_mid_r,根据mid划分为四个区域,l-mid, mid-r可以直接二分,另外两个要不断缩小范围""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def search(self, nums, target): """思路: 可以连续使用二分查找,二分查找找出旋转点,再在两侧分别进行二分查找,找到目标值""" if len(nums) == 0: return -1 if len(nums) == 1 and nums[0] != target: return -1 n = len(nums) left = 0 right = n - 1 while left < right: ...
the_stack_v2_python_sparse
ArrayOperation/search.py
Philex5/codingPractice
train
0
d596140c7aae03cdb617ea6e3b1043c815884c29
[ "if isinstance(key, int):\n return ANISuboption(key)\nif key not in ANISuboption._member_map_:\n return extend_enum(ANISuboption, key, default)\nreturn ANISuboption[key]", "if not (isinstance(value, int) and 0 <= value <= 255):\n raise ValueError('%r is not a valid %s' % (value, cls.__name__))\nif 7 <= v...
<|body_start_0|> if isinstance(key, int): return ANISuboption(key) if key not in ANISuboption._member_map_: return extend_enum(ANISuboption, key, default) return ANISuboption[key] <|end_body_0|> <|body_start_1|> if not (isinstance(value, int) and 0 <= value <= 25...
[ANISuboption] Access Network Information (ANI) Sub-Option Type Values
ANISuboption
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ANISuboption: """[ANISuboption] Access Network Information (ANI) Sub-Option Type Values""" def get(key: 'int | str', default: 'int'=-1) -> 'ANISuboption': """Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:""" ...
stack_v2_sparse_classes_75kplus_train_070869
2,239
permissive
[ { "docstring": "Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:", "name": "get", "signature": "def get(key: 'int | str', default: 'int'=-1) -> 'ANISuboption'" }, { "docstring": "Lookup function used when value is not found...
2
stack_v2_sparse_classes_30k_train_020669
Implement the Python class `ANISuboption` described below. Class description: [ANISuboption] Access Network Information (ANI) Sub-Option Type Values Method signatures and docstrings: - def get(key: 'int | str', default: 'int'=-1) -> 'ANISuboption': Backport support for original codes. Args: key: Key to get enum item....
Implement the Python class `ANISuboption` described below. Class description: [ANISuboption] Access Network Information (ANI) Sub-Option Type Values Method signatures and docstrings: - def get(key: 'int | str', default: 'int'=-1) -> 'ANISuboption': Backport support for original codes. Args: key: Key to get enum item....
a6fe49ec58f09e105bec5a00fb66d9b3f22730d9
<|skeleton|> class ANISuboption: """[ANISuboption] Access Network Information (ANI) Sub-Option Type Values""" def get(key: 'int | str', default: 'int'=-1) -> 'ANISuboption': """Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ANISuboption: """[ANISuboption] Access Network Information (ANI) Sub-Option Type Values""" def get(key: 'int | str', default: 'int'=-1) -> 'ANISuboption': """Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:""" if isi...
the_stack_v2_python_sparse
pcapkit/const/mh/ani_suboption.py
JarryShaw/PyPCAPKit
train
204
f398e5b6d3a97e2f039feea93f2450ed05c87e59
[ "self.rad = radius\nself.xc = x_center\nself.yc = y_center", "while True:\n x = self.xc + random.uniform(-1, 1) * self.rad\n y = self.yc + random.uniform(-1, 1) * self.rad\n if (x - self.xc) ** 2 + (y - self.yc) ** 2 <= self.rad ** 2:\n return [x, y]" ]
<|body_start_0|> self.rad = radius self.xc = x_center self.yc = y_center <|end_body_0|> <|body_start_1|> while True: x = self.xc + random.uniform(-1, 1) * self.rad y = self.yc + random.uniform(-1, 1) * self.rad if (x - self.xc) ** 2 + (y - self.yc) **...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def __init__(self, radius, x_center, y_center): """:type radius: float :type x_center: float :type y_center: float""" <|body_0|> def randPoint(self): """:rtype: List[float]""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.rad = radius ...
stack_v2_sparse_classes_75kplus_train_070870
1,035
no_license
[ { "docstring": ":type radius: float :type x_center: float :type y_center: float", "name": "__init__", "signature": "def __init__(self, radius, x_center, y_center)" }, { "docstring": ":rtype: List[float]", "name": "randPoint", "signature": "def randPoint(self)" } ]
2
stack_v2_sparse_classes_30k_train_032600
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, radius, x_center, y_center): :type radius: float :type x_center: float :type y_center: float - def randPoint(self): :rtype: List[float]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, radius, x_center, y_center): :type radius: float :type x_center: float :type y_center: float - def randPoint(self): :rtype: List[float] <|skeleton|> class Sol...
6fec95b9b4d735727160905e754a698513bfb7d8
<|skeleton|> class Solution: def __init__(self, radius, x_center, y_center): """:type radius: float :type x_center: float :type y_center: float""" <|body_0|> def randPoint(self): """:rtype: List[float]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def __init__(self, radius, x_center, y_center): """:type radius: float :type x_center: float :type y_center: float""" self.rad = radius self.xc = x_center self.yc = y_center def randPoint(self): """:rtype: List[float]""" while True: x ...
the_stack_v2_python_sparse
leetcode/math/generate-random-point-in-a-circle.py
jwyx3/practices
train
2
54e1080fd73636e5f427bebfb67fb80878699a39
[ "super(BaseFilmLayer, self).__init__()\nself.num_maps = num_maps\nself.num_blocks = num_blocks", "l2_term = 0\nfor gamma_regularizer, beta_regularizer in zip(self.gamma_regularizers, self.beta_regularizers):\n l2_term += (gamma_regularizer ** 2).sum()\n l2_term += (beta_regularizer ** 2).sum()\nreturn l2_te...
<|body_start_0|> super(BaseFilmLayer, self).__init__() self.num_maps = num_maps self.num_blocks = num_blocks <|end_body_0|> <|body_start_1|> l2_term = 0 for gamma_regularizer, beta_regularizer in zip(self.gamma_regularizers, self.beta_regularizers): l2_term += (gamma...
Base class for a FiLM layer in an EfficientNet feature extractor. Will be wrapped around a FilmAdapter instance.
BaseFilmLayer
[ "LicenseRef-scancode-generic-cla", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseFilmLayer: """Base class for a FiLM layer in an EfficientNet feature extractor. Will be wrapped around a FilmAdapter instance.""" def __init__(self, num_maps, num_blocks): """Creates a BaseFilmLayer instance. :param num_maps: (list::int) Dimensionality of input to each block in t...
stack_v2_sparse_classes_75kplus_train_070871
6,092
permissive
[ { "docstring": "Creates a BaseFilmLayer instance. :param num_maps: (list::int) Dimensionality of input to each block in the FiLM layer. :param num_blocks: (int) Number of blocks in the FiLM layer. :return: Nothing.", "name": "__init__", "signature": "def __init__(self, num_maps, num_blocks)" }, { ...
2
stack_v2_sparse_classes_30k_train_011728
Implement the Python class `BaseFilmLayer` described below. Class description: Base class for a FiLM layer in an EfficientNet feature extractor. Will be wrapped around a FilmAdapter instance. Method signatures and docstrings: - def __init__(self, num_maps, num_blocks): Creates a BaseFilmLayer instance. :param num_map...
Implement the Python class `BaseFilmLayer` described below. Class description: Base class for a FiLM layer in an EfficientNet feature extractor. Will be wrapped around a FilmAdapter instance. Method signatures and docstrings: - def __init__(self, num_maps, num_blocks): Creates a BaseFilmLayer instance. :param num_map...
01b744829154ef660eb708b9e962295fbb421df2
<|skeleton|> class BaseFilmLayer: """Base class for a FiLM layer in an EfficientNet feature extractor. Will be wrapped around a FilmAdapter instance.""" def __init__(self, num_maps, num_blocks): """Creates a BaseFilmLayer instance. :param num_maps: (list::int) Dimensionality of input to each block in t...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BaseFilmLayer: """Base class for a FiLM layer in an EfficientNet feature extractor. Will be wrapped around a FilmAdapter instance.""" def __init__(self, num_maps, num_blocks): """Creates a BaseFilmLayer instance. :param num_maps: (list::int) Dimensionality of input to each block in the FiLM layer...
the_stack_v2_python_sparse
feature_adapters/efficientnet_adaptation_layers.py
AI-HUB-Deep-Learning-Fundamental/ORBIT-Dataset-Real-World-Few-Shot-Object-Recognition
train
0
09d3e230ee9d27ee96e1f55843b5d2837dd58697
[ "try:\n permissions = config_db.get_permissions()\n return permissions\nexcept Exception as e:\n return {'error': 'Error fetching permissions: ' + str(e)}", "body = request.json\nconfig_service.create_permission(body)\nreturn {'error': 'Success'}" ]
<|body_start_0|> try: permissions = config_db.get_permissions() return permissions except Exception as e: return {'error': 'Error fetching permissions: ' + str(e)} <|end_body_0|> <|body_start_1|> body = request.json config_service.create_permission(bo...
PermissionsResource
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PermissionsResource: def get(self): """Get all valid permissions""" <|body_0|> def post(self): """Create position""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: permissions = config_db.get_permissions() return permissio...
stack_v2_sparse_classes_75kplus_train_070872
2,020
no_license
[ { "docstring": "Get all valid permissions", "name": "get", "signature": "def get(self)" }, { "docstring": "Create position", "name": "post", "signature": "def post(self)" } ]
2
null
Implement the Python class `PermissionsResource` described below. Class description: Implement the PermissionsResource class. Method signatures and docstrings: - def get(self): Get all valid permissions - def post(self): Create position
Implement the Python class `PermissionsResource` described below. Class description: Implement the PermissionsResource class. Method signatures and docstrings: - def get(self): Get all valid permissions - def post(self): Create position <|skeleton|> class PermissionsResource: def get(self): """Get all v...
0b760c062275e4d265cfbd8caacd23c36042f8d3
<|skeleton|> class PermissionsResource: def get(self): """Get all valid permissions""" <|body_0|> def post(self): """Create position""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PermissionsResource: def get(self): """Get all valid permissions""" try: permissions = config_db.get_permissions() return permissions except Exception as e: return {'error': 'Error fetching permissions: ' + str(e)} def post(self): """Cre...
the_stack_v2_python_sparse
api/controllers/config.py
otter-pond/backend
train
0
3c4a028f08dfa7bbe5f28c94f95c77a77a16cd99
[ "super(MultiheadAttentionContainer, self).__init__()\nself.nhead = nhead\nself.in_proj_container = in_proj_container\nself.attention_layer = attention_layer\nself.out_proj = out_proj\nself.attn_map = 0", "tgt_len, src_len, bsz, embed_dim = (query.size(-3), key.size(-3), query.size(-2), query.size(-1))\nq, k, v = ...
<|body_start_0|> super(MultiheadAttentionContainer, self).__init__() self.nhead = nhead self.in_proj_container = in_proj_container self.attention_layer = attention_layer self.out_proj = out_proj self.attn_map = 0 <|end_body_0|> <|body_start_1|> tgt_len, src_len, ...
MultiheadAttentionContainer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiheadAttentionContainer: def __init__(self, nhead, in_proj_container, attention_layer, out_proj): """A multi-head attention container Args: nhead: the number of heads in the multiheadattention model in_proj_container: A container of multi-head in-projection linear layers (a.k.a nn.Li...
stack_v2_sparse_classes_75kplus_train_070873
38,400
permissive
[ { "docstring": "A multi-head attention container Args: nhead: the number of heads in the multiheadattention model in_proj_container: A container of multi-head in-projection linear layers (a.k.a nn.Linear). attention_layer: The attention layer. out_proj: The multi-head out-projection layer (a.k.a nn.Linear). Exa...
2
stack_v2_sparse_classes_30k_train_020315
Implement the Python class `MultiheadAttentionContainer` described below. Class description: Implement the MultiheadAttentionContainer class. Method signatures and docstrings: - def __init__(self, nhead, in_proj_container, attention_layer, out_proj): A multi-head attention container Args: nhead: the number of heads i...
Implement the Python class `MultiheadAttentionContainer` described below. Class description: Implement the MultiheadAttentionContainer class. Method signatures and docstrings: - def __init__(self, nhead, in_proj_container, attention_layer, out_proj): A multi-head attention container Args: nhead: the number of heads i...
feeab742e9c737c8e2b8b0e44d3efff4049f5847
<|skeleton|> class MultiheadAttentionContainer: def __init__(self, nhead, in_proj_container, attention_layer, out_proj): """A multi-head attention container Args: nhead: the number of heads in the multiheadattention model in_proj_container: A container of multi-head in-projection linear layers (a.k.a nn.Li...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MultiheadAttentionContainer: def __init__(self, nhead, in_proj_container, attention_layer, out_proj): """A multi-head attention container Args: nhead: the number of heads in the multiheadattention model in_proj_container: A container of multi-head in-projection linear layers (a.k.a nn.Linear). attenti...
the_stack_v2_python_sparse
src/models/baselines/transformer.py
ColinAvrech/state-spaces
train
0
acd5a69c53a2919d13368cac254a20a2fdc1d352
[ "self.client_vm.Install('pip')\nself.client_vm.RemoteCommand('sudo pip install absl-py')\nself.client_vm.Install('google_cloud_sdk')\nkey_file_name = FLAGS.gcp_service_account_key_file.split('/')[-1]\nif '/' in FLAGS.gcp_service_account_key_file:\n self.client_vm.PushFile(FLAGS.gcp_service_account_key_file)\nels...
<|body_start_0|> self.client_vm.Install('pip') self.client_vm.RemoteCommand('sudo pip install absl-py') self.client_vm.Install('google_cloud_sdk') key_file_name = FLAGS.gcp_service_account_key_file.split('/')[-1] if '/' in FLAGS.gcp_service_account_key_file: self.clie...
Command Line Client Interface class for BigQuery. Uses the native Bigquery client that ships with the google_cloud_sdk https://cloud.google.com/bigquery/docs/bq-command-line-tool.
CliClientInterface
[ "Classpath-exception-2.0", "BSD-3-Clause", "AGPL-3.0-only", "MIT", "GPL-2.0-only", "Apache-2.0", "LicenseRef-scancode-public-domain", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CliClientInterface: """Command Line Client Interface class for BigQuery. Uses the native Bigquery client that ships with the google_cloud_sdk https://cloud.google.com/bigquery/docs/bq-command-line-tool.""" def Prepare(self, package_name: str) -> None: """Prepares the client vm to exe...
stack_v2_sparse_classes_75kplus_train_070874
24,185
permissive
[ { "docstring": "Prepares the client vm to execute query. Installs the bq tool dependencies and authenticates using a service account. Args: package_name: String name of the package defining the preprovisioned data (certificates, etc.) to extract and use during client vm preparation.", "name": "Prepare", ...
2
null
Implement the Python class `CliClientInterface` described below. Class description: Command Line Client Interface class for BigQuery. Uses the native Bigquery client that ships with the google_cloud_sdk https://cloud.google.com/bigquery/docs/bq-command-line-tool. Method signatures and docstrings: - def Prepare(self, ...
Implement the Python class `CliClientInterface` described below. Class description: Command Line Client Interface class for BigQuery. Uses the native Bigquery client that ships with the google_cloud_sdk https://cloud.google.com/bigquery/docs/bq-command-line-tool. Method signatures and docstrings: - def Prepare(self, ...
d0699f32998898757b036704fba39e5471641f01
<|skeleton|> class CliClientInterface: """Command Line Client Interface class for BigQuery. Uses the native Bigquery client that ships with the google_cloud_sdk https://cloud.google.com/bigquery/docs/bq-command-line-tool.""" def Prepare(self, package_name: str) -> None: """Prepares the client vm to exe...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CliClientInterface: """Command Line Client Interface class for BigQuery. Uses the native Bigquery client that ships with the google_cloud_sdk https://cloud.google.com/bigquery/docs/bq-command-line-tool.""" def Prepare(self, package_name: str) -> None: """Prepares the client vm to execute query. I...
the_stack_v2_python_sparse
perfkitbenchmarker/providers/gcp/bigquery.py
GoogleCloudPlatform/PerfKitBenchmarker
train
1,923
2ccc503f8a9efd4aa08f95ef77e3b4988adb1420
[ "comments = CommentsSongs.query.order_by(asc(CommentsSongs.SongID), asc(CommentsSongs.Created)).all()\ncontents = jsonify({'comments': [{'commentID': comment.CommentID, 'songID': comment.SongID, 'userID': comment.UserID, 'name': get_username(comment.UserID), 'comment': comment.Comment, 'createdAt': get_iso_format(c...
<|body_start_0|> comments = CommentsSongs.query.order_by(asc(CommentsSongs.SongID), asc(CommentsSongs.Created)).all() contents = jsonify({'comments': [{'commentID': comment.CommentID, 'songID': comment.SongID, 'userID': comment.UserID, 'name': get_username(comment.UserID), 'comment': comment.Comment, 'c...
SongCommentsView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SongCommentsView: def index(self): """Return all comments for all songs.""" <|body_0|> def get(self, song_id): """Return the comments for a specific song.""" <|body_1|> def post(self): """Add a comment to a song specified in the payload.""" ...
stack_v2_sparse_classes_75kplus_train_070875
26,847
permissive
[ { "docstring": "Return all comments for all songs.", "name": "index", "signature": "def index(self)" }, { "docstring": "Return the comments for a specific song.", "name": "get", "signature": "def get(self, song_id)" }, { "docstring": "Add a comment to a song specified in the payl...
5
stack_v2_sparse_classes_30k_train_005504
Implement the Python class `SongCommentsView` described below. Class description: Implement the SongCommentsView class. Method signatures and docstrings: - def index(self): Return all comments for all songs. - def get(self, song_id): Return the comments for a specific song. - def post(self): Add a comment to a song s...
Implement the Python class `SongCommentsView` described below. Class description: Implement the SongCommentsView class. Method signatures and docstrings: - def index(self): Return all comments for all songs. - def get(self, song_id): Return the comments for a specific song. - def post(self): Add a comment to a song s...
62f8e8e904e379541193f0cbb91a8434b47f538f
<|skeleton|> class SongCommentsView: def index(self): """Return all comments for all songs.""" <|body_0|> def get(self, song_id): """Return the comments for a specific song.""" <|body_1|> def post(self): """Add a comment to a song specified in the payload.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SongCommentsView: def index(self): """Return all comments for all songs.""" comments = CommentsSongs.query.order_by(asc(CommentsSongs.SongID), asc(CommentsSongs.Created)).all() contents = jsonify({'comments': [{'commentID': comment.CommentID, 'songID': comment.SongID, 'userID': comment...
the_stack_v2_python_sparse
apps/comments/views.py
Torniojaws/vortech-backend
train
0
2be2e64a13b65fad14e25c281e3f818c93fb30fc
[ "argument_group.add_argument(u'--name', u'--timeline_name', u'--timeline-name', dest=u'timeline_name', type=str, action=u'store', default=cls._DEFAULT_NAME, required=False, help=u'The name of the timeline in Timesketch. Default: hostname if present in the storage file. If no hostname is found then manual input is u...
<|body_start_0|> argument_group.add_argument(u'--name', u'--timeline_name', u'--timeline-name', dest=u'timeline_name', type=str, action=u'store', default=cls._DEFAULT_NAME, required=False, help=u'The name of the timeline in Timesketch. Default: hostname if present in the storage file. If no hostname is found th...
CLI arguments helper class for a timesketch output module.
TimesketchOutputHelper
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TimesketchOutputHelper: """CLI arguments helper class for a timesketch output module.""" def AddArguments(cls, argument_group): """Add command line arguments the helper supports to an argument group. This function takes an argument parser or an argument group object and adds to it al...
stack_v2_sparse_classes_75kplus_train_070876
3,277
permissive
[ { "docstring": "Add command line arguments the helper supports to an argument group. This function takes an argument parser or an argument group object and adds to it all the command line arguments this helper supports. Args: argument_group: the argparse group (instance of argparse._ArgumentGroup or or argparse...
2
stack_v2_sparse_classes_30k_train_001170
Implement the Python class `TimesketchOutputHelper` described below. Class description: CLI arguments helper class for a timesketch output module. Method signatures and docstrings: - def AddArguments(cls, argument_group): Add command line arguments the helper supports to an argument group. This function takes an argu...
Implement the Python class `TimesketchOutputHelper` described below. Class description: CLI arguments helper class for a timesketch output module. Method signatures and docstrings: - def AddArguments(cls, argument_group): Add command line arguments the helper supports to an argument group. This function takes an argu...
923797fc00664fa9e3277781b0334d6eed5664fd
<|skeleton|> class TimesketchOutputHelper: """CLI arguments helper class for a timesketch output module.""" def AddArguments(cls, argument_group): """Add command line arguments the helper supports to an argument group. This function takes an argument parser or an argument group object and adds to it al...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TimesketchOutputHelper: """CLI arguments helper class for a timesketch output module.""" def AddArguments(cls, argument_group): """Add command line arguments the helper supports to an argument group. This function takes an argument parser or an argument group object and adds to it all the command...
the_stack_v2_python_sparse
plaso/cli/helpers/timesketch_out.py
CNR-ITTIG/plasodfaxp
train
1
61fb353296b05ae2ce3c47000c2daa3a1f04acc0
[ "super().__init__(containers=containers, image=pygame.Surface((1, 1)), start=start)\nself.font_size = font_size\nself.color = color\nself.text = text\nself.update_image()", "font = pygame.font.SysFont('mono', self.font_size)\nimg = font.render(self.text, True, self.color)\nself.set_image(img)", "if text != self...
<|body_start_0|> super().__init__(containers=containers, image=pygame.Surface((1, 1)), start=start) self.font_size = font_size self.color = color self.text = text self.update_image() <|end_body_0|> <|body_start_1|> font = pygame.font.SysFont('mono', self.font_size) ...
A sprite that contains text
TextSprite
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TextSprite: """A sprite that contains text""" def __init__(self, containers, text, start, font_size=24, color=(255, 255, 255)): """Creates the TextSprite""" <|body_0|> def update_image(self): """Updates the image used for this sprite""" <|body_1|> de...
stack_v2_sparse_classes_75kplus_train_070877
7,153
no_license
[ { "docstring": "Creates the TextSprite", "name": "__init__", "signature": "def __init__(self, containers, text, start, font_size=24, color=(255, 255, 255))" }, { "docstring": "Updates the image used for this sprite", "name": "update_image", "signature": "def update_image(self)" }, { ...
5
stack_v2_sparse_classes_30k_train_031862
Implement the Python class `TextSprite` described below. Class description: A sprite that contains text Method signatures and docstrings: - def __init__(self, containers, text, start, font_size=24, color=(255, 255, 255)): Creates the TextSprite - def update_image(self): Updates the image used for this sprite - def se...
Implement the Python class `TextSprite` described below. Class description: A sprite that contains text Method signatures and docstrings: - def __init__(self, containers, text, start, font_size=24, color=(255, 255, 255)): Creates the TextSprite - def update_image(self): Updates the image used for this sprite - def se...
8604a243baeecdd393a54c18bf2ff9e003b4b8a0
<|skeleton|> class TextSprite: """A sprite that contains text""" def __init__(self, containers, text, start, font_size=24, color=(255, 255, 255)): """Creates the TextSprite""" <|body_0|> def update_image(self): """Updates the image used for this sprite""" <|body_1|> de...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TextSprite: """A sprite that contains text""" def __init__(self, containers, text, start, font_size=24, color=(255, 255, 255)): """Creates the TextSprite""" super().__init__(containers=containers, image=pygame.Surface((1, 1)), start=start) self.font_size = font_size self.c...
the_stack_v2_python_sparse
src/sprite/sprite_library.py
ZXQYC/random-shooter-game
train
0
be223ca3bb54700f4c025e92a6632e8f0c4c63f6
[ "self.level = level\nself.radius = radius\nself.sigma = sigma\nself.prob_thred = prob_thred", "probs_map = np.load(probs_map_path)\nX, Y = probs_map.shape\nmag = pow(2, self.level)\nif self.sigma > 0:\n probs_map = filters.gaussian(probs_map, sigma=self.sigma)\noutfile = open(output_path, 'w')\nwhile np.max(pr...
<|body_start_0|> self.level = level self.radius = radius self.sigma = sigma self.prob_thred = prob_thred <|end_body_0|> <|body_start_1|> probs_map = np.load(probs_map_path) X, Y = probs_map.shape mag = pow(2, self.level) if self.sigma > 0: pro...
NMS
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NMS: def __init__(self, level, radius=12, sigma=0, prob_thred=0.5): """设置通用NMS处理代码 :param level: :param radius: :param sigma: :param prob_thred:""" <|body_0|> def run(self, probs_map_path, output_path): """:param probs_map_path: heatmap的路径 :param output_path: 保存为csv坐...
stack_v2_sparse_classes_75kplus_train_070878
1,653
no_license
[ { "docstring": "设置通用NMS处理代码 :param level: :param radius: :param sigma: :param prob_thred:", "name": "__init__", "signature": "def __init__(self, level, radius=12, sigma=0, prob_thred=0.5)" }, { "docstring": ":param probs_map_path: heatmap的路径 :param output_path: 保存为csv坐标 :return:", "name": "r...
2
null
Implement the Python class `NMS` described below. Class description: Implement the NMS class. Method signatures and docstrings: - def __init__(self, level, radius=12, sigma=0, prob_thred=0.5): 设置通用NMS处理代码 :param level: :param radius: :param sigma: :param prob_thred: - def run(self, probs_map_path, output_path): :para...
Implement the Python class `NMS` described below. Class description: Implement the NMS class. Method signatures and docstrings: - def __init__(self, level, radius=12, sigma=0, prob_thred=0.5): 设置通用NMS处理代码 :param level: :param radius: :param sigma: :param prob_thred: - def run(self, probs_map_path, output_path): :para...
7b98c93c818388ba0a85a4748f59890250708d61
<|skeleton|> class NMS: def __init__(self, level, radius=12, sigma=0, prob_thred=0.5): """设置通用NMS处理代码 :param level: :param radius: :param sigma: :param prob_thred:""" <|body_0|> def run(self, probs_map_path, output_path): """:param probs_map_path: heatmap的路径 :param output_path: 保存为csv坐...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NMS: def __init__(self, level, radius=12, sigma=0, prob_thred=0.5): """设置通用NMS处理代码 :param level: :param radius: :param sigma: :param prob_thred:""" self.level = level self.radius = radius self.sigma = sigma self.prob_thred = prob_thred def run(self, probs_map_path,...
the_stack_v2_python_sparse
classfication/postprocess/nms.py
PCLLS/bigtest
train
0
42a3c0f5e91bf8939ca22df830cfad0989c6fd6a
[ "if not proto_obj.last_update_source:\n raise GameModelError('No update source specified in Game creation.')\nreturn Game(id_str=proto_obj.id_str, teams=[Team.FromProto(tm) for tm in proto_obj.teams], scores=proto_obj.scores, name=proto_obj.name, tournament_id=proto_obj.tournament_id_str, tournament_name=proto_o...
<|body_start_0|> if not proto_obj.last_update_source: raise GameModelError('No update source specified in Game creation.') return Game(id_str=proto_obj.id_str, teams=[Team.FromProto(tm) for tm in proto_obj.teams], scores=proto_obj.scores, name=proto_obj.name, tournament_id=proto_obj.tourname...
Information about a single game including all sources.
Game
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Game: """Information about a single game including all sources.""" def FromProto(cls, proto_obj): """Builds a Game object from a protobuf object.""" <|body_0|> def FromTweet(cls, twt, teams, scores, division, age_bracket, league): """Builds a Game object from a t...
stack_v2_sparse_classes_75kplus_train_070879
18,736
permissive
[ { "docstring": "Builds a Game object from a protobuf object.", "name": "FromProto", "signature": "def FromProto(cls, proto_obj)" }, { "docstring": "Builds a Game object from a tweet and the specified teams. Args: twt: The tweets.Tweet object teams: A list of exactly two Team objects derived from...
4
stack_v2_sparse_classes_30k_train_015682
Implement the Python class `Game` described below. Class description: Information about a single game including all sources. Method signatures and docstrings: - def FromProto(cls, proto_obj): Builds a Game object from a protobuf object. - def FromTweet(cls, twt, teams, scores, division, age_bracket, league): Builds a...
Implement the Python class `Game` described below. Class description: Information about a single game including all sources. Method signatures and docstrings: - def FromProto(cls, proto_obj): Builds a Game object from a protobuf object. - def FromTweet(cls, twt, teams, scores, division, age_bracket, league): Builds a...
58197798a0a3a4fbcd54ffa0a2fab2e865985bfd
<|skeleton|> class Game: """Information about a single game including all sources.""" def FromProto(cls, proto_obj): """Builds a Game object from a protobuf object.""" <|body_0|> def FromTweet(cls, twt, teams, scores, division, age_bracket, league): """Builds a Game object from a t...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Game: """Information about a single game including all sources.""" def FromProto(cls, proto_obj): """Builds a Game object from a protobuf object.""" if not proto_obj.last_update_source: raise GameModelError('No update source specified in Game creation.') return Game(id...
the_stack_v2_python_sparse
game_model.py
martincochran/score-minion
train
0
cdea184ad08c0b636b6421c22b348d3653184138
[ "commands = []\nfor provider in self.providers:\n for cmd in provider.get_commands() or []:\n parts = cmd[0].split()\n if parts[:len(args)] == args:\n commands.append(cmd[:3])\ncommands.sort()\nreturn commands", "comp = []\nfor provider in self.providers:\n for cmd in provider.get_c...
<|body_start_0|> commands = [] for provider in self.providers: for cmd in provider.get_commands() or []: parts = cmd[0].split() if parts[:len(args)] == args: commands.append(cmd[:3]) commands.sort() return commands <|end_bod...
plumbum command manager.
PlumbumCommandManager
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PlumbumCommandManager: """plumbum command manager.""" def get_command_help(self, args=[]): """Return help information for a set of commands.""" <|body_0|> def complete_command(self, args, cmd_only=False): """Perform auto-completion on the given arguments.""" ...
stack_v2_sparse_classes_75kplus_train_070880
3,688
permissive
[ { "docstring": "Return help information for a set of commands.", "name": "get_command_help", "signature": "def get_command_help(self, args=[])" }, { "docstring": "Perform auto-completion on the given arguments.", "name": "complete_command", "signature": "def complete_command(self, args, ...
3
stack_v2_sparse_classes_30k_train_036188
Implement the Python class `PlumbumCommandManager` described below. Class description: plumbum command manager. Method signatures and docstrings: - def get_command_help(self, args=[]): Return help information for a set of commands. - def complete_command(self, args, cmd_only=False): Perform auto-completion on the giv...
Implement the Python class `PlumbumCommandManager` described below. Class description: plumbum command manager. Method signatures and docstrings: - def get_command_help(self, args=[]): Return help information for a set of commands. - def complete_command(self, args, cmd_only=False): Perform auto-completion on the giv...
c0f769ca525298ab190592d0997575d917a4bed4
<|skeleton|> class PlumbumCommandManager: """plumbum command manager.""" def get_command_help(self, args=[]): """Return help information for a set of commands.""" <|body_0|> def complete_command(self, args, cmd_only=False): """Perform auto-completion on the given arguments.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PlumbumCommandManager: """plumbum command manager.""" def get_command_help(self, args=[]): """Return help information for a set of commands.""" commands = [] for provider in self.providers: for cmd in provider.get_commands() or []: parts = cmd[0].split(...
the_stack_v2_python_sparse
plumbum/command/api.py
coyotevz/plumbum-old-1
train
0
0623ce76293157e8f8db70996fe794381e13fe64
[ "super(MouseEvents, self).__init__(**kwargs)\nself.right_click = None\nself.left_click = None", "super(MouseEvents, self).on_touch_down(touch)\nif touch.button == 'right' and self.right_click is not None:\n self.right_click()\nelif touch.button == 'left' and self.left_click is not None:\n self.left_click()"...
<|body_start_0|> super(MouseEvents, self).__init__(**kwargs) self.right_click = None self.left_click = None <|end_body_0|> <|body_start_1|> super(MouseEvents, self).on_touch_down(touch) if touch.button == 'right' and self.right_click is not None: self.right_click() ...
Classe abstraite rajoutant des fonctionnalités sur les évènements engendré par la souris.
MouseEvents
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MouseEvents: """Classe abstraite rajoutant des fonctionnalités sur les évènements engendré par la souris.""" def __init__(self, **kwargs): """Ne pas utiliser directement -> classe abstraite.""" <|body_0|> def on_touch_down(self, touch): """Applique les raccourcis...
stack_v2_sparse_classes_75kplus_train_070881
16,681
no_license
[ { "docstring": "Ne pas utiliser directement -> classe abstraite.", "name": "__init__", "signature": "def __init__(self, **kwargs)" }, { "docstring": "Applique les raccourcis souris.", "name": "on_touch_down", "signature": "def on_touch_down(self, touch)" } ]
2
stack_v2_sparse_classes_30k_train_021936
Implement the Python class `MouseEvents` described below. Class description: Classe abstraite rajoutant des fonctionnalités sur les évènements engendré par la souris. Method signatures and docstrings: - def __init__(self, **kwargs): Ne pas utiliser directement -> classe abstraite. - def on_touch_down(self, touch): Ap...
Implement the Python class `MouseEvents` described below. Class description: Classe abstraite rajoutant des fonctionnalités sur les évènements engendré par la souris. Method signatures and docstrings: - def __init__(self, **kwargs): Ne pas utiliser directement -> classe abstraite. - def on_touch_down(self, touch): Ap...
4cde0cb92576b9b6d25df0797feb7b86a772842c
<|skeleton|> class MouseEvents: """Classe abstraite rajoutant des fonctionnalités sur les évènements engendré par la souris.""" def __init__(self, **kwargs): """Ne pas utiliser directement -> classe abstraite.""" <|body_0|> def on_touch_down(self, touch): """Applique les raccourcis...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MouseEvents: """Classe abstraite rajoutant des fonctionnalités sur les évènements engendré par la souris.""" def __init__(self, **kwargs): """Ne pas utiliser directement -> classe abstraite.""" super(MouseEvents, self).__init__(**kwargs) self.right_click = None self.left_c...
the_stack_v2_python_sparse
demarrage.py
Chronoflo/echecsPour3
train
0
19dbbd6c7bcfe30e6cf125f1e2a22fa9e8e235eb
[ "self.tester = tester.Tester()\nself.tester.register_handler(event_types.BeginEvent, on_begin)\nself.tester.register_handler(event_types.CaseTestedEvent, on_case)\nself.tester.register_handler(event_types.FinishEvent, on_finish)\nself.truncate_amount = truncate_amount\nself.show_correct_output = show_correct_output...
<|body_start_0|> self.tester = tester.Tester() self.tester.register_handler(event_types.BeginEvent, on_begin) self.tester.register_handler(event_types.CaseTestedEvent, on_case) self.tester.register_handler(event_types.FinishEvent, on_finish) self.truncate_amount = truncate_amount...
A text based display mechanism for test case results
TextHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TextHandler: """A text based display mechanism for test case results""" def __init__(self, show_time=True, show_score=True, show_correct_output=True, truncate_amount=TRUNCATE_AMOUNT): """Constructor :param show_time: Controls whether the run time is shown :param show_score: Controls ...
stack_v2_sparse_classes_75kplus_train_070882
2,286
no_license
[ { "docstring": "Constructor :param show_time: Controls whether the run time is shown :param show_score: Controls whether a score is shown in the end :param show_correct_output: Controls whether correct output is shown in case of a WA :param truncate_amount: How much to truncate output by (if it is being display...
2
stack_v2_sparse_classes_30k_train_001974
Implement the Python class `TextHandler` described below. Class description: A text based display mechanism for test case results Method signatures and docstrings: - def __init__(self, show_time=True, show_score=True, show_correct_output=True, truncate_amount=TRUNCATE_AMOUNT): Constructor :param show_time: Controls w...
Implement the Python class `TextHandler` described below. Class description: A text based display mechanism for test case results Method signatures and docstrings: - def __init__(self, show_time=True, show_score=True, show_correct_output=True, truncate_amount=TRUNCATE_AMOUNT): Constructor :param show_time: Controls w...
6bac81405275f76b429d8aae53c395c97b178f83
<|skeleton|> class TextHandler: """A text based display mechanism for test case results""" def __init__(self, show_time=True, show_score=True, show_correct_output=True, truncate_amount=TRUNCATE_AMOUNT): """Constructor :param show_time: Controls whether the run time is shown :param show_score: Controls ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TextHandler: """A text based display mechanism for test case results""" def __init__(self, show_time=True, show_score=True, show_correct_output=True, truncate_amount=TRUNCATE_AMOUNT): """Constructor :param show_time: Controls whether the run time is shown :param show_score: Controls whether a sco...
the_stack_v2_python_sparse
tester/handlers/text_handler.py
plasmatic1/PYTester
train
0
04068c2d9595b5d1c89d03ba9180d31767ccb468
[ "if type(self) in (CQRSSerializer, CQRSPolymorphicSerializer):\n return {}\nfields = super(CQRSSerializer, self).get_default_fields()\nfor base in type(self).__bases__:\n base = CQRSSerializerMeta._register.instances[base.Meta.model]\n if type(base) in (CQRSSerializer, CQRSPolymorphicSerializer):\n ...
<|body_start_0|> if type(self) in (CQRSSerializer, CQRSPolymorphicSerializer): return {} fields = super(CQRSSerializer, self).get_default_fields() for base in type(self).__bases__: base = CQRSSerializerMeta._register.instances[base.Meta.model] if type(base) in...
CQRSSerializer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CQRSSerializer: def get_default_fields(self): """Return the PARTIAL set of default fields for the object, as a dict. This differs from :meth:`rest_framework.serializers.ModelSerializer.get_default_fields` in that it only returns the *newly added fields*: that is, the fields from this cla...
stack_v2_sparse_classes_75kplus_train_070883
13,334
no_license
[ { "docstring": "Return the PARTIAL set of default fields for the object, as a dict. This differs from :meth:`rest_framework.serializers.ModelSerializer.get_default_fields` in that it only returns the *newly added fields*: that is, the fields from this class but not from one of its CQRS bases (thus, fields from ...
2
stack_v2_sparse_classes_30k_train_042534
Implement the Python class `CQRSSerializer` described below. Class description: Implement the CQRSSerializer class. Method signatures and docstrings: - def get_default_fields(self): Return the PARTIAL set of default fields for the object, as a dict. This differs from :meth:`rest_framework.serializers.ModelSerializer....
Implement the Python class `CQRSSerializer` described below. Class description: Implement the CQRSSerializer class. Method signatures and docstrings: - def get_default_fields(self): Return the PARTIAL set of default fields for the object, as a dict. This differs from :meth:`rest_framework.serializers.ModelSerializer....
72dfb45220000bed3b506885c0196bc2e4540836
<|skeleton|> class CQRSSerializer: def get_default_fields(self): """Return the PARTIAL set of default fields for the object, as a dict. This differs from :meth:`rest_framework.serializers.ModelSerializer.get_default_fields` in that it only returns the *newly added fields*: that is, the fields from this cla...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CQRSSerializer: def get_default_fields(self): """Return the PARTIAL set of default fields for the object, as a dict. This differs from :meth:`rest_framework.serializers.ModelSerializer.get_default_fields` in that it only returns the *newly added fields*: that is, the fields from this class but not fro...
the_stack_v2_python_sparse
cqrs/serializers.py
xyicheng/cqrs
train
0
df8f59313bf3025e8b5a8226de2977d518ae67e7
[ "assert request.user.is_authenticated()\nurl = reverse('user_dashboard')\nreturn url", "if len(accounts) == 1:\n if not account.user.has_usable_password():\n raise ValidationError(_('Your account has no password set up.'))" ]
<|body_start_0|> assert request.user.is_authenticated() url = reverse('user_dashboard') return url <|end_body_0|> <|body_start_1|> if len(accounts) == 1: if not account.user.has_usable_password(): raise ValidationError(_('Your account has no password set up.'...
MySocialAdapter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MySocialAdapter: def get_connect_redirect_url(self, request, socialaccount): """Returns the default URL to redirect to after successfully connecting a social account.""" <|body_0|> def validate_disconnect(self, account, accounts): """Validate whether or not the socia...
stack_v2_sparse_classes_75kplus_train_070884
14,787
no_license
[ { "docstring": "Returns the default URL to redirect to after successfully connecting a social account.", "name": "get_connect_redirect_url", "signature": "def get_connect_redirect_url(self, request, socialaccount)" }, { "docstring": "Validate whether or not the socialaccount account can be safel...
2
stack_v2_sparse_classes_30k_val_002142
Implement the Python class `MySocialAdapter` described below. Class description: Implement the MySocialAdapter class. Method signatures and docstrings: - def get_connect_redirect_url(self, request, socialaccount): Returns the default URL to redirect to after successfully connecting a social account. - def validate_di...
Implement the Python class `MySocialAdapter` described below. Class description: Implement the MySocialAdapter class. Method signatures and docstrings: - def get_connect_redirect_url(self, request, socialaccount): Returns the default URL to redirect to after successfully connecting a social account. - def validate_di...
d0ec2300b07af51deeeece42590110c37c90493f
<|skeleton|> class MySocialAdapter: def get_connect_redirect_url(self, request, socialaccount): """Returns the default URL to redirect to after successfully connecting a social account.""" <|body_0|> def validate_disconnect(self, account, accounts): """Validate whether or not the socia...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MySocialAdapter: def get_connect_redirect_url(self, request, socialaccount): """Returns the default URL to redirect to after successfully connecting a social account.""" assert request.user.is_authenticated() url = reverse('user_dashboard') return url def validate_disconne...
the_stack_v2_python_sparse
thoughtbubble/views.py
mattiek/thoughtbubble.us
train
0
91dd295a10f901f2f06c9dc663d21a83b06293a3
[ "env = rwrl.load(domain_name=domain_name, task_name=task_name, safety_spec={'enable': False}, multiobj_spec={'enable': True, 'objective': 'safety', 'observed': True, 'coeff': 0.5})\nwith self.assertRaises(Exception):\n env.reset()\n env.step(0)", "multiobj_class = lambda: multiobj_objectives.SafetyObjective...
<|body_start_0|> env = rwrl.load(domain_name=domain_name, task_name=task_name, safety_spec={'enable': False}, multiobj_spec={'enable': True, 'objective': 'safety', 'observed': True, 'coeff': 0.5}) with self.assertRaises(Exception): env.reset() env.step(0) <|end_body_0|> <|body_s...
MultiObjTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiObjTest: def testMultiObjNoSafety(self, domain_name, task_name): """Ensure multi-objective safety reward can be loaded.""" <|body_0|> def testMultiObjPassedObjective(self, domain_name, task_name): """Ensure objective class can be passed directly.""" <|bo...
stack_v2_sparse_classes_75kplus_train_070885
5,094
permissive
[ { "docstring": "Ensure multi-objective safety reward can be loaded.", "name": "testMultiObjNoSafety", "signature": "def testMultiObjNoSafety(self, domain_name, task_name)" }, { "docstring": "Ensure objective class can be passed directly.", "name": "testMultiObjPassedObjective", "signatur...
4
stack_v2_sparse_classes_30k_train_030928
Implement the Python class `MultiObjTest` described below. Class description: Implement the MultiObjTest class. Method signatures and docstrings: - def testMultiObjNoSafety(self, domain_name, task_name): Ensure multi-objective safety reward can be loaded. - def testMultiObjPassedObjective(self, domain_name, task_name...
Implement the Python class `MultiObjTest` described below. Class description: Implement the MultiObjTest class. Method signatures and docstrings: - def testMultiObjNoSafety(self, domain_name, task_name): Ensure multi-objective safety reward can be loaded. - def testMultiObjPassedObjective(self, domain_name, task_name...
6151ab704220cf192603962a659a0fbe792854e9
<|skeleton|> class MultiObjTest: def testMultiObjNoSafety(self, domain_name, task_name): """Ensure multi-objective safety reward can be loaded.""" <|body_0|> def testMultiObjPassedObjective(self, domain_name, task_name): """Ensure objective class can be passed directly.""" <|bo...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MultiObjTest: def testMultiObjNoSafety(self, domain_name, task_name): """Ensure multi-objective safety reward can be loaded.""" env = rwrl.load(domain_name=domain_name, task_name=task_name, safety_spec={'enable': False}, multiobj_spec={'enable': True, 'objective': 'safety', 'observed': True, '...
the_stack_v2_python_sparse
realworldrl_suite/utils/multiobj_objectives_test.py
jamesgmccarthy/realworldrl_suite
train
0
d3db2089f93c64776a5e83dfef70b3339292d74e
[ "super(MKRNN_lstm, self).__init__()\nself.input_size = input_size\nself.history = history\nself.hidden_size_1 = hidden_size_1\nself.hidden_size_2 = hidden_size_2\nself.hidden_size_3 = hidden_size_3\nself.output_vec = output_vec\nself.lstm = nn.LSTM(self.input_size * self.input_size, self.hidden_size_1, num_layers=s...
<|body_start_0|> super(MKRNN_lstm, self).__init__() self.input_size = input_size self.history = history self.hidden_size_1 = hidden_size_1 self.hidden_size_2 = hidden_size_2 self.hidden_size_3 = hidden_size_3 self.output_vec = output_vec self.lstm = nn.LST...
MKRNN_lstm
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MKRNN_lstm: def __init__(self): """Recurrent Neural Network (RNN) architecture of Mario Kart AI agent with LSTM.""" <|body_0|> def forward(self, x): """Forward pass of the neural network. Accepts a tensor of size input_size*input_size.""" <|body_1|> <|end_sk...
stack_v2_sparse_classes_75kplus_train_070886
4,744
permissive
[ { "docstring": "Recurrent Neural Network (RNN) architecture of Mario Kart AI agent with LSTM.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Forward pass of the neural network. Accepts a tensor of size input_size*input_size.", "name": "forward", "signature": "...
2
stack_v2_sparse_classes_30k_train_014801
Implement the Python class `MKRNN_lstm` described below. Class description: Implement the MKRNN_lstm class. Method signatures and docstrings: - def __init__(self): Recurrent Neural Network (RNN) architecture of Mario Kart AI agent with LSTM. - def forward(self, x): Forward pass of the neural network. Accepts a tensor...
Implement the Python class `MKRNN_lstm` described below. Class description: Implement the MKRNN_lstm class. Method signatures and docstrings: - def __init__(self): Recurrent Neural Network (RNN) architecture of Mario Kart AI agent with LSTM. - def forward(self, x): Forward pass of the neural network. Accepts a tensor...
c8a7d0f84ca39b41ebd3acb3791dd19cd7907264
<|skeleton|> class MKRNN_lstm: def __init__(self): """Recurrent Neural Network (RNN) architecture of Mario Kart AI agent with LSTM.""" <|body_0|> def forward(self, x): """Forward pass of the neural network. Accepts a tensor of size input_size*input_size.""" <|body_1|> <|end_sk...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MKRNN_lstm: def __init__(self): """Recurrent Neural Network (RNN) architecture of Mario Kart AI agent with LSTM.""" super(MKRNN_lstm, self).__init__() self.input_size = input_size self.history = history self.hidden_size_1 = hidden_size_1 self.hidden_size_2 = hid...
the_stack_v2_python_sparse
src/agents/mk_rnn_lstm_train.py
adriendod/dolphin-env-api
train
0
41198ce9da384a16735542f1f4bc4add95eee09f
[ "from basic_info.url_info import create_zmod_flow_url\nresponse = requests.post(url=create_zmod_flow_url, headers=get_headers(HOST_189), json=zmod_id)\nself.assertEqual(200, response.status_code, '分析任务创建失败')\nself.assertEqual(zmod_id[0], response.json()['modelId'], '分析任务的modelId不一致')", "from basic_info.url_info i...
<|body_start_0|> from basic_info.url_info import create_zmod_flow_url response = requests.post(url=create_zmod_flow_url, headers=get_headers(HOST_189), json=zmod_id) self.assertEqual(200, response.status_code, '分析任务创建失败') self.assertEqual(zmod_id[0], response.json()['modelId'], '分析任务的mod...
CasesForZmod
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CasesForZmod: def test_create_Zdaf_flow(self): """创建分析任务-flow""" <|body_0|> def test_query_zdaf_all(self): """查询所有的分析任务""" <|body_1|> def test_query_zdaf_by_name(self): """按照分析模板名称查询分析任务""" <|body_2|> def test_query_zdaf_by_time(self...
stack_v2_sparse_classes_75kplus_train_070887
5,767
no_license
[ { "docstring": "创建分析任务-flow", "name": "test_create_Zdaf_flow", "signature": "def test_create_Zdaf_flow(self)" }, { "docstring": "查询所有的分析任务", "name": "test_query_zdaf_all", "signature": "def test_query_zdaf_all(self)" }, { "docstring": "按照分析模板名称查询分析任务", "name": "test_query_zda...
6
stack_v2_sparse_classes_30k_train_028545
Implement the Python class `CasesForZmod` described below. Class description: Implement the CasesForZmod class. Method signatures and docstrings: - def test_create_Zdaf_flow(self): 创建分析任务-flow - def test_query_zdaf_all(self): 查询所有的分析任务 - def test_query_zdaf_by_name(self): 按照分析模板名称查询分析任务 - def test_query_zdaf_by_time(...
Implement the Python class `CasesForZmod` described below. Class description: Implement the CasesForZmod class. Method signatures and docstrings: - def test_create_Zdaf_flow(self): 创建分析任务-flow - def test_query_zdaf_all(self): 查询所有的分析任务 - def test_query_zdaf_by_name(self): 按照分析模板名称查询分析任务 - def test_query_zdaf_by_time(...
fc41513af3063169ff1b17d6f01f7074057ceb1f
<|skeleton|> class CasesForZmod: def test_create_Zdaf_flow(self): """创建分析任务-flow""" <|body_0|> def test_query_zdaf_all(self): """查询所有的分析任务""" <|body_1|> def test_query_zdaf_by_name(self): """按照分析模板名称查询分析任务""" <|body_2|> def test_query_zdaf_by_time(self...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CasesForZmod: def test_create_Zdaf_flow(self): """创建分析任务-flow""" from basic_info.url_info import create_zmod_flow_url response = requests.post(url=create_zmod_flow_url, headers=get_headers(HOST_189), json=zmod_id) self.assertEqual(200, response.status_code, '分析任务创建失败') ...
the_stack_v2_python_sparse
singl_api/api_test_cases/cases_for_analysis_zmod.py
bingjiegu/For_API
train
0
bd1b24f536bd75a33690848d4b8f6eee045cf609
[ "self.context = context\nself.field = field\nself.widget = widget", "html = self.widget.render().strip()\ntransforms = getToolByName(self.context, 'portal_transforms')\nstream = transforms.convertTo('text/plain', html, mimetype='text/html')\nreturn stream.getData().strip()" ]
<|body_start_0|> self.context = context self.field = field self.widget = widget <|end_body_0|> <|body_start_1|> html = self.widget.render().strip() transforms = getToolByName(self.context, 'portal_transforms') stream = transforms.convertTo('text/plain', html, mimetype='t...
Fallback field converter which uses the rendered widget in display mode for generating a indexable string.
DefaultDexterityTextIndexFieldConverter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DefaultDexterityTextIndexFieldConverter: """Fallback field converter which uses the rendered widget in display mode for generating a indexable string.""" def __init__(self, context, field, widget): """Initialize field converter""" <|body_0|> def convert(self): ""...
stack_v2_sparse_classes_75kplus_train_070888
5,051
no_license
[ { "docstring": "Initialize field converter", "name": "__init__", "signature": "def __init__(self, context, field, widget)" }, { "docstring": "Convert the adapted field value to text/plain for indexing", "name": "convert", "signature": "def convert(self)" } ]
2
stack_v2_sparse_classes_30k_train_006827
Implement the Python class `DefaultDexterityTextIndexFieldConverter` described below. Class description: Fallback field converter which uses the rendered widget in display mode for generating a indexable string. Method signatures and docstrings: - def __init__(self, context, field, widget): Initialize field converter...
Implement the Python class `DefaultDexterityTextIndexFieldConverter` described below. Class description: Fallback field converter which uses the rendered widget in display mode for generating a indexable string. Method signatures and docstrings: - def __init__(self, context, field, widget): Initialize field converter...
51827ba0f63d8d342a360cd4b10213fd3a29557f
<|skeleton|> class DefaultDexterityTextIndexFieldConverter: """Fallback field converter which uses the rendered widget in display mode for generating a indexable string.""" def __init__(self, context, field, widget): """Initialize field converter""" <|body_0|> def convert(self): ""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DefaultDexterityTextIndexFieldConverter: """Fallback field converter which uses the rendered widget in display mode for generating a indexable string.""" def __init__(self, context, field, widget): """Initialize field converter""" self.context = context self.field = field ...
the_stack_v2_python_sparse
plone/app/dexterity/textindexer/converters.py
plone/plone.app.dexterity
train
12
4e482c97403eb574d7d474828ef7c598716d9a37
[ "nums, curr = ([], head)\nwhile curr:\n nums.append(curr.val)\n curr = curr.next\nreturn self.sortedArrayToBST(nums)", "if nums:\n l = len(nums)\n root = TreeNode(nums[l // 2])\n root.left = self.sortedArrayToBST(nums[:l // 2])\n root.right = self.sortedArrayToBST(nums[l // 2 + 1:])\n return ...
<|body_start_0|> nums, curr = ([], head) while curr: nums.append(curr.val) curr = curr.next return self.sortedArrayToBST(nums) <|end_body_0|> <|body_start_1|> if nums: l = len(nums) root = TreeNode(nums[l // 2]) root.left = sel...
Solution2
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution2: def sortedListToBST(self, head): """:type head: ListNode :rtype: TreeNode""" <|body_0|> def sortedArrayToBST(self, nums): """:type nums: List[int] :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_start_0|> nums, curr = ([], head) ...
stack_v2_sparse_classes_75kplus_train_070889
2,265
no_license
[ { "docstring": ":type head: ListNode :rtype: TreeNode", "name": "sortedListToBST", "signature": "def sortedListToBST(self, head)" }, { "docstring": ":type nums: List[int] :rtype: TreeNode", "name": "sortedArrayToBST", "signature": "def sortedArrayToBST(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_047241
Implement the Python class `Solution2` described below. Class description: Implement the Solution2 class. Method signatures and docstrings: - def sortedListToBST(self, head): :type head: ListNode :rtype: TreeNode - def sortedArrayToBST(self, nums): :type nums: List[int] :rtype: TreeNode
Implement the Python class `Solution2` described below. Class description: Implement the Solution2 class. Method signatures and docstrings: - def sortedListToBST(self, head): :type head: ListNode :rtype: TreeNode - def sortedArrayToBST(self, nums): :type nums: List[int] :rtype: TreeNode <|skeleton|> class Solution2:...
80e78b153ad2bdfb52070ba75b166a4237847d75
<|skeleton|> class Solution2: def sortedListToBST(self, head): """:type head: ListNode :rtype: TreeNode""" <|body_0|> def sortedArrayToBST(self, nums): """:type nums: List[int] :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution2: def sortedListToBST(self, head): """:type head: ListNode :rtype: TreeNode""" nums, curr = ([], head) while curr: nums.append(curr.val) curr = curr.next return self.sortedArrayToBST(nums) def sortedArrayToBST(self, nums): """:type ...
the_stack_v2_python_sparse
109-sortedListToBST.py
MarshalLeeeeee/myLeetCodes
train
0
d2a87154c7814ebd9665492e053a378d3a907842
[ "index = 'test_index'\nsketch_id = 1\nfor seq_sessionizer_class in self.seq_sessionizer_classes:\n sessionizer = seq_sessionizer_class(index, sketch_id)\n self.assertIsInstance(sessionizer, seq_sessionizer_class)\n self.assertEqual(index, sessionizer.index_name)\n self.assertEqual(sketch_id, sessionizer...
<|body_start_0|> index = 'test_index' sketch_id = 1 for seq_sessionizer_class in self.seq_sessionizer_classes: sessionizer = seq_sessionizer_class(index, sketch_id) self.assertIsInstance(sessionizer, seq_sessionizer_class) self.assertEqual(index, sessionizer.i...
Tests base functionality of sequence sessionizing sketch analyzers with one event in the even_seq which are listed in seq_sessionizer_classes. Attributes: seq_sessionizer_classes: A list of sequence sessionizer classes to test.
TestOneEventSequenceSessionizerPlugin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestOneEventSequenceSessionizerPlugin: """Tests base functionality of sequence sessionizing sketch analyzers with one event in the even_seq which are listed in seq_sessionizer_classes. Attributes: seq_sessionizer_classes: A list of sequence sessionizer classes to test.""" def test_sessionize...
stack_v2_sparse_classes_75kplus_train_070890
21,891
permissive
[ { "docstring": "Test basic sequence sessionizer functionality.", "name": "test_sessionizer", "signature": "def test_sessionizer(self)" }, { "docstring": "Test one sequence of events is finded and allocated as a session.", "name": "test_one_session", "signature": "def test_one_session(sel...
5
stack_v2_sparse_classes_30k_train_026047
Implement the Python class `TestOneEventSequenceSessionizerPlugin` described below. Class description: Tests base functionality of sequence sessionizing sketch analyzers with one event in the even_seq which are listed in seq_sessionizer_classes. Attributes: seq_sessionizer_classes: A list of sequence sessionizer class...
Implement the Python class `TestOneEventSequenceSessionizerPlugin` described below. Class description: Tests base functionality of sequence sessionizing sketch analyzers with one event in the even_seq which are listed in seq_sessionizer_classes. Attributes: seq_sessionizer_classes: A list of sequence sessionizer class...
24f471b58ca4a87cb053961b5f05c07a544ca7b8
<|skeleton|> class TestOneEventSequenceSessionizerPlugin: """Tests base functionality of sequence sessionizing sketch analyzers with one event in the even_seq which are listed in seq_sessionizer_classes. Attributes: seq_sessionizer_classes: A list of sequence sessionizer classes to test.""" def test_sessionize...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestOneEventSequenceSessionizerPlugin: """Tests base functionality of sequence sessionizing sketch analyzers with one event in the even_seq which are listed in seq_sessionizer_classes. Attributes: seq_sessionizer_classes: A list of sequence sessionizer classes to test.""" def test_sessionizer(self): ...
the_stack_v2_python_sparse
timesketch/lib/analyzers/sequence_sessionizer_test.py
google/timesketch
train
2,263
2075b971f03f8e940fa92c31f6035a2c069d975b
[ "super().__init__(hyperparams, protocol_handler, None, None, **kwargs)\nself.name = 'Shuffle-Iterative-Weight-Average'\nself.trainingid = 0\nrandom.seed(datetime.now())", "self.curr_round = 0\nwhile not self.reach_termination_criteria(self.curr_round):\n if self.current_model_weights:\n model_update = M...
<|body_start_0|> super().__init__(hyperparams, protocol_handler, None, None, **kwargs) self.name = 'Shuffle-Iterative-Weight-Average' self.trainingid = 0 random.seed(datetime.now()) <|end_body_0|> <|body_start_1|> self.curr_round = 0 while not self.reach_termination_crit...
Class for shuffle iterative averaging based fusion algorithms. Implements the shuffle aggregation algorithm presented in Section 4.3: https://arxiv.org/pdf/2105.09400.pdf
ShuffleIterAvgFusionHandler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ShuffleIterAvgFusionHandler: """Class for shuffle iterative averaging based fusion algorithms. Implements the shuffle aggregation algorithm presented in Section 4.3: https://arxiv.org/pdf/2105.09400.pdf""" def __init__(self, hyperparams, protocol_handler, data_handler=None, fl_model=None, **...
stack_v2_sparse_classes_75kplus_train_070891
2,594
permissive
[ { "docstring": "Initializes an IterAvgFusionHandler object with provided information, such as protocol handler and hyperparams.", "name": "__init__", "signature": "def __init__(self, hyperparams, protocol_handler, data_handler=None, fl_model=None, **kwargs)" }, { "docstring": "Starts an iterativ...
2
stack_v2_sparse_classes_30k_train_039166
Implement the Python class `ShuffleIterAvgFusionHandler` described below. Class description: Class for shuffle iterative averaging based fusion algorithms. Implements the shuffle aggregation algorithm presented in Section 4.3: https://arxiv.org/pdf/2105.09400.pdf Method signatures and docstrings: - def __init__(self,...
Implement the Python class `ShuffleIterAvgFusionHandler` described below. Class description: Class for shuffle iterative averaging based fusion algorithms. Implements the shuffle aggregation algorithm presented in Section 4.3: https://arxiv.org/pdf/2105.09400.pdf Method signatures and docstrings: - def __init__(self,...
64ffa2ee2e906b1bd6b3dd6aabcf6fc3de862608
<|skeleton|> class ShuffleIterAvgFusionHandler: """Class for shuffle iterative averaging based fusion algorithms. Implements the shuffle aggregation algorithm presented in Section 4.3: https://arxiv.org/pdf/2105.09400.pdf""" def __init__(self, hyperparams, protocol_handler, data_handler=None, fl_model=None, **...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ShuffleIterAvgFusionHandler: """Class for shuffle iterative averaging based fusion algorithms. Implements the shuffle aggregation algorithm presented in Section 4.3: https://arxiv.org/pdf/2105.09400.pdf""" def __init__(self, hyperparams, protocol_handler, data_handler=None, fl_model=None, **kwargs): ...
the_stack_v2_python_sparse
debugging-constructs/ibmfl/aggregator/fusion/shuffle_iter_avg_fusion_handler.py
SEED-VT/FedDebug
train
8
2cee7f7f2890f783e8285994679b0d1d82fc2796
[ "if len(matrix) == 0 or len(matrix[0]) == 0:\n return matrix\nfor i in range(len(matrix)):\n for j in range(len(matrix[0])):\n if matrix[i][j] == 0:\n continue\n else:\n matrix[i][j] = float('inf')\n for k in range(len(matrix)):\n for c in range(le...
<|body_start_0|> if len(matrix) == 0 or len(matrix[0]) == 0: return matrix for i in range(len(matrix)): for j in range(len(matrix[0])): if matrix[i][j] == 0: continue else: matrix[i][j] = float('inf') ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def updateMatrix1(self, matrix): """:type matrix: List[List[int]] :rtype: List[List[int]]""" <|body_0|> def updateMatrix2(self, matrix): """:type matrix: List[List[int]] :rtype: List[List[int]]""" <|body_1|> def updateMatrix(self, matrix): ...
stack_v2_sparse_classes_75kplus_train_070892
2,501
no_license
[ { "docstring": ":type matrix: List[List[int]] :rtype: List[List[int]]", "name": "updateMatrix1", "signature": "def updateMatrix1(self, matrix)" }, { "docstring": ":type matrix: List[List[int]] :rtype: List[List[int]]", "name": "updateMatrix2", "signature": "def updateMatrix2(self, matrix...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def updateMatrix1(self, matrix): :type matrix: List[List[int]] :rtype: List[List[int]] - def updateMatrix2(self, matrix): :type matrix: List[List[int]] :rtype: List[List[int]] - ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def updateMatrix1(self, matrix): :type matrix: List[List[int]] :rtype: List[List[int]] - def updateMatrix2(self, matrix): :type matrix: List[List[int]] :rtype: List[List[int]] - ...
e5b018493bbd12edcdcd0434f35d9c358106d391
<|skeleton|> class Solution: def updateMatrix1(self, matrix): """:type matrix: List[List[int]] :rtype: List[List[int]]""" <|body_0|> def updateMatrix2(self, matrix): """:type matrix: List[List[int]] :rtype: List[List[int]]""" <|body_1|> def updateMatrix(self, matrix): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def updateMatrix1(self, matrix): """:type matrix: List[List[int]] :rtype: List[List[int]]""" if len(matrix) == 0 or len(matrix[0]) == 0: return matrix for i in range(len(matrix)): for j in range(len(matrix[0])): if matrix[i][j] == 0: ...
the_stack_v2_python_sparse
py/leetcode/542.py
wfeng1991/learnpy
train
0
1a01cdf84b1a3985a01b70ecfe0fe134dd0171c8
[ "test_user = User.objects.create_user(username='test_patient', first_name='test', last_name='patient', email='test@123.com', password='1234')\ntest_user.save()\ntest_patient_user_id = 1\ntest_patient = Patient(user_id=test_patient_user_id, first_name='test', last_name='patient', contact_number=1231231234, emergency...
<|body_start_0|> test_user = User.objects.create_user(username='test_patient', first_name='test', last_name='patient', email='test@123.com', password='1234') test_user.save() test_patient_user_id = 1 test_patient = Patient(user_id=test_patient_user_id, first_name='test', last_name='patie...
Class containing all of the Patient model test cases.
PatientTestCase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PatientTestCase: """Class containing all of the Patient model test cases.""" def test_patient_creation(self): """Tests that Patients are created correctly and linked to a User correctly. :return: None""" <|body_0|> def test_update_patient_info(self): """Tests tha...
stack_v2_sparse_classes_75kplus_train_070893
8,064
no_license
[ { "docstring": "Tests that Patients are created correctly and linked to a User correctly. :return: None", "name": "test_patient_creation", "signature": "def test_patient_creation(self)" }, { "docstring": "Tests that Patients can update their information correctly. :return: None", "name": "te...
2
null
Implement the Python class `PatientTestCase` described below. Class description: Class containing all of the Patient model test cases. Method signatures and docstrings: - def test_patient_creation(self): Tests that Patients are created correctly and linked to a User correctly. :return: None - def test_update_patient_...
Implement the Python class `PatientTestCase` described below. Class description: Class containing all of the Patient model test cases. Method signatures and docstrings: - def test_patient_creation(self): Tests that Patients are created correctly and linked to a User correctly. :return: None - def test_update_patient_...
5a867d272dc1576184ac067347f38544e7dc41f1
<|skeleton|> class PatientTestCase: """Class containing all of the Patient model test cases.""" def test_patient_creation(self): """Tests that Patients are created correctly and linked to a User correctly. :return: None""" <|body_0|> def test_update_patient_info(self): """Tests tha...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PatientTestCase: """Class containing all of the Patient model test cases.""" def test_patient_creation(self): """Tests that Patients are created correctly and linked to a User correctly. :return: None""" test_user = User.objects.create_user(username='test_patient', first_name='test', last...
the_stack_v2_python_sparse
healthnet_site/healthnet/tests.py
ug1086/HealthNet
train
0
0a1fbcea8b2d35f7a5a97cd8e8ea24474eda85ec
[ "self.app_id = app_id\nself.input_params = input_params\nself.mr_input = mr_input\nself.mr_output = mr_output", "if dictionary is None:\n return None\napp_id = dictionary.get('appId')\ninput_params = None\nif dictionary.get('inputParams') != None:\n input_params = list()\n for structure in dictionary.get...
<|body_start_0|> self.app_id = app_id self.input_params = input_params self.mr_input = mr_input self.mr_output = mr_output <|end_body_0|> <|body_start_1|> if dictionary is None: return None app_id = dictionary.get('appId') input_params = None ...
Implementation of the 'RunMapReduceParams' model. RunMapReduceParams specifies the input params to run a map reduce instance. Attributes: app_id (long|int): ApplicationId is the Id of the map reduce application to run. input_params (list of MapReduceInstance_InputParam): InputParams specifies optional list of key=value...
RunMapReduceParams
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RunMapReduceParams: """Implementation of the 'RunMapReduceParams' model. RunMapReduceParams specifies the input params to run a map reduce instance. Attributes: app_id (long|int): ApplicationId is the Id of the map reduce application to run. input_params (list of MapReduceInstance_InputParam): In...
stack_v2_sparse_classes_75kplus_train_070894
3,036
permissive
[ { "docstring": "Constructor for the RunMapReduceParams class", "name": "__init__", "signature": "def __init__(self, app_id=None, input_params=None, mr_input=None, mr_output=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary r...
2
stack_v2_sparse_classes_30k_train_016009
Implement the Python class `RunMapReduceParams` described below. Class description: Implementation of the 'RunMapReduceParams' model. RunMapReduceParams specifies the input params to run a map reduce instance. Attributes: app_id (long|int): ApplicationId is the Id of the map reduce application to run. input_params (li...
Implement the Python class `RunMapReduceParams` described below. Class description: Implementation of the 'RunMapReduceParams' model. RunMapReduceParams specifies the input params to run a map reduce instance. Attributes: app_id (long|int): ApplicationId is the Id of the map reduce application to run. input_params (li...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class RunMapReduceParams: """Implementation of the 'RunMapReduceParams' model. RunMapReduceParams specifies the input params to run a map reduce instance. Attributes: app_id (long|int): ApplicationId is the Id of the map reduce application to run. input_params (list of MapReduceInstance_InputParam): In...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RunMapReduceParams: """Implementation of the 'RunMapReduceParams' model. RunMapReduceParams specifies the input params to run a map reduce instance. Attributes: app_id (long|int): ApplicationId is the Id of the map reduce application to run. input_params (list of MapReduceInstance_InputParam): InputParams spe...
the_stack_v2_python_sparse
cohesity_management_sdk/models/run_map_reduce_params.py
cohesity/management-sdk-python
train
24
220773e4901a9de02e4dcc20a33822e30ebcfa05
[ "\"\"\"Columns in Project table\"\"\"\nself.project_id = project_id\nself.title = title\nself.max_students = max_students\nself.description_id = description_id\nself.research_group = research_group\nself.is_active = is_active\nself.last_updated = last_updated\nself.view_count = view_count\nself.extension = extensio...
<|body_start_0|> """Columns in Project table""" self.project_id = project_id self.title = title self.max_students = max_students self.description_id = description_id self.research_group = research_group self.is_active = is_active self.last_updated = last_u...
This class defines a project.
Project
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Project: """This class defines a project.""" def __init__(self, project_id, title, max_students, description_id, research_group, is_active, last_updated, view_count, extension, creation_date=date.today().strftime('%Y-%m-%d')): """Project initializer. :param project_id: The project ID...
stack_v2_sparse_classes_75kplus_train_070895
21,513
permissive
[ { "docstring": "Project initializer. :param project_id: The project ID. :param title: The title of the project. :param max_students: The maxumum amount of student that can participate in the project. :param description_id: The ID of the document containing the desciption. :param research_group: The ID of the co...
2
null
Implement the Python class `Project` described below. Class description: This class defines a project. Method signatures and docstrings: - def __init__(self, project_id, title, max_students, description_id, research_group, is_active, last_updated, view_count, extension, creation_date=date.today().strftime('%Y-%m-%d')...
Implement the Python class `Project` described below. Class description: This class defines a project. Method signatures and docstrings: - def __init__(self, project_id, title, max_students, description_id, research_group, is_active, last_updated, view_count, extension, creation_date=date.today().strftime('%Y-%m-%d')...
6f2129d60954b198f233e75956a4f5c675a03cbc
<|skeleton|> class Project: """This class defines a project.""" def __init__(self, project_id, title, max_students, description_id, research_group, is_active, last_updated, view_count, extension, creation_date=date.today().strftime('%Y-%m-%d')): """Project initializer. :param project_id: The project ID...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Project: """This class defines a project.""" def __init__(self, project_id, title, max_students, description_id, research_group, is_active, last_updated, view_count, extension, creation_date=date.today().strftime('%Y-%m-%d')): """Project initializer. :param project_id: The project ID. :param titl...
the_stack_v2_python_sparse
src/models/project.py
MaxVanHoucke/esp-uantwerp
train
0
30f126b48c2c2c1b925fdb0453832f01e9b22b0a
[ "cls.endpoint = '/api/courseadmin/'\ncls.course = CourseFactory(name='Course', description='Description', start='2020-01-05', cost=5000, deleted=False)\ncls.administrator = AdministratorFactory(user__username='administrator', user__first_name='Name', user__last_name='Surname', about='About administrator')\ncls.supe...
<|body_start_0|> cls.endpoint = '/api/courseadmin/' cls.course = CourseFactory(name='Course', description='Description', start='2020-01-05', cost=5000, deleted=False) cls.administrator = AdministratorFactory(user__username='administrator', user__first_name='Name', user__last_name='Surname', abou...
Тесты свзи администратора с курсом
CourseAdminTestCase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CourseAdminTestCase: """Тесты свзи администратора с курсом""" def setUpTestData(cls): """Данные для тесткейса""" <|body_0|> def test_course_admin_list(self): """Список связей администраторов с курсами""" <|body_1|> def test_get_course_admin(self): ...
stack_v2_sparse_classes_75kplus_train_070896
33,302
no_license
[ { "docstring": "Данные для тесткейса", "name": "setUpTestData", "signature": "def setUpTestData(cls)" }, { "docstring": "Список связей администраторов с курсами", "name": "test_course_admin_list", "signature": "def test_course_admin_list(self)" }, { "docstring": "Получение связи ...
5
stack_v2_sparse_classes_30k_train_005529
Implement the Python class `CourseAdminTestCase` described below. Class description: Тесты свзи администратора с курсом Method signatures and docstrings: - def setUpTestData(cls): Данные для тесткейса - def test_course_admin_list(self): Список связей администраторов с курсами - def test_get_course_admin(self): Получе...
Implement the Python class `CourseAdminTestCase` described below. Class description: Тесты свзи администратора с курсом Method signatures and docstrings: - def setUpTestData(cls): Данные для тесткейса - def test_course_admin_list(self): Список связей администраторов с курсами - def test_get_course_admin(self): Получе...
3de0f8eeb4dbf9ec37b17ece0dde51c9e0f381ac
<|skeleton|> class CourseAdminTestCase: """Тесты свзи администратора с курсом""" def setUpTestData(cls): """Данные для тесткейса""" <|body_0|> def test_course_admin_list(self): """Список связей администраторов с курсами""" <|body_1|> def test_get_course_admin(self): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CourseAdminTestCase: """Тесты свзи администратора с курсом""" def setUpTestData(cls): """Данные для тесткейса""" cls.endpoint = '/api/courseadmin/' cls.course = CourseFactory(name='Course', description='Description', start='2020-01-05', cost=5000, deleted=False) cls.admini...
the_stack_v2_python_sparse
education_django/education_app/test_api.py
ilyaignatyev/python-web-otus-ru
train
0
4bb4dd9873c4f45e1d43dee83a23174fc6c14962
[ "def inner(self, loan, **kwargs):\n document_pid = kwargs.get('document_pid')\n if document_pid and (not kwargs.get('item_pid')):\n available_item_pid = get_available_item_by_doc_pid(document_pid)\n if available_item_pid:\n kwargs['item_pid'] = available_item_pid\n return f(self, l...
<|body_start_0|> def inner(self, loan, **kwargs): document_pid = kwargs.get('document_pid') if document_pid and (not kwargs.get('item_pid')): available_item_pid = get_available_item_by_doc_pid(document_pid) if available_item_pid: kwargs...
Action to request to loan an item.
CreatedToPending
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CreatedToPending: """Action to request to loan an item.""" def check_request_on_document(f): """Decorator to check if the request is on document.""" <|body_0|> def before(self, loan, **kwargs): """Set a default pickup location if not passed as param.""" <...
stack_v2_sparse_classes_75kplus_train_070897
9,784
permissive
[ { "docstring": "Decorator to check if the request is on document.", "name": "check_request_on_document", "signature": "def check_request_on_document(f)" }, { "docstring": "Set a default pickup location if not passed as param.", "name": "before", "signature": "def before(self, loan, **kwa...
2
stack_v2_sparse_classes_30k_train_020789
Implement the Python class `CreatedToPending` described below. Class description: Action to request to loan an item. Method signatures and docstrings: - def check_request_on_document(f): Decorator to check if the request is on document. - def before(self, loan, **kwargs): Set a default pickup location if not passed a...
Implement the Python class `CreatedToPending` described below. Class description: Action to request to loan an item. Method signatures and docstrings: - def check_request_on_document(f): Decorator to check if the request is on document. - def before(self, loan, **kwargs): Set a default pickup location if not passed a...
ad47dbd4e086f4d4a889d4039960f710cb291c6d
<|skeleton|> class CreatedToPending: """Action to request to loan an item.""" def check_request_on_document(f): """Decorator to check if the request is on document.""" <|body_0|> def before(self, loan, **kwargs): """Set a default pickup location if not passed as param.""" <...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CreatedToPending: """Action to request to loan an item.""" def check_request_on_document(f): """Decorator to check if the request is on document.""" def inner(self, loan, **kwargs): document_pid = kwargs.get('document_pid') if document_pid and (not kwargs.get('item...
the_stack_v2_python_sparse
invenio_circulation/transitions/transitions.py
zzacharo/invenio-circulation
train
0
744f5688727cef7d9e61a7743aee29b734624260
[ "def minFunc(param):\n \"\"\" The function to minimize - negative log likelihood\n of the data given the parameters \"\"\"\n logLikelihood = GeneralizedParetoDistribution.logLikelihood(param[0], param[1], data)\n return -logLikelihood if logLikelihood is not None else np.inf\nparams, bestCost, ...
<|body_start_0|> def minFunc(param): """ The function to minimize - negative log likelihood of the data given the parameters """ logLikelihood = GeneralizedParetoDistribution.logLikelihood(param[0], param[1], data) return -logLikelihood if logLikelihood i...
GpdEstimate
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GpdEstimate: def psoMethod(data, initialPos, inertiaCoeff=1, inertiaDamp=0.99, personalCoeff=2, socialCoeff=2, numIterations=20): """PSO method for maximum likelihood estimation of GPD's parameters :param data: the data, it is a numpy array of shape (n,) :param initialPos: initial positi...
stack_v2_sparse_classes_75kplus_train_070898
8,218
no_license
[ { "docstring": "PSO method for maximum likelihood estimation of GPD's parameters :param data: the data, it is a numpy array of shape (n,) :param initialPos: initial positions of the particles in the parameter space, it is a numpy array of shape (numParticles, 2) :param inertiaCoeff: coefficient used for updatin...
2
stack_v2_sparse_classes_30k_train_042344
Implement the Python class `GpdEstimate` described below. Class description: Implement the GpdEstimate class. Method signatures and docstrings: - def psoMethod(data, initialPos, inertiaCoeff=1, inertiaDamp=0.99, personalCoeff=2, socialCoeff=2, numIterations=20): PSO method for maximum likelihood estimation of GPD's p...
Implement the Python class `GpdEstimate` described below. Class description: Implement the GpdEstimate class. Method signatures and docstrings: - def psoMethod(data, initialPos, inertiaCoeff=1, inertiaDamp=0.99, personalCoeff=2, socialCoeff=2, numIterations=20): PSO method for maximum likelihood estimation of GPD's p...
62f6fa0d5e832d2d1786eae729d9462b78d9b459
<|skeleton|> class GpdEstimate: def psoMethod(data, initialPos, inertiaCoeff=1, inertiaDamp=0.99, personalCoeff=2, socialCoeff=2, numIterations=20): """PSO method for maximum likelihood estimation of GPD's parameters :param data: the data, it is a numpy array of shape (n,) :param initialPos: initial positi...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GpdEstimate: def psoMethod(data, initialPos, inertiaCoeff=1, inertiaDamp=0.99, personalCoeff=2, socialCoeff=2, numIterations=20): """PSO method for maximum likelihood estimation of GPD's parameters :param data: the data, it is a numpy array of shape (n,) :param initialPos: initial positions of the par...
the_stack_v2_python_sparse
ts/experimental/genpareto.py
tedlaw09/time_series_forecaster
train
1
5af17100e306179729d0992fa926c910ebe2e258
[ "self.uid = uid\nself.type = type_\nself.name = name\nself.styles = {}", "if style.type == 'filter':\n if style.type not in self.styles:\n self.styles[style.type] = []\n self.styles[style.type] += [style]\nelif style.type not in self.styles:\n self.styles[style.type] = style\nelse:\n raise Dupl...
<|body_start_0|> self.uid = uid self.type = type_ self.name = name self.styles = {} <|end_body_0|> <|body_start_1|> if style.type == 'filter': if style.type not in self.styles: self.styles[style.type] = [] self.styles[style.type] += [style...
Represents an Artwork on an Artboard.
Artwork
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Artwork: """Represents an Artwork on an Artboard.""" def __init__(self, uid, type_, name): """Instantiates this Artwork.""" <|body_0|> def add_style(self, style): """Add style to this Artwork's styles. Raises DuplicateStyleTypeException.""" <|body_1|> ...
stack_v2_sparse_classes_75kplus_train_070899
1,214
permissive
[ { "docstring": "Instantiates this Artwork.", "name": "__init__", "signature": "def __init__(self, uid, type_, name)" }, { "docstring": "Add style to this Artwork's styles. Raises DuplicateStyleTypeException.", "name": "add_style", "signature": "def add_style(self, style)" }, { "d...
3
stack_v2_sparse_classes_30k_train_040908
Implement the Python class `Artwork` described below. Class description: Represents an Artwork on an Artboard. Method signatures and docstrings: - def __init__(self, uid, type_, name): Instantiates this Artwork. - def add_style(self, style): Add style to this Artwork's styles. Raises DuplicateStyleTypeException. - de...
Implement the Python class `Artwork` described below. Class description: Represents an Artwork on an Artboard. Method signatures and docstrings: - def __init__(self, uid, type_, name): Instantiates this Artwork. - def add_style(self, style): Add style to this Artwork's styles. Raises DuplicateStyleTypeException. - de...
de3ffe5cec81297c10c6a7cf4577ebdd91245224
<|skeleton|> class Artwork: """Represents an Artwork on an Artboard.""" def __init__(self, uid, type_, name): """Instantiates this Artwork.""" <|body_0|> def add_style(self, style): """Add style to this Artwork's styles. Raises DuplicateStyleTypeException.""" <|body_1|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Artwork: """Represents an Artwork on an Artboard.""" def __init__(self, uid, type_, name): """Instantiates this Artwork.""" self.uid = uid self.type = type_ self.name = name self.styles = {} def add_style(self, style): """Add style to this Artwork's st...
the_stack_v2_python_sparse
xdtools/artwork/artwork.py
umar-ahmed/xdtools
train
51