blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
7.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
378
8.64k
id
stringlengths
44
44
length_bytes
int64
505
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.88k
prompted_full_text
stringlengths
565
12.5k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
5.05k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
snapshot_total_rows
int64
75.8k
75.8k
solution
stringlengths
242
8.3k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
ea91e84824249c3a79c9289202c100aa87b2880d
[ "twython.TwythonStreamer.__init__(self, app_key, app_secret, oauth_token, oauth_token_secret)\nself.response_queue = response_queue\nself.db_queue = db_queue\nself.filter_list = filter_list\nself.message_received = False\nreturn", "message = ''\nuser_name = ''\nscreen_name = ''\nprint(data)\nif 'text' in data:\n ...
<|body_start_0|> twython.TwythonStreamer.__init__(self, app_key, app_secret, oauth_token, oauth_token_secret) self.response_queue = response_queue self.db_queue = db_queue self.filter_list = filter_list self.message_received = False return <|end_body_0|> <|body_start_1|>...
This class is an extension of the twython.TwythonStreamer. The on_success method is called when we get a message from our list of commands and we can then process it.
TwitterStreamer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TwitterStreamer: """This class is an extension of the twython.TwythonStreamer. The on_success method is called when we get a message from our list of commands and we can then process it.""" def __init__(self, app_key=None, app_secret=None, oauth_token=None, oauth_token_secret=None, response_...
stack_v2_sparse_classes_75kplus_train_067400
4,693
no_license
[ { "docstring": "Create our instance of the TwythonStreamer", "name": "__init__", "signature": "def __init__(self, app_key=None, app_secret=None, oauth_token=None, oauth_token_secret=None, response_queue=None, filter_list=None, db_queue=None)" }, { "docstring": "Come here when we receive a tweet ...
2
stack_v2_sparse_classes_30k_train_004514
Implement the Python class `TwitterStreamer` described below. Class description: This class is an extension of the twython.TwythonStreamer. The on_success method is called when we get a message from our list of commands and we can then process it. Method signatures and docstrings: - def __init__(self, app_key=None, a...
Implement the Python class `TwitterStreamer` described below. Class description: This class is an extension of the twython.TwythonStreamer. The on_success method is called when we get a message from our list of commands and we can then process it. Method signatures and docstrings: - def __init__(self, app_key=None, a...
7d4a27126f7f2a93f7216b9ea4eed15789599bf3
<|skeleton|> class TwitterStreamer: """This class is an extension of the twython.TwythonStreamer. The on_success method is called when we get a message from our list of commands and we can then process it.""" def __init__(self, app_key=None, app_secret=None, oauth_token=None, oauth_token_secret=None, response_...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TwitterStreamer: """This class is an extension of the twython.TwythonStreamer. The on_success method is called when we get a message from our list of commands and we can then process it.""" def __init__(self, app_key=None, app_secret=None, oauth_token=None, oauth_token_secret=None, response_queue=None, f...
the_stack_v2_python_sparse
python3/RaspberryPi/twitter.py
ptracton/experimental
train
4
e3c91798aacd8fc5db48d4aff2d559f3e1a10766
[ "s = pattern\nt = str.split()\nreturn list(map(s.find, s)) == list(map(t.index, t))", "s = pattern\nt = str.split()\nif len(s) != len(t):\n return False\nelse:\n return len(set(zip(s, t))) == len(set(s)) == len(set(t))" ]
<|body_start_0|> s = pattern t = str.split() return list(map(s.find, s)) == list(map(t.index, t)) <|end_body_0|> <|body_start_1|> s = pattern t = str.split() if len(s) != len(t): return False else: return len(set(zip(s, t))) == len(set(s))...
Solution1
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution1: def wordPattern1(self, pattern, str): """:type pattern: str :type str: str :rtype: bool""" <|body_0|> def wordPattern(self, pattern, str): """:type pattern: str :type str: str :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> s...
stack_v2_sparse_classes_75kplus_train_067401
1,385
no_license
[ { "docstring": ":type pattern: str :type str: str :rtype: bool", "name": "wordPattern1", "signature": "def wordPattern1(self, pattern, str)" }, { "docstring": ":type pattern: str :type str: str :rtype: bool", "name": "wordPattern", "signature": "def wordPattern(self, pattern, str)" } ]
2
stack_v2_sparse_classes_30k_train_028399
Implement the Python class `Solution1` described below. Class description: Implement the Solution1 class. Method signatures and docstrings: - def wordPattern1(self, pattern, str): :type pattern: str :type str: str :rtype: bool - def wordPattern(self, pattern, str): :type pattern: str :type str: str :rtype: bool
Implement the Python class `Solution1` described below. Class description: Implement the Solution1 class. Method signatures and docstrings: - def wordPattern1(self, pattern, str): :type pattern: str :type str: str :rtype: bool - def wordPattern(self, pattern, str): :type pattern: str :type str: str :rtype: bool <|sk...
4a1747b6497305f3821612d9c358a6795b1690da
<|skeleton|> class Solution1: def wordPattern1(self, pattern, str): """:type pattern: str :type str: str :rtype: bool""" <|body_0|> def wordPattern(self, pattern, str): """:type pattern: str :type str: str :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution1: def wordPattern1(self, pattern, str): """:type pattern: str :type str: str :rtype: bool""" s = pattern t = str.split() return list(map(s.find, s)) == list(map(t.index, t)) def wordPattern(self, pattern, str): """:type pattern: str :type str: str :rtype: ...
the_stack_v2_python_sparse
String/q290_word_pattern.py
sevenhe716/LeetCode
train
0
8555721f123b1a72ec96c19a099efaed1920814f
[ "self.nstates = nstates\nself.beta = beta\nself.precision = precision\nself.two_stage = two_stage\nself.burnin = True\nself.time = 0\nself.burnin_length = None\nif zetas is None:\n self.zetas = np.zeros(self.nstates)\nelif len(zetas) != self.nstates:\n raise Exception('The length of the bias/estimate (zetas)...
<|body_start_0|> self.nstates = nstates self.beta = beta self.precision = precision self.two_stage = two_stage self.burnin = True self.time = 0 self.burnin_length = None if zetas is None: self.zetas = np.zeros(self.nstates) elif len(zet...
Implements the update scheme for self adjusted mixture sampling as described by Z. Tan in [1]. Can use either the Rao-Blackwellized or binary update schemes. To function, this class must be paired with a method to perform mixture sampling over states and configurations. [1] Z. Tan, "Optimally adjusted mixture sampling ...
SAMSAdaptor
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SAMSAdaptor: """Implements the update scheme for self adjusted mixture sampling as described by Z. Tan in [1]. Can use either the Rao-Blackwellized or binary update schemes. To function, this class must be paired with a method to perform mixture sampling over states and configurations. [1] Z. Tan...
stack_v2_sparse_classes_75kplus_train_067402
11,523
permissive
[ { "docstring": "Parameters ---------- nstates: int The number of free energies to infer zeta: numpy array The estimate of the free energy and the current state biasing potential target_weights: numpy array vector of the state probabilities that the sampler should converge to. two_stage: bool whether to perform ...
3
stack_v2_sparse_classes_30k_train_023322
Implement the Python class `SAMSAdaptor` described below. Class description: Implements the update scheme for self adjusted mixture sampling as described by Z. Tan in [1]. Can use either the Rao-Blackwellized or binary update schemes. To function, this class must be paired with a method to perform mixture sampling ove...
Implement the Python class `SAMSAdaptor` described below. Class description: Implements the update scheme for self adjusted mixture sampling as described by Z. Tan in [1]. Can use either the Rao-Blackwellized or binary update schemes. To function, this class must be paired with a method to perform mixture sampling ove...
d30804beb158960a62f94182c694df6dd9130fb8
<|skeleton|> class SAMSAdaptor: """Implements the update scheme for self adjusted mixture sampling as described by Z. Tan in [1]. Can use either the Rao-Blackwellized or binary update schemes. To function, this class must be paired with a method to perform mixture sampling over states and configurations. [1] Z. Tan...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SAMSAdaptor: """Implements the update scheme for self adjusted mixture sampling as described by Z. Tan in [1]. Can use either the Rao-Blackwellized or binary update schemes. To function, this class must be paired with a method to perform mixture sampling over states and configurations. [1] Z. Tan, "Optimally ...
the_stack_v2_python_sparse
saltswap/sams_adapter.py
Byun-jinyoung/saltswap
train
0
76f32816b81a2645b48c5f143d13198f86ec11e7
[ "try:\n return float(value)\nexcept ValueError:\n raise ValueError('Attempted to set value for an %s field which is not compatible: %s' % (self.typeName(), repr(value)))", "if isinstance(value, float):\n return 1\nreturn 0" ]
<|body_start_0|> try: return float(value) except ValueError: raise ValueError('Attempted to set value for an %s field which is not compatible: %s' % (self.typeName(), repr(value))) <|end_body_0|> <|body_start_1|> if isinstance(value, float): return 1 ...
SFFloat field/event type base-class
_SFFloat
[ "GPL-1.0-or-later", "MIT", "LicenseRef-scancode-warranty-disclaimer", "LicenseRef-scancode-other-copyleft", "LGPL-2.1-or-later", "GPL-3.0-only", "LGPL-2.0-or-later", "GPL-3.0-or-later" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _SFFloat: """SFFloat field/event type base-class""" def coerce(self, value): """Coerce the given value to our type Allowable types: any object with true/false protocol""" <|body_0|> def check(self, value): """Check that value is of precisely the expected data typ...
stack_v2_sparse_classes_75kplus_train_067403
34,853
permissive
[ { "docstring": "Coerce the given value to our type Allowable types: any object with true/false protocol", "name": "coerce", "signature": "def coerce(self, value)" }, { "docstring": "Check that value is of precisely the expected data type", "name": "check", "signature": "def check(self, v...
2
stack_v2_sparse_classes_30k_train_046935
Implement the Python class `_SFFloat` described below. Class description: SFFloat field/event type base-class Method signatures and docstrings: - def coerce(self, value): Coerce the given value to our type Allowable types: any object with true/false protocol - def check(self, value): Check that value is of precisely ...
Implement the Python class `_SFFloat` described below. Class description: SFFloat field/event type base-class Method signatures and docstrings: - def coerce(self, value): Coerce the given value to our type Allowable types: any object with true/false protocol - def check(self, value): Check that value is of precisely ...
7f600ad153270feff12aa7aa86d7ed0a49ebc71c
<|skeleton|> class _SFFloat: """SFFloat field/event type base-class""" def coerce(self, value): """Coerce the given value to our type Allowable types: any object with true/false protocol""" <|body_0|> def check(self, value): """Check that value is of precisely the expected data typ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class _SFFloat: """SFFloat field/event type base-class""" def coerce(self, value): """Coerce the given value to our type Allowable types: any object with true/false protocol""" try: return float(value) except ValueError: raise ValueError('Attempted to set value f...
the_stack_v2_python_sparse
pythonAnimations/pyOpenGLChess/engineDirectory/oglc-env/lib/python2.7/site-packages/vrml/fieldtypes.py
alexus37/AugmentedRealityChess
train
1
74605ab539252f68c06bc37e7f59ff8c898113a1
[ "test_keys = ['o.c.test.Test', 'o.c.testing.Test', 'o.c.test.Wrong']\nvalid_keys = print_dependencies_helper.get_valid_keys_matching_input(test_keys, 'test')\nself.assertEqual(valid_keys, sorted(['o.c.test.Test', 'o.c.testing.Test']))", "test_keys = ['o.c.test.Test', 'o.c.testing.Test', 'o.c.test.Wrong']\nvalid_k...
<|body_start_0|> test_keys = ['o.c.test.Test', 'o.c.testing.Test', 'o.c.test.Wrong'] valid_keys = print_dependencies_helper.get_valid_keys_matching_input(test_keys, 'test') self.assertEqual(valid_keys, sorted(['o.c.test.Test', 'o.c.testing.Test'])) <|end_body_0|> <|body_start_1|> test_k...
Unit tests for the helper functions in the module.
TestHelperFunctions
[ "Zlib", "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference", "LGPL-2.1-only", "LGPL-2.0-or-later", "APSL-2.0", "MIT", "Apache-2.0", "LGPL-2.0-only", "LicenseRef-scancode-unknown" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestHelperFunctions: """Unit tests for the helper functions in the module.""" def test_get_valid_keys_matching_input(self): """Tests getting all valid keys for the given input.""" <|body_0|> def test_get_valid_keys_matching_input_no_match(self): """Tests getting ...
stack_v2_sparse_classes_75kplus_train_067404
1,183
permissive
[ { "docstring": "Tests getting all valid keys for the given input.", "name": "test_get_valid_keys_matching_input", "signature": "def test_get_valid_keys_matching_input(self)" }, { "docstring": "Tests getting all valid keys when there is no matching key.", "name": "test_get_valid_keys_matching...
2
stack_v2_sparse_classes_30k_val_002993
Implement the Python class `TestHelperFunctions` described below. Class description: Unit tests for the helper functions in the module. Method signatures and docstrings: - def test_get_valid_keys_matching_input(self): Tests getting all valid keys for the given input. - def test_get_valid_keys_matching_input_no_match(...
Implement the Python class `TestHelperFunctions` described below. Class description: Unit tests for the helper functions in the module. Method signatures and docstrings: - def test_get_valid_keys_matching_input(self): Tests getting all valid keys for the given input. - def test_get_valid_keys_matching_input_no_match(...
64bee65c921db7e78e25d08f1e98da2668b57be5
<|skeleton|> class TestHelperFunctions: """Unit tests for the helper functions in the module.""" def test_get_valid_keys_matching_input(self): """Tests getting all valid keys for the given input.""" <|body_0|> def test_get_valid_keys_matching_input_no_match(self): """Tests getting ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestHelperFunctions: """Unit tests for the helper functions in the module.""" def test_get_valid_keys_matching_input(self): """Tests getting all valid keys for the given input.""" test_keys = ['o.c.test.Test', 'o.c.testing.Test', 'o.c.test.Wrong'] valid_keys = print_dependencies_h...
the_stack_v2_python_sparse
tools/android/dependency_analysis/print_dependencies_helper_unittest.py
otcshare/chromium-src
train
18
65faf6d1b9d2b7c2c348ad115c20fc840e0dcd4c
[ "if isinstance(key, int):\n return ESPTransformSuite(key)\nif key not in ESPTransformSuite._member_map_:\n return extend_enum(ESPTransformSuite, key, default)\nreturn ESPTransformSuite[key]", "if not (isinstance(value, int) and 0 <= value <= 65535):\n raise ValueError('%r is not a valid %s' % (value, cls...
<|body_start_0|> if isinstance(key, int): return ESPTransformSuite(key) if key not in ESPTransformSuite._member_map_: return extend_enum(ESPTransformSuite, key, default) return ESPTransformSuite[key] <|end_body_0|> <|body_start_1|> if not (isinstance(value, int) ...
[ESPTransformSuite] ESP Transform Suite IDs
ESPTransformSuite
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ESPTransformSuite: """[ESPTransformSuite] ESP Transform Suite IDs""" def get(key: 'int | str', default: 'int'=-1) -> 'ESPTransformSuite': """Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:""" <|body_0|>...
stack_v2_sparse_classes_75kplus_train_067405
2,727
permissive
[ { "docstring": "Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:", "name": "get", "signature": "def get(key: 'int | str', default: 'int'=-1) -> 'ESPTransformSuite'" }, { "docstring": "Lookup function used when value is not ...
2
stack_v2_sparse_classes_30k_train_020119
Implement the Python class `ESPTransformSuite` described below. Class description: [ESPTransformSuite] ESP Transform Suite IDs Method signatures and docstrings: - def get(key: 'int | str', default: 'int'=-1) -> 'ESPTransformSuite': Backport support for original codes. Args: key: Key to get enum item. default: Default...
Implement the Python class `ESPTransformSuite` described below. Class description: [ESPTransformSuite] ESP Transform Suite IDs Method signatures and docstrings: - def get(key: 'int | str', default: 'int'=-1) -> 'ESPTransformSuite': Backport support for original codes. Args: key: Key to get enum item. default: Default...
a6fe49ec58f09e105bec5a00fb66d9b3f22730d9
<|skeleton|> class ESPTransformSuite: """[ESPTransformSuite] ESP Transform Suite IDs""" def get(key: 'int | str', default: 'int'=-1) -> 'ESPTransformSuite': """Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:""" <|body_0|>...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ESPTransformSuite: """[ESPTransformSuite] ESP Transform Suite IDs""" def get(key: 'int | str', default: 'int'=-1) -> 'ESPTransformSuite': """Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:""" if isinstance(key, int)...
the_stack_v2_python_sparse
pcapkit/const/hip/esp_transform_suite.py
JarryShaw/PyPCAPKit
train
204
a4f2fbee19340abc9dcda81ed3aaf0b6a8b7c920
[ "self.FILEPATH = filename\nself.DATETIME_OBJ = None\nself.LANDSAT_SCENE_ID = None\nself.DATA_TYPE = None\nself.ELEVATION_SOURCE = None\nself.OUTPUT_FORMAT = None\nself.SPACECRAFT_ID = None\nself.SENSOR_ID = None\nself.WRS_PATH = None\nself.WRS_ROW = None\nself.NADIR_OFFNADIR = None\nself.TARGET_WRS_PATH = None\nsel...
<|body_start_0|> self.FILEPATH = filename self.DATETIME_OBJ = None self.LANDSAT_SCENE_ID = None self.DATA_TYPE = None self.ELEVATION_SOURCE = None self.OUTPUT_FORMAT = None self.SPACECRAFT_ID = None self.SENSOR_ID = None self.WRS_PATH = None ...
A landsat metadata object. This class builds is attributes from the names of each tag in the xml formatted .MTL files that come with landsat data. So, any tag that appears in the MTL file will populate as an attribute of landsat_metadata. You can access explore these attributes by using, for example .. code-block:: pyt...
landsat_metadata
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class landsat_metadata: """A landsat metadata object. This class builds is attributes from the names of each tag in the xml formatted .MTL files that come with landsat data. So, any tag that appears in the MTL file will populate as an attribute of landsat_metadata. You can access explore these attribut...
stack_v2_sparse_classes_75kplus_train_067406
15,909
permissive
[ { "docstring": "There are several critical attributes that keep a common naming convention between all landsat versions, so they are initialized in this class for good record keeping and reference", "name": "__init__", "signature": "def __init__(self, filename)" }, { "docstring": "reads the cont...
2
stack_v2_sparse_classes_30k_train_035815
Implement the Python class `landsat_metadata` described below. Class description: A landsat metadata object. This class builds is attributes from the names of each tag in the xml formatted .MTL files that come with landsat data. So, any tag that appears in the MTL file will populate as an attribute of landsat_metadata...
Implement the Python class `landsat_metadata` described below. Class description: A landsat metadata object. This class builds is attributes from the names of each tag in the xml formatted .MTL files that come with landsat data. So, any tag that appears in the MTL file will populate as an attribute of landsat_metadata...
052ed7cf313be8418c4429ab31600d778c552de0
<|skeleton|> class landsat_metadata: """A landsat metadata object. This class builds is attributes from the names of each tag in the xml formatted .MTL files that come with landsat data. So, any tag that appears in the MTL file will populate as an attribute of landsat_metadata. You can access explore these attribut...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class landsat_metadata: """A landsat metadata object. This class builds is attributes from the names of each tag in the xml formatted .MTL files that come with landsat data. So, any tag that appears in the MTL file will populate as an attribute of landsat_metadata. You can access explore these attributes by using, ...
the_stack_v2_python_sparse
pydisalexi/landsatTools.py
bucricket/projectMAS
train
3
c4814eb6d8881635d582095fd5a545edccf7c6cf
[ "self.Factors = dict()\nself.Rank = Rank\nself.Dimensions = len(Size)\nself.Size = Size\nself.Type = 'ktensor'\nself.Weights = np.ones(Rank)\nif Minit == 'random':\n np.random.seed(random_state)\n for d in range(self.Dimensions):\n self.Factors[str(d)] = np.random.uniform(low=0, high=1, size=(Size[d], ...
<|body_start_0|> self.Factors = dict() self.Rank = Rank self.Dimensions = len(Size) self.Size = Size self.Type = 'ktensor' self.Weights = np.ones(Rank) if Minit == 'random': np.random.seed(random_state) for d in range(self.Dimensions): ...
K_TENSOR
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class K_TENSOR: def __init__(self, Rank, Size, Minit='random', random_state=42, order=-1): """Initilize the K_TENSOR class. Creates the object representation of M. If initial M is not passed, by default, creates M from uniform distribution. Parameters ---------- Rank : int Tensor rank, i.e. nu...
stack_v2_sparse_classes_75kplus_train_067407
3,574
permissive
[ { "docstring": "Initilize the K_TENSOR class. Creates the object representation of M. If initial M is not passed, by default, creates M from uniform distribution. Parameters ---------- Rank : int Tensor rank, i.e. number of components in M. Size : list Shape of the tensor. Minit : string or dictionary of latent...
2
stack_v2_sparse_classes_30k_train_001469
Implement the Python class `K_TENSOR` described below. Class description: Implement the K_TENSOR class. Method signatures and docstrings: - def __init__(self, Rank, Size, Minit='random', random_state=42, order=-1): Initilize the K_TENSOR class. Creates the object representation of M. If initial M is not passed, by de...
Implement the Python class `K_TENSOR` described below. Class description: Implement the K_TENSOR class. Method signatures and docstrings: - def __init__(self, Rank, Size, Minit='random', random_state=42, order=-1): Initilize the K_TENSOR class. Creates the object representation of M. If initial M is not passed, by de...
bdaed6e820e1ded21836d904f9012fb921e27e6a
<|skeleton|> class K_TENSOR: def __init__(self, Rank, Size, Minit='random', random_state=42, order=-1): """Initilize the K_TENSOR class. Creates the object representation of M. If initial M is not passed, by default, creates M from uniform distribution. Parameters ---------- Rank : int Tensor rank, i.e. nu...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class K_TENSOR: def __init__(self, Rank, Size, Minit='random', random_state=42, order=-1): """Initilize the K_TENSOR class. Creates the object representation of M. If initial M is not passed, by default, creates M from uniform distribution. Parameters ---------- Rank : int Tensor rank, i.e. number of compon...
the_stack_v2_python_sparse
pyCP_APR/numpy_backend/ktensor.py
lanl/pyCP_APR
train
9
e948749d11cba7758f6fd7c2a2b5a1353b94b31d
[ "buffer = []\n\ndef _serialize(node: 'TreeNode') -> None:\n if node is None:\n return\n buffer.append(str(node.val))\n _serialize(node.left)\n _serialize(node.right)\n_serialize(root)\nreturn ','.join(buffer)", "if len(data) == 0:\n return None\nbuffer = list(map(int, data.split(',')))\n\nde...
<|body_start_0|> buffer = [] def _serialize(node: 'TreeNode') -> None: if node is None: return buffer.append(str(node.val)) _serialize(node.left) _serialize(node.right) _serialize(root) return ','.join(buffer) <|end_body_0|...
Codec
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data: str) -> TreeNode: """Decodes your encoded data to tree.""" <|body_1|> <|end_skeleton|> <|body_start_0|> buffer = [] ...
stack_v2_sparse_classes_75kplus_train_067408
1,683
permissive
[ { "docstring": "Encodes a tree to a single string.", "name": "serialize", "signature": "def serialize(self, root: TreeNode) -> str" }, { "docstring": "Decodes your encoded data to tree.", "name": "deserialize", "signature": "def deserialize(self, data: str) -> TreeNode" } ]
2
stack_v2_sparse_classes_30k_train_010169
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string. - def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree.
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string. - def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree. <|skeleton|> class Co...
f35305c618b383a79d05074d891cf0f7acabd88f
<|skeleton|> class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data: str) -> TreeNode: """Decodes your encoded data to tree.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" buffer = [] def _serialize(node: 'TreeNode') -> None: if node is None: return buffer.append(str(node.val)) _serialize(node.left) ...
the_stack_v2_python_sparse
p449m/codec.py
l33tdaima/l33tdaima
train
1
dc92843aa5e5d967194dd284517e082eb1df4776
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn Onenote()", "from .entity import Entity\nfrom .notebook import Notebook\nfrom .onenote_operation import OnenoteOperation\nfrom .onenote_page import OnenotePage\nfrom .onenote_resource import OnenoteResource\nfrom .onenote_section impor...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return Onenote() <|end_body_0|> <|body_start_1|> from .entity import Entity from .notebook import Notebook from .onenote_operation import OnenoteOperation from .onenote_page imp...
Onenote
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Onenote: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Onenote: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: Onenote"""...
stack_v2_sparse_classes_75kplus_train_067409
4,865
permissive
[ { "docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: Onenote", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_value(parse...
3
stack_v2_sparse_classes_30k_train_022079
Implement the Python class `Onenote` described below. Class description: Implement the Onenote class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Onenote: Creates a new instance of the appropriate class based on discriminator value Args: parse_node:...
Implement the Python class `Onenote` described below. Class description: Implement the Onenote class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Onenote: Creates a new instance of the appropriate class based on discriminator value Args: parse_node:...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class Onenote: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Onenote: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: Onenote"""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Onenote: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Onenote: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: Onenote""" if no...
the_stack_v2_python_sparse
msgraph/generated/models/onenote.py
microsoftgraph/msgraph-sdk-python
train
135
4ba4d94433caa510db0cf6f095714a45ac3148fc
[ "self.config = config\nself.executor = executor\nself.cacheobj = cacheobj\nself.pii_salt = self.config.piisalt\nself.nworkers = self.config.workers\nself.ratelimits = self.config.ratelimits", "self.set_header('content-type', 'text/plain; charset=UTF-8')\nif status_code == 400:\n self.write(f'HTTP {status_code}...
<|body_start_0|> self.config = config self.executor = executor self.cacheobj = cacheobj self.pii_salt = self.config.piisalt self.nworkers = self.config.workers self.ratelimits = self.config.ratelimits <|end_body_0|> <|body_start_1|> self.set_header('content-type'...
This handles health check endpoints.
HealthCheckHandler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HealthCheckHandler: """This handles health check endpoints.""" def initialize(self, config, executor, cacheobj): """This sets up some config.""" <|body_0|> def write_error(self, status_code, **kwargs): """This writes the error as a response.""" <|body_1|>...
stack_v2_sparse_classes_75kplus_train_067410
4,066
permissive
[ { "docstring": "This sets up some config.", "name": "initialize", "signature": "def initialize(self, config, executor, cacheobj)" }, { "docstring": "This writes the error as a response.", "name": "write_error", "signature": "def write_error(self, status_code, **kwargs)" }, { "doc...
3
stack_v2_sparse_classes_30k_train_051229
Implement the Python class `HealthCheckHandler` described below. Class description: This handles health check endpoints. Method signatures and docstrings: - def initialize(self, config, executor, cacheobj): This sets up some config. - def write_error(self, status_code, **kwargs): This writes the error as a response. ...
Implement the Python class `HealthCheckHandler` described below. Class description: This handles health check endpoints. Method signatures and docstrings: - def initialize(self, config, executor, cacheobj): This sets up some config. - def write_error(self, status_code, **kwargs): This writes the error as a response. ...
9a038e3734bb8f66115384a1e0917042a4bc4681
<|skeleton|> class HealthCheckHandler: """This handles health check endpoints.""" def initialize(self, config, executor, cacheobj): """This sets up some config.""" <|body_0|> def write_error(self, status_code, **kwargs): """This writes the error as a response.""" <|body_1|>...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class HealthCheckHandler: """This handles health check endpoints.""" def initialize(self, config, executor, cacheobj): """This sets up some config.""" self.config = config self.executor = executor self.cacheobj = cacheobj self.pii_salt = self.config.piisalt self....
the_stack_v2_python_sparse
authnzerver/healthcheck.py
waqasbhatti/authnzerver
train
3
82201f83aae589b4cba33ac2b165d20d7a18f196
[ "self.url = url\nself.make_soup()\nself.get_title()\nself.get_image()\nself.get_ingredients()\nself.get_contents()\nself.get_portions()", "try:\n self.title = self.soup.find(class_='recipe-header__title').text.strip()\nexcept Exception:\n current_app.logger.error(f'Could not extract title: {traceback.format...
<|body_start_0|> self.url = url self.make_soup() self.get_title() self.get_image() self.get_ingredients() self.get_contents() self.get_portions() <|end_body_0|> <|body_start_1|> try: self.title = self.soup.find(class_='recipe-header__title').t...
Parser for recipes at ica.se.
ICAParser
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ICAParser: """Parser for recipes at ica.se.""" def __init__(self, url): """Init the parser.""" <|body_0|> def get_title(self): """Get recipe title.""" <|body_1|> def get_image(self): """Get recipe main image.""" <|body_2|> def ge...
stack_v2_sparse_classes_75kplus_train_067411
3,852
permissive
[ { "docstring": "Init the parser.", "name": "__init__", "signature": "def __init__(self, url)" }, { "docstring": "Get recipe title.", "name": "get_title", "signature": "def get_title(self)" }, { "docstring": "Get recipe main image.", "name": "get_image", "signature": "def ...
6
stack_v2_sparse_classes_30k_train_016272
Implement the Python class `ICAParser` described below. Class description: Parser for recipes at ica.se. Method signatures and docstrings: - def __init__(self, url): Init the parser. - def get_title(self): Get recipe title. - def get_image(self): Get recipe main image. - def get_ingredients(self): Get recipe ingredie...
Implement the Python class `ICAParser` described below. Class description: Parser for recipes at ica.se. Method signatures and docstrings: - def __init__(self, url): Init the parser. - def get_title(self): Get recipe title. - def get_image(self): Get recipe main image. - def get_ingredients(self): Get recipe ingredie...
df3ca44eeefb1c3c3f4c54272f63059be47990bf
<|skeleton|> class ICAParser: """Parser for recipes at ica.se.""" def __init__(self, url): """Init the parser.""" <|body_0|> def get_title(self): """Get recipe title.""" <|body_1|> def get_image(self): """Get recipe main image.""" <|body_2|> def ge...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ICAParser: """Parser for recipes at ica.se.""" def __init__(self, url): """Init the parser.""" self.url = url self.make_soup() self.get_title() self.get_image() self.get_ingredients() self.get_contents() self.get_portions() def get_titl...
the_stack_v2_python_sparse
recapi/html_parsers/icaparser.py
anne17/recapi
train
2
d371e24d9b9ab89426acb2f2c42d96cbfa19a97a
[ "self._flat_layer_suffix = '_flat'\nself.old_layer = old_layer\nself.new_layer = new_layer\nself.diff_attribs = diff_attribs\nself.focus_attribs = focus_attribs\nself.morph_diff_tagger = DiffTagger(layer_a=old_layer + self._flat_layer_suffix, layer_b=new_layer + self._flat_layer_suffix, output_layer='morph_diff_lay...
<|body_start_0|> self._flat_layer_suffix = '_flat' self.old_layer = old_layer self.new_layer = new_layer self.diff_attribs = diff_attribs self.focus_attribs = focus_attribs self.morph_diff_tagger = DiffTagger(layer_a=old_layer + self._flat_layer_suffix, layer_b=new_layer ...
Finds all differences between two (Vabamorf's) morphological analysis layers, and groups differences in modified spans in a way that both matching and mismatching annotations are shown. Note: output grouped differences only cover modified spans; annotations on non-overlapping spans (missing and extra spans) will be lef...
MorphDiffFinder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MorphDiffFinder: """Finds all differences between two (Vabamorf's) morphological analysis layers, and groups differences in modified spans in a way that both matching and mismatching annotations are shown. Note: output grouped differences only cover modified spans; annotations on non-overlapping ...
stack_v2_sparse_classes_75kplus_train_067412
35,998
no_license
[ { "docstring": "Initializes MorphDiffFinder. A specification of comparable layers must be provided. :param old_layer: str Name of the old morph_analysis layer. :param new_layer: str Name of the new morph_analysis layer. :param diff_attribs: list List containing morph_analysis attributes which will be used for f...
2
stack_v2_sparse_classes_30k_train_038554
Implement the Python class `MorphDiffFinder` described below. Class description: Finds all differences between two (Vabamorf's) morphological analysis layers, and groups differences in modified spans in a way that both matching and mismatching annotations are shown. Note: output grouped differences only cover modified...
Implement the Python class `MorphDiffFinder` described below. Class description: Finds all differences between two (Vabamorf's) morphological analysis layers, and groups differences in modified spans in a way that both matching and mismatching annotations are shown. Note: output grouped differences only cover modified...
d0b498a08a938b204fc34c3ea5e3ee3eb57bb25d
<|skeleton|> class MorphDiffFinder: """Finds all differences between two (Vabamorf's) morphological analysis layers, and groups differences in modified spans in a way that both matching and mismatching annotations are shown. Note: output grouped differences only cover modified spans; annotations on non-overlapping ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MorphDiffFinder: """Finds all differences between two (Vabamorf's) morphological analysis layers, and groups differences in modified spans in a way that both matching and mismatching annotations are shown. Note: output grouped differences only cover modified spans; annotations on non-overlapping spans (missin...
the_stack_v2_python_sparse
diff_morph_analysis/morph_eval_utils.py
estnltk/estnltk-workflows
train
0
b6941a852d51fb4a92441a683ecbec3ce34e0ae2
[ "if task_token is None:\n task_token = self.last_tasktoken\nreturn self._swf.respond_activity_task_canceled(task_token, details)", "if task_token is None:\n task_token = self.last_tasktoken\nreturn self._swf.respond_activity_task_completed(task_token, result)", "if task_token is None:\n task_token = se...
<|body_start_0|> if task_token is None: task_token = self.last_tasktoken return self._swf.respond_activity_task_canceled(task_token, details) <|end_body_0|> <|body_start_1|> if task_token is None: task_token = self.last_tasktoken return self._swf.respond_activity...
Base class for SimpleWorkflow activity workers.
ActivityWorker
[ "CC-BY-3.0", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-unknown-license-reference", "ZPL-2.0", "Unlicense", "LGPL-3.0-only", "CC0-1.0", "LicenseRef-scancode-other-permissive", "CNRI-Python", "LicenseRef-scancode-warranty-disclaimer", "GPL-2.0-or-later", "Python-2.0", "GPL-3.0...
stack_v2_sparse_python_classes_v1
<|skeleton|> class ActivityWorker: """Base class for SimpleWorkflow activity workers.""" def cancel(self, task_token=None, details=None): """RespondActivityTaskCanceled.""" <|body_0|> def complete(self, task_token=None, result=None): """RespondActivityTaskCompleted.""" <|bo...
stack_v2_sparse_classes_75kplus_train_067413
13,056
permissive
[ { "docstring": "RespondActivityTaskCanceled.", "name": "cancel", "signature": "def cancel(self, task_token=None, details=None)" }, { "docstring": "RespondActivityTaskCompleted.", "name": "complete", "signature": "def complete(self, task_token=None, result=None)" }, { "docstring":...
5
stack_v2_sparse_classes_30k_train_023230
Implement the Python class `ActivityWorker` described below. Class description: Base class for SimpleWorkflow activity workers. Method signatures and docstrings: - def cancel(self, task_token=None, details=None): RespondActivityTaskCanceled. - def complete(self, task_token=None, result=None): RespondActivityTaskCompl...
Implement the Python class `ActivityWorker` described below. Class description: Base class for SimpleWorkflow activity workers. Method signatures and docstrings: - def cancel(self, task_token=None, details=None): RespondActivityTaskCanceled. - def complete(self, task_token=None, result=None): RespondActivityTaskCompl...
dccb9467675c67b9c3399fc76c5de6d31bfb8255
<|skeleton|> class ActivityWorker: """Base class for SimpleWorkflow activity workers.""" def cancel(self, task_token=None, details=None): """RespondActivityTaskCanceled.""" <|body_0|> def complete(self, task_token=None, result=None): """RespondActivityTaskCompleted.""" <|bo...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ActivityWorker: """Base class for SimpleWorkflow activity workers.""" def cancel(self, task_token=None, details=None): """RespondActivityTaskCanceled.""" if task_token is None: task_token = self.last_tasktoken return self._swf.respond_activity_task_canceled(task_token,...
the_stack_v2_python_sparse
desktop/core/ext-py3/boto-2.49.0/boto/swf/layer2.py
cloudera/hue
train
5,655
c1916aa2ee5846bed8d09c1eb08d4fa6a271ed88
[ "params = Differ.get_valid_params()\nparams.add_param('rel_err', '', 'Relative Error for csv files')\nparams.add_param('zero_threshold', sys.float_info.min * 4.0, 'it represents the value below which a float is ' + 'considered zero (XML comparison only)')\nparams.add_param('ignore_sign', False, 'if true, then only ...
<|body_start_0|> params = Differ.get_valid_params() params.add_param('rel_err', '', 'Relative Error for csv files') params.add_param('zero_threshold', sys.float_info.min * 4.0, 'it represents the value below which a float is ' + 'considered zero (XML comparison only)') params.add_param('...
This is the class to use for handling the parameters block.
UnorderedCSV
[ "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer", "BSD-2-Clause", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UnorderedCSV: """This is the class to use for handling the parameters block.""" def get_valid_params(): """Returns the valid parameters for this class. @ In, None @ Out, params, _ValidParameters, return the parameters.""" <|body_0|> def __init__(self, name, params, testD...
stack_v2_sparse_classes_75kplus_train_067414
14,039
permissive
[ { "docstring": "Returns the valid parameters for this class. @ In, None @ Out, params, _ValidParameters, return the parameters.", "name": "get_valid_params", "signature": "def get_valid_params()" }, { "docstring": "Initializer for the class. Takes a String name and a dictionary params @ In, name...
3
stack_v2_sparse_classes_30k_train_013174
Implement the Python class `UnorderedCSV` described below. Class description: This is the class to use for handling the parameters block. Method signatures and docstrings: - def get_valid_params(): Returns the valid parameters for this class. @ In, None @ Out, params, _ValidParameters, return the parameters. - def __...
Implement the Python class `UnorderedCSV` described below. Class description: This is the class to use for handling the parameters block. Method signatures and docstrings: - def get_valid_params(): Returns the valid parameters for this class. @ In, None @ Out, params, _ValidParameters, return the parameters. - def __...
2b16e7aa3325fe84cab2477947a951414c635381
<|skeleton|> class UnorderedCSV: """This is the class to use for handling the parameters block.""" def get_valid_params(): """Returns the valid parameters for this class. @ In, None @ Out, params, _ValidParameters, return the parameters.""" <|body_0|> def __init__(self, name, params, testD...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UnorderedCSV: """This is the class to use for handling the parameters block.""" def get_valid_params(): """Returns the valid parameters for this class. @ In, None @ Out, params, _ValidParameters, return the parameters.""" params = Differ.get_valid_params() params.add_param('rel_er...
the_stack_v2_python_sparse
scripts/TestHarness/testers/UnorderedCSVDiffer.py
idaholab/raven
train
201
78831c3f27120e24f4da27d75f37b3c6f53641a2
[ "super().__init__()\nassert len(kernel_sizes) == 2\nassert kernel_sizes[0] % 2 == 1, 'Kernel size must be odd number.'\nassert kernel_sizes[1] % 2 == 1, 'Kernel size must be odd number.'\nself.period = period\nself.convs = torch.nn.ModuleList()\nin_chs = in_channels\nout_chs = channels\nfor downsample_scale in down...
<|body_start_0|> super().__init__() assert len(kernel_sizes) == 2 assert kernel_sizes[0] % 2 == 1, 'Kernel size must be odd number.' assert kernel_sizes[1] % 2 == 1, 'Kernel size must be odd number.' self.period = period self.convs = torch.nn.ModuleList() in_chs =...
HiFiGAN period discriminator module.
HiFiGANPeriodDiscriminator
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HiFiGANPeriodDiscriminator: """HiFiGAN period discriminator module.""" def __init__(self, in_channels: int=1, out_channels: int=1, period: int=3, kernel_sizes: List[int]=[5, 3], channels: int=32, downsample_scales: List[int]=[3, 3, 3, 3, 1], max_downsample_channels: int=1024, bias: bool=True...
stack_v2_sparse_classes_75kplus_train_067415
31,567
permissive
[ { "docstring": "Initialize HiFiGANPeriodDiscriminator module. Args: in_channels (int): Number of input channels. out_channels (int): Number of output channels. period (int): Period. kernel_sizes (list): Kernel sizes of initial conv layers and the final conv layer. channels (int): Number of initial channels. dow...
4
stack_v2_sparse_classes_30k_train_002367
Implement the Python class `HiFiGANPeriodDiscriminator` described below. Class description: HiFiGAN period discriminator module. Method signatures and docstrings: - def __init__(self, in_channels: int=1, out_channels: int=1, period: int=3, kernel_sizes: List[int]=[5, 3], channels: int=32, downsample_scales: List[int]...
Implement the Python class `HiFiGANPeriodDiscriminator` described below. Class description: HiFiGAN period discriminator module. Method signatures and docstrings: - def __init__(self, in_channels: int=1, out_channels: int=1, period: int=3, kernel_sizes: List[int]=[5, 3], channels: int=32, downsample_scales: List[int]...
bcd20948db7846ee523443ef9fd78c7a1248c95e
<|skeleton|> class HiFiGANPeriodDiscriminator: """HiFiGAN period discriminator module.""" def __init__(self, in_channels: int=1, out_channels: int=1, period: int=3, kernel_sizes: List[int]=[5, 3], channels: int=32, downsample_scales: List[int]=[3, 3, 3, 3, 1], max_downsample_channels: int=1024, bias: bool=True...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class HiFiGANPeriodDiscriminator: """HiFiGAN period discriminator module.""" def __init__(self, in_channels: int=1, out_channels: int=1, period: int=3, kernel_sizes: List[int]=[5, 3], channels: int=32, downsample_scales: List[int]=[3, 3, 3, 3, 1], max_downsample_channels: int=1024, bias: bool=True, nonlinear_a...
the_stack_v2_python_sparse
espnet2/gan_tts/hifigan/hifigan.py
espnet/espnet
train
7,242
4a71f04531553bea773f9325ef730f66dcb1d6ba
[ "result = []\n\ndef recursive(node, result):\n if node:\n result.append(node.val)\n recursive(node.left, result)\n recursive(node.right, result)\n else:\n result.append('$')\nrecursive(root, result)\nreturn result", "def recursive(nums, length, index):\n if index < length and ...
<|body_start_0|> result = [] def recursive(node, result): if node: result.append(node.val) recursive(node.left, result) recursive(node.right, result) else: result.append('$') recursive(root, result) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def serialize(self, root): """:type root:BinaryTreeNode :rtype:list""" <|body_0|> def deserialize(self, nums): """:type nums:list :rtype:BinaryTreeNode""" <|body_1|> <|end_skeleton|> <|body_start_0|> result = [] def recursive(node...
stack_v2_sparse_classes_75kplus_train_067416
1,091
no_license
[ { "docstring": ":type root:BinaryTreeNode :rtype:list", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": ":type nums:list :rtype:BinaryTreeNode", "name": "deserialize", "signature": "def deserialize(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_022359
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def serialize(self, root): :type root:BinaryTreeNode :rtype:list - def deserialize(self, nums): :type nums:list :rtype:BinaryTreeNode
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def serialize(self, root): :type root:BinaryTreeNode :rtype:list - def deserialize(self, nums): :type nums:list :rtype:BinaryTreeNode <|skeleton|> class Solution: def seria...
42a15943394ae533dcd0d5bbf52e4366ab0756ab
<|skeleton|> class Solution: def serialize(self, root): """:type root:BinaryTreeNode :rtype:list""" <|body_0|> def deserialize(self, nums): """:type nums:list :rtype:BinaryTreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def serialize(self, root): """:type root:BinaryTreeNode :rtype:list""" result = [] def recursive(node, result): if node: result.append(node.val) recursive(node.left, result) recursive(node.right, result) ...
the_stack_v2_python_sparse
test37.py
nihao-hit/jianzhiOffer
train
0
5892b812a1567363c1e04a041948d8a1f91997f9
[ "self.pq = nums\nself.k = k\nheapify(self.pq)\nwhile len(self.pq) > k:\n heappop(self.pq)", "heappush(self.pq, val)\nwhile len(self.pq) > self.k:\n heappop(self.pq)\nreturn self.pq[0]" ]
<|body_start_0|> self.pq = nums self.k = k heapify(self.pq) while len(self.pq) > k: heappop(self.pq) <|end_body_0|> <|body_start_1|> heappush(self.pq, val) while len(self.pq) > self.k: heappop(self.pq) return self.pq[0] <|end_body_1|>
KthLargest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" <|body_0|> def add(self, val): """:type val: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.pq = nums self.k = k heapify(self.pq)...
stack_v2_sparse_classes_75kplus_train_067417
936
no_license
[ { "docstring": ":type k: int :type nums: List[int]", "name": "__init__", "signature": "def __init__(self, k, nums)" }, { "docstring": ":type val: int :rtype: int", "name": "add", "signature": "def add(self, val)" } ]
2
stack_v2_sparse_classes_30k_train_021150
Implement the Python class `KthLargest` described below. Class description: Implement the KthLargest class. Method signatures and docstrings: - def __init__(self, k, nums): :type k: int :type nums: List[int] - def add(self, val): :type val: int :rtype: int
Implement the Python class `KthLargest` described below. Class description: Implement the KthLargest class. Method signatures and docstrings: - def __init__(self, k, nums): :type k: int :type nums: List[int] - def add(self, val): :type val: int :rtype: int <|skeleton|> class KthLargest: def __init__(self, k, nu...
76d767ec001649b2df07aac211ac4b43b415ebdd
<|skeleton|> class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" <|body_0|> def add(self, val): """:type val: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" self.pq = nums self.k = k heapify(self.pq) while len(self.pq) > k: heappop(self.pq) def add(self, val): """:type val: int :rtype: int""" heappush(self.pq, ...
the_stack_v2_python_sparse
leetcode703 Kth Largest Element in a Stream.py
whglamrock/leetcode_series
train
2
dcc927e97f7a5740227eb6f200bf0b80dea44f0f
[ "if path[:5] == 's3://':\n folders = path.split('/')\n self.path = '/'.join(folders[3:])\n self.bucket = folders[2]\n if aws_access_key_id is not None and aws_secret_access_key is not None:\n self.S3 = boto3.client('s3', aws_access_key_id=aws_access_key_id, aws_secret_access_key=aws_secret_access...
<|body_start_0|> if path[:5] == 's3://': folders = path.split('/') self.path = '/'.join(folders[3:]) self.bucket = folders[2] if aws_access_key_id is not None and aws_secret_access_key is not None: self.S3 = boto3.client('s3', aws_access_key_id=aws...
Memoizer for alignments. This stores an alignment using a hash of the accession.version in the alignments. This stores alignments as fasta files named by the hash.
AlignmentMemoizer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AlignmentMemoizer: """Memoizer for alignments. This stores an alignment using a hash of the accession.version in the alignments. This stores alignments as fasta files named by the hash.""" def __init__(self, path, aws_access_key_id=None, aws_secret_access_key=None): """Args: path: pa...
stack_v2_sparse_classes_75kplus_train_067418
22,491
permissive
[ { "docstring": "Args: path: path to directory in which to read and store memoized alignments; if path begins with \"s3://\", stores bucket", "name": "__init__", "signature": "def __init__(self, path, aws_access_key_id=None, aws_secret_access_key=None)" }, { "docstring": "Generate a path or S3 ke...
4
stack_v2_sparse_classes_30k_train_036587
Implement the Python class `AlignmentMemoizer` described below. Class description: Memoizer for alignments. This stores an alignment using a hash of the accession.version in the alignments. This stores alignments as fasta files named by the hash. Method signatures and docstrings: - def __init__(self, path, aws_access...
Implement the Python class `AlignmentMemoizer` described below. Class description: Memoizer for alignments. This stores an alignment using a hash of the accession.version in the alignments. This stores alignments as fasta files named by the hash. Method signatures and docstrings: - def __init__(self, path, aws_access...
b8464e7bb2dda44cb9a24325fef9ce0c93951c5e
<|skeleton|> class AlignmentMemoizer: """Memoizer for alignments. This stores an alignment using a hash of the accession.version in the alignments. This stores alignments as fasta files named by the hash.""" def __init__(self, path, aws_access_key_id=None, aws_secret_access_key=None): """Args: path: pa...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AlignmentMemoizer: """Memoizer for alignments. This stores an alignment using a hash of the accession.version in the alignments. This stores alignments as fasta files named by the hash.""" def __init__(self, path, aws_access_key_id=None, aws_secret_access_key=None): """Args: path: path to directo...
the_stack_v2_python_sparse
adapt/prepare/align.py
broadinstitute/adapt
train
22
406664b5e107f0f1f36995c3aa8d69dbb8a1b201
[ "self._entries = entries\nself._att_reporter = att_reporter\nself._ctc_reporter = ctc_reporter\nself._logger = logger\nself._epoch = epoch", "observation = trainer.observation\nfor k, v in observation.items():\n if self._entries is not None and k not in self._entries:\n continue\n if k is not None an...
<|body_start_0|> self._entries = entries self._att_reporter = att_reporter self._ctc_reporter = ctc_reporter self._logger = logger self._epoch = epoch <|end_body_0|> <|body_start_1|> observation = trainer.observation for k, v in observation.items(): i...
A tensorboard logger extension
TensorboardLogger
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TensorboardLogger: """A tensorboard logger extension""" def __init__(self, logger, att_reporter=None, ctc_reporter=None, entries=None, epoch=0): """Init the extension :param SummaryWriter logger: The logger to use :param PlotAttentionReporter att_reporter: The (optional) PlotAttentio...
stack_v2_sparse_classes_75kplus_train_067419
1,915
permissive
[ { "docstring": "Init the extension :param SummaryWriter logger: The logger to use :param PlotAttentionReporter att_reporter: The (optional) PlotAttentionReporter :param entries: The entries to watch :param int epoch: The starting epoch", "name": "__init__", "signature": "def __init__(self, logger, att_r...
2
null
Implement the Python class `TensorboardLogger` described below. Class description: A tensorboard logger extension Method signatures and docstrings: - def __init__(self, logger, att_reporter=None, ctc_reporter=None, entries=None, epoch=0): Init the extension :param SummaryWriter logger: The logger to use :param PlotAt...
Implement the Python class `TensorboardLogger` described below. Class description: A tensorboard logger extension Method signatures and docstrings: - def __init__(self, logger, att_reporter=None, ctc_reporter=None, entries=None, epoch=0): Init the extension :param SummaryWriter logger: The logger to use :param PlotAt...
bcd20948db7846ee523443ef9fd78c7a1248c95e
<|skeleton|> class TensorboardLogger: """A tensorboard logger extension""" def __init__(self, logger, att_reporter=None, ctc_reporter=None, entries=None, epoch=0): """Init the extension :param SummaryWriter logger: The logger to use :param PlotAttentionReporter att_reporter: The (optional) PlotAttentio...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TensorboardLogger: """A tensorboard logger extension""" def __init__(self, logger, att_reporter=None, ctc_reporter=None, entries=None, epoch=0): """Init the extension :param SummaryWriter logger: The logger to use :param PlotAttentionReporter att_reporter: The (optional) PlotAttentionReporter :pa...
the_stack_v2_python_sparse
espnet/utils/training/tensorboard_logger.py
espnet/espnet
train
7,242
fb58a4fe2b2c1de6e4b8d3aaef538228377031a6
[ "super(OwnedEntityForm, self).__init__(*args, **kwargs)\nif not self.instance.id:\n self.instance.owner = self.user.owner\nself.restrict_fields()\nself.restrict_querysets()\nself.modernize_fields()", "disallowed_fields = self.user.get_disallowed_fields_for(self.instance)\nif self.is_bound:\n for k in disall...
<|body_start_0|> super(OwnedEntityForm, self).__init__(*args, **kwargs) if not self.instance.id: self.instance.owner = self.user.owner self.restrict_fields() self.restrict_querysets() self.modernize_fields() <|end_body_0|> <|body_start_1|> disallowed_fields =...
Base model form for OwnedEntity subclasses, providing automatic disabled fields based on permissions, filters for choice fields based on user account (owner of instances) and HTML5 widgets. IMPORTANT: Only fields belonging to the model are disabled by default, so any extra fields added to the form MUST BE handled by th...
OwnedEntityForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OwnedEntityForm: """Base model form for OwnedEntity subclasses, providing automatic disabled fields based on permissions, filters for choice fields based on user account (owner of instances) and HTML5 widgets. IMPORTANT: Only fields belonging to the model are disabled by default, so any extra fie...
stack_v2_sparse_classes_75kplus_train_067420
2,435
no_license
[ { "docstring": "Set owner to new insstance, restrict fields, querysets and modernize fields.", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Disable or remove fields for data that the user is not allowed to modify.", "name": "restrict_fields", ...
2
stack_v2_sparse_classes_30k_train_018383
Implement the Python class `OwnedEntityForm` described below. Class description: Base model form for OwnedEntity subclasses, providing automatic disabled fields based on permissions, filters for choice fields based on user account (owner of instances) and HTML5 widgets. IMPORTANT: Only fields belonging to the model ar...
Implement the Python class `OwnedEntityForm` described below. Class description: Base model form for OwnedEntity subclasses, providing automatic disabled fields based on permissions, filters for choice fields based on user account (owner of instances) and HTML5 widgets. IMPORTANT: Only fields belonging to the model ar...
4dcf0e6a37e8753ae9d69d663c0c280fcca0a26c
<|skeleton|> class OwnedEntityForm: """Base model form for OwnedEntity subclasses, providing automatic disabled fields based on permissions, filters for choice fields based on user account (owner of instances) and HTML5 widgets. IMPORTANT: Only fields belonging to the model are disabled by default, so any extra fie...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class OwnedEntityForm: """Base model form for OwnedEntity subclasses, providing automatic disabled fields based on permissions, filters for choice fields based on user account (owner of instances) and HTML5 widgets. IMPORTANT: Only fields belonging to the model are disabled by default, so any extra fields added to ...
the_stack_v2_python_sparse
apps/common/forms/base.py
ESCL/pjtracker
train
1
2a5d9ab8b81474b26ddf5d86e0407a644c3a480f
[ "self.n = model.n\nself.probs = probs = dict()\nself.sorted_probs = dict()\npre = [elem for elem in model.counts.keys() if not len(elem) == self.n]\nsuf = [elem for elem in model.counts.keys() if len(elem) == self.n]\nfor elem in suf:\n prfx = elem[:-1]\n sfx = elem[-1]\n if prfx in probs:\n aux = p...
<|body_start_0|> self.n = model.n self.probs = probs = dict() self.sorted_probs = dict() pre = [elem for elem in model.counts.keys() if not len(elem) == self.n] suf = [elem for elem in model.counts.keys() if len(elem) == self.n] for elem in suf: prfx = elem[:-...
n-gram generator.
NGramGenerator
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NGramGenerator: """n-gram generator.""" def __init__(self, model): """model -- n-gram model.""" <|body_0|> def generate_sent(self): """Randomly generate a sentence.""" <|body_1|> def generate_token(self, prev_tokens=None): """Randomly generat...
stack_v2_sparse_classes_75kplus_train_067421
2,740
permissive
[ { "docstring": "model -- n-gram model.", "name": "__init__", "signature": "def __init__(self, model)" }, { "docstring": "Randomly generate a sentence.", "name": "generate_sent", "signature": "def generate_sent(self)" }, { "docstring": "Randomly generate a token, given prev_tokens...
3
stack_v2_sparse_classes_30k_val_002609
Implement the Python class `NGramGenerator` described below. Class description: n-gram generator. Method signatures and docstrings: - def __init__(self, model): model -- n-gram model. - def generate_sent(self): Randomly generate a sentence. - def generate_token(self, prev_tokens=None): Randomly generate a token, give...
Implement the Python class `NGramGenerator` described below. Class description: n-gram generator. Method signatures and docstrings: - def __init__(self, model): model -- n-gram model. - def generate_sent(self): Randomly generate a sentence. - def generate_token(self, prev_tokens=None): Randomly generate a token, give...
cb163f203ae3ce21d210d7751c457b18443e43d0
<|skeleton|> class NGramGenerator: """n-gram generator.""" def __init__(self, model): """model -- n-gram model.""" <|body_0|> def generate_sent(self): """Randomly generate a sentence.""" <|body_1|> def generate_token(self, prev_tokens=None): """Randomly generat...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NGramGenerator: """n-gram generator.""" def __init__(self, model): """model -- n-gram model.""" self.n = model.n self.probs = probs = dict() self.sorted_probs = dict() pre = [elem for elem in model.counts.keys() if not len(elem) == self.n] suf = [elem for e...
the_stack_v2_python_sparse
pagi/utils/ngram/ngram_generator.py
yoelm/pagi
train
0
bd57c8c3a2954ec8ce319dc67205c2a7e27456fb
[ "result = factual_client.resolve(name='primanti brothers', town='pittsburgh', state='PA', latitude=40.45, longitude=-79.98).get_resolved_result()\nself.assertIsNotNone(result)\nself.assertEquals(result['name'], 'Primanti Brothers')\nself.assertEquals(result['postcode'], '15222')\nresult = factual_client.resolve(nam...
<|body_start_0|> result = factual_client.resolve(name='primanti brothers', town='pittsburgh', state='PA', latitude=40.45, longitude=-79.98).get_resolved_result() self.assertIsNotNone(result) self.assertEquals(result['name'], 'Primanti Brothers') self.assertEquals(result['postcode'], '152...
FactualResolveTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FactualResolveTest: def test_successful_request(self): """Tests response from a few Resolve API calls known to work""" <|body_0|> def test_unsuccessful_request(self): """Tests response from a few Resolve API calls known to not work""" <|body_1|> <|end_skelet...
stack_v2_sparse_classes_75kplus_train_067422
18,595
no_license
[ { "docstring": "Tests response from a few Resolve API calls known to work", "name": "test_successful_request", "signature": "def test_successful_request(self)" }, { "docstring": "Tests response from a few Resolve API calls known to not work", "name": "test_unsuccessful_request", "signatu...
2
stack_v2_sparse_classes_30k_train_031757
Implement the Python class `FactualResolveTest` described below. Class description: Implement the FactualResolveTest class. Method signatures and docstrings: - def test_successful_request(self): Tests response from a few Resolve API calls known to work - def test_unsuccessful_request(self): Tests response from a few ...
Implement the Python class `FactualResolveTest` described below. Class description: Implement the FactualResolveTest class. Method signatures and docstrings: - def test_successful_request(self): Tests response from a few Resolve API calls known to work - def test_unsuccessful_request(self): Tests response from a few ...
3ed85e856a026001a1d91d09d31d944c64704824
<|skeleton|> class FactualResolveTest: def test_successful_request(self): """Tests response from a few Resolve API calls known to work""" <|body_0|> def test_unsuccessful_request(self): """Tests response from a few Resolve API calls known to not work""" <|body_1|> <|end_skelet...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FactualResolveTest: def test_successful_request(self): """Tests response from a few Resolve API calls known to work""" result = factual_client.resolve(name='primanti brothers', town='pittsburgh', state='PA', latitude=40.45, longitude=-79.98).get_resolved_result() self.assertIsNotNone(r...
the_stack_v2_python_sparse
scenable/outsourcing/apitools/tests.py
gregarious/betasite
train
0
7c1f032ccb30f943e5d04d80e7adbd5448b38a3c
[ "queryset = NewUser.objects.all()\nserializer = UserSerializer(queryset, many=True)\nreturn Response(serializer.data)", "queryset = NewUser.objects.all().order_by('first_name')\nuser = get_object_or_404(queryset, pk=pk)\nserializer = UserSerializer(user)\nreturn Response(serializer.data)" ]
<|body_start_0|> queryset = NewUser.objects.all() serializer = UserSerializer(queryset, many=True) return Response(serializer.data) <|end_body_0|> <|body_start_1|> queryset = NewUser.objects.all().order_by('first_name') user = get_object_or_404(queryset, pk=pk) serialize...
View que retorna informações de todos os usuários
UserView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserView: """View que retorna informações de todos os usuários""" def list(self, request): """Retorna a lista de usuários""" <|body_0|> def retrieve(self, request, pk=None): """Retorna um usuário em específico""" <|body_1|> <|end_skeleton|> <|body_start...
stack_v2_sparse_classes_75kplus_train_067423
4,671
no_license
[ { "docstring": "Retorna a lista de usuários", "name": "list", "signature": "def list(self, request)" }, { "docstring": "Retorna um usuário em específico", "name": "retrieve", "signature": "def retrieve(self, request, pk=None)" } ]
2
null
Implement the Python class `UserView` described below. Class description: View que retorna informações de todos os usuários Method signatures and docstrings: - def list(self, request): Retorna a lista de usuários - def retrieve(self, request, pk=None): Retorna um usuário em específico
Implement the Python class `UserView` described below. Class description: View que retorna informações de todos os usuários Method signatures and docstrings: - def list(self, request): Retorna a lista de usuários - def retrieve(self, request, pk=None): Retorna um usuário em específico <|skeleton|> class UserView: ...
4ee69ab46a33c326bf41fca5b9fe0d6746ce683d
<|skeleton|> class UserView: """View que retorna informações de todos os usuários""" def list(self, request): """Retorna a lista de usuários""" <|body_0|> def retrieve(self, request, pk=None): """Retorna um usuário em específico""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UserView: """View que retorna informações de todos os usuários""" def list(self, request): """Retorna a lista de usuários""" queryset = NewUser.objects.all() serializer = UserSerializer(queryset, many=True) return Response(serializer.data) def retrieve(self, request, ...
the_stack_v2_python_sparse
manage_users/views.py
gomeslucasm/Backend_canil
train
1
2acd034ef3caa4a68ef922c687606857b7431922
[ "ageAnnees = situation.AgeEnAnnees()\ntraitsPerso = situation.GetDicoTraits()\nreturn self.DeterminerPortraits(situation, ageAnnees, 'Saint Louis', traitsPerso, masculin)", "portraits = []\nportraitCourant = situation.GetValCarac(portrait.Portrait.C_PORTRAIT)\nif nom == heros.Heros.C_NOM:\n if ageAnnees >= 30 ...
<|body_start_0|> ageAnnees = situation.AgeEnAnnees() traitsPerso = situation.GetDicoTraits() return self.DeterminerPortraits(situation, ageAnnees, 'Saint Louis', traitsPerso, masculin) <|end_body_0|> <|body_start_1|> portraits = [] portraitCourant = situation.GetValCarac(portrai...
PortraitSpe
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PortraitSpe: def DeterminerPortraitPersoPrincipal(self, situation, masculin): """retourne l'adresse du portrait à afficher pour le perso courant""" <|body_0|> def DeterminerPortraits(self, situation, ageAnnees, nom, valeursTraits, masculin): """retourne l'adresse du ...
stack_v2_sparse_classes_75kplus_train_067424
1,861
no_license
[ { "docstring": "retourne l'adresse du portrait à afficher pour le perso courant", "name": "DeterminerPortraitPersoPrincipal", "signature": "def DeterminerPortraitPersoPrincipal(self, situation, masculin)" }, { "docstring": "retourne l'adresse du portrait à afficher pour le perso courant valeursT...
2
stack_v2_sparse_classes_30k_train_008943
Implement the Python class `PortraitSpe` described below. Class description: Implement the PortraitSpe class. Method signatures and docstrings: - def DeterminerPortraitPersoPrincipal(self, situation, masculin): retourne l'adresse du portrait à afficher pour le perso courant - def DeterminerPortraits(self, situation, ...
Implement the Python class `PortraitSpe` described below. Class description: Implement the PortraitSpe class. Method signatures and docstrings: - def DeterminerPortraitPersoPrincipal(self, situation, masculin): retourne l'adresse du portrait à afficher pour le perso courant - def DeterminerPortraits(self, situation, ...
ece5e7b6aeac787bd3d5dee2c245496a5a4f4c50
<|skeleton|> class PortraitSpe: def DeterminerPortraitPersoPrincipal(self, situation, masculin): """retourne l'adresse du portrait à afficher pour le perso courant""" <|body_0|> def DeterminerPortraits(self, situation, ageAnnees, nom, valeursTraits, masculin): """retourne l'adresse du ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PortraitSpe: def DeterminerPortraitPersoPrincipal(self, situation, masculin): """retourne l'adresse du portrait à afficher pour le perso courant""" ageAnnees = situation.AgeEnAnnees() traitsPerso = situation.GetDicoTraits() return self.DeterminerPortraits(situation, ageAnnees, ...
the_stack_v2_python_sparse
game/spe/humanite/portrait_saint_louis.py
gabriellevy/destinSaintLouis
train
2
6d277752a793592cc0109d2f19dc55cc28451a60
[ "self.__chip_dataset = chip_dataset\nself.__chip_key_maker = chip_key_maker\nself.__set_root_dir()\nself.__class_to_index = attributes_to_classes(self.__chip_dataset, self.__chip_key_maker)\nprint(self.__class_to_index)", "ROOTMAP = {SetType.ALL.value: 'all', SetType.QUERY.value: 'query', SetType.TEST.value: 'tes...
<|body_start_0|> self.__chip_dataset = chip_dataset self.__chip_key_maker = chip_key_maker self.__set_root_dir() self.__class_to_index = attributes_to_classes(self.__chip_dataset, self.__chip_key_maker) print(self.__class_to_index) <|end_body_0|> <|body_start_1|> ROOTMAP...
KerasDirectory
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KerasDirectory: def __init__(self, chip_dataset, chip_key_maker): """Takes a ChipDataset and hard links the files to custom defined class directories. Args: chip_dataset: A ChipDataset, or other iterable of Chips chip_key_maker: A callable that takes a chip and returns a string represent...
stack_v2_sparse_classes_75kplus_train_067425
12,062
permissive
[ { "docstring": "Takes a ChipDataset and hard links the files to custom defined class directories. Args: chip_dataset: A ChipDataset, or other iterable of Chips chip_key_maker: A callable that takes a chip and returns a string representing the attributes in that chip that you care about. For example, you might w...
4
stack_v2_sparse_classes_30k_test_002664
Implement the Python class `KerasDirectory` described below. Class description: Implement the KerasDirectory class. Method signatures and docstrings: - def __init__(self, chip_dataset, chip_key_maker): Takes a ChipDataset and hard links the files to custom defined class directories. Args: chip_dataset: A ChipDataset,...
Implement the Python class `KerasDirectory` described below. Class description: Implement the KerasDirectory class. Method signatures and docstrings: - def __init__(self, chip_dataset, chip_key_maker): Takes a ChipDataset and hard links the files to custom defined class directories. Args: chip_dataset: A ChipDataset,...
c39b91d7f6b8837d77130598c0778c59b5b82669
<|skeleton|> class KerasDirectory: def __init__(self, chip_dataset, chip_key_maker): """Takes a ChipDataset and hard links the files to custom defined class directories. Args: chip_dataset: A ChipDataset, or other iterable of Chips chip_key_maker: A callable that takes a chip and returns a string represent...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class KerasDirectory: def __init__(self, chip_dataset, chip_key_maker): """Takes a ChipDataset and hard links the files to custom defined class directories. Args: chip_dataset: A ChipDataset, or other iterable of Chips chip_key_maker: A callable that takes a chip and returns a string representing the attrib...
the_stack_v2_python_sparse
pelops/training/utils.py
d-grossman/pelops
train
1
5c55ad70bdf19449d3426a47e5f7804f7bb0883d
[ "self.argument_spec = netapp_utils.na_ontap_host_argument_spec()\nself.argument_spec.update(dict(state=dict(required=False, choices=['present'], default='present'), address_type=dict(required=True, choices=['ipv4', 'ipv6']), is_enabled=dict(required=True, type='bool'), node=dict(required=True, type='str'), dhcp=dic...
<|body_start_0|> self.argument_spec = netapp_utils.na_ontap_host_argument_spec() self.argument_spec.update(dict(state=dict(required=False, choices=['present'], default='present'), address_type=dict(required=True, choices=['ipv4', 'ipv6']), is_enabled=dict(required=True, type='bool'), node=dict(required=...
Modify a Service Processor Network
NetAppOntapServiceProcessorNetwork
[ "MIT", "GPL-3.0-or-later" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NetAppOntapServiceProcessorNetwork: """Modify a Service Processor Network""" def __init__(self): """Initialize the NetAppOntapServiceProcessorNetwork class""" <|body_0|> def get_service_processor_network(self): """Return details about service processor network :p...
stack_v2_sparse_classes_75kplus_train_067426
9,677
permissive
[ { "docstring": "Initialize the NetAppOntapServiceProcessorNetwork class", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Return details about service processor network :param: name : name of the vserver :return: Details about service processor network. None if not found...
4
null
Implement the Python class `NetAppOntapServiceProcessorNetwork` described below. Class description: Modify a Service Processor Network Method signatures and docstrings: - def __init__(self): Initialize the NetAppOntapServiceProcessorNetwork class - def get_service_processor_network(self): Return details about service...
Implement the Python class `NetAppOntapServiceProcessorNetwork` described below. Class description: Modify a Service Processor Network Method signatures and docstrings: - def __init__(self): Initialize the NetAppOntapServiceProcessorNetwork class - def get_service_processor_network(self): Return details about service...
0cd0c003884155ac922e3e301305ac202de7028c
<|skeleton|> class NetAppOntapServiceProcessorNetwork: """Modify a Service Processor Network""" def __init__(self): """Initialize the NetAppOntapServiceProcessorNetwork class""" <|body_0|> def get_service_processor_network(self): """Return details about service processor network :p...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NetAppOntapServiceProcessorNetwork: """Modify a Service Processor Network""" def __init__(self): """Initialize the NetAppOntapServiceProcessorNetwork class""" self.argument_spec = netapp_utils.na_ontap_host_argument_spec() self.argument_spec.update(dict(state=dict(required=False, ...
the_stack_v2_python_sparse
ansible/my_env/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_service_processor_network.py
otus-devops-2019-02/yyashkin_infra
train
0
07ecf50c0038c082a958b4d591516608e9eae747
[ "self.root = TrieNode()\nfor word in word_list:\n if word:\n self.insert(word)", "node = self.root\nfor w in word:\n if w not in node.child:\n node.child[w] = TrieNode()\n node = node.child[w]\nnode.is_end = True" ]
<|body_start_0|> self.root = TrieNode() for word in word_list: if word: self.insert(word) <|end_body_0|> <|body_start_1|> node = self.root for w in word: if w not in node.child: node.child[w] = TrieNode() node = node.ch...
Trie
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Trie: def __init__(self, word_list): """Initialize your data structure here.""" <|body_0|> def insert(self, word: str) -> None: """Inserts a word into the trie.""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.root = TrieNode() for word ...
stack_v2_sparse_classes_75kplus_train_067427
1,352
no_license
[ { "docstring": "Initialize your data structure here.", "name": "__init__", "signature": "def __init__(self, word_list)" }, { "docstring": "Inserts a word into the trie.", "name": "insert", "signature": "def insert(self, word: str) -> None" } ]
2
null
Implement the Python class `Trie` described below. Class description: Implement the Trie class. Method signatures and docstrings: - def __init__(self, word_list): Initialize your data structure here. - def insert(self, word: str) -> None: Inserts a word into the trie.
Implement the Python class `Trie` described below. Class description: Implement the Trie class. Method signatures and docstrings: - def __init__(self, word_list): Initialize your data structure here. - def insert(self, word: str) -> None: Inserts a word into the trie. <|skeleton|> class Trie: def __init__(self,...
ffc5606817a666aa6241cfab27364326f5c066ff
<|skeleton|> class Trie: def __init__(self, word_list): """Initialize your data structure here.""" <|body_0|> def insert(self, word: str) -> None: """Inserts a word into the trie.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Trie: def __init__(self, word_list): """Initialize your data structure here.""" self.root = TrieNode() for word in word_list: if word: self.insert(word) def insert(self, word: str) -> None: """Inserts a word into the trie.""" node = self...
the_stack_v2_python_sparse
Code/CodeRecords/2776/8246/306416.py
AdamZhouSE/pythonHomework
train
2
dcabea67fbb716277c8c157eb8f0cd15b6494927
[ "reader = sitk.ImageSeriesReader()\ndicom_names = reader.GetGDCMSeriesFileNames(self.image_path)\nreader.SetFileNames(dicom_names)\nimage = reader.Execute()\ntest_image = np.swapaxes(sitk.GetArrayFromImage(image), 0, 2).astype('float32')\nreturn test_image", "reader = sitk.ImageSeriesReader()\ndicom_names = reade...
<|body_start_0|> reader = sitk.ImageSeriesReader() dicom_names = reader.GetGDCMSeriesFileNames(self.image_path) reader.SetFileNames(dicom_names) image = reader.Execute() test_image = np.swapaxes(sitk.GetArrayFromImage(image), 0, 2).astype('float32') return test_image <|en...
Class to read DICOM MRI images
DICOMReader
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DICOMReader: """Class to read DICOM MRI images""" def get_np_array(self): """Return the DICOM image as a Numpy array""" <|body_0|> def get_resolution(self): """Return the spacing between the slices""" <|body_1|> def set_itk_image(self): """Se...
stack_v2_sparse_classes_75kplus_train_067428
2,416
no_license
[ { "docstring": "Return the DICOM image as a Numpy array", "name": "get_np_array", "signature": "def get_np_array(self)" }, { "docstring": "Return the spacing between the slices", "name": "get_resolution", "signature": "def get_resolution(self)" }, { "docstring": "Set ITK image ob...
3
stack_v2_sparse_classes_30k_train_042875
Implement the Python class `DICOMReader` described below. Class description: Class to read DICOM MRI images Method signatures and docstrings: - def get_np_array(self): Return the DICOM image as a Numpy array - def get_resolution(self): Return the spacing between the slices - def set_itk_image(self): Set ITK image obj...
Implement the Python class `DICOMReader` described below. Class description: Class to read DICOM MRI images Method signatures and docstrings: - def get_np_array(self): Return the DICOM image as a Numpy array - def get_resolution(self): Return the spacing between the slices - def set_itk_image(self): Set ITK image obj...
4cf3ea43aaf4ab435fb46587e0fa51a5f9c2657e
<|skeleton|> class DICOMReader: """Class to read DICOM MRI images""" def get_np_array(self): """Return the DICOM image as a Numpy array""" <|body_0|> def get_resolution(self): """Return the spacing between the slices""" <|body_1|> def set_itk_image(self): """Se...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DICOMReader: """Class to read DICOM MRI images""" def get_np_array(self): """Return the DICOM image as a Numpy array""" reader = sitk.ImageSeriesReader() dicom_names = reader.GetGDCMSeriesFileNames(self.image_path) reader.SetFileNames(dicom_names) image = reader.Ex...
the_stack_v2_python_sparse
home_backup/mask_SegSRGAN/utils/ImageReader.py
sai36/SRGAN
train
0
9ab2e0373d28cc580f231323a9211093dc7f7de4
[ "self.logger = logging.getLogger('app')\nself.logger.debug('instantiated')\nself.cfg = cfg\nself.web_util = web_util\nself.session_manager = session_manager", "user_token = req.context['user']['user']\nif self.web_util.check_csrf(user_token['ses'], csrf):\n self.logger.debug('Ending session %s for user %s', us...
<|body_start_0|> self.logger = logging.getLogger('app') self.logger.debug('instantiated') self.cfg = cfg self.web_util = web_util self.session_manager = session_manager <|end_body_0|> <|body_start_1|> user_token = req.context['user']['user'] if self.web_util.chec...
provides logout functionality
LogoutResource
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LogoutResource: """provides logout functionality""" def __init__(self, session_manager, cfg, web_util): """Initialization function""" <|body_0|> def on_get(self, req, resp, csrf): """Processes Get Request to logout, requires csrf token in url""" <|body_1|...
stack_v2_sparse_classes_75kplus_train_067429
1,318
no_license
[ { "docstring": "Initialization function", "name": "__init__", "signature": "def __init__(self, session_manager, cfg, web_util)" }, { "docstring": "Processes Get Request to logout, requires csrf token in url", "name": "on_get", "signature": "def on_get(self, req, resp, csrf)" } ]
2
stack_v2_sparse_classes_30k_train_017888
Implement the Python class `LogoutResource` described below. Class description: provides logout functionality Method signatures and docstrings: - def __init__(self, session_manager, cfg, web_util): Initialization function - def on_get(self, req, resp, csrf): Processes Get Request to logout, requires csrf token in url
Implement the Python class `LogoutResource` described below. Class description: provides logout functionality Method signatures and docstrings: - def __init__(self, session_manager, cfg, web_util): Initialization function - def on_get(self, req, resp, csrf): Processes Get Request to logout, requires csrf token in url...
3c774731b054c38a273371450a451c951d73b726
<|skeleton|> class LogoutResource: """provides logout functionality""" def __init__(self, session_manager, cfg, web_util): """Initialization function""" <|body_0|> def on_get(self, req, resp, csrf): """Processes Get Request to logout, requires csrf token in url""" <|body_1|...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LogoutResource: """provides logout functionality""" def __init__(self, session_manager, cfg, web_util): """Initialization function""" self.logger = logging.getLogger('app') self.logger.debug('instantiated') self.cfg = cfg self.web_util = web_util self.sessi...
the_stack_v2_python_sparse
genesis/logoutresource.py
wbmartin/exodus-app
train
0
f479d0c043e81307d4dad56f088843eb3c85a051
[ "if not self.server.shutdown_flag:\n raw = self.request[0]\n if raw:\n raw = bytearray(raw)\n self.handle_raw_line(raw)", "try:\n self.request[1].sendto(event.create_response(), self.client_address)\nexcept Exception as exp:\n _LOGGER.error('Exception caught while responding to event: %s...
<|body_start_0|> if not self.server.shutdown_flag: raw = self.request[0] if raw: raw = bytearray(raw) self.handle_raw_line(raw) <|end_body_0|> <|body_start_1|> try: self.request[1].sendto(event.create_response(), self.client_address) ...
Class for UDP Handling.
SIAUDPHandler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SIAUDPHandler: """Class for UDP Handling.""" def handle(self) -> None: """Overwritten method for the RequestHandler.""" <|body_0|> def respond(self, event: SIAEvent) -> None: """Respond to the event.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_067430
2,823
permissive
[ { "docstring": "Overwritten method for the RequestHandler.", "name": "handle", "signature": "def handle(self) -> None" }, { "docstring": "Respond to the event.", "name": "respond", "signature": "def respond(self, event: SIAEvent) -> None" } ]
2
stack_v2_sparse_classes_30k_train_015031
Implement the Python class `SIAUDPHandler` described below. Class description: Class for UDP Handling. Method signatures and docstrings: - def handle(self) -> None: Overwritten method for the RequestHandler. - def respond(self, event: SIAEvent) -> None: Respond to the event.
Implement the Python class `SIAUDPHandler` described below. Class description: Class for UDP Handling. Method signatures and docstrings: - def handle(self) -> None: Overwritten method for the RequestHandler. - def respond(self, event: SIAEvent) -> None: Respond to the event. <|skeleton|> class SIAUDPHandler: """...
c5394b7e2911d154b0aac5600cd57878ec7094ac
<|skeleton|> class SIAUDPHandler: """Class for UDP Handling.""" def handle(self) -> None: """Overwritten method for the RequestHandler.""" <|body_0|> def respond(self, event: SIAEvent) -> None: """Respond to the event.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SIAUDPHandler: """Class for UDP Handling.""" def handle(self) -> None: """Overwritten method for the RequestHandler.""" if not self.server.shutdown_flag: raw = self.request[0] if raw: raw = bytearray(raw) self.handle_raw_line(raw) ...
the_stack_v2_python_sparse
src/pysiaalarm/sync/handler.py
mach0gr/pysiaalarm
train
1
fbf41b4e737bc5ca4f3a10c8adbb0a3e8a84c4ea
[ "new_items = self.__class__()\nfor k, v in self.iteritems():\n new_items[k] = v\nreturn new_items", "sections = []\nfor key in self.iterkeys():\n if self.separator in key:\n sec, _ = key.rsplit(self.separator, 1)\n if sec not in sections:\n sections.append(sec)\nreturn sections", ...
<|body_start_0|> new_items = self.__class__() for k, v in self.iteritems(): new_items[k] = v return new_items <|end_body_0|> <|body_start_1|> sections = [] for key in self.iterkeys(): if self.separator in key: sec, _ = key.rsplit(self.sepa...
A dict subclass with some extra helpers for dealing with app settings. This class extends the standard dictionary interface with some extra helper methods that are handy when dealing with application settings. It expects the keys to be dotted setting names, where each component indicates one section in the settings hei...
SettingsDict
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SettingsDict: """A dict subclass with some extra helpers for dealing with app settings. This class extends the standard dictionary interface with some extra helper methods that are handy when dealing with application settings. It expects the keys to be dotted setting names, where each component i...
stack_v2_sparse_classes_75kplus_train_067431
9,249
permissive
[ { "docstring": "D.copy() -> a shallow copy of D. This overrides the default dict.copy method to ensure that the copy is also an instance of SettingsDict.", "name": "copy", "signature": "def copy(self)" }, { "docstring": "Return a list of sections for this dict", "name": "sections", "sign...
4
null
Implement the Python class `SettingsDict` described below. Class description: A dict subclass with some extra helpers for dealing with app settings. This class extends the standard dictionary interface with some extra helper methods that are handy when dealing with application settings. It expects the keys to be dotte...
Implement the Python class `SettingsDict` described below. Class description: A dict subclass with some extra helpers for dealing with app settings. This class extends the standard dictionary interface with some extra helper methods that are handy when dealing with application settings. It expects the keys to be dotte...
d2f663f11d2b439ede5f0dca77f9d5f552b0fa36
<|skeleton|> class SettingsDict: """A dict subclass with some extra helpers for dealing with app settings. This class extends the standard dictionary interface with some extra helper methods that are handy when dealing with application settings. It expects the keys to be dotted setting names, where each component i...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SettingsDict: """A dict subclass with some extra helpers for dealing with app settings. This class extends the standard dictionary interface with some extra helper methods that are handy when dealing with application settings. It expects the keys to be dotted setting names, where each component indicates one ...
the_stack_v2_python_sparse
vaurien/config.py
searchspring/vaurien
train
0
d208ca4db22c8cf8466a505e4ff0d86271a9748e
[ "BaseDustNode.__init__(self, xml_node)\nself._value = utils.parse_coords(xml_node.text)\nunits = u.deg\nself._columns = [Column(name=col_names[0], unit=units), Column(name=col_names[1], unit=units), Column(name=col_names[2], dtype='S25')]", "base_string = BaseDustNode.__str__(self)\nvalues_str = 'values: ' + str(...
<|body_start_0|> BaseDustNode.__init__(self, xml_node) self._value = utils.parse_coords(xml_node.text) units = u.deg self._columns = [Column(name=col_names[0], unit=units), Column(name=col_names[1], unit=units), Column(name=col_names[2], dtype='S25')] <|end_body_0|> <|body_start_1|> ...
A node that contains RA, Dec coordinates. Outputs three values / columns: RA, Dec and a coordinate system description string.
CoordNode
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CoordNode: """A node that contains RA, Dec coordinates. Outputs three values / columns: RA, Dec and a coordinate system description string.""" def __init__(self, xml_node, col_names): """Parameters ---------- xml_node : `xml.etree.ElementTree` the xml node that provides the raw data ...
stack_v2_sparse_classes_75kplus_train_067432
41,056
permissive
[ { "docstring": "Parameters ---------- xml_node : `xml.etree.ElementTree` the xml node that provides the raw data for this DustNode col_names : str the names of the columns associated with this item", "name": "__init__", "signature": "def __init__(self, xml_node, col_names)" }, { "docstring": "Re...
2
stack_v2_sparse_classes_30k_train_001407
Implement the Python class `CoordNode` described below. Class description: A node that contains RA, Dec coordinates. Outputs three values / columns: RA, Dec and a coordinate system description string. Method signatures and docstrings: - def __init__(self, xml_node, col_names): Parameters ---------- xml_node : `xml.et...
Implement the Python class `CoordNode` described below. Class description: A node that contains RA, Dec coordinates. Outputs three values / columns: RA, Dec and a coordinate system description string. Method signatures and docstrings: - def __init__(self, xml_node, col_names): Parameters ---------- xml_node : `xml.et...
51316d7417d7daf01a8b29d1df99037b9227c2bc
<|skeleton|> class CoordNode: """A node that contains RA, Dec coordinates. Outputs three values / columns: RA, Dec and a coordinate system description string.""" def __init__(self, xml_node, col_names): """Parameters ---------- xml_node : `xml.etree.ElementTree` the xml node that provides the raw data ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CoordNode: """A node that contains RA, Dec coordinates. Outputs three values / columns: RA, Dec and a coordinate system description string.""" def __init__(self, xml_node, col_names): """Parameters ---------- xml_node : `xml.etree.ElementTree` the xml node that provides the raw data for this Dust...
the_stack_v2_python_sparse
astroquery/ipac/irsa/irsa_dust/core.py
astropy/astroquery
train
636
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_75kplus_train_067433
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_train_004951
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_75kplus
data/stack_v2_sparse_classes_30k
75,829
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
35ebaf649bc0b5900856d6582efda4851f59517c
[ "with tempfile.TemporaryDirectory() as tmp_dir:\n test_repo = test_repos.TEST_REPOS[1]\n self.assertTrue(helper.build_image_impl(test_repo.project_name))\n host_src_dir = build_specified_commit.copy_src_from_docker(test_repo.project_name, tmp_dir)\n test_repo_manager = repo_manager.clone_repo_and_get_ma...
<|body_start_0|> with tempfile.TemporaryDirectory() as tmp_dir: test_repo = test_repos.TEST_REPOS[1] self.assertTrue(helper.build_image_impl(test_repo.project_name)) host_src_dir = build_specified_commit.copy_src_from_docker(test_repo.project_name, tmp_dir) test_r...
Tests if an image can be built from different states e.g. a commit.
BuildImageIntegrationTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BuildImageIntegrationTest: """Tests if an image can be built from different states e.g. a commit.""" def test_build_fuzzers_from_commit(self): """Tests if the fuzzers can build at a specified commit. This is done by using a known regression range for a specific test case. The old com...
stack_v2_sparse_classes_75kplus_train_067434
5,754
permissive
[ { "docstring": "Tests if the fuzzers can build at a specified commit. This is done by using a known regression range for a specific test case. The old commit should show the error when its fuzzers run and the new one should not.", "name": "test_build_fuzzers_from_commit", "signature": "def test_build_fu...
3
stack_v2_sparse_classes_30k_train_051992
Implement the Python class `BuildImageIntegrationTest` described below. Class description: Tests if an image can be built from different states e.g. a commit. Method signatures and docstrings: - def test_build_fuzzers_from_commit(self): Tests if the fuzzers can build at a specified commit. This is done by using a kno...
Implement the Python class `BuildImageIntegrationTest` described below. Class description: Tests if an image can be built from different states e.g. a commit. Method signatures and docstrings: - def test_build_fuzzers_from_commit(self): Tests if the fuzzers can build at a specified commit. This is done by using a kno...
f0275421f84b8f80ee767fb9230134ac97cb687b
<|skeleton|> class BuildImageIntegrationTest: """Tests if an image can be built from different states e.g. a commit.""" def test_build_fuzzers_from_commit(self): """Tests if the fuzzers can build at a specified commit. This is done by using a known regression range for a specific test case. The old com...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BuildImageIntegrationTest: """Tests if an image can be built from different states e.g. a commit.""" def test_build_fuzzers_from_commit(self): """Tests if the fuzzers can build at a specified commit. This is done by using a known regression range for a specific test case. The old commit should sh...
the_stack_v2_python_sparse
infra/build_specified_commit_test.py
google/oss-fuzz
train
9,438
3aa50cd82b1ac77df7f38e50c8ac6d3dd0fe65b5
[ "Continuum.__init__(self, *args, **kwargs)\nself.frac = frac\nself.sbin = sbin", "if valid is None:\n valid = np.ones(x.shape, dtype=np.bool)\nbins_x = np.zeros(self.sbin)\nbins_y = np.zeros(self.sbin)\nw1 = 0\nw2 = float(len(x)) / self.sbin\nfor i in range(self.sbin):\n bindata = y[int(w1):int(w2)].copy()\...
<|body_start_0|> Continuum.__init__(self, *args, **kwargs) self.frac = frac self.sbin = sbin <|end_body_0|> <|body_start_1|> if valid is None: valid = np.ones(x.shape, dtype=np.bool) bins_x = np.zeros(self.sbin) bins_y = np.zeros(self.sbin) w1 = 0 ...
Derive continuum as spline to all points that are within a given fraction of largest points in a given number of bins.
MaximumBin
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MaximumBin: """Derive continuum as spline to all points that are within a given fraction of largest points in a given number of bins.""" def __init__(self, frac: float=0.15, sbin: int=100, *args, **kwargs): """Initialize a new MaximumBin continuum. Args: frac: Fraction of largest poi...
stack_v2_sparse_classes_75kplus_train_067435
15,610
permissive
[ { "docstring": "Initialize a new MaximumBin continuum. Args: frac: Fraction of largest points in each bin to use for fitting the continuum. sbin: Number of bins.", "name": "__init__", "signature": "def __init__(self, frac: float=0.15, sbin: int=100, *args, **kwargs)" }, { "docstring": "Calculate...
2
null
Implement the Python class `MaximumBin` described below. Class description: Derive continuum as spline to all points that are within a given fraction of largest points in a given number of bins. Method signatures and docstrings: - def __init__(self, frac: float=0.15, sbin: int=100, *args, **kwargs): Initialize a new ...
Implement the Python class `MaximumBin` described below. Class description: Derive continuum as spline to all points that are within a given fraction of largest points in a given number of bins. Method signatures and docstrings: - def __init__(self, frac: float=0.15, sbin: int=100, *args, **kwargs): Initialize a new ...
648eb1758e3744d9e3d6669edc4a0c4753559f17
<|skeleton|> class MaximumBin: """Derive continuum as spline to all points that are within a given fraction of largest points in a given number of bins.""" def __init__(self, frac: float=0.15, sbin: int=100, *args, **kwargs): """Initialize a new MaximumBin continuum. Args: frac: Fraction of largest poi...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MaximumBin: """Derive continuum as spline to all points that are within a given fraction of largest points in a given number of bins.""" def __init__(self, frac: float=0.15, sbin: int=100, *args, **kwargs): """Initialize a new MaximumBin continuum. Args: frac: Fraction of largest points in each b...
the_stack_v2_python_sparse
spexxy/utils/continuum.py
thusser/spexxy
train
4
1c091674cc144b1908d815eed32fc2210101fac5
[ "if additional_help is not None:\n self._help = additional_help\nelse:\n self._help = ''", "width = 80\nparser = _Parser(description=self._help, formatter_class=argparse.RawTextHelpFormatter)\nsubparsers = parser.add_subparsers(dest='action')\n_Install(subparsers, width=width)\nif len(sys.argv) == 1:\n p...
<|body_start_0|> if additional_help is not None: self._help = additional_help else: self._help = '' <|end_body_0|> <|body_start_1|> width = 80 parser = _Parser(description=self._help, formatter_class=argparse.RawTextHelpFormatter) subparsers = parser.add_...
Class gathers all CLI information.
Parser
[ "GPL-3.0-only" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Parser: """Class gathers all CLI information.""" def __init__(self, additional_help=None): """Intialize the class.""" <|body_0|> def args(self): """Return all the CLI options. Args: None Returns: _args: Namespace() containing all of our CLI arguments as objects -...
stack_v2_sparse_classes_75kplus_train_067436
11,324
permissive
[ { "docstring": "Intialize the class.", "name": "__init__", "signature": "def __init__(self, additional_help=None)" }, { "docstring": "Return all the CLI options. Args: None Returns: _args: Namespace() containing all of our CLI arguments as objects - filename: Path to the configuration file", ...
2
stack_v2_sparse_classes_30k_train_052342
Implement the Python class `Parser` described below. Class description: Class gathers all CLI information. Method signatures and docstrings: - def __init__(self, additional_help=None): Intialize the class. - def args(self): Return all the CLI options. Args: None Returns: _args: Namespace() containing all of our CLI a...
Implement the Python class `Parser` described below. Class description: Class gathers all CLI information. Method signatures and docstrings: - def __init__(self, additional_help=None): Intialize the class. - def args(self): Return all the CLI options. Args: None Returns: _args: Namespace() containing all of our CLI a...
57bd3e82e49d51e3426b13ad53ed8326a735ce29
<|skeleton|> class Parser: """Class gathers all CLI information.""" def __init__(self, additional_help=None): """Intialize the class.""" <|body_0|> def args(self): """Return all the CLI options. Args: None Returns: _args: Namespace() containing all of our CLI arguments as objects -...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Parser: """Class gathers all CLI information.""" def __init__(self, additional_help=None): """Intialize the class.""" if additional_help is not None: self._help = additional_help else: self._help = '' def args(self): """Return all the CLI optio...
the_stack_v2_python_sparse
setup/pattoo_installation.py
palisadoes/pattoo
train
0
187b3b682caf0497131f5fc1d82fe4dfea6621fd
[ "self._check()\nself.calc_derivatives(first=True)\nself.ffd_order = 1\nself.differentiator.calc_gradient()\nself.ffd_order = 0\ninputs = self.get_parameters().keys()\nobjs = self.get_objectives().keys()\nconstraints = list(self.get_eq_constraints().keys() + self.get_ineq_constraints().keys())\nself.dF = zeros((len(...
<|body_start_0|> self._check() self.calc_derivatives(first=True) self.ffd_order = 1 self.differentiator.calc_gradient() self.ffd_order = 0 inputs = self.get_parameters().keys() objs = self.get_objectives().keys() constraints = list(self.get_eq_constraints(...
Driver to calculate the gradient of a workflow, and return it as a driver output. The gradient is calculated from all inputs (Parameters) to all outputs (Objectives and Constraints). SensitivityDriver includes a differentiator slot where the differentiation method can be plugged. Fake finite difference is supported.
SensitivityDriver
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SensitivityDriver: """Driver to calculate the gradient of a workflow, and return it as a driver output. The gradient is calculated from all inputs (Parameters) to all outputs (Objectives and Constraints). SensitivityDriver includes a differentiator slot where the differentiation method can be plu...
stack_v2_sparse_classes_75kplus_train_067437
5,240
no_license
[ { "docstring": "Calculate the gradient of the workflow.", "name": "execute", "signature": "def execute(self)" }, { "docstring": "Make sure we aren't missing inputs or outputs", "name": "_check", "signature": "def _check(self)" } ]
2
stack_v2_sparse_classes_30k_train_045043
Implement the Python class `SensitivityDriver` described below. Class description: Driver to calculate the gradient of a workflow, and return it as a driver output. The gradient is calculated from all inputs (Parameters) to all outputs (Objectives and Constraints). SensitivityDriver includes a differentiator slot wher...
Implement the Python class `SensitivityDriver` described below. Class description: Driver to calculate the gradient of a workflow, and return it as a driver output. The gradient is calculated from all inputs (Parameters) to all outputs (Objectives and Constraints). SensitivityDriver includes a differentiator slot wher...
7b4d9c2804bfd84773bad6cbac37a7175f47104f
<|skeleton|> class SensitivityDriver: """Driver to calculate the gradient of a workflow, and return it as a driver output. The gradient is calculated from all inputs (Parameters) to all outputs (Objectives and Constraints). SensitivityDriver includes a differentiator slot where the differentiation method can be plu...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SensitivityDriver: """Driver to calculate the gradient of a workflow, and return it as a driver output. The gradient is calculated from all inputs (Parameters) to all outputs (Objectives and Constraints). SensitivityDriver includes a differentiator slot where the differentiation method can be plugged. Fake fi...
the_stack_v2_python_sparse
openmdao.lib/src/openmdao/lib/drivers/sensitivity.py
hschilling/OpenMDAO-Framework
train
0
b498195670ccbd3330a0e62d5d2073a56a80bdce
[ "max_date_filter = ' AND o.orderdate <= %(max_date)s' if max_date else ' '\nquery = '\\n SELECT\\n z.countyname,\\n z.countypop,\\n count(o.orderid) as NumofOrders,\\n sum(o.totalprice) as TotalSpending\\n FROM\\n zipco...
<|body_start_0|> max_date_filter = ' AND o.orderdate <= %(max_date)s' if max_date else ' ' query = '\n SELECT\n z.countyname,\n z.countypop,\n count(o.orderid) as NumofOrders,\n sum(o.totalprice) as TotalSpending\n FROM\n ...
Orders
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Orders: def statsByZipcode(self, min_date='1900-1-1', max_date=None, sample_size=100): """For each zipcode, determine the number of orders and the total amount of money has been spent. Args: min_date (string): optional. date. Limits the search result timeframe. max_date (string): optiona...
stack_v2_sparse_classes_75kplus_train_067438
6,046
no_license
[ { "docstring": "For each zipcode, determine the number of orders and the total amount of money has been spent. Args: min_date (string): optional. date. Limits the search result timeframe. max_date (string): optional. date. Limits the search result timeframe. sample_size (int): optional. Percentage of the data t...
2
null
Implement the Python class `Orders` described below. Class description: Implement the Orders class. Method signatures and docstrings: - def statsByZipcode(self, min_date='1900-1-1', max_date=None, sample_size=100): For each zipcode, determine the number of orders and the total amount of money has been spent. Args: mi...
Implement the Python class `Orders` described below. Class description: Implement the Orders class. Method signatures and docstrings: - def statsByZipcode(self, min_date='1900-1-1', max_date=None, sample_size=100): For each zipcode, determine the number of orders and the total amount of money has been spent. Args: mi...
047d8f2c420e69b0cb7f3e2838e1c5e30d738918
<|skeleton|> class Orders: def statsByZipcode(self, min_date='1900-1-1', max_date=None, sample_size=100): """For each zipcode, determine the number of orders and the total amount of money has been spent. Args: min_date (string): optional. date. Limits the search result timeframe. max_date (string): optiona...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Orders: def statsByZipcode(self, min_date='1900-1-1', max_date=None, sample_size=100): """For each zipcode, determine the number of orders and the total amount of money has been spent. Args: min_date (string): optional. date. Limits the search result timeframe. max_date (string): optional. date. Limit...
the_stack_v2_python_sparse
data_exploration/dora/orders.py
j-goldsmith/dse203-group-project
train
0
447a2628a8fd2f102efa973d12b8218c4926567d
[ "zk_client = KazooClient(hosts=','.join(zk_locations), connection_retry=ZK_PERSISTENT_RECONNECTS)\nzk_client.start()\nself.ioloop = io_loop\nself.source = source\nself.start_time = None\nself.status = 'Not started'\nself.finish_time = None\nself.api_methods = api_methods.APIMethods(zk_client)\nself.scheduled_indexe...
<|body_start_0|> zk_client = KazooClient(hosts=','.join(zk_locations), connection_retry=ZK_PERSISTENT_RECONNECTS) zk_client.start() self.ioloop = io_loop self.source = source self.start_time = None self.status = 'Not started' self.finish_time = None self.a...
Importer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Importer: def __init__(self, io_loop, source, zk_locations, max_concurrency): """Args: io_loop: an instance of tornado IOLoop. source: an instance of import Source (e.g.: S3Source). zk_locations: a list - Zookeeper locations. max_concurrency: an int - maximum number of concurrent jobs.""...
stack_v2_sparse_classes_75kplus_train_067439
6,138
permissive
[ { "docstring": "Args: io_loop: an instance of tornado IOLoop. source: an instance of import Source (e.g.: S3Source). zk_locations: a list - Zookeeper locations. max_concurrency: an int - maximum number of concurrent jobs.", "name": "__init__", "signature": "def __init__(self, io_loop, source, zk_locatio...
4
stack_v2_sparse_classes_30k_test_002736
Implement the Python class `Importer` described below. Class description: Implement the Importer class. Method signatures and docstrings: - def __init__(self, io_loop, source, zk_locations, max_concurrency): Args: io_loop: an instance of tornado IOLoop. source: an instance of import Source (e.g.: S3Source). zk_locati...
Implement the Python class `Importer` described below. Class description: Implement the Importer class. Method signatures and docstrings: - def __init__(self, io_loop, source, zk_locations, max_concurrency): Args: io_loop: an instance of tornado IOLoop. source: an instance of import Source (e.g.: S3Source). zk_locati...
be17e5f658d7b42b5aa7eeb7a5ddd4962f3ea82f
<|skeleton|> class Importer: def __init__(self, io_loop, source, zk_locations, max_concurrency): """Args: io_loop: an instance of tornado IOLoop. source: an instance of import Source (e.g.: S3Source). zk_locations: a list - Zookeeper locations. max_concurrency: an int - maximum number of concurrent jobs.""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Importer: def __init__(self, io_loop, source, zk_locations, max_concurrency): """Args: io_loop: an instance of tornado IOLoop. source: an instance of import Source (e.g.: S3Source). zk_locations: a list - Zookeeper locations. max_concurrency: an int - maximum number of concurrent jobs.""" zk_c...
the_stack_v2_python_sparse
SearchService2/appscale/search/backup_restore/restore_to_v2.py
obino/appscale
train
1
7942d5556e07b63ce4e8bf5fc006d31ecfd4ea81
[ "staff_orser_event_qs = StaffOrderEvent.query(**search_info)\nstaff_orser_event_qs = staff_orser_event_qs.order_by('-create_time')\nreturn Splitor(current_page, staff_orser_event_qs)", "try:\n return StaffOrderEvent.query(order=order)[0]\nexcept:\n return None", "try:\n return StaffOrderEvent.search(st...
<|body_start_0|> staff_orser_event_qs = StaffOrderEvent.query(**search_info) staff_orser_event_qs = staff_orser_event_qs.order_by('-create_time') return Splitor(current_page, staff_orser_event_qs) <|end_body_0|> <|body_start_1|> try: return StaffOrderEvent.query(order=order)...
StaffOrderEventServer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StaffOrderEventServer: def search(cls, current_page, **search_info): """查询事件列表""" <|body_0|> def get_event_byorder(cls, order): """通过订单查询事件""" <|body_1|> def get_event_bystaff(cls, staff_list): """通过员工查询事件""" <|body_2|> <|end_skeleton|> ...
stack_v2_sparse_classes_75kplus_train_067440
5,325
no_license
[ { "docstring": "查询事件列表", "name": "search", "signature": "def search(cls, current_page, **search_info)" }, { "docstring": "通过订单查询事件", "name": "get_event_byorder", "signature": "def get_event_byorder(cls, order)" }, { "docstring": "通过员工查询事件", "name": "get_event_bystaff", "s...
3
stack_v2_sparse_classes_30k_train_009593
Implement the Python class `StaffOrderEventServer` described below. Class description: Implement the StaffOrderEventServer class. Method signatures and docstrings: - def search(cls, current_page, **search_info): 查询事件列表 - def get_event_byorder(cls, order): 通过订单查询事件 - def get_event_bystaff(cls, staff_list): 通过员工查询事件
Implement the Python class `StaffOrderEventServer` described below. Class description: Implement the StaffOrderEventServer class. Method signatures and docstrings: - def search(cls, current_page, **search_info): 查询事件列表 - def get_event_byorder(cls, order): 通过订单查询事件 - def get_event_bystaff(cls, staff_list): 通过员工查询事件 <...
c22e772bc24381f7f57e1d6e41ae0289e7f11e57
<|skeleton|> class StaffOrderEventServer: def search(cls, current_page, **search_info): """查询事件列表""" <|body_0|> def get_event_byorder(cls, order): """通过订单查询事件""" <|body_1|> def get_event_bystaff(cls, staff_list): """通过员工查询事件""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class StaffOrderEventServer: def search(cls, current_page, **search_info): """查询事件列表""" staff_orser_event_qs = StaffOrderEvent.query(**search_info) staff_orser_event_qs = staff_orser_event_qs.order_by('-create_time') return Splitor(current_page, staff_orser_event_qs) def get_eve...
the_stack_v2_python_sparse
codes/crm-be/tuoen/abs/service/order/manager.py
MaseraTiGo/Maserati_Go
train
0
2e2fee5932ac93c2a07c63bb4fa7628b1d9d03d6
[ "LeoCloudIOBase.__init__(self, c, p, kwargs)\nself.basepath = os.path.expanduser(kwargs['root'])\nif not os.path.exists(self.basepath):\n os.makedirs(self.basepath)", "filepath = os.path.join(self.basepath, lc_id + '.json')\nwith open(filepath) as data:\n return json.load(data)", "filepath = os.path.join(...
<|body_start_0|> LeoCloudIOBase.__init__(self, c, p, kwargs) self.basepath = os.path.expanduser(kwargs['root']) if not os.path.exists(self.basepath): os.makedirs(self.basepath) <|end_body_0|> <|body_start_1|> filepath = os.path.join(self.basepath, lc_id + '.json') wi...
Leo Cloud IO layer that just loads / saves local files. i.e it's just for development / testing
LeoCloudIOFileSystem
[ "BSD-3-Clause", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LeoCloudIOFileSystem: """Leo Cloud IO layer that just loads / saves local files. i.e it's just for development / testing""" def __init__(self, c, p, kwargs): """Args: basepath (str): root folder for data""" <|body_0|> def get_data(self, lc_id): """get_data - get ...
stack_v2_sparse_classes_75kplus_train_067441
26,949
permissive
[ { "docstring": "Args: basepath (str): root folder for data", "name": "__init__", "signature": "def __init__(self, c, p, kwargs)" }, { "docstring": "get_data - get a Leo Cloud resource Args: lc_id (str(?)): resource to get Returns: object loaded from JSON", "name": "get_data", "signature"...
3
stack_v2_sparse_classes_30k_train_003501
Implement the Python class `LeoCloudIOFileSystem` described below. Class description: Leo Cloud IO layer that just loads / saves local files. i.e it's just for development / testing Method signatures and docstrings: - def __init__(self, c, p, kwargs): Args: basepath (str): root folder for data - def get_data(self, lc...
Implement the Python class `LeoCloudIOFileSystem` described below. Class description: Leo Cloud IO layer that just loads / saves local files. i.e it's just for development / testing Method signatures and docstrings: - def __init__(self, c, p, kwargs): Args: basepath (str): root folder for data - def get_data(self, lc...
a3f6c3ebda805dc40cd93123948f153a26eccee5
<|skeleton|> class LeoCloudIOFileSystem: """Leo Cloud IO layer that just loads / saves local files. i.e it's just for development / testing""" def __init__(self, c, p, kwargs): """Args: basepath (str): root folder for data""" <|body_0|> def get_data(self, lc_id): """get_data - get ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LeoCloudIOFileSystem: """Leo Cloud IO layer that just loads / saves local files. i.e it's just for development / testing""" def __init__(self, c, p, kwargs): """Args: basepath (str): root folder for data""" LeoCloudIOBase.__init__(self, c, p, kwargs) self.basepath = os.path.expand...
the_stack_v2_python_sparse
leo/plugins/leo_cloud.py
leo-editor/leo-editor
train
1,671
174ef5425da4c050a820da829e8e8bad350e1da7
[ "CHOICES = ('dark', 'caramel', 'mint', 'surprise', 'stats', 'shutdown')\nchoice = 'dark'\nself.chocolate_machine = ChocolateMachine(CHOICES)\nself.selection = CHOCOLATE_CHOICES[choice]", "d_raw_materials = {'sugar': 2, 'butter': 2, 'caramel': 15, 'dark chocolate': 30, 'mint chocolate': 30, 'milk chocolate': 30, '...
<|body_start_0|> CHOICES = ('dark', 'caramel', 'mint', 'surprise', 'stats', 'shutdown') choice = 'dark' self.chocolate_machine = ChocolateMachine(CHOICES) self.selection = CHOCOLATE_CHOICES[choice] <|end_body_0|> <|body_start_1|> d_raw_materials = {'sugar': 2, 'butter': 2, 'cara...
Test class to test chocolate_machine module
TestChocolateMachine
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestChocolateMachine: """Test class to test chocolate_machine module""" def setUp(self): """setUp class""" <|body_0|> def test_stats(self): """test stats functionality""" <|body_1|> def test_has_raw_materials(self): """test has_raw_materials ...
stack_v2_sparse_classes_75kplus_train_067442
4,538
permissive
[ { "docstring": "setUp class", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "test stats functionality", "name": "test_stats", "signature": "def test_stats(self)" }, { "docstring": "test has_raw_materials functionality", "name": "test_has_raw_materials", ...
5
stack_v2_sparse_classes_30k_test_002771
Implement the Python class `TestChocolateMachine` described below. Class description: Test class to test chocolate_machine module Method signatures and docstrings: - def setUp(self): setUp class - def test_stats(self): test stats functionality - def test_has_raw_materials(self): test has_raw_materials functionality -...
Implement the Python class `TestChocolateMachine` described below. Class description: Test class to test chocolate_machine module Method signatures and docstrings: - def setUp(self): setUp class - def test_stats(self): test stats functionality - def test_has_raw_materials(self): test has_raw_materials functionality -...
3ad0990ee100d0dcf7a69a6851ce84ba262a6f5e
<|skeleton|> class TestChocolateMachine: """Test class to test chocolate_machine module""" def setUp(self): """setUp class""" <|body_0|> def test_stats(self): """test stats functionality""" <|body_1|> def test_has_raw_materials(self): """test has_raw_materials ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestChocolateMachine: """Test class to test chocolate_machine module""" def setUp(self): """setUp class""" CHOICES = ('dark', 'caramel', 'mint', 'surprise', 'stats', 'shutdown') choice = 'dark' self.chocolate_machine = ChocolateMachine(CHOICES) self.selection = CHO...
the_stack_v2_python_sparse
Part_7_Unittest/p_0006_wonka_chocolate_machine/test_chocolate_machine.py
mytechnotalent/Python-For-Kids
train
697
f1f1617b69267399b90f989cb1ffaf1e7f911d32
[ "BaseMailingProcess.__init__(self)\nself.user = None\nself.unit_problem = None\nself.stripe_session = None\nself.future_pro_user = None", "self.user = user\nself.unit_problem = problem\nself.stripe_session = stripe_session\nself.future_pro_user = future_pro_user\ngateway_token = generate_gateway_token()\nbackslas...
<|body_start_0|> BaseMailingProcess.__init__(self) self.user = None self.unit_problem = None self.stripe_session = None self.future_pro_user = None <|end_body_0|> <|body_start_1|> self.user = user self.unit_problem = problem self.stripe_session = stripe_s...
UnitMailingProcess
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UnitMailingProcess: def __init__(self): """The UnitMailingProcess handle the core logic for sending one mail given a problem. It's when a user decide to go for the PRO offer (a unit mail with the solution is directly sent)""" <|body_0|> def run(self, user, problem, stripe_se...
stack_v2_sparse_classes_75kplus_train_067443
24,237
no_license
[ { "docstring": "The UnitMailingProcess handle the core logic for sending one mail given a problem. It's when a user decide to go for the PRO offer (a unit mail with the solution is directly sent)", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Run the unit mailing proc...
2
stack_v2_sparse_classes_30k_train_005850
Implement the Python class `UnitMailingProcess` described below. Class description: Implement the UnitMailingProcess class. Method signatures and docstrings: - def __init__(self): The UnitMailingProcess handle the core logic for sending one mail given a problem. It's when a user decide to go for the PRO offer (a unit...
Implement the Python class `UnitMailingProcess` described below. Class description: Implement the UnitMailingProcess class. Method signatures and docstrings: - def __init__(self): The UnitMailingProcess handle the core logic for sending one mail given a problem. It's when a user decide to go for the PRO offer (a unit...
048e349a413b075da9cc0e0b497c40ab6620e245
<|skeleton|> class UnitMailingProcess: def __init__(self): """The UnitMailingProcess handle the core logic for sending one mail given a problem. It's when a user decide to go for the PRO offer (a unit mail with the solution is directly sent)""" <|body_0|> def run(self, user, problem, stripe_se...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UnitMailingProcess: def __init__(self): """The UnitMailingProcess handle the core logic for sending one mail given a problem. It's when a user decide to go for the PRO offer (a unit mail with the solution is directly sent)""" BaseMailingProcess.__init__(self) self.user = None s...
the_stack_v2_python_sparse
1interviewparjour/oneinterviewparjour/mail_scheduler/engine.py
gabrielmougard/1interviewparjour
train
1
23a074fc3d6d6deb18ded23cbf8b2d2b4d04c29b
[ "things = self.model_factory.create_batch(20)\ntable = self.table_class(things)\nself.assertEqual(self.model.objects.count(), len(table.rows))", "things = self.model_factory.create_batch(20)\ntable = self.table_class(things)\nrow = table.rows[0]\nself.assertIn(row.record.i_trait_name, row.get_cell_value('i_trait_...
<|body_start_0|> things = self.model_factory.create_batch(20) table = self.table_class(things) self.assertEqual(self.model.objects.count(), len(table.rows)) <|end_body_0|> <|body_start_1|> things = self.model_factory.create_batch(20) table = self.table_class(things) row ...
SourceTraitTableTest
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SourceTraitTableTest: def test_row_count(self): """Table has expected number of rows.""" <|body_0|> def test_trait_name(self): """Trait name column value is as expected.""" <|body_1|> <|end_skeleton|> <|body_start_0|> things = self.model_factory.cre...
stack_v2_sparse_classes_75kplus_train_067444
9,256
permissive
[ { "docstring": "Table has expected number of rows.", "name": "test_row_count", "signature": "def test_row_count(self)" }, { "docstring": "Trait name column value is as expected.", "name": "test_trait_name", "signature": "def test_trait_name(self)" } ]
2
null
Implement the Python class `SourceTraitTableTest` described below. Class description: Implement the SourceTraitTableTest class. Method signatures and docstrings: - def test_row_count(self): Table has expected number of rows. - def test_trait_name(self): Trait name column value is as expected.
Implement the Python class `SourceTraitTableTest` described below. Class description: Implement the SourceTraitTableTest class. Method signatures and docstrings: - def test_row_count(self): Table has expected number of rows. - def test_trait_name(self): Trait name column value is as expected. <|skeleton|> class Sour...
89ae277f5ba1357580d78c3527f26200686308a6
<|skeleton|> class SourceTraitTableTest: def test_row_count(self): """Table has expected number of rows.""" <|body_0|> def test_trait_name(self): """Trait name column value is as expected.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SourceTraitTableTest: def test_row_count(self): """Table has expected number of rows.""" things = self.model_factory.create_batch(20) table = self.table_class(things) self.assertEqual(self.model.objects.count(), len(table.rows)) def test_trait_name(self): """Trait ...
the_stack_v2_python_sparse
trait_browser/test_tables.py
UW-GAC/pie
train
0
d2cc412e30fb8ab6432776ebfa83e70e630a5bec
[ "super().__init__(cv)\nself._nextrocket = 0\nself._time = 0\nself._cv = cv\nself._pos = pos", "super().update(dt)\nself._time = self._time + dt\nif self._time > self._nextrocket:\n r = RocketRocket(self._cv, self._pos, 1000, ['red', 'blue', 'yellow', 'chartreuse2'], [500, 500], 3, 3)\n entities.append(r)\n ...
<|body_start_0|> super().__init__(cv) self._nextrocket = 0 self._time = 0 self._cv = cv self._pos = pos <|end_body_0|> <|body_start_1|> super().update(dt) self._time = self._time + dt if self._time > self._nextrocket: r = RocketRocket(self._cv...
RocketRocketLauncher
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RocketRocketLauncher: def __init__(self, cv, pos): """Barrages the skies with a relentless series of badass explosions. (repetadly executes RocketRocket) Arguments: cv {idontknow} -- the canvas upon which this wonderful display pos {int} -- the position of the new rocket from the old roc...
stack_v2_sparse_classes_75kplus_train_067445
16,427
permissive
[ { "docstring": "Barrages the skies with a relentless series of badass explosions. (repetadly executes RocketRocket) Arguments: cv {idontknow} -- the canvas upon which this wonderful display pos {int} -- the position of the new rocket from the old rocket", "name": "__init__", "signature": "def __init__(s...
2
stack_v2_sparse_classes_30k_train_027180
Implement the Python class `RocketRocketLauncher` described below. Class description: Implement the RocketRocketLauncher class. Method signatures and docstrings: - def __init__(self, cv, pos): Barrages the skies with a relentless series of badass explosions. (repetadly executes RocketRocket) Arguments: cv {idontknow}...
Implement the Python class `RocketRocketLauncher` described below. Class description: Implement the RocketRocketLauncher class. Method signatures and docstrings: - def __init__(self, cv, pos): Barrages the skies with a relentless series of badass explosions. (repetadly executes RocketRocket) Arguments: cv {idontknow}...
c6b6d80e9d59f5d115ca8b8fc020fcd6cb030af8
<|skeleton|> class RocketRocketLauncher: def __init__(self, cv, pos): """Barrages the skies with a relentless series of badass explosions. (repetadly executes RocketRocket) Arguments: cv {idontknow} -- the canvas upon which this wonderful display pos {int} -- the position of the new rocket from the old roc...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RocketRocketLauncher: def __init__(self, cv, pos): """Barrages the skies with a relentless series of badass explosions. (repetadly executes RocketRocket) Arguments: cv {idontknow} -- the canvas upon which this wonderful display pos {int} -- the position of the new rocket from the old rocket""" ...
the_stack_v2_python_sparse
scripts/sheet9/9.2.py
LennartElbe/PythOnline
train
0
ee2aed7b3678c8c22b05c04c50adf7571f4228b0
[ "super(DumpConfiguration, self).__init__(*args, **kwargs)\nself.allow_extras = True\nreturn", "if self._configspec_source is None:\n self._configspec_source = dump_configspec\nreturn self._configspec_source" ]
<|body_start_0|> super(DumpConfiguration, self).__init__(*args, **kwargs) self.allow_extras = True return <|end_body_0|> <|body_start_1|> if self._configspec_source is None: self._configspec_source = dump_configspec return self._configspec_source <|end_body_1|>
A configuration for the dump
DumpConfiguration
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DumpConfiguration: """A configuration for the dump""" def __init__(self, *args, **kwargs): """DumpConfiguration constructor (allow_extras=True)""" <|body_0|> def configspec_source(self): """string configuration specification""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_75kplus_train_067446
18,096
no_license
[ { "docstring": "DumpConfiguration constructor (allow_extras=True)", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "string configuration specification", "name": "configspec_source", "signature": "def configspec_source(self)" } ]
2
stack_v2_sparse_classes_30k_train_033130
Implement the Python class `DumpConfiguration` described below. Class description: A configuration for the dump Method signatures and docstrings: - def __init__(self, *args, **kwargs): DumpConfiguration constructor (allow_extras=True) - def configspec_source(self): string configuration specification
Implement the Python class `DumpConfiguration` described below. Class description: A configuration for the dump Method signatures and docstrings: - def __init__(self, *args, **kwargs): DumpConfiguration constructor (allow_extras=True) - def configspec_source(self): string configuration specification <|skeleton|> cla...
cd735b8c0fec06f7f9083714900ff88395c9443f
<|skeleton|> class DumpConfiguration: """A configuration for the dump""" def __init__(self, *args, **kwargs): """DumpConfiguration constructor (allow_extras=True)""" <|body_0|> def configspec_source(self): """string configuration specification""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DumpConfiguration: """A configuration for the dump""" def __init__(self, *args, **kwargs): """DumpConfiguration constructor (allow_extras=True)""" super(DumpConfiguration, self).__init__(*args, **kwargs) self.allow_extras = True return def configspec_source(self): ...
the_stack_v2_python_sparse
cameraobscura/plugins/rvrplugin.py
russell-n/cameraobscura
train
0
2955a24ef7d61ddce4e07a01bdd518262cab889f
[ "differentiator.refresh()\nop = differentiator.generate_differentiable_op(sampled_op=op)\nqubit = cirq.GridQubit(0, 0)\ncircuit = util.convert_to_tensor([cirq.Circuit(cirq.X(qubit) ** sympy.Symbol('alpha'))])\npsums = util.convert_to_tensor([[cirq.Z(qubit)]])\nsymbol_values_array = np.array([[0.123]], dtype=np.floa...
<|body_start_0|> differentiator.refresh() op = differentiator.generate_differentiable_op(sampled_op=op) qubit = cirq.GridQubit(0, 0) circuit = util.convert_to_tensor([cirq.Circuit(cirq.X(qubit) ** sympy.Symbol('alpha'))]) psums = util.convert_to_tensor([[cirq.Z(qubit)]]) ...
Test approximate correctness of noisy methods.
NoisyGradientCorrectnessTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NoisyGradientCorrectnessTest: """Test approximate correctness of noisy methods.""" def test_sampled_value_with_simple_circuit(self, differentiator, op, num_samples): """Test the value of sampled differentiator with simple circuit.""" <|body_0|> def test_approx_equality_s...
stack_v2_sparse_classes_75kplus_train_067447
22,303
permissive
[ { "docstring": "Test the value of sampled differentiator with simple circuit.", "name": "test_sampled_value_with_simple_circuit", "signature": "def test_sampled_value_with_simple_circuit(self, differentiator, op, num_samples)" }, { "docstring": "Test small circuits with limited depth.", "nam...
3
stack_v2_sparse_classes_30k_train_021605
Implement the Python class `NoisyGradientCorrectnessTest` described below. Class description: Test approximate correctness of noisy methods. Method signatures and docstrings: - def test_sampled_value_with_simple_circuit(self, differentiator, op, num_samples): Test the value of sampled differentiator with simple circu...
Implement the Python class `NoisyGradientCorrectnessTest` described below. Class description: Test approximate correctness of noisy methods. Method signatures and docstrings: - def test_sampled_value_with_simple_circuit(self, differentiator, op, num_samples): Test the value of sampled differentiator with simple circu...
f56257bceb988b743790e1e480eac76fd036d4ff
<|skeleton|> class NoisyGradientCorrectnessTest: """Test approximate correctness of noisy methods.""" def test_sampled_value_with_simple_circuit(self, differentiator, op, num_samples): """Test the value of sampled differentiator with simple circuit.""" <|body_0|> def test_approx_equality_s...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NoisyGradientCorrectnessTest: """Test approximate correctness of noisy methods.""" def test_sampled_value_with_simple_circuit(self, differentiator, op, num_samples): """Test the value of sampled differentiator with simple circuit.""" differentiator.refresh() op = differentiator.ge...
the_stack_v2_python_sparse
tensorflow_quantum/python/differentiators/gradient_test.py
tensorflow/quantum
train
1,799
f4c83df86710cab187ff272df237ae5067e5e0d7
[ "values = board_config_string.split(delimiter)\ncount = len(values)\nif not values[0]:\n raise ValueError('board_config_string')\nself.name = values[0]\ntry:\n self.difficulty = Difficulty[values[1]]\nexcept:\n self.difficulty = Difficulty.default\ntry:\n self.attribute = CharacterAttribute[values[2]]\n...
<|body_start_0|> values = board_config_string.split(delimiter) count = len(values) if not values[0]: raise ValueError('board_config_string') self.name = values[0] try: self.difficulty = Difficulty[values[1]] except: self.difficulty = Di...
Board configuration details, parsed from the command line arguments. Attributes: name (str): the board name. all_cards (bool): If True, all cards should be used; otherwise only cards assigned to the current user should be used. difficulty (scriptabit.Difficulty): the default difficulty for this board. attribute (script...
BoardConfig
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BoardConfig: """Board configuration details, parsed from the command line arguments. Attributes: name (str): the board name. all_cards (bool): If True, all cards should be used; otherwise only cards assigned to the current user should be used. difficulty (scriptabit.Difficulty): the default diffi...
stack_v2_sparse_classes_75kplus_train_067448
2,453
permissive
[ { "docstring": "Initialises the BoardConfig instance. Args: board_config_string (str): The board configuration string. This is a packed string containing up to four options, delimited by `delimiter`. E.G.:: 'board_name|difficulty|attribute|user' If the user field is not specified, then it defaults to `all_cards...
2
stack_v2_sparse_classes_30k_test_001299
Implement the Python class `BoardConfig` described below. Class description: Board configuration details, parsed from the command line arguments. Attributes: name (str): the board name. all_cards (bool): If True, all cards should be used; otherwise only cards assigned to the current user should be used. difficulty (sc...
Implement the Python class `BoardConfig` described below. Class description: Board configuration details, parsed from the command line arguments. Attributes: name (str): the board name. all_cards (bool): If True, all cards should be used; otherwise only cards assigned to the current user should be used. difficulty (sc...
0d0cf71814e98954850891fa0887bdcffcf7147d
<|skeleton|> class BoardConfig: """Board configuration details, parsed from the command line arguments. Attributes: name (str): the board name. all_cards (bool): If True, all cards should be used; otherwise only cards assigned to the current user should be used. difficulty (scriptabit.Difficulty): the default diffi...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BoardConfig: """Board configuration details, parsed from the command line arguments. Attributes: name (str): the board name. all_cards (bool): If True, all cards should be used; otherwise only cards assigned to the current user should be used. difficulty (scriptabit.Difficulty): the default difficulty for thi...
the_stack_v2_python_sparse
scriptabit/plugins/trello/board_config.py
DC23/scriptabit
train
10
7360adda5d8607c2abe59635521d999d501126f2
[ "examples, metadata = tfds.load('ted_hrlr_translate/pt_to_en', with_info=True, as_supervised=True)\nself.data_train = examples['train']\nself.data_valid = examples['validation']\nPT, EN = self.tokenize_dataset(self.data_train)\nself.tokenizer_pt, self.tokenizer_en = (PT, EN)", "tokenizer_en = tfds.features.text.S...
<|body_start_0|> examples, metadata = tfds.load('ted_hrlr_translate/pt_to_en', with_info=True, as_supervised=True) self.data_train = examples['train'] self.data_valid = examples['validation'] PT, EN = self.tokenize_dataset(self.data_train) self.tokenizer_pt, self.tokenizer_en = (...
Class Dataset
Dataset
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Dataset: """Class Dataset""" def __init__(self): """* data_train, which contains the ted_hrlr_translate/pt_to_en tf.data.Dataset train split, loaded as_supervided * data_valid, which contains the ted_hrlr_translate/pt_to_en tf.data.Dataset validate split, loaded as_supervided * token...
stack_v2_sparse_classes_75kplus_train_067449
1,982
no_license
[ { "docstring": "* data_train, which contains the ted_hrlr_translate/pt_to_en tf.data.Dataset train split, loaded as_supervided * data_valid, which contains the ted_hrlr_translate/pt_to_en tf.data.Dataset validate split, loaded as_supervided * tokenizer_pt is the Portuguese tokenizer created from the training se...
2
stack_v2_sparse_classes_30k_train_053752
Implement the Python class `Dataset` described below. Class description: Class Dataset Method signatures and docstrings: - def __init__(self): * data_train, which contains the ted_hrlr_translate/pt_to_en tf.data.Dataset train split, loaded as_supervided * data_valid, which contains the ted_hrlr_translate/pt_to_en tf....
Implement the Python class `Dataset` described below. Class description: Class Dataset Method signatures and docstrings: - def __init__(self): * data_train, which contains the ted_hrlr_translate/pt_to_en tf.data.Dataset train split, loaded as_supervided * data_valid, which contains the ted_hrlr_translate/pt_to_en tf....
8ad4c2594ff78b345dbd92e9d54d2a143ac4071a
<|skeleton|> class Dataset: """Class Dataset""" def __init__(self): """* data_train, which contains the ted_hrlr_translate/pt_to_en tf.data.Dataset train split, loaded as_supervided * data_valid, which contains the ted_hrlr_translate/pt_to_en tf.data.Dataset validate split, loaded as_supervided * token...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Dataset: """Class Dataset""" def __init__(self): """* data_train, which contains the ted_hrlr_translate/pt_to_en tf.data.Dataset train split, loaded as_supervided * data_valid, which contains the ted_hrlr_translate/pt_to_en tf.data.Dataset validate split, loaded as_supervided * tokenizer_pt is th...
the_stack_v2_python_sparse
supervised_learning/0x12-transformer_apps/0-dataset.py
jorgezafra94/holbertonschool-machine_learning
train
1
b2502ba68a4bf752c0f29effc64c3d37b8e977ad
[ "if not root:\n return None\nif root.val < L:\n root = self.trimBST(root.right, L, R)\nelif root.val > R:\n root = self.trimBST(root.left, L, R)\nelse:\n root.left = self.trimBST(root.left, L, R)\n root.right = self.trimBST(root.right, L, R)\nreturn root", "if not root:\n return None\ncontour = ...
<|body_start_0|> if not root: return None if root.val < L: root = self.trimBST(root.right, L, R) elif root.val > R: root = self.trimBST(root.left, L, R) else: root.left = self.trimBST(root.left, L, R) root.right = self.trimBST(r...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def trimBST(self, root, L, R): """:type root: TreeNode :type L: int :type R: int :rtype: TreeNode""" <|body_0|> def trimBST2_WRONG(self, root, L, R): """:type root: TreeNode :type L: int :type R: int :rtype: TreeNode""" <|body_1|> <|end_skeleton|> ...
stack_v2_sparse_classes_75kplus_train_067450
4,018
no_license
[ { "docstring": ":type root: TreeNode :type L: int :type R: int :rtype: TreeNode", "name": "trimBST", "signature": "def trimBST(self, root, L, R)" }, { "docstring": ":type root: TreeNode :type L: int :type R: int :rtype: TreeNode", "name": "trimBST2_WRONG", "signature": "def trimBST2_WRON...
2
stack_v2_sparse_classes_30k_train_042731
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def trimBST(self, root, L, R): :type root: TreeNode :type L: int :type R: int :rtype: TreeNode - def trimBST2_WRONG(self, root, L, R): :type root: TreeNode :type L: int :type R: ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def trimBST(self, root, L, R): :type root: TreeNode :type L: int :type R: int :rtype: TreeNode - def trimBST2_WRONG(self, root, L, R): :type root: TreeNode :type L: int :type R: ...
635af6e22aa8eef8e7920a585d43a45a891a8157
<|skeleton|> class Solution: def trimBST(self, root, L, R): """:type root: TreeNode :type L: int :type R: int :rtype: TreeNode""" <|body_0|> def trimBST2_WRONG(self, root, L, R): """:type root: TreeNode :type L: int :type R: int :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def trimBST(self, root, L, R): """:type root: TreeNode :type L: int :type R: int :rtype: TreeNode""" if not root: return None if root.val < L: root = self.trimBST(root.right, L, R) elif root.val > R: root = self.trimBST(root.left, L...
the_stack_v2_python_sparse
code669TrimABinarySearchTree.py
cybelewang/leetcode-python
train
0
50e3429995b38107c4c50ff208aac2ee12d8fd09
[ "try:\n queryEstate = self.queryEstate_parameter(xiaoqu_Name=estateName)\n logging.info(queryEstate)\n estateId = queryEstate[0]\n estateName = queryEstate[1]\n querySubEstates = self.querySubEstates_parameter(estateId=estateId)\n logging.info(querySubEstates)\n subEstateId = querySubEstates[1]...
<|body_start_0|> try: queryEstate = self.queryEstate_parameter(xiaoqu_Name=estateName) logging.info(queryEstate) estateId = queryEstate[0] estateName = queryEstate[1] querySubEstates = self.querySubEstates_parameter(estateId=estateId) loggi...
创建房屋
Create_house
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Create_house: """创建房屋""" def rented_house(self, estateName=''): """创建合租房屋""" <|body_0|> def rented_house_create_apply(self, estateName=''): """创建房源并且填写房间信息,且申请装锁成功""" <|body_1|> def rented_house_delete(self, estateName=''): """创建房源并且删除房屋""" ...
stack_v2_sparse_classes_75kplus_train_067451
6,277
no_license
[ { "docstring": "创建合租房屋", "name": "rented_house", "signature": "def rented_house(self, estateName='')" }, { "docstring": "创建房源并且填写房间信息,且申请装锁成功", "name": "rented_house_create_apply", "signature": "def rented_house_create_apply(self, estateName='')" }, { "docstring": "创建房源并且删除房屋", ...
5
null
Implement the Python class `Create_house` described below. Class description: 创建房屋 Method signatures and docstrings: - def rented_house(self, estateName=''): 创建合租房屋 - def rented_house_create_apply(self, estateName=''): 创建房源并且填写房间信息,且申请装锁成功 - def rented_house_delete(self, estateName=''): 创建房源并且删除房屋 - def rented_house_...
Implement the Python class `Create_house` described below. Class description: 创建房屋 Method signatures and docstrings: - def rented_house(self, estateName=''): 创建合租房屋 - def rented_house_create_apply(self, estateName=''): 创建房源并且填写房间信息,且申请装锁成功 - def rented_house_delete(self, estateName=''): 创建房源并且删除房屋 - def rented_house_...
e173d4e535ac22b72b67371b8a2524ee425cdcbf
<|skeleton|> class Create_house: """创建房屋""" def rented_house(self, estateName=''): """创建合租房屋""" <|body_0|> def rented_house_create_apply(self, estateName=''): """创建房源并且填写房间信息,且申请装锁成功""" <|body_1|> def rented_house_delete(self, estateName=''): """创建房源并且删除房屋""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Create_house: """创建房屋""" def rented_house(self, estateName=''): """创建合租房屋""" try: queryEstate = self.queryEstate_parameter(xiaoqu_Name=estateName) logging.info(queryEstate) estateId = queryEstate[0] estateName = queryEstate[1] qu...
the_stack_v2_python_sparse
public/aYiLou_fangdong/yilou_fangdong_operation_flow/Business_process.py
GSIL-Monitor/mrbao_python
train
0
a3db018269fd598436ba04f10bdc6860f888b833
[ "build_directory = self.stage.source_path\nif self.spec.variants['build_type'].value == 'Debug':\n build_directory = join_path(build_directory, 'build', 'debug')\nelse:\n build_directory = join_path(build_directory, 'build', 'release')\nreturn build_directory", "spec = self.spec\nargs = ['../..', '-DCMAKE_I...
<|body_start_0|> build_directory = self.stage.source_path if self.spec.variants['build_type'].value == 'Debug': build_directory = join_path(build_directory, 'build', 'debug') else: build_directory = join_path(build_directory, 'build', 'release') return build_direc...
AOCL-Sparse is a library that contains basic linear algebra subroutines for sparse matrices and vectors optimized for AMD EPYC family of processors. It is designed to be used with C and C++. Current functionality of sparse library supports SPMV function with CSR and ELLPACK formats.
AoclSparse
[ "Apache-2.0", "MIT", "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause", "LGPL-2.1-only" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AoclSparse: """AOCL-Sparse is a library that contains basic linear algebra subroutines for sparse matrices and vectors optimized for AMD EPYC family of processors. It is designed to be used with C and C++. Current functionality of sparse library supports SPMV function with CSR and ELLPACK formats...
stack_v2_sparse_classes_75kplus_train_067452
3,906
permissive
[ { "docstring": "Returns the directory to use when building the package :return: directory where to build the package", "name": "build_directory", "signature": "def build_directory(self)" }, { "docstring": "Runs ``cmake`` in the build directory", "name": "cmake_args", "signature": "def cm...
3
stack_v2_sparse_classes_30k_train_013791
Implement the Python class `AoclSparse` described below. Class description: AOCL-Sparse is a library that contains basic linear algebra subroutines for sparse matrices and vectors optimized for AMD EPYC family of processors. It is designed to be used with C and C++. Current functionality of sparse library supports SPM...
Implement the Python class `AoclSparse` described below. Class description: AOCL-Sparse is a library that contains basic linear algebra subroutines for sparse matrices and vectors optimized for AMD EPYC family of processors. It is designed to be used with C and C++. Current functionality of sparse library supports SPM...
6c2df00443a2cd092446c7d84431ae37e64e4296
<|skeleton|> class AoclSparse: """AOCL-Sparse is a library that contains basic linear algebra subroutines for sparse matrices and vectors optimized for AMD EPYC family of processors. It is designed to be used with C and C++. Current functionality of sparse library supports SPMV function with CSR and ELLPACK formats...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AoclSparse: """AOCL-Sparse is a library that contains basic linear algebra subroutines for sparse matrices and vectors optimized for AMD EPYC family of processors. It is designed to be used with C and C++. Current functionality of sparse library supports SPMV function with CSR and ELLPACK formats.""" def...
the_stack_v2_python_sparse
var/spack/repos/builtin/packages/aocl-sparse/package.py
JayjeetAtGithub/spack
train
0
694f2c32d491f7891ab522fa1f2d0488e09bdb6f
[ "self.visitedNodes = set()\nself.validNodes = set(validNodes)\nself.next_node_to_visit = [node]\nself.next_node = None", "self.visitedNodes.add(node)\nself.next_node_to_visit.extend(node.edges)\nself.next_node = node", "if self.next_node is not None:\n return True\nif len(self.next_node_to_visit) < 1:\n r...
<|body_start_0|> self.visitedNodes = set() self.validNodes = set(validNodes) self.next_node_to_visit = [node] self.next_node = None <|end_body_0|> <|body_start_1|> self.visitedNodes.add(node) self.next_node_to_visit.extend(node.edges) self.next_node = node <|end_...
Walk through the connected nodes with BFS
BFS
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BFS: """Walk through the connected nodes with BFS""" def __init__(self, node, validNodes): """:param node: the starting node :param validNodes: the set of valid nodes that this BFS will transverse""" <|body_0|> def visit_node(self, node): """Visits the given node...
stack_v2_sparse_classes_75kplus_train_067453
15,542
permissive
[ { "docstring": ":param node: the starting node :param validNodes: the set of valid nodes that this BFS will transverse", "name": "__init__", "signature": "def __init__(self, node, validNodes)" }, { "docstring": "Visits the given node :param node: the node to visit", "name": "visit_node", ...
4
null
Implement the Python class `BFS` described below. Class description: Walk through the connected nodes with BFS Method signatures and docstrings: - def __init__(self, node, validNodes): :param node: the starting node :param validNodes: the set of valid nodes that this BFS will transverse - def visit_node(self, node): ...
Implement the Python class `BFS` described below. Class description: Walk through the connected nodes with BFS Method signatures and docstrings: - def __init__(self, node, validNodes): :param node: the starting node :param validNodes: the set of valid nodes that this BFS will transverse - def visit_node(self, node): ...
64f360fd97410682e9f88a37373e1f64b89b62a4
<|skeleton|> class BFS: """Walk through the connected nodes with BFS""" def __init__(self, node, validNodes): """:param node: the starting node :param validNodes: the set of valid nodes that this BFS will transverse""" <|body_0|> def visit_node(self, node): """Visits the given node...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BFS: """Walk through the connected nodes with BFS""" def __init__(self, node, validNodes): """:param node: the starting node :param validNodes: the set of valid nodes that this BFS will transverse""" self.visitedNodes = set() self.validNodes = set(validNodes) self.next_nod...
the_stack_v2_python_sparse
sbp_env/utils/common.py
soraxas/sbp-env
train
16
83d6930320f6613c25436c740822fab1b5aa44b3
[ "if not tx_id:\n return False\nif order.sys_tx_id == tx_id:\n return False\nif order.mch_tx_id == tx_id:\n return False\nreturn True", "if not channel:\n return False\norder_channel = channel_dict.get(order.channel_id)\nif not order_channel:\n return True\nif order_channel.channel_enum == channel:\...
<|body_start_0|> if not tx_id: return False if order.sys_tx_id == tx_id: return False if order.mch_tx_id == tx_id: return False return True <|end_body_0|> <|body_start_1|> if not channel: return False order_channel = channe...
OrderFilters
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OrderFilters: def filter_tx_id(cls, tx_id, order): """根据交易ID来过滤 :param tx_id: :param order: :return: True: 过滤;False:不过滤""" <|body_0|> def filter_channel(cls, channel_dict, channel, order): """根据交易通道类型过滤 :param channel_dict: :param channel: :param order: :return: True...
stack_v2_sparse_classes_75kplus_train_067454
14,827
no_license
[ { "docstring": "根据交易ID来过滤 :param tx_id: :param order: :return: True: 过滤;False:不过滤", "name": "filter_tx_id", "signature": "def filter_tx_id(cls, tx_id, order)" }, { "docstring": "根据交易通道类型过滤 :param channel_dict: :param channel: :param order: :return: True: 过滤;False:不过滤", "name": "filter_channe...
5
stack_v2_sparse_classes_30k_train_048330
Implement the Python class `OrderFilters` described below. Class description: Implement the OrderFilters class. Method signatures and docstrings: - def filter_tx_id(cls, tx_id, order): 根据交易ID来过滤 :param tx_id: :param order: :return: True: 过滤;False:不过滤 - def filter_channel(cls, channel_dict, channel, order): 根据交易通道类型过滤...
Implement the Python class `OrderFilters` described below. Class description: Implement the OrderFilters class. Method signatures and docstrings: - def filter_tx_id(cls, tx_id, order): 根据交易ID来过滤 :param tx_id: :param order: :return: True: 过滤;False:不过滤 - def filter_channel(cls, channel_dict, channel, order): 根据交易通道类型过滤...
ff36deb73e667de16a73b1666bbeaf28f993f944
<|skeleton|> class OrderFilters: def filter_tx_id(cls, tx_id, order): """根据交易ID来过滤 :param tx_id: :param order: :return: True: 过滤;False:不过滤""" <|body_0|> def filter_channel(cls, channel_dict, channel, order): """根据交易通道类型过滤 :param channel_dict: :param channel: :param order: :return: True...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class OrderFilters: def filter_tx_id(cls, tx_id, order): """根据交易ID来过滤 :param tx_id: :param order: :return: True: 过滤;False:不过滤""" if not tx_id: return False if order.sys_tx_id == tx_id: return False if order.mch_tx_id == tx_id: return False ...
the_stack_v2_python_sparse
backend/app/logics/backoffice/order_list_helper.py
LyanJin/check-pay
train
0
6082b5b7f56dbd47afdd762443e3491b517aff30
[ "self.A_ = A\nself.coeff_ = coeff\nself.xmin_ = xmin\nself.xSpan_ = xSpan", "nc = len(self.coeff_) / 2\nA = np.ones(nc * 2) * 0.5\nA[1] = x\nA[2::2] = np.sin(2.0 * np.pi * np.arange(1, nc) * (x - self.xmin_) / self.xSpan_)\nA[3::2] = np.cos(2.0 * np.pi * np.arange(1, nc) * (x - self.xmin_) / self.xSpan_)\nreturn ...
<|body_start_0|> self.A_ = A self.coeff_ = coeff self.xmin_ = xmin self.xSpan_ = xSpan <|end_body_0|> <|body_start_1|> nc = len(self.coeff_) / 2 A = np.ones(nc * 2) * 0.5 A[1] = x A[2::2] = np.sin(2.0 * np.pi * np.arange(1, nc) * (x - self.xmin_) / self.x...
Functor for harmonic functions plus offset and drift.
HarmFunctor
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HarmFunctor: """Functor for harmonic functions plus offset and drift.""" def __init__(self, A, coeff, xmin, xSpan): """Initialize.""" <|body_0|> def __call__(self, x): """Yield function call.""" <|body_1|> <|end_skeleton|> <|body_start_0|> self....
stack_v2_sparse_classes_75kplus_train_067455
7,677
permissive
[ { "docstring": "Initialize.", "name": "__init__", "signature": "def __init__(self, A, coeff, xmin, xSpan)" }, { "docstring": "Yield function call.", "name": "__call__", "signature": "def __call__(self, x)" } ]
2
stack_v2_sparse_classes_30k_train_015889
Implement the Python class `HarmFunctor` described below. Class description: Functor for harmonic functions plus offset and drift. Method signatures and docstrings: - def __init__(self, A, coeff, xmin, xSpan): Initialize. - def __call__(self, x): Yield function call.
Implement the Python class `HarmFunctor` described below. Class description: Functor for harmonic functions plus offset and drift. Method signatures and docstrings: - def __init__(self, A, coeff, xmin, xSpan): Initialize. - def __call__(self, x): Yield function call. <|skeleton|> class HarmFunctor: """Functor fo...
0f55444b624f390a674053f62ba1a05506deafa6
<|skeleton|> class HarmFunctor: """Functor for harmonic functions plus offset and drift.""" def __init__(self, A, coeff, xmin, xSpan): """Initialize.""" <|body_0|> def __call__(self, x): """Yield function call.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class HarmFunctor: """Functor for harmonic functions plus offset and drift.""" def __init__(self, A, coeff, xmin, xSpan): """Initialize.""" self.A_ = A self.coeff_ = coeff self.xmin_ = xmin self.xSpan_ = xSpan def __call__(self, x): """Yield function call.""...
the_stack_v2_python_sparse
pygimli/frameworks/harmfit.py
gimli-org/gimli
train
307
17abbb44f11fe6e4d095091fb05d61291939d3b1
[ "self.options.declare('vec_size', types=int, default=1, desc='The number of points at which the vector magnitude is computed')\nself.options.declare('length', types=int, default=3, desc='The length of the input vector at each point')\nself.options.declare('in_name', types=string_types, default='a', desc='The variab...
<|body_start_0|> self.options.declare('vec_size', types=int, default=1, desc='The number of points at which the vector magnitude is computed') self.options.declare('length', types=int, default=3, desc='The length of the input vector at each point') self.options.declare('in_name', types=string_ty...
Computes the unitized vector math:: \\hat{a} = ar{a} / np.sqrt(np.dot(a, a)) where a is of shape (vec_size, n)
VectorUnitizeComp
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VectorUnitizeComp: """Computes the unitized vector math:: \\hat{a} = ar{a} / np.sqrt(np.dot(a, a)) where a is of shape (vec_size, n)""" def initialize(self): """Declare options.""" <|body_0|> def setup(self): """Declare inputs, outputs, and derivatives for the v...
stack_v2_sparse_classes_75kplus_train_067456
4,551
permissive
[ { "docstring": "Declare options.", "name": "initialize", "signature": "def initialize(self)" }, { "docstring": "Declare inputs, outputs, and derivatives for the vector magnitude component.", "name": "setup", "signature": "def setup(self)" }, { "docstring": "Compute the vector mag...
4
null
Implement the Python class `VectorUnitizeComp` described below. Class description: Computes the unitized vector math:: \\hat{a} = ar{a} / np.sqrt(np.dot(a, a)) where a is of shape (vec_size, n) Method signatures and docstrings: - def initialize(self): Declare options. - def setup(self): Declare inputs, outputs, and ...
Implement the Python class `VectorUnitizeComp` described below. Class description: Computes the unitized vector math:: \\hat{a} = ar{a} / np.sqrt(np.dot(a, a)) where a is of shape (vec_size, n) Method signatures and docstrings: - def initialize(self): Declare options. - def setup(self): Declare inputs, outputs, and ...
a4ffd61582b8474953fc309aa540838a14f29dcf
<|skeleton|> class VectorUnitizeComp: """Computes the unitized vector math:: \\hat{a} = ar{a} / np.sqrt(np.dot(a, a)) where a is of shape (vec_size, n)""" def initialize(self): """Declare options.""" <|body_0|> def setup(self): """Declare inputs, outputs, and derivatives for the v...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class VectorUnitizeComp: """Computes the unitized vector math:: \\hat{a} = ar{a} / np.sqrt(np.dot(a, a)) where a is of shape (vec_size, n)""" def initialize(self): """Declare options.""" self.options.declare('vec_size', types=int, default=1, desc='The number of points at which the vector magni...
the_stack_v2_python_sparse
CADRE/attitude_dymos/VectorUnitizeComp.py
johnjasa/CADRE
train
0
1a96938658bb3d23e5e9b6d2b81b9aadc352ee3b
[ "interview: Interview = self.get_object()\nif interview.company.interviews.filter(is_top=True).count() >= 10:\n raise MaxFavoriteInterview\ninterview.is_top = True\ninterview.save()\nserializer: InterviewSerializer = self.get_serializer(interview)\nreturn Response(data=serializer.data, status=status.HTTP_200_OK)...
<|body_start_0|> interview: Interview = self.get_object() if interview.company.interviews.filter(is_top=True).count() >= 10: raise MaxFavoriteInterview interview.is_top = True interview.save() serializer: InterviewSerializer = self.get_serializer(interview) re...
Interview favorite view.
InterviewTop
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InterviewTop: """Interview favorite view.""" def post(self, request: Request, *args: tuple, **kwargs: dict) -> Response: """Set the interview as favorite. :param request: Request :return: Interview instance""" <|body_0|> def delete(self, request: Request, *args: tuple, *...
stack_v2_sparse_classes_75kplus_train_067457
5,804
no_license
[ { "docstring": "Set the interview as favorite. :param request: Request :return: Interview instance", "name": "post", "signature": "def post(self, request: Request, *args: tuple, **kwargs: dict) -> Response" }, { "docstring": "Unset the interview as favorite. :param request: Request :return: Inte...
2
null
Implement the Python class `InterviewTop` described below. Class description: Interview favorite view. Method signatures and docstrings: - def post(self, request: Request, *args: tuple, **kwargs: dict) -> Response: Set the interview as favorite. :param request: Request :return: Interview instance - def delete(self, r...
Implement the Python class `InterviewTop` described below. Class description: Interview favorite view. Method signatures and docstrings: - def post(self, request: Request, *args: tuple, **kwargs: dict) -> Response: Set the interview as favorite. :param request: Request :return: Interview instance - def delete(self, r...
713b9d84ac70d964d46f189ab1f9c7b944b9684b
<|skeleton|> class InterviewTop: """Interview favorite view.""" def post(self, request: Request, *args: tuple, **kwargs: dict) -> Response: """Set the interview as favorite. :param request: Request :return: Interview instance""" <|body_0|> def delete(self, request: Request, *args: tuple, *...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class InterviewTop: """Interview favorite view.""" def post(self, request: Request, *args: tuple, **kwargs: dict) -> Response: """Set the interview as favorite. :param request: Request :return: Interview instance""" interview: Interview = self.get_object() if interview.company.interview...
the_stack_v2_python_sparse
jobadvisor/reviews/views/interview.py
ewgen19892/jobadvisor
train
0
a6b67a05aa54125d2195b5b30c293370bc4e10cc
[ "base_options = _BaseOptions(model_asset_path=model_path)\noptions = InteractiveSegmenterOptions(base_options=base_options)\nreturn cls.create_from_options(options)", "output_streams = [':'.join([_IMAGE_TAG, _IMAGE_OUT_STREAM_NAME])]\nif options.output_confidence_masks:\n output_streams.append(':'.join([_CONFI...
<|body_start_0|> base_options = _BaseOptions(model_asset_path=model_path) options = InteractiveSegmenterOptions(base_options=base_options) return cls.create_from_options(options) <|end_body_0|> <|body_start_1|> output_streams = [':'.join([_IMAGE_TAG, _IMAGE_OUT_STREAM_NAME])] if...
Class that performs interactive segmentation on images. Users can represent user interaction through `RegionOfInterest`, which gives a hint to InteractiveSegmenter to perform segmentation focusing on the given region of interest. The API expects a TFLite model with mandatory TFLite Model Metadata. Input tensor: (kTfLit...
InteractiveSegmenter
[ "Apache-2.0", "dtoa" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InteractiveSegmenter: """Class that performs interactive segmentation on images. Users can represent user interaction through `RegionOfInterest`, which gives a hint to InteractiveSegmenter to perform segmentation focusing on the given region of interest. The API expects a TFLite model with mandat...
stack_v2_sparse_classes_75kplus_train_067458
10,462
permissive
[ { "docstring": "Creates an `InteractiveSegmenter` object from a TensorFlow Lite model and the default `InteractiveSegmenterOptions`. Note that the created `InteractiveSegmenter` instance is in image mode, for performing image segmentation on single image inputs. Args: model_path: Path to the model. Returns: `In...
3
stack_v2_sparse_classes_30k_train_028476
Implement the Python class `InteractiveSegmenter` described below. Class description: Class that performs interactive segmentation on images. Users can represent user interaction through `RegionOfInterest`, which gives a hint to InteractiveSegmenter to perform segmentation focusing on the given region of interest. The...
Implement the Python class `InteractiveSegmenter` described below. Class description: Class that performs interactive segmentation on images. Users can represent user interaction through `RegionOfInterest`, which gives a hint to InteractiveSegmenter to perform segmentation focusing on the given region of interest. The...
007824594bf1d07c7c1467df03a43886f8a4b3ad
<|skeleton|> class InteractiveSegmenter: """Class that performs interactive segmentation on images. Users can represent user interaction through `RegionOfInterest`, which gives a hint to InteractiveSegmenter to perform segmentation focusing on the given region of interest. The API expects a TFLite model with mandat...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class InteractiveSegmenter: """Class that performs interactive segmentation on images. Users can represent user interaction through `RegionOfInterest`, which gives a hint to InteractiveSegmenter to perform segmentation focusing on the given region of interest. The API expects a TFLite model with mandatory TFLite Mo...
the_stack_v2_python_sparse
mediapipe/tasks/python/vision/interactive_segmenter.py
google/mediapipe
train
23,940
874dbeffc3a6c99b07837c4dfa9ac138d6a2b4d6
[ "self._app = app\nself._collection = collection\nself._kv = kv\nself._owner = owner", "excludes_search = 'NOT ' + '(' + ' OR '.join(['type=\"%s\"' % i for i in excludes_list]) + ')'\ngetargs = {'output_mode': 'json', 'search': excludes_search, 'count': 0}\nupdate_times = {}\nresponse, content = splunk.rest.simple...
<|body_start_0|> self._app = app self._collection = collection self._kv = kv self._owner = owner <|end_body_0|> <|body_start_1|> excludes_search = 'NOT ' + '(' + ' OR '.join(['type="%s"' % i for i in excludes_list]) + ')' getargs = {'output_mode': 'json', 'search': exclu...
ThreatIntelMeta
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ThreatIntelMeta: def __init__(self, app, collection, kv, owner): """Initialize a class for handling of threat intel metadata. Arguments: app - The app where the metadata collection is housed. collection - The name of the collection. kv - a KVStoreHandler object. owner - The owner of the ...
stack_v2_sparse_classes_75kplus_train_067459
39,192
no_license
[ { "docstring": "Initialize a class for handling of threat intel metadata. Arguments: app - The app where the metadata collection is housed. collection - The name of the collection. kv - a KVStoreHandler object. owner - The owner of the collection", "name": "__init__", "signature": "def __init__(self, ap...
4
stack_v2_sparse_classes_30k_train_008748
Implement the Python class `ThreatIntelMeta` described below. Class description: Implement the ThreatIntelMeta class. Method signatures and docstrings: - def __init__(self, app, collection, kv, owner): Initialize a class for handling of threat intel metadata. Arguments: app - The app where the metadata collection is ...
Implement the Python class `ThreatIntelMeta` described below. Class description: Implement the ThreatIntelMeta class. Method signatures and docstrings: - def __init__(self, app, collection, kv, owner): Initialize a class for handling of threat intel metadata. Arguments: app - The app where the metadata collection is ...
70689c54d1a67e809bf134dd586b2ea05ff4c431
<|skeleton|> class ThreatIntelMeta: def __init__(self, app, collection, kv, owner): """Initialize a class for handling of threat intel metadata. Arguments: app - The app where the metadata collection is housed. collection - The name of the collection. kv - a KVStoreHandler object. owner - The owner of the ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ThreatIntelMeta: def __init__(self, app, collection, kv, owner): """Initialize a class for handling of threat intel metadata. Arguments: app - The app where the metadata collection is housed. collection - The name of the collection. kv - a KVStoreHandler object. owner - The owner of the collection""" ...
the_stack_v2_python_sparse
DA-ESS-ThreatIntelligence/bin/threat_intelligence_manager.py
reza/es_eventgens
train
0
6a153b4f0ed1d50bede1bdc3be7752c7ee772ded
[ "try:\n if g.user is None or g.user.is_anonymous:\n return self.response_401()\nexcept NoAuthorizationError:\n return self.response_401()\nreturn self.response(200, result=user_response_schema.dump(g.user))", "try:\n if g.user is None or g.user.is_anonymous:\n return self.response_401()\nex...
<|body_start_0|> try: if g.user is None or g.user.is_anonymous: return self.response_401() except NoAuthorizationError: return self.response_401() return self.response(200, result=user_response_schema.dump(g.user)) <|end_body_0|> <|body_start_1|> ...
An api to get information about the current user
CurrentUserRestApi
[ "Apache-2.0", "OFL-1.1" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CurrentUserRestApi: """An api to get information about the current user""" def get_me(self) -> Response: """Get the user object corresponding to the agent making the request --- get: description: >- Returns the user object corresponding to the agent making the request, or returns a 4...
stack_v2_sparse_classes_75kplus_train_067460
3,395
permissive
[ { "docstring": "Get the user object corresponding to the agent making the request --- get: description: >- Returns the user object corresponding to the agent making the request, or returns a 401 error if the user is unauthenticated. responses: 200: description: The current user content: application/json: schema...
2
stack_v2_sparse_classes_30k_train_038258
Implement the Python class `CurrentUserRestApi` described below. Class description: An api to get information about the current user Method signatures and docstrings: - def get_me(self) -> Response: Get the user object corresponding to the agent making the request --- get: description: >- Returns the user object corr...
Implement the Python class `CurrentUserRestApi` described below. Class description: An api to get information about the current user Method signatures and docstrings: - def get_me(self) -> Response: Get the user object corresponding to the agent making the request --- get: description: >- Returns the user object corr...
0945d4a2f46667aebb9b93d0d7685215627ad237
<|skeleton|> class CurrentUserRestApi: """An api to get information about the current user""" def get_me(self) -> Response: """Get the user object corresponding to the agent making the request --- get: description: >- Returns the user object corresponding to the agent making the request, or returns a 4...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CurrentUserRestApi: """An api to get information about the current user""" def get_me(self) -> Response: """Get the user object corresponding to the agent making the request --- get: description: >- Returns the user object corresponding to the agent making the request, or returns a 401 error if t...
the_stack_v2_python_sparse
superset/views/users/api.py
apache-superset/incubator-superset
train
21
f336cd96cf813ec8daa9f4ea73b96fa49779c260
[ "self.file_path = source_file\nself.public = IdentifierSet()\nself.doxygen_groupings = []\nself.interfaces = IdentifierDict()\nself.subroutines = IdentifierDict()\nself.constants = IdentifierDict()\nself.types = IdentifierDict()\nself.parse_file(params_only)", "source_lines = _join_lines(open(self.file_path, 'r')...
<|body_start_0|> self.file_path = source_file self.public = IdentifierSet() self.doxygen_groupings = [] self.interfaces = IdentifierDict() self.subroutines = IdentifierDict() self.constants = IdentifierDict() self.types = IdentifierDict() self.parse_file(p...
Info for an individual source file
SourceFile
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SourceFile: """Info for an individual source file""" def __init__(self, source_file, params_only=False): """Initialise SourceFile object Arguments: source_file -- Path to the source file""" <|body_0|> def parse_file(self, params_only=False): """Run through file o...
stack_v2_sparse_classes_75kplus_train_067461
28,119
no_license
[ { "docstring": "Initialise SourceFile object Arguments: source_file -- Path to the source file", "name": "__init__", "signature": "def __init__(self, source_file, params_only=False)" }, { "docstring": "Run through file once, getting everything we'll need", "name": "parse_file", "signatur...
2
stack_v2_sparse_classes_30k_train_035884
Implement the Python class `SourceFile` described below. Class description: Info for an individual source file Method signatures and docstrings: - def __init__(self, source_file, params_only=False): Initialise SourceFile object Arguments: source_file -- Path to the source file - def parse_file(self, params_only=False...
Implement the Python class `SourceFile` described below. Class description: Info for an individual source file Method signatures and docstrings: - def __init__(self, source_file, params_only=False): Initialise SourceFile object Arguments: source_file -- Path to the source file - def parse_file(self, params_only=False...
38c0755396efea44feb87a4c01b5e956d6736691
<|skeleton|> class SourceFile: """Info for an individual source file""" def __init__(self, source_file, params_only=False): """Initialise SourceFile object Arguments: source_file -- Path to the source file""" <|body_0|> def parse_file(self, params_only=False): """Run through file o...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SourceFile: """Info for an individual source file""" def __init__(self, source_file, params_only=False): """Initialise SourceFile object Arguments: source_file -- Path to the source file""" self.file_path = source_file self.public = IdentifierSet() self.doxygen_groupings =...
the_stack_v2_python_sparse
bindings/generate_bindings/parse.py
OpenCMISS/iron
train
10
40e198602353e77b64080812be3ba2809408dbbe
[ "super().__init__(**kwargs)\ntry:\n from InstructorEmbedding import INSTRUCTOR\n self.client = INSTRUCTOR(self.model_name)\nexcept ImportError as e:\n raise ValueError('Dependencies for InstructorEmbedding not found.') from e", "instruction_pairs = [[self.embed_instruction, text] for text in texts]\nembe...
<|body_start_0|> super().__init__(**kwargs) try: from InstructorEmbedding import INSTRUCTOR self.client = INSTRUCTOR(self.model_name) except ImportError as e: raise ValueError('Dependencies for InstructorEmbedding not found.') from e <|end_body_0|> <|body_sta...
Wrapper around sentence_transformers embedding models. To use, you should have the ``sentence_transformers`` and ``InstructorEmbedding`` python package installed. Example: .. code-block:: python from langchain.embeddings import HuggingFaceInstructEmbeddings model_name = "hkunlp/instructor-large" hf = HuggingFaceInstruc...
HuggingFaceInstructEmbeddings
[ "LicenseRef-scancode-generic-cla", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HuggingFaceInstructEmbeddings: """Wrapper around sentence_transformers embedding models. To use, you should have the ``sentence_transformers`` and ``InstructorEmbedding`` python package installed. Example: .. code-block:: python from langchain.embeddings import HuggingFaceInstructEmbeddings model...
stack_v2_sparse_classes_75kplus_train_067462
4,545
permissive
[ { "docstring": "Initialize the sentence_transformer.", "name": "__init__", "signature": "def __init__(self, **kwargs: Any)" }, { "docstring": "Compute doc embeddings using a HuggingFace instruct model. Args: texts: The list of texts to embed. Returns: List of embeddings, one for each text.", ...
3
stack_v2_sparse_classes_30k_train_020700
Implement the Python class `HuggingFaceInstructEmbeddings` described below. Class description: Wrapper around sentence_transformers embedding models. To use, you should have the ``sentence_transformers`` and ``InstructorEmbedding`` python package installed. Example: .. code-block:: python from langchain.embeddings imp...
Implement the Python class `HuggingFaceInstructEmbeddings` described below. Class description: Wrapper around sentence_transformers embedding models. To use, you should have the ``sentence_transformers`` and ``InstructorEmbedding`` python package installed. Example: .. code-block:: python from langchain.embeddings imp...
b8f29af7f3c24cf3a4554bebfa2053064467fbdb
<|skeleton|> class HuggingFaceInstructEmbeddings: """Wrapper around sentence_transformers embedding models. To use, you should have the ``sentence_transformers`` and ``InstructorEmbedding`` python package installed. Example: .. code-block:: python from langchain.embeddings import HuggingFaceInstructEmbeddings model...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class HuggingFaceInstructEmbeddings: """Wrapper around sentence_transformers embedding models. To use, you should have the ``sentence_transformers`` and ``InstructorEmbedding`` python package installed. Example: .. code-block:: python from langchain.embeddings import HuggingFaceInstructEmbeddings model_name = "hkun...
the_stack_v2_python_sparse
langchain/embeddings/huggingface.py
microsoft/MM-REACT
train
705
803ab85ac425511dcee71923e21499053c053a5d
[ "self.matrix = matrix\nself.prefix_sum = [[0 for i in range(len(matrix[0]))] for j in range(len(matrix))]\nfor i in range(len(matrix)):\n for j in range(len(matrix[0])):\n if i == 0:\n self.prefix_sum[i][j] = matrix[i][j]\n else:\n self.prefix_sum[i][j] = matrix[i][j] + self.p...
<|body_start_0|> self.matrix = matrix self.prefix_sum = [[0 for i in range(len(matrix[0]))] for j in range(len(matrix))] for i in range(len(matrix)): for j in range(len(matrix[0])): if i == 0: self.prefix_sum[i][j] = matrix[i][j] el...
NumMatrix
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumMatrix: def __init__(self, matrix): """:type matrix: List[List[int]]""" <|body_0|> def update(self, row, col, val): """:type row: int :type col: int :type val: int :rtype: void""" <|body_1|> def sumRegion(self, row1, col1, row2, col2): """:typ...
stack_v2_sparse_classes_75kplus_train_067463
16,103
no_license
[ { "docstring": ":type matrix: List[List[int]]", "name": "__init__", "signature": "def __init__(self, matrix)" }, { "docstring": ":type row: int :type col: int :type val: int :rtype: void", "name": "update", "signature": "def update(self, row, col, val)" }, { "docstring": ":type r...
3
stack_v2_sparse_classes_30k_train_031417
Implement the Python class `NumMatrix` described below. Class description: Implement the NumMatrix class. Method signatures and docstrings: - def __init__(self, matrix): :type matrix: List[List[int]] - def update(self, row, col, val): :type row: int :type col: int :type val: int :rtype: void - def sumRegion(self, row...
Implement the Python class `NumMatrix` described below. Class description: Implement the NumMatrix class. Method signatures and docstrings: - def __init__(self, matrix): :type matrix: List[List[int]] - def update(self, row, col, val): :type row: int :type col: int :type val: int :rtype: void - def sumRegion(self, row...
fa3704af37d9e04ab6fd13b7b17cc83c239946f7
<|skeleton|> class NumMatrix: def __init__(self, matrix): """:type matrix: List[List[int]]""" <|body_0|> def update(self, row, col, val): """:type row: int :type col: int :type val: int :rtype: void""" <|body_1|> def sumRegion(self, row1, col1, row2, col2): """:typ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NumMatrix: def __init__(self, matrix): """:type matrix: List[List[int]]""" self.matrix = matrix self.prefix_sum = [[0 for i in range(len(matrix[0]))] for j in range(len(matrix))] for i in range(len(matrix)): for j in range(len(matrix[0])): if i == 0:...
the_stack_v2_python_sparse
lintcode/medium/817_range_sum_query_2d_mutable.py
simonfqy/SimonfqyGitHub
train
2
93499e764ab2fedf78334f02a049a6fcf22bbf53
[ "all_data = [self.match.serialize(), struct.pack(self.FORMAT2, self.duration_sec, self.duration_nsec, self.priority, self.idle_timeout, self.hard_timeout, self.cookie, self.packet_count, self.byte_count)]\nfor a in self.actions:\n all_data.extend(serialize_action(a))\nlength = self.FORMAT1_LENGTH + sum((len(d) f...
<|body_start_0|> all_data = [self.match.serialize(), struct.pack(self.FORMAT2, self.duration_sec, self.duration_nsec, self.priority, self.idle_timeout, self.hard_timeout, self.cookie, self.packet_count, self.byte_count)] for a in self.actions: all_data.extend(serialize_action(a)) len...
The stats about an individual flow. The attributes of the flow statistics are: table_id: The ID of the table the flow came from. match: A Match object describing the fields of the flow. duration_sec: Time the flow has been alive in seconds, as a 32-bit unsigned integer. duration_nsec: Time flow has been alive in nanose...
FlowStats
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FlowStats: """The stats about an individual flow. The attributes of the flow statistics are: table_id: The ID of the table the flow came from. match: A Match object describing the fields of the flow. duration_sec: Time the flow has been alive in seconds, as a 32-bit unsigned integer. duration_nse...
stack_v2_sparse_classes_75kplus_train_067464
17,066
permissive
[ { "docstring": "Serialize this object into an OpenFlow ofp_flow_stats. The returned string can be passed to deserialize() to recreate a copy of this object. Args: serialize_action: A callable with signature serialize_action(action) that takes an Action* object and returns the serialized form of the action as a ...
2
stack_v2_sparse_classes_30k_train_005723
Implement the Python class `FlowStats` described below. Class description: The stats about an individual flow. The attributes of the flow statistics are: table_id: The ID of the table the flow came from. match: A Match object describing the fields of the flow. duration_sec: Time the flow has been alive in seconds, as ...
Implement the Python class `FlowStats` described below. Class description: The stats about an individual flow. The attributes of the flow statistics are: table_id: The ID of the table the flow came from. match: A Match object describing the fields of the flow. duration_sec: Time the flow has been alive in seconds, as ...
4ef1783fc74320e66ee7a71576dc91511f238a81
<|skeleton|> class FlowStats: """The stats about an individual flow. The attributes of the flow statistics are: table_id: The ID of the table the flow came from. match: A Match object describing the fields of the flow. duration_sec: Time the flow has been alive in seconds, as a 32-bit unsigned integer. duration_nse...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FlowStats: """The stats about an individual flow. The attributes of the flow statistics are: table_id: The ID of the table the flow came from. match: A Match object describing the fields of the flow. duration_sec: Time the flow has been alive in seconds, as a 32-bit unsigned integer. duration_nsec: Time flow ...
the_stack_v2_python_sparse
src/openfaucet/ofstats.py
bharathi26/openfaucet
train
0
88275f7142b479087596e4887fbb824f1f9597aa
[ "params = base.get_params(None, locals())\nurl = '{0}/deals'.format(self.get_url())\nreturn (http.Request('GET', url, params), parsers.parse_json)", "params = base.get_params(None, locals())\nurl = '{0}/conversion_statistics'.format(self.get_url())\nreturn (http.Request('GET', url, params), parsers.parse_json)", ...
<|body_start_0|> params = base.get_params(None, locals()) url = '{0}/deals'.format(self.get_url()) return (http.Request('GET', url, params), parsers.parse_json) <|end_body_0|> <|body_start_1|> params = base.get_params(None, locals()) url = '{0}/conversion_statistics'.format(self...
Pipeline
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Pipeline: def deals(self, filter_id=None, user_id=None, everyone=None, stage_id=None, start=None, limit=None): """Lists deals in a specific pipeline across all its stages. Upstream documentation: https://developers.pipedrive.com/v1#methods-Pipelines""" <|body_0|> def convers...
stack_v2_sparse_classes_75kplus_train_067465
2,938
permissive
[ { "docstring": "Lists deals in a specific pipeline across all its stages. Upstream documentation: https://developers.pipedrive.com/v1#methods-Pipelines", "name": "deals", "signature": "def deals(self, filter_id=None, user_id=None, everyone=None, stage_id=None, start=None, limit=None)" }, { "docs...
3
stack_v2_sparse_classes_30k_train_051583
Implement the Python class `Pipeline` described below. Class description: Implement the Pipeline class. Method signatures and docstrings: - def deals(self, filter_id=None, user_id=None, everyone=None, stage_id=None, start=None, limit=None): Lists deals in a specific pipeline across all its stages. Upstream documentat...
Implement the Python class `Pipeline` described below. Class description: Implement the Pipeline class. Method signatures and docstrings: - def deals(self, filter_id=None, user_id=None, everyone=None, stage_id=None, start=None, limit=None): Lists deals in a specific pipeline across all its stages. Upstream documentat...
25caa745a104c8dc209584fa359294c65dbf88bb
<|skeleton|> class Pipeline: def deals(self, filter_id=None, user_id=None, everyone=None, stage_id=None, start=None, limit=None): """Lists deals in a specific pipeline across all its stages. Upstream documentation: https://developers.pipedrive.com/v1#methods-Pipelines""" <|body_0|> def convers...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Pipeline: def deals(self, filter_id=None, user_id=None, everyone=None, stage_id=None, start=None, limit=None): """Lists deals in a specific pipeline across all its stages. Upstream documentation: https://developers.pipedrive.com/v1#methods-Pipelines""" params = base.get_params(None, locals()) ...
the_stack_v2_python_sparse
libsaas/services/pipedrive/pipelines.py
piplcom/libsaas
train
1
00443d1ea00a666e3243f663a74f5c852162aecc
[ "metByAny = False\nfor singleValue in value:\n metByAny = self.MetBy(singleValue, ValueType.SINGLE_VALUE)\n if metByAny:\n break\nreturn metByAny", "metByAll = True\nfor singleValue in value:\n metByAll = self.MetBy(singleValue, ValueType.SINGLE_VALUE)\n if metByAll == False:\n break\nre...
<|body_start_0|> metByAny = False for singleValue in value: metByAny = self.MetBy(singleValue, ValueType.SINGLE_VALUE) if metByAny: break return metByAny <|end_body_0|> <|body_start_1|> metByAll = True for singleValue in value: ...
Base-class for all conditions.
Condition
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Condition: """Base-class for all conditions.""" def __MetByAny(self, value): """In: value - list of values to test. Out: True if condition was met by any in list, False otherwise.""" <|body_0|> def __MetByAll(self, value): """In: value - list of values to test. O...
stack_v2_sparse_classes_75kplus_train_067466
6,558
no_license
[ { "docstring": "In: value - list of values to test. Out: True if condition was met by any in list, False otherwise.", "name": "__MetByAny", "signature": "def __MetByAny(self, value)" }, { "docstring": "In: value - list of values to test. Out: True if condition was met by all in list, False other...
3
stack_v2_sparse_classes_30k_train_012521
Implement the Python class `Condition` described below. Class description: Base-class for all conditions. Method signatures and docstrings: - def __MetByAny(self, value): In: value - list of values to test. Out: True if condition was met by any in list, False otherwise. - def __MetByAll(self, value): In: value - list...
Implement the Python class `Condition` described below. Class description: Base-class for all conditions. Method signatures and docstrings: - def __MetByAny(self, value): In: value - list of values to test. Out: True if condition was met by any in list, False otherwise. - def __MetByAll(self, value): In: value - list...
5e7cc7de3495145501ca53deb9efee2233ab7e1c
<|skeleton|> class Condition: """Base-class for all conditions.""" def __MetByAny(self, value): """In: value - list of values to test. Out: True if condition was met by any in list, False otherwise.""" <|body_0|> def __MetByAll(self, value): """In: value - list of values to test. O...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Condition: """Base-class for all conditions.""" def __MetByAny(self, value): """In: value - list of values to test. Out: True if condition was met by any in list, False otherwise.""" metByAny = False for singleValue in value: metByAny = self.MetBy(singleValue, ValueTyp...
the_stack_v2_python_sparse
Extensions/Default/FPythonCode/FOperationsRuleEngine.py
webclinic017/fa-absa-py3
train
0
f89139c2774cece69f0e7269000d6edd245210ef
[ "tests = [((8, 8), 1, [(8, 8)]), ((8, 8), 2, [(8, 8), (4, 4)]), ((8, 8), 3, [(8, 8), (4, 4), (2, 2)]), ((8, 8), 4, [(8, 8), (4, 4), (2, 2), (1, 1)])]\nfor i, ((width, height), levels, want_layers) in enumerate(tests):\n image = Image()\n image.create(width, height)\n pyramid = Pyramid(image, levels)\n h...
<|body_start_0|> tests = [((8, 8), 1, [(8, 8)]), ((8, 8), 2, [(8, 8), (4, 4)]), ((8, 8), 3, [(8, 8), (4, 4), (2, 2)]), ((8, 8), 4, [(8, 8), (4, 4), (2, 2), (1, 1)])] for i, ((width, height), levels, want_layers) in enumerate(tests): image = Image() image.create(width, height) ...
Tests for the Pyramid class.
TestPyramid
[ "MIT", "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestPyramid: """Tests for the Pyramid class.""" def test_init(self): """Tests the Pyramid.__init__() function.""" <|body_0|> def test_reconstruct(self): """Tests the Pyramid.reconstruct() function.""" <|body_1|> def test_items(self): """Tests...
stack_v2_sparse_classes_75kplus_train_067467
2,570
permissive
[ { "docstring": "Tests the Pyramid.__init__() function.", "name": "test_init", "signature": "def test_init(self)" }, { "docstring": "Tests the Pyramid.reconstruct() function.", "name": "test_reconstruct", "signature": "def test_reconstruct(self)" }, { "docstring": "Tests the Pyram...
3
stack_v2_sparse_classes_30k_train_024044
Implement the Python class `TestPyramid` described below. Class description: Tests for the Pyramid class. Method signatures and docstrings: - def test_init(self): Tests the Pyramid.__init__() function. - def test_reconstruct(self): Tests the Pyramid.reconstruct() function. - def test_items(self): Tests the Pyramid.__...
Implement the Python class `TestPyramid` described below. Class description: Tests for the Pyramid class. Method signatures and docstrings: - def test_init(self): Tests the Pyramid.__init__() function. - def test_reconstruct(self): Tests the Pyramid.reconstruct() function. - def test_items(self): Tests the Pyramid.__...
7e7282698befd53383cbd6566039340babb0a289
<|skeleton|> class TestPyramid: """Tests for the Pyramid class.""" def test_init(self): """Tests the Pyramid.__init__() function.""" <|body_0|> def test_reconstruct(self): """Tests the Pyramid.reconstruct() function.""" <|body_1|> def test_items(self): """Tests...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestPyramid: """Tests for the Pyramid class.""" def test_init(self): """Tests the Pyramid.__init__() function.""" tests = [((8, 8), 1, [(8, 8)]), ((8, 8), 2, [(8, 8), (4, 4)]), ((8, 8), 3, [(8, 8), (4, 4), (2, 2)]), ((8, 8), 4, [(8, 8), (4, 4), (2, 2), (1, 1)])] for i, ((width, he...
the_stack_v2_python_sparse
sandbox/image/pyramid_test.py
Mandrenkov/SVBRDF-Texture-Synthesis
train
3
359eabcdcddd484abe382f0c95c6e34762a8ffcd
[ "np.random.seed(seed)\nself.n_inputs = n_inputs\nself.n_outputs = n_outputs\nself.activation = activation\nself.w = np.random.randn(self.n_inputs, self.n_outputs)\nself.b = np.random.randn(1, self.n_outputs)", "self.z = X @ self.w + self.b\nself.a = self.activation(self.z)\nself.a_deriv = self.activation.deriv(se...
<|body_start_0|> np.random.seed(seed) self.n_inputs = n_inputs self.n_outputs = n_outputs self.activation = activation self.w = np.random.randn(self.n_inputs, self.n_outputs) self.b = np.random.randn(1, self.n_outputs) <|end_body_0|> <|body_start_1|> self.z = X @...
DenseLayer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DenseLayer: def __init__(self, n_inputs, n_outputs, activation, seed=1004): """Create one layer in the neural network. Keyword arguments: n_inputs -- number of inputs to the layer n_outputs -- number of outputs to the layer activation -- activation function used on input to get output"""...
stack_v2_sparse_classes_75kplus_train_067468
5,478
no_license
[ { "docstring": "Create one layer in the neural network. Keyword arguments: n_inputs -- number of inputs to the layer n_outputs -- number of outputs to the layer activation -- activation function used on input to get output", "name": "__init__", "signature": "def __init__(self, n_inputs, n_outputs, activ...
2
null
Implement the Python class `DenseLayer` described below. Class description: Implement the DenseLayer class. Method signatures and docstrings: - def __init__(self, n_inputs, n_outputs, activation, seed=1004): Create one layer in the neural network. Keyword arguments: n_inputs -- number of inputs to the layer n_outputs...
Implement the Python class `DenseLayer` described below. Class description: Implement the DenseLayer class. Method signatures and docstrings: - def __init__(self, n_inputs, n_outputs, activation, seed=1004): Create one layer in the neural network. Keyword arguments: n_inputs -- number of inputs to the layer n_outputs...
f9fbe289ebe1e90dddf288a6e713cabc8d02b1f0
<|skeleton|> class DenseLayer: def __init__(self, n_inputs, n_outputs, activation, seed=1004): """Create one layer in the neural network. Keyword arguments: n_inputs -- number of inputs to the layer n_outputs -- number of outputs to the layer activation -- activation function used on input to get output"""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DenseLayer: def __init__(self, n_inputs, n_outputs, activation, seed=1004): """Create one layer in the neural network. Keyword arguments: n_inputs -- number of inputs to the layer n_outputs -- number of outputs to the layer activation -- activation function used on input to get output""" np.ra...
the_stack_v2_python_sparse
Project2/source/NeuralNetwork.py
elinfi/FYS-STK4155
train
1
2ec6bc1ebc4c0d9a6f0ab7cb6626d7b8051cb91e
[ "salt = hashlib.sha1(str(random.random())).hexdigest()[:5]\nuser_pk = str(user.pk)\ntoken_key = hashlib.sha1(salt + user_pk).hexdigest()\nreturn self.create(token_key=token_key, created_by=user, expiration_days=expiration_days, url=url, url_params=url_params)", "token_key = request.GET.get('tk')\nif token_key and...
<|body_start_0|> salt = hashlib.sha1(str(random.random())).hexdigest()[:5] user_pk = str(user.pk) token_key = hashlib.sha1(salt + user_pk).hexdigest() return self.create(token_key=token_key, created_by=user, expiration_days=expiration_days, url=url, url_params=url_params) <|end_body_0|> ...
Custom manager for the ``UrlToken`` model. The methods defined here provide shortcuts for token creation and for cleaning out expired tokens.
UrlTokenManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UrlTokenManager: """Custom manager for the ``UrlToken`` model. The methods defined here provide shortcuts for token creation and for cleaning out expired tokens.""" def create_url_token(self, user, expiration_days, url, url_params=None): """Create a ``UrlToken`` for a given ``url`` a...
stack_v2_sparse_classes_75kplus_train_067469
2,760
no_license
[ { "docstring": "Create a ``UrlToken`` for a given ``url`` and ``days``, and return the ``UrlToken``. The token key for the ``UrlToken`` will be a SHA1 hash, generated from a combination of the ``url``, days and a random salt.", "name": "create_url_token", "signature": "def create_url_token(self, user, e...
2
stack_v2_sparse_classes_30k_test_002202
Implement the Python class `UrlTokenManager` described below. Class description: Custom manager for the ``UrlToken`` model. The methods defined here provide shortcuts for token creation and for cleaning out expired tokens. Method signatures and docstrings: - def create_url_token(self, user, expiration_days, url, url_...
Implement the Python class `UrlTokenManager` described below. Class description: Custom manager for the ``UrlToken`` model. The methods defined here provide shortcuts for token creation and for cleaning out expired tokens. Method signatures and docstrings: - def create_url_token(self, user, expiration_days, url, url_...
8d8be00502977431297d2138f72d153695b9f06a
<|skeleton|> class UrlTokenManager: """Custom manager for the ``UrlToken`` model. The methods defined here provide shortcuts for token creation and for cleaning out expired tokens.""" def create_url_token(self, user, expiration_days, url, url_params=None): """Create a ``UrlToken`` for a given ``url`` a...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UrlTokenManager: """Custom manager for the ``UrlToken`` model. The methods defined here provide shortcuts for token creation and for cleaning out expired tokens.""" def create_url_token(self, user, expiration_days, url, url_params=None): """Create a ``UrlToken`` for a given ``url`` and ``days``, ...
the_stack_v2_python_sparse
tokens/models.py
qazmaxlow/edms
train
0
39017c91fcb49dc9a62c590010bfd0dd887e318e
[ "super(ProxyNCALoss, self).__init__()\nself.num_proxies = num_proxies\nself.embedding_dim = embedding_dim\nself.PROXIES = torch.nn.Parameter(torch.randn(num_proxies, self.embedding_dim) / 8)\nself.all_classes = torch.arange(num_proxies)", "batch = 3 * torch.nn.functional.normalize(batch, dim=1)\nPROXIES = 3 * tor...
<|body_start_0|> super(ProxyNCALoss, self).__init__() self.num_proxies = num_proxies self.embedding_dim = embedding_dim self.PROXIES = torch.nn.Parameter(torch.randn(num_proxies, self.embedding_dim) / 8) self.all_classes = torch.arange(num_proxies) <|end_body_0|> <|body_start_1|...
ProxyNCALoss
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProxyNCALoss: def __init__(self, num_proxies, embedding_dim): """Basic ProxyNCA Loss as proposed in 'No Fuss Distance Metric Learning using Proxies'. Args: num_proxies: int, number of proxies to use to estimate data groups. Usually set to number of classes. embedding_dim: int, Required t...
stack_v2_sparse_classes_75kplus_train_067470
29,027
no_license
[ { "docstring": "Basic ProxyNCA Loss as proposed in 'No Fuss Distance Metric Learning using Proxies'. Args: num_proxies: int, number of proxies to use to estimate data groups. Usually set to number of classes. embedding_dim: int, Required to generate initial proxies which are the same size as the actual data emb...
2
stack_v2_sparse_classes_30k_val_001869
Implement the Python class `ProxyNCALoss` described below. Class description: Implement the ProxyNCALoss class. Method signatures and docstrings: - def __init__(self, num_proxies, embedding_dim): Basic ProxyNCA Loss as proposed in 'No Fuss Distance Metric Learning using Proxies'. Args: num_proxies: int, number of pro...
Implement the Python class `ProxyNCALoss` described below. Class description: Implement the ProxyNCALoss class. Method signatures and docstrings: - def __init__(self, num_proxies, embedding_dim): Basic ProxyNCA Loss as proposed in 'No Fuss Distance Metric Learning using Proxies'. Args: num_proxies: int, number of pro...
7e55a422588c1d1e00f35a3d3a3ff896cce59e18
<|skeleton|> class ProxyNCALoss: def __init__(self, num_proxies, embedding_dim): """Basic ProxyNCA Loss as proposed in 'No Fuss Distance Metric Learning using Proxies'. Args: num_proxies: int, number of proxies to use to estimate data groups. Usually set to number of classes. embedding_dim: int, Required t...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ProxyNCALoss: def __init__(self, num_proxies, embedding_dim): """Basic ProxyNCA Loss as proposed in 'No Fuss Distance Metric Learning using Proxies'. Args: num_proxies: int, number of proxies to use to estimate data groups. Usually set to number of classes. embedding_dim: int, Required to generate ini...
the_stack_v2_python_sparse
generated/test_Confusezius_Deep_Metric_Learning_Baselines.py
jansel/pytorch-jit-paritybench
train
35
08d6d950974a21c19ecf1ae273ee63ceb2f47534
[ "with self.assertLogs(level='WARNING') as log_cm:\n stdout, stderr = self.redirect_streams(lambda: show.show_files([]))\n self.assertEqual(len(log_cm.output), 1)\n self.assertIn('No items to show', log_cm.output[0])\nself.assertEqual(stdout, '')\nself.assertEqual(stderr, '')", "with self.assertLogs(level...
<|body_start_0|> with self.assertLogs(level='WARNING') as log_cm: stdout, stderr = self.redirect_streams(lambda: show.show_files([])) self.assertEqual(len(log_cm.output), 1) self.assertIn('No items to show', log_cm.output[0]) self.assertEqual(stdout, '') self....
Basic tests of show_files
TestShowFiles
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestShowFiles: """Basic tests of show_files""" def test_show_files_empty_list(self): """An empty list in should show nothing""" <|body_0|> def test_show_files_empty_string(self): """An empty string in should show nothing""" <|body_1|> def test_show_f...
stack_v2_sparse_classes_75kplus_train_067471
5,423
no_license
[ { "docstring": "An empty list in should show nothing", "name": "test_show_files_empty_list", "signature": "def test_show_files_empty_list(self)" }, { "docstring": "An empty string in should show nothing", "name": "test_show_files_empty_string", "signature": "def test_show_files_empty_str...
4
stack_v2_sparse_classes_30k_train_023537
Implement the Python class `TestShowFiles` described below. Class description: Basic tests of show_files Method signatures and docstrings: - def test_show_files_empty_list(self): An empty list in should show nothing - def test_show_files_empty_string(self): An empty string in should show nothing - def test_show_files...
Implement the Python class `TestShowFiles` described below. Class description: Basic tests of show_files Method signatures and docstrings: - def test_show_files_empty_list(self): An empty list in should show nothing - def test_show_files_empty_string(self): An empty string in should show nothing - def test_show_files...
539868dab2041b7694c0d53e8e74cf1b5b033653
<|skeleton|> class TestShowFiles: """Basic tests of show_files""" def test_show_files_empty_list(self): """An empty list in should show nothing""" <|body_0|> def test_show_files_empty_string(self): """An empty string in should show nothing""" <|body_1|> def test_show_f...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestShowFiles: """Basic tests of show_files""" def test_show_files_empty_list(self): """An empty list in should show nothing""" with self.assertLogs(level='WARNING') as log_cm: stdout, stderr = self.redirect_streams(lambda: show.show_files([])) self.assertEqual(len...
the_stack_v2_python_sparse
test_igseq/test_show.py
ShawHahnLab/igseq
train
1
6d3a95a0160ff8b7166a9b4013fc7c57c508e172
[ "super(MLLM, self).__init__()\nself.device = opt.device\nself.max_sequence_len = opt.max_sequence_length\nsentiment_lexicon = opt.sentiment_dic\nif sentiment_lexicon is not None:\n sentiment_lexicon = torch.tensor(sentiment_lexicon, dtype=torch.float)\nself.num_hidden_layers = len(str(opt.ngram_value).split(',')...
<|body_start_0|> super(MLLM, self).__init__() self.device = opt.device self.max_sequence_len = opt.max_sequence_length sentiment_lexicon = opt.sentiment_dic if sentiment_lexicon is not None: sentiment_lexicon = torch.tensor(sentiment_lexicon, dtype=torch.float) ...
MLLM
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MLLM: def __init__(self, opt): """max_sequence_len: input sentence length embedding_dim: input dimension num_measurements: number of measurement units, also the output dimension""" <|body_0|> def forward(self, input_seq): """In the forward function we accept a Variab...
stack_v2_sparse_classes_75kplus_train_067472
4,295
no_license
[ { "docstring": "max_sequence_len: input sentence length embedding_dim: input dimension num_measurements: number of measurement units, also the output dimension", "name": "__init__", "signature": "def __init__(self, opt)" }, { "docstring": "In the forward function we accept a Variable of input da...
2
stack_v2_sparse_classes_30k_train_032654
Implement the Python class `MLLM` described below. Class description: Implement the MLLM class. Method signatures and docstrings: - def __init__(self, opt): max_sequence_len: input sentence length embedding_dim: input dimension num_measurements: number of measurement units, also the output dimension - def forward(sel...
Implement the Python class `MLLM` described below. Class description: Implement the MLLM class. Method signatures and docstrings: - def __init__(self, opt): max_sequence_len: input sentence length embedding_dim: input dimension num_measurements: number of measurement units, also the output dimension - def forward(sel...
de9a632fd2895d7341b03d6ef8149e7670bd78db
<|skeleton|> class MLLM: def __init__(self, opt): """max_sequence_len: input sentence length embedding_dim: input dimension num_measurements: number of measurement units, also the output dimension""" <|body_0|> def forward(self, input_seq): """In the forward function we accept a Variab...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MLLM: def __init__(self, opt): """max_sequence_len: input sentence length embedding_dim: input dimension num_measurements: number of measurement units, also the output dimension""" super(MLLM, self).__init__() self.device = opt.device self.max_sequence_len = opt.max_sequence_le...
the_stack_v2_python_sparse
models/classification/MLLM.py
qiuchili/qnn_torch
train
17
367d3c25983cd2edb62cf274faa55796a342a6ed
[ "m, n = (len(heights), len(heights[0]))\npos = [(0, 1), (0, -1), (1, 0), (-1, 0)]\n\ndef dfs(x, y):\n if (x, y) in memo:\n return memo[x, y]\n visited.add((x, y))\n ans = 0\n if x == 0 or y == 0:\n ans |= 2\n if x == m - 1 or y == n - 1:\n ans |= 1\n print(x, y, ans)\n for ...
<|body_start_0|> m, n = (len(heights), len(heights[0])) pos = [(0, 1), (0, -1), (1, 0), (-1, 0)] def dfs(x, y): if (x, y) in memo: return memo[x, y] visited.add((x, y)) ans = 0 if x == 0 or y == 0: ans |= 2 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def pacificAtlantic(self, heights: List[List[int]]) -> List[List[int]]: """思路:顺流而下 1. 从大陆开始流向太平洋和大西洋,通过两位二进制记录最终流向,如果能流向太平洋,ans |=2,如果能流向大西洋,ans |=1 1. 00:都不能流入 2. 01:能流向大西洋 3. 10:能流向太平洋 4. 11:能流向太平洋和大西洋 2. 当某个点对应的ans=3时,说明既能流向太平洋也能流向大西洋 @param heights: @return:""" <|bo...
stack_v2_sparse_classes_75kplus_train_067473
3,937
no_license
[ { "docstring": "思路:顺流而下 1. 从大陆开始流向太平洋和大西洋,通过两位二进制记录最终流向,如果能流向太平洋,ans |=2,如果能流向大西洋,ans |=1 1. 00:都不能流入 2. 01:能流向大西洋 3. 10:能流向太平洋 4. 11:能流向太平洋和大西洋 2. 当某个点对应的ans=3时,说明既能流向太平洋也能流向大西洋 @param heights: @return:", "name": "pacificAtlantic", "signature": "def pacificAtlantic(self, heights: List[List[int]]) -> Li...
2
stack_v2_sparse_classes_30k_train_054401
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def pacificAtlantic(self, heights: List[List[int]]) -> List[List[int]]: 思路:顺流而下 1. 从大陆开始流向太平洋和大西洋,通过两位二进制记录最终流向,如果能流向太平洋,ans |=2,如果能流向大西洋,ans |=1 1. 00:都不能流入 2. 01:能流向大西洋 3. 10:能...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def pacificAtlantic(self, heights: List[List[int]]) -> List[List[int]]: 思路:顺流而下 1. 从大陆开始流向太平洋和大西洋,通过两位二进制记录最终流向,如果能流向太平洋,ans |=2,如果能流向大西洋,ans |=1 1. 00:都不能流入 2. 01:能流向大西洋 3. 10:能...
e43ee86c5a8cdb808da09b4b6138e10275abadb5
<|skeleton|> class Solution: def pacificAtlantic(self, heights: List[List[int]]) -> List[List[int]]: """思路:顺流而下 1. 从大陆开始流向太平洋和大西洋,通过两位二进制记录最终流向,如果能流向太平洋,ans |=2,如果能流向大西洋,ans |=1 1. 00:都不能流入 2. 01:能流向大西洋 3. 10:能流向太平洋 4. 11:能流向太平洋和大西洋 2. 当某个点对应的ans=3时,说明既能流向太平洋也能流向大西洋 @param heights: @return:""" <|bo...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def pacificAtlantic(self, heights: List[List[int]]) -> List[List[int]]: """思路:顺流而下 1. 从大陆开始流向太平洋和大西洋,通过两位二进制记录最终流向,如果能流向太平洋,ans |=2,如果能流向大西洋,ans |=1 1. 00:都不能流入 2. 01:能流向大西洋 3. 10:能流向太平洋 4. 11:能流向太平洋和大西洋 2. 当某个点对应的ans=3时,说明既能流向太平洋也能流向大西洋 @param heights: @return:""" m, n = (len(height...
the_stack_v2_python_sparse
LeetCode/深度优先搜索(dfs)/岛屿问题/417. 太平洋大西洋水流问题.py
yiming1012/MyLeetCode
train
2
9e3b840c54734cffbcb4fa7481f0ee433f2b74f0
[ "super(BinaryFocalLoss, self).__init__(name=name)\nself.gamma = gamma\nself.alpha = alpha", "y_true = tf.cast(y_true, tf.float32)\nepsilon = K.epsilon()\ny_pred = K.clip(y_pred, epsilon, 1.0 - epsilon)\np_t = tf.where(K.equal(y_true, 1), y_pred, 1 - y_pred)\nalpha_factor = K.ones_like(y_true) * self.alpha\nalpha_...
<|body_start_0|> super(BinaryFocalLoss, self).__init__(name=name) self.gamma = gamma self.alpha = alpha <|end_body_0|> <|body_start_1|> y_true = tf.cast(y_true, tf.float32) epsilon = K.epsilon() y_pred = K.clip(y_pred, epsilon, 1.0 - epsilon) p_t = tf.where(K.equ...
Implementation of simple binary focal loss.
BinaryFocalLoss
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BinaryFocalLoss: """Implementation of simple binary focal loss.""" def __init__(self, name=None, gamma=2.0, alpha=0.25): """:param name: displayed name for loss function :param gamma: gamma constant used in focal loss. gamma > 0 reduces the relative loss for well-classified examples ...
stack_v2_sparse_classes_75kplus_train_067474
3,619
permissive
[ { "docstring": ":param name: displayed name for loss function :param gamma: gamma constant used in focal loss. gamma > 0 reduces the relative loss for well-classified examples (p>0.5) putting more focus on hard misclassified example :param alpha: alpha constant used in focal loss equation. scalar factor to redu...
2
stack_v2_sparse_classes_30k_train_022954
Implement the Python class `BinaryFocalLoss` described below. Class description: Implementation of simple binary focal loss. Method signatures and docstrings: - def __init__(self, name=None, gamma=2.0, alpha=0.25): :param name: displayed name for loss function :param gamma: gamma constant used in focal loss. gamma > ...
Implement the Python class `BinaryFocalLoss` described below. Class description: Implementation of simple binary focal loss. Method signatures and docstrings: - def __init__(self, name=None, gamma=2.0, alpha=0.25): :param name: displayed name for loss function :param gamma: gamma constant used in focal loss. gamma > ...
391b4d84c9994e9abda64c6e48f2eac6b374b052
<|skeleton|> class BinaryFocalLoss: """Implementation of simple binary focal loss.""" def __init__(self, name=None, gamma=2.0, alpha=0.25): """:param name: displayed name for loss function :param gamma: gamma constant used in focal loss. gamma > 0 reduces the relative loss for well-classified examples ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BinaryFocalLoss: """Implementation of simple binary focal loss.""" def __init__(self, name=None, gamma=2.0, alpha=0.25): """:param name: displayed name for loss function :param gamma: gamma constant used in focal loss. gamma > 0 reduces the relative loss for well-classified examples (p>0.5) putti...
the_stack_v2_python_sparse
losses/focal_loss.py
Barchid/Indoor_Segmentation
train
2
06ea7904436cf2143621688f92fe768fb6d18a75
[ "user = User.objects.create_user(username='username', email='myemail@test.com', password='password', first_name='first', last_name='last')\ndata = {'username': 'changed', 'first_name': 'changed', 'last_name': 'changed', 'email': 'changed@change.ie'}\nform = EditProfileForm(data, instance=user)\nself.assertTrue(form...
<|body_start_0|> user = User.objects.create_user(username='username', email='myemail@test.com', password='password', first_name='first', last_name='last') data = {'username': 'changed', 'first_name': 'changed', 'last_name': 'changed', 'email': 'changed@change.ie'} form = EditProfileForm(data, in...
test the edit profile form
Test_Edit_Profile_Form
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test_Edit_Profile_Form: """test the edit profile form""" def test_Edit_Profile_Form(self): """Test that the Edit Profile Form returns valid when there is valid changes""" <|body_0|> def test_correct_message_for_no_username_input(self): """Test that the error mess...
stack_v2_sparse_classes_75kplus_train_067475
9,772
no_license
[ { "docstring": "Test that the Edit Profile Form returns valid when there is valid changes", "name": "test_Edit_Profile_Form", "signature": "def test_Edit_Profile_Form(self)" }, { "docstring": "Test that the error message 'This field is required' occurs when there is no username inputted in the f...
3
stack_v2_sparse_classes_30k_train_051260
Implement the Python class `Test_Edit_Profile_Form` described below. Class description: test the edit profile form Method signatures and docstrings: - def test_Edit_Profile_Form(self): Test that the Edit Profile Form returns valid when there is valid changes - def test_correct_message_for_no_username_input(self): Tes...
Implement the Python class `Test_Edit_Profile_Form` described below. Class description: test the edit profile form Method signatures and docstrings: - def test_Edit_Profile_Form(self): Test that the Edit Profile Form returns valid when there is valid changes - def test_correct_message_for_no_username_input(self): Tes...
a80148cb642cb09dac57cff18483be14fed67dfd
<|skeleton|> class Test_Edit_Profile_Form: """test the edit profile form""" def test_Edit_Profile_Form(self): """Test that the Edit Profile Form returns valid when there is valid changes""" <|body_0|> def test_correct_message_for_no_username_input(self): """Test that the error mess...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Test_Edit_Profile_Form: """test the edit profile form""" def test_Edit_Profile_Form(self): """Test that the Edit Profile Form returns valid when there is valid changes""" user = User.objects.create_user(username='username', email='myemail@test.com', password='password', first_name='first'...
the_stack_v2_python_sparse
accounts/tests_forms.py
sarahbarron/Stream-3-Project
train
1
ccfa549c203e6aaa51d5e12d24543cdf770eefdf
[ "def check_supported_spec(spec):\n if tensor_spec.is_discrete(spec):\n assert len(spec.shape) == 0 or (len(spec.shape) == 1 and spec.shape[0] == 1)\n else:\n assert len(spec.shape) == 1\ntf.nest.map_structure(check_supported_spec, action_spec)\nself._action_spec = action_spec", "tf.nest.assert...
<|body_start_0|> def check_supported_spec(spec): if tensor_spec.is_discrete(spec): assert len(spec.shape) == 0 or (len(spec.shape) == 1 and spec.shape[0] == 1) else: assert len(spec.shape) == 1 tf.nest.map_structure(check_supported_spec, action_spe...
A simple encoder for action. Only supports one action (discrete or continuous). If encode discrete action to one hot representation and use the original continous actions. And output the concat of all of them
SimpleActionEncoder
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SimpleActionEncoder: """A simple encoder for action. Only supports one action (discrete or continuous). If encode discrete action to one hot representation and use the original continous actions. And output the concat of all of them""" def __init__(self, action_spec): """Create Simpl...
stack_v2_sparse_classes_75kplus_train_067476
2,438
permissive
[ { "docstring": "Create SimpleActionEncoder. Args: action_spec (nested BoundedTensorSpec): spec for actions", "name": "__init__", "signature": "def __init__(self, action_spec)" }, { "docstring": "Generate encoded actions. Args: inputs (nested Tensor): action tensors. Returns: nested Tensor with t...
2
stack_v2_sparse_classes_30k_train_038987
Implement the Python class `SimpleActionEncoder` described below. Class description: A simple encoder for action. Only supports one action (discrete or continuous). If encode discrete action to one hot representation and use the original continous actions. And output the concat of all of them Method signatures and do...
Implement the Python class `SimpleActionEncoder` described below. Class description: A simple encoder for action. Only supports one action (discrete or continuous). If encode discrete action to one hot representation and use the original continous actions. And output the concat of all of them Method signatures and do...
38a3621337a030f74bb3944d7695e7642e777e10
<|skeleton|> class SimpleActionEncoder: """A simple encoder for action. Only supports one action (discrete or continuous). If encode discrete action to one hot representation and use the original continous actions. And output the concat of all of them""" def __init__(self, action_spec): """Create Simpl...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SimpleActionEncoder: """A simple encoder for action. Only supports one action (discrete or continuous). If encode discrete action to one hot representation and use the original continous actions. And output the concat of all of them""" def __init__(self, action_spec): """Create SimpleActionEncode...
the_stack_v2_python_sparse
alf/utils/action_encoder.py
Haichao-Zhang/alf
train
1
d1ac638651d2a219ce26c5098f97aa5f7f890535
[ "if isinstance(model, str):\n name = model\nelif isinstance(model, type):\n name = model.__name__\nelse:\n name = model.__class__.__name__\nreturn '__%s_%s__' % (name, id_)", "res = DBSession.query(cls.value).filter(cls.key == cls.replacement_key(model, id_)).first()\nif res:\n return res[0]", "sess...
<|body_start_0|> if isinstance(model, str): name = model elif isinstance(model, type): name = model.__name__ else: name = model.__class__.__name__ return '__%s_%s__' % (name, id_) <|end_body_0|> <|body_start_1|> res = DBSession.query(cls.value...
Model class to allow storage of key-value pairs of configuration data. This model is also (ab-)used to implement a mechanism linking database objects of all types without enforcing referential intagrity, e.g. to model chains of superseding objects, where referred objects may become obsolete themselves.
Config
[ "BSD-3-Clause", "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Config: """Model class to allow storage of key-value pairs of configuration data. This model is also (ab-)used to implement a mechanism linking database objects of all types without enforcing referential intagrity, e.g. to model chains of superseding objects, where referred objects may become obs...
stack_v2_sparse_classes_75kplus_train_067477
2,241
permissive
[ { "docstring": "Determine the replacement key for an object. :param model: Model class or instance. :param id_: Identifier of a class instance. :return: ``str`` representation identifying a database object.", "name": "replacement_key", "signature": "def replacement_key(model, id_)" }, { "docstri...
3
null
Implement the Python class `Config` described below. Class description: Model class to allow storage of key-value pairs of configuration data. This model is also (ab-)used to implement a mechanism linking database objects of all types without enforcing referential intagrity, e.g. to model chains of superseding objects...
Implement the Python class `Config` described below. Class description: Model class to allow storage of key-value pairs of configuration data. This model is also (ab-)used to implement a mechanism linking database objects of all types without enforcing referential intagrity, e.g. to model chains of superseding objects...
a4901e2e1c90eb62b5f855608863df556677df06
<|skeleton|> class Config: """Model class to allow storage of key-value pairs of configuration data. This model is also (ab-)used to implement a mechanism linking database objects of all types without enforcing referential intagrity, e.g. to model chains of superseding objects, where referred objects may become obs...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Config: """Model class to allow storage of key-value pairs of configuration data. This model is also (ab-)used to implement a mechanism linking database objects of all types without enforcing referential intagrity, e.g. to model chains of superseding objects, where referred objects may become obsolete themsel...
the_stack_v2_python_sparse
src/clld/db/models/config.py
clld/clld
train
44
ff3e713bda33fe18287774cf6e4c22000bc7b201
[ "def dfs(root, curMax):\n if not root:\n return 0\n if root.val >= curMax:\n cur = 1\n curMax = max(curMax, root.val)\n else:\n cur = 0\n return cur + dfs(root.left, curMax) + dfs(root.right, curMax)\nres = dfs(root, root.val)\nreturn res", "self.count = 0\n\ndef dfs(root, ...
<|body_start_0|> def dfs(root, curMax): if not root: return 0 if root.val >= curMax: cur = 1 curMax = max(curMax, root.val) else: cur = 0 return cur + dfs(root.left, curMax) + dfs(root.right, curMax) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def goodNodes1(self, root): """:type root: TreeNode :rtype: int my own solution: pass curMax value down to the subtrees if current is good node, ie curcount += 1 and update curMax""" <|body_0|> def goodNodes2(self, root): """:type root: TreeNode :rtype: int...
stack_v2_sparse_classes_75kplus_train_067478
1,298
no_license
[ { "docstring": ":type root: TreeNode :rtype: int my own solution: pass curMax value down to the subtrees if current is good node, ie curcount += 1 and update curMax", "name": "goodNodes1", "signature": "def goodNodes1(self, root)" }, { "docstring": ":type root: TreeNode :rtype: int", "name":...
2
stack_v2_sparse_classes_30k_test_002003
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def goodNodes1(self, root): :type root: TreeNode :rtype: int my own solution: pass curMax value down to the subtrees if current is good node, ie curcount += 1 and update curMax -...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def goodNodes1(self, root): :type root: TreeNode :rtype: int my own solution: pass curMax value down to the subtrees if current is good node, ie curcount += 1 and update curMax -...
813235789ce422a3bab198317aafc46fbc61625e
<|skeleton|> class Solution: def goodNodes1(self, root): """:type root: TreeNode :rtype: int my own solution: pass curMax value down to the subtrees if current is good node, ie curcount += 1 and update curMax""" <|body_0|> def goodNodes2(self, root): """:type root: TreeNode :rtype: int...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def goodNodes1(self, root): """:type root: TreeNode :rtype: int my own solution: pass curMax value down to the subtrees if current is good node, ie curcount += 1 and update curMax""" def dfs(root, curMax): if not root: return 0 if root.val >= c...
the_stack_v2_python_sparse
7.BINARY TREE and BST/1448_count_good_nodes/solution.py
kimmyoo/python_leetcode
train
1
890e2f587a9c4ec1e03642011f9ad5371be7d0db
[ "DocketGenerator.__init__(self)\nself.n_stimuli = n_stimuli\nself.n_reference = np.int32(n_reference)\nself.n_select = np.int32(n_select)\nself.is_ranked = True", "n_reference = self.n_reference\nn_select = np.repeat(self.n_select, n_trial)\nis_ranked = np.repeat(self.is_ranked, n_trial)\nidx_eligable = np.arange...
<|body_start_0|> DocketGenerator.__init__(self) self.n_stimuli = n_stimuli self.n_reference = np.int32(n_reference) self.n_select = np.int32(n_select) self.is_ranked = True <|end_body_0|> <|body_start_1|> n_reference = self.n_reference n_select = np.repeat(self.n...
A trial generator that blindly samples trials.
RandomRank
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RandomRank: """A trial generator that blindly samples trials.""" def __init__(self, n_stimuli, n_reference=2, n_select=1): """Initialize. Arguments: n_stimuli: A scalar indicating the total number of unique stimuli. n_reference (optional): A scalar indicating the number of references...
stack_v2_sparse_classes_75kplus_train_067479
2,605
permissive
[ { "docstring": "Initialize. Arguments: n_stimuli: A scalar indicating the total number of unique stimuli. n_reference (optional): A scalar indicating the number of references for each trial. n_select (optional): A scalar indicating the number of selections an agent must make.", "name": "__init__", "sign...
2
stack_v2_sparse_classes_30k_train_037737
Implement the Python class `RandomRank` described below. Class description: A trial generator that blindly samples trials. Method signatures and docstrings: - def __init__(self, n_stimuli, n_reference=2, n_select=1): Initialize. Arguments: n_stimuli: A scalar indicating the total number of unique stimuli. n_reference...
Implement the Python class `RandomRank` described below. Class description: A trial generator that blindly samples trials. Method signatures and docstrings: - def __init__(self, n_stimuli, n_reference=2, n_select=1): Initialize. Arguments: n_stimuli: A scalar indicating the total number of unique stimuli. n_reference...
4f05348cf43d2d53ff9cc6dee633de385df883e3
<|skeleton|> class RandomRank: """A trial generator that blindly samples trials.""" def __init__(self, n_stimuli, n_reference=2, n_select=1): """Initialize. Arguments: n_stimuli: A scalar indicating the total number of unique stimuli. n_reference (optional): A scalar indicating the number of references...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RandomRank: """A trial generator that blindly samples trials.""" def __init__(self, n_stimuli, n_reference=2, n_select=1): """Initialize. Arguments: n_stimuli: A scalar indicating the total number of unique stimuli. n_reference (optional): A scalar indicating the number of references for each tri...
the_stack_v2_python_sparse
psiz/generators/similarity/rank/random_rank.py
asuiconlab/psiz
train
0
3bc9ed7fac8464e9d9f14df0ea35c50e38380ede
[ "argument_and_expected_result = {'a': 'a', 'aa': 'a', 'aaa': 'a', 'aba': 'ab', 'bba': 'ba', 'aab': 'ab', 'TechCity': 'Techiy'}\nfor word, expected_result in argument_and_expected_result.items():\n result = task1.remove_all_except_first(word)\n self.assertEqual(result, expected_result)", "argument_and_expect...
<|body_start_0|> argument_and_expected_result = {'a': 'a', 'aa': 'a', 'aaa': 'a', 'aba': 'ab', 'bba': 'ba', 'aab': 'ab', 'TechCity': 'Techiy'} for word, expected_result in argument_and_expected_result.items(): result = task1.remove_all_except_first(word) self.assertEqual(result, ...
Tests for string manipulation task.
StringManipulationTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StringManipulationTest: """Tests for string manipulation task.""" def test_remove_all_except_first(self): """Test that all character in a strings are removed except first character""" <|body_0|> def test_remove_first_occurrence(self): """Test that first occurrenc...
stack_v2_sparse_classes_75kplus_train_067480
1,369
no_license
[ { "docstring": "Test that all character in a strings are removed except first character", "name": "test_remove_all_except_first", "signature": "def test_remove_all_except_first(self)" }, { "docstring": "Test that first occurrence of character is removed in a string", "name": "test_remove_fir...
2
stack_v2_sparse_classes_30k_train_011941
Implement the Python class `StringManipulationTest` described below. Class description: Tests for string manipulation task. Method signatures and docstrings: - def test_remove_all_except_first(self): Test that all character in a strings are removed except first character - def test_remove_first_occurrence(self): Test...
Implement the Python class `StringManipulationTest` described below. Class description: Tests for string manipulation task. Method signatures and docstrings: - def test_remove_all_except_first(self): Test that all character in a strings are removed except first character - def test_remove_first_occurrence(self): Test...
4c5044a4e9085cc09d8eee223c89217cae408166
<|skeleton|> class StringManipulationTest: """Tests for string manipulation task.""" def test_remove_all_except_first(self): """Test that all character in a strings are removed except first character""" <|body_0|> def test_remove_first_occurrence(self): """Test that first occurrenc...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class StringManipulationTest: """Tests for string manipulation task.""" def test_remove_all_except_first(self): """Test that all character in a strings are removed except first character""" argument_and_expected_result = {'a': 'a', 'aa': 'a', 'aaa': 'a', 'aba': 'ab', 'bba': 'ba', 'aab': 'ab', '...
the_stack_v2_python_sparse
unit_test/test_task1.py
monofal/Full-Stack-Training
train
0
e50b5fba8e02c08bc0d94bc143e22793c8752d4e
[ "super(FeatureSlice, self).__init__(**kwargs)\nself.slicing_indices = s_inds\nself.n_feats = len(s_inds)\nself.n_dims = n_dims\nself.return_last_seq = return_last_seq\nif n_dims == 2:\n raise NotImplementedError('Not implemented for 2D tensors!')", "s = -1 if self.return_last_seq else slice(None)\nfeature_tens...
<|body_start_0|> super(FeatureSlice, self).__init__(**kwargs) self.slicing_indices = s_inds self.n_feats = len(s_inds) self.n_dims = n_dims self.return_last_seq = return_last_seq if n_dims == 2: raise NotImplementedError('Not implemented for 2D tensors!') <|en...
Extracts specified features from tensor. TODO: Make it more efficient by considering not single slices but multiple consecutive ones.
FeatureSlice
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FeatureSlice: """Extracts specified features from tensor. TODO: Make it more efficient by considering not single slices but multiple consecutive ones.""" def __init__(self, s_inds: np.ndarray, n_dims: int=3, return_last_seq: bool=True, **kwargs): """Initialize layer. Args: s_inds: Th...
stack_v2_sparse_classes_75kplus_train_067481
13,797
no_license
[ { "docstring": "Initialize layer. Args: s_inds: The array with the indices. n_dims: The number of dimensions of the input tensor. **kwargs: The kwargs for super(), e.g. `name`.", "name": "__init__", "signature": "def __init__(self, s_inds: np.ndarray, n_dims: int=3, return_last_seq: bool=True, **kwargs)...
3
stack_v2_sparse_classes_30k_train_005122
Implement the Python class `FeatureSlice` described below. Class description: Extracts specified features from tensor. TODO: Make it more efficient by considering not single slices but multiple consecutive ones. Method signatures and docstrings: - def __init__(self, s_inds: np.ndarray, n_dims: int=3, return_last_seq:...
Implement the Python class `FeatureSlice` described below. Class description: Extracts specified features from tensor. TODO: Make it more efficient by considering not single slices but multiple consecutive ones. Method signatures and docstrings: - def __init__(self, s_inds: np.ndarray, n_dims: int=3, return_last_seq:...
76bb37bf2d23f7d047602bbdbcc4b2607df53a2b
<|skeleton|> class FeatureSlice: """Extracts specified features from tensor. TODO: Make it more efficient by considering not single slices but multiple consecutive ones.""" def __init__(self, s_inds: np.ndarray, n_dims: int=3, return_last_seq: bool=True, **kwargs): """Initialize layer. Args: s_inds: Th...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FeatureSlice: """Extracts specified features from tensor. TODO: Make it more efficient by considering not single slices but multiple consecutive ones.""" def __init__(self, s_inds: np.ndarray, n_dims: int=3, return_last_seq: bool=True, **kwargs): """Initialize layer. Args: s_inds: The array with ...
the_stack_v2_python_sparse
BatchRL/ml/keras_layers.py
chbauman/MasterThesis
train
0
f2e52a6d9a71753b882c449c9fbad3af436d7c6a
[ "msg_id = None\nmsg_len = 0\nraw_msg_id = np.fromfile(file_hdl, np.int16, 1)\nraw_msg_len = np.fromfile(file_hdl, np.int32, 1)\ntry:\n if raw_msg_id is not None:\n msg_id = raw_msg_id[0]\n if raw_msg_len is not None:\n msg_len = raw_msg_len[0]\nexcept IndexError:\n pass\nreturn (msg_id, msg_l...
<|body_start_0|> msg_id = None msg_len = 0 raw_msg_id = np.fromfile(file_hdl, np.int16, 1) raw_msg_len = np.fromfile(file_hdl, np.int32, 1) try: if raw_msg_id is not None: msg_id = raw_msg_id[0] if raw_msg_len is not None: m...
Handles reading UTWin CScan (.csc) files
UTWinCscanReader
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UTWinCscanReader: """Handles reading UTWin CScan (.csc) files""" def msg_info(cls, file_hdl): """Returns a tuple of message ID and message length read from the file. Returns (None, 0) if ID and length were not found.""" <|body_0|> def find_message(cls, file_name, message...
stack_v2_sparse_classes_75kplus_train_067482
49,665
permissive
[ { "docstring": "Returns a tuple of message ID and message length read from the file. Returns (None, 0) if ID and length were not found.", "name": "msg_info", "signature": "def msg_info(cls, file_hdl)" }, { "docstring": "Returns the position in the UTWin file corresponding to the specified messag...
5
null
Implement the Python class `UTWinCscanReader` described below. Class description: Handles reading UTWin CScan (.csc) files Method signatures and docstrings: - def msg_info(cls, file_hdl): Returns a tuple of message ID and message length read from the file. Returns (None, 0) if ID and length were not found. - def find...
Implement the Python class `UTWinCscanReader` described below. Class description: Handles reading UTWin CScan (.csc) files Method signatures and docstrings: - def msg_info(cls, file_hdl): Returns a tuple of message ID and message length read from the file. Returns (None, 0) if ID and length were not found. - def find...
33f4ec11cfc3befbe52f0985b8ab8ff39901d0c9
<|skeleton|> class UTWinCscanReader: """Handles reading UTWin CScan (.csc) files""" def msg_info(cls, file_hdl): """Returns a tuple of message ID and message length read from the file. Returns (None, 0) if ID and length were not found.""" <|body_0|> def find_message(cls, file_name, message...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UTWinCscanReader: """Handles reading UTWin CScan (.csc) files""" def msg_info(cls, file_hdl): """Returns a tuple of message ID and message length read from the file. Returns (None, 0) if ID and length were not found.""" msg_id = None msg_len = 0 raw_msg_id = np.fromfile(fi...
the_stack_v2_python_sparse
models/dataio.py
ccoughlin/nditoolbox-labs
train
0
89fecd54bc1f885c366fe4130658e60b7039fa96
[ "with self.assertRaises(EOFError) as e:\n fileio.GetAtomsFromXyzq([])\nself.assertEqual(str(e.exception), 'XYZQ file is empty.')", "with self.assertRaises(IndexError) as e:\n fileio.GetAtomsFromXyzq([[], ['X', '0.0', '0.0', '0.0', '0.0']])\nself.assertEqual(str(e.exception), 'First line of XYZQ file must be...
<|body_start_0|> with self.assertRaises(EOFError) as e: fileio.GetAtomsFromXyzq([]) self.assertEqual(str(e.exception), 'XYZQ file is empty.') <|end_body_0|> <|body_start_1|> with self.assertRaises(IndexError) as e: fileio.GetAtomsFromXyzq([[], ['X', '0.0', '0.0', '0.0', ...
Unit tests for mmlib.fileio.GetAtomsFromXyzq method.
TestGetAtomsFromXyzq
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestGetAtomsFromXyzq: """Unit tests for mmlib.fileio.GetAtomsFromXyzq method.""" def testEmptyArray(self): """Asserts error raise for empty input.""" <|body_0|> def testEmptyFirstRow(self): """Asserts error raise for empty first row of input.""" <|body_1|...
stack_v2_sparse_classes_75kplus_train_067483
20,144
no_license
[ { "docstring": "Asserts error raise for empty input.", "name": "testEmptyArray", "signature": "def testEmptyArray(self)" }, { "docstring": "Asserts error raise for empty first row of input.", "name": "testEmptyFirstRow", "signature": "def testEmptyFirstRow(self)" }, { "docstring"...
6
stack_v2_sparse_classes_30k_test_002513
Implement the Python class `TestGetAtomsFromXyzq` described below. Class description: Unit tests for mmlib.fileio.GetAtomsFromXyzq method. Method signatures and docstrings: - def testEmptyArray(self): Asserts error raise for empty input. - def testEmptyFirstRow(self): Asserts error raise for empty first row of input....
Implement the Python class `TestGetAtomsFromXyzq` described below. Class description: Unit tests for mmlib.fileio.GetAtomsFromXyzq method. Method signatures and docstrings: - def testEmptyArray(self): Asserts error raise for empty input. - def testEmptyFirstRow(self): Asserts error raise for empty first row of input....
0ac31aac3070bba17e91c9922a2e32c569479e4d
<|skeleton|> class TestGetAtomsFromXyzq: """Unit tests for mmlib.fileio.GetAtomsFromXyzq method.""" def testEmptyArray(self): """Asserts error raise for empty input.""" <|body_0|> def testEmptyFirstRow(self): """Asserts error raise for empty first row of input.""" <|body_1|...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestGetAtomsFromXyzq: """Unit tests for mmlib.fileio.GetAtomsFromXyzq method.""" def testEmptyArray(self): """Asserts error raise for empty input.""" with self.assertRaises(EOFError) as e: fileio.GetAtomsFromXyzq([]) self.assertEqual(str(e.exception), 'XYZQ file is emp...
the_stack_v2_python_sparse
scripts/molecular_mechanics/mmlib/fileio_test.py
aledzib/Computational-Chemistry
train
1
a856e9c098632e4e753cbae27d0b50362a4f2ee1
[ "super().__init__()\nself._commands = []\nself._allocated_qubit_ids = set()\nself._deallocated_qubit_ids = set()", "if self._deallocated_qubit_ids != self._allocated_qubit_ids:\n raise QubitManagementError(\"\\n Error. Qubits have been allocated in 'with \" + \"Dagger(eng)' context,\\n which have not explicitl...
<|body_start_0|> super().__init__() self._commands = [] self._allocated_qubit_ids = set() self._deallocated_qubit_ids = set() <|end_body_0|> <|body_start_1|> if self._deallocated_qubit_ids != self._allocated_qubit_ids: raise QubitManagementError("\n Error. Qubits hav...
Store all commands and, when done, inverts the circuit & runs it.
DaggerEngine
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DaggerEngine: """Store all commands and, when done, inverts the circuit & runs it.""" def __init__(self): """Initialize a DaggerEngine object.""" <|body_0|> def run(self): """Run the stored circuit in reverse and check that local qubits have been deallocated.""" ...
stack_v2_sparse_classes_75kplus_train_067484
4,460
permissive
[ { "docstring": "Initialize a DaggerEngine object.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Run the stored circuit in reverse and check that local qubits have been deallocated.", "name": "run", "signature": "def run(self)" }, { "docstring": "Recei...
3
null
Implement the Python class `DaggerEngine` described below. Class description: Store all commands and, when done, inverts the circuit & runs it. Method signatures and docstrings: - def __init__(self): Initialize a DaggerEngine object. - def run(self): Run the stored circuit in reverse and check that local qubits have ...
Implement the Python class `DaggerEngine` described below. Class description: Store all commands and, when done, inverts the circuit & runs it. Method signatures and docstrings: - def __init__(self): Initialize a DaggerEngine object. - def run(self): Run the stored circuit in reverse and check that local qubits have ...
67c660ca18725d23ab0b261a45e34873b6a58d03
<|skeleton|> class DaggerEngine: """Store all commands and, when done, inverts the circuit & runs it.""" def __init__(self): """Initialize a DaggerEngine object.""" <|body_0|> def run(self): """Run the stored circuit in reverse and check that local qubits have been deallocated.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DaggerEngine: """Store all commands and, when done, inverts the circuit & runs it.""" def __init__(self): """Initialize a DaggerEngine object.""" super().__init__() self._commands = [] self._allocated_qubit_ids = set() self._deallocated_qubit_ids = set() def r...
the_stack_v2_python_sparse
projectq/meta/_dagger.py
ProjectQ-Framework/ProjectQ
train
886
92ccc251ace9030607e5deef492bceea069bddb8
[ "self.X = X\nself.input_dim = input_dim\nself.batch_input = batch_input", "if self.batch_input is True:\n return tf.expand_dims(self.X, 0)[0, :, :, :]\nelse:\n return tf.expand_dims(self.X, 0)" ]
<|body_start_0|> self.X = X self.input_dim = input_dim self.batch_input = batch_input <|end_body_0|> <|body_start_1|> if self.batch_input is True: return tf.expand_dims(self.X, 0)[0, :, :, :] else: return tf.expand_dims(self.X, 0) <|end_body_1|>
This layer expands dimensions inorder for the LSTM to function. The input data has a shape of (?,input_dimensions) and the output for this layer is a tensor of the shape (1, ?, input_dimensions)
InputLSTMLayer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InputLSTMLayer: """This layer expands dimensions inorder for the LSTM to function. The input data has a shape of (?,input_dimensions) and the output for this layer is a tensor of the shape (1, ?, input_dimensions)""" def __init__(self, X, input_dim, batch_input=False): """Initialize ...
stack_v2_sparse_classes_75kplus_train_067485
1,119
permissive
[ { "docstring": "Initialize InputLSTMLayer class Parameters ---------- X : tf.Tensor Input tensor to be transformed input_dim : integer Input dimensions batch_input : boolean (default False) If input is batch", "name": "__init__", "signature": "def __init__(self, X, input_dim, batch_input=False)" }, ...
2
stack_v2_sparse_classes_30k_train_043108
Implement the Python class `InputLSTMLayer` described below. Class description: This layer expands dimensions inorder for the LSTM to function. The input data has a shape of (?,input_dimensions) and the output for this layer is a tensor of the shape (1, ?, input_dimensions) Method signatures and docstrings: - def __i...
Implement the Python class `InputLSTMLayer` described below. Class description: This layer expands dimensions inorder for the LSTM to function. The input data has a shape of (?,input_dimensions) and the output for this layer is a tensor of the shape (1, ?, input_dimensions) Method signatures and docstrings: - def __i...
d129172b064d9e73e9118ac7164eb826a1263100
<|skeleton|> class InputLSTMLayer: """This layer expands dimensions inorder for the LSTM to function. The input data has a shape of (?,input_dimensions) and the output for this layer is a tensor of the shape (1, ?, input_dimensions)""" def __init__(self, X, input_dim, batch_input=False): """Initialize ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class InputLSTMLayer: """This layer expands dimensions inorder for the LSTM to function. The input data has a shape of (?,input_dimensions) and the output for this layer is a tensor of the shape (1, ?, input_dimensions)""" def __init__(self, X, input_dim, batch_input=False): """Initialize InputLSTMLaye...
the_stack_v2_python_sparse
timeflow/layers/input_lstm_layer.py
genesiscrew/TensorFlow-Predictor
train
1
41fa99d6de5ae139cacd40bb2788d0d5a93a4391
[ "if not root:\n return True\nreturn self.is_symmetric_recursive(root)", "def recursion(node1, node2):\n if not node1 and (not node2):\n return True\n return bool(node1) and bool(node2) and (node1.val == node2.val) and recursion(node1.left, node2.right) and recursion(node1.right, node2.left)\nretur...
<|body_start_0|> if not root: return True return self.is_symmetric_recursive(root) <|end_body_0|> <|body_start_1|> def recursion(node1, node2): if not node1 and (not node2): return True return bool(node1) and bool(node2) and (node1.val == node...
Solution to Leetcode problem 101: Symmetric Tree. Definition for a binary tree node. class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """Solution to Leetcode problem 101: Symmetric Tree. Definition for a binary tree node. class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None""" def is_symmetric(self, root): """Determine whether a given binary tree is left-right sym...
stack_v2_sparse_classes_75kplus_train_067486
3,129
no_license
[ { "docstring": "Determine whether a given binary tree is left-right symmetric. :type root: TreeNode :rtype: bool", "name": "is_symmetric", "signature": "def is_symmetric(self, root)" }, { "docstring": "Symmetric tree: recursive solution.", "name": "is_symmetric_recursive", "signature": "...
3
stack_v2_sparse_classes_30k_train_032353
Implement the Python class `Solution` described below. Class description: Solution to Leetcode problem 101: Symmetric Tree. Definition for a binary tree node. class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None Method signatures and docstrings: - def is_symmetric(self, root)...
Implement the Python class `Solution` described below. Class description: Solution to Leetcode problem 101: Symmetric Tree. Definition for a binary tree node. class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None Method signatures and docstrings: - def is_symmetric(self, root)...
e11bfc454789e716055b80873af0817ec8588aea
<|skeleton|> class Solution: """Solution to Leetcode problem 101: Symmetric Tree. Definition for a binary tree node. class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None""" def is_symmetric(self, root): """Determine whether a given binary tree is left-right sym...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: """Solution to Leetcode problem 101: Symmetric Tree. Definition for a binary tree node. class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None""" def is_symmetric(self, root): """Determine whether a given binary tree is left-right symmetric. :type...
the_stack_v2_python_sparse
p101/problem101.py
stanl3y/leetcode
train
0
d56b20c9c038f2a636de9aee5cc0d98868d217e3
[ "super(FunctionComponent, self).__init__(opts)\nself.fn_options = opts.get(PACKAGE_NAME, {})\nself.opts = opts\nvalidate_fields(config.REQUIRED_CONFIG_SETTINGS, self.fn_options)", "self.fn_options = opts.get(PACKAGE_NAME, {})\nself.opts = opts\nvalidate_fields(config.REQUIRED_CONFIG_SETTINGS, self.fn_options)", ...
<|body_start_0|> super(FunctionComponent, self).__init__(opts) self.fn_options = opts.get(PACKAGE_NAME, {}) self.opts = opts validate_fields(config.REQUIRED_CONFIG_SETTINGS, self.fn_options) <|end_body_0|> <|body_start_1|> self.fn_options = opts.get(PACKAGE_NAME, {}) sel...
Component that implements Resilient function 'funct_zia_remove_from_url_category''
FunctionComponent
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FunctionComponent: """Component that implements Resilient function 'funct_zia_remove_from_url_category''""" def __init__(self, opts): """Constructor provides access to the configuration options""" <|body_0|> def _reload(self, event, opts): """Configuration option...
stack_v2_sparse_classes_75kplus_train_067487
3,635
permissive
[ { "docstring": "Constructor provides access to the configuration options", "name": "__init__", "signature": "def __init__(self, opts)" }, { "docstring": "Configuration options have changed, save new values", "name": "_reload", "signature": "def _reload(self, event, opts)" }, { "d...
3
stack_v2_sparse_classes_30k_train_052328
Implement the Python class `FunctionComponent` described below. Class description: Component that implements Resilient function 'funct_zia_remove_from_url_category'' Method signatures and docstrings: - def __init__(self, opts): Constructor provides access to the configuration options - def _reload(self, event, opts):...
Implement the Python class `FunctionComponent` described below. Class description: Component that implements Resilient function 'funct_zia_remove_from_url_category'' Method signatures and docstrings: - def __init__(self, opts): Constructor provides access to the configuration options - def _reload(self, event, opts):...
6878c78b94eeca407998a41ce8db2cc00f2b6758
<|skeleton|> class FunctionComponent: """Component that implements Resilient function 'funct_zia_remove_from_url_category''""" def __init__(self, opts): """Constructor provides access to the configuration options""" <|body_0|> def _reload(self, event, opts): """Configuration option...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FunctionComponent: """Component that implements Resilient function 'funct_zia_remove_from_url_category''""" def __init__(self, opts): """Constructor provides access to the configuration options""" super(FunctionComponent, self).__init__(opts) self.fn_options = opts.get(PACKAGE_NAM...
the_stack_v2_python_sparse
fn_zia/fn_zia/components/funct_zia_remove_from_url_category.py
ibmresilient/resilient-community-apps
train
81
dc3d247bb1098d297aad529bf34ae5dfd0af6d33
[ "new_prop = 'user_prop'\nnew_prop_value = rand_name('new_prop_value')\nimage = self.images_behavior.create_image_via_task()\nresponse = self.images_client.update_image(image.id_, add={new_prop: new_prop_value})\nself.assertEqual(response.status_code, 200)\nupdated_image = response.entity\nself.assertIn(new_prop, up...
<|body_start_0|> new_prop = 'user_prop' new_prop_value = rand_name('new_prop_value') image = self.images_behavior.create_image_via_task() response = self.images_client.update_image(image.id_, add={new_prop: new_prop_value}) self.assertEqual(response.status_code, 200) upda...
TestUpdateImagePositive
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestUpdateImagePositive: def test_update_image_add_additional_property(self): """@summary: Update image add additional property 1) Create image 2) Update image adding a new property 3) Verify that the response code is 200 4) Verify that the new property is in the response 5) Verify that ...
stack_v2_sparse_classes_75kplus_train_067488
6,204
permissive
[ { "docstring": "@summary: Update image add additional property 1) Create image 2) Update image adding a new property 3) Verify that the response code is 200 4) Verify that the new property is in the response 5) Verify that the new property's value is correct", "name": "test_update_image_add_additional_prope...
4
stack_v2_sparse_classes_30k_train_008384
Implement the Python class `TestUpdateImagePositive` described below. Class description: Implement the TestUpdateImagePositive class. Method signatures and docstrings: - def test_update_image_add_additional_property(self): @summary: Update image add additional property 1) Create image 2) Update image adding a new pro...
Implement the Python class `TestUpdateImagePositive` described below. Class description: Implement the TestUpdateImagePositive class. Method signatures and docstrings: - def test_update_image_add_additional_property(self): @summary: Update image add additional property 1) Create image 2) Update image adding a new pro...
30f0e64672676c3f90b4a582fe90fac6621475b3
<|skeleton|> class TestUpdateImagePositive: def test_update_image_add_additional_property(self): """@summary: Update image add additional property 1) Create image 2) Update image adding a new property 3) Verify that the response code is 200 4) Verify that the new property is in the response 5) Verify that ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestUpdateImagePositive: def test_update_image_add_additional_property(self): """@summary: Update image add additional property 1) Create image 2) Update image adding a new property 3) Verify that the response code is 200 4) Verify that the new property is in the response 5) Verify that the new proper...
the_stack_v2_python_sparse
cloudroast/images/v2/functional/test_update_image_positive.py
RULCSoft/cloudroast
train
1
0d329c74abd1b6cf79b45535999e320f2f8eb5c8
[ "response = get_and_check_page(self, 'huntserver:create_account', 200)\npost_context = {'user-first_name': 'first', 'user-last_name': 'last', 'user-username': 'user7', 'user-email': 'user7@example.com', 'person-phone': '777-777-7777', 'person-allergies': 'something', 'user-password': 'password', 'user-confirm_passw...
<|body_start_0|> response = get_and_check_page(self, 'huntserver:create_account', 200) post_context = {'user-first_name': 'first', 'user-last_name': 'last', 'user-username': 'user7', 'user-email': 'user7@example.com', 'person-phone': '777-777-7777', 'person-allergies': 'something', 'user-password': 'pas...
AuthTests
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AuthTests: def test_create_account(self): """Test the account creation view""" <|body_0|> def test_login_selection(self): """Test the login selection view""" <|body_1|> def test_account_logout(self): """Test the account logout view""" <|b...
stack_v2_sparse_classes_75kplus_train_067489
33,380
permissive
[ { "docstring": "Test the account creation view", "name": "test_create_account", "signature": "def test_create_account(self)" }, { "docstring": "Test the login selection view", "name": "test_login_selection", "signature": "def test_login_selection(self)" }, { "docstring": "Test th...
4
stack_v2_sparse_classes_30k_test_000616
Implement the Python class `AuthTests` described below. Class description: Implement the AuthTests class. Method signatures and docstrings: - def test_create_account(self): Test the account creation view - def test_login_selection(self): Test the login selection view - def test_account_logout(self): Test the account ...
Implement the Python class `AuthTests` described below. Class description: Implement the AuthTests class. Method signatures and docstrings: - def test_create_account(self): Test the account creation view - def test_login_selection(self): Test the login selection view - def test_account_logout(self): Test the account ...
44f87cc5cfe8bb23a8e04fddee187b9056407741
<|skeleton|> class AuthTests: def test_create_account(self): """Test the account creation view""" <|body_0|> def test_login_selection(self): """Test the login selection view""" <|body_1|> def test_account_logout(self): """Test the account logout view""" <|b...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AuthTests: def test_create_account(self): """Test the account creation view""" response = get_and_check_page(self, 'huntserver:create_account', 200) post_context = {'user-first_name': 'first', 'user-last_name': 'last', 'user-username': 'user7', 'user-email': 'user7@example.com', 'perso...
the_stack_v2_python_sparse
huntserver/tests.py
dlareau/puzzlehunt_server
train
20
4ccd406ad7014e7578048084f424dacd39d2692e
[ "rs = [S]\n\ndef flip(ch):\n if ch in ascii_lowercase:\n return ch.upper()\n else:\n return ch.lower()\nfor i in range(len(S)):\n if S[i].lower() not in ascii_lowercase:\n continue\n else:\n ans = []\n for cur_s in rs:\n tmp = cur_s[:i] + flip(cur_s[i]) + cu...
<|body_start_0|> rs = [S] def flip(ch): if ch in ascii_lowercase: return ch.upper() else: return ch.lower() for i in range(len(S)): if S[i].lower() not in ascii_lowercase: continue else: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def letterCasePermutation(self, S): """:type S: str :rtype: List[str]""" <|body_0|> def letterCasePermutation1(self, S): """:type S: str :rtype: List[str]""" <|body_1|> <|end_skeleton|> <|body_start_0|> rs = [S] def flip(ch): ...
stack_v2_sparse_classes_75kplus_train_067490
1,812
no_license
[ { "docstring": ":type S: str :rtype: List[str]", "name": "letterCasePermutation", "signature": "def letterCasePermutation(self, S)" }, { "docstring": ":type S: str :rtype: List[str]", "name": "letterCasePermutation1", "signature": "def letterCasePermutation1(self, S)" } ]
2
stack_v2_sparse_classes_30k_train_018702
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def letterCasePermutation(self, S): :type S: str :rtype: List[str] - def letterCasePermutation1(self, S): :type S: str :rtype: List[str]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def letterCasePermutation(self, S): :type S: str :rtype: List[str] - def letterCasePermutation1(self, S): :type S: str :rtype: List[str] <|skeleton|> class Solution: def le...
56730ff8cf432dda08bb56a0e783400d0375af69
<|skeleton|> class Solution: def letterCasePermutation(self, S): """:type S: str :rtype: List[str]""" <|body_0|> def letterCasePermutation1(self, S): """:type S: str :rtype: List[str]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def letterCasePermutation(self, S): """:type S: str :rtype: List[str]""" rs = [S] def flip(ch): if ch in ascii_lowercase: return ch.upper() else: return ch.lower() for i in range(len(S)): if S[i].low...
the_stack_v2_python_sparse
784-字母大小写全排列.py
kt8506/Leetcode
train
0
72b10bcb2bc85c6862d110b6299aa2ea2fdae35d
[ "args = get_retro_args()\nassert torch.distributed.get_rank() == 0\nfaiss.omp_set_num_threads(64)\nempty_index_path = self.get_empty_index_path()\nif os.path.isfile(empty_index_path):\n return\nmerged_path = get_training_data_merged_path()\ninp = np.memmap(merged_path, dtype='f4', mode='r').reshape((-1, args.hid...
<|body_start_0|> args = get_retro_args() assert torch.distributed.get_rank() == 0 faiss.omp_set_num_threads(64) empty_index_path = self.get_empty_index_path() if os.path.isfile(empty_index_path): return merged_path = get_training_data_merged_path() inp...
FaissBaseIndex
[ "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FaissBaseIndex: def _train(self): """Train index (rank 0's method).""" <|body_0|> def train(self): """Train index.""" <|body_1|> def _add(self, text_dataset): """Add to index (rank 0's method).""" <|body_2|> def add(self, text_datase...
stack_v2_sparse_classes_75kplus_train_067491
4,030
permissive
[ { "docstring": "Train index (rank 0's method).", "name": "_train", "signature": "def _train(self)" }, { "docstring": "Train index.", "name": "train", "signature": "def train(self)" }, { "docstring": "Add to index (rank 0's method).", "name": "_add", "signature": "def _add...
4
stack_v2_sparse_classes_30k_train_000975
Implement the Python class `FaissBaseIndex` described below. Class description: Implement the FaissBaseIndex class. Method signatures and docstrings: - def _train(self): Train index (rank 0's method). - def train(self): Train index. - def _add(self, text_dataset): Add to index (rank 0's method). - def add(self, text_...
Implement the Python class `FaissBaseIndex` described below. Class description: Implement the FaissBaseIndex class. Method signatures and docstrings: - def _train(self): Train index (rank 0's method). - def train(self): Train index. - def _add(self, text_dataset): Add to index (rank 0's method). - def add(self, text_...
99b044bff07f8e5d48b45223ed4bb11bd4e884e6
<|skeleton|> class FaissBaseIndex: def _train(self): """Train index (rank 0's method).""" <|body_0|> def train(self): """Train index.""" <|body_1|> def _add(self, text_dataset): """Add to index (rank 0's method).""" <|body_2|> def add(self, text_datase...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FaissBaseIndex: def _train(self): """Train index (rank 0's method).""" args = get_retro_args() assert torch.distributed.get_rank() == 0 faiss.omp_set_num_threads(64) empty_index_path = self.get_empty_index_path() if os.path.isfile(empty_index_path): ...
the_stack_v2_python_sparse
tools/retro/index/indexes/faiss_base.py
NVIDIA/Megatron-LM
train
6,315
fb7f952c7f01b52a0cb0b2f3f0e5893d08421183
[ "try:\n registry = oai_registry_api.get_by_id(registry_id)\n all_errors = oai_registry_api.harvest_registry(registry)\n if len(all_errors) > 0:\n raise exceptions_oai.OAIAPISerializeLabelledException(errors=all_errors, status_code=status.HTTP_400_BAD_REQUEST)\n content = OaiPmhMessage.get_message...
<|body_start_0|> try: registry = oai_registry_api.get_by_id(registry_id) all_errors = oai_registry_api.harvest_registry(registry) if len(all_errors) > 0: raise exceptions_oai.OAIAPISerializeLabelledException(errors=all_errors, status_code=status.HTTP_400_BAD_R...
Harvest
Harvest
[ "NIST-Software", "Apache-2.0", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Harvest: """Harvest""" def patch(self, request, registry_id): """Harvest a given registry (Data provider) Args: request: HTTP request registry_id: ObjectId Returns: - code: 200 content: Success message - code: 404 content: Object was not found - code: 500 content: Internal server err...
stack_v2_sparse_classes_75kplus_train_067492
17,640
permissive
[ { "docstring": "Harvest a given registry (Data provider) Args: request: HTTP request registry_id: ObjectId Returns: - code: 200 content: Success message - code: 404 content: Object was not found - code: 500 content: Internal server error", "name": "patch", "signature": "def patch(self, request, registry...
2
stack_v2_sparse_classes_30k_train_026437
Implement the Python class `Harvest` described below. Class description: Harvest Method signatures and docstrings: - def patch(self, request, registry_id): Harvest a given registry (Data provider) Args: request: HTTP request registry_id: ObjectId Returns: - code: 200 content: Success message - code: 404 content: Obje...
Implement the Python class `Harvest` described below. Class description: Harvest Method signatures and docstrings: - def patch(self, request, registry_id): Harvest a given registry (Data provider) Args: request: HTTP request registry_id: ObjectId Returns: - code: 200 content: Success message - code: 404 content: Obje...
bc5e31a9d7e5f66e34340230ae17a3cc2d08e7e7
<|skeleton|> class Harvest: """Harvest""" def patch(self, request, registry_id): """Harvest a given registry (Data provider) Args: request: HTTP request registry_id: ObjectId Returns: - code: 200 content: Success message - code: 404 content: Object was not found - code: 500 content: Internal server err...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Harvest: """Harvest""" def patch(self, request, registry_id): """Harvest a given registry (Data provider) Args: request: HTTP request registry_id: ObjectId Returns: - code: 200 content: Success message - code: 404 content: Object was not found - code: 500 content: Internal server error""" ...
the_stack_v2_python_sparse
core_oaipmh_harvester_app/rest/oai_registry/views.py
usnistgov/core_oaipmh_harvester_app
train
1
b4d80942c203d4d2c2267610f6dce8f059be9bc5
[ "self.key = generate_random_aes_key()\nself.keysize = len(self.key)\nself.iv = b'0' * len(self.key)\nself.prefix = 'comment1=cooking%20MCs;userdata='\nself.suffix = ';comment2=%20like%20a%20pound%20of%20bacon'", "print_line(f'{BOLD_START}CBC bitflipping attacks{BOLD_END}', color=BLUE)\nprint_line('Generate a rand...
<|body_start_0|> self.key = generate_random_aes_key() self.keysize = len(self.key) self.iv = b'0' * len(self.key) self.prefix = 'comment1=cooking%20MCs;userdata=' self.suffix = ';comment2=%20like%20a%20pound%20of%20bacon' <|end_body_0|> <|body_start_1|> print_line(f'{BOL...
Challenge16
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Challenge16: def __init__(self): """Init""" <|body_0|> def display(self): """Display challenge info :return:""" <|body_1|> def run(self): """The idea is we are filling the prefix up to full block size as usual Then we inject a dummy block with kn...
stack_v2_sparse_classes_75kplus_train_067493
5,228
no_license
[ { "docstring": "Init", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Display challenge info :return:", "name": "display", "signature": "def display(self)" }, { "docstring": "The idea is we are filling the prefix up to full block size as usual Then we in...
5
stack_v2_sparse_classes_30k_train_036102
Implement the Python class `Challenge16` described below. Class description: Implement the Challenge16 class. Method signatures and docstrings: - def __init__(self): Init - def display(self): Display challenge info :return: - def run(self): The idea is we are filling the prefix up to full block size as usual Then we ...
Implement the Python class `Challenge16` described below. Class description: Implement the Challenge16 class. Method signatures and docstrings: - def __init__(self): Init - def display(self): Display challenge info :return: - def run(self): The idea is we are filling the prefix up to full block size as usual Then we ...
8e5a5b8216b3ee91b72a7388289bb5658721d375
<|skeleton|> class Challenge16: def __init__(self): """Init""" <|body_0|> def display(self): """Display challenge info :return:""" <|body_1|> def run(self): """The idea is we are filling the prefix up to full block size as usual Then we inject a dummy block with kn...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Challenge16: def __init__(self): """Init""" self.key = generate_random_aes_key() self.keysize = len(self.key) self.iv = b'0' * len(self.key) self.prefix = 'comment1=cooking%20MCs;userdata=' self.suffix = ';comment2=%20like%20a%20pound%20of%20bacon' def disp...
the_stack_v2_python_sparse
challenges/set_02_block_crypto/challenge_16_cbc_bit_flipping_attack.py
matei/cryptopals
train
0
d2512f3e345335fbbeea4df9aef0c3124adbd787
[ "q_data = request.query_params\nser = GetPortfolioSerializer(data=q_data)\nif ser.is_valid(raise_exception=False):\n return send_200(data=ser.data, message='portfolios retrieved successfully')\nreturn send_400(status='FAILED', data={'errors': ser.errors}, message=ser.extract_error_msg())", "data = dict(request...
<|body_start_0|> q_data = request.query_params ser = GetPortfolioSerializer(data=q_data) if ser.is_valid(raise_exception=False): return send_200(data=ser.data, message='portfolios retrieved successfully') return send_400(status='FAILED', data={'errors': ser.errors}, message=s...
PortfolioInfo
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PortfolioInfo: def get(self, request): """Get protflios of an user""" <|body_0|> def post(self, request): """Register a new portfolio for user""" <|body_1|> <|end_skeleton|> <|body_start_0|> q_data = request.query_params ser = GetPortfolioSe...
stack_v2_sparse_classes_75kplus_train_067494
4,414
no_license
[ { "docstring": "Get protflios of an user", "name": "get", "signature": "def get(self, request)" }, { "docstring": "Register a new portfolio for user", "name": "post", "signature": "def post(self, request)" } ]
2
stack_v2_sparse_classes_30k_test_002350
Implement the Python class `PortfolioInfo` described below. Class description: Implement the PortfolioInfo class. Method signatures and docstrings: - def get(self, request): Get protflios of an user - def post(self, request): Register a new portfolio for user
Implement the Python class `PortfolioInfo` described below. Class description: Implement the PortfolioInfo class. Method signatures and docstrings: - def get(self, request): Get protflios of an user - def post(self, request): Register a new portfolio for user <|skeleton|> class PortfolioInfo: def get(self, requ...
3a64de39af7c51f6702c0e84a9c034055d72780e
<|skeleton|> class PortfolioInfo: def get(self, request): """Get protflios of an user""" <|body_0|> def post(self, request): """Register a new portfolio for user""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PortfolioInfo: def get(self, request): """Get protflios of an user""" q_data = request.query_params ser = GetPortfolioSerializer(data=q_data) if ser.is_valid(raise_exception=False): return send_200(data=ser.data, message='portfolios retrieved successfully') ...
the_stack_v2_python_sparse
stashaway/api/portfolio.py
ritzvik/sample-portfolio-manager
train
0
b83e0c4f970a56257e8f2ea5e5d60644e2d35492
[ "\"\"\"\n Explanation: Using a set, we can see what values already exist in\n the array as we iterate through wih O(1) retrieval. If the set already contains\n the value we're at, we return True to denote that a duplicate is found. Otherwise,\n we return False at the end after we've made...
<|body_start_0|> """ Explanation: Using a set, we can see what values already exist in the array as we iterate through wih O(1) retrieval. If the set already contains the value we're at, we return True to denote that a duplicate is found. Otherwise, ...
Duplicates
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Duplicates: def containsDuplicate(self, nums): """:type nums: List[int] :rtype: bool""" <|body_0|> def findDuplicates(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_1|> def findDisappearedNumbers(self, nums): """:type nums: Lis...
stack_v2_sparse_classes_75kplus_train_067495
2,726
no_license
[ { "docstring": ":type nums: List[int] :rtype: bool", "name": "containsDuplicate", "signature": "def containsDuplicate(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: List[int]", "name": "findDuplicates", "signature": "def findDuplicates(self, nums)" }, { "docstring"...
3
null
Implement the Python class `Duplicates` described below. Class description: Implement the Duplicates class. Method signatures and docstrings: - def containsDuplicate(self, nums): :type nums: List[int] :rtype: bool - def findDuplicates(self, nums): :type nums: List[int] :rtype: List[int] - def findDisappearedNumbers(s...
Implement the Python class `Duplicates` described below. Class description: Implement the Duplicates class. Method signatures and docstrings: - def containsDuplicate(self, nums): :type nums: List[int] :rtype: bool - def findDuplicates(self, nums): :type nums: List[int] :rtype: List[int] - def findDisappearedNumbers(s...
6f62fa7449f4e6f76a68068ec36587fe426734be
<|skeleton|> class Duplicates: def containsDuplicate(self, nums): """:type nums: List[int] :rtype: bool""" <|body_0|> def findDuplicates(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_1|> def findDisappearedNumbers(self, nums): """:type nums: Lis...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Duplicates: def containsDuplicate(self, nums): """:type nums: List[int] :rtype: bool""" """ Explanation: Using a set, we can see what values already exist in the array as we iterate through wih O(1) retrieval. If the set already contains the valu...
the_stack_v2_python_sparse
Questions/Duplicates.py
yojoecool/InterviewPrep
train
1
caf27bafdc9196e64def7d6b5d06a88acadd507d
[ "service_id = request.args.get('service_id')\nstart_date = request.args.get('start_date')\nend_date = request.args.get('end_date')\ntry:\n return (get_all_orders(service_id, start_date, end_date), 200)\nexcept Exception:\n orders_namespace.abort(400, 'An error occured')", "post_data = request.get_json()\nse...
<|body_start_0|> service_id = request.args.get('service_id') start_date = request.args.get('start_date') end_date = request.args.get('end_date') try: return (get_all_orders(service_id, start_date, end_date), 200) except Exception: orders_namespace.abort(40...
OrdersList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OrdersList: def get(self): """Returns all orders""" <|body_0|> def post(self): """Creates a new service request.""" <|body_1|> <|end_skeleton|> <|body_start_0|> service_id = request.args.get('service_id') start_date = request.args.get('start...
stack_v2_sparse_classes_75kplus_train_067496
4,484
no_license
[ { "docstring": "Returns all orders", "name": "get", "signature": "def get(self)" }, { "docstring": "Creates a new service request.", "name": "post", "signature": "def post(self)" } ]
2
stack_v2_sparse_classes_30k_train_026604
Implement the Python class `OrdersList` described below. Class description: Implement the OrdersList class. Method signatures and docstrings: - def get(self): Returns all orders - def post(self): Creates a new service request.
Implement the Python class `OrdersList` described below. Class description: Implement the OrdersList class. Method signatures and docstrings: - def get(self): Returns all orders - def post(self): Creates a new service request. <|skeleton|> class OrdersList: def get(self): """Returns all orders""" ...
f96bf6b151cea0905080a4b3d1d55f23c31c64b3
<|skeleton|> class OrdersList: def get(self): """Returns all orders""" <|body_0|> def post(self): """Creates a new service request.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class OrdersList: def get(self): """Returns all orders""" service_id = request.args.get('service_id') start_date = request.args.get('start_date') end_date = request.args.get('end_date') try: return (get_all_orders(service_id, start_date, end_date), 200) ex...
the_stack_v2_python_sparse
src/api/orders/views.py
tonyguesswho/quick-service
train
0
0a58edd96c5aee7ec583d1e6ff427d66cc62abbc
[ "super(InceptionModule, self).__init__()\nself.conv_1x1 = torch.nn.Sequential(DefaultConvolutionModule(in_channels=in_channels, out_channels=num1x1, kernel=1))\nself.conv_3x3 = torch.nn.Sequential(DefaultConvolutionModule(in_channels=in_channels, out_channels=num3x3reduce, kernel=1), DefaultConvolutionModule(in_cha...
<|body_start_0|> super(InceptionModule, self).__init__() self.conv_1x1 = torch.nn.Sequential(DefaultConvolutionModule(in_channels=in_channels, out_channels=num1x1, kernel=1)) self.conv_3x3 = torch.nn.Sequential(DefaultConvolutionModule(in_channels=in_channels, out_channels=num3x3reduce, kernel=1...
This class defines the Inception Module for the GoogLeNet Architecture.
InceptionModule
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InceptionModule: """This class defines the Inception Module for the GoogLeNet Architecture.""" def __init__(self, in_channels, num1x1, num3x3reduce, num3x3, num5x5reduce, num5x5, num1x1reduce): """The constructor of the InceptionModule class. :param in_channels: number of input chann...
stack_v2_sparse_classes_75kplus_train_067497
7,584
no_license
[ { "docstring": "The constructor of the InceptionModule class. :param in_channels: number of input channel :param num1x1: channel size of 1x1 convolution :param num3x3reduce: bottleneck channel size of 3x3 convolution :param num3x3: channel size of 3x3 convolution :param num5x5reduce: bottleneck channel size of ...
2
stack_v2_sparse_classes_30k_train_040673
Implement the Python class `InceptionModule` described below. Class description: This class defines the Inception Module for the GoogLeNet Architecture. Method signatures and docstrings: - def __init__(self, in_channels, num1x1, num3x3reduce, num3x3, num5x5reduce, num5x5, num1x1reduce): The constructor of the Incepti...
Implement the Python class `InceptionModule` described below. Class description: This class defines the Inception Module for the GoogLeNet Architecture. Method signatures and docstrings: - def __init__(self, in_channels, num1x1, num3x3reduce, num3x3, num5x5reduce, num5x5, num1x1reduce): The constructor of the Incepti...
e5560febfbf0f6e2d275f1147576d43411b1f182
<|skeleton|> class InceptionModule: """This class defines the Inception Module for the GoogLeNet Architecture.""" def __init__(self, in_channels, num1x1, num3x3reduce, num3x3, num5x5reduce, num5x5, num1x1reduce): """The constructor of the InceptionModule class. :param in_channels: number of input chann...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class InceptionModule: """This class defines the Inception Module for the GoogLeNet Architecture.""" def __init__(self, in_channels, num1x1, num3x3reduce, num3x3, num5x5reduce, num5x5, num1x1reduce): """The constructor of the InceptionModule class. :param in_channels: number of input channel :param num...
the_stack_v2_python_sparse
GoogLeNet/model.py
ldmichel/DeepLearning_MiniProjects
train
0
e2a24c4e7c8e369d2f4267652c1940486e416620
[ "if len(nums) == 0:\n return None\nself.sums = [0 for _ in range(len(nums))]\nself.sums[0] = nums[0]\nfor i in range(1, len(nums)):\n self.sums[i] = self.sums[i - 1] + nums[i]", "if i > 0 and j > 0:\n return self.sums[j] - self.sums[i - 1]\nelse:\n return self.sums[j]" ]
<|body_start_0|> if len(nums) == 0: return None self.sums = [0 for _ in range(len(nums))] self.sums[0] = nums[0] for i in range(1, len(nums)): self.sums[i] = self.sums[i - 1] + nums[i] <|end_body_0|> <|body_start_1|> if i > 0 and j > 0: return...
NumArray
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumArray: def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def sumRange(self, i, j): """:type i: int :type j: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if len(nums) == 0: return None self.sum...
stack_v2_sparse_classes_75kplus_train_067498
1,117
no_license
[ { "docstring": ":type nums: List[int]", "name": "__init__", "signature": "def __init__(self, nums)" }, { "docstring": ":type i: int :type j: int :rtype: int", "name": "sumRange", "signature": "def sumRange(self, i, j)" } ]
2
stack_v2_sparse_classes_30k_train_020811
Implement the Python class `NumArray` described below. Class description: Implement the NumArray class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] - def sumRange(self, i, j): :type i: int :type j: int :rtype: int
Implement the Python class `NumArray` described below. Class description: Implement the NumArray class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] - def sumRange(self, i, j): :type i: int :type j: int :rtype: int <|skeleton|> class NumArray: def __init__(self, nums): ...
7fa160362ebb58e7286b490012542baa2d51e5c9
<|skeleton|> class NumArray: def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def sumRange(self, i, j): """:type i: int :type j: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NumArray: def __init__(self, nums): """:type nums: List[int]""" if len(nums) == 0: return None self.sums = [0 for _ in range(len(nums))] self.sums[0] = nums[0] for i in range(1, len(nums)): self.sums[i] = self.sums[i - 1] + nums[i] def sumRa...
the_stack_v2_python_sparse
sum/range_sum_query.py
gerrycfchang/leetcode-python
train
2
87f201cdb85ffd756c31bc68a2b50350d81d37ed
[ "if request.user and request.user.is_staff:\n return True\nelif request.user and request.user.role_id == 4:\n return True\nreturn False", "if request.method == 'POST' or request.method == 'PUT':\n is_seller_assigned = hasattr(obj, 'seller_assigned') and request.user.id == obj.seller_assigned.id\n is_s...
<|body_start_0|> if request.user and request.user.is_staff: return True elif request.user and request.user.role_id == 4: return True return False <|end_body_0|> <|body_start_1|> if request.method == 'POST' or request.method == 'PUT': is_seller_assigne...
Solo Administradores o Vendedores.
IsAdminOrSeller
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IsAdminOrSeller: """Solo Administradores o Vendedores.""" def has_permission(self, request, view): """Permiso General.""" <|body_0|> def has_object_permission(self, request, view, obj): """Permiso de nivel objeto. PAara saber si se trata del vendedor del obj o un...
stack_v2_sparse_classes_75kplus_train_067499
7,085
no_license
[ { "docstring": "Permiso General.", "name": "has_permission", "signature": "def has_permission(self, request, view)" }, { "docstring": "Permiso de nivel objeto. PAara saber si se trata del vendedor del obj o un admin", "name": "has_object_permission", "signature": "def has_object_permissi...
2
null
Implement the Python class `IsAdminOrSeller` described below. Class description: Solo Administradores o Vendedores. Method signatures and docstrings: - def has_permission(self, request, view): Permiso General. - def has_object_permission(self, request, view, obj): Permiso de nivel objeto. PAara saber si se trata del ...
Implement the Python class `IsAdminOrSeller` described below. Class description: Solo Administradores o Vendedores. Method signatures and docstrings: - def has_permission(self, request, view): Permiso General. - def has_object_permission(self, request, view, obj): Permiso de nivel objeto. PAara saber si se trata del ...
3135a4142c38f367a152e1fc79fee8af8fca4bcc
<|skeleton|> class IsAdminOrSeller: """Solo Administradores o Vendedores.""" def has_permission(self, request, view): """Permiso General.""" <|body_0|> def has_object_permission(self, request, view, obj): """Permiso de nivel objeto. PAara saber si se trata del vendedor del obj o un...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class IsAdminOrSeller: """Solo Administradores o Vendedores.""" def has_permission(self, request, view): """Permiso General.""" if request.user and request.user.is_staff: return True elif request.user and request.user.role_id == 4: return True return Fals...
the_stack_v2_python_sparse
api/permissions.py
darwinv/api-chat-lnk
train
0