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
e90f654e6ae74620624ca100a57b4c3ce1d55425
[ "path = path.decode('utf-8')\n\ndef run():\n namespaces = SecureNamespaceAPI(session.auth.user)\n try:\n result = namespaces.get([path], withDescriptions=returnDescription, withNamespaces=returnNamespaces, withTags=returnTags)\n except UnknownPathError as error:\n unknownPath = error.paths.po...
<|body_start_0|> path = path.decode('utf-8') def run(): namespaces = SecureNamespaceAPI(session.auth.user) try: result = namespaces.get([path], withDescriptions=returnDescription, withNamespaces=returnNamespaces, withTags=returnTags) except UnknownPat...
FacadeNamespaceMixin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FacadeNamespaceMixin: def getNamespace(self, session, path, returnDescription, returnNamespaces, returnTags): """Get information about a L{Namespace}. @param session: The L{AuthenticatedSession} for the request. @param path: The L{Namespace.path} to get information about. @param returnDe...
stack_v2_sparse_classes_75kplus_train_006900
7,518
permissive
[ { "docstring": "Get information about a L{Namespace}. @param session: The L{AuthenticatedSession} for the request. @param path: The L{Namespace.path} to get information about. @param returnDescription: A C{bool} indicating whether or not to include L{Namespace.description}s in the result. @param returnNamespace...
4
stack_v2_sparse_classes_30k_train_039708
Implement the Python class `FacadeNamespaceMixin` described below. Class description: Implement the FacadeNamespaceMixin class. Method signatures and docstrings: - def getNamespace(self, session, path, returnDescription, returnNamespaces, returnTags): Get information about a L{Namespace}. @param session: The L{Authen...
Implement the Python class `FacadeNamespaceMixin` described below. Class description: Implement the FacadeNamespaceMixin class. Method signatures and docstrings: - def getNamespace(self, session, path, returnDescription, returnNamespaces, returnTags): Get information about a L{Namespace}. @param session: The L{Authen...
b5a8c8349f3eaf3364cc4efba4736c3e33b30d96
<|skeleton|> class FacadeNamespaceMixin: def getNamespace(self, session, path, returnDescription, returnNamespaces, returnTags): """Get information about a L{Namespace}. @param session: The L{AuthenticatedSession} for the request. @param path: The L{Namespace.path} to get information about. @param returnDe...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FacadeNamespaceMixin: def getNamespace(self, session, path, returnDescription, returnNamespaces, returnTags): """Get information about a L{Namespace}. @param session: The L{AuthenticatedSession} for the request. @param path: The L{Namespace.path} to get information about. @param returnDescription: A C...
the_stack_v2_python_sparse
fluiddb/api/namespace.py
fluidinfo/fluiddb
train
3
c1171925b6c1b9f28c070d721cdeb682f176f91b
[ "ret = 0\nstack = [(root, root.val)]\nwhile stack:\n node, val = stack.pop()\n if node.val >= val:\n ret += 1\n if node.left:\n stack.append((node.left, max(val, node.val)))\n if node.right:\n stack.append((node.right, max(val, node.val)))\nreturn ret", "good_nodes = 1\ndq = colle...
<|body_start_0|> ret = 0 stack = [(root, root.val)] while stack: node, val = stack.pop() if node.val >= val: ret += 1 if node.left: stack.append((node.left, max(val, node.val))) if node.right: stack.a...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def goodNodes(self, root: TreeNode) -> int: """Runtime: 330 ms, faster than 72.00% Memory Usage: 32.7 MB, less than 7.60% The number of nodes in the binary tree is in the range [1, 10^5]. Each node's value is between [-10^4, 10^4].""" <|body_0|> def goodNodes2(self...
stack_v2_sparse_classes_75kplus_train_006901
2,340
permissive
[ { "docstring": "Runtime: 330 ms, faster than 72.00% Memory Usage: 32.7 MB, less than 7.60% The number of nodes in the binary tree is in the range [1, 10^5]. Each node's value is between [-10^4, 10^4].", "name": "goodNodes", "signature": "def goodNodes(self, root: TreeNode) -> int" }, { "docstrin...
2
stack_v2_sparse_classes_30k_train_033217
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def goodNodes(self, root: TreeNode) -> int: Runtime: 330 ms, faster than 72.00% Memory Usage: 32.7 MB, less than 7.60% The number of nodes in the binary tree is in the range [1, ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def goodNodes(self, root: TreeNode) -> int: Runtime: 330 ms, faster than 72.00% Memory Usage: 32.7 MB, less than 7.60% The number of nodes in the binary tree is in the range [1, ...
4dd1e54d8d08f7e6590bc76abd08ecaacaf775e5
<|skeleton|> class Solution: def goodNodes(self, root: TreeNode) -> int: """Runtime: 330 ms, faster than 72.00% Memory Usage: 32.7 MB, less than 7.60% The number of nodes in the binary tree is in the range [1, 10^5]. Each node's value is between [-10^4, 10^4].""" <|body_0|> def goodNodes2(self...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def goodNodes(self, root: TreeNode) -> int: """Runtime: 330 ms, faster than 72.00% Memory Usage: 32.7 MB, less than 7.60% The number of nodes in the binary tree is in the range [1, 10^5]. Each node's value is between [-10^4, 10^4].""" ret = 0 stack = [(root, root.val)] ...
the_stack_v2_python_sparse
src/1448-CountGoodNodesinBinaryTree.py
Jiezhi/myleetcode
train
1
2416d4936bacbb28ffbd035059331dd466fc8fe3
[ "first = True\nfor struct in self.get_filtered_struct_names():\n body = '' if first else '\\n'\n body += 'struct Decoded_{}\\n'.format(struct)\n body += '{\\n'\n body += ' using struct_type = {};\\n'.format(struct)\n body += '\\n'\n body += ' {}* decoded_value{{ nullptr }};\\n'.format(struct...
<|body_start_0|> first = True for struct in self.get_filtered_struct_names(): body = '' if first else '\n' body += 'struct Decoded_{}\n'.format(struct) body += '{\n' body += ' using struct_type = {};\n'.format(struct) body += '\n' ...
Base class for generating struct decoder header code.
BaseStructDecodersHeaderGenerator
[ "MIT", "LicenseRef-scancode-unknown-license-reference", "BSL-1.0", "Apache-2.0", "BSD-2-Clause", "BSD-3-Clause", "LicenseRef-scancode-warranty-disclaimer", "Zlib" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseStructDecodersHeaderGenerator: """Base class for generating struct decoder header code.""" def generate_feature(self): """Performs C++ code generation for the feature.""" <|body_0|> def needs_member_declaration(self, name, value): """Determines if a Vulkan st...
stack_v2_sparse_classes_75kplus_train_006902
4,936
permissive
[ { "docstring": "Performs C++ code generation for the feature.", "name": "generate_feature", "signature": "def generate_feature(self)" }, { "docstring": "Determines if a Vulkan struct member needs an associated member delcaration in the decoded struct wrapper.", "name": "needs_member_declarat...
4
stack_v2_sparse_classes_30k_train_022866
Implement the Python class `BaseStructDecodersHeaderGenerator` described below. Class description: Base class for generating struct decoder header code. Method signatures and docstrings: - def generate_feature(self): Performs C++ code generation for the feature. - def needs_member_declaration(self, name, value): Dete...
Implement the Python class `BaseStructDecodersHeaderGenerator` described below. Class description: Base class for generating struct decoder header code. Method signatures and docstrings: - def generate_feature(self): Performs C++ code generation for the feature. - def needs_member_declaration(self, name, value): Dete...
215926d051b982a17c200ee180cef7b6622ab1dd
<|skeleton|> class BaseStructDecodersHeaderGenerator: """Base class for generating struct decoder header code.""" def generate_feature(self): """Performs C++ code generation for the feature.""" <|body_0|> def needs_member_declaration(self, name, value): """Determines if a Vulkan st...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BaseStructDecodersHeaderGenerator: """Base class for generating struct decoder header code.""" def generate_feature(self): """Performs C++ code generation for the feature.""" first = True for struct in self.get_filtered_struct_names(): body = '' if first else '\n' ...
the_stack_v2_python_sparse
framework/generated/base_generators/base_struct_decoders_header_generator.py
LunarG/gfxreconstruct
train
316
4462f30af833257389b8228085b920d8765d82b1
[ "self._challenge = challenge\nself._appid = appid\nself.register_id = response_bytes[0]\nself.ec_public_key = response_bytes[1:66]\nself.key_handle_length = response_bytes[66]\nend = 67 + self.key_handle_length\nself.key_handle = response_bytes[67:end]\ncert_len, self._cert = self._get_cert(response_bytes[end:])\n_...
<|body_start_0|> self._challenge = challenge self._appid = appid self.register_id = response_bytes[0] self.ec_public_key = response_bytes[1:66] self.key_handle_length = response_bytes[66] end = 67 + self.key_handle_length self.key_handle = response_bytes[67:end] ...
Response to registration request
RegistrationResponse
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RegistrationResponse: """Response to registration request""" def __init__(self, response_bytes: bytes, challenge: bytes, appid: bytes): """Creates an registration response.""" <|body_0|> def _get_cert(msg: bytes) -> Tuple[int, bytes]: """Parse certificate out of ...
stack_v2_sparse_classes_75kplus_train_006903
12,328
permissive
[ { "docstring": "Creates an registration response.", "name": "__init__", "signature": "def __init__(self, response_bytes: bytes, challenge: bytes, appid: bytes)" }, { "docstring": "Parse certificate out of msg", "name": "_get_cert", "signature": "def _get_cert(msg: bytes) -> Tuple[int, by...
4
null
Implement the Python class `RegistrationResponse` described below. Class description: Response to registration request Method signatures and docstrings: - def __init__(self, response_bytes: bytes, challenge: bytes, appid: bytes): Creates an registration response. - def _get_cert(msg: bytes) -> Tuple[int, bytes]: Pars...
Implement the Python class `RegistrationResponse` described below. Class description: Response to registration request Method signatures and docstrings: - def __init__(self, response_bytes: bytes, challenge: bytes, appid: bytes): Creates an registration response. - def _get_cert(msg: bytes) -> Tuple[int, bytes]: Pars...
12cfa59f05c200a72fa204961e3a5f8b3d3c0ba0
<|skeleton|> class RegistrationResponse: """Response to registration request""" def __init__(self, response_bytes: bytes, challenge: bytes, appid: bytes): """Creates an registration response.""" <|body_0|> def _get_cert(msg: bytes) -> Tuple[int, bytes]: """Parse certificate out of ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RegistrationResponse: """Response to registration request""" def __init__(self, response_bytes: bytes, challenge: bytes, appid: bytes): """Creates an registration response.""" self._challenge = challenge self._appid = appid self.register_id = response_bytes[0] self...
the_stack_v2_python_sparse
py/u2f/u2f.py
digitalbitbox/bitbox02-firmware
train
219
2c1ce9b33fc0b7ac96c0e683692982322e64f2ae
[ "q = quantity.Volume(1.0, 'm^3')\nself.assertAlmostEqual(q.value, 1.0, 6)\nself.assertAlmostEqual(q.value_si, 1.0, delta=1e-06)\nself.assertEqual(q.units, 'm^3')", "q = quantity.Volume(1.0, 'L')\nself.assertAlmostEqual(q.value, 1.0, 6)\nself.assertAlmostEqual(q.value_si, 0.001, delta=1e-09)\nself.assertEqual(q.un...
<|body_start_0|> q = quantity.Volume(1.0, 'm^3') self.assertAlmostEqual(q.value, 1.0, 6) self.assertAlmostEqual(q.value_si, 1.0, delta=1e-06) self.assertEqual(q.units, 'm^3') <|end_body_0|> <|body_start_1|> q = quantity.Volume(1.0, 'L') self.assertAlmostEqual(q.value, 1....
Contains unit tests of the Volume unit type object.
TestVolume
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestVolume: """Contains unit tests of the Volume unit type object.""" def test_m3(self): """Test the creation of an volume quantity with units of m^3.""" <|body_0|> def test_L(self): """Test the creation of an volume quantity with units of L.""" <|body_1|...
stack_v2_sparse_classes_75kplus_train_006904
33,010
permissive
[ { "docstring": "Test the creation of an volume quantity with units of m^3.", "name": "test_m3", "signature": "def test_m3(self)" }, { "docstring": "Test the creation of an volume quantity with units of L.", "name": "test_L", "signature": "def test_L(self)" } ]
2
stack_v2_sparse_classes_30k_train_037181
Implement the Python class `TestVolume` described below. Class description: Contains unit tests of the Volume unit type object. Method signatures and docstrings: - def test_m3(self): Test the creation of an volume quantity with units of m^3. - def test_L(self): Test the creation of an volume quantity with units of L.
Implement the Python class `TestVolume` described below. Class description: Contains unit tests of the Volume unit type object. Method signatures and docstrings: - def test_m3(self): Test the creation of an volume quantity with units of m^3. - def test_L(self): Test the creation of an volume quantity with units of L....
0937b2e0a955dcf21b79674a4e89f43941c0dd85
<|skeleton|> class TestVolume: """Contains unit tests of the Volume unit type object.""" def test_m3(self): """Test the creation of an volume quantity with units of m^3.""" <|body_0|> def test_L(self): """Test the creation of an volume quantity with units of L.""" <|body_1|...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestVolume: """Contains unit tests of the Volume unit type object.""" def test_m3(self): """Test the creation of an volume quantity with units of m^3.""" q = quantity.Volume(1.0, 'm^3') self.assertAlmostEqual(q.value, 1.0, 6) self.assertAlmostEqual(q.value_si, 1.0, delta=1...
the_stack_v2_python_sparse
rmgpy/quantityTest.py
vrlambert/RMG-Py
train
1
2c109f2f224a95eb03a8fbf830d9c513269edd3c
[ "IContainsAnimals.__init__(self, 6)\nIContainsPlants.__init__(self, 4)\nIdentifiable.__init__(self)\nBiome.__init__(self, 'Mountain')", "try:\n if animal.elevation:\n super().add_animal(animal)\nexcept AttributeError:\n raise AttributeError('Animal Is Incompatible With Biome')", "try:\n if plant...
<|body_start_0|> IContainsAnimals.__init__(self, 6) IContainsPlants.__init__(self, 4) Identifiable.__init__(self) Biome.__init__(self, 'Mountain') <|end_body_0|> <|body_start_1|> try: if animal.elevation: super().add_animal(animal) except Attr...
Mountain
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Mountain: def __init__(self): """Initialize max occupancy of plants and animals""" <|body_0|> def add_animal(self, animal): """Mountain is highly elevated; animals must be able to live in high elevation; otherwise raise error""" <|body_1|> def add_plant(...
stack_v2_sparse_classes_75kplus_train_006905
1,214
no_license
[ { "docstring": "Initialize max occupancy of plants and animals", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Mountain is highly elevated; animals must be able to live in high elevation; otherwise raise error", "name": "add_animal", "signature": "def add_anima...
3
stack_v2_sparse_classes_30k_val_000710
Implement the Python class `Mountain` described below. Class description: Implement the Mountain class. Method signatures and docstrings: - def __init__(self): Initialize max occupancy of plants and animals - def add_animal(self, animal): Mountain is highly elevated; animals must be able to live in high elevation; ot...
Implement the Python class `Mountain` described below. Class description: Implement the Mountain class. Method signatures and docstrings: - def __init__(self): Initialize max occupancy of plants and animals - def add_animal(self, animal): Mountain is highly elevated; animals must be able to live in high elevation; ot...
fe0cd86fd8c48c51890ed07d7885303631a9ccdc
<|skeleton|> class Mountain: def __init__(self): """Initialize max occupancy of plants and animals""" <|body_0|> def add_animal(self, animal): """Mountain is highly elevated; animals must be able to live in high elevation; otherwise raise error""" <|body_1|> def add_plant(...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Mountain: def __init__(self): """Initialize max occupancy of plants and animals""" IContainsAnimals.__init__(self, 6) IContainsPlants.__init__(self, 4) Identifiable.__init__(self) Biome.__init__(self, 'Mountain') def add_animal(self, animal): """Mountain is...
the_stack_v2_python_sparse
biomes/mountain.py
nss-day-cohort-33/keahua-arboretum-uwehe-dancers
train
0
ef51a6df46d30dc5f94294f1abda8e2bf1d0ad3c
[ "flag_config = trigger_utils.AddTriggerArgs(parser)\ntrigger_utils.AddBuildConfigArgs(flag_config)\ntrigger_utils.AddGitRepoSource(flag_config)", "client = cloudbuild_util.GetClientInstance()\nmessages = cloudbuild_util.GetMessagesModule()\ntrigger = messages.BuildTrigger()\nif args.trigger_config:\n trigger =...
<|body_start_0|> flag_config = trigger_utils.AddTriggerArgs(parser) trigger_utils.AddBuildConfigArgs(flag_config) trigger_utils.AddGitRepoSource(flag_config) <|end_body_0|> <|body_start_1|> client = cloudbuild_util.GetClientInstance() messages = cloudbuild_util.GetMessagesModule...
Create a build trigger with a manual trigger event.
CreateManual
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CreateManual: """Create a build trigger with a manual trigger event.""" def Args(parser): """Register flags for this command. Args: parser: An argparse.ArgumentParser-like object.""" <|body_0|> def Run(self, args): """This is what gets called when the user runs t...
stack_v2_sparse_classes_75kplus_train_006906
4,478
permissive
[ { "docstring": "Register flags for this command. Args: parser: An argparse.ArgumentParser-like object.", "name": "Args", "signature": "def Args(parser)" }, { "docstring": "This is what gets called when the user runs this command. Args: args: An argparse namespace. All the arguments that were pro...
2
stack_v2_sparse_classes_30k_train_051975
Implement the Python class `CreateManual` described below. Class description: Create a build trigger with a manual trigger event. Method signatures and docstrings: - def Args(parser): Register flags for this command. Args: parser: An argparse.ArgumentParser-like object. - def Run(self, args): This is what gets called...
Implement the Python class `CreateManual` described below. Class description: Create a build trigger with a manual trigger event. Method signatures and docstrings: - def Args(parser): Register flags for this command. Args: parser: An argparse.ArgumentParser-like object. - def Run(self, args): This is what gets called...
392abf004b16203030e6efd2f0af24db7c8d669e
<|skeleton|> class CreateManual: """Create a build trigger with a manual trigger event.""" def Args(parser): """Register flags for this command. Args: parser: An argparse.ArgumentParser-like object.""" <|body_0|> def Run(self, args): """This is what gets called when the user runs t...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CreateManual: """Create a build trigger with a manual trigger event.""" def Args(parser): """Register flags for this command. Args: parser: An argparse.ArgumentParser-like object.""" flag_config = trigger_utils.AddTriggerArgs(parser) trigger_utils.AddBuildConfigArgs(flag_config) ...
the_stack_v2_python_sparse
lib/surface/builds/triggers/create/manual.py
google-cloud-sdk-unofficial/google-cloud-sdk
train
9
b08c6c0f719dba0cf9bbe189232f6836c002dcd6
[ "if isinstance(v, dict):\n v = {key.lower(): value for key, value in v.items()}\nreturn v", "fields = [v.get('filter_map'), v.get('static_map'), v.get('method'), v.get('for_each')]\nif not any(fields):\n raise ValueError('Either map or method must be defined.')\nif fields.count(None) < 2:\n raise ValueEr...
<|body_start_0|> if isinstance(v, dict): v = {key.lower(): value for key, value in v.items()} return v <|end_body_0|> <|body_start_1|> fields = [v.get('filter_map'), v.get('static_map'), v.get('method'), v.get('for_each')] if not any(fields): raise ValueError('Ei...
Model Definition
TransformModel
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TransformModel: """Model Definition""" def _lower_map_keys(cls, v): """Validate static_map.""" <|body_0|> def _required_transform(cls, v: dict): """Validate either static_map or method is defined.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_006907
7,504
permissive
[ { "docstring": "Validate static_map.", "name": "_lower_map_keys", "signature": "def _lower_map_keys(cls, v)" }, { "docstring": "Validate either static_map or method is defined.", "name": "_required_transform", "signature": "def _required_transform(cls, v: dict)" } ]
2
null
Implement the Python class `TransformModel` described below. Class description: Model Definition Method signatures and docstrings: - def _lower_map_keys(cls, v): Validate static_map. - def _required_transform(cls, v: dict): Validate either static_map or method is defined.
Implement the Python class `TransformModel` described below. Class description: Model Definition Method signatures and docstrings: - def _lower_map_keys(cls, v): Validate static_map. - def _required_transform(cls, v: dict): Validate either static_map or method is defined. <|skeleton|> class TransformModel: """Mo...
30dc147e40d63d1082ec2a5e6c62005b60c29c37
<|skeleton|> class TransformModel: """Model Definition""" def _lower_map_keys(cls, v): """Validate static_map.""" <|body_0|> def _required_transform(cls, v: dict): """Validate either static_map or method is defined.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TransformModel: """Model Definition""" def _lower_map_keys(cls, v): """Validate static_map.""" if isinstance(v, dict): v = {key.lower(): value for key, value in v.items()} return v def _required_transform(cls, v: dict): """Validate either static_map or met...
the_stack_v2_python_sparse
tcex/api/tc/ti_transform/model/transform_model.py
ThreatConnect-Inc/tcex
train
24
948465607d5d900b53e50bf6d6c5af150c9f8456
[ "super(DiscreteConvGenerator, self).__init__()\nself.design_shape = design_shape\nself.latent_size = latent_size\nself.embed_0 = tfkl.Dense(hidden)\nself.embed_0.build((None, 1))\nself.dense_0 = tfkl.Conv1D(hidden, 3, strides=1, padding='same')\nself.dense_0.build((None, None, latent_size + hidden))\nself.ln_0 = tf...
<|body_start_0|> super(DiscreteConvGenerator, self).__init__() self.design_shape = design_shape self.latent_size = latent_size self.embed_0 = tfkl.Dense(hidden) self.embed_0.build((None, 1)) self.dense_0 = tfkl.Conv1D(hidden, 3, strides=1, padding='same') self.den...
A Fully Connected Network conditioned on a score
DiscreteConvGenerator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DiscreteConvGenerator: """A Fully Connected Network conditioned on a score""" def __init__(self, design_shape, latent_size, hidden=50): """Create a fully connected architecture using keras that can process several parallel streams of weights and biases Args: design_shape: List[int] a...
stack_v2_sparse_classes_75kplus_train_006908
30,757
permissive
[ { "docstring": "Create a fully connected architecture using keras that can process several parallel streams of weights and biases Args: design_shape: List[int] a list of tuple of integers that represents the shape of a float design for a particular task latent_size: int the number of hidden units in the latent ...
2
stack_v2_sparse_classes_30k_train_044015
Implement the Python class `DiscreteConvGenerator` described below. Class description: A Fully Connected Network conditioned on a score Method signatures and docstrings: - def __init__(self, design_shape, latent_size, hidden=50): Create a fully connected architecture using keras that can process several parallel stre...
Implement the Python class `DiscreteConvGenerator` described below. Class description: A Fully Connected Network conditioned on a score Method signatures and docstrings: - def __init__(self, design_shape, latent_size, hidden=50): Create a fully connected architecture using keras that can process several parallel stre...
d46ff40d8b665953afb64a3332ddf1953b8a0766
<|skeleton|> class DiscreteConvGenerator: """A Fully Connected Network conditioned on a score""" def __init__(self, design_shape, latent_size, hidden=50): """Create a fully connected architecture using keras that can process several parallel streams of weights and biases Args: design_shape: List[int] a...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DiscreteConvGenerator: """A Fully Connected Network conditioned on a score""" def __init__(self, design_shape, latent_size, hidden=50): """Create a fully connected architecture using keras that can process several parallel streams of weights and biases Args: design_shape: List[int] a list of tupl...
the_stack_v2_python_sparse
design_baselines/mins/nets.py
stjordanis/design-baselines
train
0
6f07312fa13518413ccaa6d8a4b00f67d49a1d93
[ "self._check_access(request)\nawait self._check_login(data[ATTR_USERNAME], data[ATTR_PASSWORD])\nreturn web.Response(status=HTTP_OK)", "provider = self._get_provider()\ntry:\n await provider.async_validate_login(username, password)\nexcept HomeAssistantError:\n raise HTTPUnauthorized() from None" ]
<|body_start_0|> self._check_access(request) await self._check_login(data[ATTR_USERNAME], data[ATTR_PASSWORD]) return web.Response(status=HTTP_OK) <|end_body_0|> <|body_start_1|> provider = self._get_provider() try: await provider.async_validate_login(username, passw...
Hass.io view to handle auth requests.
HassIOAuth
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HassIOAuth: """Hass.io view to handle auth requests.""" async def post(self, request, data): """Handle auth requests.""" <|body_0|> async def _check_login(self, username, password): """Check User credentials.""" <|body_1|> <|end_skeleton|> <|body_start_...
stack_v2_sparse_classes_75kplus_train_006909
4,251
permissive
[ { "docstring": "Handle auth requests.", "name": "post", "signature": "async def post(self, request, data)" }, { "docstring": "Check User credentials.", "name": "_check_login", "signature": "async def _check_login(self, username, password)" } ]
2
stack_v2_sparse_classes_30k_train_033922
Implement the Python class `HassIOAuth` described below. Class description: Hass.io view to handle auth requests. Method signatures and docstrings: - async def post(self, request, data): Handle auth requests. - async def _check_login(self, username, password): Check User credentials.
Implement the Python class `HassIOAuth` described below. Class description: Hass.io view to handle auth requests. Method signatures and docstrings: - async def post(self, request, data): Handle auth requests. - async def _check_login(self, username, password): Check User credentials. <|skeleton|> class HassIOAuth: ...
ba55b4b8338a2dc0ba3f1d750efea49d86571291
<|skeleton|> class HassIOAuth: """Hass.io view to handle auth requests.""" async def post(self, request, data): """Handle auth requests.""" <|body_0|> async def _check_login(self, username, password): """Check User credentials.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class HassIOAuth: """Hass.io view to handle auth requests.""" async def post(self, request, data): """Handle auth requests.""" self._check_access(request) await self._check_login(data[ATTR_USERNAME], data[ATTR_PASSWORD]) return web.Response(status=HTTP_OK) async def _check_...
the_stack_v2_python_sparse
homeassistant/components/hassio/auth.py
basnijholt/home-assistant
train
5
427fa7add1e8667aafdae49e353ec092ae607e1f
[ "class ABC(compat.ABCBase):\n pass\n\n@ABC.register\nclass ABCImplementation(object):\n pass\nself.assertIsInstance(ABCImplementation(), ABC)", "self.assertNotIsInstance(compat.range(5), list)\nself.assertEqual(list(compat.range(10)), list(range(10)))\nself.assertIn(19, compat.range(15, 20))\nself.assertNot...
<|body_start_0|> class ABC(compat.ABCBase): pass @ABC.register class ABCImplementation(object): pass self.assertIsInstance(ABCImplementation(), ABC) <|end_body_0|> <|body_start_1|> self.assertNotIsInstance(compat.range(5), list) self.assertEqual(...
Tests for python version compatibility helpers
TestCompat
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestCompat: """Tests for python version compatibility helpers""" def test_abc(self): """ABC Baseclass""" <|body_0|> def test_range(self): """Py3.X range""" <|body_1|> def test_views(self): """Dict views""" <|body_2|> <|end_skeleton|>...
stack_v2_sparse_classes_75kplus_train_006910
1,259
permissive
[ { "docstring": "ABC Baseclass", "name": "test_abc", "signature": "def test_abc(self)" }, { "docstring": "Py3.X range", "name": "test_range", "signature": "def test_range(self)" }, { "docstring": "Dict views", "name": "test_views", "signature": "def test_views(self)" } ]
3
null
Implement the Python class `TestCompat` described below. Class description: Tests for python version compatibility helpers Method signatures and docstrings: - def test_abc(self): ABC Baseclass - def test_range(self): Py3.X range - def test_views(self): Dict views
Implement the Python class `TestCompat` described below. Class description: Tests for python version compatibility helpers Method signatures and docstrings: - def test_abc(self): ABC Baseclass - def test_range(self): Py3.X range - def test_views(self): Dict views <|skeleton|> class TestCompat: """Tests for pytho...
3cdc360585fbb412216ce1c741bf2cadabbdba65
<|skeleton|> class TestCompat: """Tests for python version compatibility helpers""" def test_abc(self): """ABC Baseclass""" <|body_0|> def test_range(self): """Py3.X range""" <|body_1|> def test_views(self): """Dict views""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestCompat: """Tests for python version compatibility helpers""" def test_abc(self): """ABC Baseclass""" class ABC(compat.ABCBase): pass @ABC.register class ABCImplementation(object): pass self.assertIsInstance(ABCImplementation(), ABC) ...
the_stack_v2_python_sparse
dengraph_unittests/test_compat.py
MaineKuehn/dengraph
train
5
bd85718257c32e89308e52ac671657bf11b00b0b
[ "results = self.form.search()\nif results.count() == 0 and len(self.request.GET) > 0 and (not 'q' in self.request.GET):\n results = SearchQuerySet()\nself.vs_query = ''\nif 'q' in self.request.GET:\n self.vs_query += ' text:' + self.request.GET.get('q')\ndocuments_ids = self.get_documents().values_list('id', ...
<|body_start_0|> results = self.form.search() if results.count() == 0 and len(self.request.GET) > 0 and (not 'q' in self.request.GET): results = SearchQuerySet() self.vs_query = '' if 'q' in self.request.GET: self.vs_query += ' text:' + self.request.GET.get('q') ...
SearchDocumentView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SearchDocumentView: def get_results(self): """Fetches the results via the form. Returns an empty list if there's no query to search with.""" <|body_0|> def get_documents(self): """Return the documents accordingly to specific search field""" <|body_1|> de...
stack_v2_sparse_classes_75kplus_train_006911
17,963
no_license
[ { "docstring": "Fetches the results via the form. Returns an empty list if there's no query to search with.", "name": "get_results", "signature": "def get_results(self)" }, { "docstring": "Return the documents accordingly to specific search field", "name": "get_documents", "signature": "...
3
stack_v2_sparse_classes_30k_train_001858
Implement the Python class `SearchDocumentView` described below. Class description: Implement the SearchDocumentView class. Method signatures and docstrings: - def get_results(self): Fetches the results via the form. Returns an empty list if there's no query to search with. - def get_documents(self): Return the docum...
Implement the Python class `SearchDocumentView` described below. Class description: Implement the SearchDocumentView class. Method signatures and docstrings: - def get_results(self): Fetches the results via the form. Returns an empty list if there's no query to search with. - def get_documents(self): Return the docum...
c735b22045a38852dcfdc8e0235567db6aab92cd
<|skeleton|> class SearchDocumentView: def get_results(self): """Fetches the results via the form. Returns an empty list if there's no query to search with.""" <|body_0|> def get_documents(self): """Return the documents accordingly to specific search field""" <|body_1|> de...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SearchDocumentView: def get_results(self): """Fetches the results via the form. Returns an empty list if there's no query to search with.""" results = self.form.search() if results.count() == 0 and len(self.request.GET) > 0 and (not 'q' in self.request.GET): results = Searc...
the_stack_v2_python_sparse
documents/views.py
leonardotw/festos
train
0
41b7649873ec0e4890a883ade215fe493c730512
[ "if self.driver.owner != self.name:\n self.driver.owner = self.name\nsweep_modes = {'SA': 'Spectrum Analyzer', 'SPEC': 'Basic Spectrum Analyzer', 'WAV': 'Waveform'}\nd = self.driver\nheader = cleandoc('Start freq {}, Stop freq {}, Span freq {},\\n Center freq {}, Average number {}, Resol...
<|body_start_0|> if self.driver.owner != self.name: self.driver.owner = self.name sweep_modes = {'SA': 'Spectrum Analyzer', 'SPEC': 'Basic Spectrum Analyzer', 'WAV': 'Waveform'} d = self.driver header = cleandoc('Start freq {}, Stop freq {}, Span freq {},\n ...
Get the trace displayed on the Power Spectrum Analyzer.
PSAGetTrace
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PSAGetTrace: """Get the trace displayed on the Power Spectrum Analyzer.""" def perform(self): """Get the specified trace from the instrument.""" <|body_0|> def check(self, *args, **kwargs): """Validate the provided trace number.""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_75kplus_train_006912
11,298
permissive
[ { "docstring": "Get the specified trace from the instrument.", "name": "perform", "signature": "def perform(self)" }, { "docstring": "Validate the provided trace number.", "name": "check", "signature": "def check(self, *args, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_041807
Implement the Python class `PSAGetTrace` described below. Class description: Get the trace displayed on the Power Spectrum Analyzer. Method signatures and docstrings: - def perform(self): Get the specified trace from the instrument. - def check(self, *args, **kwargs): Validate the provided trace number.
Implement the Python class `PSAGetTrace` described below. Class description: Get the trace displayed on the Power Spectrum Analyzer. Method signatures and docstrings: - def perform(self): Get the specified trace from the instrument. - def check(self, *args, **kwargs): Validate the provided trace number. <|skeleton|>...
b6f1f5b236c7a4e28d9a3bc8da9820c52d789309
<|skeleton|> class PSAGetTrace: """Get the trace displayed on the Power Spectrum Analyzer.""" def perform(self): """Get the specified trace from the instrument.""" <|body_0|> def check(self, *args, **kwargs): """Validate the provided trace number.""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PSAGetTrace: """Get the trace displayed on the Power Spectrum Analyzer.""" def perform(self): """Get the specified trace from the instrument.""" if self.driver.owner != self.name: self.driver.owner = self.name sweep_modes = {'SA': 'Spectrum Analyzer', 'SPEC': 'Basic Sp...
the_stack_v2_python_sparse
exopy_hqc_legacy/tasks/tasks/instr/psa_tasks.py
Exopy/exopy_hqc_legacy
train
0
5b9b3a78c0acd53247cdc5a94086eb110799acdc
[ "self.left = None\nself.right = None\nself.data = data", "if data < self.data:\n if self.left is None:\n self.left = Node(data)\n else:\n self.left.insert(data)\nelif self.right is None:\n self.right = Node(data)\nelse:\n self.right.insert(data)", "if data < self.data:\n if self.lef...
<|body_start_0|> self.left = None self.right = None self.data = data <|end_body_0|> <|body_start_1|> if data < self.data: if self.left is None: self.left = Node(data) else: self.left.insert(data) elif self.right is None: ...
Tree Node: left and right child + data, which can be any object
Node
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Node: """Tree Node: left and right child + data, which can be any object""" def __init__(self, data): """Node constructor @param data node data object""" <|body_0|> def insert(self, data): """Insert new node with data @param data: Node data objec to insert""" ...
stack_v2_sparse_classes_75kplus_train_006913
3,647
no_license
[ { "docstring": "Node constructor @param data node data object", "name": "__init__", "signature": "def __init__(self, data)" }, { "docstring": "Insert new node with data @param data: Node data objec to insert", "name": "insert", "signature": "def insert(self, data)" }, { "docstrin...
6
null
Implement the Python class `Node` described below. Class description: Tree Node: left and right child + data, which can be any object Method signatures and docstrings: - def __init__(self, data): Node constructor @param data node data object - def insert(self, data): Insert new node with data @param data: Node data o...
Implement the Python class `Node` described below. Class description: Tree Node: left and right child + data, which can be any object Method signatures and docstrings: - def __init__(self, data): Node constructor @param data node data object - def insert(self, data): Insert new node with data @param data: Node data o...
360eca350691edd17744a2ea1b16c79e1a9ad117
<|skeleton|> class Node: """Tree Node: left and right child + data, which can be any object""" def __init__(self, data): """Node constructor @param data node data object""" <|body_0|> def insert(self, data): """Insert new node with data @param data: Node data objec to insert""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Node: """Tree Node: left and right child + data, which can be any object""" def __init__(self, data): """Node constructor @param data node data object""" self.left = None self.right = None self.data = data def insert(self, data): """Insert new node with data @...
the_stack_v2_python_sparse
testpy/src/BTree/BTree.py
RobinLiu/Test
train
2
09c4630a27f1edd7b2ce225801bf11629486b71a
[ "self.all_users = all_users\nself.denied_referrer_vec = denied_referrer_vec\nself.granted_referrer_vec = granted_referrer_vec\nself.rlistings = rlistings", "if dictionary is None:\n return None\nall_users = dictionary.get('allUsers')\ndenied_referrer_vec = dictionary.get('deniedReferrerVec')\ngranted_referrer_...
<|body_start_0|> self.all_users = all_users self.denied_referrer_vec = denied_referrer_vec self.granted_referrer_vec = granted_referrer_vec self.rlistings = rlistings <|end_body_0|> <|body_start_1|> if dictionary is None: return None all_users = dictionary.ge...
Implementation of the 'CommonACLProto_Grantees' model. TODO: type description here. Attributes: all_users (bool): This field indicates if all users are granted ACL permission. denied_referrer_vec (list of string): This field holds a list of referers who are denied ACL permission. granted_referrer_vec (list of string): ...
CommonACLProto_Grantees
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CommonACLProto_Grantees: """Implementation of the 'CommonACLProto_Grantees' model. TODO: type description here. Attributes: all_users (bool): This field indicates if all users are granted ACL permission. denied_referrer_vec (list of string): This field holds a list of referers who are denied ACL ...
stack_v2_sparse_classes_75kplus_train_006914
2,490
permissive
[ { "docstring": "Constructor for the CommonACLProto_Grantees class", "name": "__init__", "signature": "def __init__(self, all_users=None, denied_referrer_vec=None, granted_referrer_vec=None, rlistings=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (...
2
null
Implement the Python class `CommonACLProto_Grantees` described below. Class description: Implementation of the 'CommonACLProto_Grantees' model. TODO: type description here. Attributes: all_users (bool): This field indicates if all users are granted ACL permission. denied_referrer_vec (list of string): This field holds...
Implement the Python class `CommonACLProto_Grantees` described below. Class description: Implementation of the 'CommonACLProto_Grantees' model. TODO: type description here. Attributes: all_users (bool): This field indicates if all users are granted ACL permission. denied_referrer_vec (list of string): This field holds...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class CommonACLProto_Grantees: """Implementation of the 'CommonACLProto_Grantees' model. TODO: type description here. Attributes: all_users (bool): This field indicates if all users are granted ACL permission. denied_referrer_vec (list of string): This field holds a list of referers who are denied ACL ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CommonACLProto_Grantees: """Implementation of the 'CommonACLProto_Grantees' model. TODO: type description here. Attributes: all_users (bool): This field indicates if all users are granted ACL permission. denied_referrer_vec (list of string): This field holds a list of referers who are denied ACL permission. g...
the_stack_v2_python_sparse
cohesity_management_sdk/models/common_acl_proto_grantees.py
cohesity/management-sdk-python
train
24
4e10376c2b45ef591291db92cdb4536f41036c84
[ "flat = []\nif lol is not None:\n for chunk in lol:\n if isinstance(chunk, int):\n flat.append(chunk)\n else:\n flat.extend(chunk)\nreturn flat", "flat = []\nif lol is not None:\n for chunk in lol:\n if isinstance(chunk, str):\n flat.append(chunk)\n ...
<|body_start_0|> flat = [] if lol is not None: for chunk in lol: if isinstance(chunk, int): flat.append(chunk) else: flat.extend(chunk) return flat <|end_body_0|> <|body_start_1|> flat = [] if lo...
functions that can be called on argVals after initial parsing has completed. Usually for assisting with combinations of nargs='+' and a ConversionFunc
PostProcessFuncs
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PostProcessFuncs: """functions that can be called on argVals after initial parsing has completed. Usually for assisting with combinations of nargs='+' and a ConversionFunc""" def intRange(lol): """if type=intRange and nargs='*' are used together, we get back a mixed list of ints and ...
stack_v2_sparse_classes_75kplus_train_006915
19,676
permissive
[ { "docstring": "if type=intRange and nargs='*' are used together, we get back a mixed list of ints and list-of-ints, so this'll flatten it", "name": "intRange", "signature": "def intRange(lol)" }, { "docstring": "if type=strList and nargs='*' are used together, we get back a mixed list of val an...
2
stack_v2_sparse_classes_30k_train_018686
Implement the Python class `PostProcessFuncs` described below. Class description: functions that can be called on argVals after initial parsing has completed. Usually for assisting with combinations of nargs='+' and a ConversionFunc Method signatures and docstrings: - def intRange(lol): if type=intRange and nargs='*'...
Implement the Python class `PostProcessFuncs` described below. Class description: functions that can be called on argVals after initial parsing has completed. Usually for assisting with combinations of nargs='+' and a ConversionFunc Method signatures and docstrings: - def intRange(lol): if type=intRange and nargs='*'...
98b4bc8afaec2c86c859ad4f441934c19fe45be6
<|skeleton|> class PostProcessFuncs: """functions that can be called on argVals after initial parsing has completed. Usually for assisting with combinations of nargs='+' and a ConversionFunc""" def intRange(lol): """if type=intRange and nargs='*' are used together, we get back a mixed list of ints and ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PostProcessFuncs: """functions that can be called on argVals after initial parsing has completed. Usually for assisting with combinations of nargs='+' and a ConversionFunc""" def intRange(lol): """if type=intRange and nargs='*' are used together, we get back a mixed list of ints and list-of-ints,...
the_stack_v2_python_sparse
testdebug/helper/parseHelper.py
telamonian/testdebug
train
0
bc1c98d3c79c8ef00f632237abf90120927a5443
[ "n = len(s)\nadjMap = defaultdict(set)\nfor start in range(n):\n left, right = (start, start)\n while left >= 0 and right < n and (s[left] == s[right]):\n adjMap[left].add(right + 1)\n left -= 1\n right += 1\n left, right = (start, start + 1)\n while left >= 0 and right < n and (s[l...
<|body_start_0|> n = len(s) adjMap = defaultdict(set) for start in range(n): left, right = (start, start) while left >= 0 and right < n and (s[left] == s[right]): adjMap[left].add(right + 1) left -= 1 right += 1 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minCut(self, s: str) -> int: """:给你一个字符串 s,请你将 s 分割成一些子串,使每个子串都是回文。 返回符合要求的 最少分割次数 。""" <|body_0|> def minCut2(self, s: str) -> int: """:给你一个字符串 s,请你将 s 分割成一些子串,使每个子串都是回文。 返回符合要求的 最少分割次数 。""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_006916
2,494
no_license
[ { "docstring": ":给你一个字符串 s,请你将 s 分割成一些子串,使每个子串都是回文。 返回符合要求的 最少分割次数 。", "name": "minCut", "signature": "def minCut(self, s: str) -> int" }, { "docstring": ":给你一个字符串 s,请你将 s 分割成一些子串,使每个子串都是回文。 返回符合要求的 最少分割次数 。", "name": "minCut2", "signature": "def minCut2(self, s: str) -> int" } ]
2
stack_v2_sparse_classes_30k_train_007210
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minCut(self, s: str) -> int: :给你一个字符串 s,请你将 s 分割成一些子串,使每个子串都是回文。 返回符合要求的 最少分割次数 。 - def minCut2(self, s: str) -> int: :给你一个字符串 s,请你将 s 分割成一些子串,使每个子串都是回文。 返回符合要求的 最少分割次数 。
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minCut(self, s: str) -> int: :给你一个字符串 s,请你将 s 分割成一些子串,使每个子串都是回文。 返回符合要求的 最少分割次数 。 - def minCut2(self, s: str) -> int: :给你一个字符串 s,请你将 s 分割成一些子串,使每个子串都是回文。 返回符合要求的 最少分割次数 。 <|...
7e79e26bb8f641868561b186e34c1127ed63c9e0
<|skeleton|> class Solution: def minCut(self, s: str) -> int: """:给你一个字符串 s,请你将 s 分割成一些子串,使每个子串都是回文。 返回符合要求的 最少分割次数 。""" <|body_0|> def minCut2(self, s: str) -> int: """:给你一个字符串 s,请你将 s 分割成一些子串,使每个子串都是回文。 返回符合要求的 最少分割次数 。""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def minCut(self, s: str) -> int: """:给你一个字符串 s,请你将 s 分割成一些子串,使每个子串都是回文。 返回符合要求的 最少分割次数 。""" n = len(s) adjMap = defaultdict(set) for start in range(n): left, right = (start, start) while left >= 0 and right < n and (s[left] == s[right]): ...
the_stack_v2_python_sparse
11_动态规划/dp分类/区间dp/dfs/回文/分割回文串/132_分割回文串-最短路建图.py
981377660LMT/algorithm-study
train
225
04ae1e6821d1937e43fe1fe110658070ecf36309
[ "A.sort()\nfor i in range(len(A)):\n if not K:\n break\n if A[i] < 0:\n A[i] = -A[i]\n K -= 1\nif K % 2 == 0:\n return sum(A)\nelse:\n return sum(A) - 2 * min(A)", "for i in range(K):\n idx = A.index(min(A))\n A[idx] = -A[idx]\nreturn sum(A)" ]
<|body_start_0|> A.sort() for i in range(len(A)): if not K: break if A[i] < 0: A[i] = -A[i] K -= 1 if K % 2 == 0: return sum(A) else: return sum(A) - 2 * min(A) <|end_body_0|> <|body_start_1|...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def largestSumAfterKNegations(self, A, K): """:type A: List[int] :type K: int :rtype: int""" <|body_0|> def largestSumAfterKNegations2(self, A, K): """:type A: List[int] :type K: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_006917
1,756
no_license
[ { "docstring": ":type A: List[int] :type K: int :rtype: int", "name": "largestSumAfterKNegations", "signature": "def largestSumAfterKNegations(self, A, K)" }, { "docstring": ":type A: List[int] :type K: int :rtype: int", "name": "largestSumAfterKNegations2", "signature": "def largestSumA...
2
stack_v2_sparse_classes_30k_test_001393
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def largestSumAfterKNegations(self, A, K): :type A: List[int] :type K: int :rtype: int - def largestSumAfterKNegations2(self, A, K): :type A: List[int] :type K: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def largestSumAfterKNegations(self, A, K): :type A: List[int] :type K: int :rtype: int - def largestSumAfterKNegations2(self, A, K): :type A: List[int] :type K: int :rtype: int ...
8595b04cf5a024c2cd8a97f750d890a818568401
<|skeleton|> class Solution: def largestSumAfterKNegations(self, A, K): """:type A: List[int] :type K: int :rtype: int""" <|body_0|> def largestSumAfterKNegations2(self, A, K): """:type A: List[int] :type K: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def largestSumAfterKNegations(self, A, K): """:type A: List[int] :type K: int :rtype: int""" A.sort() for i in range(len(A)): if not K: break if A[i] < 0: A[i] = -A[i] K -= 1 if K % 2 == 0: ...
the_stack_v2_python_sparse
python/1005.maximize-sum-of-array-after-k-negations.py
tainenko/Leetcode2019
train
5
2613f5602b751d43c74f8f1bd1212da0e78a9eda
[ "super().__init__(**kwargs)\nself.px = 0\nself.py = 0\nself.image: 'Image'", "img_bytes = io.BytesIO(base64.b64decode(data))\ntry:\n self.image = Image.open(img_bytes)\nexcept IOError:\n log.error('Could not load image.')\nelse:\n orig_px, orig_py = self.image.size\n app = cast('App', get_app())\n ...
<|body_start_0|> super().__init__(**kwargs) self.px = 0 self.py = 0 self.image: 'Image' <|end_body_0|> <|body_start_1|> img_bytes = io.BytesIO(base64.b64decode(data)) try: self.image = Image.open(img_bytes) except IOError: log.error('Could...
Mixin for rendering images which calulates the size to render the image.
ImageMixin
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImageMixin: """Mixin for rendering images which calulates the size to render the image.""" def __init__(self, **kwargs: 'Any'): """Initiate the image renderer. Args: **kwargs: Key-word arguments to pass to the renderer initiation method.""" <|body_0|> def load(self, data...
stack_v2_sparse_classes_75kplus_train_006918
34,138
permissive
[ { "docstring": "Initiate the image renderer. Args: **kwargs: Key-word arguments to pass to the renderer initiation method.", "name": "__init__", "signature": "def __init__(self, **kwargs: 'Any')" }, { "docstring": "Determine the width and height of the output image before rendering. Images are d...
2
stack_v2_sparse_classes_30k_train_020639
Implement the Python class `ImageMixin` described below. Class description: Mixin for rendering images which calulates the size to render the image. Method signatures and docstrings: - def __init__(self, **kwargs: 'Any'): Initiate the image renderer. Args: **kwargs: Key-word arguments to pass to the renderer initiati...
Implement the Python class `ImageMixin` described below. Class description: Mixin for rendering images which calulates the size to render the image. Method signatures and docstrings: - def __init__(self, **kwargs: 'Any'): Initiate the image renderer. Args: **kwargs: Key-word arguments to pass to the renderer initiati...
4dfa2df52dc877dd809f947f4ccbc2956bae1bc4
<|skeleton|> class ImageMixin: """Mixin for rendering images which calulates the size to render the image.""" def __init__(self, **kwargs: 'Any'): """Initiate the image renderer. Args: **kwargs: Key-word arguments to pass to the renderer initiation method.""" <|body_0|> def load(self, data...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ImageMixin: """Mixin for rendering images which calulates the size to render the image.""" def __init__(self, **kwargs: 'Any'): """Initiate the image renderer. Args: **kwargs: Key-word arguments to pass to the renderer initiation method.""" super().__init__(**kwargs) self.px = 0 ...
the_stack_v2_python_sparse
euporie/render.py
betolink/euporie
train
0
0bc04914edd109977466d514dd0508fa2eda5b5f
[ "try:\n self.session_duration = int(getenv('SESSION_DURATION', 0))\nexcept ValueError:\n self.session_duration = 0", "session_id = super().create_session(user_id)\nif session_id is None:\n return None\nsession_dictionary = {'user_id': user_id, 'created_at': datetime.now()}\nself.user_id_by_session_id[ses...
<|body_start_0|> try: self.session_duration = int(getenv('SESSION_DURATION', 0)) except ValueError: self.session_duration = 0 <|end_body_0|> <|body_start_1|> session_id = super().create_session(user_id) if session_id is None: return None sessi...
initial to define attribute duration
SessionExpAuth
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SessionExpAuth: """initial to define attribute duration""" def __init__(self): """initial to define attribute duration""" <|body_0|> def create_session(self, user_id=None): """Overload session create""" <|body_1|> def user_id_for_session_id(self, ses...
stack_v2_sparse_classes_75kplus_train_006919
1,586
no_license
[ { "docstring": "initial to define attribute duration", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Overload session create", "name": "create_session", "signature": "def create_session(self, user_id=None)" }, { "docstring": "assing new dict to dict int...
3
null
Implement the Python class `SessionExpAuth` described below. Class description: initial to define attribute duration Method signatures and docstrings: - def __init__(self): initial to define attribute duration - def create_session(self, user_id=None): Overload session create - def user_id_for_session_id(self, session...
Implement the Python class `SessionExpAuth` described below. Class description: initial to define attribute duration Method signatures and docstrings: - def __init__(self): initial to define attribute duration - def create_session(self, user_id=None): Overload session create - def user_id_for_session_id(self, session...
5ed1a21e4266cc70d4122b77e7712319530d9029
<|skeleton|> class SessionExpAuth: """initial to define attribute duration""" def __init__(self): """initial to define attribute duration""" <|body_0|> def create_session(self, user_id=None): """Overload session create""" <|body_1|> def user_id_for_session_id(self, ses...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SessionExpAuth: """initial to define attribute duration""" def __init__(self): """initial to define attribute duration""" try: self.session_duration = int(getenv('SESSION_DURATION', 0)) except ValueError: self.session_duration = 0 def create_session(se...
the_stack_v2_python_sparse
0x07-Session_authentication/api/v1/auth/session_exp_auth.py
VictorZ94/holbertonschool-web_back_end
train
0
40e292ea1a269fbf4b9bc44f4b502d7b7761b5d5
[ "self.nodes, node = ([], head)\nwhile node:\n self.nodes.append(node)\n node = node.next", "if 0 < len(self.nodes):\n return random.choice(self.nodes).val\nreturn float('inf')" ]
<|body_start_0|> self.nodes, node = ([], head) while node: self.nodes.append(node) node = node.next <|end_body_0|> <|body_start_1|> if 0 < len(self.nodes): return random.choice(self.nodes).val return float('inf') <|end_body_1|>
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def __init__(self, head: ListNode): """@param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node.""" <|body_0|> def getRandom(self) -> int: """Returns a random node's value.""" <|body_1|> ...
stack_v2_sparse_classes_75kplus_train_006920
935
no_license
[ { "docstring": "@param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node.", "name": "__init__", "signature": "def __init__(self, head: ListNode)" }, { "docstring": "Returns a random node's value.", "name": "getRandom", "signatu...
2
stack_v2_sparse_classes_30k_train_020560
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, head: ListNode): @param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node. - def getRandom(self) -...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, head: ListNode): @param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node. - def getRandom(self) -...
5376dd48b1cefb4faba9d2ef6a8a497b6b1d6c67
<|skeleton|> class Solution: def __init__(self, head: ListNode): """@param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node.""" <|body_0|> def getRandom(self) -> int: """Returns a random node's value.""" <|body_1|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def __init__(self, head: ListNode): """@param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node.""" self.nodes, node = ([], head) while node: self.nodes.append(node) node = node.next def...
the_stack_v2_python_sparse
python/problem-linked-list/linked_list_random_node.py
hyunjun/practice
train
3
a01c7500b6d35f33d32f399ae27f804f5ecbcf05
[ "if self.train_verbose >= 2 and self.is_chief and (batch_index % self.train_report_steps == 0):\n try:\n out_buffer = OrderedDict(time=time.strftime('%Y-%m-%d @ %H:%M:%S'), epoch=f'{self.cur_epoch}/{self.epochs}', step=f'{self._format_batch(batch_index, self.train_num_batches)}', lr=f\"{self.trainer.optim...
<|body_start_0|> if self.train_verbose >= 2 and self.is_chief and (batch_index % self.train_report_steps == 0): try: out_buffer = OrderedDict(time=time.strftime('%Y-%m-%d @ %H:%M:%S'), epoch=f'{self.cur_epoch}/{self.epochs}', step=f'{self._format_batch(batch_index, self.train_num_bat...
Callback that shows the progress of evaluating metrics.
DetectionProgressLogger
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DetectionProgressLogger: """Callback that shows the progress of evaluating metrics.""" def after_train_step(self, batch_index, logs=None): """Be called before each batch training.""" <|body_0|> def after_valid_step(self, batch_index, logs=None): """Be called afte...
stack_v2_sparse_classes_75kplus_train_006921
3,359
permissive
[ { "docstring": "Be called before each batch training.", "name": "after_train_step", "signature": "def after_train_step(self, batch_index, logs=None)" }, { "docstring": "Be called after each batch of the validation.", "name": "after_valid_step", "signature": "def after_valid_step(self, ba...
3
stack_v2_sparse_classes_30k_train_017563
Implement the Python class `DetectionProgressLogger` described below. Class description: Callback that shows the progress of evaluating metrics. Method signatures and docstrings: - def after_train_step(self, batch_index, logs=None): Be called before each batch training. - def after_valid_step(self, batch_index, logs=...
Implement the Python class `DetectionProgressLogger` described below. Class description: Callback that shows the progress of evaluating metrics. Method signatures and docstrings: - def after_train_step(self, batch_index, logs=None): Be called before each batch training. - def after_valid_step(self, batch_index, logs=...
e4ef3a1c92d19d1d08c3ef0e2156b6fecefdbe04
<|skeleton|> class DetectionProgressLogger: """Callback that shows the progress of evaluating metrics.""" def after_train_step(self, batch_index, logs=None): """Be called before each batch training.""" <|body_0|> def after_valid_step(self, batch_index, logs=None): """Be called afte...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DetectionProgressLogger: """Callback that shows the progress of evaluating metrics.""" def after_train_step(self, batch_index, logs=None): """Be called before each batch training.""" if self.train_verbose >= 2 and self.is_chief and (batch_index % self.train_report_steps == 0): ...
the_stack_v2_python_sparse
zeus/trainer/callbacks/detection_progress_logger.py
huawei-noah/xingtian
train
308
48edb93e1910c13675358d8455375773fc2f701b
[ "threading.Thread.__init__(self, name=name)\nself.aufz = aufz\nself.id = num\nself.lck = lck\nself.stock = 0", "while not stop:\n newstock = random.randint(0, self.NSTOCK)\n if newstock != self.stock:\n s1 = time.time()\n self.lck.acquire()\n self.aufz.travel(self.stock, newstock)\n ...
<|body_start_0|> threading.Thread.__init__(self, name=name) self.aufz = aufz self.id = num self.lck = lck self.stock = 0 <|end_body_0|> <|body_start_1|> while not stop: newstock = random.randint(0, self.NSTOCK) if newstock != self.stock: ...
A sample thread class
AufzugSim
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AufzugSim: """A sample thread class""" def __init__(self, num, aufz, lck, name='TestThread'): """Constructor, setting initial variables""" <|body_0|> def run(self): """overload of threading.thread.run() main control loop""" <|body_1|> <|end_skeleton|> <...
stack_v2_sparse_classes_75kplus_train_006922
2,072
no_license
[ { "docstring": "Constructor, setting initial variables", "name": "__init__", "signature": "def __init__(self, num, aufz, lck, name='TestThread')" }, { "docstring": "overload of threading.thread.run() main control loop", "name": "run", "signature": "def run(self)" } ]
2
stack_v2_sparse_classes_30k_train_051187
Implement the Python class `AufzugSim` described below. Class description: A sample thread class Method signatures and docstrings: - def __init__(self, num, aufz, lck, name='TestThread'): Constructor, setting initial variables - def run(self): overload of threading.thread.run() main control loop
Implement the Python class `AufzugSim` described below. Class description: A sample thread class Method signatures and docstrings: - def __init__(self, num, aufz, lck, name='TestThread'): Constructor, setting initial variables - def run(self): overload of threading.thread.run() main control loop <|skeleton|> class A...
9b9823da3dbfaa53d579f2158794984fefa5b239
<|skeleton|> class AufzugSim: """A sample thread class""" def __init__(self, num, aufz, lck, name='TestThread'): """Constructor, setting initial variables""" <|body_0|> def run(self): """overload of threading.thread.run() main control loop""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AufzugSim: """A sample thread class""" def __init__(self, num, aufz, lck, name='TestThread'): """Constructor, setting initial variables""" threading.Thread.__init__(self, name=name) self.aufz = aufz self.id = num self.lck = lck self.stock = 0 def run(s...
the_stack_v2_python_sparse
notebooks/source/AufzugSim.py
fuenfundachtzig/Pythonkurs1
train
1
5bb32112032f292891bc8ca887e02ab9f60b37a3
[ "n = len(nums)\nif n < 4:\n return []\nL = set()\nsumsIndexes = {}\nfor i in range(n):\n for j in range(i + 1, n):\n cursum = nums[i] + nums[j]\n if cursum in sumsIndexes:\n sumsIndexes[cursum].append((i, j))\n else:\n sumsIndexes[cursum] = [(i, j)]\nfor i in range(n...
<|body_start_0|> n = len(nums) if n < 4: return [] L = set() sumsIndexes = {} for i in range(n): for j in range(i + 1, n): cursum = nums[i] + nums[j] if cursum in sumsIndexes: sumsIndexes[cursum].append((...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def fourSum(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[List[int]]""" <|body_0|> def fourSum_slow(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_75kplus_train_006923
1,875
permissive
[ { "docstring": ":type nums: List[int] :type target: int :rtype: List[List[int]]", "name": "fourSum", "signature": "def fourSum(self, nums, target)" }, { "docstring": ":type nums: List[int] :type target: int :rtype: List[List[int]]", "name": "fourSum_slow", "signature": "def fourSum_slow(...
2
stack_v2_sparse_classes_30k_test_000801
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def fourSum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[List[int]] - def fourSum_slow(self, nums, target): :type nums: List[int] :type target: int :...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def fourSum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[List[int]] - def fourSum_slow(self, nums, target): :type nums: List[int] :type target: int :...
38eb0556f865fd06f517ca45253d00aaca39d70b
<|skeleton|> class Solution: def fourSum(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[List[int]]""" <|body_0|> def fourSum_slow(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def fourSum(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[List[int]]""" n = len(nums) if n < 4: return [] L = set() sumsIndexes = {} for i in range(n): for j in range(i + 1, n): cur...
the_stack_v2_python_sparse
Python3/no18_4Sum.py
yif042/leetcode
train
0
f1e041c0b1210c824f8c57f842b0cdd99132fcd3
[ "super(ClinicalData, self).__init__()\nself.projectname = projectname\nself.environment = environment\nself.metadata_version_oid = metadata_version_oid\nself.subject_data = []\nself.annotations = annotations", "params = dict(MetaDataVersionOID=str(self.metadata_version_oid), StudyOID='%s (%s)' % (self.projectname...
<|body_start_0|> super(ClinicalData, self).__init__() self.projectname = projectname self.environment = environment self.metadata_version_oid = metadata_version_oid self.subject_data = [] self.annotations = annotations <|end_body_0|> <|body_start_1|> params = dic...
Models the ODM ClinicalData object
ClinicalData
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClinicalData: """Models the ODM ClinicalData object""" def __init__(self, projectname, environment, metadata_version_oid='1', annotations=None): """:param projectname: Name of Project in Medidata Rave :param environment: Rave Study Enviroment :param metadata_version_oid: MetadataVers...
stack_v2_sparse_classes_75kplus_train_006924
45,621
permissive
[ { "docstring": ":param projectname: Name of Project in Medidata Rave :param environment: Rave Study Enviroment :param metadata_version_oid: MetadataVersion OID", "name": "__init__", "signature": "def __init__(self, projectname, environment, metadata_version_oid='1', annotations=None)" }, { "docs...
3
stack_v2_sparse_classes_30k_test_000921
Implement the Python class `ClinicalData` described below. Class description: Models the ODM ClinicalData object Method signatures and docstrings: - def __init__(self, projectname, environment, metadata_version_oid='1', annotations=None): :param projectname: Name of Project in Medidata Rave :param environment: Rave S...
Implement the Python class `ClinicalData` described below. Class description: Models the ODM ClinicalData object Method signatures and docstrings: - def __init__(self, projectname, environment, metadata_version_oid='1', annotations=None): :param projectname: Name of Project in Medidata Rave :param environment: Rave S...
f3ee0f680c041b706a5024750540fb9dadf67639
<|skeleton|> class ClinicalData: """Models the ODM ClinicalData object""" def __init__(self, projectname, environment, metadata_version_oid='1', annotations=None): """:param projectname: Name of Project in Medidata Rave :param environment: Rave Study Enviroment :param metadata_version_oid: MetadataVers...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ClinicalData: """Models the ODM ClinicalData object""" def __init__(self, projectname, environment, metadata_version_oid='1', annotations=None): """:param projectname: Name of Project in Medidata Rave :param environment: Rave Study Enviroment :param metadata_version_oid: MetadataVersion OID""" ...
the_stack_v2_python_sparse
rwslib/builders/clinicaldata.py
mdsol/rwslib
train
28
b6796358f289dd65d5491b019d6781119c7fcb30
[ "if not email:\n raise ValueError('Users must have an email address')\nif not first_name:\n raise ValueError('Users must have a first name')\nif not last_name:\n raise ValueError('Users must have a last name')\nuser = self.model(email=self.normalize_email(email))\nuser.first_name = first_name\nuser.last_na...
<|body_start_0|> if not email: raise ValueError('Users must have an email address') if not first_name: raise ValueError('Users must have a first name') if not last_name: raise ValueError('Users must have a last name') user = self.model(email=self.norma...
CustomUserManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CustomUserManager: def create_user(self, email, first_name, last_name, password=None): """Creates and saves a User with the given email, date of birth and password.""" <|body_0|> def create_superuser(self, email, first_name, last_name, password): """Creates and saves...
stack_v2_sparse_classes_75kplus_train_006925
4,661
no_license
[ { "docstring": "Creates and saves a User with the given email, date of birth and password.", "name": "create_user", "signature": "def create_user(self, email, first_name, last_name, password=None)" }, { "docstring": "Creates and saves a superuser with the given email, date of birth and password....
2
null
Implement the Python class `CustomUserManager` described below. Class description: Implement the CustomUserManager class. Method signatures and docstrings: - def create_user(self, email, first_name, last_name, password=None): Creates and saves a User with the given email, date of birth and password. - def create_supe...
Implement the Python class `CustomUserManager` described below. Class description: Implement the CustomUserManager class. Method signatures and docstrings: - def create_user(self, email, first_name, last_name, password=None): Creates and saves a User with the given email, date of birth and password. - def create_supe...
f4b3ab6ed325560025199e0092d7b1258fd11cf4
<|skeleton|> class CustomUserManager: def create_user(self, email, first_name, last_name, password=None): """Creates and saves a User with the given email, date of birth and password.""" <|body_0|> def create_superuser(self, email, first_name, last_name, password): """Creates and saves...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CustomUserManager: def create_user(self, email, first_name, last_name, password=None): """Creates and saves a User with the given email, date of birth and password.""" if not email: raise ValueError('Users must have an email address') if not first_name: raise Va...
the_stack_v2_python_sparse
athlitikos/accounts/models.py
jorgenhenrichsen/TDT4290
train
1
f0fa262e96ddae6b6d882a564768e2f3114d6b09
[ "assert entity_type in BlueprintEntity.entity_classification, 'Unknown entity type {}'.format(entity_type)\nclass_list_sorted = sorted(BlueprintEntity.entity_classification[entity_type].keys())\nreturn class_list_sorted[0]", "assert entity_type in BlueprintEntity.entity_classification\nif entity_classification is...
<|body_start_0|> assert entity_type in BlueprintEntity.entity_classification, 'Unknown entity type {}'.format(entity_type) class_list_sorted = sorted(BlueprintEntity.entity_classification[entity_type].keys()) return class_list_sorted[0] <|end_body_0|> <|body_start_1|> assert entity_type...
@type entity_classification: dict[int, dict[int, str]]
BlueprintEntity
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BlueprintEntity: """@type entity_classification: dict[int, dict[int, str]]""" def get_entity_classification_default(entity_type): """Return name of entity classification @param entity_type: @type entity_type: int @rtype: str""" <|body_0|> def get_entity_classification_na...
stack_v2_sparse_classes_75kplus_train_006926
2,637
no_license
[ { "docstring": "Return name of entity classification @param entity_type: @type entity_type: int @rtype: str", "name": "get_entity_classification_default", "signature": "def get_entity_classification_default(entity_type)" }, { "docstring": "Return name of entity classification @param entity_type:...
2
stack_v2_sparse_classes_30k_train_042354
Implement the Python class `BlueprintEntity` described below. Class description: @type entity_classification: dict[int, dict[int, str]] Method signatures and docstrings: - def get_entity_classification_default(entity_type): Return name of entity classification @param entity_type: @type entity_type: int @rtype: str - ...
Implement the Python class `BlueprintEntity` described below. Class description: @type entity_classification: dict[int, dict[int, str]] Method signatures and docstrings: - def get_entity_classification_default(entity_type): Return name of entity classification @param entity_type: @type entity_type: int @rtype: str - ...
12fe1b39513cf0d1ca8edd9adb6c11269c58fbb5
<|skeleton|> class BlueprintEntity: """@type entity_classification: dict[int, dict[int, str]]""" def get_entity_classification_default(entity_type): """Return name of entity classification @param entity_type: @type entity_type: int @rtype: str""" <|body_0|> def get_entity_classification_na...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BlueprintEntity: """@type entity_classification: dict[int, dict[int, str]]""" def get_entity_classification_default(entity_type): """Return name of entity classification @param entity_type: @type entity_type: int @rtype: str""" assert entity_type in BlueprintEntity.entity_classification, ...
the_stack_v2_python_sparse
smlib/utils/blueprintentity.py
p-hofmann/SMBEdit
train
6
887cf4cde1ba4f7cc89f78b6ee44b0603b867ddf
[ "self.sensors = sensors\nself.last_state = None\nself.wrapper = wrapper\nself.attribute = attribute\nself.block = block\nself.description = description\nself._unit = self.description.unit\nif block is not None:\n if callable(self._unit):\n self._unit = self._unit(block.info(attribute))\n self._unique_i...
<|body_start_0|> self.sensors = sensors self.last_state = None self.wrapper = wrapper self.attribute = attribute self.block = block self.description = description self._unit = self.description.unit if block is not None: if callable(self._unit):...
Represent a shelly sleeping block attribute entity.
ShellySleepingBlockAttributeEntity
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ShellySleepingBlockAttributeEntity: """Represent a shelly sleeping block attribute entity.""" def __init__(self, wrapper: ShellyDeviceWrapper, block: aioshelly.Block, attribute: str, description: BlockAttributeDescription, entry: entity_registry.RegistryEntry | None=None, sensors: set | None...
stack_v2_sparse_classes_75kplus_train_006927
13,987
permissive
[ { "docstring": "Initialize the sleeping sensor.", "name": "__init__", "signature": "def __init__(self, wrapper: ShellyDeviceWrapper, block: aioshelly.Block, attribute: str, description: BlockAttributeDescription, entry: entity_registry.RegistryEntry | None=None, sensors: set | None=None) -> None" }, ...
3
stack_v2_sparse_classes_30k_train_020650
Implement the Python class `ShellySleepingBlockAttributeEntity` described below. Class description: Represent a shelly sleeping block attribute entity. Method signatures and docstrings: - def __init__(self, wrapper: ShellyDeviceWrapper, block: aioshelly.Block, attribute: str, description: BlockAttributeDescription, e...
Implement the Python class `ShellySleepingBlockAttributeEntity` described below. Class description: Represent a shelly sleeping block attribute entity. Method signatures and docstrings: - def __init__(self, wrapper: ShellyDeviceWrapper, block: aioshelly.Block, attribute: str, description: BlockAttributeDescription, e...
2fee32fce03bc49e86cf2e7b741a15621a97cce5
<|skeleton|> class ShellySleepingBlockAttributeEntity: """Represent a shelly sleeping block attribute entity.""" def __init__(self, wrapper: ShellyDeviceWrapper, block: aioshelly.Block, attribute: str, description: BlockAttributeDescription, entry: entity_registry.RegistryEntry | None=None, sensors: set | None...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ShellySleepingBlockAttributeEntity: """Represent a shelly sleeping block attribute entity.""" def __init__(self, wrapper: ShellyDeviceWrapper, block: aioshelly.Block, attribute: str, description: BlockAttributeDescription, entry: entity_registry.RegistryEntry | None=None, sensors: set | None=None) -> Non...
the_stack_v2_python_sparse
homeassistant/components/shelly/entity.py
BenWoodford/home-assistant
train
11
412a700fe43ae9f45b49baef9e45c9e9771bddec
[ "expected_out = '....\\n'\nwith patch('sys.stdout', new=StringIO()) as fake_out:\n dot = ShowProgress()\n for _ in range(3):\n dot.show()\n time.sleep(0.3)\n dot.end()\n self.assertEqual(fake_out.getvalue(), expected_out)", "expected_out = '####\\n'\nwith patch('sys.stdout', new=StringIO...
<|body_start_0|> expected_out = '....\n' with patch('sys.stdout', new=StringIO()) as fake_out: dot = ShowProgress() for _ in range(3): dot.show() time.sleep(0.3) dot.end() self.assertEqual(fake_out.getvalue(), expected_out) ...
Testcases for show_progress.py
TestShowProgress
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "CC-BY-4.0", "BSD-2-Clause", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestShowProgress: """Testcases for show_progress.py""" def test_dot_gets_to_stdout(self): """Verify standard dots""" <|body_0|> def test_dotchar_gets_to_stdout(self): """Override default character with hashtag (#) instead""" <|body_1|> def test_chang...
stack_v2_sparse_classes_75kplus_train_006928
1,875
permissive
[ { "docstring": "Verify standard dots", "name": "test_dot_gets_to_stdout", "signature": "def test_dot_gets_to_stdout(self)" }, { "docstring": "Override default character with hashtag (#) instead", "name": "test_dotchar_gets_to_stdout", "signature": "def test_dotchar_gets_to_stdout(self)" ...
3
null
Implement the Python class `TestShowProgress` described below. Class description: Testcases for show_progress.py Method signatures and docstrings: - def test_dot_gets_to_stdout(self): Verify standard dots - def test_dotchar_gets_to_stdout(self): Override default character with hashtag (#) instead - def test_change_mi...
Implement the Python class `TestShowProgress` described below. Class description: Testcases for show_progress.py Method signatures and docstrings: - def test_dot_gets_to_stdout(self): Verify standard dots - def test_dotchar_gets_to_stdout(self): Override default character with hashtag (#) instead - def test_change_mi...
0c49ee0f10da97ed52121d0d2eb9ee200803af5d
<|skeleton|> class TestShowProgress: """Testcases for show_progress.py""" def test_dot_gets_to_stdout(self): """Verify standard dots""" <|body_0|> def test_dotchar_gets_to_stdout(self): """Override default character with hashtag (#) instead""" <|body_1|> def test_chang...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestShowProgress: """Testcases for show_progress.py""" def test_dot_gets_to_stdout(self): """Verify standard dots""" expected_out = '....\n' with patch('sys.stdout', new=StringIO()) as fake_out: dot = ShowProgress() for _ in range(3): dot.sh...
the_stack_v2_python_sparse
cfc_app/tests_show.py
AmericanAirlines/Legit-Info
train
1
1f2ac86cd151c5dcf97453c05072a242af38e12b
[ "ticker = pero.LogTicker(base=2, major_count=7)\nticker(start=1.1, end=900.0)\nticks = ticker.major_ticks()\nself.assertEqual(ticks, (2, 4, 8, 16, 32, 64, 128, 256, 512))\nticker(start=1, end=900.0)\nticks = ticker.major_ticks()\nself.assertEqual(ticks, (1, 2, 4, 8, 16, 32, 64, 128, 256, 512))\nticker(start=0.1, en...
<|body_start_0|> ticker = pero.LogTicker(base=2, major_count=7) ticker(start=1.1, end=900.0) ticks = ticker.major_ticks() self.assertEqual(ticks, (2, 4, 8, 16, 32, 64, 128, 256, 512)) ticker(start=1, end=900.0) ticks = ticker.major_ticks() self.assertEqual(ticks, ...
Test case for logarithmic ticker with base 2.
TestCase
[ "LicenseRef-scancode-philippe-de-muyter", "LicenseRef-scancode-commercial-license", "AGPL-3.0-or-later", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestCase: """Test case for logarithmic ticker with base 2.""" def test_major_ticks(self): """Tests whether major ticks are generated works correctly.""" <|body_0|> def test_minor_ticks(self): """Tests whether minor ticks are generated correctly.""" <|body...
stack_v2_sparse_classes_75kplus_train_006929
3,579
permissive
[ { "docstring": "Tests whether major ticks are generated works correctly.", "name": "test_major_ticks", "signature": "def test_major_ticks(self)" }, { "docstring": "Tests whether minor ticks are generated correctly.", "name": "test_minor_ticks", "signature": "def test_minor_ticks(self)" ...
3
stack_v2_sparse_classes_30k_train_000930
Implement the Python class `TestCase` described below. Class description: Test case for logarithmic ticker with base 2. Method signatures and docstrings: - def test_major_ticks(self): Tests whether major ticks are generated works correctly. - def test_minor_ticks(self): Tests whether minor ticks are generated correct...
Implement the Python class `TestCase` described below. Class description: Test case for logarithmic ticker with base 2. Method signatures and docstrings: - def test_major_ticks(self): Tests whether major ticks are generated works correctly. - def test_minor_ticks(self): Tests whether minor ticks are generated correct...
d59b1bc056f3037b7b7ab635b6deb41120612965
<|skeleton|> class TestCase: """Test case for logarithmic ticker with base 2.""" def test_major_ticks(self): """Tests whether major ticks are generated works correctly.""" <|body_0|> def test_minor_ticks(self): """Tests whether minor ticks are generated correctly.""" <|body...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestCase: """Test case for logarithmic ticker with base 2.""" def test_major_ticks(self): """Tests whether major ticks are generated works correctly.""" ticker = pero.LogTicker(base=2, major_count=7) ticker(start=1.1, end=900.0) ticks = ticker.major_ticks() self.as...
the_stack_v2_python_sparse
unittests/tickers/test_log2.py
xxao/pero
train
31
042618efe066bb589c1e401df26c69e45d500705
[ "if self.fields_before_postal is None:\n return []\nfields = []\nfor field in self.fields_before_postal:\n try:\n fields.append(self[field])\n except KeyError:\n continue\nreturn fields", "fields = []\nfor field in self.fields_after_postal or self.fields:\n try:\n fields.append(se...
<|body_start_0|> if self.fields_before_postal is None: return [] fields = [] for field in self.fields_before_postal: try: fields.append(self[field]) except KeyError: continue return fields <|end_body_0|> <|body_start_1|...
Base class for all address forms. **Attributes:** fields_before_postal List of field names which are supposed to be displayed before the postal form fields. fields_before_postal List of field names which are supposed to be displayed after the postal form fields.
AddressBaseForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AddressBaseForm: """Base class for all address forms. **Attributes:** fields_before_postal List of field names which are supposed to be displayed before the postal form fields. fields_before_postal List of field names which are supposed to be displayed after the postal form fields.""" def ge...
stack_v2_sparse_classes_75kplus_train_006930
3,388
no_license
[ { "docstring": "Returns the fields which are supposed to be displayed before the postal form fields.", "name": "get_fields_before_postal", "signature": "def get_fields_before_postal(self)" }, { "docstring": "Returns the fields which are supposed to be displayed before the postal form fields.", ...
2
stack_v2_sparse_classes_30k_train_010342
Implement the Python class `AddressBaseForm` described below. Class description: Base class for all address forms. **Attributes:** fields_before_postal List of field names which are supposed to be displayed before the postal form fields. fields_before_postal List of field names which are supposed to be displayed after...
Implement the Python class `AddressBaseForm` described below. Class description: Base class for all address forms. **Attributes:** fields_before_postal List of field names which are supposed to be displayed before the postal form fields. fields_before_postal List of field names which are supposed to be displayed after...
77e9c70687b35fd8b65a7f2d879e0261ae69c00e
<|skeleton|> class AddressBaseForm: """Base class for all address forms. **Attributes:** fields_before_postal List of field names which are supposed to be displayed before the postal form fields. fields_before_postal List of field names which are supposed to be displayed after the postal form fields.""" def ge...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AddressBaseForm: """Base class for all address forms. **Attributes:** fields_before_postal List of field names which are supposed to be displayed before the postal form fields. fields_before_postal List of field names which are supposed to be displayed after the postal form fields.""" def get_fields_befo...
the_stack_v2_python_sparse
eggs/django_lfs-0.10.2-py2.7.egg/lfs/addresses/forms.py
yunmengyanjin/website
train
2
8b36df1a9c4b2a4c9f6fe42a3773f9c834bc1e97
[ "if hasattr(self.opts.model, 'versions') and len(self.opts.fields) == 0:\n self.opts.exclude += ('versions',)\nsuper().__init__(*args, **kwargs)", "if not many:\n for key in list(data):\n if key == 'versions':\n data.pop(key)\n return {key: value for key, value in data.items() if value ...
<|body_start_0|> if hasattr(self.opts.model, 'versions') and len(self.opts.fields) == 0: self.opts.exclude += ('versions',) super().__init__(*args, **kwargs) <|end_body_0|> <|body_start_1|> if not many: for key in list(data): if key == 'versions': ...
Base Schema.
BaseSchema
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseSchema: """Base Schema.""" def __init__(self, *args, **kwargs): """Excludes versions. Otherwise database will query <name>_versions table.""" <|body_0|> def _remove_empty(self, data, many): """Remove all empty values and versions from the dumped dict.""" ...
stack_v2_sparse_classes_75kplus_train_006931
2,211
permissive
[ { "docstring": "Excludes versions. Otherwise database will query <name>_versions table.", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Remove all empty values and versions from the dumped dict.", "name": "_remove_empty", "signature": "def _rem...
2
stack_v2_sparse_classes_30k_train_041502
Implement the Python class `BaseSchema` described below. Class description: Base Schema. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Excludes versions. Otherwise database will query <name>_versions table. - def _remove_empty(self, data, many): Remove all empty values and versions from the...
Implement the Python class `BaseSchema` described below. Class description: Base Schema. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Excludes versions. Otherwise database will query <name>_versions table. - def _remove_empty(self, data, many): Remove all empty values and versions from the...
923cb8a3ee88dcbaf0fe800ca70022b3c13c1d01
<|skeleton|> class BaseSchema: """Base Schema.""" def __init__(self, *args, **kwargs): """Excludes versions. Otherwise database will query <name>_versions table.""" <|body_0|> def _remove_empty(self, data, many): """Remove all empty values and versions from the dumped dict.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BaseSchema: """Base Schema.""" def __init__(self, *args, **kwargs): """Excludes versions. Otherwise database will query <name>_versions table.""" if hasattr(self.opts.model, 'versions') and len(self.opts.fields) == 0: self.opts.exclude += ('versions',) super().__init__...
the_stack_v2_python_sparse
auth-api/src/auth_api/schemas/base_schema.py
bcgov/sbc-auth
train
13
d90e4e92236ead7118fca3c08c8079347a6e1af0
[ "self.portrayal_method = portrayal_method\nself.canvas_height = canvas_height\nself.canvas_width = canvas_width\nnew_element = 'new Simple_Continuous_Module({}, {})'.format(self.canvas_width, self.canvas_height)\nself.js_code = 'elements.push(' + new_element + ');'", "space_state = []\nfor obj in model.schedule.a...
<|body_start_0|> self.portrayal_method = portrayal_method self.canvas_height = canvas_height self.canvas_width = canvas_width new_element = 'new Simple_Continuous_Module({}, {})'.format(self.canvas_width, self.canvas_height) self.js_code = 'elements.push(' + new_element + ');' <|...
Uses JavaScript file for a simple, continuous canvas.
SimpleCanvas
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SimpleCanvas: """Uses JavaScript file for a simple, continuous canvas.""" def __init__(self, portrayal_method, canvas_height=500, canvas_width=500): """Instantiate a new SimpleCanvas""" <|body_0|> def render(self, model): """Creates the space in which the agents ...
stack_v2_sparse_classes_75kplus_train_006932
4,439
no_license
[ { "docstring": "Instantiate a new SimpleCanvas", "name": "__init__", "signature": "def __init__(self, portrayal_method, canvas_height=500, canvas_width=500)" }, { "docstring": "Creates the space in which the agents exist.", "name": "render", "signature": "def render(self, model)" } ]
2
stack_v2_sparse_classes_30k_train_031184
Implement the Python class `SimpleCanvas` described below. Class description: Uses JavaScript file for a simple, continuous canvas. Method signatures and docstrings: - def __init__(self, portrayal_method, canvas_height=500, canvas_width=500): Instantiate a new SimpleCanvas - def render(self, model): Creates the space...
Implement the Python class `SimpleCanvas` described below. Class description: Uses JavaScript file for a simple, continuous canvas. Method signatures and docstrings: - def __init__(self, portrayal_method, canvas_height=500, canvas_width=500): Instantiate a new SimpleCanvas - def render(self, model): Creates the space...
18166af285d2a40f903bc178f5c37b7d758fb0bd
<|skeleton|> class SimpleCanvas: """Uses JavaScript file for a simple, continuous canvas.""" def __init__(self, portrayal_method, canvas_height=500, canvas_width=500): """Instantiate a new SimpleCanvas""" <|body_0|> def render(self, model): """Creates the space in which the agents ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SimpleCanvas: """Uses JavaScript file for a simple, continuous canvas.""" def __init__(self, portrayal_method, canvas_height=500, canvas_width=500): """Instantiate a new SimpleCanvas""" self.portrayal_method = portrayal_method self.canvas_height = canvas_height self.canvas...
the_stack_v2_python_sparse
shoal_model_viz.py
sowasser/fish-shoaling-model
train
1
25c6377bf1a7101a2c8440f6ea06152f0e8bb476
[ "if not root:\n return []\nqueue = [(root, 0)]\nvalues = defaultdict(list)\nwhile queue:\n cur, height = queue.pop(0)\n values[height].append(cur.val)\n if cur.left:\n queue.append((cur.left, height + 1))\n if cur.right:\n queue.append((cur.right, height + 1))\nres = []\niter = True\nfo...
<|body_start_0|> if not root: return [] queue = [(root, 0)] values = defaultdict(list) while queue: cur, height = queue.pop(0) values[height].append(cur.val) if cur.left: queue.append((cur.left, height + 1)) if c...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def zigzagLevelOrder(self, root): """:type root: TreeNode :rtype: List[List[int]]""" <|body_0|> def zigzagLevelOrder2(self, root): """:type root: TreeNode :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not root:...
stack_v2_sparse_classes_75kplus_train_006933
2,087
no_license
[ { "docstring": ":type root: TreeNode :rtype: List[List[int]]", "name": "zigzagLevelOrder", "signature": "def zigzagLevelOrder(self, root)" }, { "docstring": ":type root: TreeNode :rtype: List[List[int]]", "name": "zigzagLevelOrder2", "signature": "def zigzagLevelOrder2(self, root)" } ]
2
stack_v2_sparse_classes_30k_train_024590
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def zigzagLevelOrder(self, root): :type root: TreeNode :rtype: List[List[int]] - def zigzagLevelOrder2(self, root): :type root: TreeNode :rtype: List[List[int]]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def zigzagLevelOrder(self, root): :type root: TreeNode :rtype: List[List[int]] - def zigzagLevelOrder2(self, root): :type root: TreeNode :rtype: List[List[int]] <|skeleton|> cla...
0fc4c7af59246e3064db41989a45d9db413a624b
<|skeleton|> class Solution: def zigzagLevelOrder(self, root): """:type root: TreeNode :rtype: List[List[int]]""" <|body_0|> def zigzagLevelOrder2(self, root): """:type root: TreeNode :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def zigzagLevelOrder(self, root): """:type root: TreeNode :rtype: List[List[int]]""" if not root: return [] queue = [(root, 0)] values = defaultdict(list) while queue: cur, height = queue.pop(0) values[height].append(cur.val...
the_stack_v2_python_sparse
103. Binary Tree Zigzag Level Order Traversal/zigzag.py
Macielyoung/LeetCode
train
1
08631dc77ac77063a42cffd90a5861d18ba1ba64
[ "if self.start_date > self.end_date:\n raise ValidationError('The end date must be greater than the start date.')\nif self.active:\n try:\n active_season = Season.objects.get(active=True)\n except Season.DoesNotExist:\n pass\n else:\n if self != active_season:\n raise Val...
<|body_start_0|> if self.start_date > self.end_date: raise ValidationError('The end date must be greater than the start date.') if self.active: try: active_season = Season.objects.get(active=True) except Season.DoesNotExist: pass ...
Defines a duration of time during which players play pool matches.
Season
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Season: """Defines a duration of time during which players play pool matches.""" def clean(self): """Perform some field level validation on the two date fields.""" <|body_0|> def activate(self, commit=True): """Mark the instance as active and as a bi-product rese...
stack_v2_sparse_classes_75kplus_train_006934
3,398
no_license
[ { "docstring": "Perform some field level validation on the two date fields.", "name": "clean", "signature": "def clean(self)" }, { "docstring": "Mark the instance as active and as a bi-product reset all denormalized season fields on player objects.", "name": "activate", "signature": "def...
4
stack_v2_sparse_classes_30k_train_054043
Implement the Python class `Season` described below. Class description: Defines a duration of time during which players play pool matches. Method signatures and docstrings: - def clean(self): Perform some field level validation on the two date fields. - def activate(self, commit=True): Mark the instance as active and...
Implement the Python class `Season` described below. Class description: Defines a duration of time during which players play pool matches. Method signatures and docstrings: - def clean(self): Perform some field level validation on the two date fields. - def activate(self, commit=True): Mark the instance as active and...
96d0c1c64d73d63f086cfda5109c34723eca4a08
<|skeleton|> class Season: """Defines a duration of time during which players play pool matches.""" def clean(self): """Perform some field level validation on the two date fields.""" <|body_0|> def activate(self, commit=True): """Mark the instance as active and as a bi-product rese...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Season: """Defines a duration of time during which players play pool matches.""" def clean(self): """Perform some field level validation on the two date fields.""" if self.start_date > self.end_date: raise ValidationError('The end date must be greater than the start date.') ...
the_stack_v2_python_sparse
src/core/models/season.py
dannymilsom/poolbot-server
train
4
1b347eeca875b9f23267b7e75ac82238e49b9c2c
[ "super(Inception4e, self).__init__()\nbranch1_list = [{'type': ConvBNLayer, 'num_channels': num_channels, 'num_filters': ch3x3reduced, 'filter_size': 1, 'stride': 1, 'padding': 0, 'act': 'relu'}, {'type': ConvBNLayer, 'num_channels': ch3x3reduced, 'num_filters': ch3x3, 'filter_size': 3, 'stride': 2, 'padding': 1, '...
<|body_start_0|> super(Inception4e, self).__init__() branch1_list = [{'type': ConvBNLayer, 'num_channels': num_channels, 'num_filters': ch3x3reduced, 'filter_size': 1, 'stride': 1, 'padding': 0, 'act': 'relu'}, {'type': ConvBNLayer, 'num_channels': ch3x3reduced, 'num_filters': ch3x3, 'filter_size': 3, '...
Inception4e
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Inception4e: def __init__(self, num_channels, ch3x3reduced, ch3x3, doublech3x3reduced, doublech3x3_1, doublech3x3_2, pool_proj): """@Brief `Inception4e` @Parameters num_channels : channel numbers of input tensor ch1x1 : output channel numbers of 1x1 conv ch3x3reduced : channel numbers of...
stack_v2_sparse_classes_75kplus_train_006935
22,436
permissive
[ { "docstring": "@Brief `Inception4e` @Parameters num_channels : channel numbers of input tensor ch1x1 : output channel numbers of 1x1 conv ch3x3reduced : channel numbers of 1x1 conv before 3x3 conv ch3x3 : output channel numbers of 3x3 conv doublech3x3reduced : channel numbers of 1x1 conv before the double 3x3 ...
2
stack_v2_sparse_classes_30k_train_019272
Implement the Python class `Inception4e` described below. Class description: Implement the Inception4e class. Method signatures and docstrings: - def __init__(self, num_channels, ch3x3reduced, ch3x3, doublech3x3reduced, doublech3x3_1, doublech3x3_2, pool_proj): @Brief `Inception4e` @Parameters num_channels : channel ...
Implement the Python class `Inception4e` described below. Class description: Implement the Inception4e class. Method signatures and docstrings: - def __init__(self, num_channels, ch3x3reduced, ch3x3, doublech3x3reduced, doublech3x3_1, doublech3x3_2, pool_proj): @Brief `Inception4e` @Parameters num_channels : channel ...
78ff3c3ab3906012a0f4a612251347632aa493a7
<|skeleton|> class Inception4e: def __init__(self, num_channels, ch3x3reduced, ch3x3, doublech3x3reduced, doublech3x3_1, doublech3x3_2, pool_proj): """@Brief `Inception4e` @Parameters num_channels : channel numbers of input tensor ch1x1 : output channel numbers of 1x1 conv ch3x3reduced : channel numbers of...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Inception4e: def __init__(self, num_channels, ch3x3reduced, ch3x3, doublech3x3reduced, doublech3x3_1, doublech3x3_2, pool_proj): """@Brief `Inception4e` @Parameters num_channels : channel numbers of input tensor ch1x1 : output channel numbers of 1x1 conv ch3x3reduced : channel numbers of 1x1 conv befo...
the_stack_v2_python_sparse
ECO/paddle1.8/model/ECO.py
thinkall/Contrib
train
1
052c9d398dc42ca204de3ae408302e861f7efc1a
[ "reader = csv.reader(data)\nnext(reader)\nreturn collections.Counter(map(lambda item: self.safe_name(item[4]), filter(lambda item: len(item[1].split('-')) != 2, reader)))", "if self.record[self.safe_name(name)] > 1:\n name = f'{name}_0x{code}'\nreturn self.safe_name(name)", "reader = csv.reader(data)\nnext(r...
<|body_start_0|> reader = csv.reader(data) next(reader) return collections.Counter(map(lambda item: self.safe_name(item[4]), filter(lambda item: len(item[1].split('-')) != 2, reader))) <|end_body_0|> <|body_start_1|> if self.record[self.safe_name(name)] > 1: name = f'{name}_...
Ethertype IEEE 802 Numbers
EtherType
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EtherType: """Ethertype IEEE 802 Numbers""" def count(self, data): """Count field records. Args: data (List[str]): CSV data. Returns: Counter: Field recordings.""" <|body_0|> def rename(self, name, code): """Rename duplicated fields. Args: name (str): Field name....
stack_v2_sparse_classes_75kplus_train_006936
3,362
permissive
[ { "docstring": "Count field records. Args: data (List[str]): CSV data. Returns: Counter: Field recordings.", "name": "count", "signature": "def count(self, data)" }, { "docstring": "Rename duplicated fields. Args: name (str): Field name. code (str): Field code (hex). Keyword Args: original (str)...
3
stack_v2_sparse_classes_30k_train_045547
Implement the Python class `EtherType` described below. Class description: Ethertype IEEE 802 Numbers Method signatures and docstrings: - def count(self, data): Count field records. Args: data (List[str]): CSV data. Returns: Counter: Field recordings. - def rename(self, name, code): Rename duplicated fields. Args: na...
Implement the Python class `EtherType` described below. Class description: Ethertype IEEE 802 Numbers Method signatures and docstrings: - def count(self, data): Count field records. Args: data (List[str]): CSV data. Returns: Counter: Field recordings. - def rename(self, name, code): Rename duplicated fields. Args: na...
90cd07d67df28d5c5ab0585bc60f467a78d9db33
<|skeleton|> class EtherType: """Ethertype IEEE 802 Numbers""" def count(self, data): """Count field records. Args: data (List[str]): CSV data. Returns: Counter: Field recordings.""" <|body_0|> def rename(self, name, code): """Rename duplicated fields. Args: name (str): Field name....
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EtherType: """Ethertype IEEE 802 Numbers""" def count(self, data): """Count field records. Args: data (List[str]): CSV data. Returns: Counter: Field recordings.""" reader = csv.reader(data) next(reader) return collections.Counter(map(lambda item: self.safe_name(item[4]), f...
the_stack_v2_python_sparse
pcapkit/vendor/reg/ethertype.py
stjordanis/PyPCAPKit
train
0
0cf1cb9a338cd5383b6517e138ec2ae033a02419
[ "cube = set_up_variable_cube(278.0 * np.ones((4, 3, 3), dtype=np.float32))\nplugin = WeightAndBlend('realization', 'linear', y0val=1, ynval=1)\nweights = plugin._calculate_blending_weights(cube)\nself.assertIsInstance(weights, iris.cube.Cube)\nweights_dims = [coord.name() for coord in weights.coords(dim_coords=True...
<|body_start_0|> cube = set_up_variable_cube(278.0 * np.ones((4, 3, 3), dtype=np.float32)) plugin = WeightAndBlend('realization', 'linear', y0val=1, ynval=1) weights = plugin._calculate_blending_weights(cube) self.assertIsInstance(weights, iris.cube.Cube) weights_dims = [coord.na...
Test the _calculate_blending_weights method
Test__calculate_blending_weights
[ "BSD-3-Clause", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test__calculate_blending_weights: """Test the _calculate_blending_weights method""" def test_default_linear(self): """Test linear weighting over realizations""" <|body_0|> def test_default_nonlinear(self): """Test non-linear weighting over forecast reference time...
stack_v2_sparse_classes_75kplus_train_006937
30,096
permissive
[ { "docstring": "Test linear weighting over realizations", "name": "test_default_linear", "signature": "def test_default_linear(self)" }, { "docstring": "Test non-linear weighting over forecast reference time, where the earlier cycle has a higher weighting", "name": "test_default_nonlinear", ...
4
stack_v2_sparse_classes_30k_train_054581
Implement the Python class `Test__calculate_blending_weights` described below. Class description: Test the _calculate_blending_weights method Method signatures and docstrings: - def test_default_linear(self): Test linear weighting over realizations - def test_default_nonlinear(self): Test non-linear weighting over fo...
Implement the Python class `Test__calculate_blending_weights` described below. Class description: Test the _calculate_blending_weights method Method signatures and docstrings: - def test_default_linear(self): Test linear weighting over realizations - def test_default_nonlinear(self): Test non-linear weighting over fo...
cd2c9019944345df1e703bf8f625db537ad9f559
<|skeleton|> class Test__calculate_blending_weights: """Test the _calculate_blending_weights method""" def test_default_linear(self): """Test linear weighting over realizations""" <|body_0|> def test_default_nonlinear(self): """Test non-linear weighting over forecast reference time...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Test__calculate_blending_weights: """Test the _calculate_blending_weights method""" def test_default_linear(self): """Test linear weighting over realizations""" cube = set_up_variable_cube(278.0 * np.ones((4, 3, 3), dtype=np.float32)) plugin = WeightAndBlend('realization', 'linear...
the_stack_v2_python_sparse
improver_tests/blending/calculate_weights_and_blend/test_WeightAndBlend.py
metoppv/improver
train
101
0ad6bd1767ed3c47e6df32d97c9797dbb1e29431
[ "address_list = [None, None, None, None, None]\nfirm_account_list = [None, None]\nfirmName = request.POST.get('firmName', None)\naddress_list[0] = request.POST.get('firmAdres1', None)\naddress_list[1] = request.POST.get('firmAdres2', None)\naddress_list[2] = request.POST.get('firmAdres3', None)\naddress_list[3] = r...
<|body_start_0|> address_list = [None, None, None, None, None] firm_account_list = [None, None] firmName = request.POST.get('firmName', None) address_list[0] = request.POST.get('firmAdres1', None) address_list[1] = request.POST.get('firmAdres2', None) address_list[2] = re...
MyFirmParser
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyFirmParser: def data_firm_from_postrequest(self, request): """:param request: :return:""" <|body_0|> def myfirm_pickup(self, firm_data_obj): """:return:""" <|body_1|> def from_request_to_webcontext_firm(self, web_context, firmName, address_list, mInput...
stack_v2_sparse_classes_75kplus_train_006938
7,811
no_license
[ { "docstring": ":param request: :return:", "name": "data_firm_from_postrequest", "signature": "def data_firm_from_postrequest(self, request)" }, { "docstring": ":return:", "name": "myfirm_pickup", "signature": "def myfirm_pickup(self, firm_data_obj)" }, { "docstring": ":return:",...
4
stack_v2_sparse_classes_30k_train_051602
Implement the Python class `MyFirmParser` described below. Class description: Implement the MyFirmParser class. Method signatures and docstrings: - def data_firm_from_postrequest(self, request): :param request: :return: - def myfirm_pickup(self, firm_data_obj): :return: - def from_request_to_webcontext_firm(self, web...
Implement the Python class `MyFirmParser` described below. Class description: Implement the MyFirmParser class. Method signatures and docstrings: - def data_firm_from_postrequest(self, request): :param request: :return: - def myfirm_pickup(self, firm_data_obj): :return: - def from_request_to_webcontext_firm(self, web...
b1c72571da01c5d6f5e3bee27140931527132ef4
<|skeleton|> class MyFirmParser: def data_firm_from_postrequest(self, request): """:param request: :return:""" <|body_0|> def myfirm_pickup(self, firm_data_obj): """:return:""" <|body_1|> def from_request_to_webcontext_firm(self, web_context, firmName, address_list, mInput...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MyFirmParser: def data_firm_from_postrequest(self, request): """:param request: :return:""" address_list = [None, None, None, None, None] firm_account_list = [None, None] firmName = request.POST.get('firmName', None) address_list[0] = request.POST.get('firmAdres1', None...
the_stack_v2_python_sparse
py/iai_invoice/myfirm/utils/myfirm_parser.py
wiks/fakturkowo_DjangoSymfony5
train
0
a548a52e9740b24b5563e740ca42baa67e24638b
[ "length = len(nums1) + len(nums2)\nmid_index = length // 2\ni = 0\nj = 0\nnums = []\nwhile i < len(nums1) and j < len(nums2) and (i + j <= mid_index):\n if nums1[i] <= nums2[j]:\n nums.append(nums1[i])\n i += 1\n else:\n nums.append(nums2[j])\n j += 1\nif i + j <= mid_index:\n i...
<|body_start_0|> length = len(nums1) + len(nums2) mid_index = length // 2 i = 0 j = 0 nums = [] while i < len(nums1) and j < len(nums2) and (i + j <= mid_index): if nums1[i] <= nums2[j]: nums.append(nums1[i]) i += 1 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findMedianSortedArrays(self, nums1, nums2): """合并两个列表然后找到中间的值 :type nums1: List[int] :type nums2: List[int] :rtype: float""" <|body_0|> def findMedianSortedArrays2(self, nums1, nums2): """类似二分法查找两个列表的第k个值 O(log(m+n)) :type nums1: List[int] :type nums2: ...
stack_v2_sparse_classes_75kplus_train_006939
3,008
no_license
[ { "docstring": "合并两个列表然后找到中间的值 :type nums1: List[int] :type nums2: List[int] :rtype: float", "name": "findMedianSortedArrays", "signature": "def findMedianSortedArrays(self, nums1, nums2)" }, { "docstring": "类似二分法查找两个列表的第k个值 O(log(m+n)) :type nums1: List[int] :type nums2: List[int] :rtype: float...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMedianSortedArrays(self, nums1, nums2): 合并两个列表然后找到中间的值 :type nums1: List[int] :type nums2: List[int] :rtype: float - def findMedianSortedArrays2(self, nums1, nums2): 类似二分...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMedianSortedArrays(self, nums1, nums2): 合并两个列表然后找到中间的值 :type nums1: List[int] :type nums2: List[int] :rtype: float - def findMedianSortedArrays2(self, nums1, nums2): 类似二分...
04d87d76b762f6ea7cfb3a453382b2d7d4e154dc
<|skeleton|> class Solution: def findMedianSortedArrays(self, nums1, nums2): """合并两个列表然后找到中间的值 :type nums1: List[int] :type nums2: List[int] :rtype: float""" <|body_0|> def findMedianSortedArrays2(self, nums1, nums2): """类似二分法查找两个列表的第k个值 O(log(m+n)) :type nums1: List[int] :type nums2: ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def findMedianSortedArrays(self, nums1, nums2): """合并两个列表然后找到中间的值 :type nums1: List[int] :type nums2: List[int] :rtype: float""" length = len(nums1) + len(nums2) mid_index = length // 2 i = 0 j = 0 nums = [] while i < len(nums1) and j < len(num...
the_stack_v2_python_sparse
leetcode/004 Median of Two Sorted Arrays.py
mofei952/algorithm_exercise
train
1
2df15ca9f175e90bcb150c5adc13ccb0796689e6
[ "self._auctioneer = auctioneer\nfor bidder in bidders:\n self._auctioneer.register_bidder(bidder)", "print('Auctioning %s starting at %f' % (item, start_price))\nstart_bidder = Bidder('Starting Bid')\nself._auctioneer.accept_bid(start_price, start_bidder)\nprint('\\n--------------------------------------------...
<|body_start_0|> self._auctioneer = auctioneer for bidder in bidders: self._auctioneer.register_bidder(bidder) <|end_body_0|> <|body_start_1|> print('Auctioning %s starting at %f' % (item, start_price)) start_bidder = Bidder('Starting Bid') self._auctioneer.accept_bi...
Simulates an auction. Is responsible for driving the auctioneer and the bidders.
Auction
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Auction: """Simulates an auction. Is responsible for driving the auctioneer and the bidders.""" def __init__(self, bidders, auctioneer: Auctioneer=Auctioneer()): """Initialize an auction. Requires a list of bidders that are attending the auction and can bid. :param bidders: sequence ...
stack_v2_sparse_classes_75kplus_train_006940
7,764
no_license
[ { "docstring": "Initialize an auction. Requires a list of bidders that are attending the auction and can bid. :param bidders: sequence type of objects of type Bidder", "name": "__init__", "signature": "def __init__(self, bidders, auctioneer: Auctioneer=Auctioneer())" }, { "docstring": "Starts th...
2
null
Implement the Python class `Auction` described below. Class description: Simulates an auction. Is responsible for driving the auctioneer and the bidders. Method signatures and docstrings: - def __init__(self, bidders, auctioneer: Auctioneer=Auctioneer()): Initialize an auction. Requires a list of bidders that are att...
Implement the Python class `Auction` described below. Class description: Simulates an auction. Is responsible for driving the auctioneer and the bidders. Method signatures and docstrings: - def __init__(self, bidders, auctioneer: Auctioneer=Auctioneer()): Initialize an auction. Requires a list of bidders that are att...
c1736d33d0535502c65de86affe1c4ea151c09cb
<|skeleton|> class Auction: """Simulates an auction. Is responsible for driving the auctioneer and the bidders.""" def __init__(self, bidders, auctioneer: Auctioneer=Auctioneer()): """Initialize an auction. Requires a list of bidders that are attending the auction and can bid. :param bidders: sequence ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Auction: """Simulates an auction. Is responsible for driving the auctioneer and the bidders.""" def __init__(self, bidders, auctioneer: Auctioneer=Auctioneer()): """Initialize an auction. Requires a list of bidders that are attending the auction and can bid. :param bidders: sequence type of objec...
the_stack_v2_python_sparse
Labs/Lab6/auction_simulator.py
Bmeimei/3532_A01075487
train
1
09db15a77b28997d10bf63c667e2a9cc463fa7e4
[ "InputValidation.validate_string(config_file, 'The configuration file name must be a string')\nconfig_file = BASE_DIR + config_file\nInputValidation.validate_file_exist(config_file, 'The provided configuration file does not exist')\nself.config = ConfigParser.ConfigParser()\nself.config.read(config_file)\nfor secti...
<|body_start_0|> InputValidation.validate_string(config_file, 'The configuration file name must be a string') config_file = BASE_DIR + config_file InputValidation.validate_file_exist(config_file, 'The provided configuration file does not exist') self.config = ConfigParser.ConfigParser() ...
Used to extract data from the configuration file
ConfigurationFile
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConfigurationFile: """Used to extract data from the configuration file""" def __init__(self, sections, config_file='conf.cfg'): """Reads configuration file sections :param sections: list of strings representing the sections to be loaded :param config_file: name of the configuration f...
stack_v2_sparse_classes_75kplus_train_006941
22,587
permissive
[ { "docstring": "Reads configuration file sections :param sections: list of strings representing the sections to be loaded :param config_file: name of the configuration file (string) :return: None", "name": "__init__", "signature": "def __init__(self, sections, config_file='conf.cfg')" }, { "docs...
4
stack_v2_sparse_classes_30k_train_054388
Implement the Python class `ConfigurationFile` described below. Class description: Used to extract data from the configuration file Method signatures and docstrings: - def __init__(self, sections, config_file='conf.cfg'): Reads configuration file sections :param sections: list of strings representing the sections to ...
Implement the Python class `ConfigurationFile` described below. Class description: Used to extract data from the configuration file Method signatures and docstrings: - def __init__(self, sections, config_file='conf.cfg'): Reads configuration file sections :param sections: list of strings representing the sections to ...
9b3cc8d114d96c7353942323f0783c7138ac56b7
<|skeleton|> class ConfigurationFile: """Used to extract data from the configuration file""" def __init__(self, sections, config_file='conf.cfg'): """Reads configuration file sections :param sections: list of strings representing the sections to be loaded :param config_file: name of the configuration f...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ConfigurationFile: """Used to extract data from the configuration file""" def __init__(self, sections, config_file='conf.cfg'): """Reads configuration file sections :param sections: list of strings representing the sections to be loaded :param config_file: name of the configuration file (string) ...
the_stack_v2_python_sparse
experimental_framework/common.py
IntelLabsEurope/benchmarking-framework
train
2
5a85a282c56df0b5018c67f3257d7fd215e8dc26
[ "super().__init__(path)\nself.acquire()\nif self.get('annotated') is None:\n self['annotated'] = set()\nif clear_limbo or self.get('limbo') is None:\n self['limbo'] = set()\nif clear_priorities or self.get('priorities') is None or self.get('sorted_priorities') is None:\n self['priorities'] = dict()\n se...
<|body_start_0|> super().__init__(path) self.acquire() if self.get('annotated') is None: self['annotated'] = set() if clear_limbo or self.get('limbo') is None: self['limbo'] = set() if clear_priorities or self.get('priorities') is None or self.get('sorted_...
Maintain a sorted list or heap of (index, priority) pairs, as well as a list of annotated indices. 'priorities' and 'sorted_priorities' are (idx, priority) pairs guaranteed to not have an annotation yet. 'limbo' is a set of indices which have been selected for annotation but don't yet have an annotation. These cannot b...
AnnotationInfo
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AnnotationInfo: """Maintain a sorted list or heap of (index, priority) pairs, as well as a list of annotated indices. 'priorities' and 'sorted_priorities' are (idx, priority) pairs guaranteed to not have an annotation yet. 'limbo' is a set of indices which have been selected for annotation but do...
stack_v2_sparse_classes_75kplus_train_006942
7,520
permissive
[ { "docstring": "Create a new annotation info dict. :param path: path to save this dict. :param clear_priorities: start with a fresh set of priorities. Typically, will be True for the prioritizer, must be False for the Annotator. :param clear_limbo: clear the limbo index set. Annotator should call with clear_lim...
4
stack_v2_sparse_classes_30k_train_037358
Implement the Python class `AnnotationInfo` described below. Class description: Maintain a sorted list or heap of (index, priority) pairs, as well as a list of annotated indices. 'priorities' and 'sorted_priorities' are (idx, priority) pairs guaranteed to not have an annotation yet. 'limbo' is a set of indices which h...
Implement the Python class `AnnotationInfo` described below. Class description: Maintain a sorted list or heap of (index, priority) pairs, as well as a list of annotated indices. 'priorities' and 'sorted_priorities' are (idx, priority) pairs guaranteed to not have an annotation yet. 'limbo' is a set of indices which h...
ed6d80ad4fe5a56d8f2ae661cf702eeea18439e4
<|skeleton|> class AnnotationInfo: """Maintain a sorted list or heap of (index, priority) pairs, as well as a list of annotated indices. 'priorities' and 'sorted_priorities' are (idx, priority) pairs guaranteed to not have an annotation yet. 'limbo' is a set of indices which have been selected for annotation but do...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AnnotationInfo: """Maintain a sorted list or heap of (index, priority) pairs, as well as a list of annotated indices. 'priorities' and 'sorted_priorities' are (idx, priority) pairs guaranteed to not have an annotation yet. 'limbo' is a set of indices which have been selected for annotation but don't yet have ...
the_stack_v2_python_sparse
artifice/ann.py
zhuokaizhao/artifice
train
0
4b0ccbb10f41414782268b24c050e9c69fabbc39
[ "try:\n if text_id == 'random':\n return dumps(get_random_text())\n return dumps(get_text(text_id))\nexcept Exception as err:\n logger.error(str(err))\n return BadRequest(str(err))", "try:\n delete_text(text_id)\n return jsonify({'success': True})\nexcept Exception as err:\n logger.err...
<|body_start_0|> try: if text_id == 'random': return dumps(get_random_text()) return dumps(get_text(text_id)) except Exception as err: logger.error(str(err)) return BadRequest(str(err)) <|end_body_0|> <|body_start_1|> try: ...
Text
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Text: def get(self, text_id): """Input: text_id: [id of text, 'random'] Returns: { "_id": { "$oid": "5c6c1b2573cda500b254404c" }, "data": "This is a test. Number 2", "time_created": "2019-02-19 15:05:09", "time_modified": "2019-02-19 15:18:53", "categories": [4, 2] }""" <|body_0|...
stack_v2_sparse_classes_75kplus_train_006943
3,208
no_license
[ { "docstring": "Input: text_id: [id of text, 'random'] Returns: { \"_id\": { \"$oid\": \"5c6c1b2573cda500b254404c\" }, \"data\": \"This is a test. Number 2\", \"time_created\": \"2019-02-19 15:05:09\", \"time_modified\": \"2019-02-19 15:18:53\", \"categories\": [4, 2] }", "name": "get", "signature": "de...
3
stack_v2_sparse_classes_30k_train_022234
Implement the Python class `Text` described below. Class description: Implement the Text class. Method signatures and docstrings: - def get(self, text_id): Input: text_id: [id of text, 'random'] Returns: { "_id": { "$oid": "5c6c1b2573cda500b254404c" }, "data": "This is a test. Number 2", "time_created": "2019-02-19 1...
Implement the Python class `Text` described below. Class description: Implement the Text class. Method signatures and docstrings: - def get(self, text_id): Input: text_id: [id of text, 'random'] Returns: { "_id": { "$oid": "5c6c1b2573cda500b254404c" }, "data": "This is a test. Number 2", "time_created": "2019-02-19 1...
6dd0d1f4643d3ab40dc24f1144ce74a9e424d870
<|skeleton|> class Text: def get(self, text_id): """Input: text_id: [id of text, 'random'] Returns: { "_id": { "$oid": "5c6c1b2573cda500b254404c" }, "data": "This is a test. Number 2", "time_created": "2019-02-19 15:05:09", "time_modified": "2019-02-19 15:18:53", "categories": [4, 2] }""" <|body_0|...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Text: def get(self, text_id): """Input: text_id: [id of text, 'random'] Returns: { "_id": { "$oid": "5c6c1b2573cda500b254404c" }, "data": "This is a test. Number 2", "time_created": "2019-02-19 15:05:09", "time_modified": "2019-02-19 15:18:53", "categories": [4, 2] }""" try: if tex...
the_stack_v2_python_sparse
tatorte_classifier/api/texts.py
move-fast/tatorte-classifier
train
1
fd62df0079cc3ae073e5c65536633ab40160cfc5
[ "self.sock = socket.socket(family, sock_type)\nself.host = host\nself.port = port", "position_x = str(location[0])\nposition_y = str(1 - location[1])\nstr_mouse_location = position_x + ' ' + position_y\nlocation = bytes(str_mouse_location, 'UTF_8')\nprint(self.host)\nprint(location)\nself.sock.sendto(location, (s...
<|body_start_0|> self.sock = socket.socket(family, sock_type) self.host = host self.port = port <|end_body_0|> <|body_start_1|> position_x = str(location[0]) position_y = str(1 - location[1]) str_mouse_location = position_x + ' ' + position_y location = bytes(str...
Klasa koja se bavi slanjem lokacije miša s Raspberry Pi-a na računalo
MouseController
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MouseController: """Klasa koja se bavi slanjem lokacije miša s Raspberry Pi-a na računalo""" def __init__(self, family, sock_type, host='0.0.0.0', port=5005): """Inicijalna metoda klase MouseController. Stvara svoj socket Arguments: family {enum AddressFamily} -- tip adrese korišten ...
stack_v2_sparse_classes_75kplus_train_006944
1,747
no_license
[ { "docstring": "Inicijalna metoda klase MouseController. Stvara svoj socket Arguments: family {enum AddressFamily} -- tip adrese korišten za sockete sock_type {enum SocketType} -- port na koji će socket biti vezan Keyword Arguments: ip_address {str} -- ip adresa na koju će socket biti vezan (default: {\"172.21....
3
stack_v2_sparse_classes_30k_train_021105
Implement the Python class `MouseController` described below. Class description: Klasa koja se bavi slanjem lokacije miša s Raspberry Pi-a na računalo Method signatures and docstrings: - def __init__(self, family, sock_type, host='0.0.0.0', port=5005): Inicijalna metoda klase MouseController. Stvara svoj socket Argum...
Implement the Python class `MouseController` described below. Class description: Klasa koja se bavi slanjem lokacije miša s Raspberry Pi-a na računalo Method signatures and docstrings: - def __init__(self, family, sock_type, host='0.0.0.0', port=5005): Inicijalna metoda klase MouseController. Stvara svoj socket Argum...
0dd6346aa5f5e0b23127e33814aa0265b3eecf46
<|skeleton|> class MouseController: """Klasa koja se bavi slanjem lokacije miša s Raspberry Pi-a na računalo""" def __init__(self, family, sock_type, host='0.0.0.0', port=5005): """Inicijalna metoda klase MouseController. Stvara svoj socket Arguments: family {enum AddressFamily} -- tip adrese korišten ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MouseController: """Klasa koja se bavi slanjem lokacije miša s Raspberry Pi-a na računalo""" def __init__(self, family, sock_type, host='0.0.0.0', port=5005): """Inicijalna metoda klase MouseController. Stvara svoj socket Arguments: family {enum AddressFamily} -- tip adrese korišten za sockete so...
the_stack_v2_python_sparse
raspberry/controllers/mouse_controller.py
JBarti/MacroTouch
train
0
97a17d8a8406653d9a7614bc928f9bd26750545a
[ "self.env = jinja2.Environment(loader=jinja2.FileSystemLoader(os.path.join(templatePath, 'golang')))\nself.boTemplate = self.env.get_template('bo.template')\nself.poTemplate = self.env.get_template('po.template')\nself.tableNameTemplate = self.env.get_template('table_name.template')\nself.columnNameTemplate = self....
<|body_start_0|> self.env = jinja2.Environment(loader=jinja2.FileSystemLoader(os.path.join(templatePath, 'golang'))) self.boTemplate = self.env.get_template('bo.template') self.poTemplate = self.env.get_template('po.template') self.tableNameTemplate = self.env.get_template('table_name.te...
GolangBoPoGenerate
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GolangBoPoGenerate: def __init__(self, templatePath: str, exportPath: str): """初始化 Args: templatePath (str): 模板路径 exportPath (str): 输出路径""" <|body_0|> def generate_po_bo_file(self, conf: config_model.DataSourceConfig): """生成bo po文件 Args: conf (config_model.DataSource...
stack_v2_sparse_classes_75kplus_train_006945
2,689
no_license
[ { "docstring": "初始化 Args: templatePath (str): 模板路径 exportPath (str): 输出路径", "name": "__init__", "signature": "def __init__(self, templatePath: str, exportPath: str)" }, { "docstring": "生成bo po文件 Args: conf (config_model.DataSourceConfig): [description] ds (ds_model.DataSourceModel): [description...
2
stack_v2_sparse_classes_30k_train_020621
Implement the Python class `GolangBoPoGenerate` described below. Class description: Implement the GolangBoPoGenerate class. Method signatures and docstrings: - def __init__(self, templatePath: str, exportPath: str): 初始化 Args: templatePath (str): 模板路径 exportPath (str): 输出路径 - def generate_po_bo_file(self, conf: config...
Implement the Python class `GolangBoPoGenerate` described below. Class description: Implement the GolangBoPoGenerate class. Method signatures and docstrings: - def __init__(self, templatePath: str, exportPath: str): 初始化 Args: templatePath (str): 模板路径 exportPath (str): 输出路径 - def generate_po_bo_file(self, conf: config...
8763e5ead6be54a2cb03f5e8dabde1a7957b3aa6
<|skeleton|> class GolangBoPoGenerate: def __init__(self, templatePath: str, exportPath: str): """初始化 Args: templatePath (str): 模板路径 exportPath (str): 输出路径""" <|body_0|> def generate_po_bo_file(self, conf: config_model.DataSourceConfig): """生成bo po文件 Args: conf (config_model.DataSource...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GolangBoPoGenerate: def __init__(self, templatePath: str, exportPath: str): """初始化 Args: templatePath (str): 模板路径 exportPath (str): 输出路径""" self.env = jinja2.Environment(loader=jinja2.FileSystemLoader(os.path.join(templatePath, 'golang'))) self.boTemplate = self.env.get_template('bo.te...
the_stack_v2_python_sparse
soc_common/tools/code/code_generate/golang/generate_bo_po_by_db.py
treeyh/soc-python-common
train
1
8e5ff284bfe08acb017344d3a98f3e7c12d3aade
[ "now = head\nwhile now and now.next:\n now.val, now.next.val = (now.next.val, now.val)\n now = now.next.next\nreturn head", "root = prev = ListNode(None)\nprev.next = head\nwhile head and head.next:\n b = head.next\n head.next = b.next\n b.next = head\n prev.next = b\n head = head.next\n p...
<|body_start_0|> now = head while now and now.next: now.val, now.next.val = (now.next.val, now.val) now = now.next.next return head <|end_body_0|> <|body_start_1|> root = prev = ListNode(None) prev.next = head while head and head.next: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def swapPairs(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def swapPairs2(self, head): """:type head: ListNode :rtype: ListNode""" <|body_1|> def swapPairs3(self, head): """:type head: ListNode :rtype: ListNode"""...
stack_v2_sparse_classes_75kplus_train_006946
1,618
no_license
[ { "docstring": ":type head: ListNode :rtype: ListNode", "name": "swapPairs", "signature": "def swapPairs(self, head)" }, { "docstring": ":type head: ListNode :rtype: ListNode", "name": "swapPairs2", "signature": "def swapPairs2(self, head)" }, { "docstring": ":type head: ListNode...
3
stack_v2_sparse_classes_30k_val_000917
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def swapPairs(self, head): :type head: ListNode :rtype: ListNode - def swapPairs2(self, head): :type head: ListNode :rtype: ListNode - def swapPairs3(self, head): :type head: Lis...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def swapPairs(self, head): :type head: ListNode :rtype: ListNode - def swapPairs2(self, head): :type head: ListNode :rtype: ListNode - def swapPairs3(self, head): :type head: Lis...
bea9d655338af9ce35c70927888930507bb6aae8
<|skeleton|> class Solution: def swapPairs(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def swapPairs2(self, head): """:type head: ListNode :rtype: ListNode""" <|body_1|> def swapPairs3(self, head): """:type head: ListNode :rtype: ListNode"""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def swapPairs(self, head): """:type head: ListNode :rtype: ListNode""" now = head while now and now.next: now.val, now.next.val = (now.next.val, now.val) now = now.next.next return head def swapPairs2(self, head): """:type head: Li...
the_stack_v2_python_sparse
swapPairs.py
lilly9117/Algorithm_study
train
0
dc8b17d6eddc0cf03a64c017651eba809f1e1bda
[ "user_id = request.user.id\nredis_conn = get_redis_connection('history')\nsku_ids = redis_conn.lrange('history_' + str(user_id), 0, -1)\nsku_list = list()\nfor sku in sku_ids:\n sku = SKU.objects.get(id=sku)\n sku_list.append({'id': sku.id, 'name': sku.name, 'default_image_url': sku.default_image_url, 'price'...
<|body_start_0|> user_id = request.user.id redis_conn = get_redis_connection('history') sku_ids = redis_conn.lrange('history_' + str(user_id), 0, -1) sku_list = list() for sku in sku_ids: sku = SKU.objects.get(id=sku) sku_list.append({'id': sku.id, 'name':...
用户浏览sku记录
UserBrowseHistory
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserBrowseHistory: """用户浏览sku记录""" def get(self, request): """获取浏览记录 :param request: :return:""" <|body_0|> def post(self, request): """保存用户浏览记录 :param request: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> user_id = request.user.id ...
stack_v2_sparse_classes_75kplus_train_006947
23,231
permissive
[ { "docstring": "获取浏览记录 :param request: :return:", "name": "get", "signature": "def get(self, request)" }, { "docstring": "保存用户浏览记录 :param request: :return:", "name": "post", "signature": "def post(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_017885
Implement the Python class `UserBrowseHistory` described below. Class description: 用户浏览sku记录 Method signatures and docstrings: - def get(self, request): 获取浏览记录 :param request: :return: - def post(self, request): 保存用户浏览记录 :param request: :return:
Implement the Python class `UserBrowseHistory` described below. Class description: 用户浏览sku记录 Method signatures and docstrings: - def get(self, request): 获取浏览记录 :param request: :return: - def post(self, request): 保存用户浏览记录 :param request: :return: <|skeleton|> class UserBrowseHistory: """用户浏览sku记录""" def get(...
fecdf074ddb6844f33d6fadf05d40b0e562b46fb
<|skeleton|> class UserBrowseHistory: """用户浏览sku记录""" def get(self, request): """获取浏览记录 :param request: :return:""" <|body_0|> def post(self, request): """保存用户浏览记录 :param request: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UserBrowseHistory: """用户浏览sku记录""" def get(self, request): """获取浏览记录 :param request: :return:""" user_id = request.user.id redis_conn = get_redis_connection('history') sku_ids = redis_conn.lrange('history_' + str(user_id), 0, -1) sku_list = list() for sku i...
the_stack_v2_python_sparse
meiduo_mall/meiduo_mall/apps/users/views.py
qls7/dianshang
train
0
ced8862fcfd643fb8c711d240fd6743f1bad0a6e
[ "if len(nums) == 0:\n return False\nreturn len(set(nums)) < len(nums)", "if len(nums) < 2:\n return False\nnums.sort()\nfor i in range(len(nums) - 1):\n if nums[i] == nums[i + 1]:\n return True\nreturn False", "if len(nums) < 2:\n return False\nnums_dict = {}\nfor num in nums:\n if num in ...
<|body_start_0|> if len(nums) == 0: return False return len(set(nums)) < len(nums) <|end_body_0|> <|body_start_1|> if len(nums) < 2: return False nums.sort() for i in range(len(nums) - 1): if nums[i] == nums[i + 1]: return True...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def containsDuplicate2(self, nums): """beat 89.64% :type nums: List[int] :rtype: bool""" <|body_0|> def containsDuplicate2(self, nums): """beat 74.66% :type nums: List[int] :rtype: bool""" <|body_1|> def containsDuplicate(self, nums): "...
stack_v2_sparse_classes_75kplus_train_006948
1,509
no_license
[ { "docstring": "beat 89.64% :type nums: List[int] :rtype: bool", "name": "containsDuplicate2", "signature": "def containsDuplicate2(self, nums)" }, { "docstring": "beat 74.66% :type nums: List[int] :rtype: bool", "name": "containsDuplicate2", "signature": "def containsDuplicate2(self, nu...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def containsDuplicate2(self, nums): beat 89.64% :type nums: List[int] :rtype: bool - def containsDuplicate2(self, nums): beat 74.66% :type nums: List[int] :rtype: bool - def cont...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def containsDuplicate2(self, nums): beat 89.64% :type nums: List[int] :rtype: bool - def containsDuplicate2(self, nums): beat 74.66% :type nums: List[int] :rtype: bool - def cont...
852fad258f5070c7b93c35252f7404e85e709ea6
<|skeleton|> class Solution: def containsDuplicate2(self, nums): """beat 89.64% :type nums: List[int] :rtype: bool""" <|body_0|> def containsDuplicate2(self, nums): """beat 74.66% :type nums: List[int] :rtype: bool""" <|body_1|> def containsDuplicate(self, nums): "...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def containsDuplicate2(self, nums): """beat 89.64% :type nums: List[int] :rtype: bool""" if len(nums) == 0: return False return len(set(nums)) < len(nums) def containsDuplicate2(self, nums): """beat 74.66% :type nums: List[int] :rtype: bool""" ...
the_stack_v2_python_sparse
201-300/217. Contains Duplicate.py
SunnyMarkLiu/LeetCode
train
1
9b84900199525e4c3396543c19a69a9b1a9fddd9
[ "super(UNOInterface, self).__init__(vrf_name=vrf_name, if_name=if_name)\nself.vlan_id = vlan_id\nself.ip_address = ip_address\nself.subnet_mask = subnet_mask\nself.mss = mss", "parame = self._get_param()\nself._interface_common_start()\ncomm_txt = 'ip tcp adjust-mss %(mss)s'\nself._append_add_command(comm_txt, pa...
<|body_start_0|> super(UNOInterface, self).__init__(vrf_name=vrf_name, if_name=if_name) self.vlan_id = vlan_id self.ip_address = ip_address self.subnet_mask = subnet_mask self.mss = mss <|end_body_0|> <|body_start_1|> parame = self._get_param() self._interface_co...
Parts class for ASRdriver UNO interface configuration
UNOInterface
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UNOInterface: """Parts class for ASRdriver UNO interface configuration""" def __init__(self, vrf_name=None, if_name=None, vlan_id=None, ip_address=None, subnet_mask=None, mss=None): """Constructor""" <|body_0|> def output_add_command(self): """Command line to add...
stack_v2_sparse_classes_75kplus_train_006949
1,955
permissive
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, vrf_name=None, if_name=None, vlan_id=None, ip_address=None, subnet_mask=None, mss=None)" }, { "docstring": "Command line to add configuration is output.", "name": "output_add_command", "signature": "def ou...
3
null
Implement the Python class `UNOInterface` described below. Class description: Parts class for ASRdriver UNO interface configuration Method signatures and docstrings: - def __init__(self, vrf_name=None, if_name=None, vlan_id=None, ip_address=None, subnet_mask=None, mss=None): Constructor - def output_add_command(self)...
Implement the Python class `UNOInterface` described below. Class description: Parts class for ASRdriver UNO interface configuration Method signatures and docstrings: - def __init__(self, vrf_name=None, if_name=None, vlan_id=None, ip_address=None, subnet_mask=None, mss=None): Constructor - def output_add_command(self)...
e550d1b5ec9419f1fb3eb6e058ce46b57c92ee2f
<|skeleton|> class UNOInterface: """Parts class for ASRdriver UNO interface configuration""" def __init__(self, vrf_name=None, if_name=None, vlan_id=None, ip_address=None, subnet_mask=None, mss=None): """Constructor""" <|body_0|> def output_add_command(self): """Command line to add...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UNOInterface: """Parts class for ASRdriver UNO interface configuration""" def __init__(self, vrf_name=None, if_name=None, vlan_id=None, ip_address=None, subnet_mask=None, mss=None): """Constructor""" super(UNOInterface, self).__init__(vrf_name=vrf_name, if_name=if_name) self.vlan_...
the_stack_v2_python_sparse
lib/SeparateDriver/ASRDriverParts/UNOInterface.py
lixiaochun/element-manager
train
0
ed0208f820b21d24c1005f59a50359c6c34fd38e
[ "self.topic = sub_hedge_usnav_json_topic(SYSTEM_REAL, THING_TYPE_AGENT, THING_GROUP_LOADER)\nif debug:\n print('[USNavSubscriber] topic name = {}'.format(self.topic))\nsuper().__init__(aws_iot_client_factory, name='USNav', topic_name=self.topic, debug=debug)", "if self.debug:\n print('[USNavSubscriber] subs...
<|body_start_0|> self.topic = sub_hedge_usnav_json_topic(SYSTEM_REAL, THING_TYPE_AGENT, THING_GROUP_LOADER) if debug: print('[USNavSubscriber] topic name = {}'.format(self.topic)) super().__init__(aws_iot_client_factory, name='USNav', topic_name=self.topic, debug=debug) <|end_body_0|...
Marvelmindデータ(辞書型、位置情報データのみ)をAWS IoT Core から Subscribe するパーツクラス。
USNavSubscriber
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class USNavSubscriber: """Marvelmindデータ(辞書型、位置情報データのみ)をAWS IoT Core から Subscribe するパーツクラス。""" def __init__(self, aws_iot_client_factory, debug=False): """Subscribeを実行する。 real/agent/loaderをSubscribeする。 引数: aws_iot_client_factory AWS IoT Coreファクトリオブジェクト debug デバッグフラグ 戻り値: なし""" <|bod...
stack_v2_sparse_classes_75kplus_train_006950
7,541
no_license
[ { "docstring": "Subscribeを実行する。 real/agent/loaderをSubscribeする。 引数: aws_iot_client_factory AWS IoT Coreファクトリオブジェクト debug デバッグフラグ 戻り値: なし", "name": "__init__", "signature": "def __init__(self, aws_iot_client_factory, debug=False)" }, { "docstring": "Subscribe した Marvelmind データ(辞書型、位置情報データのみ)を取得する。...
2
stack_v2_sparse_classes_30k_train_021580
Implement the Python class `USNavSubscriber` described below. Class description: Marvelmindデータ(辞書型、位置情報データのみ)をAWS IoT Core から Subscribe するパーツクラス。 Method signatures and docstrings: - def __init__(self, aws_iot_client_factory, debug=False): Subscribeを実行する。 real/agent/loaderをSubscribeする。 引数: aws_iot_client_factory AWS I...
Implement the Python class `USNavSubscriber` described below. Class description: Marvelmindデータ(辞書型、位置情報データのみ)をAWS IoT Core から Subscribe するパーツクラス。 Method signatures and docstrings: - def __init__(self, aws_iot_client_factory, debug=False): Subscribeを実行する。 real/agent/loaderをSubscribeする。 引数: aws_iot_client_factory AWS I...
1ec8c285fcb3996eaa77869b15af993696e113a8
<|skeleton|> class USNavSubscriber: """Marvelmindデータ(辞書型、位置情報データのみ)をAWS IoT Core から Subscribe するパーツクラス。""" def __init__(self, aws_iot_client_factory, debug=False): """Subscribeを実行する。 real/agent/loaderをSubscribeする。 引数: aws_iot_client_factory AWS IoT Coreファクトリオブジェクト debug デバッグフラグ 戻り値: なし""" <|bod...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class USNavSubscriber: """Marvelmindデータ(辞書型、位置情報データのみ)をAWS IoT Core から Subscribe するパーツクラス。""" def __init__(self, aws_iot_client_factory, debug=False): """Subscribeを実行する。 real/agent/loaderをSubscribeする。 引数: aws_iot_client_factory AWS IoT Coreファクトリオブジェクト debug デバッグフラグ 戻り値: なし""" self.topic = sub_h...
the_stack_v2_python_sparse
parts/broker/sub/hedge.py
coolerking/agent_smith
train
0
e2d427ab115f5c1de2039d60b4627e6511a8ad3b
[ "super(ItApiVm, self).__init__(vm_name, vmdk_path, mac_eth0, mac_eth1)\nself.vm_type = vm_type\nself.it_api_client = None", "if None is self.it_api_client:\n raise RuntimeError('Connect called, but IT API client is notinitialized')\nif not isinstance(self.it_api_client, ItApiClient):\n raise TypeError('Inva...
<|body_start_0|> super(ItApiVm, self).__init__(vm_name, vmdk_path, mac_eth0, mac_eth1) self.vm_type = vm_type self.it_api_client = None <|end_body_0|> <|body_start_1|> if None is self.it_api_client: raise RuntimeError('Connect called, but IT API client is notinitialized') ...
Class represents VMs with IT API interface used to send commands and receive data from VMs.
ItApiVm
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ItApiVm: """Class represents VMs with IT API interface used to send commands and receive data from VMs.""" def __init__(self, vm_name, vmdk_path, mac_eth0, mac_eth1, vm_type): """Create virtual machine. :param vmdk_path: absolute path to VM image :param vm_name: VM name (used by virs...
stack_v2_sparse_classes_75kplus_train_006951
11,909
permissive
[ { "docstring": "Create virtual machine. :param vmdk_path: absolute path to VM image :param vm_name: VM name (used by virsh) :param mac_eth0: MAC address for management interface, in format: AA:BB:CC:DD:EE:FF :param mac_eth1: MAC address for communication between VMs :param vm_type: Type of VM.", "name": "__...
4
stack_v2_sparse_classes_30k_train_000603
Implement the Python class `ItApiVm` described below. Class description: Class represents VMs with IT API interface used to send commands and receive data from VMs. Method signatures and docstrings: - def __init__(self, vm_name, vmdk_path, mac_eth0, mac_eth1, vm_type): Create virtual machine. :param vmdk_path: absolu...
Implement the Python class `ItApiVm` described below. Class description: Class represents VMs with IT API interface used to send commands and receive data from VMs. Method signatures and docstrings: - def __init__(self, vm_name, vmdk_path, mac_eth0, mac_eth1, vm_type): Create virtual machine. :param vmdk_path: absolu...
70cf84df92347aba0493f506c0d059c0c041cba8
<|skeleton|> class ItApiVm: """Class represents VMs with IT API interface used to send commands and receive data from VMs.""" def __init__(self, vm_name, vmdk_path, mac_eth0, mac_eth1, vm_type): """Create virtual machine. :param vmdk_path: absolute path to VM image :param vm_name: VM name (used by virs...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ItApiVm: """Class represents VMs with IT API interface used to send commands and receive data from VMs.""" def __init__(self, vm_name, vmdk_path, mac_eth0, mac_eth1, vm_type): """Create virtual machine. :param vmdk_path: absolute path to VM image :param vm_name: VM name (used by virsh) :param mac...
the_stack_v2_python_sparse
openrpd/rpd_service_suite/it_api_topology.py
hujiangyi/or
train
0
693fd3732eed403f711a30592f0e608ed85eba5f
[ "try:\n return version_manager_api.get(pk)\nexcept exceptions.DoesNotExist:\n raise Http404", "try:\n template_version_manager_object = self.get_object(pk)\n serializer = TemplateVersionManagerSerializer(template_version_manager_object)\n return Response(serializer.data)\nexcept Http404:\n conte...
<|body_start_0|> try: return version_manager_api.get(pk) except exceptions.DoesNotExist: raise Http404 <|end_body_0|> <|body_start_1|> try: template_version_manager_object = self.get_object(pk) serializer = TemplateVersionManagerSerializer(templat...
Retrieve a TemplateVersionManager
TemplateVersionManagerDetail
[ "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TemplateVersionManagerDetail: """Retrieve a TemplateVersionManager""" def get_object(self, pk): """Get TemplateVersionManager from db Args: pk: ObjectId Returns: TemplateVersionManager""" <|body_0|> def get(self, request, pk): """Retrieve a TemplateVersionManager...
stack_v2_sparse_classes_75kplus_train_006952
9,786
permissive
[ { "docstring": "Get TemplateVersionManager from db Args: pk: ObjectId Returns: TemplateVersionManager", "name": "get_object", "signature": "def get_object(self, pk)" }, { "docstring": "Retrieve a TemplateVersionManager Args: request: HTTP request pk: ObjectId Returns: - code: 200 content: Templa...
2
stack_v2_sparse_classes_30k_train_021761
Implement the Python class `TemplateVersionManagerDetail` described below. Class description: Retrieve a TemplateVersionManager Method signatures and docstrings: - def get_object(self, pk): Get TemplateVersionManager from db Args: pk: ObjectId Returns: TemplateVersionManager - def get(self, request, pk): Retrieve a T...
Implement the Python class `TemplateVersionManagerDetail` described below. Class description: Retrieve a TemplateVersionManager Method signatures and docstrings: - def get_object(self, pk): Get TemplateVersionManager from db Args: pk: ObjectId Returns: TemplateVersionManager - def get(self, request, pk): Retrieve a T...
568cb75a40ccff1d74a1a757866112535efd769a
<|skeleton|> class TemplateVersionManagerDetail: """Retrieve a TemplateVersionManager""" def get_object(self, pk): """Get TemplateVersionManager from db Args: pk: ObjectId Returns: TemplateVersionManager""" <|body_0|> def get(self, request, pk): """Retrieve a TemplateVersionManager...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TemplateVersionManagerDetail: """Retrieve a TemplateVersionManager""" def get_object(self, pk): """Get TemplateVersionManager from db Args: pk: ObjectId Returns: TemplateVersionManager""" try: return version_manager_api.get(pk) except exceptions.DoesNotExist: ...
the_stack_v2_python_sparse
core_main_app/rest/template_version_manager/views.py
adilmania/core_main_app
train
0
3efa9fef8fc41ac10d30da5d47ae32e8dd445e7a
[ "prob = T.batched_dot(T.dot(x, W), y) + T.dot(x, xb) + T.dot(y, yb).dimshuffle(0, 'x')\nprob = T.nnet.softmax(prob)\ncontext = T.batched_dot(prob, x)\ncontext = T.dot(context, U) if U else None\nreturn (context, prob)", "if att_type == 'bilinear':\n self.W = init_matrix_u((s0, s1), pref + '_W', pdict)\n sel...
<|body_start_0|> prob = T.batched_dot(T.dot(x, W), y) + T.dot(x, xb) + T.dot(y, yb).dimshuffle(0, 'x') prob = T.nnet.softmax(prob) context = T.batched_dot(prob, x) context = T.dot(context, U) if U else None return (context, prob) <|end_body_0|> <|body_start_1|> if att_ty...
Attention
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Attention: def bilinear_fn(x, y, W, U, xb, yb): """@param x: shape (batch_size, n_sent, s0) @param y: shape (batch_size, s1) @return: shape (batch_size, s2): batched contexts""" <|body_0|> def __init__(self, s0, s1, s2, att_type, pref, pdict, no_context=False): """s1...
stack_v2_sparse_classes_75kplus_train_006953
21,104
no_license
[ { "docstring": "@param x: shape (batch_size, n_sent, s0) @param y: shape (batch_size, s1) @return: shape (batch_size, s2): batched contexts", "name": "bilinear_fn", "signature": "def bilinear_fn(x, y, W, U, xb, yb)" }, { "docstring": "s1 should be > s2 to encourage sparsity", "name": "__init...
2
null
Implement the Python class `Attention` described below. Class description: Implement the Attention class. Method signatures and docstrings: - def bilinear_fn(x, y, W, U, xb, yb): @param x: shape (batch_size, n_sent, s0) @param y: shape (batch_size, s1) @return: shape (batch_size, s2): batched contexts - def __init__(...
Implement the Python class `Attention` described below. Class description: Implement the Attention class. Method signatures and docstrings: - def bilinear_fn(x, y, W, U, xb, yb): @param x: shape (batch_size, n_sent, s0) @param y: shape (batch_size, s1) @return: shape (batch_size, s2): batched contexts - def __init__(...
2b909fa22271d343d95e846ffb0a7fa73092c293
<|skeleton|> class Attention: def bilinear_fn(x, y, W, U, xb, yb): """@param x: shape (batch_size, n_sent, s0) @param y: shape (batch_size, s1) @return: shape (batch_size, s2): batched contexts""" <|body_0|> def __init__(self, s0, s1, s2, att_type, pref, pdict, no_context=False): """s1...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Attention: def bilinear_fn(x, y, W, U, xb, yb): """@param x: shape (batch_size, n_sent, s0) @param y: shape (batch_size, s1) @return: shape (batch_size, s2): batched contexts""" prob = T.batched_dot(T.dot(x, W), y) + T.dot(x, xb) + T.dot(y, yb).dimshuffle(0, 'x') prob = T.nnet.softmax(...
the_stack_v2_python_sparse
models.py
KevinWangTHU/p0-pub
train
0
98552209d701297343e92d1d907d2cdcdfb4d806
[ "self.name = filterName\nself.filterTab = filterTab\nself.summaryTab = summaryTab\nself.controlsBoxes = []\nself.summaryBoxes = []\nself.nameLabel = QLabel(self.name)\nself.updatingCheckboxes = False\nfor i in range(len(self.filterTab.project.eg.analytes)):\n self.controlsBoxes.append(QCheckBox())\n self.summ...
<|body_start_0|> self.name = filterName self.filterTab = filterTab self.summaryTab = summaryTab self.controlsBoxes = [] self.summaryBoxes = [] self.nameLabel = QLabel(self.name) self.updatingCheckboxes = False for i in range(len(self.filterTab.project.eg.a...
Contains and controls the checkboxes for one row of a filter
AnalyteCheckBoxes
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AnalyteCheckBoxes: """Contains and controls the checkboxes for one row of a filter""" def __init__(self, filterName, filterTab, summaryTab): """A row of checkboxes that appear in both the summary tab, and the filter's tab, representing one row of a filter Parameters ---------- filter...
stack_v2_sparse_classes_75kplus_train_006954
29,890
no_license
[ { "docstring": "A row of checkboxes that appear in both the summary tab, and the filter's tab, representing one row of a filter Parameters ---------- filterName : str The technical name that LA Tools gives the filter row filterTab: FilterTab A reference to the Filter's tab object summaryTab: SummaryTab A refere...
5
null
Implement the Python class `AnalyteCheckBoxes` described below. Class description: Contains and controls the checkboxes for one row of a filter Method signatures and docstrings: - def __init__(self, filterName, filterTab, summaryTab): A row of checkboxes that appear in both the summary tab, and the filter's tab, repr...
Implement the Python class `AnalyteCheckBoxes` described below. Class description: Contains and controls the checkboxes for one row of a filter Method signatures and docstrings: - def __init__(self, filterName, filterTab, summaryTab): A row of checkboxes that appear in both the summary tab, and the filter's tab, repr...
ab59d0a5655d514246fa23a1110e0279254ea5d2
<|skeleton|> class AnalyteCheckBoxes: """Contains and controls the checkboxes for one row of a filter""" def __init__(self, filterName, filterTab, summaryTab): """A row of checkboxes that appear in both the summary tab, and the filter's tab, representing one row of a filter Parameters ---------- filter...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AnalyteCheckBoxes: """Contains and controls the checkboxes for one row of a filter""" def __init__(self, filterName, filterTab, summaryTab): """A row of checkboxes that appear in both the summary tab, and the filter's tab, representing one row of a filter Parameters ---------- filterName : str Th...
the_stack_v2_python_sparse
latools_gui/templates/filterControls.py
ch-king/latools_gui
train
0
1ff6b8fb778e7b0f0b07388cd008694882f70bd2
[ "data = GetData()\nsend = SendRequests()\nrow = data.get_depend_case_row(depend_case)\nurl = data.get_url(row)\nmethod = data.get_method(row)\nis_cookie = data.get_is_cookie(row)\ncookies = None\nif is_cookie == 'yes':\n ope_cookies = OperateCookies()\n cookies = ope_cookies.read_cookies()\nrequest_data = dat...
<|body_start_0|> data = GetData() send = SendRequests() row = data.get_depend_case_row(depend_case) url = data.get_url(row) method = data.get_method(row) is_cookie = data.get_is_cookie(row) cookies = None if is_cookie == 'yes': ope_cookies = Op...
处理有依赖的case
GetDepend
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GetDepend: """处理有依赖的case""" def run_depend(self, depend_case): """执行依赖的case""" <|body_0|> def get_depend_data(self, depend_case, depend_field): """从依赖case的返回结果中获取依赖的字段""" <|body_1|> <|end_skeleton|> <|body_start_0|> data = GetData() send...
stack_v2_sparse_classes_75kplus_train_006955
1,300
no_license
[ { "docstring": "执行依赖的case", "name": "run_depend", "signature": "def run_depend(self, depend_case)" }, { "docstring": "从依赖case的返回结果中获取依赖的字段", "name": "get_depend_data", "signature": "def get_depend_data(self, depend_case, depend_field)" } ]
2
null
Implement the Python class `GetDepend` described below. Class description: 处理有依赖的case Method signatures and docstrings: - def run_depend(self, depend_case): 执行依赖的case - def get_depend_data(self, depend_case, depend_field): 从依赖case的返回结果中获取依赖的字段
Implement the Python class `GetDepend` described below. Class description: 处理有依赖的case Method signatures and docstrings: - def run_depend(self, depend_case): 执行依赖的case - def get_depend_data(self, depend_case, depend_field): 从依赖case的返回结果中获取依赖的字段 <|skeleton|> class GetDepend: """处理有依赖的case""" def run_depend(se...
196dfdb1b185ea6d3e9dc3b0c1c18a6a73e06f2c
<|skeleton|> class GetDepend: """处理有依赖的case""" def run_depend(self, depend_case): """执行依赖的case""" <|body_0|> def get_depend_data(self, depend_case, depend_field): """从依赖case的返回结果中获取依赖的字段""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GetDepend: """处理有依赖的case""" def run_depend(self, depend_case): """执行依赖的case""" data = GetData() send = SendRequests() row = data.get_depend_case_row(depend_case) url = data.get_url(row) method = data.get_method(row) is_cookie = data.get_is_cookie(ro...
the_stack_v2_python_sparse
imooc_interface_me/data/get_depend.py
wang-orange/PyProject
train
0
6f9b1991c95bca2ef5cdbcac6b33d9e9b1bcfd99
[ "try:\n code = code.strip()\n rotation = cls.rotation_table[code[0:1]]\n angle = cls.angle_table[code[1:]]\n return lambda cube: rotation(cube, angle)\nexcept KeyError:\n raise RuntimeError('falscher Bewegungscode: ' + code)", "program = [cls.compile_code(step) for step in re.split(\"([A-Z]'?2?)\",...
<|body_start_0|> try: code = code.strip() rotation = cls.rotation_table[code[0:1]] angle = cls.angle_table[code[1:]] return lambda cube: rotation(cube, angle) except KeyError: raise RuntimeError('falscher Bewegungscode: ' + code) <|end_body_0|>...
Interpretieren der Cube Rotationen in Zeichenkette.
CubeCodes
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CubeCodes: """Interpretieren der Cube Rotationen in Zeichenkette.""" def compile_code(cls, code: str) -> Callable[[Cube], None]: """Übersetzt einen BewegungsCode in einen Aufruf einer Drehfunktion. Die Codes der einzelnen Rotationen nach https://speedcube.de/notation.php: F = front, ...
stack_v2_sparse_classes_75kplus_train_006956
11,951
permissive
[ { "docstring": "Übersetzt einen BewegungsCode in einen Aufruf einer Drehfunktion. Die Codes der einzelnen Rotationen nach https://speedcube.de/notation.php: F = front, B = back, R = right, L = left, U = up, D = down Dem Buchstaben für die Rotation kann ein Zeichen für den Winkel folgen: kein Zeichen = 90°, ' = ...
2
stack_v2_sparse_classes_30k_train_051618
Implement the Python class `CubeCodes` described below. Class description: Interpretieren der Cube Rotationen in Zeichenkette. Method signatures and docstrings: - def compile_code(cls, code: str) -> Callable[[Cube], None]: Übersetzt einen BewegungsCode in einen Aufruf einer Drehfunktion. Die Codes der einzelnen Rotat...
Implement the Python class `CubeCodes` described below. Class description: Interpretieren der Cube Rotationen in Zeichenkette. Method signatures and docstrings: - def compile_code(cls, code: str) -> Callable[[Cube], None]: Übersetzt einen BewegungsCode in einen Aufruf einer Drehfunktion. Die Codes der einzelnen Rotat...
60f62c4877303c6bc661a774da089adbbf0e5c31
<|skeleton|> class CubeCodes: """Interpretieren der Cube Rotationen in Zeichenkette.""" def compile_code(cls, code: str) -> Callable[[Cube], None]: """Übersetzt einen BewegungsCode in einen Aufruf einer Drehfunktion. Die Codes der einzelnen Rotationen nach https://speedcube.de/notation.php: F = front, ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CubeCodes: """Interpretieren der Cube Rotationen in Zeichenkette.""" def compile_code(cls, code: str) -> Callable[[Cube], None]: """Übersetzt einen BewegungsCode in einen Aufruf einer Drehfunktion. Die Codes der einzelnen Rotationen nach https://speedcube.de/notation.php: F = front, B = back, R =...
the_stack_v2_python_sparse
Teil_xx_rubiks_cube.py
soohanno2/A-beautiful-code-in-Python
train
0
ec962d1305685fc8f3b715e27d1555bcb3ae559c
[ "objs = query.order_by(order_by).limit(results_per_page + 1).offset((page - 1) * results_per_page).all()\nextra = objs.pop() if len(objs) > results_per_page else None\ncollection = {'page': page, 'next_page': page + (1 if extra else 0), 'prev_page': max(page - 1, 1), 'results_per_page': results_per_page, 'collectio...
<|body_start_0|> objs = query.order_by(order_by).limit(results_per_page + 1).offset((page - 1) * results_per_page).all() extra = objs.pop() if len(objs) > results_per_page else None collection = {'page': page, 'next_page': page + (1 if extra else 0), 'prev_page': max(page - 1, 1), 'results_per_p...
Base DOM Resource
Resource
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Resource: """Base DOM Resource""" def paged(cls, query, page, results_per_page, order_by, **kwargs): """Return a collection-like dict for a paginated (not cursored) collection results set""" <|body_0|> def generic_insert(cls, db, api, Model, data, url_field, url_cls=None...
stack_v2_sparse_classes_75kplus_train_006957
11,612
no_license
[ { "docstring": "Return a collection-like dict for a paginated (not cursored) collection results set", "name": "paged", "signature": "def paged(cls, query, page, results_per_page, order_by, **kwargs)" }, { "docstring": "Post helper method", "name": "generic_insert", "signature": "def gene...
4
stack_v2_sparse_classes_30k_train_027402
Implement the Python class `Resource` described below. Class description: Base DOM Resource Method signatures and docstrings: - def paged(cls, query, page, results_per_page, order_by, **kwargs): Return a collection-like dict for a paginated (not cursored) collection results set - def generic_insert(cls, db, api, Mode...
Implement the Python class `Resource` described below. Class description: Base DOM Resource Method signatures and docstrings: - def paged(cls, query, page, results_per_page, order_by, **kwargs): Return a collection-like dict for a paginated (not cursored) collection results set - def generic_insert(cls, db, api, Mode...
dbba9f3b292ffef6ea924608fa54237171f0aaeb
<|skeleton|> class Resource: """Base DOM Resource""" def paged(cls, query, page, results_per_page, order_by, **kwargs): """Return a collection-like dict for a paginated (not cursored) collection results set""" <|body_0|> def generic_insert(cls, db, api, Model, data, url_field, url_cls=None...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Resource: """Base DOM Resource""" def paged(cls, query, page, results_per_page, order_by, **kwargs): """Return a collection-like dict for a paginated (not cursored) collection results set""" objs = query.order_by(order_by).limit(results_per_page + 1).offset((page - 1) * results_per_page)....
the_stack_v2_python_sparse
lib/python/core/directorofme/flask/api.py
DirectorOfMe/directorof.me
train
0
48f4b8ca54534514333bac797fb791c7e766ab41
[ "self.valid = kwargs.pop('valid')\nself.error = kwargs.pop('eMsg')\nsuper(SubmitReportForm, self).__init__(*args, **kwargs)", "super().clean()\nif not self.valid:\n raise forms.ValidationError(self.error)" ]
<|body_start_0|> self.valid = kwargs.pop('valid') self.error = kwargs.pop('eMsg') super(SubmitReportForm, self).__init__(*args, **kwargs) <|end_body_0|> <|body_start_1|> super().clean() if not self.valid: raise forms.ValidationError(self.error) <|end_body_1|>
Dummy form to submit report
SubmitReportForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SubmitReportForm: """Dummy form to submit report""" def __init__(self, *args, **kwargs): """Initializes form and sets the valid and error message on the instance Keyword Args: valid (bool) : if report is valid to be submitted eMsg (str): error message""" <|body_0|> def c...
stack_v2_sparse_classes_75kplus_train_006958
914
no_license
[ { "docstring": "Initializes form and sets the valid and error message on the instance Keyword Args: valid (bool) : if report is valid to be submitted eMsg (str): error message", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Cleans form and checks if va...
2
stack_v2_sparse_classes_30k_train_052202
Implement the Python class `SubmitReportForm` described below. Class description: Dummy form to submit report Method signatures and docstrings: - def __init__(self, *args, **kwargs): Initializes form and sets the valid and error message on the instance Keyword Args: valid (bool) : if report is valid to be submitted e...
Implement the Python class `SubmitReportForm` described below. Class description: Dummy form to submit report Method signatures and docstrings: - def __init__(self, *args, **kwargs): Initializes form and sets the valid and error message on the instance Keyword Args: valid (bool) : if report is valid to be submitted e...
472a6fd487811002a60a7812ae2eef941e7182cc
<|skeleton|> class SubmitReportForm: """Dummy form to submit report""" def __init__(self, *args, **kwargs): """Initializes form and sets the valid and error message on the instance Keyword Args: valid (bool) : if report is valid to be submitted eMsg (str): error message""" <|body_0|> def c...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SubmitReportForm: """Dummy form to submit report""" def __init__(self, *args, **kwargs): """Initializes form and sets the valid and error message on the instance Keyword Args: valid (bool) : if report is valid to be submitted eMsg (str): error message""" self.valid = kwargs.pop('valid') ...
the_stack_v2_python_sparse
AACForm/makeReports/forms/other_forms.py
jdboyd-github/AAC-Capstone
train
0
ad422fdcaba8c2f233ca5431133dc9790b3d8267
[ "self.model = model\nself.epsilon = epsilon\nself.num_steps = num_steps\nself.step_size = step_size\nself.rand = random_start\nif loss_func == 'xent':\n loss = model.xent\nelif loss_func == 'cw':\n label_mask = tf.one_hot(model.y_input, 10, on_value=1.0, off_value=0.0, dtype=tf.float32)\n correct_logit = t...
<|body_start_0|> self.model = model self.epsilon = epsilon self.num_steps = num_steps self.step_size = step_size self.rand = random_start if loss_func == 'xent': loss = model.xent elif loss_func == 'cw': label_mask = tf.one_hot(model.y_inpu...
LinfPGDAttack_org
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LinfPGDAttack_org: def __init__(self, model, epsilon, num_steps, step_size, random_start, loss_func): """Attack parameter initialization. The attack performs k steps of size a, while always staying within epsilon from the initial point.""" <|body_0|> def perturb(self, x_nat,...
stack_v2_sparse_classes_75kplus_train_006959
7,367
no_license
[ { "docstring": "Attack parameter initialization. The attack performs k steps of size a, while always staying within epsilon from the initial point.", "name": "__init__", "signature": "def __init__(self, model, epsilon, num_steps, step_size, random_start, loss_func)" }, { "docstring": "Given a se...
2
null
Implement the Python class `LinfPGDAttack_org` described below. Class description: Implement the LinfPGDAttack_org class. Method signatures and docstrings: - def __init__(self, model, epsilon, num_steps, step_size, random_start, loss_func): Attack parameter initialization. The attack performs k steps of size a, while...
Implement the Python class `LinfPGDAttack_org` described below. Class description: Implement the LinfPGDAttack_org class. Method signatures and docstrings: - def __init__(self, model, epsilon, num_steps, step_size, random_start, loss_func): Attack parameter initialization. The attack performs k steps of size a, while...
fce2aedc511f925e8033c523e9a3a64a9a1abd17
<|skeleton|> class LinfPGDAttack_org: def __init__(self, model, epsilon, num_steps, step_size, random_start, loss_func): """Attack parameter initialization. The attack performs k steps of size a, while always staying within epsilon from the initial point.""" <|body_0|> def perturb(self, x_nat,...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LinfPGDAttack_org: def __init__(self, model, epsilon, num_steps, step_size, random_start, loss_func): """Attack parameter initialization. The attack performs k steps of size a, while always staying within epsilon from the initial point.""" self.model = model self.epsilon = epsilon ...
the_stack_v2_python_sparse
code/pgd_attack.py
JerishDansolBalala/FeatureSpaceAtk
train
1
bdd573fc205dcd5ff05b13ecec3196dcc18d9b60
[ "super(Action, self).__init__()\nself.actor = actor\nself.name = name\nactor.add(self)\nself.sub_actor = None", "if self.sub_actor:\n design = Service('Design')\n design.select_actor(self.sub_actor, view)\nelse:\n self.emit('activated', self.actor.item, view)", "if not self.sub_actor:\n self.sub_act...
<|body_start_0|> super(Action, self).__init__() self.actor = actor self.name = name actor.add(self) self.sub_actor = None <|end_body_0|> <|body_start_1|> if self.sub_actor: design = Service('Design') design.select_actor(self.sub_actor, view) ...
The Action class
Action
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Action: """The Action class""" def __init__(self, actor, name): """Create a new action into `actor`. You shouldn't call this method, but use the Actor.new_action method instead. :Parameters: actor : `Actor` the parent actor name : str the name of the action""" <|body_0|> ...
stack_v2_sparse_classes_75kplus_train_006960
5,550
no_license
[ { "docstring": "Create a new action into `actor`. You shouldn't call this method, but use the Actor.new_action method instead. :Parameters: actor : `Actor` the parent actor name : str the name of the action", "name": "__init__", "signature": "def __init__(self, actor, name)" }, { "docstring": "t...
3
stack_v2_sparse_classes_30k_train_051291
Implement the Python class `Action` described below. Class description: The Action class Method signatures and docstrings: - def __init__(self, actor, name): Create a new action into `actor`. You shouldn't call this method, but use the Actor.new_action method instead. :Parameters: actor : `Actor` the parent actor nam...
Implement the Python class `Action` described below. Class description: The Action class Method signatures and docstrings: - def __init__(self, actor, name): Create a new action into `actor`. You shouldn't call this method, but use the Actor.new_action method instead. :Parameters: actor : `Actor` the parent actor nam...
c43dc61124651160bc20b11873eac69a89edfb25
<|skeleton|> class Action: """The Action class""" def __init__(self, actor, name): """Create a new action into `actor`. You shouldn't call this method, but use the Actor.new_action method instead. :Parameters: actor : `Actor` the parent actor name : str the name of the action""" <|body_0|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Action: """The Action class""" def __init__(self, actor, name): """Create a new action into `actor`. You shouldn't call this method, but use the Actor.new_action method instead. :Parameters: actor : `Actor` the parent actor name : str the name of the action""" super(Action, self).__init__...
the_stack_v2_python_sparse
paroli-core/tichy/actor.py
openmoko/paroli
train
1
925178fb4714793ca037188df98996cf78aeec71
[ "st = ''\nlength = 0\nfor i in s:\n index = st.find(i)\n if index >= 0:\n if len(st) > length:\n length = len(st)\n st = st[index + 1:]\n st += i\nreturn len(st) if len(st) > length else length", "index = 0\nmax_count = 0\ndata = {}\nwhile index < len(s):\n if s[index] not in ...
<|body_start_0|> st = '' length = 0 for i in s: index = st.find(i) if index >= 0: if len(st) > length: length = len(st) st = st[index + 1:] st += i return len(st) if len(st) > length else length <|end...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def _lengthOfLongestSubstring(self, s): """:type s: str :rtype: int""" <|body_0|> def __lengthOfLongestSubstring(self, s): """:type s: str :rtype: int""" <|body_1|> def ___lengthOfLongestSubstring(self, s): """:type s: str :rtype: int""...
stack_v2_sparse_classes_75kplus_train_006961
3,690
permissive
[ { "docstring": ":type s: str :rtype: int", "name": "_lengthOfLongestSubstring", "signature": "def _lengthOfLongestSubstring(self, s)" }, { "docstring": ":type s: str :rtype: int", "name": "__lengthOfLongestSubstring", "signature": "def __lengthOfLongestSubstring(self, s)" }, { "d...
5
stack_v2_sparse_classes_30k_train_009839
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def _lengthOfLongestSubstring(self, s): :type s: str :rtype: int - def __lengthOfLongestSubstring(self, s): :type s: str :rtype: int - def ___lengthOfLongestSubstring(self, s): :...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def _lengthOfLongestSubstring(self, s): :type s: str :rtype: int - def __lengthOfLongestSubstring(self, s): :type s: str :rtype: int - def ___lengthOfLongestSubstring(self, s): :...
0dd67edca4e0b0323cb5a7239f02ea46383cd15a
<|skeleton|> class Solution: def _lengthOfLongestSubstring(self, s): """:type s: str :rtype: int""" <|body_0|> def __lengthOfLongestSubstring(self, s): """:type s: str :rtype: int""" <|body_1|> def ___lengthOfLongestSubstring(self, s): """:type s: str :rtype: int""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def _lengthOfLongestSubstring(self, s): """:type s: str :rtype: int""" st = '' length = 0 for i in s: index = st.find(i) if index >= 0: if len(st) > length: length = len(st) st = st[index + 1:...
the_stack_v2_python_sparse
3.longest-substring-without-repeating-characters.py
windard/leeeeee
train
0
8a94ea375a14729d6ef975ccaddac63862b3d6a4
[ "self.pump = Pump('127.0.0.1', 1000)\nself.sensor = Sensor('127.0.0.2', 2000)\nself.decider = Decider(100, 0.05)\nself.controller = Controller(self.sensor, self.pump, self.decider)", "self.sensor.measure = MagicMock(return_value=130)\nself.pump.get_state = MagicMock(return_value='PUMP_OFF')\nself.controller.tick ...
<|body_start_0|> self.pump = Pump('127.0.0.1', 1000) self.sensor = Sensor('127.0.0.2', 2000) self.decider = Decider(100, 0.05) self.controller = Controller(self.sensor, self.pump, self.decider) <|end_body_0|> <|body_start_1|> self.sensor.measure = MagicMock(return_value=130) ...
This class performs a unit test on Controller
ControllerTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ControllerTests: """This class performs a unit test on Controller""" def setUp(self): """This method does a setup for unit testing Controller""" <|body_0|> def test_tick(self): """This method performs a unit test on tick""" <|body_1|> <|end_skeleton|> <...
stack_v2_sparse_classes_75kplus_train_006962
3,475
no_license
[ { "docstring": "This method does a setup for unit testing Controller", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "This method performs a unit test on tick", "name": "test_tick", "signature": "def test_tick(self)" } ]
2
stack_v2_sparse_classes_30k_train_054050
Implement the Python class `ControllerTests` described below. Class description: This class performs a unit test on Controller Method signatures and docstrings: - def setUp(self): This method does a setup for unit testing Controller - def test_tick(self): This method performs a unit test on tick
Implement the Python class `ControllerTests` described below. Class description: This class performs a unit test on Controller Method signatures and docstrings: - def setUp(self): This method does a setup for unit testing Controller - def test_tick(self): This method performs a unit test on tick <|skeleton|> class C...
263685ca90110609bfd05d621516727f8cd0028f
<|skeleton|> class ControllerTests: """This class performs a unit test on Controller""" def setUp(self): """This method does a setup for unit testing Controller""" <|body_0|> def test_tick(self): """This method performs a unit test on tick""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ControllerTests: """This class performs a unit test on Controller""" def setUp(self): """This method does a setup for unit testing Controller""" self.pump = Pump('127.0.0.1', 1000) self.sensor = Sensor('127.0.0.2', 2000) self.decider = Decider(100, 0.05) self.contr...
the_stack_v2_python_sparse
students/John_Sekora/lesson06/water_reg/waterregulation/test.py
aurel1212/Sp2018-Online
train
0
f48c8bed0752f6a8c52f88ff97e588ac951420da
[ "Offsets.__init__(self, **kwargs)\nself.center = center\nself.target = target", "target = [image.header[x] for x in self.target]\ncenter = [image.header[x] for x in self.center]\nimage.meta['offsets'] = np.subtract(target, center)\nreturn image" ]
<|body_start_0|> Offsets.__init__(self, **kwargs) self.center = center self.target = target <|end_body_0|> <|body_start_1|> target = [image.header[x] for x in self.target] center = [image.header[x] for x in self.center] image.meta['offsets'] = np.subtract(target, center)...
An offset-calculation method based on fits headers.
FitsHeaderOffsets
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FitsHeaderOffsets: """An offset-calculation method based on fits headers.""" def __init__(self, target: Tuple[str, str], center: Tuple[str, str]=('DET-CPX1', 'DET-CPX2'), **kwargs: Any): """Initializes new fits header offsets.""" <|body_0|> async def __call__(self, image...
stack_v2_sparse_classes_75kplus_train_006963
1,149
permissive
[ { "docstring": "Initializes new fits header offsets.", "name": "__init__", "signature": "def __init__(self, target: Tuple[str, str], center: Tuple[str, str]=('DET-CPX1', 'DET-CPX2'), **kwargs: Any)" }, { "docstring": "Processes an image and sets x/y pixel offset to reference in offset attribute....
2
stack_v2_sparse_classes_30k_train_038075
Implement the Python class `FitsHeaderOffsets` described below. Class description: An offset-calculation method based on fits headers. Method signatures and docstrings: - def __init__(self, target: Tuple[str, str], center: Tuple[str, str]=('DET-CPX1', 'DET-CPX2'), **kwargs: Any): Initializes new fits header offsets. ...
Implement the Python class `FitsHeaderOffsets` described below. Class description: An offset-calculation method based on fits headers. Method signatures and docstrings: - def __init__(self, target: Tuple[str, str], center: Tuple[str, str]=('DET-CPX1', 'DET-CPX2'), **kwargs: Any): Initializes new fits header offsets. ...
2d7a06e5485b61b6ca7e51d99b08651ea6021086
<|skeleton|> class FitsHeaderOffsets: """An offset-calculation method based on fits headers.""" def __init__(self, target: Tuple[str, str], center: Tuple[str, str]=('DET-CPX1', 'DET-CPX2'), **kwargs: Any): """Initializes new fits header offsets.""" <|body_0|> async def __call__(self, image...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FitsHeaderOffsets: """An offset-calculation method based on fits headers.""" def __init__(self, target: Tuple[str, str], center: Tuple[str, str]=('DET-CPX1', 'DET-CPX2'), **kwargs: Any): """Initializes new fits header offsets.""" Offsets.__init__(self, **kwargs) self.center = cent...
the_stack_v2_python_sparse
pyobs/images/processors/offsets/fitsheader.py
pyobs/pyobs-core
train
9
83c85e9ffe659cbffef0e0162caa7cd8642ccc26
[ "l = 0\nr = len(List) - 1\nif l > r:\n return None\nif l == r:\n return TreeNode(List[l])\nmid = int((l + r) / 2)\nroot = TreeNode(List[mid])\nroot.left = self.build_tree(List[:mid])\nroot.right = self.build_tree(List[mid + 1:])\nreturn root", "if not root:\n return []\nqueue = []\nresult = []\nqueue.app...
<|body_start_0|> l = 0 r = len(List) - 1 if l > r: return None if l == r: return TreeNode(List[l]) mid = int((l + r) / 2) root = TreeNode(List[mid]) root.left = self.build_tree(List[:mid]) root.right = self.build_tree(List[mid + 1:]...
BinaryTree
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BinaryTree: def build_tree(self, List): """构建一棵平衡二叉树,数组必须为中序遍历类型,如果数组排好序,那么得到平衡二叉树""" <|body_0|> def PrintFromTopToBottom(self, root): """从上往下打印二叉树""" <|body_1|> <|end_skeleton|> <|body_start_0|> l = 0 r = len(List) - 1 if l > r: ...
stack_v2_sparse_classes_75kplus_train_006964
4,838
no_license
[ { "docstring": "构建一棵平衡二叉树,数组必须为中序遍历类型,如果数组排好序,那么得到平衡二叉树", "name": "build_tree", "signature": "def build_tree(self, List)" }, { "docstring": "从上往下打印二叉树", "name": "PrintFromTopToBottom", "signature": "def PrintFromTopToBottom(self, root)" } ]
2
stack_v2_sparse_classes_30k_train_021024
Implement the Python class `BinaryTree` described below. Class description: Implement the BinaryTree class. Method signatures and docstrings: - def build_tree(self, List): 构建一棵平衡二叉树,数组必须为中序遍历类型,如果数组排好序,那么得到平衡二叉树 - def PrintFromTopToBottom(self, root): 从上往下打印二叉树
Implement the Python class `BinaryTree` described below. Class description: Implement the BinaryTree class. Method signatures and docstrings: - def build_tree(self, List): 构建一棵平衡二叉树,数组必须为中序遍历类型,如果数组排好序,那么得到平衡二叉树 - def PrintFromTopToBottom(self, root): 从上往下打印二叉树 <|skeleton|> class BinaryTree: def build_tree(self...
4e4f739402b95691f6c91411da26d7d3bfe042b6
<|skeleton|> class BinaryTree: def build_tree(self, List): """构建一棵平衡二叉树,数组必须为中序遍历类型,如果数组排好序,那么得到平衡二叉树""" <|body_0|> def PrintFromTopToBottom(self, root): """从上往下打印二叉树""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BinaryTree: def build_tree(self, List): """构建一棵平衡二叉树,数组必须为中序遍历类型,如果数组排好序,那么得到平衡二叉树""" l = 0 r = len(List) - 1 if l > r: return None if l == r: return TreeNode(List[l]) mid = int((l + r) / 2) root = TreeNode(List[mid]) root...
the_stack_v2_python_sparse
剑指offer/39.平衡二叉树.py
hugechuanqi/Algorithms-and-Data-Structures
train
3
20f9cc363784c03357db84d4b69692f4d2cf5e7c
[ "classifier_dao = ClassifierDao(self.db_session())\nclassifiers = classifier_dao.retrieve_all()\nif len(classifiers) == 0:\n classifiers.append(classifier_dao.create(**{'name': 'SVM', 'external_id': 'SVM-' + generate_string(8)}))\nhtml = ''\nhtml += '<h3>Step 1 - Select a classifier</h3>'\nhtml += '<p>Select a c...
<|body_start_0|> classifier_dao = ClassifierDao(self.db_session()) classifiers = classifier_dao.retrieve_all() if len(classifiers) == 0: classifiers.append(classifier_dao.create(**{'name': 'SVM', 'external_id': 'SVM-' + generate_string(8)})) html = '' html += '<h3>Ste...
ClassifiersResource
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClassifiersResource: def get(self): """Returns a pull-down menu containing all supported classifiers. If the list is empty, it will be automatically populated in the database. :return:""" <|body_0|> def post(self): """Handles selection of a classifier type (note that...
stack_v2_sparse_classes_75kplus_train_006965
8,464
no_license
[ { "docstring": "Returns a pull-down menu containing all supported classifiers. If the list is empty, it will be automatically populated in the database. :return:", "name": "get", "signature": "def get(self)" }, { "docstring": "Handles selection of a classifier type (note that usually a PUT reque...
2
stack_v2_sparse_classes_30k_train_047337
Implement the Python class `ClassifiersResource` described below. Class description: Implement the ClassifiersResource class. Method signatures and docstrings: - def get(self): Returns a pull-down menu containing all supported classifiers. If the list is empty, it will be automatically populated in the database. :ret...
Implement the Python class `ClassifiersResource` described below. Class description: Implement the ClassifiersResource class. Method signatures and docstrings: - def get(self): Returns a pull-down menu containing all supported classifiers. If the list is empty, it will be automatically populated in the database. :ret...
2f5d7bd53ba4761af1f67fa7bd16e2c6724feb7d
<|skeleton|> class ClassifiersResource: def get(self): """Returns a pull-down menu containing all supported classifiers. If the list is empty, it will be automatically populated in the database. :return:""" <|body_0|> def post(self): """Handles selection of a classifier type (note that...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ClassifiersResource: def get(self): """Returns a pull-down menu containing all supported classifiers. If the list is empty, it will be automatically populated in the database. :return:""" classifier_dao = ClassifierDao(self.db_session()) classifiers = classifier_dao.retrieve_all() ...
the_stack_v2_python_sparse
brainminer/application/classifier.py
rbrecheisen/brainminer
train
0
e4f140109793b009b24197f24419a027ae261b07
[ "region = Region(name=ids['name'], slug=attrs['slug'], description=attrs['description'])\nif attrs['parent_name']:\n region.parent = Region.objects.get(name=attrs['parent_name'])\nregion.validated_save()\nreturn super().create(diffsync, ids=ids, attrs=attrs)", "region = Region.objects.get(name=self.name)\nfor ...
<|body_start_0|> region = Region(name=ids['name'], slug=attrs['slug'], description=attrs['description']) if attrs['parent_name']: region.parent = Region.objects.get(name=attrs['parent_name']) region.validated_save() return super().create(diffsync, ids=ids, attrs=attrs) <|end_...
Implementation of Region create/update/delete methods for updating local Nautobot data.
RegionLocalModel
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RegionLocalModel: """Implementation of Region create/update/delete methods for updating local Nautobot data.""" def create(cls, diffsync, ids, attrs): """Create a new Region record in local Nautobot. Args: diffsync (NautobotLocal): DiffSync adapter owning this Region ids (dict): Init...
stack_v2_sparse_classes_75kplus_train_006966
19,739
permissive
[ { "docstring": "Create a new Region record in local Nautobot. Args: diffsync (NautobotLocal): DiffSync adapter owning this Region ids (dict): Initial values for this model's _identifiers attrs (dict): Initial values for this model's _attributes", "name": "create", "signature": "def create(cls, diffsync,...
3
stack_v2_sparse_classes_30k_train_032465
Implement the Python class `RegionLocalModel` described below. Class description: Implementation of Region create/update/delete methods for updating local Nautobot data. Method signatures and docstrings: - def create(cls, diffsync, ids, attrs): Create a new Region record in local Nautobot. Args: diffsync (NautobotLoc...
Implement the Python class `RegionLocalModel` described below. Class description: Implementation of Region create/update/delete methods for updating local Nautobot data. Method signatures and docstrings: - def create(cls, diffsync, ids, attrs): Create a new Region record in local Nautobot. Args: diffsync (NautobotLoc...
105a79dea99190669eed2ca03557967ba434f3b6
<|skeleton|> class RegionLocalModel: """Implementation of Region create/update/delete methods for updating local Nautobot data.""" def create(cls, diffsync, ids, attrs): """Create a new Region record in local Nautobot. Args: diffsync (NautobotLocal): DiffSync adapter owning this Region ids (dict): Init...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RegionLocalModel: """Implementation of Region create/update/delete methods for updating local Nautobot data.""" def create(cls, diffsync, ids, attrs): """Create a new Region record in local Nautobot. Args: diffsync (NautobotLocal): DiffSync adapter owning this Region ids (dict): Initial values fo...
the_stack_v2_python_sparse
nautobot_ssot/jobs/examples.py
th3architect/nautobot-plugin-ssot
train
0
77f0007c6270bd4d965ec86a084b174ee57a7809
[ "self.app = app\nsuper().__init__(client_address, RequestHandlerClass)\nConfigClass.__init__(self)\nself.msg_proc = MessageProcessorClass(self)\nself.executor = ClientExecutorClass(self)\nself.connection_buffer = []\nself.pending_messages = []\nself.killed_on_server = False", "for msg in message.encode():\n wi...
<|body_start_0|> self.app = app super().__init__(client_address, RequestHandlerClass) ConfigClass.__init__(self) self.msg_proc = MessageProcessorClass(self) self.executor = ClientExecutorClass(self) self.connection_buffer = [] self.pending_messages = [] se...
Client - класс клиента.
Client
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Client: """Client - класс клиента.""" def __init__(self, app, client_address: tuple, RequestHandlerClass, MessageProcessorClass, ClientExecutorClass): """Метод инициализации. Отрабатывают функции инициализации родителей, создаёт пустой список для открытых соединений, инстанциируются ...
stack_v2_sparse_classes_75kplus_train_006967
11,307
no_license
[ { "docstring": "Метод инициализации. Отрабатывают функции инициализации родителей, создаёт пустой список для открытых соединений, инстанциируются Процессор сообщений и Исполнитель сообщений. Создаются буфера активных соединений и сообщений, ожидающих ответа. :param app: экземпляр класса ClientApp для работы кот...
2
stack_v2_sparse_classes_30k_train_033549
Implement the Python class `Client` described below. Class description: Client - класс клиента. Method signatures and docstrings: - def __init__(self, app, client_address: tuple, RequestHandlerClass, MessageProcessorClass, ClientExecutorClass): Метод инициализации. Отрабатывают функции инициализации родителей, создаё...
Implement the Python class `Client` described below. Class description: Client - класс клиента. Method signatures and docstrings: - def __init__(self, app, client_address: tuple, RequestHandlerClass, MessageProcessorClass, ClientExecutorClass): Метод инициализации. Отрабатывают функции инициализации родителей, создаё...
b92b1c57c7f39bb4d55cab829bd5900a62b61a48
<|skeleton|> class Client: """Client - класс клиента.""" def __init__(self, app, client_address: tuple, RequestHandlerClass, MessageProcessorClass, ClientExecutorClass): """Метод инициализации. Отрабатывают функции инициализации родителей, создаёт пустой список для открытых соединений, инстанциируются ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Client: """Client - класс клиента.""" def __init__(self, app, client_address: tuple, RequestHandlerClass, MessageProcessorClass, ClientExecutorClass): """Метод инициализации. Отрабатывают функции инициализации родителей, создаёт пустой список для открытых соединений, инстанциируются Процессор соо...
the_stack_v2_python_sparse
client/network.py
omelched/client-server-unittest
train
0
500bd1291abc2514a42f87040782b27f7e778456
[ "filter_users = []\ndomain_id = None\nv3, dda = api.keystone.is_default_domain_admin(request)\nif v3 and (not dda):\n domain_id = api.keystone.get_effective_domain_id(request)\nfilters = rest_utils.parse_filters_kwargs(request, self.client_keywords)[0]\nif len(filters) == 0:\n filters = None\nresult = api.key...
<|body_start_0|> filter_users = [] domain_id = None v3, dda = api.keystone.is_default_domain_admin(request) if v3 and (not dda): domain_id = api.keystone.get_effective_domain_id(request) filters = rest_utils.parse_filters_kwargs(request, self.client_keywords)[0] ...
API for keystone users.
Users
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Users: """API for keystone users.""" def get(self, request): """Get a list of users. By default, a listing of all users for the current domain are returned. You may specify GET parameters for project_id, domain_id and group_id to change that listing's context. The listing result is a...
stack_v2_sparse_classes_75kplus_train_006968
34,106
permissive
[ { "docstring": "Get a list of users. By default, a listing of all users for the current domain are returned. You may specify GET parameters for project_id, domain_id and group_id to change that listing's context. The listing result is an object with property \"items\".", "name": "get", "signature": "def...
3
stack_v2_sparse_classes_30k_train_012927
Implement the Python class `Users` described below. Class description: API for keystone users. Method signatures and docstrings: - def get(self, request): Get a list of users. By default, a listing of all users for the current domain are returned. You may specify GET parameters for project_id, domain_id and group_id ...
Implement the Python class `Users` described below. Class description: API for keystone users. Method signatures and docstrings: - def get(self, request): Get a list of users. By default, a listing of all users for the current domain are returned. You may specify GET parameters for project_id, domain_id and group_id ...
9524f1952461c83db485d5d1702c350b158d7ce0
<|skeleton|> class Users: """API for keystone users.""" def get(self, request): """Get a list of users. By default, a listing of all users for the current domain are returned. You may specify GET parameters for project_id, domain_id and group_id to change that listing's context. The listing result is a...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Users: """API for keystone users.""" def get(self, request): """Get a list of users. By default, a listing of all users for the current domain are returned. You may specify GET parameters for project_id, domain_id and group_id to change that listing's context. The listing result is an object with...
the_stack_v2_python_sparse
easystack_dashboard/api/rest/keystone.py
oksbsb/horizon-acc
train
0
88e253e1c2b70ae5ed98a5c1e2d8a96d38490333
[ "self._loop = loop\nself.raw = KytosEventBuffer('raw_event', loop=self._loop)\nself.msg_in = KytosEventBuffer('msg_in_event', loop=self._loop)\nself.msg_out = KytosEventBuffer('msg_out_event', loop=self._loop)\nself.app = KytosEventBuffer('app_event', loop=self._loop)", "LOG.info('Stop signal received by Kytos bu...
<|body_start_0|> self._loop = loop self.raw = KytosEventBuffer('raw_event', loop=self._loop) self.msg_in = KytosEventBuffer('msg_in_event', loop=self._loop) self.msg_out = KytosEventBuffer('msg_out_event', loop=self._loop) self.app = KytosEventBuffer('app_event', loop=self._loop)...
Set of KytosEventBuffer used in Kytos.
KytosBuffers
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KytosBuffers: """Set of KytosEventBuffer used in Kytos.""" def __init__(self, loop=None): """Build four KytosEventBuffers. :attr:`raw`: :class:`~kytos.core.buffers.KytosEventBuffer` with events received from network. :attr:`msg_in`: :class:`~kytos.core.buffers.KytosEventBuffer` with ...
stack_v2_sparse_classes_75kplus_train_006969
5,301
permissive
[ { "docstring": "Build four KytosEventBuffers. :attr:`raw`: :class:`~kytos.core.buffers.KytosEventBuffer` with events received from network. :attr:`msg_in`: :class:`~kytos.core.buffers.KytosEventBuffer` with events to be received. :attr:`msg_out`: :class:`~kytos.core.buffers.KytosEventBuffer` with events to be s...
2
stack_v2_sparse_classes_30k_train_028036
Implement the Python class `KytosBuffers` described below. Class description: Set of KytosEventBuffer used in Kytos. Method signatures and docstrings: - def __init__(self, loop=None): Build four KytosEventBuffers. :attr:`raw`: :class:`~kytos.core.buffers.KytosEventBuffer` with events received from network. :attr:`msg...
Implement the Python class `KytosBuffers` described below. Class description: Set of KytosEventBuffer used in Kytos. Method signatures and docstrings: - def __init__(self, loop=None): Build four KytosEventBuffers. :attr:`raw`: :class:`~kytos.core.buffers.KytosEventBuffer` with events received from network. :attr:`msg...
3b9731c08fe7550a27d159f4e2de71419c9445f1
<|skeleton|> class KytosBuffers: """Set of KytosEventBuffer used in Kytos.""" def __init__(self, loop=None): """Build four KytosEventBuffers. :attr:`raw`: :class:`~kytos.core.buffers.KytosEventBuffer` with events received from network. :attr:`msg_in`: :class:`~kytos.core.buffers.KytosEventBuffer` with ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class KytosBuffers: """Set of KytosEventBuffer used in Kytos.""" def __init__(self, loop=None): """Build four KytosEventBuffers. :attr:`raw`: :class:`~kytos.core.buffers.KytosEventBuffer` with events received from network. :attr:`msg_in`: :class:`~kytos.core.buffers.KytosEventBuffer` with events to be ...
the_stack_v2_python_sparse
kytos/core/buffers.py
kytos/kytos
train
45
6c6c224f032718081559dd0791bc234332f01357
[ "res = []\nfor num1 in nums1:\n for num2 in nums2:\n if num1 == num2:\n nums2.remove(num2)\n res.append(num2)\n break\nreturn res", "nums1.sort()\nnums2.sort()\nres = []\ni, j = (0, 0)\nwhile i < len(nums1) and j < len(nums2):\n a = nums1[i]\n b = nums2[j]\n if ...
<|body_start_0|> res = [] for num1 in nums1: for num2 in nums2: if num1 == num2: nums2.remove(num2) res.append(num2) break return res <|end_body_0|> <|body_start_1|> nums1.sort() nums2.sort()...
描述: 第350题:两个数组的交集: 给定两个数组,编写一个函数来计算它们的交集。 示例1: 输入: nums1 = [1,2,2,1], nums2 = [2,2] 输出: [2,2] 示例2: 输入: nums1 = [4,9,5], nums2 = [9,4,9,8,4] 输出: [4,9]
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """描述: 第350题:两个数组的交集: 给定两个数组,编写一个函数来计算它们的交集。 示例1: 输入: nums1 = [1,2,2,1], nums2 = [2,2] 输出: [2,2] 示例2: 输入: nums1 = [4,9,5], nums2 = [9,4,9,8,4] 输出: [4,9]""" def intersections(self, nums1: list, nums2: list) -> list: """两个无序数组,使用循环遍历""" <|body_0|> def intersectio...
stack_v2_sparse_classes_75kplus_train_006970
1,597
no_license
[ { "docstring": "两个无序数组,使用循环遍历", "name": "intersections", "signature": "def intersections(self, nums1: list, nums2: list) -> list" }, { "docstring": "两个数组,变为有序数组,使用指针", "name": "intersections_pointer", "signature": "def intersections_pointer(self, nums1: list, nums2: list) -> list" } ]
2
stack_v2_sparse_classes_30k_train_030023
Implement the Python class `Solution` described below. Class description: 描述: 第350题:两个数组的交集: 给定两个数组,编写一个函数来计算它们的交集。 示例1: 输入: nums1 = [1,2,2,1], nums2 = [2,2] 输出: [2,2] 示例2: 输入: nums1 = [4,9,5], nums2 = [9,4,9,8,4] 输出: [4,9] Method signatures and docstrings: - def intersections(self, nums1: list, nums2: list) -> list:...
Implement the Python class `Solution` described below. Class description: 描述: 第350题:两个数组的交集: 给定两个数组,编写一个函数来计算它们的交集。 示例1: 输入: nums1 = [1,2,2,1], nums2 = [2,2] 输出: [2,2] 示例2: 输入: nums1 = [4,9,5], nums2 = [9,4,9,8,4] 输出: [4,9] Method signatures and docstrings: - def intersections(self, nums1: list, nums2: list) -> list:...
91d0a4145b066c885272cf1896b5564439f855fa
<|skeleton|> class Solution: """描述: 第350题:两个数组的交集: 给定两个数组,编写一个函数来计算它们的交集。 示例1: 输入: nums1 = [1,2,2,1], nums2 = [2,2] 输出: [2,2] 示例2: 输入: nums1 = [4,9,5], nums2 = [9,4,9,8,4] 输出: [4,9]""" def intersections(self, nums1: list, nums2: list) -> list: """两个无序数组,使用循环遍历""" <|body_0|> def intersectio...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: """描述: 第350题:两个数组的交集: 给定两个数组,编写一个函数来计算它们的交集。 示例1: 输入: nums1 = [1,2,2,1], nums2 = [2,2] 输出: [2,2] 示例2: 输入: nums1 = [4,9,5], nums2 = [9,4,9,8,4] 输出: [4,9]""" def intersections(self, nums1: list, nums2: list) -> list: """两个无序数组,使用循环遍历""" res = [] for num1 in nums1: ...
the_stack_v2_python_sparse
数组系列/leetcode350 数组的交集.py
Deaseyy/algorithm
train
0
64b7c7f0da2ad9311d1e4b7d4250557d71de380b
[ "can_edit_player(player_id)\ntickets = g.db.query(Ticket).filter(Ticket.player_id == player_id, Ticket.used_date == None)\nret = [add_ticket_links(t) for t in tickets]\nreturn ret", "args = request.json\nissuer_id = args.get('issuer_id')\nticket_type = args.get('ticket_type')\ndetails = args.get('details')\nexter...
<|body_start_0|> can_edit_player(player_id) tickets = g.db.query(Ticket).filter(Ticket.player_id == player_id, Ticket.used_date == None) ret = [add_ticket_links(t) for t in tickets] return ret <|end_body_0|> <|body_start_1|> args = request.json issuer_id = args.get('issu...
TicketsEndpoint
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TicketsEndpoint: def get(self, player_id): """Get a list of outstanding tickets for the player""" <|body_0|> def post(self, player_id): """Create a ticket for a player. Only available to services""" <|body_1|> <|end_skeleton|> <|body_start_0|> can_e...
stack_v2_sparse_classes_75kplus_train_006971
4,333
permissive
[ { "docstring": "Get a list of outstanding tickets for the player", "name": "get", "signature": "def get(self, player_id)" }, { "docstring": "Create a ticket for a player. Only available to services", "name": "post", "signature": "def post(self, player_id)" } ]
2
stack_v2_sparse_classes_30k_train_022420
Implement the Python class `TicketsEndpoint` described below. Class description: Implement the TicketsEndpoint class. Method signatures and docstrings: - def get(self, player_id): Get a list of outstanding tickets for the player - def post(self, player_id): Create a ticket for a player. Only available to services
Implement the Python class `TicketsEndpoint` described below. Class description: Implement the TicketsEndpoint class. Method signatures and docstrings: - def get(self, player_id): Get a list of outstanding tickets for the player - def post(self, player_id): Create a ticket for a player. Only available to services <|...
58439d9398006616bbf438da6c5dbe7c32e7a379
<|skeleton|> class TicketsEndpoint: def get(self, player_id): """Get a list of outstanding tickets for the player""" <|body_0|> def post(self, player_id): """Create a ticket for a player. Only available to services""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TicketsEndpoint: def get(self, player_id): """Get a list of outstanding tickets for the player""" can_edit_player(player_id) tickets = g.db.query(Ticket).filter(Ticket.player_id == player_id, Ticket.used_date == None) ret = [add_ticket_links(t) for t in tickets] return ...
the_stack_v2_python_sparse
driftbase/players/tickets/endpoints.py
1939Games/drift-base
train
0
5a55163857061eb0ad0b238870270e86ccdeb487
[ "super().__init__(*args, **kwargs)\nself._all_traces = None\nself._syscall_information_content = None", "if self._all_traces is not all_traces or self._syscall_information_content is None:\n logger.info('Computing document frequencies.')\n self._all_traces = all_traces\n counter = Counter(chain.from_iter...
<|body_start_0|> super().__init__(*args, **kwargs) self._all_traces = None self._syscall_information_content = None <|end_body_0|> <|body_start_1|> if self._all_traces is not all_traces or self._syscall_information_content is None: logger.info('Computing document frequencies...
Scoring method using information content. The final similarity score for two straces is the sum of information content for each matching syscall found in both traces. Syscall information content is computed using the standard definition where P is the probability of finding that syscall in any given strace (from all_tr...
NormalizedInformationContent
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NormalizedInformationContent: """Scoring method using information content. The final similarity score for two straces is the sum of information content for each matching syscall found in both traces. Syscall information content is computed using the standard definition where P is the probability ...
stack_v2_sparse_classes_75kplus_train_006972
34,744
no_license
[ { "docstring": "Init.", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Compute and cache normalized information content.", "name": "_information_content", "signature": "def _information_content(self, all_traces: Set[Strace]) -> Dict[Syscall, flo...
3
stack_v2_sparse_classes_30k_train_026159
Implement the Python class `NormalizedInformationContent` described below. Class description: Scoring method using information content. The final similarity score for two straces is the sum of information content for each matching syscall found in both traces. Syscall information content is computed using the standard...
Implement the Python class `NormalizedInformationContent` described below. Class description: Scoring method using information content. The final similarity score for two straces is the sum of information content for each matching syscall found in both traces. Syscall information content is computed using the standard...
96ca42d65a91b5505316831318863f1963ff7c23
<|skeleton|> class NormalizedInformationContent: """Scoring method using information content. The final similarity score for two straces is the sum of information content for each matching syscall found in both traces. Syscall information content is computed using the standard definition where P is the probability ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NormalizedInformationContent: """Scoring method using information content. The final similarity score for two straces is the sum of information content for each matching syscall found in both traces. Syscall information content is computed using the standard definition where P is the probability of finding th...
the_stack_v2_python_sparse
lib/strace/comparison/scoring.py
config-migration/dozer
train
2
7c8df29753f5f935af959bb9fe12a07eedac8867
[ "LDC_Info.__init__(self)\nself.setTitle(self.name)\nself.status = compat_res[0]\nui = Ui_HarddiskFrame()\nui.setupUi(self.frame)\nself.__fill_frame(ui, info_res, compat_res, diag_res)", "family = self._check_invalid_values(info_res.modelFamily)\nmodel = self._check_invalid_values(info_res.model)\nvendor = self._c...
<|body_start_0|> LDC_Info.__init__(self) self.setTitle(self.name) self.status = compat_res[0] ui = Ui_HarddiskFrame() ui.setupUi(self.frame) self.__fill_frame(ui, info_res, compat_res, diag_res) <|end_body_0|> <|body_start_1|> family = self._check_invalid_values(...
Estende a classe 'LDC_Info'. Classe que define a interface gráfica com os resultados para o teste de HD.
GUIHarddisk
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GUIHarddisk: """Estende a classe 'LDC_Info'. Classe que define a interface gráfica com os resultados para o teste de HD.""" def __init__(self, info_res, compat_res, diag_res): """Construtor Parâmetros: info_res -- lista com os resultados informativos (lista de 'InfoResHarddisks') com...
stack_v2_sparse_classes_75kplus_train_006973
4,408
no_license
[ { "docstring": "Construtor Parâmetros: info_res -- lista com os resultados informativos (lista de 'InfoResHarddisks') compat_res -- Lista com as tuples de resultados de compatibilidade [(True, msg)] diag_res -- Lista com os resultados do diagnóstico (lista de 'DaigResHarddisk')", "name": "__init__", "si...
3
stack_v2_sparse_classes_30k_train_011774
Implement the Python class `GUIHarddisk` described below. Class description: Estende a classe 'LDC_Info'. Classe que define a interface gráfica com os resultados para o teste de HD. Method signatures and docstrings: - def __init__(self, info_res, compat_res, diag_res): Construtor Parâmetros: info_res -- lista com os ...
Implement the Python class `GUIHarddisk` described below. Class description: Estende a classe 'LDC_Info'. Classe que define a interface gráfica com os resultados para o teste de HD. Method signatures and docstrings: - def __init__(self, info_res, compat_res, diag_res): Construtor Parâmetros: info_res -- lista com os ...
bda0c2c8977dd1246339f1f0f4718d29e8795f21
<|skeleton|> class GUIHarddisk: """Estende a classe 'LDC_Info'. Classe que define a interface gráfica com os resultados para o teste de HD.""" def __init__(self, info_res, compat_res, diag_res): """Construtor Parâmetros: info_res -- lista com os resultados informativos (lista de 'InfoResHarddisks') com...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GUIHarddisk: """Estende a classe 'LDC_Info'. Classe que define a interface gráfica com os resultados para o teste de HD.""" def __init__(self, info_res, compat_res, diag_res): """Construtor Parâmetros: info_res -- lista com os resultados informativos (lista de 'InfoResHarddisks') compat_res -- Li...
the_stack_v2_python_sparse
src/libs/harddisk/gui_harddisk.py
adrianomelo/ldc-desktop
train
1
11ea5bf1406ce849564fb5bc9bd21a6086340946
[ "def visit(node, curr):\n if not node:\n return (False, curr)\n l = visit(node.left, curr)\n if l[0]:\n return l\n curr = l[1] + 1\n if curr == k:\n return (True, node.val)\n return visit(node.right, curr)\nreturn visit(root, 0)[1]", "def getAllElements(node):\n if not no...
<|body_start_0|> def visit(node, curr): if not node: return (False, curr) l = visit(node.left, curr) if l[0]: return l curr = l[1] + 1 if curr == k: return (True, node.val) return visit(node.r...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def kthSmallest(self, root, k): """DFS approach Use a counter to count how many nodes we have visited. Once we reach k, we stop. :type root: TreeNode :type k: int :rtype: int""" <|body_0|> def kthSmallest2(self, root, k): """Naive solution Find all elements...
stack_v2_sparse_classes_75kplus_train_006974
1,605
no_license
[ { "docstring": "DFS approach Use a counter to count how many nodes we have visited. Once we reach k, we stop. :type root: TreeNode :type k: int :rtype: int", "name": "kthSmallest", "signature": "def kthSmallest(self, root, k)" }, { "docstring": "Naive solution Find all elements and place them in...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def kthSmallest(self, root, k): DFS approach Use a counter to count how many nodes we have visited. Once we reach k, we stop. :type root: TreeNode :type k: int :rtype: int - def ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def kthSmallest(self, root, k): DFS approach Use a counter to count how many nodes we have visited. Once we reach k, we stop. :type root: TreeNode :type k: int :rtype: int - def ...
c14d8829c95f61ff6691816e8c0de76b9319f389
<|skeleton|> class Solution: def kthSmallest(self, root, k): """DFS approach Use a counter to count how many nodes we have visited. Once we reach k, we stop. :type root: TreeNode :type k: int :rtype: int""" <|body_0|> def kthSmallest2(self, root, k): """Naive solution Find all elements...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def kthSmallest(self, root, k): """DFS approach Use a counter to count how many nodes we have visited. Once we reach k, we stop. :type root: TreeNode :type k: int :rtype: int""" def visit(node, curr): if not node: return (False, curr) l = visit...
the_stack_v2_python_sparse
medium/kth-smallest-element-in-a-bst/solution.py
hsuanhauliu/leetcode-solutions
train
0
a8904f2c319ee5ca143ec31fb7a53c891df28290
[ "result = {'result': 'NG'}\nctrl_obj = CtrlGroup()\ncontent = ctrl_obj.get_group_members(group_id)\nif content:\n result['result'] = 'OK'\n result['content'] = content\nreturn result", "json_data = request.get_json(force=True)\nctrl_obj = CtrlGroup()\nresult = {'result': 'NG', 'error': ''}\ntry:\n ctrl_o...
<|body_start_0|> result = {'result': 'NG'} ctrl_obj = CtrlGroup() content = ctrl_obj.get_group_members(group_id) if content: result['result'] = 'OK' result['content'] = content return result <|end_body_0|> <|body_start_1|> json_data = request.get_...
ApiGroupMembers
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ApiGroupMembers: def get(self, group_id=None): """获取组成员信息 :param group_id: :return:""" <|body_0|> def post(self): """添加组成员 :return:""" <|body_1|> def put(self): """编辑组成员角色 :return:""" <|body_2|> def delete(self, group_id, user_id): ...
stack_v2_sparse_classes_75kplus_train_006975
5,041
no_license
[ { "docstring": "获取组成员信息 :param group_id: :return:", "name": "get", "signature": "def get(self, group_id=None)" }, { "docstring": "添加组成员 :return:", "name": "post", "signature": "def post(self)" }, { "docstring": "编辑组成员角色 :return:", "name": "put", "signature": "def put(self...
4
stack_v2_sparse_classes_30k_train_015150
Implement the Python class `ApiGroupMembers` described below. Class description: Implement the ApiGroupMembers class. Method signatures and docstrings: - def get(self, group_id=None): 获取组成员信息 :param group_id: :return: - def post(self): 添加组成员 :return: - def put(self): 编辑组成员角色 :return: - def delete(self, group_id, user...
Implement the Python class `ApiGroupMembers` described below. Class description: Implement the ApiGroupMembers class. Method signatures and docstrings: - def get(self, group_id=None): 获取组成员信息 :param group_id: :return: - def post(self): 添加组成员 :return: - def put(self): 编辑组成员角色 :return: - def delete(self, group_id, user...
64b31e7bdfcb8a4c95f0a8a607f0bcff576cec11
<|skeleton|> class ApiGroupMembers: def get(self, group_id=None): """获取组成员信息 :param group_id: :return:""" <|body_0|> def post(self): """添加组成员 :return:""" <|body_1|> def put(self): """编辑组成员角色 :return:""" <|body_2|> def delete(self, group_id, user_id): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ApiGroupMembers: def get(self, group_id=None): """获取组成员信息 :param group_id: :return:""" result = {'result': 'NG'} ctrl_obj = CtrlGroup() content = ctrl_obj.get_group_members(group_id) if content: result['result'] = 'OK' result['content'] = content...
the_stack_v2_python_sparse
Source/collaboration_2/app/api_1_0/api_group_members.py
lsn1183/web_project
train
0
9b4d577dd6c701f7244999f91211e5d3bee2e9c1
[ "self.input_k = 3\nself.input_arr = [1, 3, 5, 3, 1, 4]\nself.output = [[0, 2], [4, 5], [1, 3]]\nreturn (self.input_k, self.input_arr, self.output)", "input_k, input_arr, proper_output = self.setUp()\noutput = TaskAssignment.taskAssignment(input_k, input_arr)\nself.assertEqual(output, proper_output)" ]
<|body_start_0|> self.input_k = 3 self.input_arr = [1, 3, 5, 3, 1, 4] self.output = [[0, 2], [4, 5], [1, 3]] return (self.input_k, self.input_arr, self.output) <|end_body_0|> <|body_start_1|> input_k, input_arr, proper_output = self.setUp() output = TaskAssignment.taskAs...
Class with unittests for TaskAssignment.py
test_TaskAssignment
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class test_TaskAssignment: """Class with unittests for TaskAssignment.py""" def setUp(self): """SetUp matrix for tests.""" <|body_0|> def test_ExpectedOutput(self): """Checks if returned output is as expected.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_006976
933
no_license
[ { "docstring": "SetUp matrix for tests.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Checks if returned output is as expected.", "name": "test_ExpectedOutput", "signature": "def test_ExpectedOutput(self)" } ]
2
stack_v2_sparse_classes_30k_val_000372
Implement the Python class `test_TaskAssignment` described below. Class description: Class with unittests for TaskAssignment.py Method signatures and docstrings: - def setUp(self): SetUp matrix for tests. - def test_ExpectedOutput(self): Checks if returned output is as expected.
Implement the Python class `test_TaskAssignment` described below. Class description: Class with unittests for TaskAssignment.py Method signatures and docstrings: - def setUp(self): SetUp matrix for tests. - def test_ExpectedOutput(self): Checks if returned output is as expected. <|skeleton|> class test_TaskAssignmen...
3aa62ad36c3b06b2a3b05f1f8e2a9e21d68b371f
<|skeleton|> class test_TaskAssignment: """Class with unittests for TaskAssignment.py""" def setUp(self): """SetUp matrix for tests.""" <|body_0|> def test_ExpectedOutput(self): """Checks if returned output is as expected.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class test_TaskAssignment: """Class with unittests for TaskAssignment.py""" def setUp(self): """SetUp matrix for tests.""" self.input_k = 3 self.input_arr = [1, 3, 5, 3, 1, 4] self.output = [[0, 2], [4, 5], [1, 3]] return (self.input_k, self.input_arr, self.output) ...
the_stack_v2_python_sparse
AlgoExpert_algorithms/Medium/TaskAssignment/test_TaskAssignment.py
JakubKazimierski/PythonPortfolio
train
9
7faf00a302042df378c3e7d00cdcfe2f21b5ef8a
[ "wxScrolledPanel.__init__(self, parent, wxid, **kw)\nself.SetupScrolling()\nself._pages = {}\nself._current_page = None\nself._create_widget()\nreturn", "self._pages[name] = page\nsw, sh = self.GetSize()\npw, ph = page.GetSize()\nself.SetSize((max(sw, pw), max(sh, ph)))\npage.Show(False)\nreturn page", "if self...
<|body_start_0|> wxScrolledPanel.__init__(self, parent, wxid, **kw) self.SetupScrolling() self._pages = {} self._current_page = None self._create_widget() return <|end_body_0|> <|body_start_1|> self._pages[name] = page sw, sh = self.GetSize() pw, ...
A pager contains a set of pages, but only shows one at a time.
Pager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Pager: """A pager contains a set of pages, but only shows one at a time.""" def __init__(self, parent, wxid, **kw): """Creates a new pager.""" <|body_0|> def add_page(self, name, page): """Adds a page with the specified name.""" <|body_1|> def show_p...
stack_v2_sparse_classes_75kplus_train_006977
3,372
no_license
[ { "docstring": "Creates a new pager.", "name": "__init__", "signature": "def __init__(self, parent, wxid, **kw)" }, { "docstring": "Adds a page with the specified name.", "name": "add_page", "signature": "def add_page(self, name, page)" }, { "docstring": "Shows the page with the ...
6
stack_v2_sparse_classes_30k_train_026965
Implement the Python class `Pager` described below. Class description: A pager contains a set of pages, but only shows one at a time. Method signatures and docstrings: - def __init__(self, parent, wxid, **kw): Creates a new pager. - def add_page(self, name, page): Adds a page with the specified name. - def show_page(...
Implement the Python class `Pager` described below. Class description: A pager contains a set of pages, but only shows one at a time. Method signatures and docstrings: - def __init__(self, parent, wxid, **kw): Creates a new pager. - def add_page(self, name, page): Adds a page with the specified name. - def show_page(...
5466f5858dbd2f1f082fa0d7417b57c8fb068fad
<|skeleton|> class Pager: """A pager contains a set of pages, but only shows one at a time.""" def __init__(self, parent, wxid, **kw): """Creates a new pager.""" <|body_0|> def add_page(self, name, page): """Adds a page with the specified name.""" <|body_1|> def show_p...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Pager: """A pager contains a set of pages, but only shows one at a time.""" def __init__(self, parent, wxid, **kw): """Creates a new pager.""" wxScrolledPanel.__init__(self, parent, wxid, **kw) self.SetupScrolling() self._pages = {} self._current_page = None ...
the_stack_v2_python_sparse
maps/build/EnthoughtBase/enthought/util/wx/pager.py
m-elhussieny/code
train
0
e2bb883992b8042a0b7271f8788c1459edc6c547
[ "if isinstance(module, str):\n import basf2\n self.module = basf2.register_module(module)\nelse:\n self.module = module\nself.standalone = standalone\nself.table_beginning_html = '<table style=\"margin-left: auto; margin-right: auto;\\n border-collapse: separate; borde...
<|body_start_0|> if isinstance(module, str): import basf2 self.module = basf2.register_module(module) else: self.module = module self.standalone = standalone self.table_beginning_html = '<table style="margin-left: auto; margin-right: auto;\n ...
A widget for showing module parameter with their content (not standalone) or with their description (standalone).
ModuleViewer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ModuleViewer: """A widget for showing module parameter with their content (not standalone) or with their description (standalone).""" def __init__(self, module, standalone=True): """Init with a module as a string or a registered one.""" <|body_0|> def get_color_code(self...
stack_v2_sparse_classes_75kplus_train_006978
5,293
no_license
[ { "docstring": "Init with a module as a string or a registered one.", "name": "__init__", "signature": "def __init__(self, module, standalone=True)" }, { "docstring": "Handy function for getting a color based on a parameter: if it has the default value, no color, if not, red color.", "name":...
3
stack_v2_sparse_classes_30k_train_013229
Implement the Python class `ModuleViewer` described below. Class description: A widget for showing module parameter with their content (not standalone) or with their description (standalone). Method signatures and docstrings: - def __init__(self, module, standalone=True): Init with a module as a string or a registere...
Implement the Python class `ModuleViewer` described below. Class description: A widget for showing module parameter with their content (not standalone) or with their description (standalone). Method signatures and docstrings: - def __init__(self, module, standalone=True): Init with a module as a string or a registere...
7d054e84e80eb973b020f74d813b41e96e59928c
<|skeleton|> class ModuleViewer: """A widget for showing module parameter with their content (not standalone) or with their description (standalone).""" def __init__(self, module, standalone=True): """Init with a module as a string or a registered one.""" <|body_0|> def get_color_code(self...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ModuleViewer: """A widget for showing module parameter with their content (not standalone) or with their description (standalone).""" def __init__(self, module, standalone=True): """Init with a module as a string or a registered one.""" if isinstance(module, str): import basf2...
the_stack_v2_python_sparse
hep_ipython_tools/ipython_handler_basf2/viewer.py
hep-ipython-tools/hep-ipython-tools
train
3
27ac0cce22afcade77a5078ee9035ba676d7a408
[ "self.nums = nums\nself.quickSort(nums, 0, len(nums) - 1)\nreturn nums[-k]", "if start < end:\n i, j = (start, end)\n base = nums[i]\n while i < j:\n while i < j and nums[j] >= base:\n j -= 1\n nums[i] = nums[j]\n while i < j and nums[i] <= base:\n i += 1\n ...
<|body_start_0|> self.nums = nums self.quickSort(nums, 0, len(nums) - 1) return nums[-k] <|end_body_0|> <|body_start_1|> if start < end: i, j = (start, end) base = nums[i] while i < j: while i < j and nums[j] >= base: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findKthLargest(self, nums, k): """单纯的快排""" <|body_0|> def quickSort(self, nums, start, end): """快排""" <|body_1|> def findKthLargest1(self, nums, k): """借助快排的思想""" <|body_2|> <|end_skeleton|> <|body_start_0|> self.n...
stack_v2_sparse_classes_75kplus_train_006979
1,646
no_license
[ { "docstring": "单纯的快排", "name": "findKthLargest", "signature": "def findKthLargest(self, nums, k)" }, { "docstring": "快排", "name": "quickSort", "signature": "def quickSort(self, nums, start, end)" }, { "docstring": "借助快排的思想", "name": "findKthLargest1", "signature": "def f...
3
stack_v2_sparse_classes_30k_test_000171
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findKthLargest(self, nums, k): 单纯的快排 - def quickSort(self, nums, start, end): 快排 - def findKthLargest1(self, nums, k): 借助快排的思想
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findKthLargest(self, nums, k): 单纯的快排 - def quickSort(self, nums, start, end): 快排 - def findKthLargest1(self, nums, k): 借助快排的思想 <|skeleton|> class Solution: def findKthL...
a3872425745425f8ca960840120f06de4a8370bb
<|skeleton|> class Solution: def findKthLargest(self, nums, k): """单纯的快排""" <|body_0|> def quickSort(self, nums, start, end): """快排""" <|body_1|> def findKthLargest1(self, nums, k): """借助快排的思想""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def findKthLargest(self, nums, k): """单纯的快排""" self.nums = nums self.quickSort(nums, 0, len(nums) - 1) return nums[-k] def quickSort(self, nums, start, end): """快排""" if start < end: i, j = (start, end) base = nums[i] ...
the_stack_v2_python_sparse
leetcode_数组中的第K个最大元素.py
xiaozuo7/algorithm_python
train
1
a4957e869e3ce074b3e14fc167c0652f5637f5dd
[ "def dfs(node):\n nonlocal ans\n if not node:\n ans += 'None,'\n return\n ans += str(node.val) + ','\n dfs(node.left)\n dfs(node.right)\nans = ''\ndfs(root)\nreturn ans", "def dfs(queue):\n if queue[0] == 'None':\n queue.popleft()\n return None\n node = TreeNode(qu...
<|body_start_0|> def dfs(node): nonlocal ans if not node: ans += 'None,' return ans += str(node.val) + ',' dfs(node.left) dfs(node.right) ans = '' dfs(root) return ans <|end_body_0|> <|body_start...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree.""" <|body_1|> <|end_skeleton|> <|body_start_0|> def dfs(node): nonlocal ans ...
stack_v2_sparse_classes_75kplus_train_006980
949
no_license
[ { "docstring": "Encodes a tree to a single string.", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree.", "name": "deserialize", "signature": "def deserialize(self, data)" } ]
2
stack_v2_sparse_classes_30k_train_025527
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. - def deserialize(self, data): 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): Encodes a tree to a single string. - def deserialize(self, data): Decodes your encoded data to tree. <|skeleton|> class Codec: def serialize(self, root...
03afae2bf1407b8cf81e5e642f6d62ad4238dfe3
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data): """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): """Encodes a tree to a single string.""" def dfs(node): nonlocal ans if not node: ans += 'None,' return ans += str(node.val) + ',' dfs(node.left) dfs(node.right) ...
the_stack_v2_python_sparse
data_structures/trees/04_serialize_deserialize.py
juanjones5/cs-concepts
train
0
a8719afa908a26cc8accfc555c76471683e27105
[ "landmask_data = np.array([[0.2, 0.0, 0.0], [0.7, 0.5, 0.05], [1, 0.95, 0.7]])\nself.landmask = Cube(landmask_data, long_name='test land')\nself.expected_mask = np.array([[False, False, False], [True, True, False], [True, True, True]])", "result = CorrectLand().process(self.landmask)\nself.assertEqual(result.name...
<|body_start_0|> landmask_data = np.array([[0.2, 0.0, 0.0], [0.7, 0.5, 0.05], [1, 0.95, 0.7]]) self.landmask = Cube(landmask_data, long_name='test land') self.expected_mask = np.array([[False, False, False], [True, True, False], [True, True, True]]) <|end_body_0|> <|body_start_1|> resul...
Test the land-sea mask correction plugin.
Test_process
[ "BSD-3-Clause", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test_process: """Test the land-sea mask correction plugin.""" def setUp(self): """setting up paths to test ancillary files""" <|body_0|> def test_landmaskcorrection(self): """Test landmask correction. Note that the name land_binary_mask is enforced to reflect the...
stack_v2_sparse_classes_75kplus_train_006981
2,823
permissive
[ { "docstring": "setting up paths to test ancillary files", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test landmask correction. Note that the name land_binary_mask is enforced to reflect the change that has been made.", "name": "test_landmaskcorrection", "signatur...
2
null
Implement the Python class `Test_process` described below. Class description: Test the land-sea mask correction plugin. Method signatures and docstrings: - def setUp(self): setting up paths to test ancillary files - def test_landmaskcorrection(self): Test landmask correction. Note that the name land_binary_mask is en...
Implement the Python class `Test_process` described below. Class description: Test the land-sea mask correction plugin. Method signatures and docstrings: - def setUp(self): setting up paths to test ancillary files - def test_landmaskcorrection(self): Test landmask correction. Note that the name land_binary_mask is en...
cd2c9019944345df1e703bf8f625db537ad9f559
<|skeleton|> class Test_process: """Test the land-sea mask correction plugin.""" def setUp(self): """setting up paths to test ancillary files""" <|body_0|> def test_landmaskcorrection(self): """Test landmask correction. Note that the name land_binary_mask is enforced to reflect the...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Test_process: """Test the land-sea mask correction plugin.""" def setUp(self): """setting up paths to test ancillary files""" landmask_data = np.array([[0.2, 0.0, 0.0], [0.7, 0.5, 0.05], [1, 0.95, 0.7]]) self.landmask = Cube(landmask_data, long_name='test land') self.expec...
the_stack_v2_python_sparse
improver_tests/generate_ancillaries/test_CorrectLandSeaMask.py
metoppv/improver
train
101
2d64ebc3f3a54ef8ed8de73b67ba412e530b4022
[ "w = SetGraphRange(None)\nyield w\nw.close()", "assert isinstance(widget, QtWidgets.QDialog)\nassert widget.windowTitle() == 'Set Graph Range'\nassert isinstance(widget.txtXmin, QtWidgets.QLineEdit)\nassert isinstance(widget.txtXmin.validator(), QtGui.QDoubleValidator)", "assert widget.xrange() == (0.0, 0.0)\na...
<|body_start_0|> w = SetGraphRange(None) yield w w.close() <|end_body_0|> <|body_start_1|> assert isinstance(widget, QtWidgets.QDialog) assert widget.windowTitle() == 'Set Graph Range' assert isinstance(widget.txtXmin, QtWidgets.QLineEdit) assert isinstance(widge...
Test the SetGraphRange
SetGraphRangeTest
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SetGraphRangeTest: """Test the SetGraphRange""" def widget(self, qapp): """Create/Destroy the SetGraphRange""" <|body_0|> def testDefaults(self, widget): """Test the GUI in its default state""" <|body_1|> def testGoodRanges(self, widget): """...
stack_v2_sparse_classes_75kplus_train_006982
1,599
permissive
[ { "docstring": "Create/Destroy the SetGraphRange", "name": "widget", "signature": "def widget(self, qapp)" }, { "docstring": "Test the GUI in its default state", "name": "testDefaults", "signature": "def testDefaults(self, widget)" }, { "docstring": "Test the X range values set b...
4
stack_v2_sparse_classes_30k_train_038802
Implement the Python class `SetGraphRangeTest` described below. Class description: Test the SetGraphRange Method signatures and docstrings: - def widget(self, qapp): Create/Destroy the SetGraphRange - def testDefaults(self, widget): Test the GUI in its default state - def testGoodRanges(self, widget): Test the X rang...
Implement the Python class `SetGraphRangeTest` described below. Class description: Test the SetGraphRange Method signatures and docstrings: - def widget(self, qapp): Create/Destroy the SetGraphRange - def testDefaults(self, widget): Test the GUI in its default state - def testGoodRanges(self, widget): Test the X rang...
55b1e9f6db58e33729f2a93b7dd1d8bf255b46f7
<|skeleton|> class SetGraphRangeTest: """Test the SetGraphRange""" def widget(self, qapp): """Create/Destroy the SetGraphRange""" <|body_0|> def testDefaults(self, widget): """Test the GUI in its default state""" <|body_1|> def testGoodRanges(self, widget): """...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SetGraphRangeTest: """Test the SetGraphRange""" def widget(self, qapp): """Create/Destroy the SetGraphRange""" w = SetGraphRange(None) yield w w.close() def testDefaults(self, widget): """Test the GUI in its default state""" assert isinstance(widget, Q...
the_stack_v2_python_sparse
src/sas/qtgui/Plotting/UnitTesting/SetGraphRangeTest.py
SasView/sasview
train
48
7484d73e650bb71ebcbb8f7526d7c1b2094c70fd
[ "if self.available():\n if hasattr(self.context, '_v_bumblebee_last_converted'):\n delattr(self.context, '_v_bumblebee_last_converted')\n IBumblebeeDocument(self.context)._handle_update(force=True)\n api.portal.show_message(message=_(u'preview_revived', default=u'Preview revived and will be availabl...
<|body_start_0|> if self.available(): if hasattr(self.context, '_v_bumblebee_last_converted'): delattr(self.context, '_v_bumblebee_last_converted') IBumblebeeDocument(self.context)._handle_update(force=True) api.portal.show_message(message=_(u'preview_revived'...
Sometimes creating a bumblebee preview fails and in rare circumstances this leaves bumblebee in an inconsistent state (GEVER-side). It also may happen that the bumblebee service is down temporarily and the documents can't be registered. These documents won't show a preview until the document is modified and thus trigge...
RevivePreview
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RevivePreview: """Sometimes creating a bumblebee preview fails and in rare circumstances this leaves bumblebee in an inconsistent state (GEVER-side). It also may happen that the bumblebee service is down temporarily and the documents can't be registered. These documents won't show a preview until...
stack_v2_sparse_classes_75kplus_train_006983
2,515
no_license
[ { "docstring": "Handles the reviving process.", "name": "__call__", "signature": "def __call__(self)" }, { "docstring": "Checks if reviving is available for the current object", "name": "available", "signature": "def available(self)" } ]
2
stack_v2_sparse_classes_30k_train_018784
Implement the Python class `RevivePreview` described below. Class description: Sometimes creating a bumblebee preview fails and in rare circumstances this leaves bumblebee in an inconsistent state (GEVER-side). It also may happen that the bumblebee service is down temporarily and the documents can't be registered. The...
Implement the Python class `RevivePreview` described below. Class description: Sometimes creating a bumblebee preview fails and in rare circumstances this leaves bumblebee in an inconsistent state (GEVER-side). It also may happen that the bumblebee service is down temporarily and the documents can't be registered. The...
63b3747793d5b824c56eb3659987bb361d25d8d8
<|skeleton|> class RevivePreview: """Sometimes creating a bumblebee preview fails and in rare circumstances this leaves bumblebee in an inconsistent state (GEVER-side). It also may happen that the bumblebee service is down temporarily and the documents can't be registered. These documents won't show a preview until...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RevivePreview: """Sometimes creating a bumblebee preview fails and in rare circumstances this leaves bumblebee in an inconsistent state (GEVER-side). It also may happen that the bumblebee service is down temporarily and the documents can't be registered. These documents won't show a preview until the document...
the_stack_v2_python_sparse
opengever/bumblebee/browser/revive_preview.py
robertmuehsig/opengever.core
train
0
2225aba7b4808b076397672d8be189c93eb76a08
[ "super(BaseGroupedModelChoiceField, self).__init__(*args, **kwargs)\nself.group_by_field = group_by_field\nif group_label is None:\n self.group_label = lambda group: group\nelse:\n self.group_label = group_label", "if hasattr(self, '_choices'):\n return self._choices\nreturn GroupedModelChoiceIterator(se...
<|body_start_0|> super(BaseGroupedModelChoiceField, self).__init__(*args, **kwargs) self.group_by_field = group_by_field if group_label is None: self.group_label = lambda group: group else: self.group_label = group_label <|end_body_0|> <|body_start_1|> if...
BaseGroupedModelChoiceField
[ "ISC" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseGroupedModelChoiceField: def __init__(self, group_by_field, group_label=None, *args, **kwargs): """group_by_field is the name of a field on the model group_label is a function to return a label for each choice group""" <|body_0|> def _get_choices(self): """Exactl...
stack_v2_sparse_classes_75kplus_train_006984
4,848
permissive
[ { "docstring": "group_by_field is the name of a field on the model group_label is a function to return a label for each choice group", "name": "__init__", "signature": "def __init__(self, group_by_field, group_label=None, *args, **kwargs)" }, { "docstring": "Exactly as per ModelChoiceField excep...
2
stack_v2_sparse_classes_30k_train_033292
Implement the Python class `BaseGroupedModelChoiceField` described below. Class description: Implement the BaseGroupedModelChoiceField class. Method signatures and docstrings: - def __init__(self, group_by_field, group_label=None, *args, **kwargs): group_by_field is the name of a field on the model group_label is a f...
Implement the Python class `BaseGroupedModelChoiceField` described below. Class description: Implement the BaseGroupedModelChoiceField class. Method signatures and docstrings: - def __init__(self, group_by_field, group_label=None, *args, **kwargs): group_by_field is the name of a field on the model group_label is a f...
9fd1a3a8026cfa16e4449d9aa76e5882b24a39e7
<|skeleton|> class BaseGroupedModelChoiceField: def __init__(self, group_by_field, group_label=None, *args, **kwargs): """group_by_field is the name of a field on the model group_label is a function to return a label for each choice group""" <|body_0|> def _get_choices(self): """Exactl...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BaseGroupedModelChoiceField: def __init__(self, group_by_field, group_label=None, *args, **kwargs): """group_by_field is the name of a field on the model group_label is a function to return a label for each choice group""" super(BaseGroupedModelChoiceField, self).__init__(*args, **kwargs) ...
the_stack_v2_python_sparse
adminfilter/fields.py
ljarufe/django-adminfilter
train
2
d3d037f30156363b4a825630c03acb6a86580be1
[ "if not digits:\n return []\nres = []\nself.dfs(digits, 0, '', res)\nreturn res", "if index == len(digits):\n return res.append(s)\nfor ch in MAPPING[digits[index]]:\n self.dfs(digits, index + 1, s + ch, res)" ]
<|body_start_0|> if not digits: return [] res = [] self.dfs(digits, 0, '', res) return res <|end_body_0|> <|body_start_1|> if index == len(digits): return res.append(s) for ch in MAPPING[digits[index]]: self.dfs(digits, index + 1, s + ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def letterCombinations(self, digits): """:type digits: str :rtype: List[str]""" <|body_0|> def dfs(self, digits, index, s, res): """index keeps tracking the current position s is the substring recursively add qualified substring to res""" <|body_1|>...
stack_v2_sparse_classes_75kplus_train_006985
952
no_license
[ { "docstring": ":type digits: str :rtype: List[str]", "name": "letterCombinations", "signature": "def letterCombinations(self, digits)" }, { "docstring": "index keeps tracking the current position s is the substring recursively add qualified substring to res", "name": "dfs", "signature":...
2
stack_v2_sparse_classes_30k_train_033810
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def letterCombinations(self, digits): :type digits: str :rtype: List[str] - def dfs(self, digits, index, s, res): index keeps tracking the current position s is the substring rec...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def letterCombinations(self, digits): :type digits: str :rtype: List[str] - def dfs(self, digits, index, s, res): index keeps tracking the current position s is the substring rec...
90c000c3be70727cde4f7494fbbb1c425bfd3da4
<|skeleton|> class Solution: def letterCombinations(self, digits): """:type digits: str :rtype: List[str]""" <|body_0|> def dfs(self, digits, index, s, res): """index keeps tracking the current position s is the substring recursively add qualified substring to res""" <|body_1|>...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def letterCombinations(self, digits): """:type digits: str :rtype: List[str]""" if not digits: return [] res = [] self.dfs(digits, 0, '', res) return res def dfs(self, digits, index, s, res): """index keeps tracking the current positio...
the_stack_v2_python_sparse
categories/dfs-bfs/17.letter-combinations-of-a-phone-number.py
chenjienan/python-leetcode
train
16
3077088e5e3a6ce5ab65a0e1aaa97dc97975f27a
[ "super(DynamicNet, self).__init__()\nself.input_linear = torch.nn.Linear(D_in, H)\nself.middle_linear = torch.nn.Linear(H, H)\nself.output_linear = torch.nn.Linear(H, D_out)", "h_relu = self.input_linear(x).clamp(min=0)\nfor _ in range(random.randint(0, 3)):\n h_relu = self.middle_linear(h_relu).clamp(min=0)\n...
<|body_start_0|> super(DynamicNet, self).__init__() self.input_linear = torch.nn.Linear(D_in, H) self.middle_linear = torch.nn.Linear(H, H) self.output_linear = torch.nn.Linear(H, D_out) <|end_body_0|> <|body_start_1|> h_relu = self.input_linear(x).clamp(min=0) for _ in ...
DynamicNet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DynamicNet: def __init__(self, D_in, H, D_out): """在构造函数中,我们构造了三个nn.Linear实例,它们将在前向传播时被使用。""" <|body_0|> def forward(self, x): """对于模型的前向传播,我们随机选择0、1、2、3, 并重用了多次计算隐藏层的middle_linear模块。 由于每个前向传播构建一个动态计算图, 我们可以在定义模型的前向传播时使用常规Python控制流运算符,如循环或条件语句。 在这里,我们还看到,在定义计算图形时多次重用...
stack_v2_sparse_classes_75kplus_train_006986
16,194
no_license
[ { "docstring": "在构造函数中,我们构造了三个nn.Linear实例,它们将在前向传播时被使用。", "name": "__init__", "signature": "def __init__(self, D_in, H, D_out)" }, { "docstring": "对于模型的前向传播,我们随机选择0、1、2、3, 并重用了多次计算隐藏层的middle_linear模块。 由于每个前向传播构建一个动态计算图, 我们可以在定义模型的前向传播时使用常规Python控制流运算符,如循环或条件语句。 在这里,我们还看到,在定义计算图形时多次重用同一个模块是完全安全的。...
2
stack_v2_sparse_classes_30k_train_046591
Implement the Python class `DynamicNet` described below. Class description: Implement the DynamicNet class. Method signatures and docstrings: - def __init__(self, D_in, H, D_out): 在构造函数中,我们构造了三个nn.Linear实例,它们将在前向传播时被使用。 - def forward(self, x): 对于模型的前向传播,我们随机选择0、1、2、3, 并重用了多次计算隐藏层的middle_linear模块。 由于每个前向传播构建一个动态计算图, 我...
Implement the Python class `DynamicNet` described below. Class description: Implement the DynamicNet class. Method signatures and docstrings: - def __init__(self, D_in, H, D_out): 在构造函数中,我们构造了三个nn.Linear实例,它们将在前向传播时被使用。 - def forward(self, x): 对于模型的前向传播,我们随机选择0、1、2、3, 并重用了多次计算隐藏层的middle_linear模块。 由于每个前向传播构建一个动态计算图, 我...
272e0b674f2d8ebdca9eea0a35909d2c420212ae
<|skeleton|> class DynamicNet: def __init__(self, D_in, H, D_out): """在构造函数中,我们构造了三个nn.Linear实例,它们将在前向传播时被使用。""" <|body_0|> def forward(self, x): """对于模型的前向传播,我们随机选择0、1、2、3, 并重用了多次计算隐藏层的middle_linear模块。 由于每个前向传播构建一个动态计算图, 我们可以在定义模型的前向传播时使用常规Python控制流运算符,如循环或条件语句。 在这里,我们还看到,在定义计算图形时多次重用...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DynamicNet: def __init__(self, D_in, H, D_out): """在构造函数中,我们构造了三个nn.Linear实例,它们将在前向传播时被使用。""" super(DynamicNet, self).__init__() self.input_linear = torch.nn.Linear(D_in, H) self.middle_linear = torch.nn.Linear(H, H) self.output_linear = torch.nn.Linear(H, D_out) d...
the_stack_v2_python_sparse
PyTorch/quick_start_2/function_try.py
StarkTan/Python
train
0
bcc5efdb6867387de0d158035899c7bc96ef7595
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn IosNetworkUsageRule()", "from .app_list_item import AppListItem\nfrom .app_list_item import AppListItem\nfields: Dict[str, Callable[[Any], None]] = {'cellularDataBlockWhenRoaming': lambda n: setattr(self, 'cellular_data_block_when_roam...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return IosNetworkUsageRule() <|end_body_0|> <|body_start_1|> from .app_list_item import AppListItem from .app_list_item import AppListItem fields: Dict[str, Callable[[Any], None]] = {'c...
Network Usage Rules allow enterprises to specify how managed apps use networks, such as cellular data networks.
IosNetworkUsageRule
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IosNetworkUsageRule: """Network Usage Rules allow enterprises to specify how managed apps use networks, such as cellular data networks.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> IosNetworkUsageRule: """Creates a new instance of the appropriate cl...
stack_v2_sparse_classes_75kplus_train_006987
3,663
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: IosNetworkUsageRule", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator...
3
stack_v2_sparse_classes_30k_train_016375
Implement the Python class `IosNetworkUsageRule` described below. Class description: Network Usage Rules allow enterprises to specify how managed apps use networks, such as cellular data networks. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> IosNetwo...
Implement the Python class `IosNetworkUsageRule` described below. Class description: Network Usage Rules allow enterprises to specify how managed apps use networks, such as cellular data networks. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> IosNetwo...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class IosNetworkUsageRule: """Network Usage Rules allow enterprises to specify how managed apps use networks, such as cellular data networks.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> IosNetworkUsageRule: """Creates a new instance of the appropriate cl...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class IosNetworkUsageRule: """Network Usage Rules allow enterprises to specify how managed apps use networks, such as cellular data networks.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> IosNetworkUsageRule: """Creates a new instance of the appropriate class based on ...
the_stack_v2_python_sparse
msgraph/generated/models/ios_network_usage_rule.py
microsoftgraph/msgraph-sdk-python
train
135
e44e8a8ae5e1925ed2276cccf06dfaec18f2bcd9
[ "try:\n data = json.loads(item)\n title = data.get('title')\n url = f'https://s.weibo.com/weibo?q={url_encode(title)}'\n self.logger.info(f'request url -> {url}')\nexcept Exception as e:\n self.logger.error('redis队列中取出的数据异常,请检查')\n raise e\nreturn Request(url, dont_filter=True, meta={'data': data}...
<|body_start_0|> try: data = json.loads(item) title = data.get('title') url = f'https://s.weibo.com/weibo?q={url_encode(title)}' self.logger.info(f'request url -> {url}') except Exception as e: self.logger.error('redis队列中取出的数据异常,请检查') ...
redis slave 爬虫 微博 weibo.com V3 微博话题搜索
WeiboTopicSearchRedisV3
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WeiboTopicSearchRedisV3: """redis slave 爬虫 微博 weibo.com V3 微博话题搜索""" def make_requests_from_url(self, item): """获取微博热门话题的标题,拼接成url""" <|body_0|> def parse(self, response): """解析本页的数据""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: ...
stack_v2_sparse_classes_75kplus_train_006988
3,790
no_license
[ { "docstring": "获取微博热门话题的标题,拼接成url", "name": "make_requests_from_url", "signature": "def make_requests_from_url(self, item)" }, { "docstring": "解析本页的数据", "name": "parse", "signature": "def parse(self, response)" } ]
2
stack_v2_sparse_classes_30k_train_011986
Implement the Python class `WeiboTopicSearchRedisV3` described below. Class description: redis slave 爬虫 微博 weibo.com V3 微博话题搜索 Method signatures and docstrings: - def make_requests_from_url(self, item): 获取微博热门话题的标题,拼接成url - def parse(self, response): 解析本页的数据
Implement the Python class `WeiboTopicSearchRedisV3` described below. Class description: redis slave 爬虫 微博 weibo.com V3 微博话题搜索 Method signatures and docstrings: - def make_requests_from_url(self, item): 获取微博热门话题的标题,拼接成url - def parse(self, response): 解析本页的数据 <|skeleton|> class WeiboTopicSearchRedisV3: """redis s...
54710ec22bb2404cc8a7c28d457d5a1700ac5bce
<|skeleton|> class WeiboTopicSearchRedisV3: """redis slave 爬虫 微博 weibo.com V3 微博话题搜索""" def make_requests_from_url(self, item): """获取微博热门话题的标题,拼接成url""" <|body_0|> def parse(self, response): """解析本页的数据""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class WeiboTopicSearchRedisV3: """redis slave 爬虫 微博 weibo.com V3 微博话题搜索""" def make_requests_from_url(self, item): """获取微博热门话题的标题,拼接成url""" try: data = json.loads(item) title = data.get('title') url = f'https://s.weibo.com/weibo?q={url_encode(title)}' ...
the_stack_v2_python_sparse
spider_server/spiders/weibo/weiboTopicSearchRedisV3.py
Jasonjk3/jason_scrapy
train
0
11e35923278f9c8df96609d5673a1c23c5fb5bcb
[ "id_ = self.kwargs.get('ride_id')\nself.success_url = '/view-ride/' + str(id_)\nreturn get_object_or_404(Ride, id=id_)", "context = super().get_context_data(**kwargs)\ncontext['update'] = True\nreturn context", "super(RequestRideEdit, self).form_valid(form)\nform_data = self.get_object()\nsend_message(\"Ride to...
<|body_start_0|> id_ = self.kwargs.get('ride_id') self.success_url = '/view-ride/' + str(id_) return get_object_or_404(Ride, id=id_) <|end_body_0|> <|body_start_1|> context = super().get_context_data(**kwargs) context['update'] = True return context <|end_body_1|> <|bod...
Object used to render the request form's update view :param template_name: the name of the template used to render the view :type template_name: string :param form_class: the form that specifies what data needs to be input :type form_class: ModelFormMetaclass :param queryset: the queryable attributes of the form :type ...
RequestRideEdit
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RequestRideEdit: """Object used to render the request form's update view :param template_name: the name of the template used to render the view :type template_name: string :param form_class: the form that specifies what data needs to be input :type form_class: ModelFormMetaclass :param queryset: ...
stack_v2_sparse_classes_75kplus_train_006989
18,890
no_license
[ { "docstring": "gets the ride object associated with the update or 404 if none :return: the ride object or 404 :rtype: Ride", "name": "get_object", "signature": "def get_object(self)" }, { "docstring": "Generates the context data for the html template :return: data to be displayed in the templat...
3
stack_v2_sparse_classes_30k_train_031233
Implement the Python class `RequestRideEdit` described below. Class description: Object used to render the request form's update view :param template_name: the name of the template used to render the view :type template_name: string :param form_class: the form that specifies what data needs to be input :type form_clas...
Implement the Python class `RequestRideEdit` described below. Class description: Object used to render the request form's update view :param template_name: the name of the template used to render the view :type template_name: string :param form_class: the form that specifies what data needs to be input :type form_clas...
520f93891ecea8de8139bdfb913a5cc9cf13f461
<|skeleton|> class RequestRideEdit: """Object used to render the request form's update view :param template_name: the name of the template used to render the view :type template_name: string :param form_class: the form that specifies what data needs to be input :type form_class: ModelFormMetaclass :param queryset: ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RequestRideEdit: """Object used to render the request form's update view :param template_name: the name of the template used to render the view :type template_name: string :param form_class: the form that specifies what data needs to be input :type form_class: ModelFormMetaclass :param queryset: the queryable...
the_stack_v2_python_sparse
website/views.py
CS130-W20/team-A9
train
0
e6ec4b41a2c3f75bf2f8ba82bd0b3c51f62fda2e
[ "schools_urls_xpath = '//*[@id=\"table10\"]/tr/td/table[2]/tr/td/font/a/@href'\nschools_urls = response.xpath(schools_urls_xpath).extract()\nfor url in schools_urls:\n yield scrapy.Request(response.urljoin(url), callback=self.parse_school)", "school_name_xpath = '//*[@id=\"table1\"]/tr[1]/td/table/tr/td[1]/fon...
<|body_start_0|> schools_urls_xpath = '//*[@id="table10"]/tr/td/table[2]/tr/td/font/a/@href' schools_urls = response.xpath(schools_urls_xpath).extract() for url in schools_urls: yield scrapy.Request(response.urljoin(url), callback=self.parse_school) <|end_body_0|> <|body_start_1|> ...
a scrapy spider to crawl lbpsb.qc.ca domain to get school_name street_address city province postal_code phone_number school_url school_grades school_language school_type school_board response_url for each school found
MontrealLbpsbSpider
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MontrealLbpsbSpider: """a scrapy spider to crawl lbpsb.qc.ca domain to get school_name street_address city province postal_code phone_number school_url school_grades school_language school_type school_board response_url for each school found""" def parse(self, response): """get all s...
stack_v2_sparse_classes_75kplus_train_006990
3,493
no_license
[ { "docstring": "get all schools urls then yield a Request for each one.", "name": "parse", "signature": "def parse(self, response)" }, { "docstring": "get required information for each school this method is called once for each school", "name": "parse_school", "signature": "def parse_sch...
2
stack_v2_sparse_classes_30k_train_016256
Implement the Python class `MontrealLbpsbSpider` described below. Class description: a scrapy spider to crawl lbpsb.qc.ca domain to get school_name street_address city province postal_code phone_number school_url school_grades school_language school_type school_board response_url for each school found Method signatur...
Implement the Python class `MontrealLbpsbSpider` described below. Class description: a scrapy spider to crawl lbpsb.qc.ca domain to get school_name street_address city province postal_code phone_number school_url school_grades school_language school_type school_board response_url for each school found Method signatur...
350264cf6da323692c2838d8cb235ef61085851b
<|skeleton|> class MontrealLbpsbSpider: """a scrapy spider to crawl lbpsb.qc.ca domain to get school_name street_address city province postal_code phone_number school_url school_grades school_language school_type school_board response_url for each school found""" def parse(self, response): """get all s...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MontrealLbpsbSpider: """a scrapy spider to crawl lbpsb.qc.ca domain to get school_name street_address city province postal_code phone_number school_url school_grades school_language school_type school_board response_url for each school found""" def parse(self, response): """get all schools urls t...
the_stack_v2_python_sparse
school_scraping/spiders/montreal_lbpsb.py
ramadanmostafa/canada_school_scraping
train
0
e72260d4ff1b10aa5a0194659c977364ad6e506f
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "conte...
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
message EmailRequest{ string email = 1; string username = 2; } ////////////////////////////////////////// ////////////////////////////////////////// ////////////////////////////////////////// ////////////////////////////////////////// ////////////////////////////////////////// //////////////////////////////////////////
SignInServicer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SignInServicer: """message EmailRequest{ string email = 1; string username = 2; } ////////////////////////////////////////// ////////////////////////////////////////// ////////////////////////////////////////// ////////////////////////////////////////// ////////////////////////////////////////// ...
stack_v2_sparse_classes_75kplus_train_006991
6,288
no_license
[ { "docstring": "rpc CreateUser (EmailRequest) returns (Success); rpc VerificarPassword(VerificarRequest) returns (VerificarResponse);", "name": "GetUserByName", "signature": "def GetUserByName(self, request, context)" }, { "docstring": "Missing associated documentation comment in .proto file.", ...
3
null
Implement the Python class `SignInServicer` described below. Class description: message EmailRequest{ string email = 1; string username = 2; } ////////////////////////////////////////// ////////////////////////////////////////// ////////////////////////////////////////// ////////////////////////////////////////// ////...
Implement the Python class `SignInServicer` described below. Class description: message EmailRequest{ string email = 1; string username = 2; } ////////////////////////////////////////// ////////////////////////////////////////// ////////////////////////////////////////// ////////////////////////////////////////// ////...
4f51e5c6ed34c31053d9183da152eac843e7ea96
<|skeleton|> class SignInServicer: """message EmailRequest{ string email = 1; string username = 2; } ////////////////////////////////////////// ////////////////////////////////////////// ////////////////////////////////////////// ////////////////////////////////////////// ////////////////////////////////////////// ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SignInServicer: """message EmailRequest{ string email = 1; string username = 2; } ////////////////////////////////////////// ////////////////////////////////////////// ////////////////////////////////////////// ////////////////////////////////////////// ////////////////////////////////////////// /////////////...
the_stack_v2_python_sparse
app/stuff/signin/signin_pb2_grpc.py
JotaFilip/cn-g
train
1
43debd58cd0ea6ce7012740db86698eda79cfb55
[ "if self.domain and self.suffix:\n return self.domain + '.' + self.suffix\nreturn ''", "if self.domain and self.suffix:\n return '.'.join((i for i in self if i))\nreturn ''", "if not (self.suffix or self.subdomain) and IP_RE.match(self.domain):\n return self.domain\nreturn ''" ]
<|body_start_0|> if self.domain and self.suffix: return self.domain + '.' + self.suffix return '' <|end_body_0|> <|body_start_1|> if self.domain and self.suffix: return '.'.join((i for i in self if i)) return '' <|end_body_1|> <|body_start_2|> if not (se...
namedtuple of a URL's subdomain, domain, and suffix.
ExtractResult
[ "GPL-3.0-only", "Python-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExtractResult: """namedtuple of a URL's subdomain, domain, and suffix.""" def registered_domain(self): """Joins the domain and suffix fields with a dot, if they're both set. >>> extract('http://forums.bbc.co.uk').registered_domain 'bbc.co.uk' >>> extract('http://localhost:8080').regi...
stack_v2_sparse_classes_75kplus_train_006992
7,568
permissive
[ { "docstring": "Joins the domain and suffix fields with a dot, if they're both set. >>> extract('http://forums.bbc.co.uk').registered_domain 'bbc.co.uk' >>> extract('http://localhost:8080').registered_domain ''", "name": "registered_domain", "signature": "def registered_domain(self)" }, { "docst...
3
stack_v2_sparse_classes_30k_train_037040
Implement the Python class `ExtractResult` described below. Class description: namedtuple of a URL's subdomain, domain, and suffix. Method signatures and docstrings: - def registered_domain(self): Joins the domain and suffix fields with a dot, if they're both set. >>> extract('http://forums.bbc.co.uk').registered_dom...
Implement the Python class `ExtractResult` described below. Class description: namedtuple of a URL's subdomain, domain, and suffix. Method signatures and docstrings: - def registered_domain(self): Joins the domain and suffix fields with a dot, if they're both set. >>> extract('http://forums.bbc.co.uk').registered_dom...
b6edb06fc4e53a90c756459d7c03f8b33692b42b
<|skeleton|> class ExtractResult: """namedtuple of a URL's subdomain, domain, and suffix.""" def registered_domain(self): """Joins the domain and suffix fields with a dot, if they're both set. >>> extract('http://forums.bbc.co.uk').registered_domain 'bbc.co.uk' >>> extract('http://localhost:8080').regi...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ExtractResult: """namedtuple of a URL's subdomain, domain, and suffix.""" def registered_domain(self): """Joins the domain and suffix fields with a dot, if they're both set. >>> extract('http://forums.bbc.co.uk').registered_domain 'bbc.co.uk' >>> extract('http://localhost:8080').registered_domain...
the_stack_v2_python_sparse
python/app/thirdparty/oneforall/common/tldextract.py
taomujian/linbing
train
545
4d6db3bf1f72c3dddd6d43addb45350ffefe473c
[ "if not email:\n raise ValueError('Users must have an email address')\nuser = self.model(email=self.normalize_email(email), last_name=last_name, first_name=first_name)\nuser.set_password(password)\nuser.save(using=self._db)\nreturn user", "user = self.create_user(email, password=password)\nuser.is_admin = True...
<|body_start_0|> if not email: raise ValueError('Users must have an email address') user = self.model(email=self.normalize_email(email), last_name=last_name, first_name=first_name) user.set_password(password) user.save(using=self._db) return user <|end_body_0|> <|bod...
CustomUserManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CustomUserManager: def create_user(self, email, password=None, confirm_password=None, last_name=None, first_name=None): """Creates and saves a User with the given email, and password.""" <|body_0|> def create_superuser(self, email, password=None): """Creates and save...
stack_v2_sparse_classes_75kplus_train_006993
10,051
no_license
[ { "docstring": "Creates and saves a User with the given email, and password.", "name": "create_user", "signature": "def create_user(self, email, password=None, confirm_password=None, last_name=None, first_name=None)" }, { "docstring": "Creates and saves a superuser with the given email, and pass...
2
stack_v2_sparse_classes_30k_train_033351
Implement the Python class `CustomUserManager` described below. Class description: Implement the CustomUserManager class. Method signatures and docstrings: - def create_user(self, email, password=None, confirm_password=None, last_name=None, first_name=None): Creates and saves a User with the given email, and password...
Implement the Python class `CustomUserManager` described below. Class description: Implement the CustomUserManager class. Method signatures and docstrings: - def create_user(self, email, password=None, confirm_password=None, last_name=None, first_name=None): Creates and saves a User with the given email, and password...
e9c8e84f0f4ccd60f9d7806269609c2362a72bd7
<|skeleton|> class CustomUserManager: def create_user(self, email, password=None, confirm_password=None, last_name=None, first_name=None): """Creates and saves a User with the given email, and password.""" <|body_0|> def create_superuser(self, email, password=None): """Creates and save...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CustomUserManager: def create_user(self, email, password=None, confirm_password=None, last_name=None, first_name=None): """Creates and saves a User with the given email, and password.""" if not email: raise ValueError('Users must have an email address') user = self.model(em...
the_stack_v2_python_sparse
management/models.py
fbenavente/jackies
train
0
54967b4fb9fff0ce9ae44d636414f5bb23fc4cdd
[ "nums.sort()\nif nums[0] != 0:\n return 0\nfor i in range(len(nums) - 1):\n if nums[i + 1] == nums[i] + 1:\n continue\n else:\n return nums[i] + 1\nreturn nums[-1] + 1", "sum = 0\nfor i in nums:\n sum += i\nreturn int(len(nums) * (len(nums) + 1) / 2 - sum)" ]
<|body_start_0|> nums.sort() if nums[0] != 0: return 0 for i in range(len(nums) - 1): if nums[i + 1] == nums[i] + 1: continue else: return nums[i] + 1 return nums[-1] + 1 <|end_body_0|> <|body_start_1|> sum = 0 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def missingNumber(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def missingNumber1(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> nums.sort() if nums[0] != 0: ...
stack_v2_sparse_classes_75kplus_train_006994
735
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "missingNumber", "signature": "def missingNumber(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "missingNumber1", "signature": "def missingNumber1(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_017609
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def missingNumber(self, nums): :type nums: List[int] :rtype: int - def missingNumber1(self, nums): :type nums: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def missingNumber(self, nums): :type nums: List[int] :rtype: int - def missingNumber1(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution: def missin...
96dd15210bcf9efe1f8cf31ce0566a7eabb3e221
<|skeleton|> class Solution: def missingNumber(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def missingNumber1(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def missingNumber(self, nums): """:type nums: List[int] :rtype: int""" nums.sort() if nums[0] != 0: return 0 for i in range(len(nums) - 1): if nums[i + 1] == nums[i] + 1: continue else: return nums[i]...
the_stack_v2_python_sparse
Python/MissingNumber.py
abhi-verma/LeetCode-Algo
train
0
f7c95e965fc627fbab8c941ebb1f08aeb546d663
[ "l3 = ListNode(0)\nresult = l3\nwhile l1 and l2:\n if l1.val >= l2.val:\n l3.next = l2\n l2 = l2.next\n else:\n l3.next = l1\n l1 = l1.next\n l3 = l3.next\nl3.next = l1 if not l2 else l2\nreturn result.next", "s = []\nwhile head:\n s.append(head.val)\n head = head.next\n...
<|body_start_0|> l3 = ListNode(0) result = l3 while l1 and l2: if l1.val >= l2.val: l3.next = l2 l2 = l2.next else: l3.next = l1 l1 = l1.next l3 = l3.next l3.next = l1 if not l2 else l2 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode: """同时遍历两个链表,小的值直接链向新创建的链表,直到短的 一个遍历完之后,将另一个链表剩余的元素直接链向新链表 :param l1: :param l2: :return:""" <|body_0|> def showNode(self, head: ListNode) -> list: """打印节点元素 :param head: :return:""" <|...
stack_v2_sparse_classes_75kplus_train_006995
1,698
no_license
[ { "docstring": "同时遍历两个链表,小的值直接链向新创建的链表,直到短的 一个遍历完之后,将另一个链表剩余的元素直接链向新链表 :param l1: :param l2: :return:", "name": "mergeTwoLists", "signature": "def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode" }, { "docstring": "打印节点元素 :param head: :return:", "name": "showNode", "signature...
2
stack_v2_sparse_classes_30k_train_040164
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode: 同时遍历两个链表,小的值直接链向新创建的链表,直到短的 一个遍历完之后,将另一个链表剩余的元素直接链向新链表 :param l1: :param l2: :return: - def showNode(self, head: ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode: 同时遍历两个链表,小的值直接链向新创建的链表,直到短的 一个遍历完之后,将另一个链表剩余的元素直接链向新链表 :param l1: :param l2: :return: - def showNode(self, head: ...
fa45cd44c3d4e7b0205833efcdc708d1638cbbe4
<|skeleton|> class Solution: def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode: """同时遍历两个链表,小的值直接链向新创建的链表,直到短的 一个遍历完之后,将另一个链表剩余的元素直接链向新链表 :param l1: :param l2: :return:""" <|body_0|> def showNode(self, head: ListNode) -> list: """打印节点元素 :param head: :return:""" <|...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode: """同时遍历两个链表,小的值直接链向新创建的链表,直到短的 一个遍历完之后,将另一个链表剩余的元素直接链向新链表 :param l1: :param l2: :return:""" l3 = ListNode(0) result = l3 while l1 and l2: if l1.val >= l2.val: l3.next = l2 ...
the_stack_v2_python_sparse
Python/t21.py
g-lyc/LeetCode
train
15
6792073338a25b1ea2e6ffa23a94433b6d23468b
[ "if not isinstance(gate, Gate):\n raise TypeError('Expected gate object, got %s.' % type(gate))\nif not is_integer(num_controls):\n raise TypeError('Expected integer for num_controls, got %s.' % type(num_controls))\nif num_controls < 1:\n raise ValueError('Expected positive integer for num_controls, got %d...
<|body_start_0|> if not isinstance(gate, Gate): raise TypeError('Expected gate object, got %s.' % type(gate)) if not is_integer(num_controls): raise TypeError('Expected integer for num_controls, got %s.' % type(num_controls)) if num_controls < 1: raise ValueEr...
ControlledGate
[ "LicenseRef-scancode-unknown-license-reference", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ControlledGate: def __init__(self, gate: Gate, num_controls: int=1, radixes: Sequence[int]=[]) -> None: """Construct a ControlledGate.""" <|body_0|> def get_unitary(self, params: Sequence[float]=[]) -> UnitaryMatrix: """Returns the unitary for this gate, see Unitary ...
stack_v2_sparse_classes_75kplus_train_006996
3,456
permissive
[ { "docstring": "Construct a ControlledGate.", "name": "__init__", "signature": "def __init__(self, gate: Gate, num_controls: int=1, radixes: Sequence[int]=[]) -> None" }, { "docstring": "Returns the unitary for this gate, see Unitary for more info.", "name": "get_unitary", "signature": "...
4
null
Implement the Python class `ControlledGate` described below. Class description: Implement the ControlledGate class. Method signatures and docstrings: - def __init__(self, gate: Gate, num_controls: int=1, radixes: Sequence[int]=[]) -> None: Construct a ControlledGate. - def get_unitary(self, params: Sequence[float]=[]...
Implement the Python class `ControlledGate` described below. Class description: Implement the ControlledGate class. Method signatures and docstrings: - def __init__(self, gate: Gate, num_controls: int=1, radixes: Sequence[int]=[]) -> None: Construct a ControlledGate. - def get_unitary(self, params: Sequence[float]=[]...
3083218c2f4e3c3ce4ba027d12caa30c384d7665
<|skeleton|> class ControlledGate: def __init__(self, gate: Gate, num_controls: int=1, radixes: Sequence[int]=[]) -> None: """Construct a ControlledGate.""" <|body_0|> def get_unitary(self, params: Sequence[float]=[]) -> UnitaryMatrix: """Returns the unitary for this gate, see Unitary ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ControlledGate: def __init__(self, gate: Gate, num_controls: int=1, radixes: Sequence[int]=[]) -> None: """Construct a ControlledGate.""" if not isinstance(gate, Gate): raise TypeError('Expected gate object, got %s.' % type(gate)) if not is_integer(num_controls): ...
the_stack_v2_python_sparse
bqskit/ir/gates/composed/controlled.py
mtreinish/bqskit
train
0
795ca010cda82239cf93bc05c73cb2d1f9d9ec6a
[ "req = ReqJson()\nparse = reqparse.RequestParser()\nparse.add_argument('category', type=str, required=True, loction='json', help='请输入短信类型')\nparse.add_argument('phone', type=str, required=True, location='json', help='请输入手机号码')\nfront_data = parse.add_argument()\nphone = front_data.get('phone')\ncategory = front_dat...
<|body_start_0|> req = ReqJson() parse = reqparse.RequestParser() parse.add_argument('category', type=str, required=True, loction='json', help='请输入短信类型') parse.add_argument('phone', type=str, required=True, location='json', help='请输入手机号码') front_data = parse.add_argument() ...
Sms
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Sms: def get(self): """获取手机验证码""" <|body_0|> def post(self): """验证手机验证码""" <|body_1|> <|end_skeleton|> <|body_start_0|> req = ReqJson() parse = reqparse.RequestParser() parse.add_argument('category', type=str, required=True, loction=...
stack_v2_sparse_classes_75kplus_train_006997
3,761
permissive
[ { "docstring": "获取手机验证码", "name": "get", "signature": "def get(self)" }, { "docstring": "验证手机验证码", "name": "post", "signature": "def post(self)" } ]
2
null
Implement the Python class `Sms` described below. Class description: Implement the Sms class. Method signatures and docstrings: - def get(self): 获取手机验证码 - def post(self): 验证手机验证码
Implement the Python class `Sms` described below. Class description: Implement the Sms class. Method signatures and docstrings: - def get(self): 获取手机验证码 - def post(self): 验证手机验证码 <|skeleton|> class Sms: def get(self): """获取手机验证码""" <|body_0|> def post(self): """验证手机验证码""" <|...
761ecbe1f2dca66babff5f0b9d9636ab9c5e6ebc
<|skeleton|> class Sms: def get(self): """获取手机验证码""" <|body_0|> def post(self): """验证手机验证码""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Sms: def get(self): """获取手机验证码""" req = ReqJson() parse = reqparse.RequestParser() parse.add_argument('category', type=str, required=True, loction='json', help='请输入短信类型') parse.add_argument('phone', type=str, required=True, location='json', help='请输入手机号码') front...
the_stack_v2_python_sparse
webAPi/routes/sms.py
BennyJane/web-common-service
train
2
215f4a3ac95afd0ecb2f2c6bfa2651dc17181a3d
[ "self.num_imus = num_imus\nself.axis = axis\nself.values = []\nfor i in range(1, num_imus):\n rospy.Subscriber('imu_data{}'.format(i), Imu, self.imu_callback)", "A = data.linear_acceleration\nif self.axis == 'x':\n value = A.x\nelif self.axis == 'y':\n value = A.y\nelif self.axis == 'z':\n value = A.z...
<|body_start_0|> self.num_imus = num_imus self.axis = axis self.values = [] for i in range(1, num_imus): rospy.Subscriber('imu_data{}'.format(i), Imu, self.imu_callback) <|end_body_0|> <|body_start_1|> A = data.linear_acceleration if self.axis == 'x': ...
ImuListener
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImuListener: def __init__(self, num_imus, axis): """ImuListener class for registering when IMUs are activated; that is, the IMU is moved enough. Arguments ---------- `num_imus`: `int` Amount of IMUs on the robot `acc_thresh`: `float` The default threshold used to determine the minimal di...
stack_v2_sparse_classes_75kplus_train_006998
1,858
no_license
[ { "docstring": "ImuListener class for registering when IMUs are activated; that is, the IMU is moved enough. Arguments ---------- `num_imus`: `int` Amount of IMUs on the robot `acc_thresh`: `float` The default threshold used to determine the minimal difference between two consecutive IMU readings to constitute ...
2
null
Implement the Python class `ImuListener` described below. Class description: Implement the ImuListener class. Method signatures and docstrings: - def __init__(self, num_imus, axis): ImuListener class for registering when IMUs are activated; that is, the IMU is moved enough. Arguments ---------- `num_imus`: `int` Amou...
Implement the Python class `ImuListener` described below. Class description: Implement the ImuListener class. Method signatures and docstrings: - def __init__(self, num_imus, axis): ImuListener class for registering when IMUs are activated; that is, the IMU is moved enough. Arguments ---------- `num_imus`: `int` Amou...
ef4c115fc42de4c992281bc800064abf0f494b72
<|skeleton|> class ImuListener: def __init__(self, num_imus, axis): """ImuListener class for registering when IMUs are activated; that is, the IMU is moved enough. Arguments ---------- `num_imus`: `int` Amount of IMUs on the robot `acc_thresh`: `float` The default threshold used to determine the minimal di...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ImuListener: def __init__(self, num_imus, axis): """ImuListener class for registering when IMUs are activated; that is, the IMU is moved enough. Arguments ---------- `num_imus`: `int` Amount of IMUs on the robot `acc_thresh`: `float` The default threshold used to determine the minimal difference betwe...
the_stack_v2_python_sparse
scripts/utils/record_mean_imu_norms.py
HIRO-group/ros_robotic_skin
train
3
605636c2fbe69c314eae40fc0b8760ce277672e3
[ "if isinstance(name, cls):\n return name\nname = name.upper()\nreturn cls[name]", "if self == self.TAD:\n return tad.Tad\nelif self == self.CNV:\n return cnv.CNV\nelif self == self.BED:\n return bed.Bed\nelif self == self.GENE:\n return gene.Gene\nelse:\n raise TypeError(f'Type {self} has no ass...
<|body_start_0|> if isinstance(name, cls): return name name = name.upper() return cls[name] <|end_body_0|> <|body_start_1|> if self == self.TAD: return tad.Tad elif self == self.CNV: return cnv.CNV elif self == self.BED: re...
BedClass
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BedClass: def from_str(cls, name): """Get enum type from a string as a case-insensitive operation.""" <|body_0|> def get_class(self): """Get the associated class for the given value.""" <|body_1|> <|end_skeleton|> <|body_start_0|> if isinstance(name...
stack_v2_sparse_classes_75kplus_train_006999
800
permissive
[ { "docstring": "Get enum type from a string as a case-insensitive operation.", "name": "from_str", "signature": "def from_str(cls, name)" }, { "docstring": "Get the associated class for the given value.", "name": "get_class", "signature": "def get_class(self)" } ]
2
stack_v2_sparse_classes_30k_train_019865
Implement the Python class `BedClass` described below. Class description: Implement the BedClass class. Method signatures and docstrings: - def from_str(cls, name): Get enum type from a string as a case-insensitive operation. - def get_class(self): Get the associated class for the given value.
Implement the Python class `BedClass` described below. Class description: Implement the BedClass class. Method signatures and docstrings: - def from_str(cls, name): Get enum type from a string as a case-insensitive operation. - def get_class(self): Get the associated class for the given value. <|skeleton|> class Bed...
6caf4711d63f54b5b3648b9afa3fc8283a40978d
<|skeleton|> class BedClass: def from_str(cls, name): """Get enum type from a string as a case-insensitive operation.""" <|body_0|> def get_class(self): """Get the associated class for the given value.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BedClass: def from_str(cls, name): """Get enum type from a string as a case-insensitive operation.""" if isinstance(name, cls): return name name = name.upper() return cls[name] def get_class(self): """Get the associated class for the given value.""" ...
the_stack_v2_python_sparse
tadacnv/lib/bed_class.py
jakob-he/TADA
train
10