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
467
8.64k
id
stringlengths
40
40
length_bytes
int64
515
49.7k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
160
3.93k
prompted_full_text
stringlengths
681
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.09k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
331
8.3k
source
stringclasses
1 value
source_path
stringlengths
5
177
source_repo
stringlengths
6
88
split
stringclasses
1 value
star_events_count
int64
0
209k
60e58ae2f11593b81982ec718ac87184974f3d9c
[ "try:\n payload = jwt.decode(data['token'], settings.SECRET_KEY, algorithms=['HS256'])\nexcept ExpiredSignatureError:\n raise serializers.ValidationError('The token has expired.')\nexcept JWTError:\n raise serializers.ValidationError('Error validating token. Ensure is the right token.')\nself.context['payl...
<|body_start_0|> try: payload = jwt.decode(data['token'], settings.SECRET_KEY, algorithms=['HS256']) except ExpiredSignatureError: raise serializers.ValidationError('The token has expired.') except JWTError: raise serializers.ValidationError('Error validating ...
Account verification Serializer that allows to know which user has a verificated account and which doesn't
AccountVerificationSerializer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AccountVerificationSerializer: """Account verification Serializer that allows to know which user has a verificated account and which doesn't""" def validate(self, data): """Validate method for the token""" <|body_0|> def save(self, **kwargs): """Update the user's...
stack_v2_sparse_classes_10k_train_006400
6,022
no_license
[ { "docstring": "Validate method for the token", "name": "validate", "signature": "def validate(self, data)" }, { "docstring": "Update the user's verification status", "name": "save", "signature": "def save(self, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_001248
Implement the Python class `AccountVerificationSerializer` described below. Class description: Account verification Serializer that allows to know which user has a verificated account and which doesn't Method signatures and docstrings: - def validate(self, data): Validate method for the token - def save(self, **kwarg...
Implement the Python class `AccountVerificationSerializer` described below. Class description: Account verification Serializer that allows to know which user has a verificated account and which doesn't Method signatures and docstrings: - def validate(self, data): Validate method for the token - def save(self, **kwarg...
bd037be8a814dce554e709d851c6a96e6a41ea78
<|skeleton|> class AccountVerificationSerializer: """Account verification Serializer that allows to know which user has a verificated account and which doesn't""" def validate(self, data): """Validate method for the token""" <|body_0|> def save(self, **kwargs): """Update the user's...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AccountVerificationSerializer: """Account verification Serializer that allows to know which user has a verificated account and which doesn't""" def validate(self, data): """Validate method for the token""" try: payload = jwt.decode(data['token'], settings.SECRET_KEY, algorithm...
the_stack_v2_python_sparse
users/serializers/users.py
jpcano1/tShoes
train
0
ace94eee74d1e597d12c17a09cb675d6899aee62
[ "self.n = len(nums)\nself.tree = nums + nums\nfor i in range(self.n - 1, 0, -1):\n self.tree[i] = self.tree[2 * i] + self.tree[2 * i + 1]", "tree = self.tree\ni += self.n\ntree[i] = val\nwhile i > 0:\n left = right = i\n if i % 2 == 1:\n left -= 1\n else:\n right += 1\n tree[i / 2] = ...
<|body_start_0|> self.n = len(nums) self.tree = nums + nums for i in range(self.n - 1, 0, -1): self.tree[i] = self.tree[2 * i] + self.tree[2 * i + 1] <|end_body_0|> <|body_start_1|> tree = self.tree i += self.n tree[i] = val while i > 0: l...
NumArray
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumArray: def __init__(self, nums): """initialize your data structure here. :type nums: List[int]""" <|body_0|> def update(self, i, val): """:type i: int :type val: int :rtype: int""" <|body_1|> def sumRange(self, i, j): """sum of elements nums[i...
stack_v2_sparse_classes_10k_train_006401
1,416
no_license
[ { "docstring": "initialize your data structure here. :type nums: List[int]", "name": "__init__", "signature": "def __init__(self, nums)" }, { "docstring": ":type i: int :type val: int :rtype: int", "name": "update", "signature": "def update(self, i, val)" }, { "docstring": "sum o...
3
null
Implement the Python class `NumArray` described below. Class description: Implement the NumArray class. Method signatures and docstrings: - def __init__(self, nums): initialize your data structure here. :type nums: List[int] - def update(self, i, val): :type i: int :type val: int :rtype: int - def sumRange(self, i, j...
Implement the Python class `NumArray` described below. Class description: Implement the NumArray class. Method signatures and docstrings: - def __init__(self, nums): initialize your data structure here. :type nums: List[int] - def update(self, i, val): :type i: int :type val: int :rtype: int - def sumRange(self, i, j...
036a29d681cc91f2317d454e04530d7375d55478
<|skeleton|> class NumArray: def __init__(self, nums): """initialize your data structure here. :type nums: List[int]""" <|body_0|> def update(self, i, val): """:type i: int :type val: int :rtype: int""" <|body_1|> def sumRange(self, i, j): """sum of elements nums[i...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class NumArray: def __init__(self, nums): """initialize your data structure here. :type nums: List[int]""" self.n = len(nums) self.tree = nums + nums for i in range(self.n - 1, 0, -1): self.tree[i] = self.tree[2 * i] + self.tree[2 * i + 1] def update(self, i, val): ...
the_stack_v2_python_sparse
leetcode/range_sum_query_mutable_v1.py
myliu/python-algorithm
train
0
039c6622f853c67c0b637c34f4ff07e853015901
[ "try:\n with open(primary_config_file, 'r') as f:\n self.primary_config = json.load(f)\nexcept Exception as e:\n raise Exception('Error reading primary config file: {}. Run reset.py script to reinitialize configs'.format(primary_config_file))\ntry:\n with open(secondary_config_file, 'r') as f:\n ...
<|body_start_0|> try: with open(primary_config_file, 'r') as f: self.primary_config = json.load(f) except Exception as e: raise Exception('Error reading primary config file: {}. Run reset.py script to reinitialize configs'.format(primary_config_file)) try:...
Reads the config files and supports requested values from the user Methods: get_config_value: returns the value of the config key override_with_command_line_args: overrides the config values with command line arguments
ConfigReader
[ "Apache-2.0", "BSD-3-Clause", "MIT", "WTFPL", "GPL-2.0-only" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConfigReader: """Reads the config files and supports requested values from the user Methods: get_config_value: returns the value of the config key override_with_command_line_args: overrides the config values with command line arguments""" def __init__(self, primary_config_file, secondary_con...
stack_v2_sparse_classes_10k_train_006402
3,982
permissive
[ { "docstring": "Constructor :param primary_config_file: str , path to primary config file :param secondary_config_file: str , path to secondary config file", "name": "__init__", "signature": "def __init__(self, primary_config_file, secondary_config_file)" }, { "docstring": "Overrides the config ...
3
null
Implement the Python class `ConfigReader` described below. Class description: Reads the config files and supports requested values from the user Methods: get_config_value: returns the value of the config key override_with_command_line_args: overrides the config values with command line arguments Method signatures and...
Implement the Python class `ConfigReader` described below. Class description: Reads the config files and supports requested values from the user Methods: get_config_value: returns the value of the config key override_with_command_line_args: overrides the config values with command line arguments Method signatures and...
8d5f9a2d49ab8f9e85ccf058cb02c2fda287afc6
<|skeleton|> class ConfigReader: """Reads the config files and supports requested values from the user Methods: get_config_value: returns the value of the config key override_with_command_line_args: overrides the config values with command line arguments""" def __init__(self, primary_config_file, secondary_con...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ConfigReader: """Reads the config files and supports requested values from the user Methods: get_config_value: returns the value of the config key override_with_command_line_args: overrides the config values with command line arguments""" def __init__(self, primary_config_file, secondary_config_file): ...
the_stack_v2_python_sparse
govern/data-security/ranger/ranger-tools/src/main/python/ranger_performance_tool/ranger_perf_utils/config_utils.py
alldatacenter/alldata
train
774
fd94796047c557b42d455180121d18b4c96ee72f
[ "from scoop.content.models.content import Content\nuuid = self.value\nstyle = self.kwargs.get('style', 'link')\ncontents = Content.objects.visible().filter(uuid=uuid)\ncontent = contents[0] if contents.exists() else None\nreturn {'content': content, 'style': style}", "base = super(ContentInline, self).get_templat...
<|body_start_0|> from scoop.content.models.content import Content uuid = self.value style = self.kwargs.get('style', 'link') contents = Content.objects.visible().filter(uuid=uuid) content = contents[0] if contents.exists() else None return {'content': content, 'style': st...
Inline d'insertion de contenus Format : {{content uuid [style=stylename]}} Exemple : {{content identifier style="link"}}
ContentInline
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ContentInline: """Inline d'insertion de contenus Format : {{content uuid [style=stylename]}} Exemple : {{content identifier style="link"}}""" def get_context(self): """Renvoyer un contexte pour le rendu de l'inline""" <|body_0|> def get_template_name(self): """Re...
stack_v2_sparse_classes_10k_train_006403
6,816
no_license
[ { "docstring": "Renvoyer un contexte pour le rendu de l'inline", "name": "get_context", "signature": "def get_context(self)" }, { "docstring": "Renvoyer le chemin du template", "name": "get_template_name", "signature": "def get_template_name(self)" } ]
2
null
Implement the Python class `ContentInline` described below. Class description: Inline d'insertion de contenus Format : {{content uuid [style=stylename]}} Exemple : {{content identifier style="link"}} Method signatures and docstrings: - def get_context(self): Renvoyer un contexte pour le rendu de l'inline - def get_te...
Implement the Python class `ContentInline` described below. Class description: Inline d'insertion de contenus Format : {{content uuid [style=stylename]}} Exemple : {{content identifier style="link"}} Method signatures and docstrings: - def get_context(self): Renvoyer un contexte pour le rendu de l'inline - def get_te...
8cef6f6e89c1990e2b25f83e54e0c3481d83b6d7
<|skeleton|> class ContentInline: """Inline d'insertion de contenus Format : {{content uuid [style=stylename]}} Exemple : {{content identifier style="link"}}""" def get_context(self): """Renvoyer un contexte pour le rendu de l'inline""" <|body_0|> def get_template_name(self): """Re...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ContentInline: """Inline d'insertion de contenus Format : {{content uuid [style=stylename]}} Exemple : {{content identifier style="link"}}""" def get_context(self): """Renvoyer un contexte pour le rendu de l'inline""" from scoop.content.models.content import Content uuid = self.va...
the_stack_v2_python_sparse
scoop/content/util/inlines.py
artscoop/scoop
train
0
3fbad9abe1ddc3fdf17c50ca1ca108b45440e426
[ "Q = self.coll.Qmat if Q is None else Q\nQI = np.zeros_like(Q) if QI is None else QI\nQE = np.zeros_like(Q) if QE is None else QE\nL = self.level\nme = []\nfor m in range(1, self.coll.num_nodes + 1):\n me.append(L.dt * ((Q - QI)[m, 1] * L.f[1].impl + (Q - QE)[m, 1] * L.f[1].expl))\n for j in range(2, self.col...
<|body_start_0|> Q = self.coll.Qmat if Q is None else Q QI = np.zeros_like(Q) if QI is None else QI QE = np.zeros_like(Q) if QE is None else QE L = self.level me = [] for m in range(1, self.coll.num_nodes + 1): me.append(L.dt * ((Q - QI)[m, 1] * L.f[1].impl + ...
Duplicate of `imex_1st_order` sweeper which is slightly more efficient at the cost of code readability.
imex_1st_order_efficient
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class imex_1st_order_efficient: """Duplicate of `imex_1st_order` sweeper which is slightly more efficient at the cost of code readability.""" def integrate(self, Q=None, QI=None, QE=None): """Integrates the right-hand side (here impl + expl) Args: Q (numpy.ndarray): Full quadrature rule QI...
stack_v2_sparse_classes_10k_train_006404
7,777
permissive
[ { "docstring": "Integrates the right-hand side (here impl + expl) Args: Q (numpy.ndarray): Full quadrature rule QI (numpy.ndarray): Implicit preconditioner QE (numpy.ndarray): Explicit preconditioner Returns: list of dtype_u: containing the integral as values", "name": "integrate", "signature": "def int...
2
null
Implement the Python class `imex_1st_order_efficient` described below. Class description: Duplicate of `imex_1st_order` sweeper which is slightly more efficient at the cost of code readability. Method signatures and docstrings: - def integrate(self, Q=None, QI=None, QE=None): Integrates the right-hand side (here impl...
Implement the Python class `imex_1st_order_efficient` described below. Class description: Duplicate of `imex_1st_order` sweeper which is slightly more efficient at the cost of code readability. Method signatures and docstrings: - def integrate(self, Q=None, QI=None, QE=None): Integrates the right-hand side (here impl...
1a51834bedffd4472e344bed28f4d766614b1537
<|skeleton|> class imex_1st_order_efficient: """Duplicate of `imex_1st_order` sweeper which is slightly more efficient at the cost of code readability.""" def integrate(self, Q=None, QI=None, QE=None): """Integrates the right-hand side (here impl + expl) Args: Q (numpy.ndarray): Full quadrature rule QI...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class imex_1st_order_efficient: """Duplicate of `imex_1st_order` sweeper which is slightly more efficient at the cost of code readability.""" def integrate(self, Q=None, QI=None, QE=None): """Integrates the right-hand side (here impl + expl) Args: Q (numpy.ndarray): Full quadrature rule QI (numpy.ndarr...
the_stack_v2_python_sparse
pySDC/projects/Resilience/sweepers.py
Parallel-in-Time/pySDC
train
30
5f31c53665618560ad7de4dd2c2c9bf591afe89f
[ "if not root:\n return []\nqueue = deque([(0, root)])\nret = []\nwhile queue:\n l, n = queue.popleft()\n if l < len(ret):\n ret[l].append(n.val)\n else:\n ret.append([n.val])\n if n.children:\n for c in n.children:\n queue.append((l + 1, c))\nreturn ret", "if not roo...
<|body_start_0|> if not root: return [] queue = deque([(0, root)]) ret = [] while queue: l, n = queue.popleft() if l < len(ret): ret[l].append(n.val) else: ret.append([n.val]) if n.children: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def levelOrder(self, root: 'Node') -> List[List[int]]: """04/28/2020 23:57""" <|body_0|> def levelOrder(self, root: 'Node') -> List[List[int]]: """08/23/2021 15:04""" <|body_1|> def levelOrder(self, root: 'Node') -> List[List[int]]: """...
stack_v2_sparse_classes_10k_train_006405
4,519
no_license
[ { "docstring": "04/28/2020 23:57", "name": "levelOrder", "signature": "def levelOrder(self, root: 'Node') -> List[List[int]]" }, { "docstring": "08/23/2021 15:04", "name": "levelOrder", "signature": "def levelOrder(self, root: 'Node') -> List[List[int]]" }, { "docstring": "09/18/...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def levelOrder(self, root: 'Node') -> List[List[int]]: 04/28/2020 23:57 - def levelOrder(self, root: 'Node') -> List[List[int]]: 08/23/2021 15:04 - def levelOrder(self, root: 'No...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def levelOrder(self, root: 'Node') -> List[List[int]]: 04/28/2020 23:57 - def levelOrder(self, root: 'Node') -> List[List[int]]: 08/23/2021 15:04 - def levelOrder(self, root: 'No...
1389a009a02e90e8700a7a00e0b7f797c129cdf4
<|skeleton|> class Solution: def levelOrder(self, root: 'Node') -> List[List[int]]: """04/28/2020 23:57""" <|body_0|> def levelOrder(self, root: 'Node') -> List[List[int]]: """08/23/2021 15:04""" <|body_1|> def levelOrder(self, root: 'Node') -> List[List[int]]: """...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def levelOrder(self, root: 'Node') -> List[List[int]]: """04/28/2020 23:57""" if not root: return [] queue = deque([(0, root)]) ret = [] while queue: l, n = queue.popleft() if l < len(ret): ret[l].append(n.va...
the_stack_v2_python_sparse
leetcode/solved/764_N-ary_Tree_Level_Order_Traversal/solution.py
sungminoh/algorithms
train
0
fa83e0fddf69bd0119cf9f296cd1f4783cbea9b4
[ "self.backup_type = backup_type\nself.copy_partially_successful_run = copy_partially_successful_run\nself.granularity_bucket = granularity_bucket\nself.id = id\nself.retention_policy = retention_policy", "if dictionary is None:\n return None\nbackup_type = dictionary.get('backupType')\ncopy_partially_successfu...
<|body_start_0|> self.backup_type = backup_type self.copy_partially_successful_run = copy_partially_successful_run self.granularity_bucket = granularity_bucket self.id = id self.retention_policy = retention_policy <|end_body_0|> <|body_start_1|> if dictionary is None: ...
Implementation of the 'ExtendedRetentionPolicyProto' model. Message that specifies additional retention policies to apply to backup snapshots. Attributes: backup_type (int): The backup type to which this extended retention applies to. If this is not set, the extended retention will be applicable to all non-log backup t...
ExtendedRetentionPolicyProto
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExtendedRetentionPolicyProto: """Implementation of the 'ExtendedRetentionPolicyProto' model. Message that specifies additional retention policies to apply to backup snapshots. Attributes: backup_type (int): The backup type to which this extended retention applies to. If this is not set, the exten...
stack_v2_sparse_classes_10k_train_006406
4,004
permissive
[ { "docstring": "Constructor for the ExtendedRetentionPolicyProto class", "name": "__init__", "signature": "def __init__(self, backup_type=None, copy_partially_successful_run=None, granularity_bucket=None, id=None, retention_policy=None)" }, { "docstring": "Creates an instance of this model from ...
2
stack_v2_sparse_classes_30k_train_002689
Implement the Python class `ExtendedRetentionPolicyProto` described below. Class description: Implementation of the 'ExtendedRetentionPolicyProto' model. Message that specifies additional retention policies to apply to backup snapshots. Attributes: backup_type (int): The backup type to which this extended retention ap...
Implement the Python class `ExtendedRetentionPolicyProto` described below. Class description: Implementation of the 'ExtendedRetentionPolicyProto' model. Message that specifies additional retention policies to apply to backup snapshots. Attributes: backup_type (int): The backup type to which this extended retention ap...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class ExtendedRetentionPolicyProto: """Implementation of the 'ExtendedRetentionPolicyProto' model. Message that specifies additional retention policies to apply to backup snapshots. Attributes: backup_type (int): The backup type to which this extended retention applies to. If this is not set, the exten...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ExtendedRetentionPolicyProto: """Implementation of the 'ExtendedRetentionPolicyProto' model. Message that specifies additional retention policies to apply to backup snapshots. Attributes: backup_type (int): The backup type to which this extended retention applies to. If this is not set, the extended retention...
the_stack_v2_python_sparse
cohesity_management_sdk/models/extended_retention_policy_proto.py
cohesity/management-sdk-python
train
24
9f266255e1c50b648cfa6d78fe24d41fda4cd497
[ "delta_lat = size / 1000.0 / _EARTH_RADIUS_IN_KM * (180.0 / math.pi)\ndelta_lng = delta_lat / math.cos(math.pi * lat / 180.0)\nself._horizontal_stroke = _Polyline([lat, lat], [lng - delta_lng, lng + delta_lng], precision, **kwargs)\nself._vertical_stroke = _Polyline([lat - delta_lat, lat + delta_lat], [lng, lng], p...
<|body_start_0|> delta_lat = size / 1000.0 / _EARTH_RADIUS_IN_KM * (180.0 / math.pi) delta_lng = delta_lat / math.cos(math.pi * lat / 180.0) self._horizontal_stroke = _Polyline([lat, lat], [lng - delta_lng, lng + delta_lng], precision, **kwargs) self._vertical_stroke = _Polyline([lat - d...
_Plus
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _Plus: def __init__(self, lat, lng, size, precision, **kwargs): """Args: lat (float): Latitude of the center of the '+'. lng (float): Longitude of the center of the '+'. size (int): Size of the '+', in meters. precision (int): Number of digits after the decimal to round to for lat/lng va...
stack_v2_sparse_classes_10k_train_006407
1,509
permissive
[ { "docstring": "Args: lat (float): Latitude of the center of the '+'. lng (float): Longitude of the center of the '+'. size (int): Size of the '+', in meters. precision (int): Number of digits after the decimal to round to for lat/lng values. Optional: Args: color (str): Color of the '+'. Can be hex ('#00FFFF')...
2
stack_v2_sparse_classes_30k_train_003691
Implement the Python class `_Plus` described below. Class description: Implement the _Plus class. Method signatures and docstrings: - def __init__(self, lat, lng, size, precision, **kwargs): Args: lat (float): Latitude of the center of the '+'. lng (float): Longitude of the center of the '+'. size (int): Size of the ...
Implement the Python class `_Plus` described below. Class description: Implement the _Plus class. Method signatures and docstrings: - def __init__(self, lat, lng, size, precision, **kwargs): Args: lat (float): Latitude of the center of the '+'. lng (float): Longitude of the center of the '+'. size (int): Size of the ...
8654a5a370b5ec309e1282c457eaf375c3dcb4bb
<|skeleton|> class _Plus: def __init__(self, lat, lng, size, precision, **kwargs): """Args: lat (float): Latitude of the center of the '+'. lng (float): Longitude of the center of the '+'. size (int): Size of the '+', in meters. precision (int): Number of digits after the decimal to round to for lat/lng va...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class _Plus: def __init__(self, lat, lng, size, precision, **kwargs): """Args: lat (float): Latitude of the center of the '+'. lng (float): Longitude of the center of the '+'. size (int): Size of the '+', in meters. precision (int): Number of digits after the decimal to round to for lat/lng values. Optional...
the_stack_v2_python_sparse
gmplot/drawables/symbols/plus.py
fishke22/gmplot
train
0
d22cc28a5835a2111c7646ab5cf33c708abc3e5f
[ "if not root:\n return False\nif not root.left and (not root.right):\n return root.val == targetSum\nleft = self.hasPathSum(root.left, targetSum - root.val)\nright = self.hasPathSum(root.right, targetSum - root.val)\nreturn left or right", "if not root:\n return False\n\ndef traverse(root, count):\n i...
<|body_start_0|> if not root: return False if not root.left and (not root.right): return root.val == targetSum left = self.hasPathSum(root.left, targetSum - root.val) right = self.hasPathSum(root.right, targetSum - root.val) return left or right <|end_body...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def hasPathSum1(self, root, targetSum): """:type root: TreeNode :type targetSum: int :rtype: bool 递归,如果需要搜索整颗二叉树,那么递归函数就不要返回值, 如果要搜索其中一条符合条件的路径,递归函数就需要返回值, 因为遇到符合条件的路径了就要及时返回。""" <|body_0|> def hasPathSum(self, root, targetSum): """:type root: TreeNode :typ...
stack_v2_sparse_classes_10k_train_006408
2,781
no_license
[ { "docstring": ":type root: TreeNode :type targetSum: int :rtype: bool 递归,如果需要搜索整颗二叉树,那么递归函数就不要返回值, 如果要搜索其中一条符合条件的路径,递归函数就需要返回值, 因为遇到符合条件的路径了就要及时返回。", "name": "hasPathSum1", "signature": "def hasPathSum1(self, root, targetSum)" }, { "docstring": ":type root: TreeNode :type targetSum: int :rtype:...
3
stack_v2_sparse_classes_30k_train_003980
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hasPathSum1(self, root, targetSum): :type root: TreeNode :type targetSum: int :rtype: bool 递归,如果需要搜索整颗二叉树,那么递归函数就不要返回值, 如果要搜索其中一条符合条件的路径,递归函数就需要返回值, 因为遇到符合条件的路径了就要及时返回。 - def...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hasPathSum1(self, root, targetSum): :type root: TreeNode :type targetSum: int :rtype: bool 递归,如果需要搜索整颗二叉树,那么递归函数就不要返回值, 如果要搜索其中一条符合条件的路径,递归函数就需要返回值, 因为遇到符合条件的路径了就要及时返回。 - def...
6e18c5d257840489cc3fb1079ae3804c743982a4
<|skeleton|> class Solution: def hasPathSum1(self, root, targetSum): """:type root: TreeNode :type targetSum: int :rtype: bool 递归,如果需要搜索整颗二叉树,那么递归函数就不要返回值, 如果要搜索其中一条符合条件的路径,递归函数就需要返回值, 因为遇到符合条件的路径了就要及时返回。""" <|body_0|> def hasPathSum(self, root, targetSum): """:type root: TreeNode :typ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def hasPathSum1(self, root, targetSum): """:type root: TreeNode :type targetSum: int :rtype: bool 递归,如果需要搜索整颗二叉树,那么递归函数就不要返回值, 如果要搜索其中一条符合条件的路径,递归函数就需要返回值, 因为遇到符合条件的路径了就要及时返回。""" if not root: return False if not root.left and (not root.right): return r...
the_stack_v2_python_sparse
112.路径总和.py
yangyuxiang1996/leetcode
train
0
964108a024c9f534d58c8b027b971aaefeb440bd
[ "self.head = head\nself.count = 0\nwhile head:\n self.count += 1\n head = head.next", "randnode = random.randint(0, self.count - 1)\nnode = self.head\nfor _ in range(randnode):\n node = node.next\nreturn node.val" ]
<|body_start_0|> self.head = head self.count = 0 while head: self.count += 1 head = head.next <|end_body_0|> <|body_start_1|> randnode = random.randint(0, self.count - 1) node = self.head for _ in range(randnode): node = node.next ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def __init__(self, head): """@param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node. :type head: ListNode""" <|body_0|> def getRandom(self): """Returns a random node's value. :rtype: int""" ...
stack_v2_sparse_classes_10k_train_006409
1,294
no_license
[ { "docstring": "@param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node. :type head: ListNode", "name": "__init__", "signature": "def __init__(self, head)" }, { "docstring": "Returns a random node's value. :rtype: int", "name": "g...
2
stack_v2_sparse_classes_30k_val_000033
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, head): @param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node. :type head: ListNode - def getRan...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, head): @param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node. :type head: ListNode - def getRan...
05e0beff0047f0ad399d0b46d625bb8d3459814e
<|skeleton|> class Solution: def __init__(self, head): """@param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node. :type head: ListNode""" <|body_0|> def getRandom(self): """Returns a random node's value. :rtype: int""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def __init__(self, head): """@param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node. :type head: ListNode""" self.head = head self.count = 0 while head: self.count += 1 head = head....
the_stack_v2_python_sparse
python_1_to_1000/382_Linked_List_Random_Node.py
jakehoare/leetcode
train
58
f0493c348d3af52f361513921d87bf8c06bc4055
[ "if s == s[::-1]:\n return s\nLen = 1\nstart = 0\nfor i in range(1, len(s)):\n p1, p2 = (i - Len, i + 1)\n if p1 >= 1:\n temp = s[p1 - 1:p2]\n if temp == temp[::-1]:\n start = p1 - 1\n Len += 2\n continue\n if p1 >= 0:\n temp = s[p1:p2]\n if t...
<|body_start_0|> if s == s[::-1]: return s Len = 1 start = 0 for i in range(1, len(s)): p1, p2 = (i - Len, i + 1) if p1 >= 1: temp = s[p1 - 1:p2] if temp == temp[::-1]: start = p1 - 1 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestPalindrome(self, s): """:type s: str :rtype: str""" <|body_0|> def longestPalindrome_mysecond_fromcenter(self, s): """:type s: str :rtype: str""" <|body_1|> def longestPalindrome_myfirst(self, s): """:type s: str :rtype: str"...
stack_v2_sparse_classes_10k_train_006410
2,919
no_license
[ { "docstring": ":type s: str :rtype: str", "name": "longestPalindrome", "signature": "def longestPalindrome(self, s)" }, { "docstring": ":type s: str :rtype: str", "name": "longestPalindrome_mysecond_fromcenter", "signature": "def longestPalindrome_mysecond_fromcenter(self, s)" }, { ...
3
stack_v2_sparse_classes_30k_train_006679
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestPalindrome(self, s): :type s: str :rtype: str - def longestPalindrome_mysecond_fromcenter(self, s): :type s: str :rtype: str - def longestPalindrome_myfirst(self, s): ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestPalindrome(self, s): :type s: str :rtype: str - def longestPalindrome_mysecond_fromcenter(self, s): :type s: str :rtype: str - def longestPalindrome_myfirst(self, s): ...
f0d9070fa292ca36971a465a805faddb12025482
<|skeleton|> class Solution: def longestPalindrome(self, s): """:type s: str :rtype: str""" <|body_0|> def longestPalindrome_mysecond_fromcenter(self, s): """:type s: str :rtype: str""" <|body_1|> def longestPalindrome_myfirst(self, s): """:type s: str :rtype: str"...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def longestPalindrome(self, s): """:type s: str :rtype: str""" if s == s[::-1]: return s Len = 1 start = 0 for i in range(1, len(s)): p1, p2 = (i - Len, i + 1) if p1 >= 1: temp = s[p1 - 1:p2] ...
the_stack_v2_python_sparse
5.LongestPalindromicSubstring.py
JerryRoc/leetcode
train
0
6727d0823ebc4b00846bc7eb6387aac3611391a9
[ "if name is None:\n return jsonify(responses.missing_parameters)\nsensor = Sensor.objects(name=name).first()\nif sensor is None:\n return jsonify(responses.invalid_uuid)\ntags_owned = [{'name': tag.name, 'value': tag.value} for tag in sensor.tags]\nmetadata = Sensor._get_collection().find({'name': name}, {'me...
<|body_start_0|> if name is None: return jsonify(responses.missing_parameters) sensor = Sensor.objects(name=name).first() if sensor is None: return jsonify(responses.invalid_uuid) tags_owned = [{'name': tag.name, 'value': tag.value} for tag in sensor.tags] ...
SensorService
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SensorService: def get(self, name): """Retrieve sensor details based on uuid specified Args as data: name : <name of sensor> Returns (JSON): { 'building': <name of building in which sensor is present>, 'name' : <sensor uuid>, 'tags' : tags_owned, 'metadata' : metadata, 'source_identifier...
stack_v2_sparse_classes_10k_train_006411
3,642
permissive
[ { "docstring": "Retrieve sensor details based on uuid specified Args as data: name : <name of sensor> Returns (JSON): { 'building': <name of building in which sensor is present>, 'name' : <sensor uuid>, 'tags' : tags_owned, 'metadata' : metadata, 'source_identifier' : str(sensor.source_identifier), 'source_name...
2
stack_v2_sparse_classes_30k_train_000571
Implement the Python class `SensorService` described below. Class description: Implement the SensorService class. Method signatures and docstrings: - def get(self, name): Retrieve sensor details based on uuid specified Args as data: name : <name of sensor> Returns (JSON): { 'building': <name of building in which sens...
Implement the Python class `SensorService` described below. Class description: Implement the SensorService class. Method signatures and docstrings: - def get(self, name): Retrieve sensor details based on uuid specified Args as data: name : <name of sensor> Returns (JSON): { 'building': <name of building in which sens...
53ba7519c56d46af1e32a77aab5cf1c5cd8143fc
<|skeleton|> class SensorService: def get(self, name): """Retrieve sensor details based on uuid specified Args as data: name : <name of sensor> Returns (JSON): { 'building': <name of building in which sensor is present>, 'name' : <sensor uuid>, 'tags' : tags_owned, 'metadata' : metadata, 'source_identifier...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SensorService: def get(self, name): """Retrieve sensor details based on uuid specified Args as data: name : <name of sensor> Returns (JSON): { 'building': <name of building in which sensor is present>, 'name' : <sensor uuid>, 'tags' : tags_owned, 'metadata' : metadata, 'source_identifier' : str(sensor...
the_stack_v2_python_sparse
BuildingDepot-v3.2.8/buildingdepot/CentralService/app/rest_api/sensors/sensor.py
Entromorgan/GIoTTo
train
0
4ade24baff66daa44ecfc0010d597d1df486f7c3
[ "response = super().to_representation(instance)\nif hasattr(response, 'user'):\n response['user'] = {'id': instance.user.id}\nif hasattr(response, 'listing'):\n response['listing'] = {'id': instance.listing.id}\nreturn response", "request = self.context.get('request')\ndata['user'] = request.user\nif data['...
<|body_start_0|> response = super().to_representation(instance) if hasattr(response, 'user'): response['user'] = {'id': instance.user.id} if hasattr(response, 'listing'): response['listing'] = {'id': instance.listing.id} return response <|end_body_0|> <|body_star...
Serializer to create galleries
GallerySerializer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GallerySerializer: """Serializer to create galleries""" def to_representation(self, instance): """Return only the id of the user or listing for the gallery and not the entire object.""" <|body_0|> def validate(self, data): """Validate creation of gallery. - Check...
stack_v2_sparse_classes_10k_train_006412
2,374
no_license
[ { "docstring": "Return only the id of the user or listing for the gallery and not the entire object.", "name": "to_representation", "signature": "def to_representation(self, instance)" }, { "docstring": "Validate creation of gallery. - Check if user exists or has listing to make gallery - Check ...
2
stack_v2_sparse_classes_30k_train_005075
Implement the Python class `GallerySerializer` described below. Class description: Serializer to create galleries Method signatures and docstrings: - def to_representation(self, instance): Return only the id of the user or listing for the gallery and not the entire object. - def validate(self, data): Validate creatio...
Implement the Python class `GallerySerializer` described below. Class description: Serializer to create galleries Method signatures and docstrings: - def to_representation(self, instance): Return only the id of the user or listing for the gallery and not the entire object. - def validate(self, data): Validate creatio...
1f2c8c232372de6a40089c8b867ce1798d2296c7
<|skeleton|> class GallerySerializer: """Serializer to create galleries""" def to_representation(self, instance): """Return only the id of the user or listing for the gallery and not the entire object.""" <|body_0|> def validate(self, data): """Validate creation of gallery. - Check...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class GallerySerializer: """Serializer to create galleries""" def to_representation(self, instance): """Return only the id of the user or listing for the gallery and not the entire object.""" response = super().to_representation(instance) if hasattr(response, 'user'): respon...
the_stack_v2_python_sparse
core/roommates_api/serializers/gallery_serializers.py
harmanT23/yournextroommates
train
1
c9b35349b6916ecf5981f3cd0c7548abb28ba931
[ "l = len(s)\nstep = 1\ncur = s[0:step]\nwhile step < l:\n if l % step == 0:\n i = 1\n while i < l // step:\n if s[step * i:step * i + step] != cur:\n break\n i += 1\n if i == l // step:\n return True\n step += 1\n cur = s[0:step]\nreturn ...
<|body_start_0|> l = len(s) step = 1 cur = s[0:step] while step < l: if l % step == 0: i = 1 while i < l // step: if s[step * i:step * i + step] != cur: break i += 1 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def repeatedSubstringPattern(self, s): """:type s: str :rtype: bool""" <|body_0|> def repeatedSubstringPattern(self, s): """:type s: str :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> l = len(s) step = 1 cur =...
stack_v2_sparse_classes_10k_train_006413
716
no_license
[ { "docstring": ":type s: str :rtype: bool", "name": "repeatedSubstringPattern", "signature": "def repeatedSubstringPattern(self, s)" }, { "docstring": ":type s: str :rtype: bool", "name": "repeatedSubstringPattern", "signature": "def repeatedSubstringPattern(self, s)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def repeatedSubstringPattern(self, s): :type s: str :rtype: bool - def repeatedSubstringPattern(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 repeatedSubstringPattern(self, s): :type s: str :rtype: bool - def repeatedSubstringPattern(self, s): :type s: str :rtype: bool <|skeleton|> class Solution: def repeate...
7c5e5fe76cee542f67cd7dd3a389470b02597548
<|skeleton|> class Solution: def repeatedSubstringPattern(self, s): """:type s: str :rtype: bool""" <|body_0|> def repeatedSubstringPattern(self, s): """:type s: str :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def repeatedSubstringPattern(self, s): """:type s: str :rtype: bool""" l = len(s) step = 1 cur = s[0:step] while step < l: if l % step == 0: i = 1 while i < l // step: if s[step * i:step * i + ste...
the_stack_v2_python_sparse
459. Repeated Substring Pattern.py
Mschikay/leetcode
train
0
9689eeca03569387815b68344597f6e1c00654f0
[ "super(AlphaBeta, self).__init__()\nself.portfolioReturn = portfolioReturn\nself.benchmarkReturn = benchmarkReturn\nself.riskfreeRate = riskfreeRate", "alphas = []\nbetas = []\nfor i in range(len(self.portfolioReturn)):\n if i == 0:\n alpha = np.nan\n beta = np.nan\n else:\n n = i + 1\n...
<|body_start_0|> super(AlphaBeta, self).__init__() self.portfolioReturn = portfolioReturn self.benchmarkReturn = benchmarkReturn self.riskfreeRate = riskfreeRate <|end_body_0|> <|body_start_1|> alphas = [] betas = [] for i in range(len(self.portfolioReturn)): ...
Alpha-beta of the given profit returns to the risk free rate.
AlphaBeta
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AlphaBeta: """Alpha-beta of the given profit returns to the risk free rate.""" def __init__(self, portfolioReturn, benchmarkReturn, riskfreeRate): """Initialize the AlphaBeta calculator with the portfolio data and a benchmark one. Parameters ---------- portfolioReturn : pandas.Series...
stack_v2_sparse_classes_10k_train_006414
10,010
permissive
[ { "docstring": "Initialize the AlphaBeta calculator with the portfolio data and a benchmark one. Parameters ---------- portfolioReturn : pandas.Series annual returns indexed by trading date as strings in the format %Y%m%d; benchmarkReturn : pandas.Series benchmark return indexed by trading date as strings in th...
2
stack_v2_sparse_classes_30k_train_000819
Implement the Python class `AlphaBeta` described below. Class description: Alpha-beta of the given profit returns to the risk free rate. Method signatures and docstrings: - def __init__(self, portfolioReturn, benchmarkReturn, riskfreeRate): Initialize the AlphaBeta calculator with the portfolio data and a benchmark o...
Implement the Python class `AlphaBeta` described below. Class description: Alpha-beta of the given profit returns to the risk free rate. Method signatures and docstrings: - def __init__(self, portfolioReturn, benchmarkReturn, riskfreeRate): Initialize the AlphaBeta calculator with the portfolio data and a benchmark o...
139d604177da3855503643e0fcfa87711ba7e588
<|skeleton|> class AlphaBeta: """Alpha-beta of the given profit returns to the risk free rate.""" def __init__(self, portfolioReturn, benchmarkReturn, riskfreeRate): """Initialize the AlphaBeta calculator with the portfolio data and a benchmark one. Parameters ---------- portfolioReturn : pandas.Series...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AlphaBeta: """Alpha-beta of the given profit returns to the risk free rate.""" def __init__(self, portfolioReturn, benchmarkReturn, riskfreeRate): """Initialize the AlphaBeta calculator with the portfolio data and a benchmark one. Parameters ---------- portfolioReturn : pandas.Series annual retur...
the_stack_v2_python_sparse
analytics/riskMeasurement/riskMetric.py
WinQuant/arsenal
train
0
23509248321e8b3b939dba7d92e4b3f406c684ac
[ "sqlalchemy_uri = self.get_uri()\nsqlite_uri = sqlalchemy_uri.replace('sqlite:///', 'file:')\nconn = sqlite3.connect(sqlite_uri, uri=True)\nreturn conn", "conn_id = getattr(self, self.conn_name_attr)\nairflow_conn = self.get_connection(conn_id)\nif airflow_conn.conn_type is None:\n airflow_conn.conn_type = sel...
<|body_start_0|> sqlalchemy_uri = self.get_uri() sqlite_uri = sqlalchemy_uri.replace('sqlite:///', 'file:') conn = sqlite3.connect(sqlite_uri, uri=True) return conn <|end_body_0|> <|body_start_1|> conn_id = getattr(self, self.conn_name_attr) airflow_conn = self.get_conne...
Interact with SQLite.
SqliteHook
[ "Apache-2.0", "BSD-3-Clause", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SqliteHook: """Interact with SQLite.""" def get_conn(self) -> sqlite3.dbapi2.Connection: """Returns a sqlite connection object.""" <|body_0|> def get_uri(self) -> str: """Override DbApiHook get_uri method for get_sqlalchemy_engine().""" <|body_1|> <|end_...
stack_v2_sparse_classes_10k_train_006415
2,402
permissive
[ { "docstring": "Returns a sqlite connection object.", "name": "get_conn", "signature": "def get_conn(self) -> sqlite3.dbapi2.Connection" }, { "docstring": "Override DbApiHook get_uri method for get_sqlalchemy_engine().", "name": "get_uri", "signature": "def get_uri(self) -> str" } ]
2
null
Implement the Python class `SqliteHook` described below. Class description: Interact with SQLite. Method signatures and docstrings: - def get_conn(self) -> sqlite3.dbapi2.Connection: Returns a sqlite connection object. - def get_uri(self) -> str: Override DbApiHook get_uri method for get_sqlalchemy_engine().
Implement the Python class `SqliteHook` described below. Class description: Interact with SQLite. Method signatures and docstrings: - def get_conn(self) -> sqlite3.dbapi2.Connection: Returns a sqlite connection object. - def get_uri(self) -> str: Override DbApiHook get_uri method for get_sqlalchemy_engine(). <|skele...
1b122c15030e99cef9d4ff26d3781a7a9d6949bc
<|skeleton|> class SqliteHook: """Interact with SQLite.""" def get_conn(self) -> sqlite3.dbapi2.Connection: """Returns a sqlite connection object.""" <|body_0|> def get_uri(self) -> str: """Override DbApiHook get_uri method for get_sqlalchemy_engine().""" <|body_1|> <|end_...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SqliteHook: """Interact with SQLite.""" def get_conn(self) -> sqlite3.dbapi2.Connection: """Returns a sqlite connection object.""" sqlalchemy_uri = self.get_uri() sqlite_uri = sqlalchemy_uri.replace('sqlite:///', 'file:') conn = sqlite3.connect(sqlite_uri, uri=True) ...
the_stack_v2_python_sparse
airflow/providers/sqlite/hooks/sqlite.py
apache/airflow
train
22,756
60dfebbf7e17ad808dc88026523469f4eca9367f
[ "try:\n\n def generate(vo):\n for exception in list_exceptions(vo=vo):\n yield (dumps(exception, cls=APIEncoder) + '\\n')\n return try_stream(generate(vo=request.environ.get('vo')))\nexcept LifetimeExceptionNotFound as error:\n return generate_http_error_flask(404, error)", "parameters ...
<|body_start_0|> try: def generate(vo): for exception in list_exceptions(vo=vo): yield (dumps(exception, cls=APIEncoder) + '\n') return try_stream(generate(vo=request.environ.get('vo'))) except LifetimeExceptionNotFound as error: r...
REST APIs for Lifetime Model exception.
LifetimeException
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LifetimeException: """REST APIs for Lifetime Model exception.""" def get(self): """--- summary: List Exceptions description: Retrieves all exceptions. tags: - Lifetime Exceptions responses: 200: description: OK content: application/x-json-stream: schema: description: One exception pe...
stack_v2_sparse_classes_10k_train_006416
12,043
permissive
[ { "docstring": "--- summary: List Exceptions description: Retrieves all exceptions. tags: - Lifetime Exceptions responses: 200: description: OK content: application/x-json-stream: schema: description: One exception per line. type: array items: description: A lifetime exception type: object properties: id: descr...
2
null
Implement the Python class `LifetimeException` described below. Class description: REST APIs for Lifetime Model exception. Method signatures and docstrings: - def get(self): --- summary: List Exceptions description: Retrieves all exceptions. tags: - Lifetime Exceptions responses: 200: description: OK content: applica...
Implement the Python class `LifetimeException` described below. Class description: REST APIs for Lifetime Model exception. Method signatures and docstrings: - def get(self): --- summary: List Exceptions description: Retrieves all exceptions. tags: - Lifetime Exceptions responses: 200: description: OK content: applica...
7f0d229ac0b3bc7dec12c6e158bea2b82d414a3b
<|skeleton|> class LifetimeException: """REST APIs for Lifetime Model exception.""" def get(self): """--- summary: List Exceptions description: Retrieves all exceptions. tags: - Lifetime Exceptions responses: 200: description: OK content: application/x-json-stream: schema: description: One exception pe...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LifetimeException: """REST APIs for Lifetime Model exception.""" def get(self): """--- summary: List Exceptions description: Retrieves all exceptions. tags: - Lifetime Exceptions responses: 200: description: OK content: application/x-json-stream: schema: description: One exception per line. type:...
the_stack_v2_python_sparse
lib/rucio/web/rest/flaskapi/v1/lifetime_exceptions.py
rucio/rucio
train
232
86900507eb1c7bbb75bb1acb8836d304c1f4e76e
[ "if self.key not in data:\n _logger.debug(f'Could not find {self.key} key.')\n data[self.key] = self.get_hash(circuit)\n return True\nnew_hash = self.get_hash(circuit)\nif data[self.key] == new_hash:\n _logger.debug('Hashes match; no change detected.')\n return False\ndata[self.key] = new_hash\n_logg...
<|body_start_0|> if self.key not in data: _logger.debug(f'Could not find {self.key} key.') data[self.key] = self.get_hash(circuit) return True new_hash = self.get_hash(circuit) if data[self.key] == new_hash: _logger.debug('Hashes match; no change d...
The ChangePredicate class. The ChangePredicate returns true if the circuit has changed since the last call. On the first call, the predicate returns true.
ChangePredicate
[ "LicenseRef-scancode-unknown-license-reference", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ChangePredicate: """The ChangePredicate class. The ChangePredicate returns true if the circuit has changed since the last call. On the first call, the predicate returns true.""" def get_truth_value(self, circuit: Circuit, data: PassData) -> bool: """Call this predicate, see :class:`P...
stack_v2_sparse_classes_10k_train_006417
1,984
permissive
[ { "docstring": "Call this predicate, see :class:`PassPredicate` for more info.", "name": "get_truth_value", "signature": "def get_truth_value(self, circuit: Circuit, data: PassData) -> bool" }, { "docstring": "Retreive hash associated with `circuit`.", "name": "get_hash", "signature": "d...
2
stack_v2_sparse_classes_30k_train_005499
Implement the Python class `ChangePredicate` described below. Class description: The ChangePredicate class. The ChangePredicate returns true if the circuit has changed since the last call. On the first call, the predicate returns true. Method signatures and docstrings: - def get_truth_value(self, circuit: Circuit, da...
Implement the Python class `ChangePredicate` described below. Class description: The ChangePredicate class. The ChangePredicate returns true if the circuit has changed since the last call. On the first call, the predicate returns true. Method signatures and docstrings: - def get_truth_value(self, circuit: Circuit, da...
c89112d15072e8ffffb68cf1757b184e2aeb3dc8
<|skeleton|> class ChangePredicate: """The ChangePredicate class. The ChangePredicate returns true if the circuit has changed since the last call. On the first call, the predicate returns true.""" def get_truth_value(self, circuit: Circuit, data: PassData) -> bool: """Call this predicate, see :class:`P...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ChangePredicate: """The ChangePredicate class. The ChangePredicate returns true if the circuit has changed since the last call. On the first call, the predicate returns true.""" def get_truth_value(self, circuit: Circuit, data: PassData) -> bool: """Call this predicate, see :class:`PassPredicate`...
the_stack_v2_python_sparse
bqskit/passes/control/predicates/change.py
BQSKit/bqskit
train
54
adee28b65fc41db2414026f42a549c2495195562
[ "self.res = []\nself.getPaths(root, '')\nreturn self.res", "if root == None:\n return\nif path == '':\n path = path + str(root.val)\nelse:\n path = path + '->' + str(root.val)\nif root.left == None and root.right == None:\n self.res.append(path)\nelse:\n self.getPaths(root.left, path)\n self.get...
<|body_start_0|> self.res = [] self.getPaths(root, '') return self.res <|end_body_0|> <|body_start_1|> if root == None: return if path == '': path = path + str(root.val) else: path = path + '->' + str(root.val) if root.left == ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def binaryTreePaths(self, root): """:type root: TreeNode :rtype: List[str]""" <|body_0|> def getPaths(self, root, path): """:type root: TreeNode :rtype: None""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.res = [] self.getPat...
stack_v2_sparse_classes_10k_train_006418
1,625
no_license
[ { "docstring": ":type root: TreeNode :rtype: List[str]", "name": "binaryTreePaths", "signature": "def binaryTreePaths(self, root)" }, { "docstring": ":type root: TreeNode :rtype: None", "name": "getPaths", "signature": "def getPaths(self, root, path)" } ]
2
stack_v2_sparse_classes_30k_train_001050
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def binaryTreePaths(self, root): :type root: TreeNode :rtype: List[str] - def getPaths(self, root, path): :type root: TreeNode :rtype: None
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def binaryTreePaths(self, root): :type root: TreeNode :rtype: List[str] - def getPaths(self, root, path): :type root: TreeNode :rtype: None <|skeleton|> class Solution: def...
8cda0518440488992d7e2c70cb8555ec7b34083f
<|skeleton|> class Solution: def binaryTreePaths(self, root): """:type root: TreeNode :rtype: List[str]""" <|body_0|> def getPaths(self, root, path): """:type root: TreeNode :rtype: None""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def binaryTreePaths(self, root): """:type root: TreeNode :rtype: List[str]""" self.res = [] self.getPaths(root, '') return self.res def getPaths(self, root, path): """:type root: TreeNode :rtype: None""" if root == None: return ...
the_stack_v2_python_sparse
257/main.py
szhongren/leetcode
train
0
bee3d4f0aea87a8bf7d2551f4a0f57068b3b36dc
[ "fast, slow = (head, head)\nwhile fast and fast.next:\n fast, slow = (fast.next.next, slow.next)\n if fast is slow:\n fast = head\n while fast is not slow:\n fast, slow = (fast.next, slow.next)\n return fast\nreturn None", "if len(data) == 0 or data is None:\n return None\...
<|body_start_0|> fast, slow = (head, head) while fast and fast.next: fast, slow = (fast.next.next, slow.next) if fast is slow: fast = head while fast is not slow: fast, slow = (fast.next, slow.next) return fast ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def detectCycle(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def createList(self, data): """:param data: a list :return: a head node to a linked list""" <|body_1|> <|end_skeleton|> <|body_start_0|> fast, slow = (head...
stack_v2_sparse_classes_10k_train_006419
1,748
no_license
[ { "docstring": ":type head: ListNode :rtype: ListNode", "name": "detectCycle", "signature": "def detectCycle(self, head)" }, { "docstring": ":param data: a list :return: a head node to a linked list", "name": "createList", "signature": "def createList(self, data)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def detectCycle(self, head): :type head: ListNode :rtype: ListNode - def createList(self, data): :param data: a list :return: a head node to a linked list
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def detectCycle(self, head): :type head: ListNode :rtype: ListNode - def createList(self, data): :param data: a list :return: a head node to a linked list <|skeleton|> class Sol...
a5b02044ef39154b6a8d32eb57682f447e1632ba
<|skeleton|> class Solution: def detectCycle(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def createList(self, data): """:param data: a list :return: a head node to a linked list""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def detectCycle(self, head): """:type head: ListNode :rtype: ListNode""" fast, slow = (head, head) while fast and fast.next: fast, slow = (fast.next.next, slow.next) if fast is slow: fast = head while fast is not slow: ...
the_stack_v2_python_sparse
algo/list/linked_list_cycle_II.py
xys234/coding-problems
train
0
5b0500661a868e1922a93a3abd6f634c0d08e8ec
[ "self.name = name\nself.num = num\nself.course = course\nself.classes = classes\nself.teacher = teacher\nself.student = student", "ret = MyPickle.load(settings.schoolinfo)\nfor i in ret.values():\n if self.name == i.name:\n Public.print('%s已经存在!' % self.name, 'error')\n return 0\nself.num = len(r...
<|body_start_0|> self.name = name self.num = num self.course = course self.classes = classes self.teacher = teacher self.student = student <|end_body_0|> <|body_start_1|> ret = MyPickle.load(settings.schoolinfo) for i in ret.values(): if self....
School
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class School: def __init__(self, name, num=0, classes={}, course={}, teacher={}, student={}): """:param name: 学校名称 :param num: 学校的ID :param classes: 学校包含的所有班级 :param course: 学校包含的所有课程 :param teacher: 学校包含的所有老师 :param student: 包含学校的所有学生""" <|body_0|> def create(self): """创建...
stack_v2_sparse_classes_10k_train_006420
3,775
no_license
[ { "docstring": ":param name: 学校名称 :param num: 学校的ID :param classes: 学校包含的所有班级 :param course: 学校包含的所有课程 :param teacher: 学校包含的所有老师 :param student: 包含学校的所有学生", "name": "__init__", "signature": "def __init__(self, name, num=0, classes={}, course={}, teacher={}, student={})" }, { "docstring": "创建学校 :...
2
stack_v2_sparse_classes_30k_train_006963
Implement the Python class `School` described below. Class description: Implement the School class. Method signatures and docstrings: - def __init__(self, name, num=0, classes={}, course={}, teacher={}, student={}): :param name: 学校名称 :param num: 学校的ID :param classes: 学校包含的所有班级 :param course: 学校包含的所有课程 :param teacher:...
Implement the Python class `School` described below. Class description: Implement the School class. Method signatures and docstrings: - def __init__(self, name, num=0, classes={}, course={}, teacher={}, student={}): :param name: 学校名称 :param num: 学校的ID :param classes: 学校包含的所有班级 :param course: 学校包含的所有课程 :param teacher:...
d7fc68d3d23345df5bfb09d4a84686c8b49a5ad7
<|skeleton|> class School: def __init__(self, name, num=0, classes={}, course={}, teacher={}, student={}): """:param name: 学校名称 :param num: 学校的ID :param classes: 学校包含的所有班级 :param course: 学校包含的所有课程 :param teacher: 学校包含的所有老师 :param student: 包含学校的所有学生""" <|body_0|> def create(self): """创建...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class School: def __init__(self, name, num=0, classes={}, course={}, teacher={}, student={}): """:param name: 学校名称 :param num: 学校的ID :param classes: 学校包含的所有班级 :param course: 学校包含的所有课程 :param teacher: 学校包含的所有老师 :param student: 包含学校的所有学生""" self.name = name self.num = num self.course =...
the_stack_v2_python_sparse
Homework/day07/core/school.py
214031230/Python21
train
0
b3b5a46342b86652deb5a903b9cf477dcc9c5fd6
[ "self.enable_fips_mode = enable_fips_mode\nself.enable_hardware_encryption = enable_hardware_encryption\nself.enable_software_encryption = enable_software_encryption\nself.rotation_period = rotation_period", "if dictionary is None:\n return None\nenable_fips_mode = dictionary.get('enableFipsMode')\nenable_hard...
<|body_start_0|> self.enable_fips_mode = enable_fips_mode self.enable_hardware_encryption = enable_hardware_encryption self.enable_software_encryption = enable_software_encryption self.rotation_period = rotation_period <|end_body_0|> <|body_start_1|> if dictionary is None: ...
Implementation of the 'EncryptionConfiguration' model. Specifies the parameters the user wants to use when configuring encryption for the new Cluster. Attributes: enable_fips_mode (bool): Specifies whether or not to enable FIPS mode. EnableSoftwareEncryption must be set to true in order to enable FIPS. enable_hardware_...
EncryptionConfiguration
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EncryptionConfiguration: """Implementation of the 'EncryptionConfiguration' model. Specifies the parameters the user wants to use when configuring encryption for the new Cluster. Attributes: enable_fips_mode (bool): Specifies whether or not to enable FIPS mode. EnableSoftwareEncryption must be se...
stack_v2_sparse_classes_10k_train_006421
3,088
permissive
[ { "docstring": "Constructor for the EncryptionConfiguration class", "name": "__init__", "signature": "def __init__(self, enable_fips_mode=None, enable_hardware_encryption=None, enable_software_encryption=None, rotation_period=None)" }, { "docstring": "Creates an instance of this model from a dic...
2
null
Implement the Python class `EncryptionConfiguration` described below. Class description: Implementation of the 'EncryptionConfiguration' model. Specifies the parameters the user wants to use when configuring encryption for the new Cluster. Attributes: enable_fips_mode (bool): Specifies whether or not to enable FIPS mo...
Implement the Python class `EncryptionConfiguration` described below. Class description: Implementation of the 'EncryptionConfiguration' model. Specifies the parameters the user wants to use when configuring encryption for the new Cluster. Attributes: enable_fips_mode (bool): Specifies whether or not to enable FIPS mo...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class EncryptionConfiguration: """Implementation of the 'EncryptionConfiguration' model. Specifies the parameters the user wants to use when configuring encryption for the new Cluster. Attributes: enable_fips_mode (bool): Specifies whether or not to enable FIPS mode. EnableSoftwareEncryption must be se...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class EncryptionConfiguration: """Implementation of the 'EncryptionConfiguration' model. Specifies the parameters the user wants to use when configuring encryption for the new Cluster. Attributes: enable_fips_mode (bool): Specifies whether or not to enable FIPS mode. EnableSoftwareEncryption must be set to true in ...
the_stack_v2_python_sparse
cohesity_management_sdk/models/encryption_configuration.py
cohesity/management-sdk-python
train
24
ad14551af5a156ae4c87b25bdcb75383ea771922
[ "digits_len = len(digits)\nif not self.increment_digit(digits, digits_len - 1, 1):\n return digits\nfor i in range(digits_len - 2, -1, -1):\n if not self.increment_digit(digits, i, 1):\n break\nreturn digits", "new_digit = digits[i] + carry\ndigits[i] = new_digit % 10\ncarry = new_digit // 10\nif i =...
<|body_start_0|> digits_len = len(digits) if not self.increment_digit(digits, digits_len - 1, 1): return digits for i in range(digits_len - 2, -1, -1): if not self.increment_digit(digits, i, 1): break return digits <|end_body_0|> <|body_start_1|> ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def plusOne(self, digits: List[int]) -> List[int]: """(Solution, list of int) -> list of int Return a list of digits representing a number that is one higher than the number represented by digits. >>> soln = Solution() >>> soln.plusOne([1, 2, 3]) [1, 2, 4] >>> soln.plusOne([4, ...
stack_v2_sparse_classes_10k_train_006422
2,409
no_license
[ { "docstring": "(Solution, list of int) -> list of int Return a list of digits representing a number that is one higher than the number represented by digits. >>> soln = Solution() >>> soln.plusOne([1, 2, 3]) [1, 2, 4] >>> soln.plusOne([4, 3, 2, 1]) [4, 3, 2, 2] >>> soln.plusOne([9]) [1, 0]", "name": "plusO...
2
stack_v2_sparse_classes_30k_train_004756
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def plusOne(self, digits: List[int]) -> List[int]: (Solution, list of int) -> list of int Return a list of digits representing a number that is one higher than the number represe...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def plusOne(self, digits: List[int]) -> List[int]: (Solution, list of int) -> list of int Return a list of digits representing a number that is one higher than the number represe...
6812253b90bdd5a35c6bfba8eac54da9be26d56c
<|skeleton|> class Solution: def plusOne(self, digits: List[int]) -> List[int]: """(Solution, list of int) -> list of int Return a list of digits representing a number that is one higher than the number represented by digits. >>> soln = Solution() >>> soln.plusOne([1, 2, 3]) [1, 2, 4] >>> soln.plusOne([4, ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def plusOne(self, digits: List[int]) -> List[int]: """(Solution, list of int) -> list of int Return a list of digits representing a number that is one higher than the number represented by digits. >>> soln = Solution() >>> soln.plusOne([1, 2, 3]) [1, 2, 4] >>> soln.plusOne([4, 3, 2, 1]) [4, ...
the_stack_v2_python_sparse
python3/plusOne.py
yichuanma95/leetcode-solns
train
2
813362b8df0c6241ec1d8bcdce7750e4b2355363
[ "def inorder(root):\n if not root:\n return\n inorder(root.left)\n ans.append(root.val)\n inorder(root.right)\nans = []\ninorder(root)\nreturn ans", "def preorder(root):\n if not root:\n return\n ans.append(root)\n preorder(root.left)\n preorder(root.right)\nans = []\npreorde...
<|body_start_0|> def inorder(root): if not root: return inorder(root.left) ans.append(root.val) inorder(root.right) ans = [] inorder(root) return ans <|end_body_0|> <|body_start_1|> def preorder(root): i...
Solution1
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution1: def inorderTraversal(self, root): """采用递归方法实现 中序遍历 :param root: TreeNode :return: List[int]""" <|body_0|> def preorderTraversal(self, root): """采用递归方法实现 先序遍历 :param root: TreeNode :return: List[int]""" <|body_1|> def postorderTraversal(self, r...
stack_v2_sparse_classes_10k_train_006423
1,981
no_license
[ { "docstring": "采用递归方法实现 中序遍历 :param root: TreeNode :return: List[int]", "name": "inorderTraversal", "signature": "def inorderTraversal(self, root)" }, { "docstring": "采用递归方法实现 先序遍历 :param root: TreeNode :return: List[int]", "name": "preorderTraversal", "signature": "def preorderTraversa...
3
stack_v2_sparse_classes_30k_train_005944
Implement the Python class `Solution1` described below. Class description: Implement the Solution1 class. Method signatures and docstrings: - def inorderTraversal(self, root): 采用递归方法实现 中序遍历 :param root: TreeNode :return: List[int] - def preorderTraversal(self, root): 采用递归方法实现 先序遍历 :param root: TreeNode :return: List[...
Implement the Python class `Solution1` described below. Class description: Implement the Solution1 class. Method signatures and docstrings: - def inorderTraversal(self, root): 采用递归方法实现 中序遍历 :param root: TreeNode :return: List[int] - def preorderTraversal(self, root): 采用递归方法实现 先序遍历 :param root: TreeNode :return: List[...
e03b8a324e816fee9c8440552de825be07132170
<|skeleton|> class Solution1: def inorderTraversal(self, root): """采用递归方法实现 中序遍历 :param root: TreeNode :return: List[int]""" <|body_0|> def preorderTraversal(self, root): """采用递归方法实现 先序遍历 :param root: TreeNode :return: List[int]""" <|body_1|> def postorderTraversal(self, r...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution1: def inorderTraversal(self, root): """采用递归方法实现 中序遍历 :param root: TreeNode :return: List[int]""" def inorder(root): if not root: return inorder(root.left) ans.append(root.val) inorder(root.right) ans = [] ...
the_stack_v2_python_sparse
Leetcode0094.py
ThompsonHe/LeetCode-Python
train
0
1982d1f1f14c08951ebd42990e0e5de9894822bc
[ "self.logger = logging.getLogger(__name__)\nself.logger.setLevel(logging.DEBUG)\nself.X = X\nself.Y = Y\nself.is_stochastic = is_stochastic\nif is_stochastic:\n self.logger.debug('Running Stochastic Perceptron...')\nself.step_size = step_size\nself.max_steps = max_steps\nself.reg_constant = reg_constant\nself.w ...
<|body_start_0|> self.logger = logging.getLogger(__name__) self.logger.setLevel(logging.DEBUG) self.X = X self.Y = Y self.is_stochastic = is_stochastic if is_stochastic: self.logger.debug('Running Stochastic Perceptron...') self.step_size = step_size ...
The Perceptron classifier, intended to be run on a dataset of two classes that are linearly separable.
Perceptron
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Perceptron: """The Perceptron classifier, intended to be run on a dataset of two classes that are linearly separable.""" def __init__(self, X, Y, is_stochastic, step_size, max_steps, reg_constant=0): """Initializes the Perceptron classifier. X and Y is the training data over which to...
stack_v2_sparse_classes_10k_train_006424
4,229
permissive
[ { "docstring": "Initializes the Perceptron classifier. X and Y is the training data over which to learn the hyperplane If is_stochastic is True then the perceptron gradient steps will be stochastic not batch. step_size is the learning rate to be used. max_steps is the maximum number of iterations to use before ...
4
stack_v2_sparse_classes_30k_train_001617
Implement the Python class `Perceptron` described below. Class description: The Perceptron classifier, intended to be run on a dataset of two classes that are linearly separable. Method signatures and docstrings: - def __init__(self, X, Y, is_stochastic, step_size, max_steps, reg_constant=0): Initializes the Perceptr...
Implement the Python class `Perceptron` described below. Class description: The Perceptron classifier, intended to be run on a dataset of two classes that are linearly separable. Method signatures and docstrings: - def __init__(self, X, Y, is_stochastic, step_size, max_steps, reg_constant=0): Initializes the Perceptr...
5d5a372f315cbd3cf8a3b2e865a8724f7cf4cc2b
<|skeleton|> class Perceptron: """The Perceptron classifier, intended to be run on a dataset of two classes that are linearly separable.""" def __init__(self, X, Y, is_stochastic, step_size, max_steps, reg_constant=0): """Initializes the Perceptron classifier. X and Y is the training data over which to...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Perceptron: """The Perceptron classifier, intended to be run on a dataset of two classes that are linearly separable.""" def __init__(self, X, Y, is_stochastic, step_size, max_steps, reg_constant=0): """Initializes the Perceptron classifier. X and Y is the training data over which to learn the hy...
the_stack_v2_python_sparse
ml_lib/perceptron.py
enerve/ml
train
0
17fcdfb0e94493d58fab386764d7a0dd2a58df65
[ "super().__init__(data)\ncoloring = config.get_option_from_section(consts.DisplayOptions.FLAMEGRAPH.value, 'coloring')\nself.display_options = self.DisplayOptions(coloring)\nself.svg_temp_file = str(file.TempFileName())", "stacks_temp_file = str(file.TempFileName())\ncounts = collections.Counter()\nstack_data = s...
<|body_start_0|> super().__init__(data) coloring = config.get_option_from_section(consts.DisplayOptions.FLAMEGRAPH.value, 'coloring') self.display_options = self.DisplayOptions(coloring) self.svg_temp_file = str(file.TempFileName()) <|end_body_0|> <|body_start_1|> stacks_temp_fi...
The class representing flamegraphs.
Flamegraph
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Flamegraph: """The class representing flamegraphs.""" def __init__(self, data): """Initialise the flamegraph. :param data: A `data_io.StackData` object that encapsulated the collected data we want to display as a flamegraph""" <|body_0|> def _make(self): """Uses ...
stack_v2_sparse_classes_10k_train_006425
3,399
permissive
[ { "docstring": "Initialise the flamegraph. :param data: A `data_io.StackData` object that encapsulated the collected data we want to display as a flamegraph", "name": "__init__", "signature": "def __init__(self, data)" }, { "docstring": "Uses Brendan Gregg's flamegraph tool to convert data to fl...
3
stack_v2_sparse_classes_30k_val_000220
Implement the Python class `Flamegraph` described below. Class description: The class representing flamegraphs. Method signatures and docstrings: - def __init__(self, data): Initialise the flamegraph. :param data: A `data_io.StackData` object that encapsulated the collected data we want to display as a flamegraph - d...
Implement the Python class `Flamegraph` described below. Class description: The class representing flamegraphs. Method signatures and docstrings: - def __init__(self, data): Initialise the flamegraph. :param data: A `data_io.StackData` object that encapsulated the collected data we want to display as a flamegraph - d...
d36c3203cefdd4690ba2ecf076e5e9fca05cbc80
<|skeleton|> class Flamegraph: """The class representing flamegraphs.""" def __init__(self, data): """Initialise the flamegraph. :param data: A `data_io.StackData` object that encapsulated the collected data we want to display as a flamegraph""" <|body_0|> def _make(self): """Uses ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Flamegraph: """The class representing flamegraphs.""" def __init__(self, data): """Initialise the flamegraph. :param data: A `data_io.StackData` object that encapsulated the collected data we want to display as a flamegraph""" super().__init__(data) coloring = config.get_option_fr...
the_stack_v2_python_sparse
marple/display/interface/flamegraph.py
ensoft/marple
train
7
a2027fc35fac278eedc0d6b16539ecf32c5ecaa2
[ "super(DNN, self).__init__()\nself._dropout = dropout\nself.hidden_layers = [None for _ in range(10)]\nfor i in range(10):\n self.hidden_layers[i] = tf.keras.layers.Dense(100, activation='relu', use_bias=True, trainable=trainable, name='dense_{}'.format(i), kernel_initializer='he_normal')\nself.linear = tf.keras...
<|body_start_0|> super(DNN, self).__init__() self._dropout = dropout self.hidden_layers = [None for _ in range(10)] for i in range(10): self.hidden_layers[i] = tf.keras.layers.Dense(100, activation='relu', use_bias=True, trainable=trainable, name='dense_{}'.format(i), kernel_...
Deep Neural Network with 10 hidden layers. Attributes: hidden_layers: A list of 10 tf.keras.layers.Dense layers with ReLU. linear: Fully-connected layer.
DNN
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DNN: """Deep Neural Network with 10 hidden layers. Attributes: hidden_layers: A list of 10 tf.keras.layers.Dense layers with ReLU. linear: Fully-connected layer.""" def __init__(self, trainable=True, dropout=0.15): """Creates the DNN layers. Args: trainable: Whether the DNN parameter...
stack_v2_sparse_classes_10k_train_006426
10,796
permissive
[ { "docstring": "Creates the DNN layers. Args: trainable: Whether the DNN parameters are trainable or not. dropout: Coefficient for dropout regularization.", "name": "__init__", "signature": "def __init__(self, trainable=True, dropout=0.15)" }, { "docstring": "Creates the output tensor given an i...
2
null
Implement the Python class `DNN` described below. Class description: Deep Neural Network with 10 hidden layers. Attributes: hidden_layers: A list of 10 tf.keras.layers.Dense layers with ReLU. linear: Fully-connected layer. Method signatures and docstrings: - def __init__(self, trainable=True, dropout=0.15): Creates t...
Implement the Python class `DNN` described below. Class description: Deep Neural Network with 10 hidden layers. Attributes: hidden_layers: A list of 10 tf.keras.layers.Dense layers with ReLU. linear: Fully-connected layer. Method signatures and docstrings: - def __init__(self, trainable=True, dropout=0.15): Creates t...
727ec399ad17b4dd1f71ce69a26fc3b0371d9fa7
<|skeleton|> class DNN: """Deep Neural Network with 10 hidden layers. Attributes: hidden_layers: A list of 10 tf.keras.layers.Dense layers with ReLU. linear: Fully-connected layer.""" def __init__(self, trainable=True, dropout=0.15): """Creates the DNN layers. Args: trainable: Whether the DNN parameter...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DNN: """Deep Neural Network with 10 hidden layers. Attributes: hidden_layers: A list of 10 tf.keras.layers.Dense layers with ReLU. linear: Fully-connected layer.""" def __init__(self, trainable=True, dropout=0.15): """Creates the DNN layers. Args: trainable: Whether the DNN parameters are trainab...
the_stack_v2_python_sparse
neural_additive_models/models.py
Ayoob7/google-research
train
2
bec1a20f5d61760917005ff69c85a57821f7b375
[ "cnt = 0\nfor i in range(len(flowerbed)):\n if flowerbed[i] == 0 and (i == 0 or flowerbed[i - 1] == 0) and (i == len(flowerbed) - 1 or flowerbed[i + 1] == 0):\n flowerbed[i] = 1\n cnt += 1\nreturn cnt >= n", "cnt = 0\nfor i in range(len(flowerbed)):\n if flowerbed[i] == 0 and (i == 0 or flower...
<|body_start_0|> cnt = 0 for i in range(len(flowerbed)): if flowerbed[i] == 0 and (i == 0 or flowerbed[i - 1] == 0) and (i == len(flowerbed) - 1 or flowerbed[i + 1] == 0): flowerbed[i] = 1 cnt += 1 return cnt >= n <|end_body_0|> <|body_start_1|> ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def canPlaceFlowers(self, flowerbed, n): """:type flowerbed: List[int] :type n: int :rtype: bool""" <|body_0|> def canPlaceFlowers(self, flowerbed, n): """:type flowerbed: List[int] :type n: int :rtype: bool""" <|body_1|> def canPlaceFlowers(se...
stack_v2_sparse_classes_10k_train_006427
1,373
no_license
[ { "docstring": ":type flowerbed: List[int] :type n: int :rtype: bool", "name": "canPlaceFlowers", "signature": "def canPlaceFlowers(self, flowerbed, n)" }, { "docstring": ":type flowerbed: List[int] :type n: int :rtype: bool", "name": "canPlaceFlowers", "signature": "def canPlaceFlowers(...
3
stack_v2_sparse_classes_30k_train_000551
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canPlaceFlowers(self, flowerbed, n): :type flowerbed: List[int] :type n: int :rtype: bool - def canPlaceFlowers(self, flowerbed, n): :type flowerbed: List[int] :type n: int :...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canPlaceFlowers(self, flowerbed, n): :type flowerbed: List[int] :type n: int :rtype: bool - def canPlaceFlowers(self, flowerbed, n): :type flowerbed: List[int] :type n: int :...
a509b383a42f54313970168d9faa11f088f18708
<|skeleton|> class Solution: def canPlaceFlowers(self, flowerbed, n): """:type flowerbed: List[int] :type n: int :rtype: bool""" <|body_0|> def canPlaceFlowers(self, flowerbed, n): """:type flowerbed: List[int] :type n: int :rtype: bool""" <|body_1|> def canPlaceFlowers(se...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def canPlaceFlowers(self, flowerbed, n): """:type flowerbed: List[int] :type n: int :rtype: bool""" cnt = 0 for i in range(len(flowerbed)): if flowerbed[i] == 0 and (i == 0 or flowerbed[i - 1] == 0) and (i == len(flowerbed) - 1 or flowerbed[i + 1] == 0): ...
the_stack_v2_python_sparse
0605_Can_Place_Flowers.py
bingli8802/leetcode
train
0
a0bfb0aec0a5a0db1b795389abf7866bdb28db3a
[ "self.enable_deepcopy = enable_deepcopy\nself.init_val = init_val\nself.root = TrieNode(self.init_val, self.enable_deepcopy)", "i, n = (0, len(string))\nnode = self.root\nwhile i < n:\n if string[i] not in node.next:\n node.next[string[i]] = TrieNode(self.init_val, self.enable_deepcopy)\n if insert_o...
<|body_start_0|> self.enable_deepcopy = enable_deepcopy self.init_val = init_val self.root = TrieNode(self.init_val, self.enable_deepcopy) <|end_body_0|> <|body_start_1|> i, n = (0, len(string)) node = self.root while i < n: if string[i] not in node.next: ...
Class of Trie, which is a kind of search tree—an ordered tree data structure used to store a dynamic set or associative array where the keys are usually strings. (See: https://en.wikipedia.org/wiki/Trie)
Trie
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Trie: """Class of Trie, which is a kind of search tree—an ordered tree data structure used to store a dynamic set or associative array where the keys are usually strings. (See: https://en.wikipedia.org/wiki/Trie)""" def __init__(self, init_val=None, enable_deepcopy=False): """Init a ...
stack_v2_sparse_classes_10k_train_006428
3,546
no_license
[ { "docstring": "Init a Trie using specific initial value. :param init_val: Initial value of each Trie node. :param enable_deepcopy: Whether using the deepcopy to initialize the value of Trie node. This option is useful to avoiding initialize all nodes with a same reference when using list/dict as initial value....
3
stack_v2_sparse_classes_30k_val_000219
Implement the Python class `Trie` described below. Class description: Class of Trie, which is a kind of search tree—an ordered tree data structure used to store a dynamic set or associative array where the keys are usually strings. (See: https://en.wikipedia.org/wiki/Trie) Method signatures and docstrings: - def __in...
Implement the Python class `Trie` described below. Class description: Class of Trie, which is a kind of search tree—an ordered tree data structure used to store a dynamic set or associative array where the keys are usually strings. (See: https://en.wikipedia.org/wiki/Trie) Method signatures and docstrings: - def __in...
72d172ea25777980a49439042dbc39448fcad73d
<|skeleton|> class Trie: """Class of Trie, which is a kind of search tree—an ordered tree data structure used to store a dynamic set or associative array where the keys are usually strings. (See: https://en.wikipedia.org/wiki/Trie)""" def __init__(self, init_val=None, enable_deepcopy=False): """Init a ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Trie: """Class of Trie, which is a kind of search tree—an ordered tree data structure used to store a dynamic set or associative array where the keys are usually strings. (See: https://en.wikipedia.org/wiki/Trie)""" def __init__(self, init_val=None, enable_deepcopy=False): """Init a Trie using sp...
the_stack_v2_python_sparse
src/data_structure/trie.py
stupidchen/leetcode
train
7
eea60ad92b847edb5f9854240c2da5fa07d695cd
[ "string = ''\nstack = [root]\nwhile stack:\n node = stack.pop(0)\n if node is None:\n string += 'null,'\n continue\n else:\n string += f'{node.val},'\n stack.extend([node.left, node.right])\nreturn f'[{string[:-1]}]'", "nodes = data.strip('[').strip(']').split(',')\nheader = nodes...
<|body_start_0|> string = '' stack = [root] while stack: node = stack.pop(0) if node is None: string += 'null,' continue else: string += f'{node.val},' stack.extend([node.left, node.right]) re...
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_10k_train_006429
1,676
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_002381
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:...
b47280681276ec7001efa3d0dbb9c354ca5c6abc
<|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_10k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" string = '' stack = [root] while stack: node = stack.pop(0) if node is None: string += 'null,' continue ...
the_stack_v2_python_sparse
算法训练营/07-递归/297/广度优先遍历.py
youguanxinqing/RoadOfDSA
train
0
7d2fce56982c6d54a4ede5b681be380be64e8019
[ "self.proof_type = proof_type\nself.proof_purpose = proof_purpose\nself.created = created\nself.domain = domain\nself.challenge = challenge\nself.credential_status = credential_status", "if isinstance(o, LDProofVCDetailOptions):\n return self.proof_type == o.proof_type and self.proof_purpose == o.proof_purpose...
<|body_start_0|> self.proof_type = proof_type self.proof_purpose = proof_purpose self.created = created self.domain = domain self.challenge = challenge self.credential_status = credential_status <|end_body_0|> <|body_start_1|> if isinstance(o, LDProofVCDetailOpti...
Linked Data Proof verifiable credential options model.
LDProofVCDetailOptions
[ "LicenseRef-scancode-dco-1.1", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LDProofVCDetailOptions: """Linked Data Proof verifiable credential options model.""" def __init__(self, proof_type: Optional[str]=None, proof_purpose: Optional[str]=None, created: Optional[str]=None, domain: Optional[str]=None, challenge: Optional[str]=None, credential_status: Optional[dict]...
stack_v2_sparse_classes_10k_train_006430
4,481
permissive
[ { "docstring": "Initialize the LDProofVCDetailOptions instance.", "name": "__init__", "signature": "def __init__(self, proof_type: Optional[str]=None, proof_purpose: Optional[str]=None, created: Optional[str]=None, domain: Optional[str]=None, challenge: Optional[str]=None, credential_status: Optional[di...
2
null
Implement the Python class `LDProofVCDetailOptions` described below. Class description: Linked Data Proof verifiable credential options model. Method signatures and docstrings: - def __init__(self, proof_type: Optional[str]=None, proof_purpose: Optional[str]=None, created: Optional[str]=None, domain: Optional[str]=No...
Implement the Python class `LDProofVCDetailOptions` described below. Class description: Linked Data Proof verifiable credential options model. Method signatures and docstrings: - def __init__(self, proof_type: Optional[str]=None, proof_purpose: Optional[str]=None, created: Optional[str]=None, domain: Optional[str]=No...
39cac36d8937ce84a9307ce100aaefb8bc05ec04
<|skeleton|> class LDProofVCDetailOptions: """Linked Data Proof verifiable credential options model.""" def __init__(self, proof_type: Optional[str]=None, proof_purpose: Optional[str]=None, created: Optional[str]=None, domain: Optional[str]=None, challenge: Optional[str]=None, credential_status: Optional[dict]...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LDProofVCDetailOptions: """Linked Data Proof verifiable credential options model.""" def __init__(self, proof_type: Optional[str]=None, proof_purpose: Optional[str]=None, created: Optional[str]=None, domain: Optional[str]=None, challenge: Optional[str]=None, credential_status: Optional[dict]=None) -> Non...
the_stack_v2_python_sparse
aries_cloudagent/protocols/issue_credential/v2_0/formats/ld_proof/models/cred_detail_options.py
hyperledger/aries-cloudagent-python
train
370
a2ade2c6ca67f1449d567d17b0258d2879668864
[ "try:\n self.account = Account.actives.get(pk=account_id)\nexcept Account.DoesNotExist:\n raise AccountNotExistError('Account ID %s does not exist or not active' % account_id)\nelse:\n storage = Storage(GoogleCredentials, 'account', self.account, 'credentials')\n self.credentials = storage.get()\n if...
<|body_start_0|> try: self.account = Account.actives.get(pk=account_id) except Account.DoesNotExist: raise AccountNotExistError('Account ID %s does not exist or not active' % account_id) else: storage = Storage(GoogleCredentials, 'account', self.account, 'cred...
Call Google Data APIs using pre-existing google credentials. Use /api/self/google-connect to get and save credentials. Sample usage: Get all Google contacts of account with id=3 g = GDataClient(account_id=3) response = g.get_json_response('get', 'https://www.google.com/m8/feeds/contacts/default/full', {'max-results': 1...
GDataClient
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GDataClient: """Call Google Data APIs using pre-existing google credentials. Use /api/self/google-connect to get and save credentials. Sample usage: Get all Google contacts of account with id=3 g = GDataClient(account_id=3) response = g.get_json_response('get', 'https://www.google.com/m8/feeds/co...
stack_v2_sparse_classes_10k_train_006431
2,708
no_license
[ { "docstring": "Create GDataClient connecting to an account_id. This account must have google credentials.", "name": "__init__", "signature": "def __init__(self, account_id)" }, { "docstring": "Returns access_token. Refresh if access_token has already expired.", "name": "get_access_token", ...
3
stack_v2_sparse_classes_30k_test_000023
Implement the Python class `GDataClient` described below. Class description: Call Google Data APIs using pre-existing google credentials. Use /api/self/google-connect to get and save credentials. Sample usage: Get all Google contacts of account with id=3 g = GDataClient(account_id=3) response = g.get_json_response('ge...
Implement the Python class `GDataClient` described below. Class description: Call Google Data APIs using pre-existing google credentials. Use /api/self/google-connect to get and save credentials. Sample usage: Get all Google contacts of account with id=3 g = GDataClient(account_id=3) response = g.get_json_response('ge...
0d5912eb2800eeb095df9aec19045e3916ba0d13
<|skeleton|> class GDataClient: """Call Google Data APIs using pre-existing google credentials. Use /api/self/google-connect to get and save credentials. Sample usage: Get all Google contacts of account with id=3 g = GDataClient(account_id=3) response = g.get_json_response('get', 'https://www.google.com/m8/feeds/co...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class GDataClient: """Call Google Data APIs using pre-existing google credentials. Use /api/self/google-connect to get and save credentials. Sample usage: Get all Google contacts of account with id=3 g = GDataClient(account_id=3) response = g.get_json_response('get', 'https://www.google.com/m8/feeds/contacts/defaul...
the_stack_v2_python_sparse
core/shared/google_data_api.py
eventure-interactive/eventure_django
train
0
3b2d844358edfa8f87ccbb40f7f3b7a178157d99
[ "a = 'AGC'\nb = 'AC'\ncomputedMatrix = [[0 for i in range(len(b) + 1)] for j in range(len(a) + 1)]\nfor i in range(1, len(a) + 1):\n computedMatrix[i][0] = computedMatrix[i - 1][0] + pah().weightFunctionDifference('', a[i - 1])\nfor i in range(1, len(b) + 1):\n computedMatrix[0][i] = computedMatrix[0][i - 1] ...
<|body_start_0|> a = 'AGC' b = 'AC' computedMatrix = [[0 for i in range(len(b) + 1)] for j in range(len(a) + 1)] for i in range(1, len(a) + 1): computedMatrix[i][0] = computedMatrix[i - 1][0] + pah().weightFunctionDifference('', a[i - 1]) for i in range(1, len(b) + 1)...
Class to test the correctness of the computation for the class NeedlemanWunsch.
NeedlemanWunschTestClass
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NeedlemanWunschTestClass: """Class to test the correctness of the computation for the class NeedlemanWunsch.""" def test_computeMatrix(self): """Test of the computation of the matrix.""" <|body_0|> def test_traceback(self): """Test of the traceback computation.""...
stack_v2_sparse_classes_10k_train_006432
2,597
no_license
[ { "docstring": "Test of the computation of the matrix.", "name": "test_computeMatrix", "signature": "def test_computeMatrix(self)" }, { "docstring": "Test of the traceback computation.", "name": "test_traceback", "signature": "def test_traceback(self)" } ]
2
stack_v2_sparse_classes_30k_train_005281
Implement the Python class `NeedlemanWunschTestClass` described below. Class description: Class to test the correctness of the computation for the class NeedlemanWunsch. Method signatures and docstrings: - def test_computeMatrix(self): Test of the computation of the matrix. - def test_traceback(self): Test of the tra...
Implement the Python class `NeedlemanWunschTestClass` described below. Class description: Class to test the correctness of the computation for the class NeedlemanWunsch. Method signatures and docstrings: - def test_computeMatrix(self): Test of the computation of the matrix. - def test_traceback(self): Test of the tra...
20d8df6172906337f81583dabb841d66b8f31857
<|skeleton|> class NeedlemanWunschTestClass: """Class to test the correctness of the computation for the class NeedlemanWunsch.""" def test_computeMatrix(self): """Test of the computation of the matrix.""" <|body_0|> def test_traceback(self): """Test of the traceback computation.""...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class NeedlemanWunschTestClass: """Class to test the correctness of the computation for the class NeedlemanWunsch.""" def test_computeMatrix(self): """Test of the computation of the matrix.""" a = 'AGC' b = 'AC' computedMatrix = [[0 for i in range(len(b) + 1)] for j in range(len...
the_stack_v2_python_sparse
new_algs/Sequence+algorithms/Needleman-Wunsch+algorithm/needlemanWunschTest.py
coolsnake/JupyterNotebook
train
0
d2e255737b5c37972a519266509de2d4291e2ac5
[ "i = 0\nwhile i < len(arr):\n if len(arr[i:]) < m * k:\n return False\n j = 1\n while j < k:\n if arr[i:i + m] != arr[i + m * j:i + m * (j + 1)]:\n i += 1\n break\n elif arr[i:i + m] == arr[i + m * j:i + m * (j + 1)]:\n j += 1\n if j == k:\n r...
<|body_start_0|> i = 0 while i < len(arr): if len(arr[i:]) < m * k: return False j = 1 while j < k: if arr[i:i + m] != arr[i + m * j:i + m * (j + 1)]: i += 1 break elif arr[i:i + m...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def containsPattern(self, arr, m, k): """:type arr: List[int] :type m: int :type k: int :rtype: bool""" <|body_0|> def containsPattern(self, arr, m, k): """:type arr: List[int] :type m: int :type k: int :rtype: bool""" <|body_1|> def containsPa...
stack_v2_sparse_classes_10k_train_006433
1,339
no_license
[ { "docstring": ":type arr: List[int] :type m: int :type k: int :rtype: bool", "name": "containsPattern", "signature": "def containsPattern(self, arr, m, k)" }, { "docstring": ":type arr: List[int] :type m: int :type k: int :rtype: bool", "name": "containsPattern", "signature": "def conta...
3
stack_v2_sparse_classes_30k_train_003778
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def containsPattern(self, arr, m, k): :type arr: List[int] :type m: int :type k: int :rtype: bool - def containsPattern(self, arr, m, k): :type arr: List[int] :type m: int :type ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def containsPattern(self, arr, m, k): :type arr: List[int] :type m: int :type k: int :rtype: bool - def containsPattern(self, arr, m, k): :type arr: List[int] :type m: int :type ...
a509b383a42f54313970168d9faa11f088f18708
<|skeleton|> class Solution: def containsPattern(self, arr, m, k): """:type arr: List[int] :type m: int :type k: int :rtype: bool""" <|body_0|> def containsPattern(self, arr, m, k): """:type arr: List[int] :type m: int :type k: int :rtype: bool""" <|body_1|> def containsPa...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def containsPattern(self, arr, m, k): """:type arr: List[int] :type m: int :type k: int :rtype: bool""" i = 0 while i < len(arr): if len(arr[i:]) < m * k: return False j = 1 while j < k: if arr[i:i + m] != ar...
the_stack_v2_python_sparse
1566_Detect_Pattern_of_Length_M_Repeated_K_or_More.py
bingli8802/leetcode
train
0
9e9a5cbfdd434932d9742249705770a7d795518d
[ "if six.PY2:\n buf = io.BytesIO()\n try:\n json.dump(self.document, buf, cls=ProvJSONEncoder, **kwargs)\n buf.seek(0, 0)\n if isinstance(stream, io.TextIOBase):\n stream.write(buf.read().decode('utf-8'))\n else:\n stream.write(buf.read())\n finally:\n ...
<|body_start_0|> if six.PY2: buf = io.BytesIO() try: json.dump(self.document, buf, cls=ProvJSONEncoder, **kwargs) buf.seek(0, 0) if isinstance(stream, io.TextIOBase): stream.write(buf.read().decode('utf-8')) ...
PROV-JSON serializer for :class:`~prov.model.ProvDocument`
ProvJSONSerializer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProvJSONSerializer: """PROV-JSON serializer for :class:`~prov.model.ProvDocument`""" def serialize(self, stream, **kwargs): """Serializes a :class:`~prov.model.ProvDocument` instance to `PROV-JSON <https://provenance.ecs.soton.ac.uk/prov-json/>`_. :param stream: Where to save the out...
stack_v2_sparse_classes_10k_train_006434
13,588
permissive
[ { "docstring": "Serializes a :class:`~prov.model.ProvDocument` instance to `PROV-JSON <https://provenance.ecs.soton.ac.uk/prov-json/>`_. :param stream: Where to save the output.", "name": "serialize", "signature": "def serialize(self, stream, **kwargs)" }, { "docstring": "Deserialize from the `P...
2
null
Implement the Python class `ProvJSONSerializer` described below. Class description: PROV-JSON serializer for :class:`~prov.model.ProvDocument` Method signatures and docstrings: - def serialize(self, stream, **kwargs): Serializes a :class:`~prov.model.ProvDocument` instance to `PROV-JSON <https://provenance.ecs.soton....
Implement the Python class `ProvJSONSerializer` described below. Class description: PROV-JSON serializer for :class:`~prov.model.ProvDocument` Method signatures and docstrings: - def serialize(self, stream, **kwargs): Serializes a :class:`~prov.model.ProvDocument` instance to `PROV-JSON <https://provenance.ecs.soton....
3c3acc55de8ba741e673063378e6cbaf10b64c7a
<|skeleton|> class ProvJSONSerializer: """PROV-JSON serializer for :class:`~prov.model.ProvDocument`""" def serialize(self, stream, **kwargs): """Serializes a :class:`~prov.model.ProvDocument` instance to `PROV-JSON <https://provenance.ecs.soton.ac.uk/prov-json/>`_. :param stream: Where to save the out...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ProvJSONSerializer: """PROV-JSON serializer for :class:`~prov.model.ProvDocument`""" def serialize(self, stream, **kwargs): """Serializes a :class:`~prov.model.ProvDocument` instance to `PROV-JSON <https://provenance.ecs.soton.ac.uk/prov-json/>`_. :param stream: Where to save the output.""" ...
the_stack_v2_python_sparse
env/lib/python3.6/site-packages/prov/serializers/provjson.py
Raniac/NEURO-LEARN
train
9
a1536957cbf57af9f9ffc12f1fbdfb42c4bc4414
[ "self.session = session\nself.starting_op_names = starting_op_names\nself.layer_output = LayerOutput(session=session, starting_op_names=starting_op_names, output_op_names=output_op_names, dir_path=dir_path)\naxis_layout = 'NHWC' if tf.keras.backend.image_data_format() == 'channels_last' else 'NCHW'\nself.save_input...
<|body_start_0|> self.session = session self.starting_op_names = starting_op_names self.layer_output = LayerOutput(session=session, starting_op_names=starting_op_names, output_op_names=output_op_names, dir_path=dir_path) axis_layout = 'NHWC' if tf.keras.backend.image_data_format() == 'ch...
Implementation to capture and save outputs of intermediate layers of a model (fp32/quantsim)
LayerOutputUtil
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LayerOutputUtil: """Implementation to capture and save outputs of intermediate layers of a model (fp32/quantsim)""" def __init__(self, session: tf.compat.v1.Session, starting_op_names: List[str], output_op_names: List[str], dir_path: str): """Constructor for LayerOutputUtil. :param s...
stack_v2_sparse_classes_10k_train_006435
8,075
permissive
[ { "docstring": "Constructor for LayerOutputUtil. :param session: Session containing the model whose layer-outputs are needed. :param starting_op_names: List of starting op names of the model. :param output_op_names: List of output op names of the model. :param dir_path: Directory wherein layer-outputs will be s...
2
stack_v2_sparse_classes_30k_train_006152
Implement the Python class `LayerOutputUtil` described below. Class description: Implementation to capture and save outputs of intermediate layers of a model (fp32/quantsim) Method signatures and docstrings: - def __init__(self, session: tf.compat.v1.Session, starting_op_names: List[str], output_op_names: List[str], ...
Implement the Python class `LayerOutputUtil` described below. Class description: Implementation to capture and save outputs of intermediate layers of a model (fp32/quantsim) Method signatures and docstrings: - def __init__(self, session: tf.compat.v1.Session, starting_op_names: List[str], output_op_names: List[str], ...
5a406e657082b6a4f6e4bf48f0e46e085cb1e351
<|skeleton|> class LayerOutputUtil: """Implementation to capture and save outputs of intermediate layers of a model (fp32/quantsim)""" def __init__(self, session: tf.compat.v1.Session, starting_op_names: List[str], output_op_names: List[str], dir_path: str): """Constructor for LayerOutputUtil. :param s...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LayerOutputUtil: """Implementation to capture and save outputs of intermediate layers of a model (fp32/quantsim)""" def __init__(self, session: tf.compat.v1.Session, starting_op_names: List[str], output_op_names: List[str], dir_path: str): """Constructor for LayerOutputUtil. :param session: Sessi...
the_stack_v2_python_sparse
TrainingExtensions/tensorflow/src/python/aimet_tensorflow/layer_output_utils.py
quic/aimet
train
1,676
a30dc668ed4919bd8a22cc3bec519de812a774a5
[ "print('Inside __init__()')\nself.arg1 = arg1\nself.arg2 = arg2\nself.arg3 = arg3", "print('Inside __call__()')\n\ndef wrapped_f(*args):\n print('Inside wrapped_f()')\n print('Decorator arguments:', self.arg1, self.arg2, self.arg3)\n f(*args)\n print('After f(*args)')\nreturn wrapped_f" ]
<|body_start_0|> print('Inside __init__()') self.arg1 = arg1 self.arg2 = arg2 self.arg3 = arg3 <|end_body_0|> <|body_start_1|> print('Inside __call__()') def wrapped_f(*args): print('Inside wrapped_f()') print('Decorator arguments:', self.arg1, s...
DecoratorWithArguments
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DecoratorWithArguments: def __init__(self, arg1, arg2, arg3): """If there are decorator arguments, the function to be decorated is not passed to the constructor!""" <|body_0|> def __call__(self, f): """If there are decorator arguments, __call__() is only called once,...
stack_v2_sparse_classes_10k_train_006436
2,861
no_license
[ { "docstring": "If there are decorator arguments, the function to be decorated is not passed to the constructor!", "name": "__init__", "signature": "def __init__(self, arg1, arg2, arg3)" }, { "docstring": "If there are decorator arguments, __call__() is only called once, as part of the decoratio...
2
stack_v2_sparse_classes_30k_train_000445
Implement the Python class `DecoratorWithArguments` described below. Class description: Implement the DecoratorWithArguments class. Method signatures and docstrings: - def __init__(self, arg1, arg2, arg3): If there are decorator arguments, the function to be decorated is not passed to the constructor! - def __call__(...
Implement the Python class `DecoratorWithArguments` described below. Class description: Implement the DecoratorWithArguments class. Method signatures and docstrings: - def __init__(self, arg1, arg2, arg3): If there are decorator arguments, the function to be decorated is not passed to the constructor! - def __call__(...
d0b821a48a05f0ec28db73351b6e7a07b435b4a5
<|skeleton|> class DecoratorWithArguments: def __init__(self, arg1, arg2, arg3): """If there are decorator arguments, the function to be decorated is not passed to the constructor!""" <|body_0|> def __call__(self, f): """If there are decorator arguments, __call__() is only called once,...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DecoratorWithArguments: def __init__(self, arg1, arg2, arg3): """If there are decorator arguments, the function to be decorated is not passed to the constructor!""" print('Inside __init__()') self.arg1 = arg1 self.arg2 = arg2 self.arg3 = arg3 def __call__(self, f):...
the_stack_v2_python_sparse
src/main/python/lang/decorator_example.py
solma/com.sma
train
4
8f42eb8d9d3d6c628d52930e874ac5f67242d578
[ "db = DatabaseConnection()\nconn = db.getconnection()\ntry:\n with conn.cursor() as cursor:\n sql = \"SELECT A.user_pref, AST.assertion_type, A.parameters FROM assertions A LEFT JOIN assertions_types AST ON A.assertion_type = AST.id WHERE A.user_pref = '\" + user_pref + \"' ORDER BY A.assertion_type\"\n ...
<|body_start_0|> db = DatabaseConnection() conn = db.getconnection() try: with conn.cursor() as cursor: sql = "SELECT A.user_pref, AST.assertion_type, A.parameters FROM assertions A LEFT JOIN assertions_types AST ON A.assertion_type = AST.id WHERE A.user_pref = '" + u...
AssertionModel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AssertionModel: def getAssertionByUserPreference(self, user_pref): """:param user_pref: :returns the assertions by user preference:""" <|body_0|> def getLikedPagesAndEvents(self): """:returns list of LikedPagesAndEvents object:""" <|body_1|> def getAsser...
stack_v2_sparse_classes_10k_train_006437
4,087
no_license
[ { "docstring": ":param user_pref: :returns the assertions by user preference:", "name": "getAssertionByUserPreference", "signature": "def getAssertionByUserPreference(self, user_pref)" }, { "docstring": ":returns list of LikedPagesAndEvents object:", "name": "getLikedPagesAndEvents", "si...
4
stack_v2_sparse_classes_30k_train_004647
Implement the Python class `AssertionModel` described below. Class description: Implement the AssertionModel class. Method signatures and docstrings: - def getAssertionByUserPreference(self, user_pref): :param user_pref: :returns the assertions by user preference: - def getLikedPagesAndEvents(self): :returns list of ...
Implement the Python class `AssertionModel` described below. Class description: Implement the AssertionModel class. Method signatures and docstrings: - def getAssertionByUserPreference(self, user_pref): :param user_pref: :returns the assertions by user preference: - def getLikedPagesAndEvents(self): :returns list of ...
44a7dc53f33cb342b087d3c62149437eb655a3c7
<|skeleton|> class AssertionModel: def getAssertionByUserPreference(self, user_pref): """:param user_pref: :returns the assertions by user preference:""" <|body_0|> def getLikedPagesAndEvents(self): """:returns list of LikedPagesAndEvents object:""" <|body_1|> def getAsser...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AssertionModel: def getAssertionByUserPreference(self, user_pref): """:param user_pref: :returns the assertions by user preference:""" db = DatabaseConnection() conn = db.getconnection() try: with conn.cursor() as cursor: sql = "SELECT A.user_pref, A...
the_stack_v2_python_sparse
StoryGenerator/storygenappv2/storygen/models/AssertionModel.py
hbrosas/Persona-Based-Life-Story-Generation
train
0
274249474a90cf743e2ab9414cac17c62aa4f169
[ "assert dataset, 'Groundtruth should not be empty.'\nassert isinstance(dataset, dict), 'annotation file format {} not supported'.format(type(dataset))\nself.anns, self.cats, self.imgs = (dict(), dict(), dict())\nself.dataset = copy.deepcopy(dataset)\nself.createIndex()", "res = MaskCOCO()\nres.dataset['images'] =...
<|body_start_0|> assert dataset, 'Groundtruth should not be empty.' assert isinstance(dataset, dict), 'annotation file format {} not supported'.format(type(dataset)) self.anns, self.cats, self.imgs = (dict(), dict(), dict()) self.dataset = copy.deepcopy(dataset) self.createIndex(...
COCO object for mask evaluation.
MaskCOCO
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MaskCOCO: """COCO object for mask evaluation.""" def reset(self, dataset): """Reset the dataset and groundtruth data index in this object. Args: dataset: dict of groundtruth data. It should has similar structure as the COCO groundtruth JSON file. Must contains three keys: {'images', ...
stack_v2_sparse_classes_10k_train_006438
14,113
permissive
[ { "docstring": "Reset the dataset and groundtruth data index in this object. Args: dataset: dict of groundtruth data. It should has similar structure as the COCO groundtruth JSON file. Must contains three keys: {'images', 'annotations', 'categories'}. 'images': list of image information dictionary. Required key...
3
stack_v2_sparse_classes_30k_train_005496
Implement the Python class `MaskCOCO` described below. Class description: COCO object for mask evaluation. Method signatures and docstrings: - def reset(self, dataset): Reset the dataset and groundtruth data index in this object. Args: dataset: dict of groundtruth data. It should has similar structure as the COCO gro...
Implement the Python class `MaskCOCO` described below. Class description: COCO object for mask evaluation. Method signatures and docstrings: - def reset(self, dataset): Reset the dataset and groundtruth data index in this object. Args: dataset: dict of groundtruth data. It should has similar structure as the COCO gro...
a5388a45f71a949639b35cc5b990bd130d2d8164
<|skeleton|> class MaskCOCO: """COCO object for mask evaluation.""" def reset(self, dataset): """Reset the dataset and groundtruth data index in this object. Args: dataset: dict of groundtruth data. It should has similar structure as the COCO groundtruth JSON file. Must contains three keys: {'images', ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MaskCOCO: """COCO object for mask evaluation.""" def reset(self, dataset): """Reset the dataset and groundtruth data index in this object. Args: dataset: dict of groundtruth data. It should has similar structure as the COCO groundtruth JSON file. Must contains three keys: {'images', 'annotations'...
the_stack_v2_python_sparse
TensorFlow2/Segmentation/MaskRCNN/mrcnn_tf2/utils/coco_metric.py
NVIDIA/DeepLearningExamples
train
11,838
b0dde38ca32d9cb6f940d0cfac13eaf2cb04d2c7
[ "n = len(A)\nif n < 3 or A[0] >= A[1] or A[n - 2] <= A[n - 1]:\n return False\ni = 1\nwhile i < n:\n if A[i - 1] < A[i]:\n i += 1\n else:\n break\nif i == n or A[i - 1] == A[i]:\n return False\nwhile i < n:\n if A[i - 1] > A[i]:\n i += 1\n else:\n return False\nreturn i...
<|body_start_0|> n = len(A) if n < 3 or A[0] >= A[1] or A[n - 2] <= A[n - 1]: return False i = 1 while i < n: if A[i - 1] < A[i]: i += 1 else: break if i == n or A[i - 1] == A[i]: return False ...
Solution
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def validMountainArray(self, A: List[int]) -> bool: """Runtime: 236 ms, faster than 79.18% of Python3 online submissions for Valid Mountain Array. Memory Usage: 15.2 MB, less than 5.26% of Python3 online submissions for Valid Mountain Array.""" <|body_0|> def valid...
stack_v2_sparse_classes_10k_train_006439
1,841
permissive
[ { "docstring": "Runtime: 236 ms, faster than 79.18% of Python3 online submissions for Valid Mountain Array. Memory Usage: 15.2 MB, less than 5.26% of Python3 online submissions for Valid Mountain Array.", "name": "validMountainArray", "signature": "def validMountainArray(self, A: List[int]) -> bool" }...
2
stack_v2_sparse_classes_30k_train_001485
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def validMountainArray(self, A: List[int]) -> bool: Runtime: 236 ms, faster than 79.18% of Python3 online submissions for Valid Mountain Array. Memory Usage: 15.2 MB, less than 5...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def validMountainArray(self, A: List[int]) -> bool: Runtime: 236 ms, faster than 79.18% of Python3 online submissions for Valid Mountain Array. Memory Usage: 15.2 MB, less than 5...
9d7759bea1f44673c2de4f25a94b27368928a59f
<|skeleton|> class Solution: def validMountainArray(self, A: List[int]) -> bool: """Runtime: 236 ms, faster than 79.18% of Python3 online submissions for Valid Mountain Array. Memory Usage: 15.2 MB, less than 5.26% of Python3 online submissions for Valid Mountain Array.""" <|body_0|> def valid...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def validMountainArray(self, A: List[int]) -> bool: """Runtime: 236 ms, faster than 79.18% of Python3 online submissions for Valid Mountain Array. Memory Usage: 15.2 MB, less than 5.26% of Python3 online submissions for Valid Mountain Array.""" n = len(A) if n < 3 or A[0] >= ...
the_stack_v2_python_sparse
leetcode/google/tagged/mountain_array.py
pagsamo/google-tech-dev-guide
train
0
c66b999b7b85c6b60b29e358a5db643988fde3b4
[ "n = len(init_val)\nself.segfunc = segfunc\nself.ide_ele = ide_ele\nself.num = 1 << (n - 1).bit_length()\nself.tree = [ide_ele] * 2 * self.num\nfor i in range(n):\n self.tree[self.num + i] = init_val[i]\nfor i in range(self.num - 1, 0, -1):\n self.tree[i] = self.segfunc(self.tree[2 * i], self.tree[2 * i + 1])...
<|body_start_0|> n = len(init_val) self.segfunc = segfunc self.ide_ele = ide_ele self.num = 1 << (n - 1).bit_length() self.tree = [ide_ele] * 2 * self.num for i in range(n): self.tree[self.num + i] = init_val[i] for i in range(self.num - 1, 0, -1): ...
init(init_val, ide_ele): 配列init_valで初期化 O(N) update(k, x): k番目の値をxに更新 O(N) query(l, r): 区間[l, r)をsegfuncしたものを返す O(logN)
SegTree
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SegTree: """init(init_val, ide_ele): 配列init_valで初期化 O(N) update(k, x): k番目の値をxに更新 O(N) query(l, r): 区間[l, r)をsegfuncしたものを返す O(logN)""" def __init__(self, init_val, segfunc, ide_ele): """init_val: 配列の初期値 segfunc: 区間にしたい操作 ide_ele: 単位元 n: 要素数 num: n以上の最小の2のべき乗 tree: セグメント木(1-index)""" ...
stack_v2_sparse_classes_10k_train_006440
2,441
no_license
[ { "docstring": "init_val: 配列の初期値 segfunc: 区間にしたい操作 ide_ele: 単位元 n: 要素数 num: n以上の最小の2のべき乗 tree: セグメント木(1-index)", "name": "__init__", "signature": "def __init__(self, init_val, segfunc, ide_ele)" }, { "docstring": "k番目の値をxに更新 k: index(0-index) x: update value", "name": "update", "signatur...
3
stack_v2_sparse_classes_30k_train_000938
Implement the Python class `SegTree` described below. Class description: init(init_val, ide_ele): 配列init_valで初期化 O(N) update(k, x): k番目の値をxに更新 O(N) query(l, r): 区間[l, r)をsegfuncしたものを返す O(logN) Method signatures and docstrings: - def __init__(self, init_val, segfunc, ide_ele): init_val: 配列の初期値 segfunc: 区間にしたい操作 ide_el...
Implement the Python class `SegTree` described below. Class description: init(init_val, ide_ele): 配列init_valで初期化 O(N) update(k, x): k番目の値をxに更新 O(N) query(l, r): 区間[l, r)をsegfuncしたものを返す O(logN) Method signatures and docstrings: - def __init__(self, init_val, segfunc, ide_ele): init_val: 配列の初期値 segfunc: 区間にしたい操作 ide_el...
2526e72de9eb19d1e1c634dbd577816bfe39bc10
<|skeleton|> class SegTree: """init(init_val, ide_ele): 配列init_valで初期化 O(N) update(k, x): k番目の値をxに更新 O(N) query(l, r): 区間[l, r)をsegfuncしたものを返す O(logN)""" def __init__(self, init_val, segfunc, ide_ele): """init_val: 配列の初期値 segfunc: 区間にしたい操作 ide_ele: 単位元 n: 要素数 num: n以上の最小の2のべき乗 tree: セグメント木(1-index)""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SegTree: """init(init_val, ide_ele): 配列init_valで初期化 O(N) update(k, x): k番目の値をxに更新 O(N) query(l, r): 区間[l, r)をsegfuncしたものを返す O(logN)""" def __init__(self, init_val, segfunc, ide_ele): """init_val: 配列の初期値 segfunc: 区間にしたい操作 ide_ele: 単位元 n: 要素数 num: n以上の最小の2のべき乗 tree: セグメント木(1-index)""" n = l...
the_stack_v2_python_sparse
ABC/ACLBC/ACLBC_D.py
happa64/AtCoder_Beginner_Contest
train
0
87a7e039e27f4b1b3d22c985e9a3f9461d2728ec
[ "user = self\nuser_employee = self.env['hr.employee'].search_read([('user_id', '=', user.id)], fields=['id'])\nresult = []\nif user_employee:\n employee_ref = user_employee[0]['id']\n result.append(str(employee_ref))\n my_subordinates = self.env['hr.employee'].search_read(['|', ('coach_id', '=', employee_r...
<|body_start_0|> user = self user_employee = self.env['hr.employee'].search_read([('user_id', '=', user.id)], fields=['id']) result = [] if user_employee: employee_ref = user_employee[0]['id'] result.append(str(employee_ref)) my_subordinates = self.env...
ResUsers
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResUsers: def get_my_subordinate_employees(self): """Return employee's subordinates - list of employees for which user is a Manager Or Coach""" <|body_0|> def get_my_subordinate_employees_list(self): """Return employee's subordinates - list of employees for which use...
stack_v2_sparse_classes_10k_train_006441
1,903
no_license
[ { "docstring": "Return employee's subordinates - list of employees for which user is a Manager Or Coach", "name": "get_my_subordinate_employees", "signature": "def get_my_subordinate_employees(self)" }, { "docstring": "Return employee's subordinates - list of employees for which user is a Manage...
2
null
Implement the Python class `ResUsers` described below. Class description: Implement the ResUsers class. Method signatures and docstrings: - def get_my_subordinate_employees(self): Return employee's subordinates - list of employees for which user is a Manager Or Coach - def get_my_subordinate_employees_list(self): Ret...
Implement the Python class `ResUsers` described below. Class description: Implement the ResUsers class. Method signatures and docstrings: - def get_my_subordinate_employees(self): Return employee's subordinates - list of employees for which user is a Manager Or Coach - def get_my_subordinate_employees_list(self): Ret...
4fe19ca76523cf274a3a85c8bcad653100ff556f
<|skeleton|> class ResUsers: def get_my_subordinate_employees(self): """Return employee's subordinates - list of employees for which user is a Manager Or Coach""" <|body_0|> def get_my_subordinate_employees_list(self): """Return employee's subordinates - list of employees for which use...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ResUsers: def get_my_subordinate_employees(self): """Return employee's subordinates - list of employees for which user is a Manager Or Coach""" user = self user_employee = self.env['hr.employee'].search_read([('user_id', '=', user.id)], fields=['id']) result = [] if use...
the_stack_v2_python_sparse
odoo app/ksa_hr_vacation/models/res_users.py
ahmed-amine-ellouze/personal
train
0
1b3538cb8b6ddc9180fb62f925ab213932bb6415
[ "self.minBit = minBit\nself.nBits = nBits\nself.desc = desc", "reg_shift = regVal / 2 ** self.minBit\nreg_mod = reg_shift % 2 ** self.nBits\nreturn reg_mod" ]
<|body_start_0|> self.minBit = minBit self.nBits = nBits self.desc = desc <|end_body_0|> <|body_start_1|> reg_shift = regVal / 2 ** self.minBit reg_mod = reg_shift % 2 ** self.nBits return reg_mod <|end_body_1|>
Describe meaning of a register bit-set
RegisterFieldInfo
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RegisterFieldInfo: """Describe meaning of a register bit-set""" def __init__(self, minBit, nBits, desc): """fieldName - name of bitfield withing register minBit - LSB of field (numbered from 0) nBits - size of bit-field desc - txt description""" <|body_0|> def extractVal...
stack_v2_sparse_classes_10k_train_006442
9,121
permissive
[ { "docstring": "fieldName - name of bitfield withing register minBit - LSB of field (numbered from 0) nBits - size of bit-field desc - txt description", "name": "__init__", "signature": "def __init__(self, minBit, nBits, desc)" }, { "docstring": "Extract register field value (as integer) from fu...
2
stack_v2_sparse_classes_30k_train_007173
Implement the Python class `RegisterFieldInfo` described below. Class description: Describe meaning of a register bit-set Method signatures and docstrings: - def __init__(self, minBit, nBits, desc): fieldName - name of bitfield withing register minBit - LSB of field (numbered from 0) nBits - size of bit-field desc - ...
Implement the Python class `RegisterFieldInfo` described below. Class description: Describe meaning of a register bit-set Method signatures and docstrings: - def __init__(self, minBit, nBits, desc): fieldName - name of bitfield withing register minBit - LSB of field (numbered from 0) nBits - size of bit-field desc - ...
3b824540d8173a24be12316a3821304e4ea20a1f
<|skeleton|> class RegisterFieldInfo: """Describe meaning of a register bit-set""" def __init__(self, minBit, nBits, desc): """fieldName - name of bitfield withing register minBit - LSB of field (numbered from 0) nBits - size of bit-field desc - txt description""" <|body_0|> def extractVal...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RegisterFieldInfo: """Describe meaning of a register bit-set""" def __init__(self, minBit, nBits, desc): """fieldName - name of bitfield withing register minBit - LSB of field (numbered from 0) nBits - size of bit-field desc - txt description""" self.minBit = minBit self.nBits = n...
the_stack_v2_python_sparse
python/LATCRootData.py
fermi-lat/configData
train
0
ae9a8f0bb32df5471b28635dd3f324a8914f0761
[ "KratosMultiphysics.Process.__init__(self)\ndefault_settings = KratosMultiphysics.Parameters('\\n {\\n \"help\" : \"This process replaces the properties in a given instant\",\\n \"model_part_name\" : \"\",\\n \"materials_filename\" ...
<|body_start_0|> KratosMultiphysics.Process.__init__(self) default_settings = KratosMultiphysics.Parameters('\n {\n "help" : "This process replaces the properties in a given instant",\n "model_part_name" : "",\n "materials_filena...
This process replaces the properties in a given instant Only the member variables listed below should be accessed directly. Public member variables: Model -- the container of the different model parts. settings -- Kratos parameters containing solver settings.
ReplacePropertiesProcess
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReplacePropertiesProcess: """This process replaces the properties in a given instant Only the member variables listed below should be accessed directly. Public member variables: Model -- the container of the different model parts. settings -- Kratos parameters containing solver settings.""" ...
stack_v2_sparse_classes_10k_train_006443
3,806
permissive
[ { "docstring": "The default constructor of the class Keyword arguments: self -- It signifies an instance of a class. Model -- the container of the different model parts. settings -- Kratos parameters containing solver settings.", "name": "__init__", "signature": "def __init__(self, Model, settings)" }...
2
null
Implement the Python class `ReplacePropertiesProcess` described below. Class description: This process replaces the properties in a given instant Only the member variables listed below should be accessed directly. Public member variables: Model -- the container of the different model parts. settings -- Kratos paramete...
Implement the Python class `ReplacePropertiesProcess` described below. Class description: This process replaces the properties in a given instant Only the member variables listed below should be accessed directly. Public member variables: Model -- the container of the different model parts. settings -- Kratos paramete...
366949ec4e3651702edc6ac3061d2988f10dd271
<|skeleton|> class ReplacePropertiesProcess: """This process replaces the properties in a given instant Only the member variables listed below should be accessed directly. Public member variables: Model -- the container of the different model parts. settings -- Kratos parameters containing solver settings.""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ReplacePropertiesProcess: """This process replaces the properties in a given instant Only the member variables listed below should be accessed directly. Public member variables: Model -- the container of the different model parts. settings -- Kratos parameters containing solver settings.""" def __init__(...
the_stack_v2_python_sparse
applications/ContactStructuralMechanicsApplication/python_scripts/replace_properties_process.py
KratosMultiphysics/Kratos
train
994
c81679de5cc003b92c404006a988f2623b6537f6
[ "def bisearch_l() -> int:\n i = -1\n l, r = (0, len(nums) - 1)\n while l <= r:\n m = (l + r) // 2\n if nums[m] >= target:\n r = m - 1\n else:\n l = m + 1\n if nums[m] == target:\n i = m\n return i\n\ndef bisearch_r() -> int:\n i = -1\n l...
<|body_start_0|> def bisearch_l() -> int: i = -1 l, r = (0, len(nums) - 1) while l <= r: m = (l + r) // 2 if nums[m] >= target: r = m - 1 else: l = m + 1 if nums[m] == targ...
Solution
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def searchRange4(self, nums: List[int], target: int) -> List[int]: """bisect.bisect_left() and bisect.bisect_right(), O(log n) Runtime: 68ms""" <|body_0|> def searchRange1(self, nums: List[int], target: int) -> List[int]: """Binary search: O(log n), the wor...
stack_v2_sparse_classes_10k_train_006444
4,074
permissive
[ { "docstring": "bisect.bisect_left() and bisect.bisect_right(), O(log n) Runtime: 68ms", "name": "searchRange4", "signature": "def searchRange4(self, nums: List[int], target: int) -> List[int]" }, { "docstring": "Binary search: O(log n), the worst case n + log n Runtime: 72ms", "name": "sear...
4
stack_v2_sparse_classes_30k_train_001808
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def searchRange4(self, nums: List[int], target: int) -> List[int]: bisect.bisect_left() and bisect.bisect_right(), O(log n) Runtime: 68ms - def searchRange1(self, nums: List[int]...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def searchRange4(self, nums: List[int], target: int) -> List[int]: bisect.bisect_left() and bisect.bisect_right(), O(log n) Runtime: 68ms - def searchRange1(self, nums: List[int]...
49a0b03c55d8a702785888d473ef96539265ce9c
<|skeleton|> class Solution: def searchRange4(self, nums: List[int], target: int) -> List[int]: """bisect.bisect_left() and bisect.bisect_right(), O(log n) Runtime: 68ms""" <|body_0|> def searchRange1(self, nums: List[int], target: int) -> List[int]: """Binary search: O(log n), the wor...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def searchRange4(self, nums: List[int], target: int) -> List[int]: """bisect.bisect_left() and bisect.bisect_right(), O(log n) Runtime: 68ms""" def bisearch_l() -> int: i = -1 l, r = (0, len(nums) - 1) while l <= r: m = (l + r) // 2...
the_stack_v2_python_sparse
leetcode/0034_find_first_and_last_position_of_element_in_sorted_array.py
chaosWsF/Python-Practice
train
1
29fb92fea72b57ffec209da8be14747c69eede46
[ "self.hhsearch_pdb70_runner = HHSearch(binary_path=hhsearch_binary_path, databases=[pdb70_database_path])\nself.template_featurizer = template_featurizer\nself.result_path = result_path\nself.use_env = use_env", "with open(input_fasta_path) as f:\n input_fasta_str = f.read()\ninput_seqs, input_descs = parse_fa...
<|body_start_0|> self.hhsearch_pdb70_runner = HHSearch(binary_path=hhsearch_binary_path, databases=[pdb70_database_path]) self.template_featurizer = template_featurizer self.result_path = result_path self.use_env = use_env <|end_body_0|> <|body_start_1|> with open(input_fasta_pa...
Runs the alignment tools and assembles the input features.
DataPipeline
[ "Apache-2.0", "LicenseRef-scancode-generic-cla" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataPipeline: """Runs the alignment tools and assembles the input features.""" def __init__(self, hhsearch_binary_path: str, pdb70_database_path: str, template_featurizer: TemplateHitFeaturizer, result_path, use_env=False): """Constructs a feature dict for a given FASTA file.""" ...
stack_v2_sparse_classes_10k_train_006445
8,009
permissive
[ { "docstring": "Constructs a feature dict for a given FASTA file.", "name": "__init__", "signature": "def __init__(self, hhsearch_binary_path: str, pdb70_database_path: str, template_featurizer: TemplateHitFeaturizer, result_path, use_env=False)" }, { "docstring": "Runs alignment tools on the in...
2
stack_v2_sparse_classes_30k_train_001507
Implement the Python class `DataPipeline` described below. Class description: Runs the alignment tools and assembles the input features. Method signatures and docstrings: - def __init__(self, hhsearch_binary_path: str, pdb70_database_path: str, template_featurizer: TemplateHitFeaturizer, result_path, use_env=False): ...
Implement the Python class `DataPipeline` described below. Class description: Runs the alignment tools and assembles the input features. Method signatures and docstrings: - def __init__(self, hhsearch_binary_path: str, pdb70_database_path: str, template_featurizer: TemplateHitFeaturizer, result_path, use_env=False): ...
c72ce898482419117550ad16d93b38298f4306a1
<|skeleton|> class DataPipeline: """Runs the alignment tools and assembles the input features.""" def __init__(self, hhsearch_binary_path: str, pdb70_database_path: str, template_featurizer: TemplateHitFeaturizer, result_path, use_env=False): """Constructs a feature dict for a given FASTA file.""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DataPipeline: """Runs the alignment tools and assembles the input features.""" def __init__(self, hhsearch_binary_path: str, pdb70_database_path: str, template_featurizer: TemplateHitFeaturizer, result_path, use_env=False): """Constructs a feature dict for a given FASTA file.""" self.hhse...
the_stack_v2_python_sparse
reproduce/AlphaFold2-Chinese/data/tools/data_process.py
mindspore-ai/community
train
193
0bc268e0959ebd52db661aadc09388190f61175c
[ "super(Linker_separate, self).__init__()\nself.config = config\nself.encoder = encoder\nself.entity_embeddings = nn.Embedding(self.config.entity_size, self.config.embedding_dim)\nself.entity_embeddings_struct = nn.Embedding(self.config.entity_size, self.config.embedding_dim)\nif self.config.priors:\n self.char_f...
<|body_start_0|> super(Linker_separate, self).__init__() self.config = config self.encoder = encoder self.entity_embeddings = nn.Embedding(self.config.entity_size, self.config.embedding_dim) self.entity_embeddings_struct = nn.Embedding(self.config.entity_size, self.config.embeddi...
Linker_separate
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Linker_separate: def __init__(self, config, encoder): """:param config: A config object that specifies the hyperparameters of the model :param encoder: A Encoder for encoding mentions""" <|body_0|> def forward(self, entity_candidates, mention_representation, sentence, char_s...
stack_v2_sparse_classes_10k_train_006446
42,719
permissive
[ { "docstring": ":param config: A config object that specifies the hyperparameters of the model :param encoder: A Encoder for encoding mentions", "name": "__init__", "signature": "def __init__(self, config, encoder)" }, { "docstring": ":return: unnormalized log probabilities (logits) of gold enti...
2
stack_v2_sparse_classes_30k_train_007094
Implement the Python class `Linker_separate` described below. Class description: Implement the Linker_separate class. Method signatures and docstrings: - def __init__(self, config, encoder): :param config: A config object that specifies the hyperparameters of the model :param encoder: A Encoder for encoding mentions ...
Implement the Python class `Linker_separate` described below. Class description: Implement the Linker_separate class. Method signatures and docstrings: - def __init__(self, config, encoder): :param config: A config object that specifies the hyperparameters of the model :param encoder: A Encoder for encoding mentions ...
6a7dcd7d3756327c61ef949e5b4f6af6e2849187
<|skeleton|> class Linker_separate: def __init__(self, config, encoder): """:param config: A config object that specifies the hyperparameters of the model :param encoder: A Encoder for encoding mentions""" <|body_0|> def forward(self, entity_candidates, mention_representation, sentence, char_s...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Linker_separate: def __init__(self, config, encoder): """:param config: A config object that specifies the hyperparameters of the model :param encoder: A Encoder for encoding mentions""" super(Linker_separate, self).__init__() self.config = config self.encoder = encoder ...
the_stack_v2_python_sparse
typenet/src/model.py
dhruvdcoder/dl-with-constraints
train
0
bd487e09af6d18f93bf1d59df677765294db5a40
[ "pm_config = pm.PaddleMobileConfig()\npm_config.precision = pm.PaddleMobileConfig.Precision.FP32\npm_config.device = pm.PaddleMobileConfig.Device.kFPGA\nif model_dir:\n pm_config.model_dir = model_dir\nelse:\n pm_config.prog_file = model_flie\n pm_config.param_file = param_file\npm_config.thread_num = thre...
<|body_start_0|> pm_config = pm.PaddleMobileConfig() pm_config.precision = pm.PaddleMobileConfig.Precision.FP32 pm_config.device = pm.PaddleMobileConfig.Device.kFPGA if model_dir: pm_config.model_dir = model_dir else: pm_config.prog_file = model_flie ...
pm_model
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class pm_model: def load_model(self, model_flie, param_file, thread_num, model_dir): """加载PaddleMobile模型 参数:模型文件、模型参数文件、线程数、模型目录 返回:模型预测器""" <|body_0|> def data_feed(self, data_shape): """初始化PaddleMobile模型输入数据张量 参数:数据形状 返回:数据张量""" <|body_1|> def predict(self, ...
stack_v2_sparse_classes_10k_train_006447
3,563
permissive
[ { "docstring": "加载PaddleMobile模型 参数:模型文件、模型参数文件、线程数、模型目录 返回:模型预测器", "name": "load_model", "signature": "def load_model(self, model_flie, param_file, thread_num, model_dir)" }, { "docstring": "初始化PaddleMobile模型输入数据张量 参数:数据形状 返回:数据张量", "name": "data_feed", "signature": "def data_feed(self,...
3
null
Implement the Python class `pm_model` described below. Class description: Implement the pm_model class. Method signatures and docstrings: - def load_model(self, model_flie, param_file, thread_num, model_dir): 加载PaddleMobile模型 参数:模型文件、模型参数文件、线程数、模型目录 返回:模型预测器 - def data_feed(self, data_shape): 初始化PaddleMobile模型输入数据张量 ...
Implement the Python class `pm_model` described below. Class description: Implement the pm_model class. Method signatures and docstrings: - def load_model(self, model_flie, param_file, thread_num, model_dir): 加载PaddleMobile模型 参数:模型文件、模型参数文件、线程数、模型目录 返回:模型预测器 - def data_feed(self, data_shape): 初始化PaddleMobile模型输入数据张量 ...
afbd0e081763c53833617a4892d03043e644d641
<|skeleton|> class pm_model: def load_model(self, model_flie, param_file, thread_num, model_dir): """加载PaddleMobile模型 参数:模型文件、模型参数文件、线程数、模型目录 返回:模型预测器""" <|body_0|> def data_feed(self, data_shape): """初始化PaddleMobile模型输入数据张量 参数:数据形状 返回:数据张量""" <|body_1|> def predict(self, ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class pm_model: def load_model(self, model_flie, param_file, thread_num, model_dir): """加载PaddleMobile模型 参数:模型文件、模型参数文件、线程数、模型目录 返回:模型预测器""" pm_config = pm.PaddleMobileConfig() pm_config.precision = pm.PaddleMobileConfig.Precision.FP32 pm_config.device = pm.PaddleMobileConfig.Device....
the_stack_v2_python_sparse
mastercar/eblite_smart_car-master/model.py
wpy-111/python
train
1
7f6a83b13e41852bfb6bf635e66d82ab2997389e
[ "super(MultiBandUpdateManager, self).__init__(kwargs_model, kwargs_constraints, kwargs_likelihood, kwargs_params)\nkwargs_lens_fixed_init, _, _, _, _, _ = self.fixed_kwargs\nself._kwargs_lens_fixed_init = copy.deepcopy(kwargs_lens_fixed_init)\nself._index_lens_model_list = kwargs_model.get('index_lens_model_list', ...
<|body_start_0|> super(MultiBandUpdateManager, self).__init__(kwargs_model, kwargs_constraints, kwargs_likelihood, kwargs_params) kwargs_lens_fixed_init, _, _, _, _, _ = self.fixed_kwargs self._kwargs_lens_fixed_init = copy.deepcopy(kwargs_lens_fixed_init) self._index_lens_model_list = k...
specific Manager to deal with multiple images with disjoint lens model parameterization. The class inherits the UpdateManager() class and adds functionalities to hold and relieve fixed all lens model parameters of a specific frame/image for more convenient use of the FittingSequence.
MultiBandUpdateManager
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiBandUpdateManager: """specific Manager to deal with multiple images with disjoint lens model parameterization. The class inherits the UpdateManager() class and adds functionalities to hold and relieve fixed all lens model parameters of a specific frame/image for more convenient use of the Fi...
stack_v2_sparse_classes_10k_train_006448
4,390
permissive
[ { "docstring": ":param kwargs_model: keyword arguments to describe all model components used in class_creator.create_class_instances() :param kwargs_constraints: keyword arguments of the Param() class to handle parameter constraints during the sampling (except upper and lower limits and sampling input mean and ...
4
null
Implement the Python class `MultiBandUpdateManager` described below. Class description: specific Manager to deal with multiple images with disjoint lens model parameterization. The class inherits the UpdateManager() class and adds functionalities to hold and relieve fixed all lens model parameters of a specific frame/...
Implement the Python class `MultiBandUpdateManager` described below. Class description: specific Manager to deal with multiple images with disjoint lens model parameterization. The class inherits the UpdateManager() class and adds functionalities to hold and relieve fixed all lens model parameters of a specific frame/...
73c9645f26f6983fe7961104075ebe8bf7a4b54c
<|skeleton|> class MultiBandUpdateManager: """specific Manager to deal with multiple images with disjoint lens model parameterization. The class inherits the UpdateManager() class and adds functionalities to hold and relieve fixed all lens model parameters of a specific frame/image for more convenient use of the Fi...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MultiBandUpdateManager: """specific Manager to deal with multiple images with disjoint lens model parameterization. The class inherits the UpdateManager() class and adds functionalities to hold and relieve fixed all lens model parameters of a specific frame/image for more convenient use of the FittingSequence...
the_stack_v2_python_sparse
lenstronomy/Workflow/multi_band_manager.py
lenstronomy/lenstronomy
train
41
4e589f8922519877ee6234a81b63ea36292a13a8
[ "super().__init__()\nself.recursion_degree = recursion_degree\nself._sk = SolovayKitaevDecomposition(basic_approximations)", "for node in dag.op_nodes():\n if not node.op.num_qubits == 1:\n continue\n check_input = not isinstance(node.op, Gate)\n if not hasattr(node.op, 'to_matrix'):\n rais...
<|body_start_0|> super().__init__() self.recursion_degree = recursion_degree self._sk = SolovayKitaevDecomposition(basic_approximations) <|end_body_0|> <|body_start_1|> for node in dag.op_nodes(): if not node.op.num_qubits == 1: continue check_inp...
Approximately decompose 1q gates to a discrete basis using the Solovay-Kitaev algorithm. The Solovay-Kitaev theorem [1] states that any single qubit gate can be approximated to arbitrary precision by a set of fixed single-qubit gates, if the set generates a dense subset in :math:`SU(2)`. This is an important result, si...
SolovayKitaev
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SolovayKitaev: """Approximately decompose 1q gates to a discrete basis using the Solovay-Kitaev algorithm. The Solovay-Kitaev theorem [1] states that any single qubit gate can be approximated to arbitrary precision by a set of fixed single-qubit gates, if the set generates a dense subset in :math...
stack_v2_sparse_classes_10k_train_006449
10,726
permissive
[ { "docstring": "Args: recursion_degree: The recursion depth for the Solovay-Kitaev algorithm. A larger recursion depth increases the accuracy and length of the decomposition. basic_approximations: The basic approximations for the finding the best discrete decomposition at the root of the recursion. If a string,...
2
stack_v2_sparse_classes_30k_test_000402
Implement the Python class `SolovayKitaev` described below. Class description: Approximately decompose 1q gates to a discrete basis using the Solovay-Kitaev algorithm. The Solovay-Kitaev theorem [1] states that any single qubit gate can be approximated to arbitrary precision by a set of fixed single-qubit gates, if th...
Implement the Python class `SolovayKitaev` described below. Class description: Approximately decompose 1q gates to a discrete basis using the Solovay-Kitaev algorithm. The Solovay-Kitaev theorem [1] states that any single qubit gate can be approximated to arbitrary precision by a set of fixed single-qubit gates, if th...
0b51250e219ca303654fc28a318c21366584ccd3
<|skeleton|> class SolovayKitaev: """Approximately decompose 1q gates to a discrete basis using the Solovay-Kitaev algorithm. The Solovay-Kitaev theorem [1] states that any single qubit gate can be approximated to arbitrary precision by a set of fixed single-qubit gates, if the set generates a dense subset in :math...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SolovayKitaev: """Approximately decompose 1q gates to a discrete basis using the Solovay-Kitaev algorithm. The Solovay-Kitaev theorem [1] states that any single qubit gate can be approximated to arbitrary precision by a set of fixed single-qubit gates, if the set generates a dense subset in :math:`SU(2)`. Thi...
the_stack_v2_python_sparse
qiskit/transpiler/passes/synthesis/solovay_kitaev_synthesis.py
1ucian0/qiskit-terra
train
6
e59c138015eb4cb1bd22d60604ba1e0588687204
[ "self.root = Node()\nself.m = max(map(len, words))\nself.initials = set([word[0] for word in words])\nl = []\nfor word in words:\n l += list(word)\nself.letters = set(l)\nself.trie = Trie()\nself.stream = ''", "if letter not in self.letters:\n self.stream = ''\n return False\nif len(self.stream) == 0 and...
<|body_start_0|> self.root = Node() self.m = max(map(len, words)) self.initials = set([word[0] for word in words]) l = [] for word in words: l += list(word) self.letters = set(l) self.trie = Trie() self.stream = '' <|end_body_0|> <|body_start_...
StreamChecker
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StreamChecker: def __init__(self, words): """:type words: List[str]""" <|body_0|> def query(self, letter): """:type letter: str :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.root = Node() self.m = max(map(len, words)) ...
stack_v2_sparse_classes_10k_train_006450
2,195
no_license
[ { "docstring": ":type words: List[str]", "name": "__init__", "signature": "def __init__(self, words)" }, { "docstring": ":type letter: str :rtype: bool", "name": "query", "signature": "def query(self, letter)" } ]
2
stack_v2_sparse_classes_30k_train_003380
Implement the Python class `StreamChecker` described below. Class description: Implement the StreamChecker class. Method signatures and docstrings: - def __init__(self, words): :type words: List[str] - def query(self, letter): :type letter: str :rtype: bool
Implement the Python class `StreamChecker` described below. Class description: Implement the StreamChecker class. Method signatures and docstrings: - def __init__(self, words): :type words: List[str] - def query(self, letter): :type letter: str :rtype: bool <|skeleton|> class StreamChecker: def __init__(self, w...
0c3ae35908cb6aa73c0962376facbdd750854f48
<|skeleton|> class StreamChecker: def __init__(self, words): """:type words: List[str]""" <|body_0|> def query(self, letter): """:type letter: str :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class StreamChecker: def __init__(self, words): """:type words: List[str]""" self.root = Node() self.m = max(map(len, words)) self.initials = set([word[0] for word in words]) l = [] for word in words: l += list(word) self.letters = set(l) s...
the_stack_v2_python_sparse
theory/data_structures/trie/stream_of_characters.py
tHeMaskedMan981/coding_practice
train
0
c25d7dafdeaf49c5244ff060abf91e3f73419a66
[ "if not data.get('project_id'):\n data['project_id'] = uuid.uuid4().hex\nreturn data", "try:\n git_url = GitURL.parse(data['git_url'])\nexcept UnicodeError as e:\n raise ValidationError('`git_url` contains unsupported characters') from e\nexcept errors.InvalidGitURL as e:\n raise ValidationError('Inva...
<|body_start_0|> if not data.get('project_id'): data['project_id'] = uuid.uuid4().hex return data <|end_body_0|> <|body_start_1|> try: git_url = GitURL.parse(data['git_url']) except UnicodeError as e: raise ValidationError('`git_url` contains unsuppor...
Context schema for project clone.
ProjectCloneContext
[ "Apache-2.0", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProjectCloneContext: """Context schema for project clone.""" def set_missing_id(self, data, **kwargs): """Set project_id when missing.""" <|body_0|> def set_owner_name(self, data, **kwargs): """Set owner and name fields.""" <|body_1|> def format_url(...
stack_v2_sparse_classes_10k_train_006451
14,192
permissive
[ { "docstring": "Set project_id when missing.", "name": "set_missing_id", "signature": "def set_missing_id(self, data, **kwargs)" }, { "docstring": "Set owner and name fields.", "name": "set_owner_name", "signature": "def set_owner_name(self, data, **kwargs)" }, { "docstring": "Fo...
4
null
Implement the Python class `ProjectCloneContext` described below. Class description: Context schema for project clone. Method signatures and docstrings: - def set_missing_id(self, data, **kwargs): Set project_id when missing. - def set_owner_name(self, data, **kwargs): Set owner and name fields. - def format_url(self...
Implement the Python class `ProjectCloneContext` described below. Class description: Context schema for project clone. Method signatures and docstrings: - def set_missing_id(self, data, **kwargs): Set project_id when missing. - def set_owner_name(self, data, **kwargs): Set owner and name fields. - def format_url(self...
e0ff587f507d049eeeb873e8488ba8bb10ac1a15
<|skeleton|> class ProjectCloneContext: """Context schema for project clone.""" def set_missing_id(self, data, **kwargs): """Set project_id when missing.""" <|body_0|> def set_owner_name(self, data, **kwargs): """Set owner and name fields.""" <|body_1|> def format_url(...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ProjectCloneContext: """Context schema for project clone.""" def set_missing_id(self, data, **kwargs): """Set project_id when missing.""" if not data.get('project_id'): data['project_id'] = uuid.uuid4().hex return data def set_owner_name(self, data, **kwargs): ...
the_stack_v2_python_sparse
renku/ui/service/serializers/cache.py
SwissDataScienceCenter/renku-python
train
30
00a16404f30a7f2e6baa4e684ec4435e5ae5287a
[ "self.corpora = self.process_corpora(corporaList, stopwords_f)\nprint('loading pre-trained w2v model...')\ntic = time.time()\nif pretrained_w2v:\n self.w2v_model = pretrained_w2v\nelif w2v_f.endswith('.bin'):\n self.w2v_model = gensim.models.KeyedVectors.load_word2vec_format(w2v_f, binary=True)\nelse:\n se...
<|body_start_0|> self.corpora = self.process_corpora(corporaList, stopwords_f) print('loading pre-trained w2v model...') tic = time.time() if pretrained_w2v: self.w2v_model = pretrained_w2v elif w2v_f.endswith('.bin'): self.w2v_model = gensim.models.KeyedV...
W2VModel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class W2VModel: def __init__(self, corporaList, w2v_f, stopwords_f, pretrained_w2v=None, saved_corpora_vec_M=None): """实现使用语言模型对句子和句子, 词语对句子的匹配. 初始化模型: StatisticModel(corpora) Args: corporaList: 多个语料组成的列表, 应该是一个嵌套Python列表. For example: [["There", "is", "a", "cat"], ["There", "is", "a", "dog"],...
stack_v2_sparse_classes_10k_train_006452
8,398
no_license
[ { "docstring": "实现使用语言模型对句子和句子, 词语对句子的匹配. 初始化模型: StatisticModel(corpora) Args: corporaList: 多个语料组成的列表, 应该是一个嵌套Python列表. For example: [[\"There\", \"is\", \"a\", \"cat\"], [\"There\", \"is\", \"a\", \"dog\"], [\"There\", \"is\", \"a\", \"wolf\"]] w2v_f: str, 预训练的词向量文件路径 stopwords_f: str, 停用词文件 pretrained_w2v: ge...
6
stack_v2_sparse_classes_30k_val_000266
Implement the Python class `W2VModel` described below. Class description: Implement the W2VModel class. Method signatures and docstrings: - def __init__(self, corporaList, w2v_f, stopwords_f, pretrained_w2v=None, saved_corpora_vec_M=None): 实现使用语言模型对句子和句子, 词语对句子的匹配. 初始化模型: StatisticModel(corpora) Args: corporaList: 多个...
Implement the Python class `W2VModel` described below. Class description: Implement the W2VModel class. Method signatures and docstrings: - def __init__(self, corporaList, w2v_f, stopwords_f, pretrained_w2v=None, saved_corpora_vec_M=None): 实现使用语言模型对句子和句子, 词语对句子的匹配. 初始化模型: StatisticModel(corpora) Args: corporaList: 多个...
c2a20a430de197d06dca5ada96160388730a5db5
<|skeleton|> class W2VModel: def __init__(self, corporaList, w2v_f, stopwords_f, pretrained_w2v=None, saved_corpora_vec_M=None): """实现使用语言模型对句子和句子, 词语对句子的匹配. 初始化模型: StatisticModel(corpora) Args: corporaList: 多个语料组成的列表, 应该是一个嵌套Python列表. For example: [["There", "is", "a", "cat"], ["There", "is", "a", "dog"],...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class W2VModel: def __init__(self, corporaList, w2v_f, stopwords_f, pretrained_w2v=None, saved_corpora_vec_M=None): """实现使用语言模型对句子和句子, 词语对句子的匹配. 初始化模型: StatisticModel(corpora) Args: corporaList: 多个语料组成的列表, 应该是一个嵌套Python列表. For example: [["There", "is", "a", "cat"], ["There", "is", "a", "dog"], ["There", "is...
the_stack_v2_python_sparse
Models/Word2Vec/API/Word2VecModel.py
JaMesLiMers/Image_Retrieval_Framework_FYP
train
2
f6718c95d2fc137a47c3d02148bd1e571c72797f
[ "assert 0 < smoothing < 1, 'Smoothing factor should be in (0.0, 1.0)'\nassert reduction in {'batchmean', 'none', 'sum'}\nsuper().__init__()\nself.smoothing = smoothing\nself.ignore_index = ignore_index\nself.reduction = reduction", "target = target.view(-1, 1)\nsmoothed_target = torch.zeros(input.shape, requires_...
<|body_start_0|> assert 0 < smoothing < 1, 'Smoothing factor should be in (0.0, 1.0)' assert reduction in {'batchmean', 'none', 'sum'} super().__init__() self.smoothing = smoothing self.ignore_index = ignore_index self.reduction = reduction <|end_body_0|> <|body_start_1|...
Computes cross entropy loss with uniformly smoothed targets.
SmoothedCrossEntropyLoss
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SmoothedCrossEntropyLoss: """Computes cross entropy loss with uniformly smoothed targets.""" def __init__(self, smoothing: float=0.1, ignore_index: int=-1, reduction: str='batchmean'): """Cross entropy loss with uniformly smoothed targets. :param float smoothing: Label smoothing fact...
stack_v2_sparse_classes_10k_train_006453
4,120
permissive
[ { "docstring": "Cross entropy loss with uniformly smoothed targets. :param float smoothing: Label smoothing factor, between 0 and 1 (exclusive; default is 0.1) :param int ignore_index: Index to be ignored. (PAD_ID by default) :param str reduction: Style of reduction to be done. One of 'batchmean'(default), 'non...
2
stack_v2_sparse_classes_30k_train_005946
Implement the Python class `SmoothedCrossEntropyLoss` described below. Class description: Computes cross entropy loss with uniformly smoothed targets. Method signatures and docstrings: - def __init__(self, smoothing: float=0.1, ignore_index: int=-1, reduction: str='batchmean'): Cross entropy loss with uniformly smoot...
Implement the Python class `SmoothedCrossEntropyLoss` described below. Class description: Computes cross entropy loss with uniformly smoothed targets. Method signatures and docstrings: - def __init__(self, smoothing: float=0.1, ignore_index: int=-1, reduction: str='batchmean'): Cross entropy loss with uniformly smoot...
be5595fc5f40f7d281f9318ff26095c0d15ed5da
<|skeleton|> class SmoothedCrossEntropyLoss: """Computes cross entropy loss with uniformly smoothed targets.""" def __init__(self, smoothing: float=0.1, ignore_index: int=-1, reduction: str='batchmean'): """Cross entropy loss with uniformly smoothed targets. :param float smoothing: Label smoothing fact...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SmoothedCrossEntropyLoss: """Computes cross entropy loss with uniformly smoothed targets.""" def __init__(self, smoothing: float=0.1, ignore_index: int=-1, reduction: str='batchmean'): """Cross entropy loss with uniformly smoothed targets. :param float smoothing: Label smoothing factor, between 0...
the_stack_v2_python_sparse
mwptoolkit/loss/smoothed_cross_entropy_loss.py
TalhaAbid/MWPToolkit
train
0
e58cd79f1d25175c204ec9244c29c2bf0ebdf6da
[ "self.index = index\nself.source_name = source_name\nself.file_extension = file_extension\nself.sourcetype = sourcetype\nself.host = host", "fields_str = None\nfor field_name, field_value in fields_dict.items():\n if fields_str is None:\n fields_str = ''\n elif fields_str is not None:\n fields...
<|body_start_0|> self.index = index self.source_name = source_name self.file_extension = file_extension self.sourcetype = sourcetype self.host = host <|end_body_0|> <|body_start_1|> fields_str = None for field_name, field_value in fields_dict.items(): ...
The Stash writer class provides a mechanism for writing out events that will be processed by Splunk as stash events (and summary indexed accordingly).
StashNewWriter
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StashNewWriter: """The Stash writer class provides a mechanism for writing out events that will be processed by Splunk as stash events (and summary indexed accordingly).""" def __init__(self, index, source_name, file_extension='.stash_new', sourcetype=None, host=None): """Constructor...
stack_v2_sparse_classes_10k_train_006454
13,683
permissive
[ { "docstring": "Constructor for the stash writer,=. Arguments: index -- the index to send the events to source_name -- the search that is being used to generate the results file_extension -- the extension of the stash file (usually .stash_new) sourcetype -- the sourcetype to use for the event host -- the host t...
5
stack_v2_sparse_classes_30k_train_006549
Implement the Python class `StashNewWriter` described below. Class description: The Stash writer class provides a mechanism for writing out events that will be processed by Splunk as stash events (and summary indexed accordingly). Method signatures and docstrings: - def __init__(self, index, source_name, file_extensi...
Implement the Python class `StashNewWriter` described below. Class description: The Stash writer class provides a mechanism for writing out events that will be processed by Splunk as stash events (and summary indexed accordingly). Method signatures and docstrings: - def __init__(self, index, source_name, file_extensi...
9c1027f1b1a58d30973256412fb72a6fe6bf029c
<|skeleton|> class StashNewWriter: """The Stash writer class provides a mechanism for writing out events that will be processed by Splunk as stash events (and summary indexed accordingly).""" def __init__(self, index, source_name, file_extension='.stash_new', sourcetype=None, host=None): """Constructor...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class StashNewWriter: """The Stash writer class provides a mechanism for writing out events that will be processed by Splunk as stash events (and summary indexed accordingly).""" def __init__(self, index, source_name, file_extension='.stash_new', sourcetype=None, host=None): """Constructor for the stas...
the_stack_v2_python_sparse
src/bin/network_tools_app/event_writer.py
LukeMurphey/splunk-network-tools
train
6
db29e9509c6f77cb897cc65e58127c3799636518
[ "self.key = key\nif isinstance(val, list):\n nested_debug_strs = [self.StringRep(v) for v in val]\n self.val = '[%s]' % ', '.join(nested_debug_strs)\nelse:\n self.val = self.StringRep(val)", "try:\n return val.DebugString()\nexcept Exception:\n try:\n return str(val.__dict__)\n except Exc...
<|body_start_0|> self.key = key if isinstance(val, list): nested_debug_strs = [self.StringRep(v) for v in val] self.val = '[%s]' % ', '.join(nested_debug_strs) else: self.val = self.StringRep(val) <|end_body_0|> <|body_start_1|> try: retur...
Wrapper class to generate on-screen debugging output.
_ContextDebugItem
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _ContextDebugItem: """Wrapper class to generate on-screen debugging output.""" def __init__(self, key, val): """Store the key and generate a string for the value.""" <|body_0|> def StringRep(self, val): """Make a useful string representation of the given value.""...
stack_v2_sparse_classes_10k_train_006455
36,471
permissive
[ { "docstring": "Store the key and generate a string for the value.", "name": "__init__", "signature": "def __init__(self, key, val)" }, { "docstring": "Make a useful string representation of the given value.", "name": "StringRep", "signature": "def StringRep(self, val)" } ]
2
stack_v2_sparse_classes_30k_train_006130
Implement the Python class `_ContextDebugItem` described below. Class description: Wrapper class to generate on-screen debugging output. Method signatures and docstrings: - def __init__(self, key, val): Store the key and generate a string for the value. - def StringRep(self, val): Make a useful string representation ...
Implement the Python class `_ContextDebugItem` described below. Class description: Wrapper class to generate on-screen debugging output. Method signatures and docstrings: - def __init__(self, key, val): Store the key and generate a string for the value. - def StringRep(self, val): Make a useful string representation ...
b5d4783f99461438ca9e6a477535617fadab6ba3
<|skeleton|> class _ContextDebugItem: """Wrapper class to generate on-screen debugging output.""" def __init__(self, key, val): """Store the key and generate a string for the value.""" <|body_0|> def StringRep(self, val): """Make a useful string representation of the given value.""...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class _ContextDebugItem: """Wrapper class to generate on-screen debugging output.""" def __init__(self, key, val): """Store the key and generate a string for the value.""" self.key = key if isinstance(val, list): nested_debug_strs = [self.StringRep(v) for v in val] ...
the_stack_v2_python_sparse
appengine/monorail/framework/servlet.py
xinghun61/infra
train
2
92baa7a659351e7b65a740d822cbfd51ae1a6e03
[ "object = get_object_or_404(CallRegister, pk=id)\nform = CallRegisterForm(instance=object)\ncontext = {'object': object, 'form': form}\nreturn render(request, self.template_name, context)", "form = CallRegisterForm(request.POST or None)\nif form.is_valid():\n object = get_object_or_404(CallRegister, pk=id)\n ...
<|body_start_0|> object = get_object_or_404(CallRegister, pk=id) form = CallRegisterForm(instance=object) context = {'object': object, 'form': form} return render(request, self.template_name, context) <|end_body_0|> <|body_start_1|> form = CallRegisterForm(request.POST or None) ...
CallEditView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CallEditView: def get(self, request, id): """Returns single call data from db, appointment_date is passed into form to display as form only.""" <|body_0|> def post(self, request, id): """Overrides all existing details of specific call, similar to call register.""" ...
stack_v2_sparse_classes_10k_train_006456
8,699
no_license
[ { "docstring": "Returns single call data from db, appointment_date is passed into form to display as form only.", "name": "get", "signature": "def get(self, request, id)" }, { "docstring": "Overrides all existing details of specific call, similar to call register.", "name": "post", "sign...
2
stack_v2_sparse_classes_30k_train_001720
Implement the Python class `CallEditView` described below. Class description: Implement the CallEditView class. Method signatures and docstrings: - def get(self, request, id): Returns single call data from db, appointment_date is passed into form to display as form only. - def post(self, request, id): Overrides all e...
Implement the Python class `CallEditView` described below. Class description: Implement the CallEditView class. Method signatures and docstrings: - def get(self, request, id): Returns single call data from db, appointment_date is passed into form to display as form only. - def post(self, request, id): Overrides all e...
bdd7c5ca9f00ce33be31609e5be9c2ccfcd8743a
<|skeleton|> class CallEditView: def get(self, request, id): """Returns single call data from db, appointment_date is passed into form to display as form only.""" <|body_0|> def post(self, request, id): """Overrides all existing details of specific call, similar to call register.""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CallEditView: def get(self, request, id): """Returns single call data from db, appointment_date is passed into form to display as form only.""" object = get_object_or_404(CallRegister, pk=id) form = CallRegisterForm(instance=object) context = {'object': object, 'form': form} ...
the_stack_v2_python_sparse
calls/views.py
mrmaheshrajput/htscrm
train
0
a6169279466f3ef82482f9c3a52e0e3b6f28f523
[ "cg_model = self.DATA.CG_MODEL.strip()\nscp_array = numpy.array([float(self.DATA.CG_SCECN_X), float(self.DATA.CG_SCECN_Y), float(self.DATA.CG_SCECN_Z)], dtype='float64')\nif cg_model == 'ECEF':\n return scp_array\nelif cg_model == 'WGS84':\n return geodetic_to_ecf(scp_array)\nelse:\n raise ValueError('Got ...
<|body_start_0|> cg_model = self.DATA.CG_MODEL.strip() scp_array = numpy.array([float(self.DATA.CG_SCECN_X), float(self.DATA.CG_SCECN_Y), float(self.DATA.CG_SCECN_Z)], dtype='float64') if cg_model == 'ECEF': return scp_array elif cg_model == 'WGS84': return geodet...
CMETAA
[ "LicenseRef-scancode-free-unknown", "MIT", "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CMETAA: def get_scp(self): """Gets the SCP location in ECF coordinates. Returns ------- numpy.ndarray""" <|body_0|> def get_arp(self): """Gets the Aperture Position, at SCP Time, in ECF coordinates. Returns ------- numpy.ndarray""" <|body_1|> def get_ima...
stack_v2_sparse_classes_10k_train_006457
11,683
permissive
[ { "docstring": "Gets the SCP location in ECF coordinates. Returns ------- numpy.ndarray", "name": "get_scp", "signature": "def get_scp(self)" }, { "docstring": "Gets the Aperture Position, at SCP Time, in ECF coordinates. Returns ------- numpy.ndarray", "name": "get_arp", "signature": "d...
3
null
Implement the Python class `CMETAA` described below. Class description: Implement the CMETAA class. Method signatures and docstrings: - def get_scp(self): Gets the SCP location in ECF coordinates. Returns ------- numpy.ndarray - def get_arp(self): Gets the Aperture Position, at SCP Time, in ECF coordinates. Returns -...
Implement the Python class `CMETAA` described below. Class description: Implement the CMETAA class. Method signatures and docstrings: - def get_scp(self): Gets the SCP location in ECF coordinates. Returns ------- numpy.ndarray - def get_arp(self): Gets the Aperture Position, at SCP Time, in ECF coordinates. Returns -...
de1b1886f161a83b6c89aadc7a2c7cfc4892ef81
<|skeleton|> class CMETAA: def get_scp(self): """Gets the SCP location in ECF coordinates. Returns ------- numpy.ndarray""" <|body_0|> def get_arp(self): """Gets the Aperture Position, at SCP Time, in ECF coordinates. Returns ------- numpy.ndarray""" <|body_1|> def get_ima...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CMETAA: def get_scp(self): """Gets the SCP location in ECF coordinates. Returns ------- numpy.ndarray""" cg_model = self.DATA.CG_MODEL.strip() scp_array = numpy.array([float(self.DATA.CG_SCECN_X), float(self.DATA.CG_SCECN_Y), float(self.DATA.CG_SCECN_Z)], dtype='float64') if cg...
the_stack_v2_python_sparse
sarpy/io/general/nitf_elements/tres/unclass/CMETAA.py
ngageoint/sarpy
train
192
3c0c88dcecaaef0791230f216f06b9a984ba389b
[ "PlottingComponent.__init__(self, config)\nDecompositionComponent.__init__(self)\nself.frame = None\nself.bulge = None\nself.disk = None\nself.model = None", "self.setup()\nself.load_images()\nself.plot()", "log.info('Loading the IRAC 3.6 micron image ...')\npath = fs.join(self.truncation_path, 'IRAC I1.fits')\...
<|body_start_0|> PlottingComponent.__init__(self, config) DecompositionComponent.__init__(self) self.frame = None self.bulge = None self.disk = None self.model = None <|end_body_0|> <|body_start_1|> self.setup() self.load_images() self.plot() <|en...
This class...
DecompositionPlotter
[ "MIT", "GPL-1.0-or-later", "AGPL-3.0-only", "AGPL-3.0-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-philippe-de-muyter" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DecompositionPlotter: """This class...""" def __init__(self, config=None): """The constructor ... :param config: :return:""" <|body_0|> def run(self, features=None): """This function ... :return:""" <|body_1|> def load_images(self): """This f...
stack_v2_sparse_classes_10k_train_006458
4,395
permissive
[ { "docstring": "The constructor ... :param config: :return:", "name": "__init__", "signature": "def __init__(self, config=None)" }, { "docstring": "This function ... :return:", "name": "run", "signature": "def run(self, features=None)" }, { "docstring": "This function ... :return...
4
null
Implement the Python class `DecompositionPlotter` described below. Class description: This class... Method signatures and docstrings: - def __init__(self, config=None): The constructor ... :param config: :return: - def run(self, features=None): This function ... :return: - def load_images(self): This function ... :re...
Implement the Python class `DecompositionPlotter` described below. Class description: This class... Method signatures and docstrings: - def __init__(self, config=None): The constructor ... :param config: :return: - def run(self, features=None): This function ... :return: - def load_images(self): This function ... :re...
62b2339beb2eb956565e1605d44d92f934361ad7
<|skeleton|> class DecompositionPlotter: """This class...""" def __init__(self, config=None): """The constructor ... :param config: :return:""" <|body_0|> def run(self, features=None): """This function ... :return:""" <|body_1|> def load_images(self): """This f...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DecompositionPlotter: """This class...""" def __init__(self, config=None): """The constructor ... :param config: :return:""" PlottingComponent.__init__(self, config) DecompositionComponent.__init__(self) self.frame = None self.bulge = None self.disk = None ...
the_stack_v2_python_sparse
CAAPR/CAAPR_AstroMagic/PTS/pts/modeling/plotting/decomposition.py
Stargrazer82301/CAAPR
train
8
3f4b8f24136aa531101e5c0643163f534ba1ee94
[ "seg_logits = self(inputs)\nvalid_label_mask = get_valid_label_mask_per_batch(img_metas, self.num_classes)\nlosses = self.losses(seg_logits, gt_semantic_seg, train_cfg, valid_label_mask=valid_label_mask, pixel_weights=pixel_weights)\nif return_logits:\n logits = self.forward_output if self.forward_output is not ...
<|body_start_0|> seg_logits = self(inputs) valid_label_mask = get_valid_label_mask_per_batch(img_metas, self.num_classes) losses = self.losses(seg_logits, gt_semantic_seg, train_cfg, valid_label_mask=valid_label_mask, pixel_weights=pixel_weights) if return_logits: logits = se...
PixelWeightsMixin2
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PixelWeightsMixin2: def forward_train(self, inputs, img_metas, gt_semantic_seg, train_cfg, pixel_weights=None, return_logits=False): """Forward function for training. Args: inputs (list[Tensor]): List of multi-level img features. img_metas (list[dict]): List of image info dict where each...
stack_v2_sparse_classes_10k_train_006459
7,209
permissive
[ { "docstring": "Forward function for training. Args: inputs (list[Tensor]): List of multi-level img features. img_metas (list[dict]): List of image info dict where each dict has: 'img_shape', 'scale_factor', 'flip', and may also contain 'filename', 'ori_shape', 'pad_shape', 'img_norm_cfg', and 'ignored_labels'....
2
stack_v2_sparse_classes_30k_train_004485
Implement the Python class `PixelWeightsMixin2` described below. Class description: Implement the PixelWeightsMixin2 class. Method signatures and docstrings: - def forward_train(self, inputs, img_metas, gt_semantic_seg, train_cfg, pixel_weights=None, return_logits=False): Forward function for training. Args: inputs (...
Implement the Python class `PixelWeightsMixin2` described below. Class description: Implement the PixelWeightsMixin2 class. Method signatures and docstrings: - def forward_train(self, inputs, img_metas, gt_semantic_seg, train_cfg, pixel_weights=None, return_logits=False): Forward function for training. Args: inputs (...
6116639caeff100b06a6c10a96c7e7f5951f20c7
<|skeleton|> class PixelWeightsMixin2: def forward_train(self, inputs, img_metas, gt_semantic_seg, train_cfg, pixel_weights=None, return_logits=False): """Forward function for training. Args: inputs (list[Tensor]): List of multi-level img features. img_metas (list[dict]): List of image info dict where each...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PixelWeightsMixin2: def forward_train(self, inputs, img_metas, gt_semantic_seg, train_cfg, pixel_weights=None, return_logits=False): """Forward function for training. Args: inputs (list[Tensor]): List of multi-level img features. img_metas (list[dict]): List of image info dict where each dict has: 'im...
the_stack_v2_python_sparse
otx/mpa/modules/models/heads/pixel_weights_mixin.py
GalyaZalesskaya/openvino_training_extensions
train
0
8e95d308ef5d686aa068a1050d4965350314c80b
[ "json_dict = json.loads(request.body.decode())\nreceiver = json_dict.get('receiver')\nprovince_id = json_dict.get('province_id')\ncity_id = json_dict.get('city_id')\ndistrict_id = json_dict.get('district_id')\nplace = json_dict.get('place')\nmobile = json_dict.get('mobile')\ntel = json_dict.get('tel')\nemail = json...
<|body_start_0|> json_dict = json.loads(request.body.decode()) receiver = json_dict.get('receiver') province_id = json_dict.get('province_id') city_id = json_dict.get('city_id') district_id = json_dict.get('district_id') place = json_dict.get('place') mobile = jso...
修改和删除地址
UpdateDestroyAddressView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UpdateDestroyAddressView: """修改和删除地址""" def put(self, request, address_id): """修改地址""" <|body_0|> def delete(self, request, address_id): """删除地址""" <|body_1|> <|end_skeleton|> <|body_start_0|> json_dict = json.loads(request.body.decode()) ...
stack_v2_sparse_classes_10k_train_006460
29,582
permissive
[ { "docstring": "修改地址", "name": "put", "signature": "def put(self, request, address_id)" }, { "docstring": "删除地址", "name": "delete", "signature": "def delete(self, request, address_id)" } ]
2
stack_v2_sparse_classes_30k_train_004400
Implement the Python class `UpdateDestroyAddressView` described below. Class description: 修改和删除地址 Method signatures and docstrings: - def put(self, request, address_id): 修改地址 - def delete(self, request, address_id): 删除地址
Implement the Python class `UpdateDestroyAddressView` described below. Class description: 修改和删除地址 Method signatures and docstrings: - def put(self, request, address_id): 修改地址 - def delete(self, request, address_id): 删除地址 <|skeleton|> class UpdateDestroyAddressView: """修改和删除地址""" def put(self, request, addre...
5b3ca1fba8205c2c0a2b91d951f812f1c30e12ae
<|skeleton|> class UpdateDestroyAddressView: """修改和删除地址""" def put(self, request, address_id): """修改地址""" <|body_0|> def delete(self, request, address_id): """删除地址""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UpdateDestroyAddressView: """修改和删除地址""" def put(self, request, address_id): """修改地址""" json_dict = json.loads(request.body.decode()) receiver = json_dict.get('receiver') province_id = json_dict.get('province_id') city_id = json_dict.get('city_id') district_...
the_stack_v2_python_sparse
meiduo1/apps/user/views.py
woobrain/nginx-uwsgi-web
train
0
271f1b18ec797c25f684df51ed466dbfd051ab2e
[ "self.connector_group_id = connector_group_id\nself.entity_id = entity_id\nself.network_realm_id = network_realm_id", "if dictionary is None:\n return None\nconnector_group_id = dictionary.get('connectorGroupId')\nentity_id = dictionary.get('entityId')\nnetwork_realm_id = dictionary.get('networkRealmId')\nretu...
<|body_start_0|> self.connector_group_id = connector_group_id self.entity_id = entity_id self.network_realm_id = network_realm_id <|end_body_0|> <|body_start_1|> if dictionary is None: return None connector_group_id = dictionary.get('connectorGroupId') entity...
Implementation of the 'NetworkRealmInfo' model. Contains mapping of network realms with adapter specific entities. This will be populated by IRIS for create/update source requests so that we can persist the mapping in the corresponding entity hierarchy. Attributes: connector_group_id (long|int): 'network_realm_id' main...
NetworkRealmInfo
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NetworkRealmInfo: """Implementation of the 'NetworkRealmInfo' model. Contains mapping of network realms with adapter specific entities. This will be populated by IRIS for create/update source requests so that we can persist the mapping in the corresponding entity hierarchy. Attributes: connector_...
stack_v2_sparse_classes_10k_train_006461
2,452
permissive
[ { "docstring": "Constructor for the NetworkRealmInfo class", "name": "__init__", "signature": "def __init__(self, connector_group_id=None, entity_id=None, network_realm_id=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary re...
2
null
Implement the Python class `NetworkRealmInfo` described below. Class description: Implementation of the 'NetworkRealmInfo' model. Contains mapping of network realms with adapter specific entities. This will be populated by IRIS for create/update source requests so that we can persist the mapping in the corresponding e...
Implement the Python class `NetworkRealmInfo` described below. Class description: Implementation of the 'NetworkRealmInfo' model. Contains mapping of network realms with adapter specific entities. This will be populated by IRIS for create/update source requests so that we can persist the mapping in the corresponding e...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class NetworkRealmInfo: """Implementation of the 'NetworkRealmInfo' model. Contains mapping of network realms with adapter specific entities. This will be populated by IRIS for create/update source requests so that we can persist the mapping in the corresponding entity hierarchy. Attributes: connector_...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class NetworkRealmInfo: """Implementation of the 'NetworkRealmInfo' model. Contains mapping of network realms with adapter specific entities. This will be populated by IRIS for create/update source requests so that we can persist the mapping in the corresponding entity hierarchy. Attributes: connector_group_id (lon...
the_stack_v2_python_sparse
cohesity_management_sdk/models/network_realm_info.py
cohesity/management-sdk-python
train
24
9fc1955b3e73b4629b0fa0d89440aa8dd053f8bb
[ "super(BiAffineAttention, self).__init__()\nself.encoder_size = encoder_size\nself.decoder_size = decoder_size\nself.num_labels = num_labels\nself.hidden_size = hidden_size\nself.e_mlp = nn.Sequential(nn.Linear(encoder_size, hidden_size), nn.ReLU())\nself.d_mlp = nn.Sequential(nn.Linear(decoder_size, hidden_size), ...
<|body_start_0|> super(BiAffineAttention, self).__init__() self.encoder_size = encoder_size self.decoder_size = decoder_size self.num_labels = num_labels self.hidden_size = hidden_size self.e_mlp = nn.Sequential(nn.Linear(encoder_size, hidden_size), nn.ReLU()) sel...
BiAffineAttention
[ "BSD-2-Clause", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BiAffineAttention: def __init__(self, encoder_size, decoder_size, num_labels=1, hidden_size=HIDDEN_SIZE): """num_labels 代表当前节点到各个节点之间做的 bi_affine attention 分配给各个节点的向量维度, 因为子句分割是分割点选择任务,所以每个分割点的维度设置为1即可,一组标量的 soft_max 概率即 为边界标签的选择结果。""" <|body_0|> def forward(self, e_outputs,...
stack_v2_sparse_classes_10k_train_006462
3,328
permissive
[ { "docstring": "num_labels 代表当前节点到各个节点之间做的 bi_affine attention 分配给各个节点的向量维度, 因为子句分割是分割点选择任务,所以每个分割点的维度设置为1即可,一组标量的 soft_max 概率即 为边界标签的选择结果。", "name": "__init__", "signature": "def __init__(self, encoder_size, decoder_size, num_labels=1, hidden_size=HIDDEN_SIZE)" }, { "docstring": ":param e_outpu...
2
stack_v2_sparse_classes_30k_train_004887
Implement the Python class `BiAffineAttention` described below. Class description: Implement the BiAffineAttention class. Method signatures and docstrings: - def __init__(self, encoder_size, decoder_size, num_labels=1, hidden_size=HIDDEN_SIZE): num_labels 代表当前节点到各个节点之间做的 bi_affine attention 分配给各个节点的向量维度, 因为子句分割是分割点选择...
Implement the Python class `BiAffineAttention` described below. Class description: Implement the BiAffineAttention class. Method signatures and docstrings: - def __init__(self, encoder_size, decoder_size, num_labels=1, hidden_size=HIDDEN_SIZE): num_labels 代表当前节点到各个节点之间做的 bi_affine attention 分配给各个节点的向量维度, 因为子句分割是分割点选择...
fd71b353c59bcb82ec2cd0bebf943040756faa63
<|skeleton|> class BiAffineAttention: def __init__(self, encoder_size, decoder_size, num_labels=1, hidden_size=HIDDEN_SIZE): """num_labels 代表当前节点到各个节点之间做的 bi_affine attention 分配给各个节点的向量维度, 因为子句分割是分割点选择任务,所以每个分割点的维度设置为1即可,一组标量的 soft_max 概率即 为边界标签的选择结果。""" <|body_0|> def forward(self, e_outputs,...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BiAffineAttention: def __init__(self, encoder_size, decoder_size, num_labels=1, hidden_size=HIDDEN_SIZE): """num_labels 代表当前节点到各个节点之间做的 bi_affine attention 分配给各个节点的向量维度, 因为子句分割是分割点选择任务,所以每个分割点的维度设置为1即可,一组标量的 soft_max 概率即 为边界标签的选择结果。""" super(BiAffineAttention, self).__init__() self.enc...
the_stack_v2_python_sparse
CDTB_Seg/model/ENC_DEC_GCN/biaffine_attn.py
NLP-Discourse-SoochowU/segmenter2020
train
0
57b9a03d623010d22f1b49278971f4561f2ea44e
[ "lLatitude = self.cleaned_data['latitude']\nif lLatitude:\n lValue = lLatitude.strip()\n if lValue:\n lRegEx = re.compile(CO_ORD_REGEX)\n if lRegEx.match(lValue) == None:\n raise forms.ValidationError(\"Please enter the location in decimal notation, for example 53.768761 If it ends w...
<|body_start_0|> lLatitude = self.cleaned_data['latitude'] if lLatitude: lValue = lLatitude.strip() if lValue: lRegEx = re.compile(CO_ORD_REGEX) if lRegEx.match(lValue) == None: raise forms.ValidationError("Please enter the loca...
Form for entering a new venue
EditVenueForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EditVenueForm: """Form for entering a new venue""" def clean_latitude(self): """Validate latitude is in correct format""" <|body_0|> def clean_longitude(self): """Validation longitude is in correct format""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_10k_train_006463
1,542
no_license
[ { "docstring": "Validate latitude is in correct format", "name": "clean_latitude", "signature": "def clean_latitude(self)" }, { "docstring": "Validation longitude is in correct format", "name": "clean_longitude", "signature": "def clean_longitude(self)" } ]
2
stack_v2_sparse_classes_30k_test_000313
Implement the Python class `EditVenueForm` described below. Class description: Form for entering a new venue Method signatures and docstrings: - def clean_latitude(self): Validate latitude is in correct format - def clean_longitude(self): Validation longitude is in correct format
Implement the Python class `EditVenueForm` described below. Class description: Form for entering a new venue Method signatures and docstrings: - def clean_latitude(self): Validate latitude is in correct format - def clean_longitude(self): Validation longitude is in correct format <|skeleton|> class EditVenueForm: ...
05c9d3a53c491cc255e7a351de87273df31a0303
<|skeleton|> class EditVenueForm: """Form for entering a new venue""" def clean_latitude(self): """Validate latitude is in correct format""" <|body_0|> def clean_longitude(self): """Validation longitude is in correct format""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class EditVenueForm: """Form for entering a new venue""" def clean_latitude(self): """Validate latitude is in correct format""" lLatitude = self.cleaned_data['latitude'] if lLatitude: lValue = lLatitude.strip() if lValue: lRegEx = re.compile(CO_OR...
the_stack_v2_python_sparse
web/site/venues/forms.py
BrassBandResults/bbr4
train
5
6f5bf1475447565543f34822df10f7e59262fcd2
[ "super(Worker, self).__init__()\nself.func = func\nself.args = args\nself.kwargs = kwargs", "try:\n result = self.func(*self.args, **self.kwargs)\n self.result.emit(result)\nexcept:\n import sys\n self.error.emit(sys.exc_info())" ]
<|body_start_0|> super(Worker, self).__init__() self.func = func self.args = args self.kwargs = kwargs <|end_body_0|> <|body_start_1|> try: result = self.func(*self.args, **self.kwargs) self.result.emit(result) except: import sys ...
Worker
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Worker: def __init__(self, func, *args, **kwargs): """Execute a function call on a different QThread :param func: The function object to call :param args: arguments to pass to the function :param kwargs: kwargs to pass to the function""" <|body_0|> def run(self): """...
stack_v2_sparse_classes_10k_train_006464
1,096
permissive
[ { "docstring": "Execute a function call on a different QThread :param func: The function object to call :param args: arguments to pass to the function :param kwargs: kwargs to pass to the function", "name": "__init__", "signature": "def __init__(self, func, *args, **kwargs)" }, { "docstring": "I...
2
stack_v2_sparse_classes_30k_train_000041
Implement the Python class `Worker` described below. Class description: Implement the Worker class. Method signatures and docstrings: - def __init__(self, func, *args, **kwargs): Execute a function call on a different QThread :param func: The function object to call :param args: arguments to pass to the function :par...
Implement the Python class `Worker` described below. Class description: Implement the Worker class. Method signatures and docstrings: - def __init__(self, func, *args, **kwargs): Execute a function call on a different QThread :param func: The function object to call :param args: arguments to pass to the function :par...
4aa8c64a6f65629207e40df9963232473a24c9f6
<|skeleton|> class Worker: def __init__(self, func, *args, **kwargs): """Execute a function call on a different QThread :param func: The function object to call :param args: arguments to pass to the function :param kwargs: kwargs to pass to the function""" <|body_0|> def run(self): """...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Worker: def __init__(self, func, *args, **kwargs): """Execute a function call on a different QThread :param func: The function object to call :param args: arguments to pass to the function :param kwargs: kwargs to pass to the function""" super(Worker, self).__init__() self.func = func ...
the_stack_v2_python_sparse
glue/utils/qt/threading.py
astrofrog/glue
train
3
9f88d859633b506dc00d9689f06b08a9846b075d
[ "self.author = Author.objects.create(name='Test Name', email='testemail@email.com', address='Test address', bio='Test bio')\nself.publisher = publisher = Publisher.objects.create(name='Test Name', address='Test address', email='testemail@email.com', publisher_url='http://testpublisherurl.com')\nself.book = Book.obj...
<|body_start_0|> self.author = Author.objects.create(name='Test Name', email='testemail@email.com', address='Test address', bio='Test bio') self.publisher = publisher = Publisher.objects.create(name='Test Name', address='Test address', email='testemail@email.com', publisher_url='http://testpublisherurl....
Test casees for the Book model
BookTestCase
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BookTestCase: """Test casees for the Book model""" def setUp(self): """Set up data to be used in test cases""" <|body_0|> def test_model_fields_with_correct_values(self): """Test the model fields with correct values.""" <|body_1|> def test_model_fiel...
stack_v2_sparse_classes_10k_train_006465
12,307
permissive
[ { "docstring": "Set up data to be used in test cases", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test the model fields with correct values.", "name": "test_model_fields_with_correct_values", "signature": "def test_model_fields_with_correct_values(self)" }, { ...
6
stack_v2_sparse_classes_30k_train_000342
Implement the Python class `BookTestCase` described below. Class description: Test casees for the Book model Method signatures and docstrings: - def setUp(self): Set up data to be used in test cases - def test_model_fields_with_correct_values(self): Test the model fields with correct values. - def test_model_fields_w...
Implement the Python class `BookTestCase` described below. Class description: Test casees for the Book model Method signatures and docstrings: - def setUp(self): Set up data to be used in test cases - def test_model_fields_with_correct_values(self): Test the model fields with correct values. - def test_model_fields_w...
a364e9997c1c91b09f5db8a004deb4df305fa8cf
<|skeleton|> class BookTestCase: """Test casees for the Book model""" def setUp(self): """Set up data to be used in test cases""" <|body_0|> def test_model_fields_with_correct_values(self): """Test the model fields with correct values.""" <|body_1|> def test_model_fiel...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BookTestCase: """Test casees for the Book model""" def setUp(self): """Set up data to be used in test cases""" self.author = Author.objects.create(name='Test Name', email='testemail@email.com', address='Test address', bio='Test bio') self.publisher = publisher = Publisher.objects....
the_stack_v2_python_sparse
libStash/books/tests.py
Dev-Rem/libStash
train
0
407a5cc2239767789366aac65dc362cc9f6001bf
[ "self.current_usage_gib = current_usage_gib\nself.feature_name = feature_name\nself.num_vm = num_vm", "if dictionary is None:\n return None\ncurrent_usage_gib = dictionary.get('currentUsageGiB')\nfeature_name = dictionary.get('featureName')\nnum_vm = dictionary.get('numVm')\nreturn cls(current_usage_gib, featu...
<|body_start_0|> self.current_usage_gib = current_usage_gib self.feature_name = feature_name self.num_vm = num_vm <|end_body_0|> <|body_start_1|> if dictionary is None: return None current_usage_gib = dictionary.get('currentUsageGiB') feature_name = dictionar...
Implementation of the 'FeatureUsage' model. TODO: type description here. Attributes: current_usage_gib (long|int): Feature usage by the cluster. feature_name (string): Name of feature. num_vm (long|int): Number of VM spinned.
FeatureUsage
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FeatureUsage: """Implementation of the 'FeatureUsage' model. TODO: type description here. Attributes: current_usage_gib (long|int): Feature usage by the cluster. feature_name (string): Name of feature. num_vm (long|int): Number of VM spinned.""" def __init__(self, current_usage_gib=None, fea...
stack_v2_sparse_classes_10k_train_006466
1,804
permissive
[ { "docstring": "Constructor for the FeatureUsage class", "name": "__init__", "signature": "def __init__(self, current_usage_gib=None, feature_name=None, num_vm=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary representation...
2
null
Implement the Python class `FeatureUsage` described below. Class description: Implementation of the 'FeatureUsage' model. TODO: type description here. Attributes: current_usage_gib (long|int): Feature usage by the cluster. feature_name (string): Name of feature. num_vm (long|int): Number of VM spinned. Method signatu...
Implement the Python class `FeatureUsage` described below. Class description: Implementation of the 'FeatureUsage' model. TODO: type description here. Attributes: current_usage_gib (long|int): Feature usage by the cluster. feature_name (string): Name of feature. num_vm (long|int): Number of VM spinned. Method signatu...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class FeatureUsage: """Implementation of the 'FeatureUsage' model. TODO: type description here. Attributes: current_usage_gib (long|int): Feature usage by the cluster. feature_name (string): Name of feature. num_vm (long|int): Number of VM spinned.""" def __init__(self, current_usage_gib=None, fea...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FeatureUsage: """Implementation of the 'FeatureUsage' model. TODO: type description here. Attributes: current_usage_gib (long|int): Feature usage by the cluster. feature_name (string): Name of feature. num_vm (long|int): Number of VM spinned.""" def __init__(self, current_usage_gib=None, feature_name=Non...
the_stack_v2_python_sparse
cohesity_management_sdk/models/feature_usage.py
cohesity/management-sdk-python
train
24
b7344d986efccd29dea4086d92f2298c174e1360
[ "_1 = ListNode(3)\n_2 = ListNode(2)\n_3 = ListNode(0)\n_4 = ListNode(-4)\n_1.next = _2\n_2.next = _3\n_3.next = _4\n_4.next = _2\ns = Solution()\nself.assertTrue(s.hasCycle(_1))", "l = [-21, 10, 17, 8, 4, 26, 5, 35, 33, -7, -16, 27, -12, 6, 29, -12, 5, 9, 20, 14, 14, 2, 13, -24, 21, 23, -21, 5]\nn = len(l)\nhead ...
<|body_start_0|> _1 = ListNode(3) _2 = ListNode(2) _3 = ListNode(0) _4 = ListNode(-4) _1.next = _2 _2.next = _3 _3.next = _4 _4.next = _2 s = Solution() self.assertTrue(s.hasCycle(_1)) <|end_body_0|> <|body_start_1|> l = [-21, 10, ...
Test
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test: def test1(self): """head = [3,2,0,-4], pos = 1 为了表示给定链表中的环,我们使用整数 pos 来表示链表尾连接到链表中的位置(索引从 0 开始) 如果 pos 是 -1,则在该链表中没有环""" <|body_0|> def test2(self): """[-21,10,17,8,4,26,5,35,33,-7,-16,27,-12,6,29,-12,5,9,20,14,14,2,13,-24,21,23,-21,5] -1""" <|body_1|> ...
stack_v2_sparse_classes_10k_train_006467
1,711
no_license
[ { "docstring": "head = [3,2,0,-4], pos = 1 为了表示给定链表中的环,我们使用整数 pos 来表示链表尾连接到链表中的位置(索引从 0 开始) 如果 pos 是 -1,则在该链表中没有环", "name": "test1", "signature": "def test1(self)" }, { "docstring": "[-21,10,17,8,4,26,5,35,33,-7,-16,27,-12,6,29,-12,5,9,20,14,14,2,13,-24,21,23,-21,5] -1", "name": "test2", ...
2
stack_v2_sparse_classes_30k_train_001158
Implement the Python class `Test` described below. Class description: Implement the Test class. Method signatures and docstrings: - def test1(self): head = [3,2,0,-4], pos = 1 为了表示给定链表中的环,我们使用整数 pos 来表示链表尾连接到链表中的位置(索引从 0 开始) 如果 pos 是 -1,则在该链表中没有环 - def test2(self): [-21,10,17,8,4,26,5,35,33,-7,-16,27,-12,6,29,-12,5,9...
Implement the Python class `Test` described below. Class description: Implement the Test class. Method signatures and docstrings: - def test1(self): head = [3,2,0,-4], pos = 1 为了表示给定链表中的环,我们使用整数 pos 来表示链表尾连接到链表中的位置(索引从 0 开始) 如果 pos 是 -1,则在该链表中没有环 - def test2(self): [-21,10,17,8,4,26,5,35,33,-7,-16,27,-12,6,29,-12,5,9...
248b620791611001ebb471dcf8284437264b2f20
<|skeleton|> class Test: def test1(self): """head = [3,2,0,-4], pos = 1 为了表示给定链表中的环,我们使用整数 pos 来表示链表尾连接到链表中的位置(索引从 0 开始) 如果 pos 是 -1,则在该链表中没有环""" <|body_0|> def test2(self): """[-21,10,17,8,4,26,5,35,33,-7,-16,27,-12,6,29,-12,5,9,20,14,14,2,13,-24,21,23,-21,5] -1""" <|body_1|> ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Test: def test1(self): """head = [3,2,0,-4], pos = 1 为了表示给定链表中的环,我们使用整数 pos 来表示链表尾连接到链表中的位置(索引从 0 开始) 如果 pos 是 -1,则在该链表中没有环""" _1 = ListNode(3) _2 = ListNode(2) _3 = ListNode(0) _4 = ListNode(-4) _1.next = _2 _2.next = _3 _3.next = _4 _4....
the_stack_v2_python_sparse
141_linked_list_cycle/_2.py
chxj1992/leetcode-exercise
train
0
892cbc07a1524f47caaf9eddeb1e1485bb79c915
[ "data = form.cleaned_data\nself.success_url = reverse('tokens', kwargs={'level': int(data['level']), 'semester': int(data['semester']), 'course': int(data['course'].id)})\nreturn super().form_valid(form)", "context = super().get_context_data(**kwargs)\ncontext['title_text'] = 'Choose Course To View The Tokens'\nc...
<|body_start_0|> data = form.cleaned_data self.success_url = reverse('tokens', kwargs={'level': int(data['level']), 'semester': int(data['semester']), 'course': int(data['course'].id)}) return super().form_valid(form) <|end_body_0|> <|body_start_1|> context = super().get_context_data(**...
View for choosing course tokens that will be displayed. Check that the user's account is still active. Redirects to tokens view on form valid.
ShowTokensView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ShowTokensView: """View for choosing course tokens that will be displayed. Check that the user's account is still active. Redirects to tokens view on form valid.""" def form_valid(self, form): """Compute the success URL and call super.form_valid()""" <|body_0|> def get_c...
stack_v2_sparse_classes_10k_train_006468
29,759
no_license
[ { "docstring": "Compute the success URL and call super.form_valid()", "name": "form_valid", "signature": "def form_valid(self, form)" }, { "docstring": "Return the data used in the templates rendering.", "name": "get_context_data", "signature": "def get_context_data(self, **kwargs)" } ...
2
stack_v2_sparse_classes_30k_train_004547
Implement the Python class `ShowTokensView` described below. Class description: View for choosing course tokens that will be displayed. Check that the user's account is still active. Redirects to tokens view on form valid. Method signatures and docstrings: - def form_valid(self, form): Compute the success URL and cal...
Implement the Python class `ShowTokensView` described below. Class description: View for choosing course tokens that will be displayed. Check that the user's account is still active. Redirects to tokens view on form valid. Method signatures and docstrings: - def form_valid(self, form): Compute the success URL and cal...
06bc577d01d3dbf6c425e03dcb903977a38e377c
<|skeleton|> class ShowTokensView: """View for choosing course tokens that will be displayed. Check that the user's account is still active. Redirects to tokens view on form valid.""" def form_valid(self, form): """Compute the success URL and call super.form_valid()""" <|body_0|> def get_c...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ShowTokensView: """View for choosing course tokens that will be displayed. Check that the user's account is still active. Redirects to tokens view on form valid.""" def form_valid(self, form): """Compute the success URL and call super.form_valid()""" data = form.cleaned_data self....
the_stack_v2_python_sparse
cbt/views.py
Festusali/CBTest
train
6
2042473ac58e6837d57ab386b9a24b3cc0020c86
[ "self.reporting_enabled = reporting_enabled\nself.collector_ip = collector_ip\nself.collector_port = collector_port", "if dictionary is None:\n return None\nreporting_enabled = dictionary.get('reportingEnabled')\ncollector_ip = dictionary.get('collectorIp')\ncollector_port = dictionary.get('collectorPort')\nre...
<|body_start_0|> self.reporting_enabled = reporting_enabled self.collector_ip = collector_ip self.collector_port = collector_port <|end_body_0|> <|body_start_1|> if dictionary is None: return None reporting_enabled = dictionary.get('reportingEnabled') collect...
Implementation of the 'updateNetworkNetflowSettings' model. TODO: type model description here. Attributes: reporting_enabled (bool): Boolean indicating whether NetFlow traffic reporting is enabled (true) or disabled (false). collector_ip (string): The IPv4 address of the NetFlow collector. collector_port (int): The por...
UpdateNetworkNetflowSettingsModel
[ "MIT", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UpdateNetworkNetflowSettingsModel: """Implementation of the 'updateNetworkNetflowSettings' model. TODO: type model description here. Attributes: reporting_enabled (bool): Boolean indicating whether NetFlow traffic reporting is enabled (true) or disabled (false). collector_ip (string): The IPv4 ad...
stack_v2_sparse_classes_10k_train_006469
2,229
permissive
[ { "docstring": "Constructor for the UpdateNetworkNetflowSettingsModel class", "name": "__init__", "signature": "def __init__(self, reporting_enabled=None, collector_ip=None, collector_port=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary)...
2
null
Implement the Python class `UpdateNetworkNetflowSettingsModel` described below. Class description: Implementation of the 'updateNetworkNetflowSettings' model. TODO: type model description here. Attributes: reporting_enabled (bool): Boolean indicating whether NetFlow traffic reporting is enabled (true) or disabled (fal...
Implement the Python class `UpdateNetworkNetflowSettingsModel` described below. Class description: Implementation of the 'updateNetworkNetflowSettings' model. TODO: type model description here. Attributes: reporting_enabled (bool): Boolean indicating whether NetFlow traffic reporting is enabled (true) or disabled (fal...
9894089eb013318243ae48869cc5130eb37f80c0
<|skeleton|> class UpdateNetworkNetflowSettingsModel: """Implementation of the 'updateNetworkNetflowSettings' model. TODO: type model description here. Attributes: reporting_enabled (bool): Boolean indicating whether NetFlow traffic reporting is enabled (true) or disabled (false). collector_ip (string): The IPv4 ad...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UpdateNetworkNetflowSettingsModel: """Implementation of the 'updateNetworkNetflowSettings' model. TODO: type model description here. Attributes: reporting_enabled (bool): Boolean indicating whether NetFlow traffic reporting is enabled (true) or disabled (false). collector_ip (string): The IPv4 address of the ...
the_stack_v2_python_sparse
meraki_sdk/models/update_network_netflow_settings_model.py
RaulCatalano/meraki-python-sdk
train
1
f13f51ae6ca9e5819d9a91a07a4e207f260340ec
[ "question_text = json_dict['question']\ntable_rows = json_dict['table'].split('\\n')\ninstance = self._dataset_reader.text_to_instance(question_text, table_rows)\nreturn instance", "instance = self._json_to_instance(inputs)\nindex_to_rule = [production_rule_field.rule for production_rule_field in instance.fields[...
<|body_start_0|> question_text = json_dict['question'] table_rows = json_dict['table'].split('\n') instance = self._dataset_reader.text_to_instance(question_text, table_rows) return instance <|end_body_0|> <|body_start_1|> instance = self._json_to_instance(inputs) index_...
Wrapper for the :class:`~allennlp.models.encoder_decoders.wikitables_semantic_parser.WikiTablesSemanticParser` model.
WikiTablesParserPredictor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WikiTablesParserPredictor: """Wrapper for the :class:`~allennlp.models.encoder_decoders.wikitables_semantic_parser.WikiTablesSemanticParser` model.""" def _json_to_instance(self, json_dict: JsonDict) -> Instance: """Expects JSON that looks like ``{"question": "...", "table": "..."}``...
stack_v2_sparse_classes_10k_train_006470
3,591
permissive
[ { "docstring": "Expects JSON that looks like ``{\"question\": \"...\", \"table\": \"...\"}``.", "name": "_json_to_instance", "signature": "def _json_to_instance(self, json_dict: JsonDict) -> Instance" }, { "docstring": "We need to override this because of the interactive beam search aspects.", ...
2
stack_v2_sparse_classes_30k_train_000091
Implement the Python class `WikiTablesParserPredictor` described below. Class description: Wrapper for the :class:`~allennlp.models.encoder_decoders.wikitables_semantic_parser.WikiTablesSemanticParser` model. Method signatures and docstrings: - def _json_to_instance(self, json_dict: JsonDict) -> Instance: Expects JSO...
Implement the Python class `WikiTablesParserPredictor` described below. Class description: Wrapper for the :class:`~allennlp.models.encoder_decoders.wikitables_semantic_parser.WikiTablesSemanticParser` model. Method signatures and docstrings: - def _json_to_instance(self, json_dict: JsonDict) -> Instance: Expects JSO...
c863900e3e1fe7be540b9a0632a7a032491fc3ab
<|skeleton|> class WikiTablesParserPredictor: """Wrapper for the :class:`~allennlp.models.encoder_decoders.wikitables_semantic_parser.WikiTablesSemanticParser` model.""" def _json_to_instance(self, json_dict: JsonDict) -> Instance: """Expects JSON that looks like ``{"question": "...", "table": "..."}``...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class WikiTablesParserPredictor: """Wrapper for the :class:`~allennlp.models.encoder_decoders.wikitables_semantic_parser.WikiTablesSemanticParser` model.""" def _json_to_instance(self, json_dict: JsonDict) -> Instance: """Expects JSON that looks like ``{"question": "...", "table": "..."}``.""" ...
the_stack_v2_python_sparse
allennlp/predictors/wikitables_parser.py
Whu-wxy/allennlp
train
6
ed0e0fd89f5f7d5a3b77397969eae0978e64e2ea
[ "self.pf = kwargs.copy()\nself.grid = grid\nif type(self.pf['source_type']) is not list:\n self.pf['source_type'] = [self.pf['source_type']]\nself.Ns = len(self.pf['source_type'])\nself.all_sources = self.src = self.initialize_sources()", "sources = []\nfor i in range(self.Ns):\n sf = self.pf.copy()\n if...
<|body_start_0|> self.pf = kwargs.copy() self.grid = grid if type(self.pf['source_type']) is not list: self.pf['source_type'] = [self.pf['source_type']] self.Ns = len(self.pf['source_type']) self.all_sources = self.src = self.initialize_sources() <|end_body_0|> <|bod...
Class for stitching together several radiation sources.
Composite
[ "LicenseRef-scancode-warranty-disclaimer", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Composite: """Class for stitching together several radiation sources.""" def __init__(self, grid=None, **kwargs): """Initialize composite radiation source object. Parameters ---------- grid : ares.static.Grid.Grid instance""" <|body_0|> def initialize_sources(self): ...
stack_v2_sparse_classes_10k_train_006471
2,207
permissive
[ { "docstring": "Initialize composite radiation source object. Parameters ---------- grid : ares.static.Grid.Grid instance", "name": "__init__", "signature": "def __init__(self, grid=None, **kwargs)" }, { "docstring": "Construct list of RadiationSource class instances.", "name": "initialize_s...
2
null
Implement the Python class `Composite` described below. Class description: Class for stitching together several radiation sources. Method signatures and docstrings: - def __init__(self, grid=None, **kwargs): Initialize composite radiation source object. Parameters ---------- grid : ares.static.Grid.Grid instance - de...
Implement the Python class `Composite` described below. Class description: Class for stitching together several radiation sources. Method signatures and docstrings: - def __init__(self, grid=None, **kwargs): Initialize composite radiation source object. Parameters ---------- grid : ares.static.Grid.Grid instance - de...
f323300b56ae61fab56eda1e5179cfc991eaa74f
<|skeleton|> class Composite: """Class for stitching together several radiation sources.""" def __init__(self, grid=None, **kwargs): """Initialize composite radiation source object. Parameters ---------- grid : ares.static.Grid.Grid instance""" <|body_0|> def initialize_sources(self): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Composite: """Class for stitching together several radiation sources.""" def __init__(self, grid=None, **kwargs): """Initialize composite radiation source object. Parameters ---------- grid : ares.static.Grid.Grid instance""" self.pf = kwargs.copy() self.grid = grid if typ...
the_stack_v2_python_sparse
ares/sources/Composite.py
mirochaj/ares
train
16
2f8dfa2dbce137eb9548ccb02aa6a1acf5836866
[ "self.left_top_point = ShapePoint(start_end_points[0])\nself.right_top_point = ShapePoint(start_end_points[1])\nself.bins = bins\nself.count = count\nstep = abs((self.right_top_point[0] - self.left_top_point[0]) / count)\nx_start_point = self.left_top_point[0]\nx_end_point = x_start_point + step\ny_point = self.lef...
<|body_start_0|> self.left_top_point = ShapePoint(start_end_points[0]) self.right_top_point = ShapePoint(start_end_points[1]) self.bins = bins self.count = count step = abs((self.right_top_point[0] - self.left_top_point[0]) / count) x_start_point = self.left_top_point[0] ...
Funnels
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Funnels: def __init__(self, start_end_points: Tuple[tuple, tuple], funnel: Funnel, count: int, bins: Union[int, float], annot: bool=False, *args, **kwargs): """Object-constructor for the funnels. Inside init, you could pass all needed variables that will be passed to the Funnel init as w...
stack_v2_sparse_classes_10k_train_006472
3,894
no_license
[ { "docstring": "Object-constructor for the funnels. Inside init, you could pass all needed variables that will be passed to the Funnel init as well. Args: start_end_points (Tuple[tuple, tuple]): Left top and right top points. ((x1,y1), (x2,y2)). funnel (Funnel): Class for the funnel building. Must be inherited ...
2
stack_v2_sparse_classes_30k_train_005307
Implement the Python class `Funnels` described below. Class description: Implement the Funnels class. Method signatures and docstrings: - def __init__(self, start_end_points: Tuple[tuple, tuple], funnel: Funnel, count: int, bins: Union[int, float], annot: bool=False, *args, **kwargs): Object-constructor for the funne...
Implement the Python class `Funnels` described below. Class description: Implement the Funnels class. Method signatures and docstrings: - def __init__(self, start_end_points: Tuple[tuple, tuple], funnel: Funnel, count: int, bins: Union[int, float], annot: bool=False, *args, **kwargs): Object-constructor for the funne...
290bf56ef888283a0225939ed8b1f87445e506d0
<|skeleton|> class Funnels: def __init__(self, start_end_points: Tuple[tuple, tuple], funnel: Funnel, count: int, bins: Union[int, float], annot: bool=False, *args, **kwargs): """Object-constructor for the funnels. Inside init, you could pass all needed variables that will be passed to the Funnel init as w...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Funnels: def __init__(self, start_end_points: Tuple[tuple, tuple], funnel: Funnel, count: int, bins: Union[int, float], annot: bool=False, *args, **kwargs): """Object-constructor for the funnels. Inside init, you could pass all needed variables that will be passed to the Funnel init as well. Args: sta...
the_stack_v2_python_sparse
classes/funnels.py
mohovkm/habr_manim
train
0
f275cb47faca3b046385f94c356da4ad879ec7ac
[ "self.main_window = QtGui.QWidget()\nself.gui = Ui_StopwatchGui()\nself.gui.setupUi(self.main_window)\nself.gui.start_stop_button.clicked.connect(self.start_stop)\nself.stop_event = Event()\nself.stop_event.set()\nself.main_window.show()", "if self.stop_event.is_set():\n self.stop_event.clear()\n self.timer...
<|body_start_0|> self.main_window = QtGui.QWidget() self.gui = Ui_StopwatchGui() self.gui.setupUi(self.main_window) self.gui.start_stop_button.clicked.connect(self.start_stop) self.stop_event = Event() self.stop_event.set() self.main_window.show() <|end_body_0|> ...
Application class to instantiate and control a StopwatchGui.
StopwatchApp
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StopwatchApp: """Application class to instantiate and control a StopwatchGui.""" def __init__(self): """Initialize and show the gui.""" <|body_0|> def start_stop(self): """Start the stopwatch if it is not running; stop it if it is running.""" <|body_1|> ...
stack_v2_sparse_classes_10k_train_006473
2,727
no_license
[ { "docstring": "Initialize and show the gui.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Start the stopwatch if it is not running; stop it if it is running.", "name": "start_stop", "signature": "def start_stop(self)" }, { "docstring": "Runs a stopwa...
3
stack_v2_sparse_classes_30k_test_000123
Implement the Python class `StopwatchApp` described below. Class description: Application class to instantiate and control a StopwatchGui. Method signatures and docstrings: - def __init__(self): Initialize and show the gui. - def start_stop(self): Start the stopwatch if it is not running; stop it if it is running. - ...
Implement the Python class `StopwatchApp` described below. Class description: Application class to instantiate and control a StopwatchGui. Method signatures and docstrings: - def __init__(self): Initialize and show the gui. - def start_stop(self): Start the stopwatch if it is not running; stop it if it is running. - ...
e1ad9c8f3e09aec3ee72821bd8374c957f047589
<|skeleton|> class StopwatchApp: """Application class to instantiate and control a StopwatchGui.""" def __init__(self): """Initialize and show the gui.""" <|body_0|> def start_stop(self): """Start the stopwatch if it is not running; stop it if it is running.""" <|body_1|> ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class StopwatchApp: """Application class to instantiate and control a StopwatchGui.""" def __init__(self): """Initialize and show the gui.""" self.main_window = QtGui.QWidget() self.gui = Ui_StopwatchGui() self.gui.setupUi(self.main_window) self.gui.start_stop_button.cli...
the_stack_v2_python_sparse
DailyLabs/Lsn35/StopwatchApp.py
NathanRuprecht/CS210_IntroToProgramming
train
0
760d5168f4a32fc286485913717ee250692e0ba4
[ "log = ResultLog.ResultLog()\ntry:\n br = webdriver.Firefox()\nexcept:\n log.info('浏览器初始化失败了')\nbr.get('http://www.xebest.com:8000')\nreturn br", "log = ResultLog.ResultLog()\ntry:\n br = webdriver.Firefox()\nexcept:\n log.info('浏览器初始化失败了')\nbr.get('https://user.xebest.com:8443/loginAction!init.action...
<|body_start_0|> log = ResultLog.ResultLog() try: br = webdriver.Firefox() except: log.info('浏览器初始化失败了') br.get('http://www.xebest.com:8000') return br <|end_body_0|> <|body_start_1|> log = ResultLog.ResultLog() try: br = webdr...
Browser
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Browser: def init_browser(self): """该函数主要是初始化浏览器对象并返回一个webdriver对象""" <|body_0|> def init_browserByCustomerCenter(self): """该函数主要是初始化浏览器对象并返回一个webdriver对象""" <|body_1|> def init_browserByRegister(self): """该函数主要是初始化浏览器对象并返回一个webdriver对象""" ...
stack_v2_sparse_classes_10k_train_006474
1,205
no_license
[ { "docstring": "该函数主要是初始化浏览器对象并返回一个webdriver对象", "name": "init_browser", "signature": "def init_browser(self)" }, { "docstring": "该函数主要是初始化浏览器对象并返回一个webdriver对象", "name": "init_browserByCustomerCenter", "signature": "def init_browserByCustomerCenter(self)" }, { "docstring": "该函数主...
3
stack_v2_sparse_classes_30k_train_005548
Implement the Python class `Browser` described below. Class description: Implement the Browser class. Method signatures and docstrings: - def init_browser(self): 该函数主要是初始化浏览器对象并返回一个webdriver对象 - def init_browserByCustomerCenter(self): 该函数主要是初始化浏览器对象并返回一个webdriver对象 - def init_browserByRegister(self): 该函数主要是初始化浏览器对象并返...
Implement the Python class `Browser` described below. Class description: Implement the Browser class. Method signatures and docstrings: - def init_browser(self): 该函数主要是初始化浏览器对象并返回一个webdriver对象 - def init_browserByCustomerCenter(self): 该函数主要是初始化浏览器对象并返回一个webdriver对象 - def init_browserByRegister(self): 该函数主要是初始化浏览器对象并返...
4dd065806f20bfdec885fa2b40f2c22e5a8d4f15
<|skeleton|> class Browser: def init_browser(self): """该函数主要是初始化浏览器对象并返回一个webdriver对象""" <|body_0|> def init_browserByCustomerCenter(self): """该函数主要是初始化浏览器对象并返回一个webdriver对象""" <|body_1|> def init_browserByRegister(self): """该函数主要是初始化浏览器对象并返回一个webdriver对象""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Browser: def init_browser(self): """该函数主要是初始化浏览器对象并返回一个webdriver对象""" log = ResultLog.ResultLog() try: br = webdriver.Firefox() except: log.info('浏览器初始化失败了') br.get('http://www.xebest.com:8000') return br def init_browserByCustomerCe...
the_stack_v2_python_sparse
Action/Browser.py
Hardworking-tester/HuaYing
train
0
fda012309a0db17998c7739733f7afee064c0767
[ "updated = 0\nnow = datetime.datetime.now()\nfor t in queryset:\n t.last_run = now - datetime.timedelta(seconds=t.run_every)\n t.save()\n updated += 1\nif updated == 1:\n message = '1 task has been rescheduled'\nelse:\n message = '%d tasks have been rescheduled' % updated\nself.message_user(request, ...
<|body_start_0|> updated = 0 now = datetime.datetime.now() for t in queryset: t.last_run = now - datetime.timedelta(seconds=t.run_every) t.save() updated += 1 if updated == 1: message = '1 task has been rescheduled' else: ...
Schedule admin
ScheduleAdmin
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ScheduleAdmin: """Schedule admin""" def run_now(self, request, queryset): """Reschedule selected tasks""" <|body_0|> def save_model(self, request, obj, form, change): """Handle timeout""" <|body_1|> <|end_skeleton|> <|body_start_0|> updated = 0 ...
stack_v2_sparse_classes_10k_train_006475
2,711
permissive
[ { "docstring": "Reschedule selected tasks", "name": "run_now", "signature": "def run_now(self, request, queryset)" }, { "docstring": "Handle timeout", "name": "save_model", "signature": "def save_model(self, request, obj, form, change)" } ]
2
null
Implement the Python class `ScheduleAdmin` described below. Class description: Schedule admin Method signatures and docstrings: - def run_now(self, request, queryset): Reschedule selected tasks - def save_model(self, request, obj, form, change): Handle timeout
Implement the Python class `ScheduleAdmin` described below. Class description: Schedule admin Method signatures and docstrings: - def run_now(self, request, queryset): Reschedule selected tasks - def save_model(self, request, obj, form, change): Handle timeout <|skeleton|> class ScheduleAdmin: """Schedule admin"...
d43c14f02266b5a4e1fca2db3296cef612d63374
<|skeleton|> class ScheduleAdmin: """Schedule admin""" def run_now(self, request, queryset): """Reschedule selected tasks""" <|body_0|> def save_model(self, request, obj, form, change): """Handle timeout""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ScheduleAdmin: """Schedule admin""" def run_now(self, request, queryset): """Reschedule selected tasks""" updated = 0 now = datetime.datetime.now() for t in queryset: t.last_run = now - datetime.timedelta(seconds=t.run_every) t.save() up...
the_stack_v2_python_sparse
services/web/apps/main/schedule/views.py
fantmas2/noc
train
0
887cc014f6ea3f57abd3d0350894f93c11a21a13
[ "args = self.args\nif args and (not args[0] in [\"'\", ',', ':']):\n args = ' %s' % args.strip()\nself.args = args", "if not self.args:\n msg = 'What do you want to do?'\n self.caller.msg(msg)\nelse:\n msg = f'{self.caller.name}{self.args}'\n self.caller.location.msg_contents(text=(msg, {'type': 'p...
<|body_start_0|> args = self.args if args and (not args[0] in ["'", ',', ':']): args = ' %s' % args.strip() self.args = args <|end_body_0|> <|body_start_1|> if not self.args: msg = 'What do you want to do?' self.caller.msg(msg) else: ...
strike a pose Usage: pose <pose text> pose's <pose text> Example: pose is standing by the wall, smiling. -> others will see: Tom is standing by the wall, smiling. Describe an action being taken. The pose text will automatically begin with your name.
CmdPose
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CmdPose: """strike a pose Usage: pose <pose text> pose's <pose text> Example: pose is standing by the wall, smiling. -> others will see: Tom is standing by the wall, smiling. Describe an action being taken. The pose text will automatically begin with your name.""" def parse(self): ""...
stack_v2_sparse_classes_10k_train_006476
22,494
permissive
[ { "docstring": "Custom parse the cases where the emote starts with some special letter, such as 's, at which we don't want to separate the caller's name and the emote with a space.", "name": "parse", "signature": "def parse(self)" }, { "docstring": "Hook function", "name": "func", "signa...
2
null
Implement the Python class `CmdPose` described below. Class description: strike a pose Usage: pose <pose text> pose's <pose text> Example: pose is standing by the wall, smiling. -> others will see: Tom is standing by the wall, smiling. Describe an action being taken. The pose text will automatically begin with your na...
Implement the Python class `CmdPose` described below. Class description: strike a pose Usage: pose <pose text> pose's <pose text> Example: pose is standing by the wall, smiling. -> others will see: Tom is standing by the wall, smiling. Describe an action being taken. The pose text will automatically begin with your na...
b3ca58b5c1325a3bf57051dfe23560a08d2947b7
<|skeleton|> class CmdPose: """strike a pose Usage: pose <pose text> pose's <pose text> Example: pose is standing by the wall, smiling. -> others will see: Tom is standing by the wall, smiling. Describe an action being taken. The pose text will automatically begin with your name.""" def parse(self): ""...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CmdPose: """strike a pose Usage: pose <pose text> pose's <pose text> Example: pose is standing by the wall, smiling. -> others will see: Tom is standing by the wall, smiling. Describe an action being taken. The pose text will automatically begin with your name.""" def parse(self): """Custom parse...
the_stack_v2_python_sparse
evennia/commands/default/general.py
evennia/evennia
train
1,781
6fc43cc5de2f4eb3942f4a340d9281a9dffb19cf
[ "levels = []\nif not root:\n return levels\n\ndef helper(node, level):\n if len(levels) == level:\n levels.append([])\n levels[level].append(node.val)\n if node.left:\n helper(node.left, level + 1)\n if node.right:\n helper(node.right, level + 1)\nhelper(root, 0)\nreturn levels[:...
<|body_start_0|> levels = [] if not root: return levels def helper(node, level): if len(levels) == level: levels.append([]) levels[level].append(node.val) if node.left: helper(node.left, level + 1) if no...
Tree
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Tree: def traversal_(self, root: 'TreeNode') -> List[int]: """Approach: Recursion Time Complexity: O(N) Space Complexity: O(N) :param root: :return:""" <|body_0|> def traversal(self, root: 'TreeNode') -> List[int]: """Approach: Iterative/ BFS Time Complexity: O(N) Sp...
stack_v2_sparse_classes_10k_train_006477
1,516
no_license
[ { "docstring": "Approach: Recursion Time Complexity: O(N) Space Complexity: O(N) :param root: :return:", "name": "traversal_", "signature": "def traversal_(self, root: 'TreeNode') -> List[int]" }, { "docstring": "Approach: Iterative/ BFS Time Complexity: O(N) Space Complexity: O(N) :param root: ...
2
null
Implement the Python class `Tree` described below. Class description: Implement the Tree class. Method signatures and docstrings: - def traversal_(self, root: 'TreeNode') -> List[int]: Approach: Recursion Time Complexity: O(N) Space Complexity: O(N) :param root: :return: - def traversal(self, root: 'TreeNode') -> Lis...
Implement the Python class `Tree` described below. Class description: Implement the Tree class. Method signatures and docstrings: - def traversal_(self, root: 'TreeNode') -> List[int]: Approach: Recursion Time Complexity: O(N) Space Complexity: O(N) :param root: :return: - def traversal(self, root: 'TreeNode') -> Lis...
65cc78b5afa0db064f9fe8f06597e3e120f7363d
<|skeleton|> class Tree: def traversal_(self, root: 'TreeNode') -> List[int]: """Approach: Recursion Time Complexity: O(N) Space Complexity: O(N) :param root: :return:""" <|body_0|> def traversal(self, root: 'TreeNode') -> List[int]: """Approach: Iterative/ BFS Time Complexity: O(N) Sp...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Tree: def traversal_(self, root: 'TreeNode') -> List[int]: """Approach: Recursion Time Complexity: O(N) Space Complexity: O(N) :param root: :return:""" levels = [] if not root: return levels def helper(node, level): if len(levels) == level: ...
the_stack_v2_python_sparse
revisited_2021/tree/bst_level_order_traversal.py
Shiv2157k/leet_code
train
1
de87a8bccdaaf69f6bc607b4bfd5a44026af09af
[ "self.region = region\nself.proxy_config = Config()\nif proxy != 'NONE':\n self.proxy_config = Config(proxies={'https': proxy})", "try:\n return boto3.client(service, region_name=self.region, config=self.proxy_config)\nexcept ClientError as e:\n fail('AWS %s service failed with exception: %s' % (service,...
<|body_start_0|> self.region = region self.proxy_config = Config() if proxy != 'NONE': self.proxy_config = Config(proxies={'https': proxy}) <|end_body_0|> <|body_start_1|> try: return boto3.client(service, region_name=self.region, config=self.proxy_config) ...
Boto3 configuration object.
Boto3ClientFactory
[ "Python-2.0", "GPL-1.0-or-later", "MPL-2.0", "MIT", "LicenseRef-scancode-python-cwi", "BSD-3-Clause", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-free-unknown", "Apache-2.0", "MIT-0", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Boto3ClientFactory: """Boto3 configuration object.""" def __init__(self, region, proxy='NONE'): """Initialize the object.""" <|body_0|> def get_client(self, service): """Initialize the boto3 client for a given service. :param service: boto3 service. :return: the ...
stack_v2_sparse_classes_10k_train_006478
14,826
permissive
[ { "docstring": "Initialize the object.", "name": "__init__", "signature": "def __init__(self, region, proxy='NONE')" }, { "docstring": "Initialize the boto3 client for a given service. :param service: boto3 service. :return: the boto3 client", "name": "get_client", "signature": "def get_...
2
stack_v2_sparse_classes_30k_train_002416
Implement the Python class `Boto3ClientFactory` described below. Class description: Boto3 configuration object. Method signatures and docstrings: - def __init__(self, region, proxy='NONE'): Initialize the object. - def get_client(self, service): Initialize the boto3 client for a given service. :param service: boto3 s...
Implement the Python class `Boto3ClientFactory` described below. Class description: Boto3 configuration object. Method signatures and docstrings: - def __init__(self, region, proxy='NONE'): Initialize the object. - def get_client(self, service): Initialize the boto3 client for a given service. :param service: boto3 s...
a213978a09ea7fc80855bf55c539861ea95259f9
<|skeleton|> class Boto3ClientFactory: """Boto3 configuration object.""" def __init__(self, region, proxy='NONE'): """Initialize the object.""" <|body_0|> def get_client(self, service): """Initialize the boto3 client for a given service. :param service: boto3 service. :return: the ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Boto3ClientFactory: """Boto3 configuration object.""" def __init__(self, region, proxy='NONE'): """Initialize the object.""" self.region = region self.proxy_config = Config() if proxy != 'NONE': self.proxy_config = Config(proxies={'https': proxy}) def get_...
the_stack_v2_python_sparse
awsbatch-cli/src/awsbatch/common.py
aws/aws-parallelcluster
train
520
ec77e5f2083daba0c58efe8a6e8f2644aeabb214
[ "super().__init__(name)\nself.__name__ = name\nself.gen = gen", "rval = []\nfor tup, param in zip(tups, params):\n if not isinstance(tup, AbstractTuple):\n raise MyiaTypeError(f'Expected AbstractTuple, not {tup}')\n rval.append([g.apply(P.tuple_getitem, param, i) for i, elem in enumerate(tup.elements...
<|body_start_0|> super().__init__(name) self.__name__ = name self.gen = gen <|end_body_0|> <|body_start_1|> rval = [] for tup, param in zip(tups, params): if not isinstance(tup, AbstractTuple): raise MyiaTypeError(f'Expected AbstractTuple, not {tup}')...
Parametrizable MetaGraph to combine or extract tuples.
TupleReorganizer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TupleReorganizer: """Parametrizable MetaGraph to combine or extract tuples.""" def __init__(self, name, gen): """Initialize a TupleReorganizer.""" <|body_0|> def map_tuples(self, g, params, tups): """Map each element of each tuple to a getitem on the parameter.""...
stack_v2_sparse_classes_10k_train_006479
2,705
permissive
[ { "docstring": "Initialize a TupleReorganizer.", "name": "__init__", "signature": "def __init__(self, name, gen)" }, { "docstring": "Map each element of each tuple to a getitem on the parameter.", "name": "map_tuples", "signature": "def map_tuples(self, g, params, tups)" }, { "do...
3
null
Implement the Python class `TupleReorganizer` described below. Class description: Parametrizable MetaGraph to combine or extract tuples. Method signatures and docstrings: - def __init__(self, name, gen): Initialize a TupleReorganizer. - def map_tuples(self, g, params, tups): Map each element of each tuple to a getite...
Implement the Python class `TupleReorganizer` described below. Class description: Parametrizable MetaGraph to combine or extract tuples. Method signatures and docstrings: - def __init__(self, name, gen): Initialize a TupleReorganizer. - def map_tuples(self, g, params, tups): Map each element of each tuple to a getite...
d7b12c15453079e1a2c4fdae611c5f741574363d
<|skeleton|> class TupleReorganizer: """Parametrizable MetaGraph to combine or extract tuples.""" def __init__(self, name, gen): """Initialize a TupleReorganizer.""" <|body_0|> def map_tuples(self, g, params, tups): """Map each element of each tuple to a getitem on the parameter.""...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TupleReorganizer: """Parametrizable MetaGraph to combine or extract tuples.""" def __init__(self, name, gen): """Initialize a TupleReorganizer.""" super().__init__(name) self.__name__ = name self.gen = gen def map_tuples(self, g, params, tups): """Map each ele...
the_stack_v2_python_sparse
myia/operations/ops_tuple.py
breuleux/myia
train
1
bac021f94f2e11735c86c690c60800a8c16a2fd2
[ "queue = self.messages.Queue(name=queue_ref.RelativeName(), retryConfig=retry_config, rateLimits=rate_limits, appEngineRoutingOverride=app_engine_routing_override)\nrequest = self.messages.CloudtasksProjectsLocationsQueuesCreateRequest(parent=parent_ref.RelativeName(), queue=queue)\nreturn self.queues_service.Creat...
<|body_start_0|> queue = self.messages.Queue(name=queue_ref.RelativeName(), retryConfig=retry_config, rateLimits=rate_limits, appEngineRoutingOverride=app_engine_routing_override) request = self.messages.CloudtasksProjectsLocationsQueuesCreateRequest(parent=parent_ref.RelativeName(), queue=queue) ...
Client for queues service in the Cloud Tasks API.
Queues
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Queues: """Client for queues service in the Cloud Tasks API.""" def Create(self, parent_ref, queue_ref, retry_config=None, rate_limits=None, app_engine_routing_override=None): """Prepares and sends a Create request for creating a queue.""" <|body_0|> def Patch(self, queu...
stack_v2_sparse_classes_10k_train_006480
9,305
permissive
[ { "docstring": "Prepares and sends a Create request for creating a queue.", "name": "Create", "signature": "def Create(self, parent_ref, queue_ref, retry_config=None, rate_limits=None, app_engine_routing_override=None)" }, { "docstring": "Prepares and sends a Patch request for modifying a queue....
2
null
Implement the Python class `Queues` described below. Class description: Client for queues service in the Cloud Tasks API. Method signatures and docstrings: - def Create(self, parent_ref, queue_ref, retry_config=None, rate_limits=None, app_engine_routing_override=None): Prepares and sends a Create request for creating...
Implement the Python class `Queues` described below. Class description: Client for queues service in the Cloud Tasks API. Method signatures and docstrings: - def Create(self, parent_ref, queue_ref, retry_config=None, rate_limits=None, app_engine_routing_override=None): Prepares and sends a Create request for creating...
85bb264e273568b5a0408f733b403c56373e2508
<|skeleton|> class Queues: """Client for queues service in the Cloud Tasks API.""" def Create(self, parent_ref, queue_ref, retry_config=None, rate_limits=None, app_engine_routing_override=None): """Prepares and sends a Create request for creating a queue.""" <|body_0|> def Patch(self, queu...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Queues: """Client for queues service in the Cloud Tasks API.""" def Create(self, parent_ref, queue_ref, retry_config=None, rate_limits=None, app_engine_routing_override=None): """Prepares and sends a Create request for creating a queue.""" queue = self.messages.Queue(name=queue_ref.Relati...
the_stack_v2_python_sparse
google-cloud-sdk/lib/googlecloudsdk/api_lib/tasks/queues.py
bopopescu/socialliteapp
train
0
97c6a9ba97285ce1e460158b94b8e7f4e21c6d02
[ "self.logger = logger\nself.options = options\nif options.checkpoint_file is not None:\n local_ckpt_file = os.path.join(options.checkpoint_dir, options.checkpoint_file)\n if not os.path.exists(local_ckpt_file):\n raise ValueError('Checkpoint file [{}] does not exist!'.format(options.checkpoint_file))\n...
<|body_start_0|> self.logger = logger self.options = options if options.checkpoint_file is not None: local_ckpt_file = os.path.join(options.checkpoint_dir, options.checkpoint_file) if not os.path.exists(local_ckpt_file): raise ValueError('Checkpoint file [...
Class that handles saving and loading checkpoints during training.
CheckpointSaver
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CheckpointSaver: """Class that handles saving and loading checkpoints during training.""" def __init__(self, logger: Logger, options: EasyDict, training: str): """Initialization function. :param logger :param options""" <|body_0|> def check_end_epoch(self, fn: str) -> bo...
stack_v2_sparse_classes_10k_train_006481
5,171
permissive
[ { "docstring": "Initialization function. :param logger :param options", "name": "__init__", "signature": "def __init__(self, logger: Logger, options: EasyDict, training: str)" }, { "docstring": "Check if the checkpoint file is the end of one epoch. :param fn: :return:", "name": "check_end_ep...
5
stack_v2_sparse_classes_30k_train_006117
Implement the Python class `CheckpointSaver` described below. Class description: Class that handles saving and loading checkpoints during training. Method signatures and docstrings: - def __init__(self, logger: Logger, options: EasyDict, training: str): Initialization function. :param logger :param options - def chec...
Implement the Python class `CheckpointSaver` described below. Class description: Class that handles saving and loading checkpoints during training. Method signatures and docstrings: - def __init__(self, logger: Logger, options: EasyDict, training: str): Initialization function. :param logger :param options - def chec...
ca88df568a6f2143dcb85d22c005fce4562a7523
<|skeleton|> class CheckpointSaver: """Class that handles saving and loading checkpoints during training.""" def __init__(self, logger: Logger, options: EasyDict, training: str): """Initialization function. :param logger :param options""" <|body_0|> def check_end_epoch(self, fn: str) -> bo...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CheckpointSaver: """Class that handles saving and loading checkpoints during training.""" def __init__(self, logger: Logger, options: EasyDict, training: str): """Initialization function. :param logger :param options""" self.logger = logger self.options = options if option...
the_stack_v2_python_sparse
PointNetBaseline/code/functions/saver.py
zshyang/FieldConvolution
train
1
6a04d4d9f38017243fa2cef2220b0823b713c29f
[ "super(DataViewerWriter, self).__init__(cmd_tlm_data, deployment_name, cosmos_directory)\nself.repeated_names = {}\nself.destination = cosmos_directory + '/config/targets/' + deployment_name.upper() + '/tools/data_viewer/'", "event_list = []\nfor evr in self.cmd_tlm_data[2]:\n n = evr.get_evr_name()\n if n ...
<|body_start_0|> super(DataViewerWriter, self).__init__(cmd_tlm_data, deployment_name, cosmos_directory) self.repeated_names = {} self.destination = cosmos_directory + '/config/targets/' + deployment_name.upper() + '/tools/data_viewer/' <|end_body_0|> <|body_start_1|> event_list = [] ...
This class generates the data viewer definition file in cosmos_directory/config/targets/deployment_name.upper()/tools/data_viewer/
DataViewerWriter
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataViewerWriter: """This class generates the data viewer definition file in cosmos_directory/config/targets/deployment_name.upper()/tools/data_viewer/""" def __init__(self, cmd_tlm_data, deployment_name, cosmos_directory): """@param cmd_tlm_data: Tuple containing lists channels [0],...
stack_v2_sparse_classes_10k_train_006482
2,935
permissive
[ { "docstring": "@param cmd_tlm_data: Tuple containing lists channels [0], commands [1], and events [2] @param deployment_name: name of the COSMOS target @param cosmos_directory: Directory of COSMOS", "name": "__init__", "signature": "def __init__(self, cmd_tlm_data, deployment_name, cosmos_directory)" ...
2
stack_v2_sparse_classes_30k_test_000197
Implement the Python class `DataViewerWriter` described below. Class description: This class generates the data viewer definition file in cosmos_directory/config/targets/deployment_name.upper()/tools/data_viewer/ Method signatures and docstrings: - def __init__(self, cmd_tlm_data, deployment_name, cosmos_directory): ...
Implement the Python class `DataViewerWriter` described below. Class description: This class generates the data viewer definition file in cosmos_directory/config/targets/deployment_name.upper()/tools/data_viewer/ Method signatures and docstrings: - def __init__(self, cmd_tlm_data, deployment_name, cosmos_directory): ...
d19cade2140231b4e0879b2f6ab4a62b25792dea
<|skeleton|> class DataViewerWriter: """This class generates the data viewer definition file in cosmos_directory/config/targets/deployment_name.upper()/tools/data_viewer/""" def __init__(self, cmd_tlm_data, deployment_name, cosmos_directory): """@param cmd_tlm_data: Tuple containing lists channels [0],...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DataViewerWriter: """This class generates the data viewer definition file in cosmos_directory/config/targets/deployment_name.upper()/tools/data_viewer/""" def __init__(self, cmd_tlm_data, deployment_name, cosmos_directory): """@param cmd_tlm_data: Tuple containing lists channels [0], commands [1]...
the_stack_v2_python_sparse
Autocoders/Python/src/fprime_ac/utils/cosmos/writers/DataViewerWriter.py
nodcah/fprime
train
0
8c5d3028a982f74a580479b0a66eaf298f1600fd
[ "self.capacity = capacity\nself.queue = DLL()\nself.mapping = {}", "if key not in self.mapping:\n return -1\nnode = self.mapping[key]\nself.queue.update(node)\nreturn node.val", "if key in self.mapping:\n node = self.mapping[key]\n node.val = value\n self.queue.update(node)\n return\nnode = Node(...
<|body_start_0|> self.capacity = capacity self.queue = DLL() self.mapping = {} <|end_body_0|> <|body_start_1|> if key not in self.mapping: return -1 node = self.mapping[key] self.queue.update(node) return node.val <|end_body_1|> <|body_start_2|> ...
LRUCache
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:rtype: int""" <|body_1|> def set(self, key, value): """:type key: int :type value: int :rtype: nothing""" <|body_2|> <|end_skeleton|> <...
stack_v2_sparse_classes_10k_train_006483
2,822
no_license
[ { "docstring": ":type capacity: int", "name": "__init__", "signature": "def __init__(self, capacity)" }, { "docstring": ":rtype: int", "name": "get", "signature": "def get(self, key)" }, { "docstring": ":type key: int :type value: int :rtype: nothing", "name": "set", "sig...
3
stack_v2_sparse_classes_30k_train_006633
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :rtype: int - def set(self, key, value): :type key: int :type value: int :rtype: nothing
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :rtype: int - def set(self, key, value): :type key: int :type value: int :rtype: nothing <|skeleton|> cla...
05e0beff0047f0ad399d0b46d625bb8d3459814e
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:rtype: int""" <|body_1|> def set(self, key, value): """:type key: int :type value: int :rtype: nothing""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LRUCache: def __init__(self, capacity): """:type capacity: int""" self.capacity = capacity self.queue = DLL() self.mapping = {} def get(self, key): """:rtype: int""" if key not in self.mapping: return -1 node = self.mapping[key] ...
the_stack_v2_python_sparse
python_1_to_1000/146_LRU_Cache.py
jakehoare/leetcode
train
58
c8c853392ee573013a8b6c0d0da6c010fde2b69b
[ "if 'git_uri' not in self.user_params:\n raise ValueError(f'{self.__class__.__name__} instance has no source (no git_uri in user params)')\nreturn source.GitSource(provider='git', uri=self.user_params['git_uri'], provider_params={'git_commit': self.user_params.get('git_ref'), 'git_commit_depth': self.user_params...
<|body_start_0|> if 'git_uri' not in self.user_params: raise ValueError(f'{self.__class__.__name__} instance has no source (no git_uri in user params)') return source.GitSource(provider='git', uri=self.user_params['git_uri'], provider_params={'git_commit': self.user_params.get('git_ref'), 'g...
Task parameters (coming from CLI arguments).
TaskParams
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TaskParams: """Task parameters (coming from CLI arguments).""" def source(self) -> source.Source: """Source for the input files the task will operate on (e.g. a git repo).""" <|body_0|> def from_cli_args(cls, args: dict): """Create a TaskParams instance from CLI ...
stack_v2_sparse_classes_10k_train_006484
4,580
permissive
[ { "docstring": "Source for the input files the task will operate on (e.g. a git repo).", "name": "source", "signature": "def source(self) -> source.Source" }, { "docstring": "Create a TaskParams instance from CLI arguments.", "name": "from_cli_args", "signature": "def from_cli_args(cls, ...
2
stack_v2_sparse_classes_30k_train_004370
Implement the Python class `TaskParams` described below. Class description: Task parameters (coming from CLI arguments). Method signatures and docstrings: - def source(self) -> source.Source: Source for the input files the task will operate on (e.g. a git repo). - def from_cli_args(cls, args: dict): Create a TaskPara...
Implement the Python class `TaskParams` described below. Class description: Task parameters (coming from CLI arguments). Method signatures and docstrings: - def source(self) -> source.Source: Source for the input files the task will operate on (e.g. a git repo). - def from_cli_args(cls, args: dict): Create a TaskPara...
0ed6e07d848db7090332a18ef8ace3585dd314ac
<|skeleton|> class TaskParams: """Task parameters (coming from CLI arguments).""" def source(self) -> source.Source: """Source for the input files the task will operate on (e.g. a git repo).""" <|body_0|> def from_cli_args(cls, args: dict): """Create a TaskParams instance from CLI ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TaskParams: """Task parameters (coming from CLI arguments).""" def source(self) -> source.Source: """Source for the input files the task will operate on (e.g. a git repo).""" if 'git_uri' not in self.user_params: raise ValueError(f'{self.__class__.__name__} instance has no sou...
the_stack_v2_python_sparse
atomic_reactor/tasks/common.py
fr34k8/atomic-reactor
train
1
29a1184fa0a47b1bf31e810232f41e76866cfb1d
[ "if not root:\n return 0\nreturn self.subroutine(root, 0)", "if not node:\n return depth\nreturn max(self.subroutine(node.left, depth + 1), self.subroutine(node.right, depth + 1))" ]
<|body_start_0|> if not root: return 0 return self.subroutine(root, 0) <|end_body_0|> <|body_start_1|> if not node: return depth return max(self.subroutine(node.left, depth + 1), self.subroutine(node.right, depth + 1)) <|end_body_1|>
Leet104
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Leet104: def max_depth(self, root): """Finds the max depth of a binary tree. Args: root -- TreeNode Returns: The max depth of a binary tree.""" <|body_0|> def subroutine(self, node, depth): """Find the max depth of two subtrees of a node. Args: node -- TreeNode max_d...
stack_v2_sparse_classes_10k_train_006485
1,033
no_license
[ { "docstring": "Finds the max depth of a binary tree. Args: root -- TreeNode Returns: The max depth of a binary tree.", "name": "max_depth", "signature": "def max_depth(self, root)" }, { "docstring": "Find the max depth of two subtrees of a node. Args: node -- TreeNode max_depth -- keeps track o...
2
stack_v2_sparse_classes_30k_train_001280
Implement the Python class `Leet104` described below. Class description: Implement the Leet104 class. Method signatures and docstrings: - def max_depth(self, root): Finds the max depth of a binary tree. Args: root -- TreeNode Returns: The max depth of a binary tree. - def subroutine(self, node, depth): Find the max d...
Implement the Python class `Leet104` described below. Class description: Implement the Leet104 class. Method signatures and docstrings: - def max_depth(self, root): Finds the max depth of a binary tree. Args: root -- TreeNode Returns: The max depth of a binary tree. - def subroutine(self, node, depth): Find the max d...
b0cfcfa1eff0101cf8e0e3fb9db55fb83f566f6f
<|skeleton|> class Leet104: def max_depth(self, root): """Finds the max depth of a binary tree. Args: root -- TreeNode Returns: The max depth of a binary tree.""" <|body_0|> def subroutine(self, node, depth): """Find the max depth of two subtrees of a node. Args: node -- TreeNode max_d...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Leet104: def max_depth(self, root): """Finds the max depth of a binary tree. Args: root -- TreeNode Returns: The max depth of a binary tree.""" if not root: return 0 return self.subroutine(root, 0) def subroutine(self, node, depth): """Find the max depth of two...
the_stack_v2_python_sparse
archive/algorithms-leetcode/leet104.py
riehseun/software-engineering
train
0
61929cb9652b6dedc88baeb58838ac8b580e44ae
[ "for order in self.browse(cr, uid, ids, context=context):\n if order.ttype == 'other':\n if order.stock_journal_id.need_visit:\n return True\n for line in order.order_line:\n if line.product_id.need_visit:\n return True\nreturn super(exchange_order, self).has_ca...
<|body_start_0|> for order in self.browse(cr, uid, ids, context=context): if order.ttype == 'other': if order.stock_journal_id.need_visit: return True for line in order.order_line: if line.product_id.need_visit: ...
exchange_order
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class exchange_order: def has_category_manager(self, cr, uid, ids, context=None): """Condition Workflow function. @return: boolean""" <|body_0|> def action_approve_order(self, cr, uid, ids, context=None): """Workflow function Changes order state to approve. @return: True""...
stack_v2_sparse_classes_10k_train_006486
6,031
no_license
[ { "docstring": "Condition Workflow function. @return: boolean", "name": "has_category_manager", "signature": "def has_category_manager(self, cr, uid, ids, context=None)" }, { "docstring": "Workflow function Changes order state to approve. @return: True", "name": "action_approve_order", "...
3
null
Implement the Python class `exchange_order` described below. Class description: Implement the exchange_order class. Method signatures and docstrings: - def has_category_manager(self, cr, uid, ids, context=None): Condition Workflow function. @return: boolean - def action_approve_order(self, cr, uid, ids, context=None)...
Implement the Python class `exchange_order` described below. Class description: Implement the exchange_order class. Method signatures and docstrings: - def has_category_manager(self, cr, uid, ids, context=None): Condition Workflow function. @return: boolean - def action_approve_order(self, cr, uid, ids, context=None)...
0b997095c260d58b026440967fea3a202bef7efb
<|skeleton|> class exchange_order: def has_category_manager(self, cr, uid, ids, context=None): """Condition Workflow function. @return: boolean""" <|body_0|> def action_approve_order(self, cr, uid, ids, context=None): """Workflow function Changes order state to approve. @return: True""...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class exchange_order: def has_category_manager(self, cr, uid, ids, context=None): """Condition Workflow function. @return: boolean""" for order in self.browse(cr, uid, ids, context=context): if order.ttype == 'other': if order.stock_journal_id.need_visit: ...
the_stack_v2_python_sparse
v_7/GDS/shamil_v3/stock_exchange_NISS/stock_exchange.py
musabahmed/baba
train
0
916bccd256044d2f40648b401b3dd8f97c296758
[ "self.client_ip = client_ip\nself.node_ip = node_ip\nself.server_ip = server_ip\nself.view_id = view_id\nself.view_name = view_name", "if dictionary is None:\n return None\nclient_ip = dictionary.get('clientIp')\nnode_ip = dictionary.get('nodeIp')\nserver_ip = dictionary.get('serverIp')\nview_id = dictionary.g...
<|body_start_0|> self.client_ip = client_ip self.node_ip = node_ip self.server_ip = server_ip self.view_id = view_id self.view_name = view_name <|end_body_0|> <|body_start_1|> if dictionary is None: return None client_ip = dictionary.get('clientIp') ...
Implementation of the 'NfsConnection' model. TODO: type description here. Attributes: client_ip (string): Specifies the Client IP address of the connection. node_ip (string): Specifies a Node IP address where the connection request is received. server_ip (string): Specifies the Server IP address of the connection. This...
NfsConnection
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NfsConnection: """Implementation of the 'NfsConnection' model. TODO: type description here. Attributes: client_ip (string): Specifies the Client IP address of the connection. node_ip (string): Specifies a Node IP address where the connection request is received. server_ip (string): Specifies the ...
stack_v2_sparse_classes_10k_train_006487
2,341
permissive
[ { "docstring": "Constructor for the NfsConnection class", "name": "__init__", "signature": "def __init__(self, client_ip=None, node_ip=None, server_ip=None, view_id=None, view_name=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dict...
2
stack_v2_sparse_classes_30k_train_000252
Implement the Python class `NfsConnection` described below. Class description: Implementation of the 'NfsConnection' model. TODO: type description here. Attributes: client_ip (string): Specifies the Client IP address of the connection. node_ip (string): Specifies a Node IP address where the connection request is recei...
Implement the Python class `NfsConnection` described below. Class description: Implementation of the 'NfsConnection' model. TODO: type description here. Attributes: client_ip (string): Specifies the Client IP address of the connection. node_ip (string): Specifies a Node IP address where the connection request is recei...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class NfsConnection: """Implementation of the 'NfsConnection' model. TODO: type description here. Attributes: client_ip (string): Specifies the Client IP address of the connection. node_ip (string): Specifies a Node IP address where the connection request is received. server_ip (string): Specifies the ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class NfsConnection: """Implementation of the 'NfsConnection' model. TODO: type description here. Attributes: client_ip (string): Specifies the Client IP address of the connection. node_ip (string): Specifies a Node IP address where the connection request is received. server_ip (string): Specifies the Server IP add...
the_stack_v2_python_sparse
cohesity_management_sdk/models/nfs_connection.py
cohesity/management-sdk-python
train
24
6d5ed1d2eb359dbfbee3cac333e9e97acd6e0ad6
[ "if 'colored' in kwargs:\n self.colored = kwargs['colored']\n del kwargs['colored']\nelse:\n self.colored = False\nkwargs['availheight'] = self.LABELHEIGHT - self.BLOCKHEIGHT\nBaseLTOLabel.__init__(self, *args, **kwargs)", "BaseLTOLabel.drawOn(self, canvas, x, y)\ncanvas.saveState()\ncanvas.setLineWidth(...
<|body_start_0|> if 'colored' in kwargs: self.colored = kwargs['colored'] del kwargs['colored'] else: self.colored = False kwargs['availheight'] = self.LABELHEIGHT - self.BLOCKHEIGHT BaseLTOLabel.__init__(self, *args, **kwargs) <|end_body_0|> <|body_s...
A class for LTO labels with rectangular blocks around the tape identifier.
VerticalLTOLabel
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VerticalLTOLabel: """A class for LTO labels with rectangular blocks around the tape identifier.""" def __init__(self, *args, **kwargs): """Initializes the label. colored : boolean to determine if blocks have to be colorized.""" <|body_0|> def drawOn(self, canvas, x, y): ...
stack_v2_sparse_classes_10k_train_006488
7,377
permissive
[ { "docstring": "Initializes the label. colored : boolean to determine if blocks have to be colorized.", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Draws some blocks around the identifier's characters.", "name": "drawOn", "signature": "def dr...
2
stack_v2_sparse_classes_30k_train_005412
Implement the Python class `VerticalLTOLabel` described below. Class description: A class for LTO labels with rectangular blocks around the tape identifier. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Initializes the label. colored : boolean to determine if blocks have to be colorized. - ...
Implement the Python class `VerticalLTOLabel` described below. Class description: A class for LTO labels with rectangular blocks around the tape identifier. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Initializes the label. colored : boolean to determine if blocks have to be colorized. - ...
c28aa50e2d6d3451b47e114094a86c03c87d4c50
<|skeleton|> class VerticalLTOLabel: """A class for LTO labels with rectangular blocks around the tape identifier.""" def __init__(self, *args, **kwargs): """Initializes the label. colored : boolean to determine if blocks have to be colorized.""" <|body_0|> def drawOn(self, canvas, x, y): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class VerticalLTOLabel: """A class for LTO labels with rectangular blocks around the tape identifier.""" def __init__(self, *args, **kwargs): """Initializes the label. colored : boolean to determine if blocks have to be colorized.""" if 'colored' in kwargs: self.colored = kwargs['co...
the_stack_v2_python_sparse
src/reportlab/graphics/barcode/lto.py
MrBitBucket/reportlab-mirror
train
64
8cf82579b9009fbccb5335b99d74f667b681244d
[ "super(TextSubNet, self).__init__()\nif num_layers == 1:\n dropout = 0.0\nself.rnn = nn.LSTM(in_size, hidden_size, num_layers=num_layers, dropout=dropout, bidirectional=bidirectional, batch_first=True)\nself.dropout = nn.Dropout(dropout)\nself.linear_1 = nn.Linear(hidden_size, out_size)", "_, final_states = se...
<|body_start_0|> super(TextSubNet, self).__init__() if num_layers == 1: dropout = 0.0 self.rnn = nn.LSTM(in_size, hidden_size, num_layers=num_layers, dropout=dropout, bidirectional=bidirectional, batch_first=True) self.dropout = nn.Dropout(dropout) self.linear_1 = nn....
The LSTM-based subnetwork that is used in TFN for text
TextSubNet
[ "GPL-1.0-or-later", "Apache-2.0", "BSD-2-Clause", "MIT", "BSD-3-Clause", "LicenseRef-scancode-generic-cla", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TextSubNet: """The LSTM-based subnetwork that is used in TFN for text""" def __init__(self, in_size, hidden_size, out_size, num_layers=1, dropout=0.2, bidirectional=False): """Args: in_size: input dimension hidden_size: hidden layer dimension num_layers: specify the number of layers ...
stack_v2_sparse_classes_10k_train_006489
3,873
permissive
[ { "docstring": "Args: in_size: input dimension hidden_size: hidden layer dimension num_layers: specify the number of layers of LSTMs. dropout: dropout probability bidirectional: specify usage of bidirectional LSTM Output: (return value in forward) a tensor of shape (batch_size, out_size)", "name": "__init__...
2
stack_v2_sparse_classes_30k_train_003236
Implement the Python class `TextSubNet` described below. Class description: The LSTM-based subnetwork that is used in TFN for text Method signatures and docstrings: - def __init__(self, in_size, hidden_size, out_size, num_layers=1, dropout=0.2, bidirectional=False): Args: in_size: input dimension hidden_size: hidden ...
Implement the Python class `TextSubNet` described below. Class description: The LSTM-based subnetwork that is used in TFN for text Method signatures and docstrings: - def __init__(self, in_size, hidden_size, out_size, num_layers=1, dropout=0.2, bidirectional=False): Args: in_size: input dimension hidden_size: hidden ...
92acc188d3a0f634de58463b6676e70df83ef808
<|skeleton|> class TextSubNet: """The LSTM-based subnetwork that is used in TFN for text""" def __init__(self, in_size, hidden_size, out_size, num_layers=1, dropout=0.2, bidirectional=False): """Args: in_size: input dimension hidden_size: hidden layer dimension num_layers: specify the number of layers ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TextSubNet: """The LSTM-based subnetwork that is used in TFN for text""" def __init__(self, in_size, hidden_size, out_size, num_layers=1, dropout=0.2, bidirectional=False): """Args: in_size: input dimension hidden_size: hidden layer dimension num_layers: specify the number of layers of LSTMs. dro...
the_stack_v2_python_sparse
PyTorch/contrib/others/MMSA_ID2979_for_PyTorch/models/subNets/FeatureNets.py
Ascend/ModelZoo-PyTorch
train
23
7ff20d2f3817695fbe07377b00deb27d0b3d0b72
[ "super().__init__(serialName, debug)\nself.bytesStuffed = 0\nself.createCOM(serialName)\nself.run()", "stop = False\nwhile not stop:\n print()\n self.getFile()\n self.checkBytes()\n self.buildHead()\n self.packet = self.head + self.fileBA + self.eop\n self.overhead = len(self.packet) / len(self....
<|body_start_0|> super().__init__(serialName, debug) self.bytesStuffed = 0 self.createCOM(serialName) self.run() <|end_body_0|> <|body_start_1|> stop = False while not stop: print() self.getFile() self.checkBytes() self.bui...
Client
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Client: def __init__(self, serialName, debug): """Executed when the object is created. Used to create all needed attributes.""" <|body_0|> def run(self): """Runs all the logic needed to send a file and receive a response.""" <|body_1|> def checkBytes(sel...
stack_v2_sparse_classes_10k_train_006490
12,431
no_license
[ { "docstring": "Executed when the object is created. Used to create all needed attributes.", "name": "__init__", "signature": "def __init__(self, serialName, debug)" }, { "docstring": "Runs all the logic needed to send a file and receive a response.", "name": "run", "signature": "def run...
5
stack_v2_sparse_classes_30k_train_006808
Implement the Python class `Client` described below. Class description: Implement the Client class. Method signatures and docstrings: - def __init__(self, serialName, debug): Executed when the object is created. Used to create all needed attributes. - def run(self): Runs all the logic needed to send a file and receiv...
Implement the Python class `Client` described below. Class description: Implement the Client class. Method signatures and docstrings: - def __init__(self, serialName, debug): Executed when the object is created. Used to create all needed attributes. - def run(self): Runs all the logic needed to send a file and receiv...
e8c6ee9672ad33c568d97ec07c3faa6dbf9359ac
<|skeleton|> class Client: def __init__(self, serialName, debug): """Executed when the object is created. Used to create all needed attributes.""" <|body_0|> def run(self): """Runs all the logic needed to send a file and receive a response.""" <|body_1|> def checkBytes(sel...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Client: def __init__(self, serialName, debug): """Executed when the object is created. Used to create all needed attributes.""" super().__init__(serialName, debug) self.bytesStuffed = 0 self.createCOM(serialName) self.run() def run(self): """Runs all the lo...
the_stack_v2_python_sparse
Projeto2/aplicacao.py
VFermat/CamadaFisica
train
1
619e841050b05e41f34952274311ffea92a5aebc
[ "freq = 0\nfor line in self.lines:\n freq += int(line)\nprint(f'Final freq: {freq}')", "found = False\nfreq = 0\nfreqs_hit = {freq}\nwhile not found:\n for line in self.lines:\n freq += int(line)\n if freq in freqs_hit:\n found = True\n break\n freqs_hit.add(freq)\...
<|body_start_0|> freq = 0 for line in self.lines: freq += int(line) print(f'Final freq: {freq}') <|end_body_0|> <|body_start_1|> found = False freq = 0 freqs_hit = {freq} while not found: for line in self.lines: freq += int...
Day 1 challenges
Challenge
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Challenge: """Day 1 challenges""" def challenge1(self): """Day 1 challenge 1""" <|body_0|> def challenge2(self): """Day 1 challenge 2""" <|body_1|> <|end_skeleton|> <|body_start_0|> freq = 0 for line in self.lines: freq += in...
stack_v2_sparse_classes_10k_train_006491
726
permissive
[ { "docstring": "Day 1 challenge 1", "name": "challenge1", "signature": "def challenge1(self)" }, { "docstring": "Day 1 challenge 2", "name": "challenge2", "signature": "def challenge2(self)" } ]
2
stack_v2_sparse_classes_30k_train_007070
Implement the Python class `Challenge` described below. Class description: Day 1 challenges Method signatures and docstrings: - def challenge1(self): Day 1 challenge 1 - def challenge2(self): Day 1 challenge 2
Implement the Python class `Challenge` described below. Class description: Day 1 challenges Method signatures and docstrings: - def challenge1(self): Day 1 challenge 1 - def challenge2(self): Day 1 challenge 2 <|skeleton|> class Challenge: """Day 1 challenges""" def challenge1(self): """Day 1 challe...
6671ef8c16a837f697bb3fb91004d1bd892814ba
<|skeleton|> class Challenge: """Day 1 challenges""" def challenge1(self): """Day 1 challenge 1""" <|body_0|> def challenge2(self): """Day 1 challenge 2""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Challenge: """Day 1 challenges""" def challenge1(self): """Day 1 challenge 1""" freq = 0 for line in self.lines: freq += int(line) print(f'Final freq: {freq}') def challenge2(self): """Day 1 challenge 2""" found = False freq = 0 ...
the_stack_v2_python_sparse
2018/day1/challenge.py
ericgreveson/adventofcode
train
0
0c7b1cfbf2e1d5472abbfe9ae038b643e0d875b3
[ "cnt, stack = (0, [])\nfor c in s:\n if 0 == len(stack) or stack[-1] == c:\n stack.append(c)\n else:\n stack.pop()\n if 0 == len(stack):\n cnt += 1\nreturn cnt", "lc, rc, cnt = (0, 0, 0)\nfor c in s:\n if c == 'L':\n lc += 1\n elif c == 'R':\n rc += 1\n if lc =...
<|body_start_0|> cnt, stack = (0, []) for c in s: if 0 == len(stack) or stack[-1] == c: stack.append(c) else: stack.pop() if 0 == len(stack): cnt += 1 return cnt <|end_body_0|> <|body_start_1|> lc, rc, c...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def balancedStringSplit0(self, s): """:type s: str :rtype: int""" <|body_0|> def balancedStringSplit(self, s): """:type s: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> cnt, stack = (0, []) for c in s: ...
stack_v2_sparse_classes_10k_train_006492
1,184
no_license
[ { "docstring": ":type s: str :rtype: int", "name": "balancedStringSplit0", "signature": "def balancedStringSplit0(self, s)" }, { "docstring": ":type s: str :rtype: int", "name": "balancedStringSplit", "signature": "def balancedStringSplit(self, s)" } ]
2
stack_v2_sparse_classes_30k_train_006269
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def balancedStringSplit0(self, s): :type s: str :rtype: int - def balancedStringSplit(self, s): :type s: str :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def balancedStringSplit0(self, s): :type s: str :rtype: int - def balancedStringSplit(self, s): :type s: str :rtype: int <|skeleton|> class Solution: def balancedStringSpli...
5376dd48b1cefb4faba9d2ef6a8a497b6b1d6c67
<|skeleton|> class Solution: def balancedStringSplit0(self, s): """:type s: str :rtype: int""" <|body_0|> def balancedStringSplit(self, s): """:type s: str :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def balancedStringSplit0(self, s): """:type s: str :rtype: int""" cnt, stack = (0, []) for c in s: if 0 == len(stack) or stack[-1] == c: stack.append(c) else: stack.pop() if 0 == len(stack): c...
the_stack_v2_python_sparse
python/problem-stack-and-queue/split_a_string_in_balanced_strings.py
hyunjun/practice
train
3
495e39976d726bc69633ac7a16e49d0f827f46d3
[ "pysam.Samfile.__init__(self, inputFname, openMode, **keywords)\nself.inputFname = inputFname\nself.openMode = openMode\n'\\n\\t\\tfrom pymodule import ProcessOptions\\n\\t\\tself.ad = ProcessOptions.process_function_arguments(keywords, self.option_default_dict, error_doc=self.__doc__, \\t\\t\\t\\t\\t\\t\\t\\t\\t\\...
<|body_start_0|> pysam.Samfile.__init__(self, inputFname, openMode, **keywords) self.inputFname = inputFname self.openMode = openMode '\n\t\tfrom pymodule import ProcessOptions\n\t\tself.ad = ProcessOptions.process_function_arguments(keywords, self.option_default_dict, error_doc=self.__d...
BamFile
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BamFile: def __init__(self, inputFname, openMode, **keywords): """2011-7-11""" <|body_0|> def traverseBamByRead(self, processor=None): """2011-7-10 add samfile to param_obj 2011-2-8 a traverser used by other functions""" <|body_1|> <|end_skeleton|> <|body_s...
stack_v2_sparse_classes_10k_train_006493
4,113
no_license
[ { "docstring": "2011-7-11", "name": "__init__", "signature": "def __init__(self, inputFname, openMode, **keywords)" }, { "docstring": "2011-7-10 add samfile to param_obj 2011-2-8 a traverser used by other functions", "name": "traverseBamByRead", "signature": "def traverseBamByRead(self, ...
2
null
Implement the Python class `BamFile` described below. Class description: Implement the BamFile class. Method signatures and docstrings: - def __init__(self, inputFname, openMode, **keywords): 2011-7-11 - def traverseBamByRead(self, processor=None): 2011-7-10 add samfile to param_obj 2011-2-8 a traverser used by other...
Implement the Python class `BamFile` described below. Class description: Implement the BamFile class. Method signatures and docstrings: - def __init__(self, inputFname, openMode, **keywords): 2011-7-11 - def traverseBamByRead(self, processor=None): 2011-7-10 add samfile to param_obj 2011-2-8 a traverser used by other...
b9333b85daed71032a1cba766585d0be1986ffdb
<|skeleton|> class BamFile: def __init__(self, inputFname, openMode, **keywords): """2011-7-11""" <|body_0|> def traverseBamByRead(self, processor=None): """2011-7-10 add samfile to param_obj 2011-2-8 a traverser used by other functions""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BamFile: def __init__(self, inputFname, openMode, **keywords): """2011-7-11""" pysam.Samfile.__init__(self, inputFname, openMode, **keywords) self.inputFname = inputFname self.openMode = openMode '\n\t\tfrom pymodule import ProcessOptions\n\t\tself.ad = ProcessOptions.p...
the_stack_v2_python_sparse
pymodule/yhio/BamFile.py
polyactis/gwasmodules
train
0
54c4f3520d5d633aec41806b924b17ff1faf61a8
[ "QtWidgets.QDialog.__init__(self)\nself.resize(1000, 700)\nself.topicList = QtWidgets.QListWidget()\nself.topicList.setFixedWidth(200)\nself.topicList.addItem('General Use')\nself.topicList.addItem('File Menu')\nself.topicList.addItem('Operations')\nself.topicList.currentItemChanged.connect(self.displayHelp)\nself....
<|body_start_0|> QtWidgets.QDialog.__init__(self) self.resize(1000, 700) self.topicList = QtWidgets.QListWidget() self.topicList.setFixedWidth(200) self.topicList.addItem('General Use') self.topicList.addItem('File Menu') self.topicList.addItem('Operations') ...
A help wiki to teach the user about the program and how to use it.
HelpModel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HelpModel: """A help wiki to teach the user about the program and how to use it.""" def __init__(self, parent=None): """Initializes the UI and sets the properties.""" <|body_0|> def help(self, parent=None): """Present knowledge to the user""" <|body_1|> ...
stack_v2_sparse_classes_10k_train_006494
29,548
no_license
[ { "docstring": "Initializes the UI and sets the properties.", "name": "__init__", "signature": "def __init__(self, parent=None)" }, { "docstring": "Present knowledge to the user", "name": "help", "signature": "def help(self, parent=None)" }, { "docstring": "Gets active selection ...
3
stack_v2_sparse_classes_30k_train_000708
Implement the Python class `HelpModel` described below. Class description: A help wiki to teach the user about the program and how to use it. Method signatures and docstrings: - def __init__(self, parent=None): Initializes the UI and sets the properties. - def help(self, parent=None): Present knowledge to the user - ...
Implement the Python class `HelpModel` described below. Class description: A help wiki to teach the user about the program and how to use it. Method signatures and docstrings: - def __init__(self, parent=None): Initializes the UI and sets the properties. - def help(self, parent=None): Present knowledge to the user - ...
1a3c5ad967472faf66236a311cc07a5128f5f911
<|skeleton|> class HelpModel: """A help wiki to teach the user about the program and how to use it.""" def __init__(self, parent=None): """Initializes the UI and sets the properties.""" <|body_0|> def help(self, parent=None): """Present knowledge to the user""" <|body_1|> ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class HelpModel: """A help wiki to teach the user about the program and how to use it.""" def __init__(self, parent=None): """Initializes the UI and sets the properties.""" QtWidgets.QDialog.__init__(self) self.resize(1000, 700) self.topicList = QtWidgets.QListWidget() s...
the_stack_v2_python_sparse
datatool/gui/Model.py
scottawalton/datatool
train
0
f4236a16b7551e09fb381c3363817cce5168e813
[ "item = MzituScrapyItem()\nmax_num = response.xpath(\"descendant::div[@class='main']/div[@class='content']/div[@class='pagenavi']/a[last()-1]/span/text()\").extract_first(default='N/A')\nitem['name'] = response.xpath(\"./*//div[@class='main']/div[1]/h2/text()\").extract_first(default='N/A')\nitem['url'] = response....
<|body_start_0|> item = MzituScrapyItem() max_num = response.xpath("descendant::div[@class='main']/div[@class='content']/div[@class='pagenavi']/a[last()-1]/span/text()").extract_first(default='N/A') item['name'] = response.xpath("./*//div[@class='main']/div[1]/h2/text()").extract_first(default='...
Spider
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Spider: def parse_item(self, response): """:param response: 下载器返回的response :return:""" <|body_0|> def img_url(self, response): """取出图片URL 并添加进self.img_urls列表中 :param response: :param img_url 为每张图片的真实地址""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_10k_train_006495
1,685
permissive
[ { "docstring": ":param response: 下载器返回的response :return:", "name": "parse_item", "signature": "def parse_item(self, response)" }, { "docstring": "取出图片URL 并添加进self.img_urls列表中 :param response: :param img_url 为每张图片的真实地址", "name": "img_url", "signature": "def img_url(self, response)" } ]
2
stack_v2_sparse_classes_30k_train_004968
Implement the Python class `Spider` described below. Class description: Implement the Spider class. Method signatures and docstrings: - def parse_item(self, response): :param response: 下载器返回的response :return: - def img_url(self, response): 取出图片URL 并添加进self.img_urls列表中 :param response: :param img_url 为每张图片的真实地址
Implement the Python class `Spider` described below. Class description: Implement the Spider class. Method signatures and docstrings: - def parse_item(self, response): :param response: 下载器返回的response :return: - def img_url(self, response): 取出图片URL 并添加进self.img_urls列表中 :param response: :param img_url 为每张图片的真实地址 <|ske...
345e34fff7386d91acbb03a01fd4127c5dfed037
<|skeleton|> class Spider: def parse_item(self, response): """:param response: 下载器返回的response :return:""" <|body_0|> def img_url(self, response): """取出图片URL 并添加进self.img_urls列表中 :param response: :param img_url 为每张图片的真实地址""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Spider: def parse_item(self, response): """:param response: 下载器返回的response :return:""" item = MzituScrapyItem() max_num = response.xpath("descendant::div[@class='main']/div[@class='content']/div[@class='pagenavi']/a[last()-1]/span/text()").extract_first(default='N/A') item['nam...
the_stack_v2_python_sparse
projects/scrapy_mzitu_webset/mzitu_scrapy/spiders/spider.py
ice-melt/python_code_manager
train
0
42bdf7c2c612f01d328701cac9604be820d4a039
[ "super(MainApplication, self).__init__()\nself.ui = sff.SimilarFilesUIMainWindow()\nself.ui.setupUi(self)\nself.ui.search_button.clicked.connect(self.search_pressed)\nself.ui.tree.setHeaderLabels([''])", "self.ui.tree.clear()\npath = self.ui.path_panel.displayText()\ntry:\n file_chains = similar_files_chains(p...
<|body_start_0|> super(MainApplication, self).__init__() self.ui = sff.SimilarFilesUIMainWindow() self.ui.setupUi(self) self.ui.search_button.clicked.connect(self.search_pressed) self.ui.tree.setHeaderLabels(['']) <|end_body_0|> <|body_start_1|> self.ui.tree.clear() ...
Instances of this class will be similar files finder applications.
MainApplication
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MainApplication: """Instances of this class will be similar files finder applications.""" def __init__(self): """Constructor of class MainApplication.""" <|body_0|> def search_pressed(self): """This method is called when the button 'search' is pressed. It searche...
stack_v2_sparse_classes_10k_train_006496
2,033
no_license
[ { "docstring": "Constructor of class MainApplication.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "This method is called when the button 'search' is pressed. It searches for the similar files chains in the directory from the ui.path_panel and displays them in the ui...
2
stack_v2_sparse_classes_30k_train_002468
Implement the Python class `MainApplication` described below. Class description: Instances of this class will be similar files finder applications. Method signatures and docstrings: - def __init__(self): Constructor of class MainApplication. - def search_pressed(self): This method is called when the button 'search' i...
Implement the Python class `MainApplication` described below. Class description: Instances of this class will be similar files finder applications. Method signatures and docstrings: - def __init__(self): Constructor of class MainApplication. - def search_pressed(self): This method is called when the button 'search' i...
023307a9b7f7f8dbb1589e222e794e128f1f365b
<|skeleton|> class MainApplication: """Instances of this class will be similar files finder applications.""" def __init__(self): """Constructor of class MainApplication.""" <|body_0|> def search_pressed(self): """This method is called when the button 'search' is pressed. It searche...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MainApplication: """Instances of this class will be similar files finder applications.""" def __init__(self): """Constructor of class MainApplication.""" super(MainApplication, self).__init__() self.ui = sff.SimilarFilesUIMainWindow() self.ui.setupUi(self) self.ui....
the_stack_v2_python_sparse
supertool/src/supertool/sff_app.py
Goopard/Study-2
train
0
b691324c0b744ef61293ed58666d12ae927dc5d2
[ "if not take_key_as_arg:\n self.missing_value_creator = lambda k: missing_value_creator()\nelse:\n self.missing_value_creator = missing_value_creator", "value = self.missing_value_creator(k)\nself[k] = value\nreturn value" ]
<|body_start_0|> if not take_key_as_arg: self.missing_value_creator = lambda k: missing_value_creator() else: self.missing_value_creator = missing_value_creator <|end_body_0|> <|body_start_1|> value = self.missing_value_creator(k) self[k] = value return v...
A dictionary where missing values are created by an __init__ time supplied function.
DictOf
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DictOf: """A dictionary where missing values are created by an __init__ time supplied function.""" def __init__(self, missing_value_creator, take_key_as_arg=False): """@arg missing_value_creator: Function to create missing values in the dictionary""" <|body_0|> def __mis...
stack_v2_sparse_classes_10k_train_006497
3,293
permissive
[ { "docstring": "@arg missing_value_creator: Function to create missing values in the dictionary", "name": "__init__", "signature": "def __init__(self, missing_value_creator, take_key_as_arg=False)" }, { "docstring": "Called when there is no value for a given key, k.", "name": "__missing__", ...
2
stack_v2_sparse_classes_30k_train_005618
Implement the Python class `DictOf` described below. Class description: A dictionary where missing values are created by an __init__ time supplied function. Method signatures and docstrings: - def __init__(self, missing_value_creator, take_key_as_arg=False): @arg missing_value_creator: Function to create missing valu...
Implement the Python class `DictOf` described below. Class description: A dictionary where missing values are created by an __init__ time supplied function. Method signatures and docstrings: - def __init__(self, missing_value_creator, take_key_as_arg=False): @arg missing_value_creator: Function to create missing valu...
02db81f3e7c87c9497c527d3dc4ea5e3592a58cb
<|skeleton|> class DictOf: """A dictionary where missing values are created by an __init__ time supplied function.""" def __init__(self, missing_value_creator, take_key_as_arg=False): """@arg missing_value_creator: Function to create missing values in the dictionary""" <|body_0|> def __mis...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DictOf: """A dictionary where missing values are created by an __init__ time supplied function.""" def __init__(self, missing_value_creator, take_key_as_arg=False): """@arg missing_value_creator: Function to create missing values in the dictionary""" if not take_key_as_arg: se...
the_stack_v2_python_sparse
python/cookbook/dicts.py
JohnReid/Cookbook
train
1
139a67be94703b5979e587a828b8ce862535e6a2
[ "if scipy.__version__ == '0.14.0':\n return self._fftconvolve_14(in1, in2, int2_fft, mode)\nelse:\n return self._fftconvolve_18(in1, in2, int2_fft, mode)", "in1 = signaltools.asarray(in1)\nin2 = signaltools.asarray(in2)\nif in1.ndim == in2.ndim == 0:\n return in1 * in2\nelif not in1.ndim == in2.ndim:\n ...
<|body_start_0|> if scipy.__version__ == '0.14.0': return self._fftconvolve_14(in1, in2, int2_fft, mode) else: return self._fftconvolve_18(in1, in2, int2_fft, mode) <|end_body_0|> <|body_start_1|> in1 = signaltools.asarray(in1) in2 = signaltools.asarray(in2) ...
fft convolution routines optimized for different scipy versions
FFTConvolve
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FFTConvolve: """fft convolution routines optimized for different scipy versions""" def fftconvolve(self, in1, in2, int2_fft, mode='same'): """:param in1: :param in2: :param int2_fft: :param mode: :return:""" <|body_0|> def _fftconvolve_18(self, in1, in2, int2_fft, mode='...
stack_v2_sparse_classes_10k_train_006498
5,437
permissive
[ { "docstring": ":param in1: :param in2: :param int2_fft: :param mode: :return:", "name": "fftconvolve", "signature": "def fftconvolve(self, in1, in2, int2_fft, mode='same')" }, { "docstring": "scipy routine scipy.signal.fftconvolve with kernel already fourier transformed", "name": "_fftconvo...
6
stack_v2_sparse_classes_30k_train_006446
Implement the Python class `FFTConvolve` described below. Class description: fft convolution routines optimized for different scipy versions Method signatures and docstrings: - def fftconvolve(self, in1, in2, int2_fft, mode='same'): :param in1: :param in2: :param int2_fft: :param mode: :return: - def _fftconvolve_18(...
Implement the Python class `FFTConvolve` described below. Class description: fft convolution routines optimized for different scipy versions Method signatures and docstrings: - def fftconvolve(self, in1, in2, int2_fft, mode='same'): :param in1: :param in2: :param int2_fft: :param mode: :return: - def _fftconvolve_18(...
d2223705bc44d07575a5e93291375ab8e69ebfa8
<|skeleton|> class FFTConvolve: """fft convolution routines optimized for different scipy versions""" def fftconvolve(self, in1, in2, int2_fft, mode='same'): """:param in1: :param in2: :param int2_fft: :param mode: :return:""" <|body_0|> def _fftconvolve_18(self, in1, in2, int2_fft, mode='...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FFTConvolve: """fft convolution routines optimized for different scipy versions""" def fftconvolve(self, in1, in2, int2_fft, mode='same'): """:param in1: :param in2: :param int2_fft: :param mode: :return:""" if scipy.__version__ == '0.14.0': return self._fftconvolve_14(in1, in...
the_stack_v2_python_sparse
astrofunc/fft_convolve.py
sibirrer/astrofunc
train
0
24c0eca60e4b90b60e8991bbd27f5d587f97dfc2
[ "pc = DotDict()\nf2jd = copy.deepcopy(cannonical_json_dump)\npc.upload_file_minidump_flash2 = DotDict()\npc.upload_file_minidump_flash2.json_dump = f2jd\npc.upload_file_minidump_flash2.json_dump['threads'][0]['frames'][2]['function'] = 'NtAlpcSendWaitReceivePort'\nfake_processor = create_basic_fake_processor()\nrc ...
<|body_start_0|> pc = DotDict() f2jd = copy.deepcopy(cannonical_json_dump) pc.upload_file_minidump_flash2 = DotDict() pc.upload_file_minidump_flash2.json_dump = f2jd pc.upload_file_minidump_flash2.json_dump['threads'][0]['frames'][2]['function'] = 'NtAlpcSendWaitReceivePort' ...
TestSendWaitReceivePort
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestSendWaitReceivePort: def test_action_case_1(self): """success - target found in top 5 frames of stack""" <|body_0|> def test_action_case_2(self): """failure - target not found in top 5 frames of stack""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_10k_train_006499
27,276
no_license
[ { "docstring": "success - target found in top 5 frames of stack", "name": "test_action_case_1", "signature": "def test_action_case_1(self)" }, { "docstring": "failure - target not found in top 5 frames of stack", "name": "test_action_case_2", "signature": "def test_action_case_2(self)" ...
2
stack_v2_sparse_classes_30k_train_002374
Implement the Python class `TestSendWaitReceivePort` described below. Class description: Implement the TestSendWaitReceivePort class. Method signatures and docstrings: - def test_action_case_1(self): success - target found in top 5 frames of stack - def test_action_case_2(self): failure - target not found in top 5 fr...
Implement the Python class `TestSendWaitReceivePort` described below. Class description: Implement the TestSendWaitReceivePort class. Method signatures and docstrings: - def test_action_case_1(self): success - target found in top 5 frames of stack - def test_action_case_2(self): failure - target not found in top 5 fr...
9c9b7701d7ddf9f3cbba1a4d0aa65758e8b49528
<|skeleton|> class TestSendWaitReceivePort: def test_action_case_1(self): """success - target found in top 5 frames of stack""" <|body_0|> def test_action_case_2(self): """failure - target not found in top 5 frames of stack""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestSendWaitReceivePort: def test_action_case_1(self): """success - target found in top 5 frames of stack""" pc = DotDict() f2jd = copy.deepcopy(cannonical_json_dump) pc.upload_file_minidump_flash2 = DotDict() pc.upload_file_minidump_flash2.json_dump = f2jd pc.u...
the_stack_v2_python_sparse
socorro/unittest/processor/test_skunk_classifiers.py
v1ka5/socorro
train
0