blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
6.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
438
7.52k
id
stringlengths
40
40
length_bytes
int64
506
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.25k
prompted_full_text
stringlengths
645
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.34k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
302
7.33k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
a94619b76fd9dd0dc0e3afa02ececd22d1290059
[ "if data is None:\n raise ValidationError('No data was provided')\nreturn Performance(**data)", "if data['start_datetime'].date() > data['end_datetime'].date():\n raise ValidationError('Start date must be before end date.')\nelif data['start_datetime'].date() == data['end_datetime'].date() and data['start_d...
<|body_start_0|> if data is None: raise ValidationError('No data was provided') return Performance(**data) <|end_body_0|> <|body_start_1|> if data['start_datetime'].date() > data['end_datetime'].date(): raise ValidationError('Start date must be before end date.') ...
Class to serialize and deserialize Performance objects.
PerformanceSchema
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PerformanceSchema: """Class to serialize and deserialize Performance objects.""" def make_object(self, data, **kwargs): """Return a performance object from the validated data.""" <|body_0|> def validate_datetimes(self, data, **kwargs): """Raise a ValidationError ...
stack_v2_sparse_classes_36k_train_009200
2,121
no_license
[ { "docstring": "Return a performance object from the validated data.", "name": "make_object", "signature": "def make_object(self, data, **kwargs)" }, { "docstring": "Raise a ValidationError if the start_datetime is after the end_datetime.", "name": "validate_datetimes", "signature": "def...
2
stack_v2_sparse_classes_30k_train_001534
Implement the Python class `PerformanceSchema` described below. Class description: Class to serialize and deserialize Performance objects. Method signatures and docstrings: - def make_object(self, data, **kwargs): Return a performance object from the validated data. - def validate_datetimes(self, data, **kwargs): Rai...
Implement the Python class `PerformanceSchema` described below. Class description: Class to serialize and deserialize Performance objects. Method signatures and docstrings: - def make_object(self, data, **kwargs): Return a performance object from the validated data. - def validate_datetimes(self, data, **kwargs): Rai...
d5ae552d383f5f971e29a38055c518fc68172f32
<|skeleton|> class PerformanceSchema: """Class to serialize and deserialize Performance objects.""" def make_object(self, data, **kwargs): """Return a performance object from the validated data.""" <|body_0|> def validate_datetimes(self, data, **kwargs): """Raise a ValidationError ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PerformanceSchema: """Class to serialize and deserialize Performance objects.""" def make_object(self, data, **kwargs): """Return a performance object from the validated data.""" if data is None: raise ValidationError('No data was provided') return Performance(**data) ...
the_stack_v2_python_sparse
server/app/api/schemas/performance.py
EricMontague/MailChimp-Newsletter-Project
train
0
d0d9b172170d949fd68ececae325326edbedb092
[ "if not root:\n return root\nleftmost = root\nwhile leftmost.left:\n head = leftmost\n while head:\n head.left.next = head.right\n if head.next:\n head.right.next = head.next.left\n head = head.next\n leftmost = leftmost.left\nreturn root", "if not root:\n return roo...
<|body_start_0|> if not root: return root leftmost = root while leftmost.left: head = leftmost while head: head.left.next = head.right if head.next: head.right.next = head.next.left head = hea...
PointerTrees
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PointerTrees: def connect(self, root: 'Node') -> 'Node': """Approach: Next pointers O(1) space Time Complexity: O(N) Space Complexity: O(1) :param root: :return:""" <|body_0|> def connect_(self, root: 'Node') -> 'Node': """Approach: Next pointers stack Time Complexit...
stack_v2_sparse_classes_36k_train_009201
1,557
no_license
[ { "docstring": "Approach: Next pointers O(1) space Time Complexity: O(N) Space Complexity: O(1) :param root: :return:", "name": "connect", "signature": "def connect(self, root: 'Node') -> 'Node'" }, { "docstring": "Approach: Next pointers stack Time Complexity: O(N) Space Complexity: O(N) :param...
2
stack_v2_sparse_classes_30k_train_018526
Implement the Python class `PointerTrees` described below. Class description: Implement the PointerTrees class. Method signatures and docstrings: - def connect(self, root: 'Node') -> 'Node': Approach: Next pointers O(1) space Time Complexity: O(N) Space Complexity: O(1) :param root: :return: - def connect_(self, root...
Implement the Python class `PointerTrees` described below. Class description: Implement the PointerTrees class. Method signatures and docstrings: - def connect(self, root: 'Node') -> 'Node': Approach: Next pointers O(1) space Time Complexity: O(N) Space Complexity: O(1) :param root: :return: - def connect_(self, root...
65cc78b5afa0db064f9fe8f06597e3e120f7363d
<|skeleton|> class PointerTrees: def connect(self, root: 'Node') -> 'Node': """Approach: Next pointers O(1) space Time Complexity: O(N) Space Complexity: O(1) :param root: :return:""" <|body_0|> def connect_(self, root: 'Node') -> 'Node': """Approach: Next pointers stack Time Complexit...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PointerTrees: def connect(self, root: 'Node') -> 'Node': """Approach: Next pointers O(1) space Time Complexity: O(N) Space Complexity: O(1) :param root: :return:""" if not root: return root leftmost = root while leftmost.left: head = leftmost ...
the_stack_v2_python_sparse
revisited/node/populating_next_right_pointer_i.py
Shiv2157k/leet_code
train
1
ef72e34161ab309eae6cbc7835f33ee4c68d5f48
[ "course_run_id = self.initial_data['course_run']\ntry:\n course_run = models.CourseRun.objects.get(id=course_run_id)\nexcept models.CourseRun.DoesNotExist as exception:\n message = f'A course run with id \"{course_run_id}\" does not exist.'\n raise serializers.ValidationError({'__all__': [message]}) from e...
<|body_start_0|> course_run_id = self.initial_data['course_run'] try: course_run = models.CourseRun.objects.get(id=course_run_id) except models.CourseRun.DoesNotExist as exception: message = f'A course run with id "{course_run_id}" does not exist.' raise seria...
Enrollment model serializer
EnrollmentSerializer
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EnrollmentSerializer: """Enrollment model serializer""" def create(self, validated_data, **kwargs): """Retrieve the course run resource through the provided id then try to create the enrollment resource.""" <|body_0|> def update(self, instance, validated_data): "...
stack_v2_sparse_classes_36k_train_009202
23,941
permissive
[ { "docstring": "Retrieve the course run resource through the provided id then try to create the enrollment resource.", "name": "create", "signature": "def create(self, validated_data, **kwargs)" }, { "docstring": "Restrict the values that can be set from the API for the state field to \"set\". T...
3
stack_v2_sparse_classes_30k_train_011663
Implement the Python class `EnrollmentSerializer` described below. Class description: Enrollment model serializer Method signatures and docstrings: - def create(self, validated_data, **kwargs): Retrieve the course run resource through the provided id then try to create the enrollment resource. - def update(self, inst...
Implement the Python class `EnrollmentSerializer` described below. Class description: Enrollment model serializer Method signatures and docstrings: - def create(self, validated_data, **kwargs): Retrieve the course run resource through the provided id then try to create the enrollment resource. - def update(self, inst...
6571a67d020715358fec807a1137f89bdf4b305a
<|skeleton|> class EnrollmentSerializer: """Enrollment model serializer""" def create(self, validated_data, **kwargs): """Retrieve the course run resource through the provided id then try to create the enrollment resource.""" <|body_0|> def update(self, instance, validated_data): "...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EnrollmentSerializer: """Enrollment model serializer""" def create(self, validated_data, **kwargs): """Retrieve the course run resource through the provided id then try to create the enrollment resource.""" course_run_id = self.initial_data['course_run'] try: course_ru...
the_stack_v2_python_sparse
src/backend/joanie/core/serializers/client.py
openfun/joanie
train
13
cf97f49c2e28cfef04194b1368777bf4cbfbf797
[ "self.owner_name = owner_name\nself.owner_address = owner_address\nself.additional_properties = additional_properties", "if dictionary is None:\n return None\nowner_name = dictionary.get('ownerName')\nowner_address = dictionary.get('ownerAddress')\nfor key in cls._names.values():\n if key in dictionary:\n ...
<|body_start_0|> self.owner_name = owner_name self.owner_address = owner_address self.additional_properties = additional_properties <|end_body_0|> <|body_start_1|> if dictionary is None: return None owner_name = dictionary.get('ownerName') owner_address = dic...
Implementation of the 'Account Owner v1' model. The account owner information for the customer account Attributes: owner_name (string): The name of the account owner. In v1 this can be multiple account owners in one string. This is how the source data is returned from the institution. owner_address (string): The addres...
AccountOwnerV1
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AccountOwnerV1: """Implementation of the 'Account Owner v1' model. The account owner information for the customer account Attributes: owner_name (string): The name of the account owner. In v1 this can be multiple account owners in one string. This is how the source data is returned from the insti...
stack_v2_sparse_classes_36k_train_009203
2,129
permissive
[ { "docstring": "Constructor for the AccountOwnerV1 class", "name": "__init__", "signature": "def __init__(self, owner_name=None, owner_address=None, additional_properties={})" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary repre...
2
stack_v2_sparse_classes_30k_train_017488
Implement the Python class `AccountOwnerV1` described below. Class description: Implementation of the 'Account Owner v1' model. The account owner information for the customer account Attributes: owner_name (string): The name of the account owner. In v1 this can be multiple account owners in one string. This is how the...
Implement the Python class `AccountOwnerV1` described below. Class description: Implementation of the 'Account Owner v1' model. The account owner information for the customer account Attributes: owner_name (string): The name of the account owner. In v1 this can be multiple account owners in one string. This is how the...
b2ab1ded435db75c78d42261f5e4acd2a3061487
<|skeleton|> class AccountOwnerV1: """Implementation of the 'Account Owner v1' model. The account owner information for the customer account Attributes: owner_name (string): The name of the account owner. In v1 this can be multiple account owners in one string. This is how the source data is returned from the insti...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AccountOwnerV1: """Implementation of the 'Account Owner v1' model. The account owner information for the customer account Attributes: owner_name (string): The name of the account owner. In v1 this can be multiple account owners in one string. This is how the source data is returned from the institution. owner...
the_stack_v2_python_sparse
finicityapi/models/account_owner_v_1.py
monarchmoney/finicity-python
train
0
993b4a519f2c607f9073f5c103a1759ef64d8e5c
[ "self.img_rows = 720 // 2\nself.img_cols = 576 // 2\nself.channels = 3\nself.img_shape = (self.img_rows, self.img_cols, self.channels)\nself.buld_AE()\nif '-w' in sys.argv:\n self.decoder.load_weights('decoder_weights.h5')\n self.encoder.load_weights('encoder_weights.h5')\n self.autoencoder.load_weights('a...
<|body_start_0|> self.img_rows = 720 // 2 self.img_cols = 576 // 2 self.channels = 3 self.img_shape = (self.img_rows, self.img_cols, self.channels) self.buld_AE() if '-w' in sys.argv: self.decoder.load_weights('decoder_weights.h5') self.encoder.loa...
AE
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AE: def __init__(self): """Initializes and makes the autoencoder. Everything is saved as self""" <|body_0|> def buld_AE(self): """Imports the encoder, decoder and Autoencoder from the pacage (remember to install package with pip in /matkirpack/)""" <|body_1|>...
stack_v2_sparse_classes_36k_train_009204
7,319
permissive
[ { "docstring": "Initializes and makes the autoencoder. Everything is saved as self", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Imports the encoder, decoder and Autoencoder from the pacage (remember to install package with pip in /matkirpack/)", "name": "buld_AE...
4
stack_v2_sparse_classes_30k_train_002203
Implement the Python class `AE` described below. Class description: Implement the AE class. Method signatures and docstrings: - def __init__(self): Initializes and makes the autoencoder. Everything is saved as self - def buld_AE(self): Imports the encoder, decoder and Autoencoder from the pacage (remember to install ...
Implement the Python class `AE` described below. Class description: Implement the AE class. Method signatures and docstrings: - def __init__(self): Initializes and makes the autoencoder. Everything is saved as self - def buld_AE(self): Imports the encoder, decoder and Autoencoder from the pacage (remember to install ...
70c4c399f9c9fc3e1643e78694223b24d7b94b18
<|skeleton|> class AE: def __init__(self): """Initializes and makes the autoencoder. Everything is saved as self""" <|body_0|> def buld_AE(self): """Imports the encoder, decoder and Autoencoder from the pacage (remember to install package with pip in /matkirpack/)""" <|body_1|>...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AE: def __init__(self): """Initializes and makes the autoencoder. Everything is saved as self""" self.img_rows = 720 // 2 self.img_cols = 576 // 2 self.channels = 3 self.img_shape = (self.img_rows, self.img_cols, self.channels) self.buld_AE() if '-w' in ...
the_stack_v2_python_sparse
src/autoencoder/dcae/simpleAE.py
matkir/Master_programs
train
0
2d900e6da36124d0f03149e776130d77d7b24405
[ "assignment = AssignmentEntity(node)\ncontext.stack_ast_node(assignment)\nsuper().parse(node, module, context)\ncontext.unstack_ast_node()\nmodule.add_assignment(assignment)\nreturn assignment", "assignment = context.current_ast_node\nfor node in targets:\n parser = self.get_parser(node)\n target = parser.p...
<|body_start_0|> assignment = AssignmentEntity(node) context.stack_ast_node(assignment) super().parse(node, module, context) context.unstack_ast_node() module.add_assignment(assignment) return assignment <|end_body_0|> <|body_start_1|> assignment = context.curren...
Parses assignment nodes.
AssignmentParser
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AssignmentParser: """Parses assignment nodes.""" def parse(self, node: ast.Assign, module: Module, context: Context): """Process an `ast.Assign` node and extract relevant stats. An ``ast.Assign`` node has two fields: - ``targets`` that represents a list of nodes - ``value`` that is a...
stack_v2_sparse_classes_36k_train_009205
2,571
no_license
[ { "docstring": "Process an `ast.Assign` node and extract relevant stats. An ``ast.Assign`` node has two fields: - ``targets`` that represents a list of nodes - ``value`` that is a single node that is assigned to targets :param node: The node that represents an assignment operation. :param module: The python mod...
3
stack_v2_sparse_classes_30k_train_016387
Implement the Python class `AssignmentParser` described below. Class description: Parses assignment nodes. Method signatures and docstrings: - def parse(self, node: ast.Assign, module: Module, context: Context): Process an `ast.Assign` node and extract relevant stats. An ``ast.Assign`` node has two fields: - ``target...
Implement the Python class `AssignmentParser` described below. Class description: Parses assignment nodes. Method signatures and docstrings: - def parse(self, node: ast.Assign, module: Module, context: Context): Process an `ast.Assign` node and extract relevant stats. An ``ast.Assign`` node has two fields: - ``target...
1a2dc3a9c847f2a3dcf0ffc9363f3e9f3b0425ea
<|skeleton|> class AssignmentParser: """Parses assignment nodes.""" def parse(self, node: ast.Assign, module: Module, context: Context): """Process an `ast.Assign` node and extract relevant stats. An ``ast.Assign`` node has two fields: - ``targets`` that represents a list of nodes - ``value`` that is a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AssignmentParser: """Parses assignment nodes.""" def parse(self, node: ast.Assign, module: Module, context: Context): """Process an `ast.Assign` node and extract relevant stats. An ``ast.Assign`` node has two fields: - ``targets`` that represents a list of nodes - ``value`` that is a single node ...
the_stack_v2_python_sparse
src/pycodealizer/parsers/statements.py
askanium/pycodealizer
train
0
1bb69a91efb77ee151f70f2ba35860b4a4cbaaea
[ "iter_filepaths = ('a', 'b', 'c', 'd')\niter_filtered = da.lwc.search._filepath_regex_filter(iter_filepaths=iter_filepaths, incl=['^.*$'], excl=None)\nexpected_output = tuple(iter_filepaths)\nassert expected_output == tuple(iter_filtered)", "iter_filepaths = ('a_0', 'b_0', 'c_1', 'd_1')\niter_filtered = da.lwc.se...
<|body_start_0|> iter_filepaths = ('a', 'b', 'c', 'd') iter_filtered = da.lwc.search._filepath_regex_filter(iter_filepaths=iter_filepaths, incl=['^.*$'], excl=None) expected_output = tuple(iter_filepaths) assert expected_output == tuple(iter_filtered) <|end_body_0|> <|body_start_1|> ...
Specify the da.lwc.search._filepath_regex_filter function.
Specify_FilepathRegexFilter
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Specify_FilepathRegexFilter: """Specify the da.lwc.search._filepath_regex_filter function.""" def it_detect_all_expression(self): """Test that all items are matched by a suitable regular expression.""" <|body_0|> def it_detect_suffix_expression(self): """Test tha...
stack_v2_sparse_classes_36k_train_009206
29,518
permissive
[ { "docstring": "Test that all items are matched by a suitable regular expression.", "name": "it_detect_all_expression", "signature": "def it_detect_all_expression(self)" }, { "docstring": "Test that we can use regular expressions to detect items with suffixes.", "name": "it_detect_suffix_exp...
2
null
Implement the Python class `Specify_FilepathRegexFilter` described below. Class description: Specify the da.lwc.search._filepath_regex_filter function. Method signatures and docstrings: - def it_detect_all_expression(self): Test that all items are matched by a suitable regular expression. - def it_detect_suffix_expre...
Implement the Python class `Specify_FilepathRegexFilter` described below. Class description: Specify the da.lwc.search._filepath_regex_filter function. Method signatures and docstrings: - def it_detect_all_expression(self): Test that all items are matched by a suitable regular expression. - def it_detect_suffix_expre...
04a13be2792323e3f9fdb83fd236a8e9cfe6aa2d
<|skeleton|> class Specify_FilepathRegexFilter: """Specify the da.lwc.search._filepath_regex_filter function.""" def it_detect_all_expression(self): """Test that all items are matched by a suitable regular expression.""" <|body_0|> def it_detect_suffix_expression(self): """Test tha...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Specify_FilepathRegexFilter: """Specify the da.lwc.search._filepath_regex_filter function.""" def it_detect_all_expression(self): """Test that all items are matched by a suitable regular expression.""" iter_filepaths = ('a', 'b', 'c', 'd') iter_filtered = da.lwc.search._filepath_r...
the_stack_v2_python_sparse
a3_src/h70_internal/da/lwc/spec/spec_search.py
wtpayne/hiai
train
5
139e02ca201d76effe8ec1165738ea05b9ba3fda
[ "q = FeatureStar.query()\nq = q.filter(FeatureStar.email == email)\nq = q.filter(FeatureStar.feature_id == feature_id)\nreturn q.get()", "feature_star = self.get_star(email, feature_id)\nif not feature_star and starred:\n feature_star = FeatureStar(email=email, feature_id=feature_id)\n feature_star.put()\ne...
<|body_start_0|> q = FeatureStar.query() q = q.filter(FeatureStar.email == email) q = q.filter(FeatureStar.feature_id == feature_id) return q.get() <|end_body_0|> <|body_start_1|> feature_star = self.get_star(email, feature_id) if not feature_star and starred: ...
A FeatureStar represent one user's interest in one feature.
FeatureStar
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FeatureStar: """A FeatureStar represent one user's interest in one feature.""" def get_star(self, email, feature_id): """If that user starred that feature, return the model or None.""" <|body_0|> def set_star(self, email, feature_id, starred=True): """Set/clear a...
stack_v2_sparse_classes_36k_train_009207
21,473
permissive
[ { "docstring": "If that user starred that feature, return the model or None.", "name": "get_star", "signature": "def get_star(self, email, feature_id)" }, { "docstring": "Set/clear a star for the specified user and feature.", "name": "set_star", "signature": "def set_star(self, email, fe...
4
null
Implement the Python class `FeatureStar` described below. Class description: A FeatureStar represent one user's interest in one feature. Method signatures and docstrings: - def get_star(self, email, feature_id): If that user starred that feature, return the model or None. - def set_star(self, email, feature_id, starr...
Implement the Python class `FeatureStar` described below. Class description: A FeatureStar represent one user's interest in one feature. Method signatures and docstrings: - def get_star(self, email, feature_id): If that user starred that feature, return the model or None. - def set_star(self, email, feature_id, starr...
17f9886d064da5bda84006d5866077727646fff2
<|skeleton|> class FeatureStar: """A FeatureStar represent one user's interest in one feature.""" def get_star(self, email, feature_id): """If that user starred that feature, return the model or None.""" <|body_0|> def set_star(self, email, feature_id, starred=True): """Set/clear a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FeatureStar: """A FeatureStar represent one user's interest in one feature.""" def get_star(self, email, feature_id): """If that user starred that feature, return the model or None.""" q = FeatureStar.query() q = q.filter(FeatureStar.email == email) q = q.filter(FeatureSta...
the_stack_v2_python_sparse
internals/notifier.py
GoogleChrome/chromium-dashboard
train
574
c2b8181ed89cf3ee92068761a055a9126019fa5e
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\ntry:\n mapping_value = parse_node.get_child_node('@odata.type').get_str_value()\nexcept AttributeError:\n mapping_value = None\nif mapping_value and mapping_value.casefold() == '#microsoft.graph.eventMessageRequest'.casefold():\n from ...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') try: mapping_value = parse_node.get_child_node('@odata.type').get_str_value() except AttributeError: mapping_value = None if mapping_value and mapping_value.casefold() ==...
EventMessage
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EventMessage: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> EventMessage: """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: ...
stack_v2_sparse_classes_36k_train_009208
6,219
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: EventMessage", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_value(...
3
stack_v2_sparse_classes_30k_train_006074
Implement the Python class `EventMessage` described below. Class description: Implement the EventMessage class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> EventMessage: Creates a new instance of the appropriate class based on discriminator value Ar...
Implement the Python class `EventMessage` described below. Class description: Implement the EventMessage class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> EventMessage: Creates a new instance of the appropriate class based on discriminator value Ar...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class EventMessage: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> EventMessage: """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: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EventMessage: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> EventMessage: """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: EventMessage""...
the_stack_v2_python_sparse
msgraph/generated/models/event_message.py
microsoftgraph/msgraph-sdk-python
train
135
a45685fda5adf543b9fbe358ebe0f2259e1f230e
[ "result = {}\ndpkg_grep_nginx_out, _ = subp.call('dpkg -l | grep nginx')\nfor line in dpkg_grep_nginx_out:\n gwe = re.match(self.dpkg_l_re, line)\n if gwe:\n if gwe.group(2).startswith('nginx'):\n result[gwe.group(2)] = gwe.group(3)\nreturn result", "package_name = None\ndpkg_s_nginx_out, ...
<|body_start_0|> result = {} dpkg_grep_nginx_out, _ = subp.call('dpkg -l | grep nginx') for line in dpkg_grep_nginx_out: gwe = re.match(self.dpkg_l_re, line) if gwe: if gwe.group(2).startswith('nginx'): result[gwe.group(2)] = gwe.group(...
Redefines package search method
NginxDebianMetaCollector
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NginxDebianMetaCollector: """Redefines package search method""" def installed_nginx_packages(self): """trying to find some installed packages""" <|body_0|> def find_packages(self, meta): """Find a package with running binary""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_36k_train_009209
1,998
permissive
[ { "docstring": "trying to find some installed packages", "name": "installed_nginx_packages", "signature": "def installed_nginx_packages(self)" }, { "docstring": "Find a package with running binary", "name": "find_packages", "signature": "def find_packages(self, meta)" } ]
2
stack_v2_sparse_classes_30k_train_004024
Implement the Python class `NginxDebianMetaCollector` described below. Class description: Redefines package search method Method signatures and docstrings: - def installed_nginx_packages(self): trying to find some installed packages - def find_packages(self, meta): Find a package with running binary
Implement the Python class `NginxDebianMetaCollector` described below. Class description: Redefines package search method Method signatures and docstrings: - def installed_nginx_packages(self): trying to find some installed packages - def find_packages(self, meta): Find a package with running binary <|skeleton|> cla...
66d15b16302ea81ac927f0c0dc41d66e47f482f3
<|skeleton|> class NginxDebianMetaCollector: """Redefines package search method""" def installed_nginx_packages(self): """trying to find some installed packages""" <|body_0|> def find_packages(self, meta): """Find a package with running binary""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NginxDebianMetaCollector: """Redefines package search method""" def installed_nginx_packages(self): """trying to find some installed packages""" result = {} dpkg_grep_nginx_out, _ = subp.call('dpkg -l | grep nginx') for line in dpkg_grep_nginx_out: gwe = re.mat...
the_stack_v2_python_sparse
amplify/agent/containers/nginx/collectors/meta/deb.py
heartshare/nginx-amplify-agent
train
0
4ee7177256b4549b1d771d25b9575797ed45c0db
[ "if not isinstance(command, (list, tuple)):\n raise SubprocessRuntimeError(f'Command ({command}) is not of type list or tuple.')\nself.base_command = command[0]\nself.command = command\nself.stdout = stdout\nself.stderr = stderr\nself.timeout = timeout\nself.verbose = verbose\ncommand[0] = self.__which()", "ab...
<|body_start_0|> if not isinstance(command, (list, tuple)): raise SubprocessRuntimeError(f'Command ({command}) is not of type list or tuple.') self.base_command = command[0] self.command = command self.stdout = stdout self.stderr = stderr self.timeout = timeou...
Class to handle the execution of all command line tooling. User friendly subprocess wrapper, providing useful and informative error messages to the user in case of failures.
Subprocess
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Subprocess: """Class to handle the execution of all command line tooling. User friendly subprocess wrapper, providing useful and informative error messages to the user in case of failures.""" def __init__(self, command, stdout=DEVNULL, stderr=DEVNULL, verbose=0, timeout=None): """Cla...
stack_v2_sparse_classes_36k_train_009210
6,457
permissive
[ { "docstring": "Class initializer. Creates a command object that can be executed. :param command: Command to execute on operating system in tuple format :param stdout: Optional location to redirect standard output stream :param stderr: Optional location to redirect error output stream :param verbose: Optional v...
6
stack_v2_sparse_classes_30k_train_017711
Implement the Python class `Subprocess` described below. Class description: Class to handle the execution of all command line tooling. User friendly subprocess wrapper, providing useful and informative error messages to the user in case of failures. Method signatures and docstrings: - def __init__(self, command, stdo...
Implement the Python class `Subprocess` described below. Class description: Class to handle the execution of all command line tooling. User friendly subprocess wrapper, providing useful and informative error messages to the user in case of failures. Method signatures and docstrings: - def __init__(self, command, stdo...
9c25ba4d986f73962598d0e9ec09ac8fe4121a88
<|skeleton|> class Subprocess: """Class to handle the execution of all command line tooling. User friendly subprocess wrapper, providing useful and informative error messages to the user in case of failures.""" def __init__(self, command, stdout=DEVNULL, stderr=DEVNULL, verbose=0, timeout=None): """Cla...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Subprocess: """Class to handle the execution of all command line tooling. User friendly subprocess wrapper, providing useful and informative error messages to the user in case of failures.""" def __init__(self, command, stdout=DEVNULL, stderr=DEVNULL, verbose=0, timeout=None): """Class initialize...
the_stack_v2_python_sparse
src/facility/subprocess.py
rschuitema/sqatt
train
6
0eba28775ac033a4903f11832b678525f014c20d
[ "super(DeepMixtureOfExpertsModel, self).__init__()\ninputs_size = embed_size * num_fields\nlayer_sizes = [inputs_size] + moe_layer_sizes\nself.moes = nn.ModuleList()\nfor i, (inp, out) in enumerate(zip(layer_sizes[:-1], layer_sizes[1:])):\n inp = num_experts * inp if i != 0 else inp\n moe = MOELayer(inputs_si...
<|body_start_0|> super(DeepMixtureOfExpertsModel, self).__init__() inputs_size = embed_size * num_fields layer_sizes = [inputs_size] + moe_layer_sizes self.moes = nn.ModuleList() for i, (inp, out) in enumerate(zip(layer_sizes[:-1], layer_sizes[1:])): inp = num_experts...
Model class of Deep Mixture-of-Experts (MoE) model. Deep Mixture-of-Experts is purposed by David Eigen et at at 2013, which is to combine outputs of several `expert` models, each of which specializes in a different part of input space. To combine them, a gate, which is a stack of linear and softmax, will be trained for...
DeepMixtureOfExpertsModel
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeepMixtureOfExpertsModel: """Model class of Deep Mixture-of-Experts (MoE) model. Deep Mixture-of-Experts is purposed by David Eigen et at at 2013, which is to combine outputs of several `expert` models, each of which specializes in a different part of input space. To combine them, a gate, which ...
stack_v2_sparse_classes_36k_train_009211
3,977
permissive
[ { "docstring": "Initialize DeepMixtureOfExpertsModel Args: embed_size (int): Size of embedding tensor num_fields (int): Number of inputs' fields num_experts (int): Number of experts' model moe_layer_sizes (List[int]): Size of mixture-of-experts models' outputs deep_layer_sizes (List[int]): Layer sizes of dense ...
2
stack_v2_sparse_classes_30k_train_019304
Implement the Python class `DeepMixtureOfExpertsModel` described below. Class description: Model class of Deep Mixture-of-Experts (MoE) model. Deep Mixture-of-Experts is purposed by David Eigen et at at 2013, which is to combine outputs of several `expert` models, each of which specializes in a different part of input...
Implement the Python class `DeepMixtureOfExpertsModel` described below. Class description: Model class of Deep Mixture-of-Experts (MoE) model. Deep Mixture-of-Experts is purposed by David Eigen et at at 2013, which is to combine outputs of several `expert` models, each of which specializes in a different part of input...
07a6a38c7eb44225f2b22f332081f697c3b92894
<|skeleton|> class DeepMixtureOfExpertsModel: """Model class of Deep Mixture-of-Experts (MoE) model. Deep Mixture-of-Experts is purposed by David Eigen et at at 2013, which is to combine outputs of several `expert` models, each of which specializes in a different part of input space. To combine them, a gate, which ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DeepMixtureOfExpertsModel: """Model class of Deep Mixture-of-Experts (MoE) model. Deep Mixture-of-Experts is purposed by David Eigen et at at 2013, which is to combine outputs of several `expert` models, each of which specializes in a different part of input space. To combine them, a gate, which is a stack of...
the_stack_v2_python_sparse
torecsys/models/ctr/deep_moe.py
zwcdp/torecsys
train
0
7b182a070146a2cbe1a2ccbd7235f35f504350bb
[ "self.capacity = capacity\nself.cache = dict()\nself.MRU = []", "if key in self.cache:\n self.MRU.remove((key, self.cache[key]))\n self.MRU.append((key, self.cache[key]))\n return self.cache[key]\nelse:\n return -1", "if key not in self.cache:\n self.MRU.append((key, value))\nelse:\n self.MRU....
<|body_start_0|> self.capacity = capacity self.cache = dict() self.MRU = [] <|end_body_0|> <|body_start_1|> if key in self.cache: self.MRU.remove((key, self.cache[key])) self.MRU.append((key, self.cache[key])) return self.cache[key] else: ...
Purpose: MRU caching policy discards the most recently used items first. In findings presented at the 11th VLDB conference, Chou and DeWitt noted that "when a file is being repeatedly scanned in a [Looping Sequential] reference pattern, MRU is the best replacement algorithm". Subsequently, other researchers presenting ...
MRUCache
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MRUCache: """Purpose: MRU caching policy discards the most recently used items first. In findings presented at the 11th VLDB conference, Chou and DeWitt noted that "when a file is being repeatedly scanned in a [Looping Sequential] reference pattern, MRU is the best replacement algorithm". Subsequ...
stack_v2_sparse_classes_36k_train_009212
2,081
no_license
[ { "docstring": "Purpose: Initializes an MRU Cache with positive size capacity.", "name": "__init__", "signature": "def __init__(self, capacity: int)" }, { "docstring": "Purpose: Returns the value of the key if key exists.", "name": "get", "signature": "def get(self, key: int) -> int" }...
3
null
Implement the Python class `MRUCache` described below. Class description: Purpose: MRU caching policy discards the most recently used items first. In findings presented at the 11th VLDB conference, Chou and DeWitt noted that "when a file is being repeatedly scanned in a [Looping Sequential] reference pattern, MRU is t...
Implement the Python class `MRUCache` described below. Class description: Purpose: MRU caching policy discards the most recently used items first. In findings presented at the 11th VLDB conference, Chou and DeWitt noted that "when a file is being repeatedly scanned in a [Looping Sequential] reference pattern, MRU is t...
95a86cbbca28d0c0f6d72d28a2f1cb5a86327934
<|skeleton|> class MRUCache: """Purpose: MRU caching policy discards the most recently used items first. In findings presented at the 11th VLDB conference, Chou and DeWitt noted that "when a file is being repeatedly scanned in a [Looping Sequential] reference pattern, MRU is the best replacement algorithm". Subsequ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MRUCache: """Purpose: MRU caching policy discards the most recently used items first. In findings presented at the 11th VLDB conference, Chou and DeWitt noted that "when a file is being repeatedly scanned in a [Looping Sequential] reference pattern, MRU is the best replacement algorithm". Subsequently, other ...
the_stack_v2_python_sparse
mru_cache.py
tashakim/puzzles_python
train
8
a70e8c7d6e009e2e4edd8c0a16d64ea8c954f8b7
[ "UserModel = get_user_model()\ntry:\n user = UserModel._default_manager.get(mobile=username)\n if user.check_password(password):\n return user\nexcept UserModel.DoesNotExist:\n return None", "UserModel = get_user_model()\ntry:\n return UserModel.objects.get(pk=user_id)\nexcept UserModel.DoesNot...
<|body_start_0|> UserModel = get_user_model() try: user = UserModel._default_manager.get(mobile=username) if user.check_password(password): return user except UserModel.DoesNotExist: return None <|end_body_0|> <|body_start_1|> UserMode...
This Authentication Backend Authenticates a User Against the Mobile No. Possible Usage Can Be Facebook Login Where User Can Also Use Mobile No. to Create an Account.
MobileAuthenticationBackend
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MobileAuthenticationBackend: """This Authentication Backend Authenticates a User Against the Mobile No. Possible Usage Can Be Facebook Login Where User Can Also Use Mobile No. to Create an Account.""" def authenticate(self, username=None, password=None): """Authenticate Using the Mob...
stack_v2_sparse_classes_36k_train_009213
2,708
no_license
[ { "docstring": "Authenticate Using the Mobile/password And Return a User", "name": "authenticate", "signature": "def authenticate(self, username=None, password=None)" }, { "docstring": "Returns a User Against a Given User Id", "name": "get_user", "signature": "def get_user(self, user_id)...
2
stack_v2_sparse_classes_30k_test_000368
Implement the Python class `MobileAuthenticationBackend` described below. Class description: This Authentication Backend Authenticates a User Against the Mobile No. Possible Usage Can Be Facebook Login Where User Can Also Use Mobile No. to Create an Account. Method signatures and docstrings: - def authenticate(self, ...
Implement the Python class `MobileAuthenticationBackend` described below. Class description: This Authentication Backend Authenticates a User Against the Mobile No. Possible Usage Can Be Facebook Login Where User Can Also Use Mobile No. to Create an Account. Method signatures and docstrings: - def authenticate(self, ...
3bb9fe2e3fe8d876519631233fb29c7e04e2e8c3
<|skeleton|> class MobileAuthenticationBackend: """This Authentication Backend Authenticates a User Against the Mobile No. Possible Usage Can Be Facebook Login Where User Can Also Use Mobile No. to Create an Account.""" def authenticate(self, username=None, password=None): """Authenticate Using the Mob...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MobileAuthenticationBackend: """This Authentication Backend Authenticates a User Against the Mobile No. Possible Usage Can Be Facebook Login Where User Can Also Use Mobile No. to Create an Account.""" def authenticate(self, username=None, password=None): """Authenticate Using the Mobile/password ...
the_stack_v2_python_sparse
accounts/backends.py
Mr4x3/competition_mania
train
0
ca0c8473ec6bb3307145069a3b291c7fa1eb5c1a
[ "if x < 0:\n neg = 1\n x = -x\nelse:\n neg = 0\ns = str(x)\nl = [s[i] for i in range(len(s))]\nl.reverse()\nres = int(''.join(l))\nif neg:\n if res > pow(2, 31):\n return 0\n return -res\nelse:\n if res > pow(2, 31) - 1:\n return 0\n return res", "if x >= 0:\n reverse_x = int...
<|body_start_0|> if x < 0: neg = 1 x = -x else: neg = 0 s = str(x) l = [s[i] for i in range(len(s))] l.reverse() res = int(''.join(l)) if neg: if res > pow(2, 31): return 0 return -res ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reverse(self, x): """:type x: int :rtype: int""" <|body_0|> def reverse0(self, x): """:type x: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if x < 0: neg = 1 x = -x else: n...
stack_v2_sparse_classes_36k_train_009214
844
no_license
[ { "docstring": ":type x: int :rtype: int", "name": "reverse", "signature": "def reverse(self, x)" }, { "docstring": ":type x: int :rtype: int", "name": "reverse0", "signature": "def reverse0(self, x)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverse(self, x): :type x: int :rtype: int - def reverse0(self, x): :type x: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverse(self, x): :type x: int :rtype: int - def reverse0(self, x): :type x: int :rtype: int <|skeleton|> class Solution: def reverse(self, x): """:type x: int ...
9e49b2c6003b957276737005d4aaac276b44d251
<|skeleton|> class Solution: def reverse(self, x): """:type x: int :rtype: int""" <|body_0|> def reverse0(self, x): """:type x: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def reverse(self, x): """:type x: int :rtype: int""" if x < 0: neg = 1 x = -x else: neg = 0 s = str(x) l = [s[i] for i in range(len(s))] l.reverse() res = int(''.join(l)) if neg: if res > ...
the_stack_v2_python_sparse
PythonCode/src/0007_Reverse_Integer.py
oneyuan/CodeforFun
train
0
2254e2d7f2c48b5203bd1eb1b0ceba68a1b5820d
[ "data_registries = {}\nfor hostname, registry in self.sys_docker.config.registries.items():\n data_registries[hostname] = {ATTR_USERNAME: registry[ATTR_USERNAME]}\nreturn {ATTR_REGISTRIES: data_registries}", "body = await api_validate(SCHEMA_DOCKER_REGISTRY, request)\nfor hostname, registry in body.items():\n ...
<|body_start_0|> data_registries = {} for hostname, registry in self.sys_docker.config.registries.items(): data_registries[hostname] = {ATTR_USERNAME: registry[ATTR_USERNAME]} return {ATTR_REGISTRIES: data_registries} <|end_body_0|> <|body_start_1|> body = await api_validate...
Handle RESTful API for Docker configuration.
APIDocker
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class APIDocker: """Handle RESTful API for Docker configuration.""" async def registries(self, request) -> dict[str, Any]: """Return the list of registries.""" <|body_0|> async def create_registry(self, request: web.Request): """Create a new docker registry.""" ...
stack_v2_sparse_classes_36k_train_009215
2,274
permissive
[ { "docstring": "Return the list of registries.", "name": "registries", "signature": "async def registries(self, request) -> dict[str, Any]" }, { "docstring": "Create a new docker registry.", "name": "create_registry", "signature": "async def create_registry(self, request: web.Request)" ...
4
null
Implement the Python class `APIDocker` described below. Class description: Handle RESTful API for Docker configuration. Method signatures and docstrings: - async def registries(self, request) -> dict[str, Any]: Return the list of registries. - async def create_registry(self, request: web.Request): Create a new docker...
Implement the Python class `APIDocker` described below. Class description: Handle RESTful API for Docker configuration. Method signatures and docstrings: - async def registries(self, request) -> dict[str, Any]: Return the list of registries. - async def create_registry(self, request: web.Request): Create a new docker...
4838b280adafed0997f32e021274b531178386cd
<|skeleton|> class APIDocker: """Handle RESTful API for Docker configuration.""" async def registries(self, request) -> dict[str, Any]: """Return the list of registries.""" <|body_0|> async def create_registry(self, request: web.Request): """Create a new docker registry.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class APIDocker: """Handle RESTful API for Docker configuration.""" async def registries(self, request) -> dict[str, Any]: """Return the list of registries.""" data_registries = {} for hostname, registry in self.sys_docker.config.registries.items(): data_registries[hostname]...
the_stack_v2_python_sparse
supervisor/api/docker.py
home-assistant/supervisor
train
928
1d6efb35632f3df8d48ae4921dc8f4bf9c82014f
[ "if self._context is None:\n context = {}\ncontext = dict(self._context)\ncontext.update({'create_company': True})\nreturn super(ResCompany, self).create(val)", "context = dict(self._context or {})\ncontext.update({'create_company': True})\nreturn super(ResCompany, self).write(values)" ]
<|body_start_0|> if self._context is None: context = {} context = dict(self._context) context.update({'create_company': True}) return super(ResCompany, self).create(val) <|end_body_0|> <|body_start_1|> context = dict(self._context or {}) context.update({'crea...
ResCompany
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResCompany: def create(self, val): """To create a new record, adds a Boolean field to true indicates that the partner is a company""" <|body_0|> def write(self, values): """To write a new record, adds a Boolean field to true indicates that the partner is a company"""...
stack_v2_sparse_classes_36k_train_009216
1,289
no_license
[ { "docstring": "To create a new record, adds a Boolean field to true indicates that the partner is a company", "name": "create", "signature": "def create(self, val)" }, { "docstring": "To write a new record, adds a Boolean field to true indicates that the partner is a company", "name": "writ...
2
null
Implement the Python class `ResCompany` described below. Class description: Implement the ResCompany class. Method signatures and docstrings: - def create(self, val): To create a new record, adds a Boolean field to true indicates that the partner is a company - def write(self, values): To write a new record, adds a B...
Implement the Python class `ResCompany` described below. Class description: Implement the ResCompany class. Method signatures and docstrings: - def create(self, val): To create a new record, adds a Boolean field to true indicates that the partner is a company - def write(self, values): To write a new record, adds a B...
b95909d0689fc787185290565f0873040a6027cf
<|skeleton|> class ResCompany: def create(self, val): """To create a new record, adds a Boolean field to true indicates that the partner is a company""" <|body_0|> def write(self, values): """To write a new record, adds a Boolean field to true indicates that the partner is a company"""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ResCompany: def create(self, val): """To create a new record, adds a Boolean field to true indicates that the partner is a company""" if self._context is None: context = {} context = dict(self._context) context.update({'create_company': True}) return super(R...
the_stack_v2_python_sparse
localizacion_metromed/l10n_ve_fiscal_requirements/model/res_company.py
Tysamncaweb/produccion2
train
1
2e75f3f70ab13799d3b163d4f2873035a0de5839
[ "self.text_color = text_color\nLabel.__init__(self, name, text, pygame.rect.Rect((0, 0), (0, 0)))\nreturn", "if self.text != self.cached_text:\n font_surface = BOLD_FONT.render(self.text, True, (0, 0, 0))\n target_surface = pygame.Surface(font_surface.get_rect().inflate(2, 2).size, flags=pygame.SRCALPHA)\n ...
<|body_start_0|> self.text_color = text_color Label.__init__(self, name, text, pygame.rect.Rect((0, 0), (0, 0))) return <|end_body_0|> <|body_start_1|> if self.text != self.cached_text: font_surface = BOLD_FONT.render(self.text, True, (0, 0, 0)) target_surface = ...
A Label with outlined text and a transparent background. Additional attributes: OutlinedText.text_color A tuple (R, G, B) holding the color of the text.
OutlinedText
[ "Unlicense" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OutlinedText: """A Label with outlined text and a transparent background. Additional attributes: OutlinedText.text_color A tuple (R, G, B) holding the color of the text.""" def __init__(self, name, text, text_color=(255, 255, 255)): """Initialise the OutlinedText. text is the text to...
stack_v2_sparse_classes_36k_train_009217
27,668
permissive
[ { "docstring": "Initialise the OutlinedText. text is the text to be written on the Label. If text is None, it is replaced by an empty string.", "name": "__init__", "signature": "def __init__(self, name, text, text_color=(255, 255, 255))" }, { "docstring": "Redraw the Label if necessary.", "n...
2
stack_v2_sparse_classes_30k_train_012571
Implement the Python class `OutlinedText` described below. Class description: A Label with outlined text and a transparent background. Additional attributes: OutlinedText.text_color A tuple (R, G, B) holding the color of the text. Method signatures and docstrings: - def __init__(self, name, text, text_color=(255, 255...
Implement the Python class `OutlinedText` described below. Class description: A Label with outlined text and a transparent background. Additional attributes: OutlinedText.text_color A tuple (R, G, B) holding the color of the text. Method signatures and docstrings: - def __init__(self, name, text, text_color=(255, 255...
c2fc3d4e9beedb8487cfa4bfa13bdf55ec36af97
<|skeleton|> class OutlinedText: """A Label with outlined text and a transparent background. Additional attributes: OutlinedText.text_color A tuple (R, G, B) holding the color of the text.""" def __init__(self, name, text, text_color=(255, 255, 255)): """Initialise the OutlinedText. text is the text to...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OutlinedText: """A Label with outlined text and a transparent background. Additional attributes: OutlinedText.text_color A tuple (R, G, B) holding the color of the text.""" def __init__(self, name, text, text_color=(255, 255, 255)): """Initialise the OutlinedText. text is the text to be written o...
the_stack_v2_python_sparse
reference_scripts/clickndrag-0.4.1/clickndrag/gui.py
stivosaurus/rpi-snippets
train
1
48b7ee0bba2cd3a7835582b11b63b894d7060b59
[ "if attr is None:\n attr = {}\nRoot.__init__(self, name, attr)", "html = '<%s %s>' % (self.name, self.attr)\nfor ind in self:\n html = '%s%s' % (html, ind)\nhtml += '</%s>' % self.name\nreturn html" ]
<|body_start_0|> if attr is None: attr = {} Root.__init__(self, name, attr) <|end_body_0|> <|body_start_1|> html = '<%s %s>' % (self.name, self.attr) for ind in self: html = '%s%s' % (html, ind) html += '</%s>' % self.name return html <|end_body_1...
This class's instances represent xml/html tags under the form: <name key="value" ...> ... </name>. It holds useful methods for parsing xml/html documents.
Tag
[ "WTFPL" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Tag: """This class's instances represent xml/html tags under the form: <name key="value" ...> ... </name>. It holds useful methods for parsing xml/html documents.""" def __init__(self, name, attr=None): """The parameter name is the xml/html tag's name. Example: d = {'style': 'backgro...
stack_v2_sparse_classes_36k_train_009218
26,802
permissive
[ { "docstring": "The parameter name is the xml/html tag's name. Example: d = {'style': 'background:blue;'} x = Tag('p', d)", "name": "__init__", "signature": "def __init__(self, name, attr=None)" }, { "docstring": "This function returns a string representation for a node.", "name": "__str__",...
2
stack_v2_sparse_classes_30k_train_017833
Implement the Python class `Tag` described below. Class description: This class's instances represent xml/html tags under the form: <name key="value" ...> ... </name>. It holds useful methods for parsing xml/html documents. Method signatures and docstrings: - def __init__(self, name, attr=None): The parameter name is...
Implement the Python class `Tag` described below. Class description: This class's instances represent xml/html tags under the form: <name key="value" ...> ... </name>. It holds useful methods for parsing xml/html documents. Method signatures and docstrings: - def __init__(self, name, attr=None): The parameter name is...
e37adca9634f644890673dee236a9c215c6744c1
<|skeleton|> class Tag: """This class's instances represent xml/html tags under the form: <name key="value" ...> ... </name>. It holds useful methods for parsing xml/html documents.""" def __init__(self, name, attr=None): """The parameter name is the xml/html tag's name. Example: d = {'style': 'backgro...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Tag: """This class's instances represent xml/html tags under the form: <name key="value" ...> ... </name>. It holds useful methods for parsing xml/html documents.""" def __init__(self, name, attr=None): """The parameter name is the xml/html tag's name. Example: d = {'style': 'background:blue;'} x...
the_stack_v2_python_sparse
burst/parser/ehp.py
elgatito/script.elementum.burst
train
108
8b59c05981957880efe0e835a5022b301bc4801e
[ "guess_str = (str(parent_hash) + str(merkle_root) + str(nonce)).encode('utf8')\nguess_hash = FuncUtil.hashfunc_sha256(guess_str)\ndifficulty = 1\nwhile int('f' * difficulty, 16) < sum_stake:\n difficulty += 1\nguess_weight = int(guess_hash[:difficulty], 16) / int('f' * difficulty, 16)\nreturn guess_weight < stak...
<|body_start_0|> guess_str = (str(parent_hash) + str(merkle_root) + str(nonce)).encode('utf8') guess_hash = FuncUtil.hashfunc_sha256(guess_str) difficulty = 1 while int('f' * difficulty, 16) < sum_stake: difficulty += 1 guess_weight = int(guess_hash[:difficulty], 16) ...
Proof-of-Stake consenses mechanism
POS
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class POS: """Proof-of-Stake consenses mechanism""" def valid_proof(parent_hash, merkle_root, nonce, stake_weight=1, sum_stake=1): """Check if a guessing hash value satisfies the mining difficulty conditions. @ parent_hash: parent block hash value @ merkle_root: merkle tree root of transac...
stack_v2_sparse_classes_36k_train_009219
3,326
no_license
[ { "docstring": "Check if a guessing hash value satisfies the mining difficulty conditions. @ parent_hash: parent block hash value @ merkle_root: merkle tree root of transactions in block @ nonce: the stake deposit value", "name": "valid_proof", "signature": "def valid_proof(parent_hash, merkle_root, non...
3
null
Implement the Python class `POS` described below. Class description: Proof-of-Stake consenses mechanism Method signatures and docstrings: - def valid_proof(parent_hash, merkle_root, nonce, stake_weight=1, sum_stake=1): Check if a guessing hash value satisfies the mining difficulty conditions. @ parent_hash: parent bl...
Implement the Python class `POS` described below. Class description: Proof-of-Stake consenses mechanism Method signatures and docstrings: - def valid_proof(parent_hash, merkle_root, nonce, stake_weight=1, sum_stake=1): Check if a guessing hash value satisfies the mining difficulty conditions. @ parent_hash: parent bl...
03ff57e6fe0114ffd2dd953e79a73a893a6bc0ad
<|skeleton|> class POS: """Proof-of-Stake consenses mechanism""" def valid_proof(parent_hash, merkle_root, nonce, stake_weight=1, sum_stake=1): """Check if a guessing hash value satisfies the mining difficulty conditions. @ parent_hash: parent block hash value @ merkle_root: merkle tree root of transac...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class POS: """Proof-of-Stake consenses mechanism""" def valid_proof(parent_hash, merkle_root, nonce, stake_weight=1, sum_stake=1): """Check if a guessing hash value satisfies the mining difficulty conditions. @ parent_hash: parent block hash value @ merkle_root: merkle tree root of transactions in bloc...
the_stack_v2_python_sparse
Security/py_dev/VDF_chain/consensus/consensus.py
samuelxu999/Research
train
1
6ed1e559e3fccd97eccce7d0f4114f719e380bf9
[ "p = 1\nn = len(nums)\noutput = []\nfor i in range(0, n):\n output.append(p)\n p = p * nums[i]\np = 1\nfor i in range(n - 1, -1, -1):\n output[i] = output[i] * p\n p = p * nums[i]\nreturn output", "from __builtin__ import xrange\nresult = [1]\nfor i in xrange(1, len(nums)):\n result.append(result[-...
<|body_start_0|> p = 1 n = len(nums) output = [] for i in range(0, n): output.append(p) p = p * nums[i] p = 1 for i in range(n - 1, -1, -1): output[i] = output[i] * p p = p * nums[i] return output <|end_body_0|> <|b...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def productExceptSelf(self, nums): """:type nums: List[int] :rtype: List[int] 掃兩遍. 第一遍由前往後 每個slot為前面的乘積. 第二遍由後往前 每個slot為之前slot的值(即前面的乘積) 乘上 後面的乘積. 第二遍掃完slot存放著結果.""" <|body_0|> def rewrite(self, nums): """:type nums: List[int] :rtype: List[int]""" <...
stack_v2_sparse_classes_36k_train_009220
3,043
no_license
[ { "docstring": ":type nums: List[int] :rtype: List[int] 掃兩遍. 第一遍由前往後 每個slot為前面的乘積. 第二遍由後往前 每個slot為之前slot的值(即前面的乘積) 乘上 後面的乘積. 第二遍掃完slot存放著結果.", "name": "productExceptSelf", "signature": "def productExceptSelf(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: List[int]", "name": "r...
4
stack_v2_sparse_classes_30k_train_016898
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def productExceptSelf(self, nums): :type nums: List[int] :rtype: List[int] 掃兩遍. 第一遍由前往後 每個slot為前面的乘積. 第二遍由後往前 每個slot為之前slot的值(即前面的乘積) 乘上 後面的乘積. 第二遍掃完slot存放著結果. - def rewrite(self...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def productExceptSelf(self, nums): :type nums: List[int] :rtype: List[int] 掃兩遍. 第一遍由前往後 每個slot為前面的乘積. 第二遍由後往前 每個slot為之前slot的值(即前面的乘積) 乘上 後面的乘積. 第二遍掃完slot存放著結果. - def rewrite(self...
6350568d16b0f8c49a020f055bb6d72e2705ea56
<|skeleton|> class Solution: def productExceptSelf(self, nums): """:type nums: List[int] :rtype: List[int] 掃兩遍. 第一遍由前往後 每個slot為前面的乘積. 第二遍由後往前 每個slot為之前slot的值(即前面的乘積) 乘上 後面的乘積. 第二遍掃完slot存放著結果.""" <|body_0|> def rewrite(self, nums): """:type nums: List[int] :rtype: List[int]""" <...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def productExceptSelf(self, nums): """:type nums: List[int] :rtype: List[int] 掃兩遍. 第一遍由前往後 每個slot為前面的乘積. 第二遍由後往前 每個slot為之前slot的值(即前面的乘積) 乘上 後面的乘積. 第二遍掃完slot存放著結果.""" p = 1 n = len(nums) output = [] for i in range(0, n): output.append(p) ...
the_stack_v2_python_sparse
co_fb/238_Product_of_Array_Except_Self.py
vsdrun/lc_public
train
6
a60f877ac0c00fddb557829c5581824dd0a6e2d4
[ "logger.info('BioBamBam2 Filter')\nTool.__init__(self)\nif configuration is None:\n configuration = {}\nself.configuration.update(configuration)", "logger.info('BIOBAMBAM: bam_file_in: ' + bam_file_in)\nlogger.info('BIOBAMBAM: bam_file_out: ' + bam_file_out)\ncommand_line = 'bamsormadup --threads=4 --tmpfile='...
<|body_start_0|> logger.info('BioBamBam2 Filter') Tool.__init__(self) if configuration is None: configuration = {} self.configuration.update(configuration) <|end_body_0|> <|body_start_1|> logger.info('BIOBAMBAM: bam_file_in: ' + bam_file_in) logger.info('BIOB...
Tool to sort and filter bam files
biobambam
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class biobambam: """Tool to sort and filter bam files""" def __init__(self, configuration=None): """Initialise the tool with its configuration. Parameters ---------- configuration : dict a dictionary containing parameters that define how the operation should be carried out, which are speci...
stack_v2_sparse_classes_36k_train_009221
7,091
permissive
[ { "docstring": "Initialise the tool with its configuration. Parameters ---------- configuration : dict a dictionary containing parameters that define how the operation should be carried out, which are specific to each Tool.", "name": "__init__", "signature": "def __init__(self, configuration=None)" },...
3
null
Implement the Python class `biobambam` described below. Class description: Tool to sort and filter bam files Method signatures and docstrings: - def __init__(self, configuration=None): Initialise the tool with its configuration. Parameters ---------- configuration : dict a dictionary containing parameters that define...
Implement the Python class `biobambam` described below. Class description: Tool to sort and filter bam files Method signatures and docstrings: - def __init__(self, configuration=None): Initialise the tool with its configuration. Parameters ---------- configuration : dict a dictionary containing parameters that define...
50c7115c0c1a6af48dc34f275e469d1b9eb02999
<|skeleton|> class biobambam: """Tool to sort and filter bam files""" def __init__(self, configuration=None): """Initialise the tool with its configuration. Parameters ---------- configuration : dict a dictionary containing parameters that define how the operation should be carried out, which are speci...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class biobambam: """Tool to sort and filter bam files""" def __init__(self, configuration=None): """Initialise the tool with its configuration. Parameters ---------- configuration : dict a dictionary containing parameters that define how the operation should be carried out, which are specific to each T...
the_stack_v2_python_sparse
tool/biobambam_filter.py
Multiscale-Genomics/mg-process-fastq
train
2
363cfab6a7232de52da4615c8fe4e4366b11c20d
[ "if model is not None:\n try:\n return (get_framework_by_class_name(model=model), {})\n except mlrun.errors.MLRunInvalidArgumentError:\n return (get_framework_by_instance(model=model), {})\nif model_path is not None:\n model_file, model_artifact, extra_data = get_model(model_path)\n if mod...
<|body_start_0|> if model is not None: try: return (get_framework_by_class_name(model=model), {}) except mlrun.errors.MLRunInvalidArgumentError: return (get_framework_by_instance(model=model), {}) if model_path is not None: model_file, ...
A library of automatic functions for managing models using MLRun's frameworks package.
AutoMLRun
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AutoMLRun: """A library of automatic functions for managing models using MLRun's frameworks package.""" def _get_framework(model: CommonTypes.ModelType=None, model_path: str=None) -> Union[Tuple[str, dict]]: """Try to get the framework from the model or model path provided. The frame...
stack_v2_sparse_classes_36k_train_009222
24,099
permissive
[ { "docstring": "Try to get the framework from the model or model path provided. The framework can be read from the model path only if the model path is of a logged model artifact (store object uri). :param model: The model instance to get its framework. :param model_path: The store object uri of a model artifac...
3
stack_v2_sparse_classes_30k_train_007050
Implement the Python class `AutoMLRun` described below. Class description: A library of automatic functions for managing models using MLRun's frameworks package. Method signatures and docstrings: - def _get_framework(model: CommonTypes.ModelType=None, model_path: str=None) -> Union[Tuple[str, dict]]: Try to get the f...
Implement the Python class `AutoMLRun` described below. Class description: A library of automatic functions for managing models using MLRun's frameworks package. Method signatures and docstrings: - def _get_framework(model: CommonTypes.ModelType=None, model_path: str=None) -> Union[Tuple[str, dict]]: Try to get the f...
b5fe0c05ae7f5818a4a5a5a40245c851ff9b2c77
<|skeleton|> class AutoMLRun: """A library of automatic functions for managing models using MLRun's frameworks package.""" def _get_framework(model: CommonTypes.ModelType=None, model_path: str=None) -> Union[Tuple[str, dict]]: """Try to get the framework from the model or model path provided. The frame...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AutoMLRun: """A library of automatic functions for managing models using MLRun's frameworks package.""" def _get_framework(model: CommonTypes.ModelType=None, model_path: str=None) -> Union[Tuple[str, dict]]: """Try to get the framework from the model or model path provided. The framework can be r...
the_stack_v2_python_sparse
mlrun/frameworks/auto_mlrun/auto_mlrun.py
mlrun/mlrun
train
1,093
940509c4b44b76042893e9e9e08161c547052fab
[ "if kwargs.get('username') is None:\n kwargs['username'] = git.GetProjectUserEmail(os.path.dirname(__file__))\nif kwargs.get('host') is None:\n kwargs['host'] = cros_build_lib.GetHostName(fully_qualified=True)\nfor attr in ('cmd_args', 'cmd_base', 'cmd_line'):\n val = kwargs.get(attr)\n if isinstance(va...
<|body_start_0|> if kwargs.get('username') is None: kwargs['username'] = git.GetProjectUserEmail(os.path.dirname(__file__)) if kwargs.get('host') is None: kwargs['host'] = cros_build_lib.GetHostName(fully_qualified=True) for attr in ('cmd_args', 'cmd_base', 'cmd_line'): ...
Entity object for a stats entry.
Stats
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference", "LGPL-2.0-or-later", "GPL-1.0-or-later", "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Stats: """Entity object for a stats entry.""" def __init__(self, **kwargs): """Initialize the record. **kwargs keys need to correspond to elements in __slots__. These arguments can be lists: - cmd_args - cmd_base - cmd_line If unset, the |username| and |host| attributes will be deter...
stack_v2_sparse_classes_36k_train_009223
6,553
permissive
[ { "docstring": "Initialize the record. **kwargs keys need to correspond to elements in __slots__. These arguments can be lists: - cmd_args - cmd_base - cmd_line If unset, the |username| and |host| attributes will be determined automatically.", "name": "__init__", "signature": "def __init__(self, **kwarg...
3
null
Implement the Python class `Stats` described below. Class description: Entity object for a stats entry. Method signatures and docstrings: - def __init__(self, **kwargs): Initialize the record. **kwargs keys need to correspond to elements in __slots__. These arguments can be lists: - cmd_args - cmd_base - cmd_line If ...
Implement the Python class `Stats` described below. Class description: Entity object for a stats entry. Method signatures and docstrings: - def __init__(self, **kwargs): Initialize the record. **kwargs keys need to correspond to elements in __slots__. These arguments can be lists: - cmd_args - cmd_base - cmd_line If ...
72a05af97787001756bae2511b7985e61498c965
<|skeleton|> class Stats: """Entity object for a stats entry.""" def __init__(self, **kwargs): """Initialize the record. **kwargs keys need to correspond to elements in __slots__. These arguments can be lists: - cmd_args - cmd_base - cmd_line If unset, the |username| and |host| attributes will be deter...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Stats: """Entity object for a stats entry.""" def __init__(self, **kwargs): """Initialize the record. **kwargs keys need to correspond to elements in __slots__. These arguments can be lists: - cmd_args - cmd_base - cmd_line If unset, the |username| and |host| attributes will be determined automat...
the_stack_v2_python_sparse
third_party/chromite/lib/stats.py
metux/chromium-suckless
train
5
ffc27843d222e28dec61943da71cf3dd35b75133
[ "install_cache_path = os.path.join(sublime.cache_path(), 'Rainmeter', 'install', 'last_entered_zip.cache')\nif os.path.exists(install_cache_path) and os.path.isfile(install_cache_path):\n with open(install_cache_path, 'r') as cache_handler:\n cache_content = cache_handler.read()\n default_path = ca...
<|body_start_0|> install_cache_path = os.path.join(sublime.cache_path(), 'Rainmeter', 'install', 'last_entered_zip.cache') if os.path.exists(install_cache_path) and os.path.isfile(install_cache_path): with open(install_cache_path, 'r') as cache_handler: cache_content = cache_...
Class extending the ApplicationCommand from ST3. Command string is rainmeter_install_skin_from_zip_command.
RainmeterInstallSkinFromZipCommand
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RainmeterInstallSkinFromZipCommand: """Class extending the ApplicationCommand from ST3. Command string is rainmeter_install_skin_from_zip_command.""" def run(self): """Automatically executed upon calling this command.""" <|body_0|> def __on_zip_path_entered(cls, path): ...
stack_v2_sparse_classes_36k_train_009224
11,700
permissive
[ { "docstring": "Automatically executed upon calling this command.", "name": "run", "signature": "def run(self)" }, { "docstring": "Executed after a zip path is entered.", "name": "__on_zip_path_entered", "signature": "def __on_zip_path_entered(cls, path)" } ]
2
stack_v2_sparse_classes_30k_train_012091
Implement the Python class `RainmeterInstallSkinFromZipCommand` described below. Class description: Class extending the ApplicationCommand from ST3. Command string is rainmeter_install_skin_from_zip_command. Method signatures and docstrings: - def run(self): Automatically executed upon calling this command. - def __o...
Implement the Python class `RainmeterInstallSkinFromZipCommand` described below. Class description: Class extending the ApplicationCommand from ST3. Command string is rainmeter_install_skin_from_zip_command. Method signatures and docstrings: - def run(self): Automatically executed upon calling this command. - def __o...
89d67adfd0ef196360785aa2aedecb693f71e965
<|skeleton|> class RainmeterInstallSkinFromZipCommand: """Class extending the ApplicationCommand from ST3. Command string is rainmeter_install_skin_from_zip_command.""" def run(self): """Automatically executed upon calling this command.""" <|body_0|> def __on_zip_path_entered(cls, path): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RainmeterInstallSkinFromZipCommand: """Class extending the ApplicationCommand from ST3. Command string is rainmeter_install_skin_from_zip_command.""" def run(self): """Automatically executed upon calling this command.""" install_cache_path = os.path.join(sublime.cache_path(), 'Rainmeter',...
the_stack_v2_python_sparse
install_skin.py
thatsIch/sublime-rainmeter
train
62
b2c8849b114ffbfe4722b43a1884203fb935c767
[ "self._use_category_for_mask = use_category_for_mask\nself._mask_num_classes = num_classes if use_category_for_mask else 1\nself._num_downsample_channels = num_downsample_channels\nself._mask_crop_size = mask_crop_size\nself._num_convs = num_convs\nself.up_sample_factor = upsample_factor\nself._batch_norm_activatio...
<|body_start_0|> self._use_category_for_mask = use_category_for_mask self._mask_num_classes = num_classes if use_category_for_mask else 1 self._num_downsample_channels = num_downsample_channels self._mask_crop_size = mask_crop_size self._num_convs = num_convs self.up_samp...
ShapemaskFinemaskHead head.
ShapemaskFinemaskHead
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ShapemaskFinemaskHead: """ShapemaskFinemaskHead head.""" def __init__(self, num_classes, num_downsample_channels, mask_crop_size, use_category_for_mask, num_convs, upsample_factor, batch_norm_activation): """Initialize params to build ShapeMask coarse and fine prediction head. Args: ...
stack_v2_sparse_classes_36k_train_009225
46,218
permissive
[ { "docstring": "Initialize params to build ShapeMask coarse and fine prediction head. Args: num_classes: `int` number of mask classification categories. num_downsample_channels: `int` number of filters at mask head. mask_crop_size: feature crop size. use_category_for_mask: use class information in mask branch. ...
3
null
Implement the Python class `ShapemaskFinemaskHead` described below. Class description: ShapemaskFinemaskHead head. Method signatures and docstrings: - def __init__(self, num_classes, num_downsample_channels, mask_crop_size, use_category_for_mask, num_convs, upsample_factor, batch_norm_activation): Initialize params t...
Implement the Python class `ShapemaskFinemaskHead` described below. Class description: ShapemaskFinemaskHead head. Method signatures and docstrings: - def __init__(self, num_classes, num_downsample_channels, mask_crop_size, use_category_for_mask, num_convs, upsample_factor, batch_norm_activation): Initialize params t...
0f7adb97a93ec3e3485c261d030c507eb16b33e4
<|skeleton|> class ShapemaskFinemaskHead: """ShapemaskFinemaskHead head.""" def __init__(self, num_classes, num_downsample_channels, mask_crop_size, use_category_for_mask, num_convs, upsample_factor, batch_norm_activation): """Initialize params to build ShapeMask coarse and fine prediction head. Args: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ShapemaskFinemaskHead: """ShapemaskFinemaskHead head.""" def __init__(self, num_classes, num_downsample_channels, mask_crop_size, use_category_for_mask, num_convs, upsample_factor, batch_norm_activation): """Initialize params to build ShapeMask coarse and fine prediction head. Args: num_classes: ...
the_stack_v2_python_sparse
models/official/detection/modeling/architecture/heads.py
tensorflow/tpu
train
5,627
01eca0394e98fe1af866e70bef42c63924e1a41d
[ "uuid = str(uuid).replace('-', '')\norchestration_driver.init()\ndata = orchestration_driver.PipelineManager.get_pipelines(moon_user_id=authed_user, pipeline_id=uuid)\nreturn {'pipelines': data}", "uuid = str(uuid).replace('-', '')\norchestration_driver.init()\ndata = orchestration_driver.PipelineManager.add_pipe...
<|body_start_0|> uuid = str(uuid).replace('-', '') orchestration_driver.init() data = orchestration_driver.PipelineManager.get_pipelines(moon_user_id=authed_user, pipeline_id=uuid) return {'pipelines': data} <|end_body_0|> <|body_start_1|> uuid = str(uuid).replace('-', '') ...
Endpoint for pipelines requests
Pipeline
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Pipeline: """Endpoint for pipelines requests""" def get(uuid: hug.types.uuid=None, authed_user: hug.directives.user=None): """Retrieve all pipelines :param uuid: uuid of the pipeline :param authed_user: the name of the authenticated user :return: { "pipeline_id1": { "name": "...", "d...
stack_v2_sparse_classes_36k_train_009226
3,805
permissive
[ { "docstring": "Retrieve all pipelines :param uuid: uuid of the pipeline :param authed_user: the name of the authenticated user :return: { \"pipeline_id1\": { \"name\": \"...\", \"description\": \"... (optional)\", } }", "name": "get", "signature": "def get(uuid: hug.types.uuid=None, authed_user: hug.di...
3
null
Implement the Python class `Pipeline` described below. Class description: Endpoint for pipelines requests Method signatures and docstrings: - def get(uuid: hug.types.uuid=None, authed_user: hug.directives.user=None): Retrieve all pipelines :param uuid: uuid of the pipeline :param authed_user: the name of the authenti...
Implement the Python class `Pipeline` described below. Class description: Endpoint for pipelines requests Method signatures and docstrings: - def get(uuid: hug.types.uuid=None, authed_user: hug.directives.user=None): Retrieve all pipelines :param uuid: uuid of the pipeline :param authed_user: the name of the authenti...
7bb53c64da2dcf88894bfd31503accdd81498f3d
<|skeleton|> class Pipeline: """Endpoint for pipelines requests""" def get(uuid: hug.types.uuid=None, authed_user: hug.directives.user=None): """Retrieve all pipelines :param uuid: uuid of the pipeline :param authed_user: the name of the authenticated user :return: { "pipeline_id1": { "name": "...", "d...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Pipeline: """Endpoint for pipelines requests""" def get(uuid: hug.types.uuid=None, authed_user: hug.directives.user=None): """Retrieve all pipelines :param uuid: uuid of the pipeline :param authed_user: the name of the authenticated user :return: { "pipeline_id1": { "name": "...", "description": ...
the_stack_v2_python_sparse
moon_engine/moon_engine/api/wrapper/api/pipeline.py
opnfv/moon
train
3
536563c680f65385764d84e0b2d0b534c5a77ed1
[ "self.father = father\nself.row = row\nself.column = column\nself.h = distance((row, column), (target_pos[0], target_pos[1]))\nif not father:\n self.g = 0\nelse:\n self.g = self.father.g + values[map[row][column]]\nself.f = self.h + self.g", "result = ''\nresult += 'Fila: ' + str(self.row)\nresult += ' Colu...
<|body_start_0|> self.father = father self.row = row self.column = column self.h = distance((row, column), (target_pos[0], target_pos[1])) if not father: self.g = 0 else: self.g = self.father.g + values[map[row][column]] self.f = self.h + s...
@brief Representa un nodo(posible estado) en el A*
Nodo
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Nodo: """@brief Representa un nodo(posible estado) en el A*""" def __init__(self, row, column, target_pos, father=None): """@brief Constructor @param row Fila del nodo en el mapa @param column Columna del nodo en el mapa @param target_pos Posicion del objetivo al que se desea llegar....
stack_v2_sparse_classes_36k_train_009227
9,806
no_license
[ { "docstring": "@brief Constructor @param row Fila del nodo en el mapa @param column Columna del nodo en el mapa @param target_pos Posicion del objetivo al que se desea llegar. @param father Nodo padre, None por defecto", "name": "__init__", "signature": "def __init__(self, row, column, target_pos, fath...
2
stack_v2_sparse_classes_30k_train_000004
Implement the Python class `Nodo` described below. Class description: @brief Representa un nodo(posible estado) en el A* Method signatures and docstrings: - def __init__(self, row, column, target_pos, father=None): @brief Constructor @param row Fila del nodo en el mapa @param column Columna del nodo en el mapa @param...
Implement the Python class `Nodo` described below. Class description: @brief Representa un nodo(posible estado) en el A* Method signatures and docstrings: - def __init__(self, row, column, target_pos, father=None): @brief Constructor @param row Fila del nodo en el mapa @param column Columna del nodo en el mapa @param...
994a5ca9b464c9e11de96d50079503743a0035fc
<|skeleton|> class Nodo: """@brief Representa un nodo(posible estado) en el A*""" def __init__(self, row, column, target_pos, father=None): """@brief Constructor @param row Fila del nodo en el mapa @param column Columna del nodo en el mapa @param target_pos Posicion del objetivo al que se desea llegar....
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Nodo: """@brief Representa un nodo(posible estado) en el A*""" def __init__(self, row, column, target_pos, father=None): """@brief Constructor @param row Fila del nodo en el mapa @param column Columna del nodo en el mapa @param target_pos Posicion del objetivo al que se desea llegar. @param fathe...
the_stack_v2_python_sparse
engine/astar.py
jmarente/zycars
train
0
86b4d576315d9603c2b98d08eb40655ff2e2695b
[ "if self.default:\n if not self.value:\n self.value = self.default\nelif not self.default and self.required:\n raise ValidationError('Required.')\nif type(self.value) is dict:\n try:\n json.dumps(self.value)\n except TypeError:\n raise ValidationError('Value must be a valid JSON dic...
<|body_start_0|> if self.default: if not self.value: self.value = self.default elif not self.default and self.required: raise ValidationError('Required.') if type(self.value) is dict: try: json.dumps(self.value) exce...
Used to define a Custom Json Setting. Attributes: name(str): Unique name used to identify the setting. description(str): Short description of the setting. required(bool): A value will be required if True. default(str): Value as a string that may be provided as a default. **Example:** :: from tethys_sdk.app_settings imp...
JSONCustomSetting
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JSONCustomSetting: """Used to define a Custom Json Setting. Attributes: name(str): Unique name used to identify the setting. description(str): Short description of the setting. required(bool): A value will be required if True. default(str): Value as a string that may be provided as a default. **E...
stack_v2_sparse_classes_36k_train_009228
45,827
permissive
[ { "docstring": "Validate prior to saving changes.", "name": "clean", "signature": "def clean(self)" }, { "docstring": "Get the value", "name": "get_value", "signature": "def get_value(self)" } ]
2
stack_v2_sparse_classes_30k_val_000516
Implement the Python class `JSONCustomSetting` described below. Class description: Used to define a Custom Json Setting. Attributes: name(str): Unique name used to identify the setting. description(str): Short description of the setting. required(bool): A value will be required if True. default(str): Value as a string...
Implement the Python class `JSONCustomSetting` described below. Class description: Used to define a Custom Json Setting. Attributes: name(str): Unique name used to identify the setting. description(str): Short description of the setting. required(bool): A value will be required if True. default(str): Value as a string...
e9365fa55ec25d7658a75ca7fb0632013374d876
<|skeleton|> class JSONCustomSetting: """Used to define a Custom Json Setting. Attributes: name(str): Unique name used to identify the setting. description(str): Short description of the setting. required(bool): A value will be required if True. default(str): Value as a string that may be provided as a default. **E...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class JSONCustomSetting: """Used to define a Custom Json Setting. Attributes: name(str): Unique name used to identify the setting. description(str): Short description of the setting. required(bool): A value will be required if True. default(str): Value as a string that may be provided as a default. **Example:** :: ...
the_stack_v2_python_sparse
tethys_apps/models.py
tethysplatform/tethys
train
95
9bc991fe583a01460701d2176a8083bcf2b5f7ab
[ "left = 0\nright = len(nums)\nwhile left < right:\n mid = (left + right) // 2\n if mid - 1 < 0:\n l_value = -2 ** 31\n else:\n l_value = nums[mid - 1]\n if mid + 1 >= len(nums):\n r_value = -2 ** 31\n else:\n r_value = nums[mid + 1]\n if nums[mid] > l_value and nums[mid...
<|body_start_0|> left = 0 right = len(nums) while left < right: mid = (left + right) // 2 if mid - 1 < 0: l_value = -2 ** 31 else: l_value = nums[mid - 1] if mid + 1 >= len(nums): r_value = -2 ** 31 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findPeakElement_myself(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def findPeakElement_v2(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> def findPeakElement(self, nums): """:type nums: List[int] ...
stack_v2_sparse_classes_36k_train_009229
5,191
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "findPeakElement_myself", "signature": "def findPeakElement_myself(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "findPeakElement_v2", "signature": "def findPeakElement_v2(self, nums)" }, { ...
3
stack_v2_sparse_classes_30k_train_018371
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findPeakElement_myself(self, nums): :type nums: List[int] :rtype: int - def findPeakElement_v2(self, nums): :type nums: List[int] :rtype: int - def findPeakElement(self, nums...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findPeakElement_myself(self, nums): :type nums: List[int] :rtype: int - def findPeakElement_v2(self, nums): :type nums: List[int] :rtype: int - def findPeakElement(self, nums...
93266095329e2e8e949a72371b88b07382a60e0d
<|skeleton|> class Solution: def findPeakElement_myself(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def findPeakElement_v2(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> def findPeakElement(self, nums): """:type nums: List[int] ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findPeakElement_myself(self, nums): """:type nums: List[int] :rtype: int""" left = 0 right = len(nums) while left < right: mid = (left + right) // 2 if mid - 1 < 0: l_value = -2 ** 31 else: l_valu...
the_stack_v2_python_sparse
findPeakElement.py
shivangi-prog/leetcode
train
0
171c5f8dc3851fa3920ebfe5e46e91fc19397e02
[ "binX = bin(x)[2:].rjust(32, '0')\nbinY = bin(y)[2:].rjust(32, '0')\ndistance = 0\nfor i in range(len(binX)):\n if binX[i] != binY[i]:\n distance += 1\nreturn distance", "x = x ^ y\ny = 0\nwhile x:\n y += 1\n x &= x - 1\nreturn y" ]
<|body_start_0|> binX = bin(x)[2:].rjust(32, '0') binY = bin(y)[2:].rjust(32, '0') distance = 0 for i in range(len(binX)): if binX[i] != binY[i]: distance += 1 return distance <|end_body_0|> <|body_start_1|> x = x ^ y y = 0 whi...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def hammingDistance(self, x, y): """:type x: int :type y: int :rtype: int""" <|body_0|> def hammingDistanceBest(self, x, y): """:type x: int :type y: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> binX = bin(x)[2:].rjust(3...
stack_v2_sparse_classes_36k_train_009230
1,170
no_license
[ { "docstring": ":type x: int :type y: int :rtype: int", "name": "hammingDistance", "signature": "def hammingDistance(self, x, y)" }, { "docstring": ":type x: int :type y: int :rtype: int", "name": "hammingDistanceBest", "signature": "def hammingDistanceBest(self, x, y)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hammingDistance(self, x, y): :type x: int :type y: int :rtype: int - def hammingDistanceBest(self, x, y): :type x: int :type y: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hammingDistance(self, x, y): :type x: int :type y: int :rtype: int - def hammingDistanceBest(self, x, y): :type x: int :type y: int :rtype: int <|skeleton|> class Solution: ...
0743cbeb0e9aa4a8a25f4520a1e3f92793fae1ee
<|skeleton|> class Solution: def hammingDistance(self, x, y): """:type x: int :type y: int :rtype: int""" <|body_0|> def hammingDistanceBest(self, x, y): """:type x: int :type y: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def hammingDistance(self, x, y): """:type x: int :type y: int :rtype: int""" binX = bin(x)[2:].rjust(32, '0') binY = bin(y)[2:].rjust(32, '0') distance = 0 for i in range(len(binX)): if binX[i] != binY[i]: distance += 1 retu...
the_stack_v2_python_sparse
practice/leetcode/algorithm/461_HammingDistance.py
aliceayres/leetcode-practice
train
0
5ee3eeb6f8f4704e64c30e68ded2d75eaa9585af
[ "if len(matrix) <= 1:\n return\nfor i in range(len(matrix)):\n for j in range(i + 1, len(matrix)):\n matrix[i][j], matrix[j][i] = (matrix[j][i], matrix[i][j])\nfor k in range(len(matrix)):\n matrix[k] = matrix[k][::-1]", "if len(matrix) <= 1:\n return\nfor i in range(len(matrix)):\n for j in...
<|body_start_0|> if len(matrix) <= 1: return for i in range(len(matrix)): for j in range(i + 1, len(matrix)): matrix[i][j], matrix[j][i] = (matrix[j][i], matrix[i][j]) for k in range(len(matrix)): matrix[k] = matrix[k][::-1] <|end_body_0|> <|b...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def rotate(self, matrix): """:type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.""" <|body_0|> def rotate1(self, matrix): """:type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-p...
stack_v2_sparse_classes_36k_train_009231
918
no_license
[ { "docstring": ":type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.", "name": "rotate", "signature": "def rotate(self, matrix)" }, { "docstring": ":type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.", ...
2
stack_v2_sparse_classes_30k_train_000651
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rotate(self, matrix): :type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead. - def rotate1(self, matrix): :type matrix: List[List[...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rotate(self, matrix): :type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead. - def rotate1(self, matrix): :type matrix: List[List[...
b8ec1350e904665f1375c29a53f443ecf262d723
<|skeleton|> class Solution: def rotate(self, matrix): """:type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.""" <|body_0|> def rotate1(self, matrix): """:type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-p...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def rotate(self, matrix): """:type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.""" if len(matrix) <= 1: return for i in range(len(matrix)): for j in range(i + 1, len(matrix)): matrix[i][j]...
the_stack_v2_python_sparse
leetcode/048旋转图像.py
ShawDa/Coding
train
0
1e9265aeb881ff02b9d5435fff1c45af5f9b0a99
[ "group_id = self.kwargs.get('group_id')\nqueryset = Image.popular.with_user(self.request.user).filter(message__thread__group__pk=group_id)\nreturn queryset", "context = super(GroupImagesView, self).get_context_data(**kwargs)\ncontext['group'] = get_object_or_404(Group, pk=self.kwargs.get('group_id'))\nreturn cont...
<|body_start_0|> group_id = self.kwargs.get('group_id') queryset = Image.popular.with_user(self.request.user).filter(message__thread__group__pk=group_id) return queryset <|end_body_0|> <|body_start_1|> context = super(GroupImagesView, self).get_context_data(**kwargs) context['gr...
View for listing GroupImages.
GroupImagesView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GroupImagesView: """View for listing GroupImages.""" def get_queryset(self): """Update queryset to include images a user should have access to.""" <|body_0|> def get_context_data(self, **kwargs): """Add the group to the context.""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_36k_train_009232
19,778
permissive
[ { "docstring": "Update queryset to include images a user should have access to.", "name": "get_queryset", "signature": "def get_queryset(self)" }, { "docstring": "Add the group to the context.", "name": "get_context_data", "signature": "def get_context_data(self, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_val_000082
Implement the Python class `GroupImagesView` described below. Class description: View for listing GroupImages. Method signatures and docstrings: - def get_queryset(self): Update queryset to include images a user should have access to. - def get_context_data(self, **kwargs): Add the group to the context.
Implement the Python class `GroupImagesView` described below. Class description: View for listing GroupImages. Method signatures and docstrings: - def get_queryset(self): Update queryset to include images a user should have access to. - def get_context_data(self, **kwargs): Add the group to the context. <|skeleton|>...
a56c0f89df82694bf5db32a04d8b092974791972
<|skeleton|> class GroupImagesView: """View for listing GroupImages.""" def get_queryset(self): """Update queryset to include images a user should have access to.""" <|body_0|> def get_context_data(self, **kwargs): """Add the group to the context.""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GroupImagesView: """View for listing GroupImages.""" def get_queryset(self): """Update queryset to include images a user should have access to.""" group_id = self.kwargs.get('group_id') queryset = Image.popular.with_user(self.request.user).filter(message__thread__group__pk=group_i...
the_stack_v2_python_sparse
open_connect/groups/views.py
ofa/connect
train
66
57ee792fba949c7f1cec1d49ca96453921457358
[ "from utils.models import Departamento\niddpto = self.dpto\ndpto = Departamento.objects.get(pk=iddpto)\nreturn dpto.descripcion", "from utils.models import Provincia\nidprov = self.provincia\nprov = Provincia.objects.get(pk=idprov)\nreturn prov.descripcion", "from utils.models import Distrito\niddis = self.dist...
<|body_start_0|> from utils.models import Departamento iddpto = self.dpto dpto = Departamento.objects.get(pk=iddpto) return dpto.descripcion <|end_body_0|> <|body_start_1|> from utils.models import Provincia idprov = self.provincia prov = Provincia.objects.get(pk...
Clase para hacer referencia a las direcciones
Direccion
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Direccion: """Clase para hacer referencia a las direcciones""" def get_departamento(self): """Método que retorna la descripción del Departamento :return: Descripción del catalogo Departamento""" <|body_0|> def get_provincia(self): """Método que retorna la descrip...
stack_v2_sparse_classes_36k_train_009233
24,021
permissive
[ { "docstring": "Método que retorna la descripción del Departamento :return: Descripción del catalogo Departamento", "name": "get_departamento", "signature": "def get_departamento(self)" }, { "docstring": "Método que retorna la descripción del Provincia :return: Descripción del catalogo Provincia...
3
stack_v2_sparse_classes_30k_train_002789
Implement the Python class `Direccion` described below. Class description: Clase para hacer referencia a las direcciones Method signatures and docstrings: - def get_departamento(self): Método que retorna la descripción del Departamento :return: Descripción del catalogo Departamento - def get_provincia(self): Método q...
Implement the Python class `Direccion` described below. Class description: Clase para hacer referencia a las direcciones Method signatures and docstrings: - def get_departamento(self): Método que retorna la descripción del Departamento :return: Descripción del catalogo Departamento - def get_provincia(self): Método q...
573e9e4006c0d1cd33190b53da5988fdc0c9ca4c
<|skeleton|> class Direccion: """Clase para hacer referencia a las direcciones""" def get_departamento(self): """Método que retorna la descripción del Departamento :return: Descripción del catalogo Departamento""" <|body_0|> def get_provincia(self): """Método que retorna la descrip...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Direccion: """Clase para hacer referencia a las direcciones""" def get_departamento(self): """Método que retorna la descripción del Departamento :return: Descripción del catalogo Departamento""" from utils.models import Departamento iddpto = self.dpto dpto = Departamento.o...
the_stack_v2_python_sparse
src/register/models.py
furthz/colegio
train
2
09222643100a3693261a4aa64611fff7bd981946
[ "user = User.objects.get(id=self.request.user.id)\ngroup_post = Post.objects.filter(target_type=ContentType.objects.get(model='group', app_label='group').id, target_id__in=GroupMember.objects.filter(user=user).values('group_id'))\nevent_post = Post.objects.filter(target_type=ContentType.objects.get(model='event').i...
<|body_start_0|> user = User.objects.get(id=self.request.user.id) group_post = Post.objects.filter(target_type=ContentType.objects.get(model='group', app_label='group').id, target_id__in=GroupMember.objects.filter(user=user).values('group_id')) event_post = Post.objects.filter(target_type=Conten...
This class is an API for geting newsfeed posts list.
PostViewList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PostViewList: """This class is an API for geting newsfeed posts list.""" def get(self, request, format=None, limit=20): """Get a list of newsfeed post. Args: request: Django Rest Framework request object. format: pattern for Web APIs. limit: number of post in list. Return: List of la...
stack_v2_sparse_classes_36k_train_009234
17,464
no_license
[ { "docstring": "Get a list of newsfeed post. Args: request: Django Rest Framework request object. format: pattern for Web APIs. limit: number of post in list. Return: List of last #limit post in database.", "name": "get", "signature": "def get(self, request, format=None, limit=20)" }, { "docstri...
2
stack_v2_sparse_classes_30k_test_001139
Implement the Python class `PostViewList` described below. Class description: This class is an API for geting newsfeed posts list. Method signatures and docstrings: - def get(self, request, format=None, limit=20): Get a list of newsfeed post. Args: request: Django Rest Framework request object. format: pattern for We...
Implement the Python class `PostViewList` described below. Class description: This class is an API for geting newsfeed posts list. Method signatures and docstrings: - def get(self, request, format=None, limit=20): Get a list of newsfeed post. Args: request: Django Rest Framework request object. format: pattern for We...
1d01b8133669208cdd35d4aa61a41521ecd52720
<|skeleton|> class PostViewList: """This class is an API for geting newsfeed posts list.""" def get(self, request, format=None, limit=20): """Get a list of newsfeed post. Args: request: Django Rest Framework request object. format: pattern for Web APIs. limit: number of post in list. Return: List of la...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PostViewList: """This class is an API for geting newsfeed posts list.""" def get(self, request, format=None, limit=20): """Get a list of newsfeed post. Args: request: Django Rest Framework request object. format: pattern for Web APIs. limit: number of post in list. Return: List of last #limit pos...
the_stack_v2_python_sparse
newsfeed/views.py
whsatku/social
train
10
c76ce85112c52bafde6e529ee6819b36ee420489
[ "if site is None:\n site = pywikibot.Site()\nself.site = site\nself.opts = self.buildQuery(categories, subset_combination, namespaces, extra_options)", "extra_options = extra_options or {}\nquery = {'language': self.site.code, 'project': self.site.hostname().split('.')[-2], 'combination': 'subset' if subset_co...
<|body_start_0|> if site is None: site = pywikibot.Site() self.site = site self.opts = self.buildQuery(categories, subset_combination, namespaces, extra_options) <|end_body_0|> <|body_start_1|> extra_options = extra_options or {} query = {'language': self.site.code, ...
Queries PetScan to generate pages. .. seealso:: https://petscan.wmflabs.org/ .. versionadded:: 3.0 .. versionchanged:: 7.6 subclassed from :class:`tools.collections.GeneratorWrapper`
PetScanPageGenerator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PetScanPageGenerator: """Queries PetScan to generate pages. .. seealso:: https://petscan.wmflabs.org/ .. versionadded:: 3.0 .. versionchanged:: 7.6 subclassed from :class:`tools.collections.GeneratorWrapper`""" def __init__(self, categories: Sequence[str], subset_combination: bool=True, name...
stack_v2_sparse_classes_36k_train_009235
43,909
permissive
[ { "docstring": "Initializer. :param categories: List of category names to retrieve pages from :param subset_combination: Combination mode. If True, returns the intersection of the results of the categories, else returns the union of the results of the categories :param namespaces: List of namespaces to search i...
4
null
Implement the Python class `PetScanPageGenerator` described below. Class description: Queries PetScan to generate pages. .. seealso:: https://petscan.wmflabs.org/ .. versionadded:: 3.0 .. versionchanged:: 7.6 subclassed from :class:`tools.collections.GeneratorWrapper` Method signatures and docstrings: - def __init__(...
Implement the Python class `PetScanPageGenerator` described below. Class description: Queries PetScan to generate pages. .. seealso:: https://petscan.wmflabs.org/ .. versionadded:: 3.0 .. versionchanged:: 7.6 subclassed from :class:`tools.collections.GeneratorWrapper` Method signatures and docstrings: - def __init__(...
5c01e6bfcd328bc6eae643e661f1a0ae57612808
<|skeleton|> class PetScanPageGenerator: """Queries PetScan to generate pages. .. seealso:: https://petscan.wmflabs.org/ .. versionadded:: 3.0 .. versionchanged:: 7.6 subclassed from :class:`tools.collections.GeneratorWrapper`""" def __init__(self, categories: Sequence[str], subset_combination: bool=True, name...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PetScanPageGenerator: """Queries PetScan to generate pages. .. seealso:: https://petscan.wmflabs.org/ .. versionadded:: 3.0 .. versionchanged:: 7.6 subclassed from :class:`tools.collections.GeneratorWrapper`""" def __init__(self, categories: Sequence[str], subset_combination: bool=True, namespaces: Optio...
the_stack_v2_python_sparse
pywikibot/pagegenerators/_generators.py
wikimedia/pywikibot
train
432
0ace549fed70054fb9e78cb643cfd600e3a13237
[ "handlers = [('/plot', PlotHandler, {'appRef': self})]\nsettings = {'xsrf_cookies': False, 'debug': True}\nself.plotters = []\nsuper(WebDisplayServer, self).__init__(handlers, **settings)", "wsport = getFreePort()\nplotter = WebPlotter(dataReader, wsport, initParams)\nplotter.start()\nself.plotters.append((plotte...
<|body_start_0|> handlers = [('/plot', PlotHandler, {'appRef': self})] settings = {'xsrf_cookies': False, 'debug': True} self.plotters = [] super(WebDisplayServer, self).__init__(handlers, **settings) <|end_body_0|> <|body_start_1|> wsport = getFreePort() plotter = WebPl...
WebDisplayServer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WebDisplayServer: def __init__(self): """Initialize a web display server""" <|body_0|> def addPlotter(self, dataReader, initParams: dict): """Add another plotter to the server The web display server will create a free port used for interaction between the front end c...
stack_v2_sparse_classes_36k_train_009236
5,833
no_license
[ { "docstring": "Initialize a web display server", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Add another plotter to the server The web display server will create a free port used for interaction between the front end client and the web plotter. The web plotter will ...
2
stack_v2_sparse_classes_30k_train_016605
Implement the Python class `WebDisplayServer` described below. Class description: Implement the WebDisplayServer class. Method signatures and docstrings: - def __init__(self): Initialize a web display server - def addPlotter(self, dataReader, initParams: dict): Add another plotter to the server The web display server...
Implement the Python class `WebDisplayServer` described below. Class description: Implement the WebDisplayServer class. Method signatures and docstrings: - def __init__(self): Initialize a web display server - def addPlotter(self, dataReader, initParams: dict): Add another plotter to the server The web display server...
52d1f867e72c0ac37a309b087824a8d878168374
<|skeleton|> class WebDisplayServer: def __init__(self): """Initialize a web display server""" <|body_0|> def addPlotter(self, dataReader, initParams: dict): """Add another plotter to the server The web display server will create a free port used for interaction between the front end c...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WebDisplayServer: def __init__(self): """Initialize a web display server""" handlers = [('/plot', PlotHandler, {'appRef': self})] settings = {'xsrf_cookies': False, 'debug': True} self.plotters = [] super(WebDisplayServer, self).__init__(handlers, **settings) def a...
the_stack_v2_python_sparse
displayserver.py
xttjsn/tradingshell
train
1
77e2a803b0a6e1fb022dcef50feb00c90d16e888
[ "func_args = locals()\nfunc_inspect = inspect.getfullargspec(self.get_number_agents).args\nfunc_inspect.remove('self')\nfunc_args = {key: value for key, value in func_args.items() if key in func_inspect and value is not None}\n\ndef func(interval: int, volume: float, dialing_time: float, aht_correct: int, aht_wrong...
<|body_start_0|> func_args = locals() func_inspect = inspect.getfullargspec(self.get_number_agents).args func_inspect.remove('self') func_args = {key: value for key, value in func_args.items() if key in func_inspect and value is not None} def func(interval: int, volume: float, d...
OutboundPhoneController
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OutboundPhoneController: def get_number_agents(self, interval: IntList, volume: FloatList, dialing_time: IntList, aht_correct: IntList, aht_wrong: IntList, netto_contact_rate: FloatList, right_person_contact_rate: FloatList) -> FloatList: """calculates the number of agents that are requi...
stack_v2_sparse_classes_36k_train_009237
4,965
no_license
[ { "docstring": "calculates the number of agents that are required to hit the specified values :param interval: interval in seconds, that you want to observe :param volume: the number of contacts in that interval :param dialing_time: number of seconds that are used for dialing :param aht_correct: the average han...
2
stack_v2_sparse_classes_30k_train_000187
Implement the Python class `OutboundPhoneController` described below. Class description: Implement the OutboundPhoneController class. Method signatures and docstrings: - def get_number_agents(self, interval: IntList, volume: FloatList, dialing_time: IntList, aht_correct: IntList, aht_wrong: IntList, netto_contact_rat...
Implement the Python class `OutboundPhoneController` described below. Class description: Implement the OutboundPhoneController class. Method signatures and docstrings: - def get_number_agents(self, interval: IntList, volume: FloatList, dialing_time: IntList, aht_correct: IntList, aht_wrong: IntList, netto_contact_rat...
09ff583831aa7f8b604f01dc97cf0284ed342f77
<|skeleton|> class OutboundPhoneController: def get_number_agents(self, interval: IntList, volume: FloatList, dialing_time: IntList, aht_correct: IntList, aht_wrong: IntList, netto_contact_rate: FloatList, right_person_contact_rate: FloatList) -> FloatList: """calculates the number of agents that are requi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OutboundPhoneController: def get_number_agents(self, interval: IntList, volume: FloatList, dialing_time: IntList, aht_correct: IntList, aht_wrong: IntList, netto_contact_rate: FloatList, right_person_contact_rate: FloatList) -> FloatList: """calculates the number of agents that are required to hit the...
the_stack_v2_python_sparse
src/controller/capacity_planning/single_skill/outbound_phone.py
FelixKleineBoesing/queuingSystem
train
0
022513e06de38bc45441ce79e5269fa1cb3ce05e
[ "bal = await wallet.get(user)\nif bal < amount:\n raise error.NEMU\nelif bal == 0:\n raise error.FAIL\nawait wallet.remove(user, amount)\nawait bank.add(user, amount)", "bal = await bank.get(user)\nif bal < amount:\n raise error.NEMU\nelif bal == 0:\n raise error.FAIL\nawait bank.remove(user, amount)\...
<|body_start_0|> bal = await wallet.get(user) if bal < amount: raise error.NEMU elif bal == 0: raise error.FAIL await wallet.remove(user, amount) await bank.add(user, amount) <|end_body_0|> <|body_start_1|> bal = await bank.get(user) if ba...
Eco
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Eco: async def deposit(self, user, amount): """Deposits money from somebody's wallet to their bank.""" <|body_0|> async def withdraw(self, user, amount): """Withdraws money from somebody's bank to their wallet.""" <|body_1|> async def rob(self, user, tar...
stack_v2_sparse_classes_36k_train_009238
5,807
no_license
[ { "docstring": "Deposits money from somebody's wallet to their bank.", "name": "deposit", "signature": "async def deposit(self, user, amount)" }, { "docstring": "Withdraws money from somebody's bank to their wallet.", "name": "withdraw", "signature": "async def withdraw(self, user, amoun...
4
stack_v2_sparse_classes_30k_val_000997
Implement the Python class `Eco` described below. Class description: Implement the Eco class. Method signatures and docstrings: - async def deposit(self, user, amount): Deposits money from somebody's wallet to their bank. - async def withdraw(self, user, amount): Withdraws money from somebody's bank to their wallet. ...
Implement the Python class `Eco` described below. Class description: Implement the Eco class. Method signatures and docstrings: - async def deposit(self, user, amount): Deposits money from somebody's wallet to their bank. - async def withdraw(self, user, amount): Withdraws money from somebody's bank to their wallet. ...
3d075c516124d3a25feebd584fdc351c3abc6613
<|skeleton|> class Eco: async def deposit(self, user, amount): """Deposits money from somebody's wallet to their bank.""" <|body_0|> async def withdraw(self, user, amount): """Withdraws money from somebody's bank to their wallet.""" <|body_1|> async def rob(self, user, tar...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Eco: async def deposit(self, user, amount): """Deposits money from somebody's wallet to their bank.""" bal = await wallet.get(user) if bal < amount: raise error.NEMU elif bal == 0: raise error.FAIL await wallet.remove(user, amount) await ...
the_stack_v2_python_sparse
core/EcoCore.py
Smudge-Studios/smudge
train
0
eb99ccc2e8cefce621198e1d43cee86db5ef1454
[ "hotel = self.request.user.get_hotel()\nqueryset = HotelEquipmentItem.objects.filter(hotel_id=hotel.id)\nreturn queryset", "hotel = request.user.get_hotel()\nsections = EquipmentSection.objects.all()\nserializer = HotelEquipmentSections(sections, many=True, context={'hotel_id': hotel.id})\nreturn Response(seriali...
<|body_start_0|> hotel = self.request.user.get_hotel() queryset = HotelEquipmentItem.objects.filter(hotel_id=hotel.id) return queryset <|end_body_0|> <|body_start_1|> hotel = request.user.get_hotel() sections = EquipmentSection.objects.all() serializer = HotelEquipmentSe...
API for working with hotel facilities (HotelEquipment)
HotelEquipmentViewSet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HotelEquipmentViewSet: """API for working with hotel facilities (HotelEquipment)""" def get_queryset(self): """Receive information related only to the current user's hotel :return:""" <|body_0|> def list(self, request, *args, **kwargs): """Getting a list of the e...
stack_v2_sparse_classes_36k_train_009239
7,291
no_license
[ { "docstring": "Receive information related only to the current user's hotel :return:", "name": "get_queryset", "signature": "def get_queryset(self)" }, { "docstring": "Getting a list of the equipment of the hotel, grouped by type :return:", "name": "list", "signature": "def list(self, r...
2
null
Implement the Python class `HotelEquipmentViewSet` described below. Class description: API for working with hotel facilities (HotelEquipment) Method signatures and docstrings: - def get_queryset(self): Receive information related only to the current user's hotel :return: - def list(self, request, *args, **kwargs): Ge...
Implement the Python class `HotelEquipmentViewSet` described below. Class description: API for working with hotel facilities (HotelEquipment) Method signatures and docstrings: - def get_queryset(self): Receive information related only to the current user's hotel :return: - def list(self, request, *args, **kwargs): Ge...
bead0c1d30e5772377649e852f9d2be6b0cc9e26
<|skeleton|> class HotelEquipmentViewSet: """API for working with hotel facilities (HotelEquipment)""" def get_queryset(self): """Receive information related only to the current user's hotel :return:""" <|body_0|> def list(self, request, *args, **kwargs): """Getting a list of the e...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HotelEquipmentViewSet: """API for working with hotel facilities (HotelEquipment)""" def get_queryset(self): """Receive information related only to the current user's hotel :return:""" hotel = self.request.user.get_hotel() queryset = HotelEquipmentItem.objects.filter(hotel_id=hotel...
the_stack_v2_python_sparse
src/apps/hotels/viewsets.py
oleg-developer/booking-system
train
0
e3cb08378ed0063b58e6f799ef7ba896ed8ae62d
[ "temp = self.newVersion()\ntry:\n latestStamp = self.getLatestStamp()\n if latestStamp > 0:\n shutil.copyfile(self.getFile(latestStamp), temp)\n else:\n self.rrdInit(temp)\n assert os.path.isfile(temp)\n for stamp, time, value in source(latestStamp):\n if stamp <= latestStamp:\n ...
<|body_start_0|> temp = self.newVersion() try: latestStamp = self.getLatestStamp() if latestStamp > 0: shutil.copyfile(self.getFile(latestStamp), temp) else: self.rrdInit(temp) assert os.path.isfile(temp) for sta...
An RRD file, usable as a dependency to RrdDef
RrdFile
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RrdFile: """An RRD file, usable as a dependency to RrdDef""" def update(self, source): """Look for updates and commit a new stamp if necessary. 'source' is a function that returns a (stamp, time, value) tuple for every stamp after the one provided. Returns the latest stamp value.""" ...
stack_v2_sparse_classes_36k_train_009240
19,325
no_license
[ { "docstring": "Look for updates and commit a new stamp if necessary. 'source' is a function that returns a (stamp, time, value) tuple for every stamp after the one provided. Returns the latest stamp value.", "name": "update", "signature": "def update(self, source)" }, { "docstring": "Create a b...
2
stack_v2_sparse_classes_30k_train_010306
Implement the Python class `RrdFile` described below. Class description: An RRD file, usable as a dependency to RrdDef Method signatures and docstrings: - def update(self, source): Look for updates and commit a new stamp if necessary. 'source' is a function that returns a (stamp, time, value) tuple for every stamp af...
Implement the Python class `RrdFile` described below. Class description: An RRD file, usable as a dependency to RrdDef Method signatures and docstrings: - def update(self, source): Look for updates and commit a new stamp if necessary. 'source' is a function that returns a (stamp, time, value) tuple for every stamp af...
1f9099d40cc638d681eebbc85c0b8455dab21607
<|skeleton|> class RrdFile: """An RRD file, usable as a dependency to RrdDef""" def update(self, source): """Look for updates and commit a new stamp if necessary. 'source' is a function that returns a (stamp, time, value) tuple for every stamp after the one provided. Returns the latest stamp value.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RrdFile: """An RRD file, usable as a dependency to RrdDef""" def update(self, source): """Look for updates and commit a new stamp if necessary. 'source' is a function that returns a (stamp, time, value) tuple for every stamp after the one provided. Returns the latest stamp value.""" temp ...
the_stack_v2_python_sparse
therm/pytherm/rrd.py
qixiaobo/navi-misc
train
0
8cd74387efc4f22d2f87d593f76d5ba5800143fe
[ "self.filters = filters\nself.sdb = search_db\nself.atomate_collection = getattr(search_db.database, task_collection)\nself.raw_documents = []\nif extra_projections is None:\n extra_projections = []\nself.projection = list(self.BASE_PROJECTION)\nself.projection.extend(extra_projections)", "records = []\nat_col...
<|body_start_0|> self.filters = filters self.sdb = search_db self.atomate_collection = getattr(search_db.database, task_collection) self.raw_documents = [] if extra_projections is None: extra_projections = [] self.projection = list(self.BASE_PROJECTION) ...
Collect the useful data from atomate task document into a dataframe
DataCollector
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataCollector: """Collect the useful data from atomate task document into a dataframe""" def __init__(self, search_db: SearchDB, filters: dict, extra_projections=None, task_collection='atomate_tasks'): """Instantiate a data collector object. Args: search_db (SearchDB): A `SearchDB` i...
stack_v2_sparse_classes_36k_train_009241
9,330
permissive
[ { "docstring": "Instantiate a data collector object. Args: search_db (SearchDB): A `SearchDB` instance filters (dict): filters to be used for the `find` method. projection (optional, list): A list of properties to be projected", "name": "__init__", "signature": "def __init__(self, search_db: SearchDB, f...
2
stack_v2_sparse_classes_30k_train_004481
Implement the Python class `DataCollector` described below. Class description: Collect the useful data from atomate task document into a dataframe Method signatures and docstrings: - def __init__(self, search_db: SearchDB, filters: dict, extra_projections=None, task_collection='atomate_tasks'): Instantiate a data col...
Implement the Python class `DataCollector` described below. Class description: Collect the useful data from atomate task document into a dataframe Method signatures and docstrings: - def __init__(self, search_db: SearchDB, filters: dict, extra_projections=None, task_collection='atomate_tasks'): Instantiate a data col...
eb0338f5e326a41ed9aa944ee25c283fa99afa02
<|skeleton|> class DataCollector: """Collect the useful data from atomate task document into a dataframe""" def __init__(self, search_db: SearchDB, filters: dict, extra_projections=None, task_collection='atomate_tasks'): """Instantiate a data collector object. Args: search_db (SearchDB): A `SearchDB` i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DataCollector: """Collect the useful data from atomate task document into a dataframe""" def __init__(self, search_db: SearchDB, filters: dict, extra_projections=None, task_collection='atomate_tasks'): """Instantiate a data collector object. Args: search_db (SearchDB): A `SearchDB` instance filte...
the_stack_v2_python_sparse
disp/analysis/gather.py
zhubonan/disp
train
3
e15b397f260425437358783b99127347d9fdcb3c
[ "client_obj = Client(client_id=client_id, client_name=client_name, client_cnp=client_cnp)\ntry:\n self._repository.insert(client_obj)\nexcept RepositoryException as e:\n Session.set_message(e.message)\n return False\nreturn True", "client = self._repository.select_by_id(client_id)\nif not client:\n Se...
<|body_start_0|> client_obj = Client(client_id=client_id, client_name=client_name, client_cnp=client_cnp) try: self._repository.insert(client_obj) except RepositoryException as e: Session.set_message(e.message) return False return True <|end_body_0|> ...
ClientController
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClientController: def store(self, client_id, client_name, client_cnp): """Store a new client Input: instance - an object Output: True - success False - failure Raises:""" <|body_0|> def update(self, client_id, client_name, client_cnp): """Update a client by id Time c...
stack_v2_sparse_classes_36k_train_009242
3,407
permissive
[ { "docstring": "Store a new client Input: instance - an object Output: True - success False - failure Raises:", "name": "store", "signature": "def store(self, client_id, client_name, client_cnp)" }, { "docstring": "Update a client by id Time complexity: O(1) Input: instance - an object Output: T...
3
stack_v2_sparse_classes_30k_train_004025
Implement the Python class `ClientController` described below. Class description: Implement the ClientController class. Method signatures and docstrings: - def store(self, client_id, client_name, client_cnp): Store a new client Input: instance - an object Output: True - success False - failure Raises: - def update(se...
Implement the Python class `ClientController` described below. Class description: Implement the ClientController class. Method signatures and docstrings: - def store(self, client_id, client_name, client_cnp): Store a new client Input: instance - an object Output: True - success False - failure Raises: - def update(se...
9496cb63594dcf1cc2cec8650b8eee603f85fdab
<|skeleton|> class ClientController: def store(self, client_id, client_name, client_cnp): """Store a new client Input: instance - an object Output: True - success False - failure Raises:""" <|body_0|> def update(self, client_id, client_name, client_cnp): """Update a client by id Time c...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ClientController: def store(self, client_id, client_name, client_cnp): """Store a new client Input: instance - an object Output: True - success False - failure Raises:""" client_obj = Client(client_id=client_id, client_name=client_name, client_cnp=client_cnp) try: self._rep...
the_stack_v2_python_sparse
fundamentals-of-programming/labs/lab_5-11/controller/client.py
vampy/university
train
1
c5f3d11c65c9685c935289e92a611558280d29bd
[ "if not s1 and (not s2):\n return True\nif not s1 or not s2:\n return False\nif len(s1) != len(s2):\n return False\nn = len(s1)\nf = [[[False for _ in range(n)] for _ in range(n)] for _ in range(n + 1)]\nfor i in range(n):\n for j in range(n):\n f[1][i][j] = s1[i] == s2[j]\nfor l in range(1, n + ...
<|body_start_0|> if not s1 and (not s2): return True if not s1 or not s2: return False if len(s1) != len(s2): return False n = len(s1) f = [[[False for _ in range(n)] for _ in range(n)] for _ in range(n + 1)] for i in range(n): ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isScramble_DP(self, s1, s2): """:type s1: str :type s2: str :rtype: bool""" <|body_0|> def isScramble_TLE(self, s1, s2): """:type s1: str :type s2: str :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not s1 and (not s2)...
stack_v2_sparse_classes_36k_train_009243
1,922
no_license
[ { "docstring": ":type s1: str :type s2: str :rtype: bool", "name": "isScramble_DP", "signature": "def isScramble_DP(self, s1, s2)" }, { "docstring": ":type s1: str :type s2: str :rtype: bool", "name": "isScramble_TLE", "signature": "def isScramble_TLE(self, s1, s2)" } ]
2
stack_v2_sparse_classes_30k_train_012212
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isScramble_DP(self, s1, s2): :type s1: str :type s2: str :rtype: bool - def isScramble_TLE(self, s1, s2): :type s1: str :type s2: str :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isScramble_DP(self, s1, s2): :type s1: str :type s2: str :rtype: bool - def isScramble_TLE(self, s1, s2): :type s1: str :type s2: str :rtype: bool <|skeleton|> class Solutio...
1a3c1f4d6e9d3444039f087763b93241f4ba7892
<|skeleton|> class Solution: def isScramble_DP(self, s1, s2): """:type s1: str :type s2: str :rtype: bool""" <|body_0|> def isScramble_TLE(self, s1, s2): """:type s1: str :type s2: str :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isScramble_DP(self, s1, s2): """:type s1: str :type s2: str :rtype: bool""" if not s1 and (not s2): return True if not s1 or not s2: return False if len(s1) != len(s2): return False n = len(s1) f = [[[False for _...
the_stack_v2_python_sparse
Algorithm/087_Scramble_String.py
Gi1ia/TechNoteBook
train
7
8b6c9e8ef6205912cd18b32f410d788dc0ec1a64
[ "sentinel = dummy = ListNode(0)\nlength = 0\narr = []\nwhile head:\n arr.append(head.val)\n head = head.next\n length += 1\nif n == 1:\n arr = arr[:-1]\nelse:\n arr = arr[:-n] + arr[-n + 1:]\nfor num in arr:\n dummy.next = ListNode(num)\n dummy = dummy.next\nreturn sentinel.next", "second = f...
<|body_start_0|> sentinel = dummy = ListNode(0) length = 0 arr = [] while head: arr.append(head.val) head = head.next length += 1 if n == 1: arr = arr[:-1] else: arr = arr[:-n] + arr[-n + 1:] for num in a...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def removeNthFromEnd1(self, head: ListNode, n: int) -> ListNode: """Additional space + additional pass""" <|body_0|> def removeNthFromEnd(self, head: ListNode, n: int) -> ListNode: """Approch: Use two pointers. The first pointer advances the list by n+1 ste...
stack_v2_sparse_classes_36k_train_009244
2,372
no_license
[ { "docstring": "Additional space + additional pass", "name": "removeNthFromEnd1", "signature": "def removeNthFromEnd1(self, head: ListNode, n: int) -> ListNode" }, { "docstring": "Approch: Use two pointers. The first pointer advances the list by n+1 steps from the beginning, while the second poi...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeNthFromEnd1(self, head: ListNode, n: int) -> ListNode: Additional space + additional pass - def removeNthFromEnd(self, head: ListNode, n: int) -> ListNode: Approch: Use...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeNthFromEnd1(self, head: ListNode, n: int) -> ListNode: Additional space + additional pass - def removeNthFromEnd(self, head: ListNode, n: int) -> ListNode: Approch: Use...
fbaae4bdbb2017ee43b0d1a3f23137a75f7ea2c1
<|skeleton|> class Solution: def removeNthFromEnd1(self, head: ListNode, n: int) -> ListNode: """Additional space + additional pass""" <|body_0|> def removeNthFromEnd(self, head: ListNode, n: int) -> ListNode: """Approch: Use two pointers. The first pointer advances the list by n+1 ste...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def removeNthFromEnd1(self, head: ListNode, n: int) -> ListNode: """Additional space + additional pass""" sentinel = dummy = ListNode(0) length = 0 arr = [] while head: arr.append(head.val) head = head.next length += 1 ...
the_stack_v2_python_sparse
b_75/remove_nth_node_end_list.py
Milan-Chicago/ds-guide
train
0
1088dfefd1fc038125a5b29d992a3719bcbc6817
[ "self.mandatory_attributes = {'keywords': [], 'rules': [], 'desc': ''}\nmodels.AssetCollection.__init__(self, *args, **kwargs)\nself.set_gear_vars()", "gear_list = self.get_dicts()\nfor g_dict in gear_list:\n handle = g_dict['handle']\n if g_dict.get('affinity_bonus', None) is not None:\n self.assets...
<|body_start_0|> self.mandatory_attributes = {'keywords': [], 'rules': [], 'desc': ''} models.AssetCollection.__init__(self, *args, **kwargs) self.set_gear_vars() <|end_body_0|> <|body_start_1|> gear_list = self.get_dicts() for g_dict in gear_list: handle = g_dict['h...
Assets
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Assets: def __init__(self, *args, **kwargs): """In release 1.0.0, the init method for the gear asset collection uses the 'mandatory_attributes' attr instead of custom code.""" <|body_0|> def set_gear_vars(self): """Updates assets with assorted values.""" <|bo...
stack_v2_sparse_classes_36k_train_009245
1,868
permissive
[ { "docstring": "In release 1.0.0, the init method for the gear asset collection uses the 'mandatory_attributes' attr instead of custom code.", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Updates assets with assorted values.", "name": "set_gear_va...
3
stack_v2_sparse_classes_30k_train_001485
Implement the Python class `Assets` described below. Class description: Implement the Assets class. Method signatures and docstrings: - def __init__(self, *args, **kwargs): In release 1.0.0, the init method for the gear asset collection uses the 'mandatory_attributes' attr instead of custom code. - def set_gear_vars(...
Implement the Python class `Assets` described below. Class description: Implement the Assets class. Method signatures and docstrings: - def __init__(self, *args, **kwargs): In release 1.0.0, the init method for the gear asset collection uses the 'mandatory_attributes' attr instead of custom code. - def set_gear_vars(...
6d6bd2c914f6c1ad438451c6b67058cc6e5b6fa8
<|skeleton|> class Assets: def __init__(self, *args, **kwargs): """In release 1.0.0, the init method for the gear asset collection uses the 'mandatory_attributes' attr instead of custom code.""" <|body_0|> def set_gear_vars(self): """Updates assets with assorted values.""" <|bo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Assets: def __init__(self, *args, **kwargs): """In release 1.0.0, the init method for the gear asset collection uses the 'mandatory_attributes' attr instead of custom code.""" self.mandatory_attributes = {'keywords': [], 'rules': [], 'desc': ''} models.AssetCollection.__init__(self, *a...
the_stack_v2_python_sparse
app/models/gear.py
theLaborInVain/kdm-manager-api
train
3
3f30563fc9f199b975bc1a70e54b0090799272d0
[ "if isinstance(stride, int):\n stride = (stride, stride)\nassert groups in (1, channels), 'Must use no grouping, ' + 'or one group per channel'\nkernel_size = (2 * stride[0] - 1, 2 * stride[1] - 1)\npadding = (stride[0] - 1, stride[1] - 1)\nsuper().__init__(channels, channels, kernel_size=kernel_size, stride=str...
<|body_start_0|> if isinstance(stride, int): stride = (stride, stride) assert groups in (1, channels), 'Must use no grouping, ' + 'or one group per channel' kernel_size = (2 * stride[0] - 1, 2 * stride[1] - 1) padding = (stride[0] - 1, stride[1] - 1) super().__init__(...
A conv transpose initialized to bilinear interpolation.
BilinearConvTranspose2d
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BilinearConvTranspose2d: """A conv transpose initialized to bilinear interpolation.""" def __init__(self, channels, stride, groups=1): """Set up the layer. Parameters ---------- channels: int The number of input and output channels stride: int or tuple The amount of upsampling to do ...
stack_v2_sparse_classes_36k_train_009246
28,547
no_license
[ { "docstring": "Set up the layer. Parameters ---------- channels: int The number of input and output channels stride: int or tuple The amount of upsampling to do groups: int Set to 1 for a standard convolution. Set equal to channels to make sure there is no cross-talk between channels.", "name": "__init__",...
3
null
Implement the Python class `BilinearConvTranspose2d` described below. Class description: A conv transpose initialized to bilinear interpolation. Method signatures and docstrings: - def __init__(self, channels, stride, groups=1): Set up the layer. Parameters ---------- channels: int The number of input and output chan...
Implement the Python class `BilinearConvTranspose2d` described below. Class description: A conv transpose initialized to bilinear interpolation. Method signatures and docstrings: - def __init__(self, channels, stride, groups=1): Set up the layer. Parameters ---------- channels: int The number of input and output chan...
7e55a422588c1d1e00f35a3d3a3ff896cce59e18
<|skeleton|> class BilinearConvTranspose2d: """A conv transpose initialized to bilinear interpolation.""" def __init__(self, channels, stride, groups=1): """Set up the layer. Parameters ---------- channels: int The number of input and output channels stride: int or tuple The amount of upsampling to do ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BilinearConvTranspose2d: """A conv transpose initialized to bilinear interpolation.""" def __init__(self, channels, stride, groups=1): """Set up the layer. Parameters ---------- channels: int The number of input and output channels stride: int or tuple The amount of upsampling to do groups: int S...
the_stack_v2_python_sparse
generated/test_lhwcv_mlsd_pytorch.py
jansel/pytorch-jit-paritybench
train
35
6e0d4358cfc23f02ab305ab492ef38e667c0ad34
[ "ccupydo.CInterfaceMatrix.__init__(self, sizes[0], sizes[1])\nself.sizes = sizes\nself.mpiComm = mpiComm", "if self.mpiComm != None:\n ccupydo.CInterfaceMatrix.mult(self, Data, DataOut)\nelse:\n PyH = self.getMat()\n dim = Data.getDim()\n for iDim in range(dim):\n np.dot(PyH, Data.getData(iDim)...
<|body_start_0|> ccupydo.CInterfaceMatrix.__init__(self, sizes[0], sizes[1]) self.sizes = sizes self.mpiComm = mpiComm <|end_body_0|> <|body_start_1|> if self.mpiComm != None: ccupydo.CInterfaceMatrix.mult(self, Data, DataOut) else: PyH = self.getMat() ...
Define a matrix based on fluid-structure interface data. Designed for parallel computations (also works in serial). Inherited public members : -createDense() -createSparse() -createSparseFullAlloc() -setValue() -assemble() -getMat()
InterfaceMatrix
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InterfaceMatrix: """Define a matrix based on fluid-structure interface data. Designed for parallel computations (also works in serial). Inherited public members : -createDense() -createSparse() -createSparseFullAlloc() -setValue() -assemble() -getMat()""" def __init__(self, sizes, mpiComm=No...
stack_v2_sparse_classes_36k_train_009247
8,157
permissive
[ { "docstring": "Overloaded constructor", "name": "__init__", "signature": "def __init__(self, sizes, mpiComm=None)" }, { "docstring": "Performs interface matrix-data multiplication.", "name": "mult", "signature": "def mult(self, Data, DataOut)" } ]
2
stack_v2_sparse_classes_30k_train_013968
Implement the Python class `InterfaceMatrix` described below. Class description: Define a matrix based on fluid-structure interface data. Designed for parallel computations (also works in serial). Inherited public members : -createDense() -createSparse() -createSparseFullAlloc() -setValue() -assemble() -getMat() Meth...
Implement the Python class `InterfaceMatrix` described below. Class description: Define a matrix based on fluid-structure interface data. Designed for parallel computations (also works in serial). Inherited public members : -createDense() -createSparse() -createSparseFullAlloc() -setValue() -assemble() -getMat() Meth...
4a6b7f32a3196288622d46cd3498b00e75a92354
<|skeleton|> class InterfaceMatrix: """Define a matrix based on fluid-structure interface data. Designed for parallel computations (also works in serial). Inherited public members : -createDense() -createSparse() -createSparseFullAlloc() -setValue() -assemble() -getMat()""" def __init__(self, sizes, mpiComm=No...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InterfaceMatrix: """Define a matrix based on fluid-structure interface data. Designed for parallel computations (also works in serial). Inherited public members : -createDense() -createSparse() -createSparseFullAlloc() -setValue() -assemble() -getMat()""" def __init__(self, sizes, mpiComm=None): ...
the_stack_v2_python_sparse
cupydo/interfaceData.py
mlucio89/CUPyDO
train
8
ddaa4d035db1da48c907d6e096a66aadd52b2fac
[ "super().__init__(filepath, language)\nself.nbest = nbest\nself.diarization = diarization\nself.profanity = profanity\nself.cache_search_dirs = cache_search_dirs\nself.output_folder = output_dir\nself.log_dir = log_dir\nself.allow_resume = allow_resume\nself.enable_sentiment = enable_sentiment\nself._cached_duratio...
<|body_start_0|> super().__init__(filepath, language) self.nbest = nbest self.diarization = diarization self.profanity = profanity self.cache_search_dirs = cache_search_dirs self.output_folder = output_dir self.log_dir = log_dir self.allow_resume = allow_r...
SpeechSDKWorkItemRequest
[ "MIT", "LicenseRef-scancode-generic-cla" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SpeechSDKWorkItemRequest: def __init__(self, filepath: str, language: str, nbest: int, diarization: str, profanity: str, cache_search_dirs: List[str], output_dir: str, log_dir: str, allow_resume: bool, enable_sentiment: bool): """:param filepath: input audio file to recognize :param lang...
stack_v2_sparse_classes_36k_train_009248
3,693
permissive
[ { "docstring": ":param filepath: input audio file to recognize :param language: language of the request :param nbest: how many maximum results to consider per recognition :param diarization: diarization mode :param profanity: profanity mode :param output_dir: where json result containing the file's transcriptio...
3
stack_v2_sparse_classes_30k_train_004127
Implement the Python class `SpeechSDKWorkItemRequest` described below. Class description: Implement the SpeechSDKWorkItemRequest class. Method signatures and docstrings: - def __init__(self, filepath: str, language: str, nbest: int, diarization: str, profanity: str, cache_search_dirs: List[str], output_dir: str, log_...
Implement the Python class `SpeechSDKWorkItemRequest` described below. Class description: Implement the SpeechSDKWorkItemRequest class. Method signatures and docstrings: - def __init__(self, filepath: str, language: str, nbest: int, diarization: str, profanity: str, cache_search_dirs: List[str], output_dir: str, log_...
8b0a5492361ff9473ab66c2f64aaccd5340f2f62
<|skeleton|> class SpeechSDKWorkItemRequest: def __init__(self, filepath: str, language: str, nbest: int, diarization: str, profanity: str, cache_search_dirs: List[str], output_dir: str, log_dir: str, allow_resume: bool, enable_sentiment: bool): """:param filepath: input audio file to recognize :param lang...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SpeechSDKWorkItemRequest: def __init__(self, filepath: str, language: str, nbest: int, diarization: str, profanity: str, cache_search_dirs: List[str], output_dir: str, log_dir: str, allow_resume: bool, enable_sentiment: bool): """:param filepath: input audio file to recognize :param language: language...
the_stack_v2_python_sparse
batchkit_examples/speech_sdk/work_item.py
microsoft/batch-processing-kit
train
29
22797439416b5ec13b2082d3d7d637441f0214c3
[ "self.data_dir = FileOps.download_dataset(data_dir)\nself.batch_size = batch_size\nself.mode = mode\nself.num_parallel_batches = num_parallel_batches\nself.repeat_num = repeat_num\nself.dtype = tf.float16 if fp16 is True else tf.float32\nself.drop_remainder = drop_remainder\nself._include_mask = False\nself._datase...
<|body_start_0|> self.data_dir = FileOps.download_dataset(data_dir) self.batch_size = batch_size self.mode = mode self.num_parallel_batches = num_parallel_batches self.repeat_num = repeat_num self.dtype = tf.float16 if fp16 is True else tf.float32 self.drop_remain...
This is a class for Coco TFRecords dataset. :param data_dir: Coco TFRecords data directory :type data_dir: str :param batch_size: batch size :type batch_size: int :param mode: dataset mode, train or val :type mode: str :param num_parallel_batches: number of parallel batches :type num_parallel_batches: int, default 1 :p...
CocoDataset
[ "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CocoDataset: """This is a class for Coco TFRecords dataset. :param data_dir: Coco TFRecords data directory :type data_dir: str :param batch_size: batch size :type batch_size: int :param mode: dataset mode, train or val :type mode: str :param num_parallel_batches: number of parallel batches :type ...
stack_v2_sparse_classes_36k_train_009249
5,507
permissive
[ { "docstring": "Init CocoTF.", "name": "__init__", "signature": "def __init__(self, data_dir, batch_size, mode, num_parallel_batches=1, repeat_num=5, padding=8, fp16=False, drop_remainder=False)" }, { "docstring": "Coco data files of type TFRecords.", "name": "_file_pattern", "signature"...
4
stack_v2_sparse_classes_30k_train_003091
Implement the Python class `CocoDataset` described below. Class description: This is a class for Coco TFRecords dataset. :param data_dir: Coco TFRecords data directory :type data_dir: str :param batch_size: batch size :type batch_size: int :param mode: dataset mode, train or val :type mode: str :param num_parallel_bat...
Implement the Python class `CocoDataset` described below. Class description: This is a class for Coco TFRecords dataset. :param data_dir: Coco TFRecords data directory :type data_dir: str :param batch_size: batch size :type batch_size: int :param mode: dataset mode, train or val :type mode: str :param num_parallel_bat...
df51ed9c1d6dbde1deef63f2a037a369f8554406
<|skeleton|> class CocoDataset: """This is a class for Coco TFRecords dataset. :param data_dir: Coco TFRecords data directory :type data_dir: str :param batch_size: batch size :type batch_size: int :param mode: dataset mode, train or val :type mode: str :param num_parallel_batches: number of parallel batches :type ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CocoDataset: """This is a class for Coco TFRecords dataset. :param data_dir: Coco TFRecords data directory :type data_dir: str :param batch_size: batch size :type batch_size: int :param mode: dataset mode, train or val :type mode: str :param num_parallel_batches: number of parallel batches :type num_parallel_...
the_stack_v2_python_sparse
built-in/TensorFlow/Research/cv/image_classification/Cars_for_TensorFlow/automl/vega/datasets/tensorflow/coco.py
Huawei-Ascend/modelzoo
train
1
6a4c5882a8eace4f042e3f7ebb4c62d8fc163342
[ "self.cancellation_requested = cancellation_requested\nself.end_time_usecs = end_time_usecs\nself.error = error\nself.is_internal = is_internal\nself.name = name\nself.parent_source_connection_params = parent_source_connection_params\nself.preprocessing_error = preprocessing_error\nself.public_status = public_statu...
<|body_start_0|> self.cancellation_requested = cancellation_requested self.end_time_usecs = end_time_usecs self.error = error self.is_internal = is_internal self.name = name self.parent_source_connection_params = parent_source_connection_params self.preprocessing_...
Implementation of the 'RestoreTaskStateBaseProto' model. TODO: type description here. Attributes: cancellation_requested (bool): Whether this task has a pending cancellation request. end_time_usecs (long|int): If the restore task has finished, this field contains the end time for the task. error (ErrorProto): The error...
RestoreTaskStateBaseProto
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RestoreTaskStateBaseProto: """Implementation of the 'RestoreTaskStateBaseProto' model. TODO: type description here. Attributes: cancellation_requested (bool): Whether this task has a pending cancellation request. end_time_usecs (long|int): If the restore task has finished, this field contains the...
stack_v2_sparse_classes_36k_train_009250
10,022
permissive
[ { "docstring": "Constructor for the RestoreTaskStateBaseProto class", "name": "__init__", "signature": "def __init__(self, cancellation_requested=None, end_time_usecs=None, error=None, is_internal=None, name=None, parent_source_connection_params=None, preprocessing_error=None, public_status=None, refres...
2
null
Implement the Python class `RestoreTaskStateBaseProto` described below. Class description: Implementation of the 'RestoreTaskStateBaseProto' model. TODO: type description here. Attributes: cancellation_requested (bool): Whether this task has a pending cancellation request. end_time_usecs (long|int): If the restore tas...
Implement the Python class `RestoreTaskStateBaseProto` described below. Class description: Implementation of the 'RestoreTaskStateBaseProto' model. TODO: type description here. Attributes: cancellation_requested (bool): Whether this task has a pending cancellation request. end_time_usecs (long|int): If the restore tas...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class RestoreTaskStateBaseProto: """Implementation of the 'RestoreTaskStateBaseProto' model. TODO: type description here. Attributes: cancellation_requested (bool): Whether this task has a pending cancellation request. end_time_usecs (long|int): If the restore task has finished, this field contains the...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RestoreTaskStateBaseProto: """Implementation of the 'RestoreTaskStateBaseProto' model. TODO: type description here. Attributes: cancellation_requested (bool): Whether this task has a pending cancellation request. end_time_usecs (long|int): If the restore task has finished, this field contains the end time for...
the_stack_v2_python_sparse
cohesity_management_sdk/models/restore_task_state_base_proto.py
cohesity/management-sdk-python
train
24
abc4e4ef09fd4da1cc6df66a3f00982d0f022ea4
[ "if graph.is_directed():\n raise ValueError('the graph is directed')\nself.graph = graph\nfor edge in self.graph.iteredges():\n if edge.source == edge.target:\n raise ValueError('a loop detected')\nself.independent_set = set()\nself.cardinality = 0\nself.source = None", "used = set()\nif source is no...
<|body_start_0|> if graph.is_directed(): raise ValueError('the graph is directed') self.graph = graph for edge in self.graph.iteredges(): if edge.source == edge.target: raise ValueError('a loop detected') self.independent_set = set() self.c...
Find a maximal independent set.
UnorderedSequentialIndependentSet1
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UnorderedSequentialIndependentSet1: """Find a maximal independent set.""" def __init__(self, graph): """The algorithm initialization.""" <|body_0|> def run(self, source=None): """Executable pseudocode.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_009251
3,887
permissive
[ { "docstring": "The algorithm initialization.", "name": "__init__", "signature": "def __init__(self, graph)" }, { "docstring": "Executable pseudocode.", "name": "run", "signature": "def run(self, source=None)" } ]
2
stack_v2_sparse_classes_30k_train_014130
Implement the Python class `UnorderedSequentialIndependentSet1` described below. Class description: Find a maximal independent set. Method signatures and docstrings: - def __init__(self, graph): The algorithm initialization. - def run(self, source=None): Executable pseudocode.
Implement the Python class `UnorderedSequentialIndependentSet1` described below. Class description: Find a maximal independent set. Method signatures and docstrings: - def __init__(self, graph): The algorithm initialization. - def run(self, source=None): Executable pseudocode. <|skeleton|> class UnorderedSequentialI...
0ff4ae303e8824e6bb8474d23b29a7b3e5ed8e60
<|skeleton|> class UnorderedSequentialIndependentSet1: """Find a maximal independent set.""" def __init__(self, graph): """The algorithm initialization.""" <|body_0|> def run(self, source=None): """Executable pseudocode.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UnorderedSequentialIndependentSet1: """Find a maximal independent set.""" def __init__(self, graph): """The algorithm initialization.""" if graph.is_directed(): raise ValueError('the graph is directed') self.graph = graph for edge in self.graph.iteredges(): ...
the_stack_v2_python_sparse
graphtheory/independentsets/isetus.py
kgashok/graphs-dict
train
0
f1210b4696b849d9a585d6772a56c1f2a21719bd
[ "super().__init__(name='categorical_regression_mlp')\nself.dim_out = output_sizes[-1]\nself.atoms = jnp.array(atoms)\nself.output_sizes = list(output_sizes[:-1]) + [self.dim_out * len(atoms)]", "out = hk.Flatten()(inputs)\nout = hk.nets.MLP(self.output_sizes)(out)\nreturn CatOutputWithPrior(train=jnp.reshape(out,...
<|body_start_0|> super().__init__(name='categorical_regression_mlp') self.dim_out = output_sizes[-1] self.atoms = jnp.array(atoms) self.output_sizes = list(output_sizes[:-1]) + [self.dim_out * len(atoms)] <|end_body_0|> <|body_start_1|> out = hk.Flatten()(inputs) out = h...
Categorical MLP designed for regression ala MuZero value.
CategoricalRegressionMLP
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CategoricalRegressionMLP: """Categorical MLP designed for regression ala MuZero value.""" def __init__(self, output_sizes: Sequence[int], atoms: base.Array): """Categorical MLP designed for regression ala MuZero value.""" <|body_0|> def __call__(self, inputs: base.Array)...
stack_v2_sparse_classes_36k_train_009252
4,501
permissive
[ { "docstring": "Categorical MLP designed for regression ala MuZero value.", "name": "__init__", "signature": "def __init__(self, output_sizes: Sequence[int], atoms: base.Array)" }, { "docstring": "Apply MLP and wrap outputs appropriately.", "name": "__call__", "signature": "def __call__(...
2
stack_v2_sparse_classes_30k_train_020454
Implement the Python class `CategoricalRegressionMLP` described below. Class description: Categorical MLP designed for regression ala MuZero value. Method signatures and docstrings: - def __init__(self, output_sizes: Sequence[int], atoms: base.Array): Categorical MLP designed for regression ala MuZero value. - def __...
Implement the Python class `CategoricalRegressionMLP` described below. Class description: Categorical MLP designed for regression ala MuZero value. Method signatures and docstrings: - def __init__(self, output_sizes: Sequence[int], atoms: base.Array): Categorical MLP designed for regression ala MuZero value. - def __...
50fb44609f217207d1d35a516bc5ca131f987cf7
<|skeleton|> class CategoricalRegressionMLP: """Categorical MLP designed for regression ala MuZero value.""" def __init__(self, output_sizes: Sequence[int], atoms: base.Array): """Categorical MLP designed for regression ala MuZero value.""" <|body_0|> def __call__(self, inputs: base.Array)...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CategoricalRegressionMLP: """Categorical MLP designed for regression ala MuZero value.""" def __init__(self, output_sizes: Sequence[int], atoms: base.Array): """Categorical MLP designed for regression ala MuZero value.""" super().__init__(name='categorical_regression_mlp') self.di...
the_stack_v2_python_sparse
enn/networks/categorical_ensembles.py
anukaal/enn
train
0
f5a57add763b8ffa68018d0a74e34ee55f696b1a
[ "AbstractCommModule.__init__(self, sim_env)\nself.transp_lay = StdTransportLayer(sim_env)\nself.datalink_lay = StdDatalinkLayer(sim_env)\nself.physical_lay = StdPhysicalLayer(sim_env)\nif GeneralSpecPreset().enabled:\n self.transp_lay = GeneralSpecPreset().transport_layer(sim_env, proj.BUS_MSG_CLASS)\n self.d...
<|body_start_0|> AbstractCommModule.__init__(self, sim_env) self.transp_lay = StdTransportLayer(sim_env) self.datalink_lay = StdDatalinkLayer(sim_env) self.physical_lay = StdPhysicalLayer(sim_env) if GeneralSpecPreset().enabled: self.transp_lay = GeneralSpecPreset().t...
This class implements a secure communication module, that enables secure communication between several ECUs
StdCommModule
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StdCommModule: """This class implements a secure communication module, that enables secure communication between several ECUs""" def __init__(self, sim_env): """Constructor Input: sim_env simpy.Environment environment of this component MessageClass AbstractBusMessage class that is us...
stack_v2_sparse_classes_36k_train_009253
4,063
permissive
[ { "docstring": "Constructor Input: sim_env simpy.Environment environment of this component MessageClass AbstractBusMessage class that is used for sending and receiving Output: -", "name": "__init__", "signature": "def __init__(self, sim_env)" }, { "docstring": "sets the initial setting associati...
4
null
Implement the Python class `StdCommModule` described below. Class description: This class implements a secure communication module, that enables secure communication between several ECUs Method signatures and docstrings: - def __init__(self, sim_env): Constructor Input: sim_env simpy.Environment environment of this c...
Implement the Python class `StdCommModule` described below. Class description: This class implements a secure communication module, that enables secure communication between several ECUs Method signatures and docstrings: - def __init__(self, sim_env): Constructor Input: sim_env simpy.Environment environment of this c...
b2e395611e9b5111aeda7ab128f3486354bbbf0d
<|skeleton|> class StdCommModule: """This class implements a secure communication module, that enables secure communication between several ECUs""" def __init__(self, sim_env): """Constructor Input: sim_env simpy.Environment environment of this component MessageClass AbstractBusMessage class that is us...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StdCommModule: """This class implements a secure communication module, that enables secure communication between several ECUs""" def __init__(self, sim_env): """Constructor Input: sim_env simpy.Environment environment of this component MessageClass AbstractBusMessage class that is used for sendin...
the_stack_v2_python_sparse
ECUSimulation/components/base/ecu/software/impl_comm_module_simple.py
PhilippMundhenk/IVNS
train
15
ef10982b6e273e7456dff909c70456075cd34d19
[ "logs.log_info('You are using the vgK channel: Kv1.2')\nself.time_unit = 1000.0\nself.vrev = -65\nself.m = 1.0 / (1 + np.exp(-(V + 21.0) / 11.3943))\nself.h = 1.0 / (1 + np.exp((V + 22.0) / 11.3943))\nself._mpower = 1\nself._hpower = 1", "self._mInf = 1.0 / (1 + np.exp(-(V + 21.0) / 11.3943))\nself._mTau = 150.0 ...
<|body_start_0|> logs.log_info('You are using the vgK channel: Kv1.2') self.time_unit = 1000.0 self.vrev = -65 self.m = 1.0 / (1 + np.exp(-(V + 21.0) / 11.3943)) self.h = 1.0 / (1 + np.exp((V + 22.0) / 11.3943)) self._mpower = 1 self._hpower = 1 <|end_body_0|> <|...
Kv1.2 model from Sprunger et al. This channel produces well behaved action-potentials with a variety of vgNa channels. Good general-purpose vgK channel. Potassium voltage-gated channel Kv1.2 is a member of the shaker-related subfamily and belongs to the delayed rectifier class of channels, which allow nerve cells to ef...
Kv1p2
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Kv1p2: """Kv1.2 model from Sprunger et al. This channel produces well behaved action-potentials with a variety of vgNa channels. Good general-purpose vgK channel. Potassium voltage-gated channel Kv1.2 is a member of the shaker-related subfamily and belongs to the delayed rectifier class of channe...
stack_v2_sparse_classes_36k_train_009254
24,227
no_license
[ { "docstring": "Run initialization calculation for m and h gates of the channel at starting Vmem value.", "name": "_init_state", "signature": "def _init_state(self, V)" }, { "docstring": "Update the state of m and h gates of the channel given their present value and present simulation Vmem.", ...
2
null
Implement the Python class `Kv1p2` described below. Class description: Kv1.2 model from Sprunger et al. This channel produces well behaved action-potentials with a variety of vgNa channels. Good general-purpose vgK channel. Potassium voltage-gated channel Kv1.2 is a member of the shaker-related subfamily and belongs t...
Implement the Python class `Kv1p2` described below. Class description: Kv1.2 model from Sprunger et al. This channel produces well behaved action-potentials with a variety of vgNa channels. Good general-purpose vgK channel. Potassium voltage-gated channel Kv1.2 is a member of the shaker-related subfamily and belongs t...
dd03ff5e3df3ef48d887a6566a6286fcd168880b
<|skeleton|> class Kv1p2: """Kv1.2 model from Sprunger et al. This channel produces well behaved action-potentials with a variety of vgNa channels. Good general-purpose vgK channel. Potassium voltage-gated channel Kv1.2 is a member of the shaker-related subfamily and belongs to the delayed rectifier class of channe...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Kv1p2: """Kv1.2 model from Sprunger et al. This channel produces well behaved action-potentials with a variety of vgNa channels. Good general-purpose vgK channel. Potassium voltage-gated channel Kv1.2 is a member of the shaker-related subfamily and belongs to the delayed rectifier class of channels, which all...
the_stack_v2_python_sparse
betse/science/channels/vg_k.py
R-Stefano/betse-ml
train
0
18808924659768d24a74f4831c32441242f0c90c
[ "if node[u'type'] == NodeType.DUT:\n pci_address1 = Topology.get_interface_pci_addr(node, if1)\n pci_address2 = Topology.get_interface_pci_addr(node, if2)\n command = f'{Constants.REMOTE_FW_DIR}/{Constants.RESOURCES_LIB_SH}/entry/init_dpdk.sh {nic_driver} {pci_address1} {pci_address2}'\n message = u'Ini...
<|body_start_0|> if node[u'type'] == NodeType.DUT: pci_address1 = Topology.get_interface_pci_addr(node, if1) pci_address2 = Topology.get_interface_pci_addr(node, if2) command = f'{Constants.REMOTE_FW_DIR}/{Constants.RESOURCES_LIB_SH}/entry/init_dpdk.sh {nic_driver} {pci_addre...
This class implements: - Initialization of DPDK environment, - Cleanup of DPDK environment.
DPDKTools
[ "GPL-1.0-or-later", "CC-BY-4.0", "Apache-2.0", "LicenseRef-scancode-dco-1.1" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DPDKTools: """This class implements: - Initialization of DPDK environment, - Cleanup of DPDK environment.""" def initialize_dpdk_framework(node, if1, if2, nic_driver): """Initialize the DPDK framework on the DUT node. Bind interfaces to driver. :param node: DUT node. :param if1: DUT ...
stack_v2_sparse_classes_36k_train_009255
4,823
permissive
[ { "docstring": "Initialize the DPDK framework on the DUT node. Bind interfaces to driver. :param node: DUT node. :param if1: DUT first interface name. :param if2: DUT second interface name. :param nic_driver: Interface driver. :type node: dict :type if1: str :type if2: str :type nic_driver: str :raises RuntimeE...
5
stack_v2_sparse_classes_30k_train_016777
Implement the Python class `DPDKTools` described below. Class description: This class implements: - Initialization of DPDK environment, - Cleanup of DPDK environment. Method signatures and docstrings: - def initialize_dpdk_framework(node, if1, if2, nic_driver): Initialize the DPDK framework on the DUT node. Bind inte...
Implement the Python class `DPDKTools` described below. Class description: This class implements: - Initialization of DPDK environment, - Cleanup of DPDK environment. Method signatures and docstrings: - def initialize_dpdk_framework(node, if1, if2, nic_driver): Initialize the DPDK framework on the DUT node. Bind inte...
947057d7310cd1602119258c6b82fbb25fe1b79d
<|skeleton|> class DPDKTools: """This class implements: - Initialization of DPDK environment, - Cleanup of DPDK environment.""" def initialize_dpdk_framework(node, if1, if2, nic_driver): """Initialize the DPDK framework on the DUT node. Bind interfaces to driver. :param node: DUT node. :param if1: DUT ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DPDKTools: """This class implements: - Initialization of DPDK environment, - Cleanup of DPDK environment.""" def initialize_dpdk_framework(node, if1, if2, nic_driver): """Initialize the DPDK framework on the DUT node. Bind interfaces to driver. :param node: DUT node. :param if1: DUT first interfa...
the_stack_v2_python_sparse
resources/libraries/python/DPDK/DPDKTools.py
FDio/csit
train
28
754503282e85f93da799d11aaa717818f1a7e263
[ "super(Triplet_unit, self).__init__()\nself.relu = nn.ReLU()\nself.conv = depthwise_separable_conv_general(inplanes, outplanes, stride, kernel_size=kernel_size)\nself.bn = nn.BatchNorm2d(outplanes)\nself.dropout_p = dropout_p\nif dropout_p > 0:\n self.dropout = nn.Dropout(dropout_p)", "out = self.relu(x)\nout ...
<|body_start_0|> super(Triplet_unit, self).__init__() self.relu = nn.ReLU() self.conv = depthwise_separable_conv_general(inplanes, outplanes, stride, kernel_size=kernel_size) self.bn = nn.BatchNorm2d(outplanes) self.dropout_p = dropout_p if dropout_p > 0: self...
Node operation unit in the bottom-level graph.
Triplet_unit
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0", "BSD-3-Clause", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Triplet_unit: """Node operation unit in the bottom-level graph.""" def __init__(self, inplanes, outplanes, dropout_p=0, stride=1, kernel_size=3): """Initialize Triplet_unit.""" <|body_0|> def forward(self, x): """Implement forward.""" <|body_1|> <|end_sk...
stack_v2_sparse_classes_36k_train_009256
2,586
permissive
[ { "docstring": "Initialize Triplet_unit.", "name": "__init__", "signature": "def __init__(self, inplanes, outplanes, dropout_p=0, stride=1, kernel_size=3)" }, { "docstring": "Implement forward.", "name": "forward", "signature": "def forward(self, x)" } ]
2
null
Implement the Python class `Triplet_unit` described below. Class description: Node operation unit in the bottom-level graph. Method signatures and docstrings: - def __init__(self, inplanes, outplanes, dropout_p=0, stride=1, kernel_size=3): Initialize Triplet_unit. - def forward(self, x): Implement forward.
Implement the Python class `Triplet_unit` described below. Class description: Node operation unit in the bottom-level graph. Method signatures and docstrings: - def __init__(self, inplanes, outplanes, dropout_p=0, stride=1, kernel_size=3): Initialize Triplet_unit. - def forward(self, x): Implement forward. <|skeleto...
12e37a1991eb6771a2999fe0a46ddda920c47948
<|skeleton|> class Triplet_unit: """Node operation unit in the bottom-level graph.""" def __init__(self, inplanes, outplanes, dropout_p=0, stride=1, kernel_size=3): """Initialize Triplet_unit.""" <|body_0|> def forward(self, x): """Implement forward.""" <|body_1|> <|end_sk...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Triplet_unit: """Node operation unit in the bottom-level graph.""" def __init__(self, inplanes, outplanes, dropout_p=0, stride=1, kernel_size=3): """Initialize Triplet_unit.""" super(Triplet_unit, self).__init__() self.relu = nn.ReLU() self.conv = depthwise_separable_conv_...
the_stack_v2_python_sparse
vega/networks/pytorch/customs/utils/ops.py
huawei-noah/vega
train
850
6a41353850cce7279335136b679d237cf5dcbfcc
[ "if retry_num >= 5:\n return (self.RETHROW, None)\nelse:\n return (self.RETRY, consistency)", "if retry_num >= 5:\n return (self.RETHROW, None)\nelse:\n return (self.RETRY, consistency)" ]
<|body_start_0|> if retry_num >= 5: return (self.RETHROW, None) else: return (self.RETRY, consistency) <|end_body_0|> <|body_start_1|> if retry_num >= 5: return (self.RETHROW, None) else: return (self.RETRY, consistency) <|end_body_1|>
A policy used for retrying idempotent statements.
IdempotentRetryPolicy
[ "Apache-2.0", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IdempotentRetryPolicy: """A policy used for retrying idempotent statements.""" def on_read_timeout(self, query, consistency, required_responses, received_responses, data_retrieved, retry_num): """This is called when a ReadTimeout occurs. Args: query: A statement that timed out. consi...
stack_v2_sparse_classes_36k_train_009257
32,594
permissive
[ { "docstring": "This is called when a ReadTimeout occurs. Args: query: A statement that timed out. consistency: The consistency level of the statement. required_responses: The number of responses required. received_responses: The number of responses received. data_retrieved: Indicates whether any responses cont...
2
stack_v2_sparse_classes_30k_train_005778
Implement the Python class `IdempotentRetryPolicy` described below. Class description: A policy used for retrying idempotent statements. Method signatures and docstrings: - def on_read_timeout(self, query, consistency, required_responses, received_responses, data_retrieved, retry_num): This is called when a ReadTimeo...
Implement the Python class `IdempotentRetryPolicy` described below. Class description: A policy used for retrying idempotent statements. Method signatures and docstrings: - def on_read_timeout(self, query, consistency, required_responses, received_responses, data_retrieved, retry_num): This is called when a ReadTimeo...
c24ddfd987c8eed8ed8864cc839cc0556a8af3c7
<|skeleton|> class IdempotentRetryPolicy: """A policy used for retrying idempotent statements.""" def on_read_timeout(self, query, consistency, required_responses, received_responses, data_retrieved, retry_num): """This is called when a ReadTimeout occurs. Args: query: A statement that timed out. consi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IdempotentRetryPolicy: """A policy used for retrying idempotent statements.""" def on_read_timeout(self, query, consistency, required_responses, received_responses, data_retrieved, retry_num): """This is called when a ReadTimeout occurs. Args: query: A statement that timed out. consistency: The c...
the_stack_v2_python_sparse
AppDB/cassandra_env/cassandra_interface.py
christianbaun/appscale
train
2
88f9b0618788c39b546d35a838890a1ad5d2d30b
[ "for i in range(1, len(A)):\n if A[i] < A[i - 1]:\n return i - 1", "l, h = (0, len(A) - 1)\nwhile l < h:\n m = (l + h) / 2\n if A[m] > A[m + 1]:\n h = m\n else:\n l = m + 1\nreturn l" ]
<|body_start_0|> for i in range(1, len(A)): if A[i] < A[i - 1]: return i - 1 <|end_body_0|> <|body_start_1|> l, h = (0, len(A) - 1) while l < h: m = (l + h) / 2 if A[m] > A[m + 1]: h = m else: l = m ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def peakIndexInMountainArray(self, A): """:type A: List[int] :rtype: int""" <|body_0|> def rewrite_BinarySearch(self, A): """Better solution, O(log(N))""" <|body_1|> <|end_skeleton|> <|body_start_0|> for i in range(1, len(A)): ...
stack_v2_sparse_classes_36k_train_009258
1,299
no_license
[ { "docstring": ":type A: List[int] :rtype: int", "name": "peakIndexInMountainArray", "signature": "def peakIndexInMountainArray(self, A)" }, { "docstring": "Better solution, O(log(N))", "name": "rewrite_BinarySearch", "signature": "def rewrite_BinarySearch(self, A)" } ]
2
stack_v2_sparse_classes_30k_train_019641
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def peakIndexInMountainArray(self, A): :type A: List[int] :rtype: int - def rewrite_BinarySearch(self, A): Better solution, O(log(N))
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def peakIndexInMountainArray(self, A): :type A: List[int] :rtype: int - def rewrite_BinarySearch(self, A): Better solution, O(log(N)) <|skeleton|> class Solution: def peakI...
6350568d16b0f8c49a020f055bb6d72e2705ea56
<|skeleton|> class Solution: def peakIndexInMountainArray(self, A): """:type A: List[int] :rtype: int""" <|body_0|> def rewrite_BinarySearch(self, A): """Better solution, O(log(N))""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def peakIndexInMountainArray(self, A): """:type A: List[int] :rtype: int""" for i in range(1, len(A)): if A[i] < A[i - 1]: return i - 1 def rewrite_BinarySearch(self, A): """Better solution, O(log(N))""" l, h = (0, len(A) - 1) ...
the_stack_v2_python_sparse
co_fb/852_Peak_Index_in_a_Mountain_Array.py
vsdrun/lc_public
train
6
c6b313facdc81c07a11e80222edeec9dc6ca344e
[ "n = len(A)\ncnt = 0\nf = [0 for _ in xrange(n + 1)]\nfor i in xrange(1, n + 1):\n f[i] = f[i - 1] + A[i - 1]\nf.sort()\nfor i in xrange(n + 1):\n lo = bisect_left(f, f[i] - end, 0, i)\n hi = bisect_right(f, f[i] - start, 0, i)\n cnt += hi - lo\nreturn cnt", "n = len(A)\ncnt = 0\nf = [0 for _ in xrang...
<|body_start_0|> n = len(A) cnt = 0 f = [0 for _ in xrange(n + 1)] for i in xrange(1, n + 1): f[i] = f[i - 1] + A[i - 1] f.sort() for i in xrange(n + 1): lo = bisect_left(f, f[i] - end, 0, i) hi = bisect_right(f, f[i] - start, 0, i) ...
Solution
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def subarraySumII(self, A, start, end): """O(n lg n) Binary Search Bound: f[i] - f[j] = start f[i] - f[j'] = end start < end f[j] > f[j'] :param A: an integer array :param start: start an integer :param end: end an integer :return:""" <|body_0|> def subarraySumII_T...
stack_v2_sparse_classes_36k_train_009259
1,766
permissive
[ { "docstring": "O(n lg n) Binary Search Bound: f[i] - f[j] = start f[i] - f[j'] = end start < end f[j] > f[j'] :param A: an integer array :param start: start an integer :param end: end an integer :return:", "name": "subarraySumII", "signature": "def subarraySumII(self, A, start, end)" }, { "docs...
2
stack_v2_sparse_classes_30k_val_000313
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def subarraySumII(self, A, start, end): O(n lg n) Binary Search Bound: f[i] - f[j] = start f[i] - f[j'] = end start < end f[j] > f[j'] :param A: an integer array :param start: st...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def subarraySumII(self, A, start, end): O(n lg n) Binary Search Bound: f[i] - f[j] = start f[i] - f[j'] = end start < end f[j] > f[j'] :param A: an integer array :param start: st...
4629a3857b2c57418b86a3b3a7180ecb15e763e3
<|skeleton|> class Solution: def subarraySumII(self, A, start, end): """O(n lg n) Binary Search Bound: f[i] - f[j] = start f[i] - f[j'] = end start < end f[j] > f[j'] :param A: an integer array :param start: start an integer :param end: end an integer :return:""" <|body_0|> def subarraySumII_T...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def subarraySumII(self, A, start, end): """O(n lg n) Binary Search Bound: f[i] - f[j] = start f[i] - f[j'] = end start < end f[j] > f[j'] :param A: an integer array :param start: start an integer :param end: end an integer :return:""" n = len(A) cnt = 0 f = [0 for _ i...
the_stack_v2_python_sparse
Subarray Sum II.py
RijuDasgupta9116/LintCode
train
0
d4d6e81a1e4182c269cdaac531e29d97b4ce5c53
[ "assert len(input_mask_and_length_tuple) > 1\nassert len(output_mask_and_length_tuple) == 1\nsuper().__init__(input_mask_and_length_tuple, output_mask_and_length_tuple)", "assert len(input_mask_list) > 1\nassert len(output_mask_list) == 1\noutput_mask_list[0] = [item for input_mask in input_mask_list for item in ...
<|body_start_0|> assert len(input_mask_and_length_tuple) > 1 assert len(output_mask_and_length_tuple) == 1 super().__init__(input_mask_and_length_tuple, output_mask_and_length_tuple) <|end_body_0|> <|body_start_1|> assert len(input_mask_list) > 1 assert len(output_mask_list) == ...
Models CONCAT internal connectivity for an Op.
ConcatInternalConnectivity
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConcatInternalConnectivity: """Models CONCAT internal connectivity for an Op.""" def __init__(self, input_mask_and_length_tuple: List[Tuple[List, int]], output_mask_and_length_tuple: List[Tuple[List, int]]): """:param input_mask_and_length_tuple: List of Tuples. Each Tuple contains a...
stack_v2_sparse_classes_36k_train_009260
39,659
permissive
[ { "docstring": ":param input_mask_and_length_tuple: List of Tuples. Each Tuple contains a list of input masks and the mask length. :param output_mask_and_length_tuple: List of Tuples. Each Tuple contains a list of output masks and the mask length.", "name": "__init__", "signature": "def __init__(self, i...
3
stack_v2_sparse_classes_30k_train_010562
Implement the Python class `ConcatInternalConnectivity` described below. Class description: Models CONCAT internal connectivity for an Op. Method signatures and docstrings: - def __init__(self, input_mask_and_length_tuple: List[Tuple[List, int]], output_mask_and_length_tuple: List[Tuple[List, int]]): :param input_mas...
Implement the Python class `ConcatInternalConnectivity` described below. Class description: Models CONCAT internal connectivity for an Op. Method signatures and docstrings: - def __init__(self, input_mask_and_length_tuple: List[Tuple[List, int]], output_mask_and_length_tuple: List[Tuple[List, int]]): :param input_mas...
5a406e657082b6a4f6e4bf48f0e46e085cb1e351
<|skeleton|> class ConcatInternalConnectivity: """Models CONCAT internal connectivity for an Op.""" def __init__(self, input_mask_and_length_tuple: List[Tuple[List, int]], output_mask_and_length_tuple: List[Tuple[List, int]]): """:param input_mask_and_length_tuple: List of Tuples. Each Tuple contains a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ConcatInternalConnectivity: """Models CONCAT internal connectivity for an Op.""" def __init__(self, input_mask_and_length_tuple: List[Tuple[List, int]], output_mask_and_length_tuple: List[Tuple[List, int]]): """:param input_mask_and_length_tuple: List of Tuples. Each Tuple contains a list of inpu...
the_stack_v2_python_sparse
TrainingExtensions/common/src/python/aimet_common/winnow/mask.py
quic/aimet
train
1,676
5f86744bf06f08bb0f828efd62b27bcc58bc6ec8
[ "self.train_data = train_data\nself.bandwidth = bandwidth\nif kernel_type != 'gaussian':\n raise NotImplementedError\nself.kernel_type = kernel_type", "if self.bandwidth is None:\n output = kde_func(x, self.train_data[idx], bandwidth=self.bandwidth, kernel_type=self.kernel_type)\nelse:\n output = kde_fun...
<|body_start_0|> self.train_data = train_data self.bandwidth = bandwidth if kernel_type != 'gaussian': raise NotImplementedError self.kernel_type = kernel_type <|end_body_0|> <|body_start_1|> if self.bandwidth is None: output = kde_func(x, self.train_data...
KDE
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KDE: def __init__(self, bandwidth=1.0, kernel_type='gaussian'): """Custom version of scipy's KernelDensity. Inputs: bandwidth (float): bandwidth of kernel (std for gaussian). kernel_type (string): see kernel arg here https://scikit-learn.org/stable/modules/generated/sklearn.neighbors.Ker...
stack_v2_sparse_classes_36k_train_009261
10,800
no_license
[ { "docstring": "Custom version of scipy's KernelDensity. Inputs: bandwidth (float): bandwidth of kernel (std for gaussian). kernel_type (string): see kernel arg here https://scikit-learn.org/stable/modules/generated/sklearn.neighbors.KernelDensity.html", "name": "__init__", "signature": "def __init__(se...
2
null
Implement the Python class `KDE` described below. Class description: Implement the KDE class. Method signatures and docstrings: - def __init__(self, bandwidth=1.0, kernel_type='gaussian'): Custom version of scipy's KernelDensity. Inputs: bandwidth (float): bandwidth of kernel (std for gaussian). kernel_type (string):...
Implement the Python class `KDE` described below. Class description: Implement the KDE class. Method signatures and docstrings: - def __init__(self, bandwidth=1.0, kernel_type='gaussian'): Custom version of scipy's KernelDensity. Inputs: bandwidth (float): bandwidth of kernel (std for gaussian). kernel_type (string):...
ad713e4eb15a2d9573622bace528fc86e19a6545
<|skeleton|> class KDE: def __init__(self, bandwidth=1.0, kernel_type='gaussian'): """Custom version of scipy's KernelDensity. Inputs: bandwidth (float): bandwidth of kernel (std for gaussian). kernel_type (string): see kernel arg here https://scikit-learn.org/stable/modules/generated/sklearn.neighbors.Ker...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KDE: def __init__(self, bandwidth=1.0, kernel_type='gaussian'): """Custom version of scipy's KernelDensity. Inputs: bandwidth (float): bandwidth of kernel (std for gaussian). kernel_type (string): see kernel arg here https://scikit-learn.org/stable/modules/generated/sklearn.neighbors.KernelDensity.htm...
the_stack_v2_python_sparse
manipulation/plating/GMM-Placing/gmm_placing/kernel_density.py
HARPLab/gastronomy
train
6
c0f4d193c1e2e8f81d96f8b6828a0c2890950c40
[ "self.res_ls = []\ncur_sum = 0\nfor i in nums:\n cur_sum += i\n self.res_ls.append(cur_sum)", "if i == 0:\n return self.res_ls[j]\nreturn self.res_ls[j] - self.res_ls[i - 1]" ]
<|body_start_0|> self.res_ls = [] cur_sum = 0 for i in nums: cur_sum += i self.res_ls.append(cur_sum) <|end_body_0|> <|body_start_1|> if i == 0: return self.res_ls[j] return self.res_ls[j] - self.res_ls[i - 1] <|end_body_1|>
NumArray
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumArray: def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def sumRange(self, i, j): """:type i: int :type j: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.res_ls = [] cur_sum = 0 for i in nums:...
stack_v2_sparse_classes_36k_train_009262
680
no_license
[ { "docstring": ":type nums: List[int]", "name": "__init__", "signature": "def __init__(self, nums)" }, { "docstring": ":type i: int :type j: int :rtype: int", "name": "sumRange", "signature": "def sumRange(self, i, j)" } ]
2
null
Implement the Python class `NumArray` described below. Class description: Implement the NumArray class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] - def sumRange(self, i, j): :type i: int :type j: int :rtype: int
Implement the Python class `NumArray` described below. Class description: Implement the NumArray class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] - def sumRange(self, i, j): :type i: int :type j: int :rtype: int <|skeleton|> class NumArray: def __init__(self, nums): ...
2ecaeed38178819480388b5742bc2ea12009ae16
<|skeleton|> class NumArray: def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def sumRange(self, i, j): """:type i: int :type j: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NumArray: def __init__(self, nums): """:type nums: List[int]""" self.res_ls = [] cur_sum = 0 for i in nums: cur_sum += i self.res_ls.append(cur_sum) def sumRange(self, i, j): """:type i: int :type j: int :rtype: int""" if i == 0: ...
the_stack_v2_python_sparse
303.range-sum-query-immutable.py
LouisYLWang/leetcode_python
train
0
1cff53bfd76a8a23c0f3dbeaa2af3fcff5769379
[ "startTime = datetime.datetime.now()\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate(TEAM_NAME, TEAM_NAME)\nelectionIds = list(repo[STATE_SENATE_ELECTIONS_NAME].find({}, {'_id': 1}))\nelectionResultsRows = []\nfor question in electionIds:\n id = question['_id']\n url = ELECTION_DOWN...
<|body_start_0|> startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate(TEAM_NAME, TEAM_NAME) electionIds = list(repo[STATE_SENATE_ELECTIONS_NAME].find({}, {'_id': 1})) electionResultsRows = [] for question in e...
stateSenateElectionsResults
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class stateSenateElectionsResults: def execute(trial=False): """Retrieve election results data from electionstats and insert into collection ex) { "City/Town" : "Egremont", "Ward" : "-", "Pct" : "1", "Election ID" : "131526", "Adam G Hinds" : 682, "All Others" : 0, "Blanks" : 111, "Total Votes...
stack_v2_sparse_classes_36k_train_009263
6,348
no_license
[ { "docstring": "Retrieve election results data from electionstats and insert into collection ex) { \"City/Town\" : \"Egremont\", \"Ward\" : \"-\", \"Pct\" : \"1\", \"Election ID\" : \"131526\", \"Adam G Hinds\" : 682, \"All Others\" : 0, \"Blanks\" : 111, \"Total Votes Cast\" : 793 }", "name": "execute", ...
3
stack_v2_sparse_classes_30k_train_009946
Implement the Python class `stateSenateElectionsResults` described below. Class description: Implement the stateSenateElectionsResults class. Method signatures and docstrings: - def execute(trial=False): Retrieve election results data from electionstats and insert into collection ex) { "City/Town" : "Egremont", "Ward...
Implement the Python class `stateSenateElectionsResults` described below. Class description: Implement the stateSenateElectionsResults class. Method signatures and docstrings: - def execute(trial=False): Retrieve election results data from electionstats and insert into collection ex) { "City/Town" : "Egremont", "Ward...
90284cf3debbac36eead07b8d2339cdd191b86cf
<|skeleton|> class stateSenateElectionsResults: def execute(trial=False): """Retrieve election results data from electionstats and insert into collection ex) { "City/Town" : "Egremont", "Ward" : "-", "Pct" : "1", "Election ID" : "131526", "Adam G Hinds" : 682, "All Others" : 0, "Blanks" : 111, "Total Votes...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class stateSenateElectionsResults: def execute(trial=False): """Retrieve election results data from electionstats and insert into collection ex) { "City/Town" : "Egremont", "Ward" : "-", "Pct" : "1", "Election ID" : "131526", "Adam G Hinds" : 682, "All Others" : 0, "Blanks" : 111, "Total Votes Cast" : 793 }...
the_stack_v2_python_sparse
ldisalvo_skeesara_vidyaap/stateSenateElectionsResults.py
maximega/course-2019-spr-proj
train
2
88f30c129d57e5c81255200b9f74bec2371c3b1b
[ "if len(lists) == 0:\n return 0\nif len(lists) == 1:\n return lists[0]\nif len(lists) >= 2:\n n = len(lists)\n res = self.mergeTwoLists(lists[0], lists[1])\n for i in range(2, n):\n res = self.mergeTwoLists(res, lists[i])\nreturn res", "if l1 == None:\n return l2\nif l2 == None:\n retu...
<|body_start_0|> if len(lists) == 0: return 0 if len(lists) == 1: return lists[0] if len(lists) >= 2: n = len(lists) res = self.mergeTwoLists(lists[0], lists[1]) for i in range(2, n): res = self.mergeTwoLists(res, lists[...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def mergeKLists(self, lists): """:type lists: List[ListNode] :rtype: ListNode""" <|body_0|> def mergeTwoLists(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|> <|body_start_0|> if len(l...
stack_v2_sparse_classes_36k_train_009264
1,866
no_license
[ { "docstring": ":type lists: List[ListNode] :rtype: ListNode", "name": "mergeKLists", "signature": "def mergeKLists(self, lists)" }, { "docstring": ":type l1: ListNode :type l2: ListNode :rtype: ListNode", "name": "mergeTwoLists", "signature": "def mergeTwoLists(self, l1, l2)" } ]
2
stack_v2_sparse_classes_30k_val_001168
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeKLists(self, lists): :type lists: List[ListNode] :rtype: ListNode - def mergeTwoLists(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeKLists(self, lists): :type lists: List[ListNode] :rtype: ListNode - def mergeTwoLists(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode <|skeleton|>...
a9b2de06306f3929a82ef4e6613c972e9a2c2200
<|skeleton|> class Solution: def mergeKLists(self, lists): """:type lists: List[ListNode] :rtype: ListNode""" <|body_0|> def mergeTwoLists(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def mergeKLists(self, lists): """:type lists: List[ListNode] :rtype: ListNode""" if len(lists) == 0: return 0 if len(lists) == 1: return lists[0] if len(lists) >= 2: n = len(lists) res = self.mergeTwoLists(lists[0], list...
the_stack_v2_python_sparse
Practice_2/Merge_K_Sorted_Linked_Lists.py
anantvir/Leetcode-Problems
train
1
a687f2091d4e87a8ca992fa2b0225b23f26b771d
[ "piece_selected = None\nvalid_pieces = gamestate.get_valid_pieces()\nif len(valid_pieces) != 0:\n index = randint(0, len(valid_pieces) - 1)\n piece_selected = valid_pieces[index]\nreturn piece_selected", "move_choices = None\nmove_choices = checkerpiece.get_possible_moves(squares)\nif move_choices != 0:\n ...
<|body_start_0|> piece_selected = None valid_pieces = gamestate.get_valid_pieces() if len(valid_pieces) != 0: index = randint(0, len(valid_pieces) - 1) piece_selected = valid_pieces[index] return piece_selected <|end_body_0|> <|body_start_1|> move_choices...
Class -- ComputerPlayer Represents the Computer player. Attributes: None Methods: select_piece -- selects a valid piece to move make_move -- indicates the BoardSquare object to move the selected piece to
ComputerPlayer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ComputerPlayer: """Class -- ComputerPlayer Represents the Computer player. Attributes: None Methods: select_piece -- selects a valid piece to move make_move -- indicates the BoardSquare object to move the selected piece to""" def select_piece(self, gamestate): """Method -- select_pie...
stack_v2_sparse_classes_36k_train_009265
2,054
no_license
[ { "docstring": "Method -- select_piece This function returns a valid checkerpiece object that the ComputerPlayer will move. Parameters: self -- the current ComputerPlayer object gamestate -- an object representing the current state of the game Returns: A checkerpiece object selected by the ComputerPlayer to mov...
2
stack_v2_sparse_classes_30k_train_002605
Implement the Python class `ComputerPlayer` described below. Class description: Class -- ComputerPlayer Represents the Computer player. Attributes: None Methods: select_piece -- selects a valid piece to move make_move -- indicates the BoardSquare object to move the selected piece to Method signatures and docstrings: ...
Implement the Python class `ComputerPlayer` described below. Class description: Class -- ComputerPlayer Represents the Computer player. Attributes: None Methods: select_piece -- selects a valid piece to move make_move -- indicates the BoardSquare object to move the selected piece to Method signatures and docstrings: ...
6dec740c98abacba12e037b44d2f92ff773269d1
<|skeleton|> class ComputerPlayer: """Class -- ComputerPlayer Represents the Computer player. Attributes: None Methods: select_piece -- selects a valid piece to move make_move -- indicates the BoardSquare object to move the selected piece to""" def select_piece(self, gamestate): """Method -- select_pie...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ComputerPlayer: """Class -- ComputerPlayer Represents the Computer player. Attributes: None Methods: select_piece -- selects a valid piece to move make_move -- indicates the BoardSquare object to move the selected piece to""" def select_piece(self, gamestate): """Method -- select_piece This funct...
the_stack_v2_python_sparse
computerplayer.py
skhatri-28/Checkers-Game
train
0
5b2809f879ed9e8acec21c6d4f7658d104c7e2ed
[ "assert Line.objects.count() == 0\nwith mute_signals(post_save):\n user = UserFactory.create()\nfa_program = ProgramFactory.create(financial_aid_availability=True)\nCachedEnrollmentVerifiedFactory.create(user=user, course_run__course__program=fa_program)\nlines = Line.objects.all()\nassert len(lines) == 1\nasser...
<|body_start_0|> assert Line.objects.count() == 0 with mute_signals(post_save): user = UserFactory.create() fa_program = ProgramFactory.create(financial_aid_availability=True) CachedEnrollmentVerifiedFactory.create(user=user, course_run__course__program=fa_program) li...
Tests for dashboard factories
DashboardFactoryTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DashboardFactoryTests: """Tests for dashboard factories""" def test_verified_enroll_factory_fa_create(self): """Tests that CachedEnrollmentVerifiedFactory creates additional data for a FA-enabled course run""" <|body_0|> def test_verified_enrollment_factory_fa_build(self...
stack_v2_sparse_classes_36k_train_009266
1,612
no_license
[ { "docstring": "Tests that CachedEnrollmentVerifiedFactory creates additional data for a FA-enabled course run", "name": "test_verified_enroll_factory_fa_create", "signature": "def test_verified_enroll_factory_fa_create(self)" }, { "docstring": "Tests that CachedEnrollmentVerifiedFactory does no...
2
stack_v2_sparse_classes_30k_train_014976
Implement the Python class `DashboardFactoryTests` described below. Class description: Tests for dashboard factories Method signatures and docstrings: - def test_verified_enroll_factory_fa_create(self): Tests that CachedEnrollmentVerifiedFactory creates additional data for a FA-enabled course run - def test_verified_...
Implement the Python class `DashboardFactoryTests` described below. Class description: Tests for dashboard factories Method signatures and docstrings: - def test_verified_enroll_factory_fa_create(self): Tests that CachedEnrollmentVerifiedFactory creates additional data for a FA-enabled course run - def test_verified_...
3c166bc52dfe8d7aa04f922134f4f6deeff49eb6
<|skeleton|> class DashboardFactoryTests: """Tests for dashboard factories""" def test_verified_enroll_factory_fa_create(self): """Tests that CachedEnrollmentVerifiedFactory creates additional data for a FA-enabled course run""" <|body_0|> def test_verified_enrollment_factory_fa_build(self...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DashboardFactoryTests: """Tests for dashboard factories""" def test_verified_enroll_factory_fa_create(self): """Tests that CachedEnrollmentVerifiedFactory creates additional data for a FA-enabled course run""" assert Line.objects.count() == 0 with mute_signals(post_save): ...
the_stack_v2_python_sparse
dashboard/factories_test.py
avontd2868/micromasters
train
0
e2063b4154f217d2ff5041f56af8865f22ccaa65
[ "challenges: List[Dict[str, Any]] = []\nchallenges = WeaponUnlockChallenges.Table(self, challenges)\nUtility.WriteFile(self, f'{self.eXAssets}/weaponUnlockChallenges.json', challenges)\nlog.info(f'Compiled {len(challenges):,} Weapon Unlock Challenges')", "table: List[Dict[str, Any]] = Utility.ReadCSV(self, f'{sel...
<|body_start_0|> challenges: List[Dict[str, Any]] = [] challenges = WeaponUnlockChallenges.Table(self, challenges) Utility.WriteFile(self, f'{self.eXAssets}/weaponUnlockChallenges.json', challenges) log.info(f'Compiled {len(challenges):,} Weapon Unlock Challenges') <|end_body_0|> <|body...
Weapon Unlock Challenge XAssets.
WeaponUnlockChallenges
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WeaponUnlockChallenges: """Weapon Unlock Challenge XAssets.""" def Compile(self: Any) -> None: """Compile the Weapon Unlock Challenge XAssets.""" <|body_0|> def Table(self: Any, challenges: List[Dict[str, Any]]) -> List[Dict[str, Any]]: """Compile the gun_unlock_...
stack_v2_sparse_classes_36k_train_009267
13,794
permissive
[ { "docstring": "Compile the Weapon Unlock Challenge XAssets.", "name": "Compile", "signature": "def Compile(self: Any) -> None" }, { "docstring": "Compile the gun_unlock_challenges.csv XAsset.", "name": "Table", "signature": "def Table(self: Any, challenges: List[Dict[str, Any]]) -> List...
2
stack_v2_sparse_classes_30k_train_014957
Implement the Python class `WeaponUnlockChallenges` described below. Class description: Weapon Unlock Challenge XAssets. Method signatures and docstrings: - def Compile(self: Any) -> None: Compile the Weapon Unlock Challenge XAssets. - def Table(self: Any, challenges: List[Dict[str, Any]]) -> List[Dict[str, Any]]: Co...
Implement the Python class `WeaponUnlockChallenges` described below. Class description: Weapon Unlock Challenge XAssets. Method signatures and docstrings: - def Compile(self: Any) -> None: Compile the Weapon Unlock Challenge XAssets. - def Table(self: Any, challenges: List[Dict[str, Any]]) -> List[Dict[str, Any]]: Co...
82d3198a64eb2905e96dd536ce2f0acb52f9ce77
<|skeleton|> class WeaponUnlockChallenges: """Weapon Unlock Challenge XAssets.""" def Compile(self: Any) -> None: """Compile the Weapon Unlock Challenge XAssets.""" <|body_0|> def Table(self: Any, challenges: List[Dict[str, Any]]) -> List[Dict[str, Any]]: """Compile the gun_unlock_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WeaponUnlockChallenges: """Weapon Unlock Challenge XAssets.""" def Compile(self: Any) -> None: """Compile the Weapon Unlock Challenge XAssets.""" challenges: List[Dict[str, Any]] = [] challenges = WeaponUnlockChallenges.Table(self, challenges) Utility.WriteFile(self, f'{se...
the_stack_v2_python_sparse
ModernWarfare/XAssets/challenges.py
dbuentello/Hyde
train
0
2e0911386131492c0fa74ac6899e6e79db31e8eb
[ "CREATOR_ID = 'creator_id'\n_CREATOR_ID = request.query_params.get(CREATOR_ID, None)\nif _CREATOR_ID:\n books = BookService.get_books(creator_id=_CREATOR_ID, deleted=False)\nelse:\n books = BookService.get_books(deleted=False)\nreturn SimpleResponse(BookService.serialize_objs(books))", "BOOK_ID = id\ntry:\n...
<|body_start_0|> CREATOR_ID = 'creator_id' _CREATOR_ID = request.query_params.get(CREATOR_ID, None) if _CREATOR_ID: books = BookService.get_books(creator_id=_CREATOR_ID, deleted=False) else: books = BookService.get_books(deleted=False) return SimpleRespons...
BookViewSet
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BookViewSet: def list(self, request): """获得书本的列表 creator_id -- creator's id --- omit_serializer: true""" <|body_0|> def destroy(self, request, id): """Delete One Book By Book's id --- omit_serializer: true""" <|body_1|> def create(self, request): ...
stack_v2_sparse_classes_36k_train_009268
9,000
permissive
[ { "docstring": "获得书本的列表 creator_id -- creator's id --- omit_serializer: true", "name": "list", "signature": "def list(self, request)" }, { "docstring": "Delete One Book By Book's id --- omit_serializer: true", "name": "destroy", "signature": "def destroy(self, request, id)" }, { ...
5
stack_v2_sparse_classes_30k_test_000564
Implement the Python class `BookViewSet` described below. Class description: Implement the BookViewSet class. Method signatures and docstrings: - def list(self, request): 获得书本的列表 creator_id -- creator's id --- omit_serializer: true - def destroy(self, request, id): Delete One Book By Book's id --- omit_serializer: tr...
Implement the Python class `BookViewSet` described below. Class description: Implement the BookViewSet class. Method signatures and docstrings: - def list(self, request): 获得书本的列表 creator_id -- creator's id --- omit_serializer: true - def destroy(self, request, id): Delete One Book By Book's id --- omit_serializer: tr...
31ac08148fbe67ab166faa897c0cbe72cd7f62db
<|skeleton|> class BookViewSet: def list(self, request): """获得书本的列表 creator_id -- creator's id --- omit_serializer: true""" <|body_0|> def destroy(self, request, id): """Delete One Book By Book's id --- omit_serializer: true""" <|body_1|> def create(self, request): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BookViewSet: def list(self, request): """获得书本的列表 creator_id -- creator's id --- omit_serializer: true""" CREATOR_ID = 'creator_id' _CREATOR_ID = request.query_params.get(CREATOR_ID, None) if _CREATOR_ID: books = BookService.get_books(creator_id=_CREATOR_ID, deleted=...
the_stack_v2_python_sparse
wheat/apps/book/apis.py
fortyMiles/moment-note
train
2
39d77f27aa94803e28a2432c2c6a872a98c08a01
[ "startTime = datetime.datetime.now()\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('yuxiao_yzhang11', 'yuxiao_yzhang11')\nrepo.dropCollection('rental_zip_price')\nrepo.createCollection('rental_zip_price')\nrepo.dropCollection('fire_count')\nrepo.createCollection('fire_count')\nfire = re...
<|body_start_0|> startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('yuxiao_yzhang11', 'yuxiao_yzhang11') repo.dropCollection('rental_zip_price') repo.createCollection('rental_zip_price') repo.dropCollection...
fire_rental
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class fire_rental: def execute(trial=True): """Retrieve some data sets (not using the API here for the sake of simplicity).""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing everything ha...
stack_v2_sparse_classes_36k_train_009269
5,755
no_license
[ { "docstring": "Retrieve some data sets (not using the API here for the sake of simplicity).", "name": "execute", "signature": "def execute(trial=True)" }, { "docstring": "Create the provenance document describing everything happening in this script. Each run of the script will generate a new do...
2
stack_v2_sparse_classes_30k_train_019850
Implement the Python class `fire_rental` described below. Class description: Implement the fire_rental class. Method signatures and docstrings: - def execute(trial=True): Retrieve some data sets (not using the API here for the sake of simplicity). - def provenance(doc=prov.model.ProvDocument(), startTime=None, endTim...
Implement the Python class `fire_rental` described below. Class description: Implement the fire_rental class. Method signatures and docstrings: - def execute(trial=True): Retrieve some data sets (not using the API here for the sake of simplicity). - def provenance(doc=prov.model.ProvDocument(), startTime=None, endTim...
b5ccaad97f6e35f9580e645ca764f36eb3406f43
<|skeleton|> class fire_rental: def execute(trial=True): """Retrieve some data sets (not using the API here for the sake of simplicity).""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing everything ha...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class fire_rental: def execute(trial=True): """Retrieve some data sets (not using the API here for the sake of simplicity).""" startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('yuxiao_yzhang11', 'yuxiao_yzhang11') ...
the_stack_v2_python_sparse
yuxiao_yzhang11/fire_rental.py
dwang1995/course-2018-spr-proj
train
1
892bf446b0b7fc7a95f19774846dcee9f22f7095
[ "if not nums:\n return []\nres_lst = []\nleft_num = right_num = None\nfor i in range(len(nums)):\n if i == 0:\n left_num = nums[i]\n elif nums[i] == nums[i - 1] + 1:\n right_num = nums[i]\n else:\n if not right_num:\n res_lst.append(str(left_num))\n else:\n ...
<|body_start_0|> if not nums: return [] res_lst = [] left_num = right_num = None for i in range(len(nums)): if i == 0: left_num = nums[i] elif nums[i] == nums[i - 1] + 1: right_num = nums[i] else: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def summaryRanges(self, nums): """:type nums: List[int] :rtype: List[str]""" <|body_0|> def summaryRanges(self, nums): """:type nums: List[int] :rtype: List[str]""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not nums: retu...
stack_v2_sparse_classes_36k_train_009270
1,511
no_license
[ { "docstring": ":type nums: List[int] :rtype: List[str]", "name": "summaryRanges", "signature": "def summaryRanges(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: List[str]", "name": "summaryRanges", "signature": "def summaryRanges(self, nums)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def summaryRanges(self, nums): :type nums: List[int] :rtype: List[str] - def summaryRanges(self, nums): :type nums: List[int] :rtype: List[str]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def summaryRanges(self, nums): :type nums: List[int] :rtype: List[str] - def summaryRanges(self, nums): :type nums: List[int] :rtype: List[str] <|skeleton|> class Solution: ...
052bd7915257679877dbe55b60ed1abb7528eaa2
<|skeleton|> class Solution: def summaryRanges(self, nums): """:type nums: List[int] :rtype: List[str]""" <|body_0|> def summaryRanges(self, nums): """:type nums: List[int] :rtype: List[str]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def summaryRanges(self, nums): """:type nums: List[int] :rtype: List[str]""" if not nums: return [] res_lst = [] left_num = right_num = None for i in range(len(nums)): if i == 0: left_num = nums[i] elif nums[...
the_stack_v2_python_sparse
python_solution/Array/228_SummaryRanges.py
Dimen61/leetcode
train
4
2a9e37e0a7822ce53067925a769138f5740ed6a8
[ "n = len(matrix)\n\ndef get_points(x, y):\n p1 = (x, y)\n p2 = (y, n - x - 1)\n p3 = (n - x - 1, n - y - 1)\n p4 = (n - y - 1, x)\n return (p1, p2, p3, p4)\nfor i in range(n // 2):\n for j in range(i, n - i - 1):\n (x1, y1), (x2, y2), (x3, y3), (x4, y4) = get_points(i, j)\n matrix[x2...
<|body_start_0|> n = len(matrix) def get_points(x, y): p1 = (x, y) p2 = (y, n - x - 1) p3 = (n - x - 1, n - y - 1) p4 = (n - y - 1, x) return (p1, p2, p3, p4) for i in range(n // 2): for j in range(i, n - i - 1): ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def rotate(self, matrix: List[List[int]]) -> None: """2022-08-30 Runtime: 56 ms, faster than 49.28% Memory Usage: 14 MB, less than 29.99% Do not return anything, modify matrix in-place instead. n == matrix.length == matrix[i].length 1 <= n <= 20 -1000 <= matrix[i][j] <= 1000"""...
stack_v2_sparse_classes_36k_train_009271
2,485
permissive
[ { "docstring": "2022-08-30 Runtime: 56 ms, faster than 49.28% Memory Usage: 14 MB, less than 29.99% Do not return anything, modify matrix in-place instead. n == matrix.length == matrix[i].length 1 <= n <= 20 -1000 <= matrix[i][j] <= 1000", "name": "rotate", "signature": "def rotate(self, matrix: List[Li...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rotate(self, matrix: List[List[int]]) -> None: 2022-08-30 Runtime: 56 ms, faster than 49.28% Memory Usage: 14 MB, less than 29.99% Do not return anything, modify matrix in-pl...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rotate(self, matrix: List[List[int]]) -> None: 2022-08-30 Runtime: 56 ms, faster than 49.28% Memory Usage: 14 MB, less than 29.99% Do not return anything, modify matrix in-pl...
4dd1e54d8d08f7e6590bc76abd08ecaacaf775e5
<|skeleton|> class Solution: def rotate(self, matrix: List[List[int]]) -> None: """2022-08-30 Runtime: 56 ms, faster than 49.28% Memory Usage: 14 MB, less than 29.99% Do not return anything, modify matrix in-place instead. n == matrix.length == matrix[i].length 1 <= n <= 20 -1000 <= matrix[i][j] <= 1000"""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def rotate(self, matrix: List[List[int]]) -> None: """2022-08-30 Runtime: 56 ms, faster than 49.28% Memory Usage: 14 MB, less than 29.99% Do not return anything, modify matrix in-place instead. n == matrix.length == matrix[i].length 1 <= n <= 20 -1000 <= matrix[i][j] <= 1000""" n = l...
the_stack_v2_python_sparse
src/48-RotateImage.py
Jiezhi/myleetcode
train
1
9787bd1e37dc8c6c09af2110c2f8b1aeb466baad
[ "self.limit = None\nself.remaining = None\nself.reset = None", "if self.reset is None:\n return None\nreturn datetime.fromtimestamp(int(self.reset), tz=timezone.utc).replace(tzinfo=None)", "self.limit = headers.get('X-RateLimit-Limit', '0')\nself.remaining = headers.get('X-RateLimit-Remaining', '0')\nself.re...
<|body_start_0|> self.limit = None self.remaining = None self.reset = None <|end_body_0|> <|body_start_1|> if self.reset is None: return None return datetime.fromtimestamp(int(self.reset), tz=timezone.utc).replace(tzinfo=None) <|end_body_1|> <|body_start_2|> ...
AIOGitHubAPIRateLimit Holds information about the current reatelimit status.
AIOGitHubAPIRateLimit
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AIOGitHubAPIRateLimit: """AIOGitHubAPIRateLimit Holds information about the current reatelimit status.""" def __init__(self) -> None: """Initialize.""" <|body_0|> def reset_utc(self) -> None: """Return naïve date + time in UTC for next reset.""" <|body_1|...
stack_v2_sparse_classes_36k_train_009272
1,126
permissive
[ { "docstring": "Initialize.", "name": "__init__", "signature": "def __init__(self) -> None" }, { "docstring": "Return naïve date + time in UTC for next reset.", "name": "reset_utc", "signature": "def reset_utc(self) -> None" }, { "docstring": "Load from response headers. :param h...
3
null
Implement the Python class `AIOGitHubAPIRateLimit` described below. Class description: AIOGitHubAPIRateLimit Holds information about the current reatelimit status. Method signatures and docstrings: - def __init__(self) -> None: Initialize. - def reset_utc(self) -> None: Return naïve date + time in UTC for next reset....
Implement the Python class `AIOGitHubAPIRateLimit` described below. Class description: AIOGitHubAPIRateLimit Holds information about the current reatelimit status. Method signatures and docstrings: - def __init__(self) -> None: Initialize. - def reset_utc(self) -> None: Return naïve date + time in UTC for next reset....
90f3fc98e5096300269763c9a5857481b2dec4d2
<|skeleton|> class AIOGitHubAPIRateLimit: """AIOGitHubAPIRateLimit Holds information about the current reatelimit status.""" def __init__(self) -> None: """Initialize.""" <|body_0|> def reset_utc(self) -> None: """Return naïve date + time in UTC for next reset.""" <|body_1|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AIOGitHubAPIRateLimit: """AIOGitHubAPIRateLimit Holds information about the current reatelimit status.""" def __init__(self) -> None: """Initialize.""" self.limit = None self.remaining = None self.reset = None def reset_utc(self) -> None: """Return naïve date ...
the_stack_v2_python_sparse
aiogithubapi/objects/ratelimit.py
ludeeus/aiogithubapi
train
21
863777be6a8136dd8144abda04eea8a9265533b8
[ "if not data:\n data = 0\nif not size:\n size = 1\nmax_size = 2 ** (size * 8)\nif data >= max_size:\n data = max_size - 1\nreturn data.to_bytes(size, byteorder='big')", "if not size:\n size = 1\nif len(payload) < size:\n return (payload, None)\nreturn (payload[size:], int.from_bytes(payload[:size],...
<|body_start_0|> if not data: data = 0 if not size: size = 1 max_size = 2 ** (size * 8) if data >= max_size: data = max_size - 1 return data.to_bytes(size, byteorder='big') <|end_body_0|> <|body_start_1|> if not size: size ...
INT data encode in x bytes.
SMPayloadTypeINT
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SMPayloadTypeINT: """INT data encode in x bytes.""" def encode(data, size=1): """Encode integer into binary string :Example: >>> SMPayloadTypeINT.encode(2, size=2) b'\\x00\\x02' >>> SMPayloadTypeINT.encode(123456789, size=4) b'\\x07[\\xcd\\x15' >>> # Return the max is size exceed >>>...
stack_v2_sparse_classes_36k_train_009273
14,049
permissive
[ { "docstring": "Encode integer into binary string :Example: >>> SMPayloadTypeINT.encode(2, size=2) b'\\\\x00\\\\x02' >>> SMPayloadTypeINT.encode(123456789, size=4) b'\\\\x07[\\\\xcd\\\\x15' >>> # Return the max is size exceed >>> SMPayloadTypeINT.encode(5165165, size=2) b'\\\\xff\\\\xff'", "name": "encode",...
2
stack_v2_sparse_classes_30k_train_011551
Implement the Python class `SMPayloadTypeINT` described below. Class description: INT data encode in x bytes. Method signatures and docstrings: - def encode(data, size=1): Encode integer into binary string :Example: >>> SMPayloadTypeINT.encode(2, size=2) b'\\x00\\x02' >>> SMPayloadTypeINT.encode(123456789, size=4) b'...
Implement the Python class `SMPayloadTypeINT` described below. Class description: INT data encode in x bytes. Method signatures and docstrings: - def encode(data, size=1): Encode integer into binary string :Example: >>> SMPayloadTypeINT.encode(2, size=2) b'\\x00\\x02' >>> SMPayloadTypeINT.encode(123456789, size=4) b'...
cf20b363ed3d7bcb75101b17870e876a857ecd66
<|skeleton|> class SMPayloadTypeINT: """INT data encode in x bytes.""" def encode(data, size=1): """Encode integer into binary string :Example: >>> SMPayloadTypeINT.encode(2, size=2) b'\\x00\\x02' >>> SMPayloadTypeINT.encode(123456789, size=4) b'\\x07[\\xcd\\x15' >>> # Return the max is size exceed >>>...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SMPayloadTypeINT: """INT data encode in x bytes.""" def encode(data, size=1): """Encode integer into binary string :Example: >>> SMPayloadTypeINT.encode(2, size=2) b'\\x00\\x02' >>> SMPayloadTypeINT.encode(123456789, size=4) b'\\x07[\\xcd\\x15' >>> # Return the max is size exceed >>> SMPayloadTyp...
the_stack_v2_python_sparse
smserver/smutils/smpacket/smencoder.py
Moutix/stepmania-server
train
4
c638cd5f56d1d9a79d2067a478edd7d454b4036a
[ "if not nums:\n return\nself.__n = nums\nl = math.sqrt(len(nums))\nself.lens = math.ceil(len(nums) / l)\nself.b = [0 for _ in range(self.lens)]\nfor i in range(len(nums)):\n self.b[i // self.lens] += nums[i]", "b_l = i // self.lens\nself.b[b_l] = self.b[b_l] - self.__n[i] + val\nself.__n[i] = val", "s = 0...
<|body_start_0|> if not nums: return self.__n = nums l = math.sqrt(len(nums)) self.lens = math.ceil(len(nums) / l) self.b = [0 for _ in range(self.lens)] for i in range(len(nums)): self.b[i // self.lens] += nums[i] <|end_body_0|> <|body_start_1|> ...
NumArray
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumArray: def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def update(self, i, val): """:type i: int :type val: int :rtype: void""" <|body_1|> def sumRange(self, i, j): """:type i: int :type j: int :rtype: int""" <|body_2|...
stack_v2_sparse_classes_36k_train_009274
1,342
no_license
[ { "docstring": ":type nums: List[int]", "name": "__init__", "signature": "def __init__(self, nums)" }, { "docstring": ":type i: int :type val: int :rtype: void", "name": "update", "signature": "def update(self, i, val)" }, { "docstring": ":type i: int :type j: int :rtype: int", ...
3
null
Implement the Python class `NumArray` described below. Class description: Implement the NumArray class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] - def update(self, i, val): :type i: int :type val: int :rtype: void - def sumRange(self, i, j): :type i: int :type j: int :rtype:...
Implement the Python class `NumArray` described below. Class description: Implement the NumArray class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] - def update(self, i, val): :type i: int :type val: int :rtype: void - def sumRange(self, i, j): :type i: int :type j: int :rtype:...
bccd0f6ebb00e9569093f8ec18ebf0e94035dce6
<|skeleton|> class NumArray: def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def update(self, i, val): """:type i: int :type val: int :rtype: void""" <|body_1|> def sumRange(self, i, j): """:type i: int :type j: int :rtype: int""" <|body_2|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NumArray: def __init__(self, nums): """:type nums: List[int]""" if not nums: return self.__n = nums l = math.sqrt(len(nums)) self.lens = math.ceil(len(nums) / l) self.b = [0 for _ in range(self.lens)] for i in range(len(nums)): se...
the_stack_v2_python_sparse
Range Sum Query - Mutable.py
nan0445/Leetcode-Python
train
0
8798367333a1c41e46786ff3a41e7bfe38dbcdd9
[ "num = 1\nself.container = []\ntemp = 0\nfor w_ in w:\n temp += w_\n self.container.append(temp)\nself.maxint = temp", "rand = random.randint(1, self.maxint)\nindex = bisect.bisect_left(self.container, rand)\nreturn index" ]
<|body_start_0|> num = 1 self.container = [] temp = 0 for w_ in w: temp += w_ self.container.append(temp) self.maxint = temp <|end_body_0|> <|body_start_1|> rand = random.randint(1, self.maxint) index = bisect.bisect_left(self.container, r...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def __init__(self, w): """:type w: List[int]""" <|body_0|> def pickIndex(self): """:rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> num = 1 self.container = [] temp = 0 for w_ in w: temp += w_...
stack_v2_sparse_classes_36k_train_009275
616
no_license
[ { "docstring": ":type w: List[int]", "name": "__init__", "signature": "def __init__(self, w)" }, { "docstring": ":rtype: int", "name": "pickIndex", "signature": "def pickIndex(self)" } ]
2
stack_v2_sparse_classes_30k_train_002757
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, w): :type w: List[int] - def pickIndex(self): :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, w): :type w: List[int] - def pickIndex(self): :rtype: int <|skeleton|> class Solution: def __init__(self, w): """:type w: List[int]""" <|...
d2e0fb4a55003d5c230fb8b2e13ac8b224b47a75
<|skeleton|> class Solution: def __init__(self, w): """:type w: List[int]""" <|body_0|> def pickIndex(self): """:rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def __init__(self, w): """:type w: List[int]""" num = 1 self.container = [] temp = 0 for w_ in w: temp += w_ self.container.append(temp) self.maxint = temp def pickIndex(self): """:rtype: int""" rand = rando...
the_stack_v2_python_sparse
528-pickIndex.py
sunshinewxz/leetcode
train
0
c51e01f03fa6c876b4ef3bf4ba940c5c9bd4910d
[ "server = ctx.guild\nif currency < 0 or currency > 1000:\n await ctx.send('Please enter a valid number between 0 and 1000.')\n return\nawait self.config.guild(server).msg_credits.set(currency)\nawait ctx.send('Credits per message logged set to `{}`.'.format(currency))", "if price < 0:\n await ctx.send('T...
<|body_start_0|> server = ctx.guild if currency < 0 or currency > 1000: await ctx.send('Please enter a valid number between 0 and 1000.') return await self.config.guild(server).msg_credits.set(currency) await ctx.send('Credits per message logged set to `{}`.'.form...
Economy administration commands
Economy
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Economy: """Economy administration commands""" async def msgcredits(self, ctx, currency: int=0): """Credits per message logged. Default to `0`.""" <|body_0|> async def setprice(self, ctx, price: int): """Set a price for background changes.""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_009276
1,392
permissive
[ { "docstring": "Credits per message logged. Default to `0`.", "name": "msgcredits", "signature": "async def msgcredits(self, ctx, currency: int=0)" }, { "docstring": "Set a price for background changes.", "name": "setprice", "signature": "async def setprice(self, ctx, price: int)" } ]
2
null
Implement the Python class `Economy` described below. Class description: Economy administration commands Method signatures and docstrings: - async def msgcredits(self, ctx, currency: int=0): Credits per message logged. Default to `0`. - async def setprice(self, ctx, price: int): Set a price for background changes.
Implement the Python class `Economy` described below. Class description: Economy administration commands Method signatures and docstrings: - async def msgcredits(self, ctx, currency: int=0): Credits per message logged. Default to `0`. - async def setprice(self, ctx, price: int): Set a price for background changes. <...
c977b1d127629b858235b23dd86e5fe0756d1edb
<|skeleton|> class Economy: """Economy administration commands""" async def msgcredits(self, ctx, currency: int=0): """Credits per message logged. Default to `0`.""" <|body_0|> async def setprice(self, ctx, price: int): """Set a price for background changes.""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Economy: """Economy administration commands""" async def msgcredits(self, ctx, currency: int=0): """Credits per message logged. Default to `0`.""" server = ctx.guild if currency < 0 or currency > 1000: await ctx.send('Please enter a valid number between 0 and 1000.') ...
the_stack_v2_python_sparse
leveler/commands/lvladmin/economy.py
fixator10/Fixator10-Cogs
train
90
a56551e462bf434139ffd8498015c81df1bcc9e0
[ "TracksWriter._write_text_tracks(phon_tier, tok_tier, dir_align)\nif input_audio is not None:\n if phon_tier.is_interval() is False:\n raise BadInputError\n if tok_tier is not None:\n if tok_tier.is_interval() is False:\n raise BadInputError\n tracks = phon_tier.get_midpoint_interv...
<|body_start_0|> TracksWriter._write_text_tracks(phon_tier, tok_tier, dir_align) if input_audio is not None: if phon_tier.is_interval() is False: raise BadInputError if tok_tier is not None: if tok_tier.is_interval() is False: r...
Write non-aligned track files. :author: Brigitte Bigi :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :contact: develop@sppas.org :license: GPL, v3 :copyright: Copyright (C) 2011-2018 Brigitte Bigi Manage tracks for the audio, the phonetization and the tokenization.
TracksWriter
[ "MIT", "GFDL-1.1-or-later", "GPL-3.0-only", "GPL-3.0-or-later" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TracksWriter: """Write non-aligned track files. :author: Brigitte Bigi :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :contact: develop@sppas.org :license: GPL, v3 :copyright: Copyright (C) 2011-2018 Brigitte Bigi Manage tracks for the audio, the phonetization and the token...
stack_v2_sparse_classes_36k_train_009277
20,964
permissive
[ { "docstring": "Main method to write tracks from the given data. :param input_audio: (src) File name of the audio file. :param phon_tier: (Tier) Tier with phonetization to split. :param tok_tier: (Tier) Tier with tokenization to split. :param dir_align: (str) Directory to put units. :returns: List of tracks wit...
6
null
Implement the Python class `TracksWriter` described below. Class description: Write non-aligned track files. :author: Brigitte Bigi :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :contact: develop@sppas.org :license: GPL, v3 :copyright: Copyright (C) 2011-2018 Brigitte Bigi Manage tracks for the...
Implement the Python class `TracksWriter` described below. Class description: Write non-aligned track files. :author: Brigitte Bigi :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :contact: develop@sppas.org :license: GPL, v3 :copyright: Copyright (C) 2011-2018 Brigitte Bigi Manage tracks for the...
3167b65f576abcc27a8767d24c274a04712bd948
<|skeleton|> class TracksWriter: """Write non-aligned track files. :author: Brigitte Bigi :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :contact: develop@sppas.org :license: GPL, v3 :copyright: Copyright (C) 2011-2018 Brigitte Bigi Manage tracks for the audio, the phonetization and the token...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TracksWriter: """Write non-aligned track files. :author: Brigitte Bigi :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :contact: develop@sppas.org :license: GPL, v3 :copyright: Copyright (C) 2011-2018 Brigitte Bigi Manage tracks for the audio, the phonetization and the tokenization.""" ...
the_stack_v2_python_sparse
sppas/sppas/src/annotations/Align/tracksio.py
mirfan899/MTTS
train
0
f6dd5f937c0263f26eeaa04a2ab647e54874aaa9
[ "self.annoDict = defaultdict()\nfor sheet in sheet_names:\n annotation = pd.read_excel(os.path.join(path_xlsx_file, file_name_xlsx), sheet_name=sheet)\n for idx, path in enumerate(annotation['Recording']):\n name = path.split('/')[-1][:-4]\n self.annoDict[name] = {'annotation': annotation.iloc[i...
<|body_start_0|> self.annoDict = defaultdict() for sheet in sheet_names: annotation = pd.read_excel(os.path.join(path_xlsx_file, file_name_xlsx), sheet_name=sheet) for idx, path in enumerate(annotation['Recording']): name = path.split('/')[-1][:-4] ...
BrainCapture_prepossing
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BrainCapture_prepossing: def preloadAnno(self, path_xlsx_file, file_name_xlsx='MGH_File_Annotations.xlsx', sheet_names=[2, 3, 4], atributes=['Quality Of Eeg', 'Is Eeg Usable For Clinical Purposes', 'Reader', 'Recording Length [seconds]'], sort=False): """Read the braincapture exel file a...
stack_v2_sparse_classes_36k_train_009278
4,453
no_license
[ { "docstring": "Read the braincapture exel file and create and opbject self.annoDict with all the anotations. str: path_xlsx_file: path to the braincapture folder str: file_name_xlsx: list: sheet_names: list of the sheets to loop over bool: sort: if true files with missing attributes will be deathFlagged list: ...
3
stack_v2_sparse_classes_30k_train_006519
Implement the Python class `BrainCapture_prepossing` described below. Class description: Implement the BrainCapture_prepossing class. Method signatures and docstrings: - def preloadAnno(self, path_xlsx_file, file_name_xlsx='MGH_File_Annotations.xlsx', sheet_names=[2, 3, 4], atributes=['Quality Of Eeg', 'Is Eeg Usable...
Implement the Python class `BrainCapture_prepossing` described below. Class description: Implement the BrainCapture_prepossing class. Method signatures and docstrings: - def preloadAnno(self, path_xlsx_file, file_name_xlsx='MGH_File_Annotations.xlsx', sheet_names=[2, 3, 4], atributes=['Quality Of Eeg', 'Is Eeg Usable...
e64ba9632335150d9f5b6b7be0ae5e2cb9d845cd
<|skeleton|> class BrainCapture_prepossing: def preloadAnno(self, path_xlsx_file, file_name_xlsx='MGH_File_Annotations.xlsx', sheet_names=[2, 3, 4], atributes=['Quality Of Eeg', 'Is Eeg Usable For Clinical Purposes', 'Reader', 'Recording Length [seconds]'], sort=False): """Read the braincapture exel file a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BrainCapture_prepossing: def preloadAnno(self, path_xlsx_file, file_name_xlsx='MGH_File_Annotations.xlsx', sheet_names=[2, 3, 4], atributes=['Quality Of Eeg', 'Is Eeg Usable For Clinical Purposes', 'Reader', 'Recording Length [seconds]'], sort=False): """Read the braincapture exel file and create and ...
the_stack_v2_python_sparse
BC.py
AndreasRaaskov/EEG_prepossing
train
1
0f3df79cfd3f9e907a37378324754d340005be10
[ "super().__init__(offset)\nif shadow_rgbFace is None:\n self._shadow_rgbFace = shadow_rgbFace\nelse:\n self._shadow_rgbFace = mcolors.to_rgba(shadow_rgbFace)\nif alpha is None:\n alpha = 0.3\nself._alpha = alpha\nself._rho = rho\nself._gc = kwargs", "gc0 = renderer.new_gc()\ngc0.copy_properties(gc)\nif s...
<|body_start_0|> super().__init__(offset) if shadow_rgbFace is None: self._shadow_rgbFace = shadow_rgbFace else: self._shadow_rgbFace = mcolors.to_rgba(shadow_rgbFace) if alpha is None: alpha = 0.3 self._alpha = alpha self._rho = rho ...
A simple shadow via a filled patch.
SimplePatchShadow
[ "CC0-1.0", "BSD-3-Clause", "MIT", "Bitstream-Charter", "LicenseRef-scancode-warranty-disclaimer", "LicenseRef-scancode-bakoma-fonts-1995", "LicenseRef-scancode-unknown-license-reference", "OFL-1.1", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SimplePatchShadow: """A simple shadow via a filled patch.""" def __init__(self, offset=(2, -2), shadow_rgbFace=None, alpha=None, rho=0.3, **kwargs): """Parameters ---------- offset : (float, float), default: (2, -2) The (x, y) offset of the shadow in points. shadow_rgbFace : color Th...
stack_v2_sparse_classes_36k_train_009279
18,595
permissive
[ { "docstring": "Parameters ---------- offset : (float, float), default: (2, -2) The (x, y) offset of the shadow in points. shadow_rgbFace : color The shadow color. alpha : float, default: 0.3 The alpha transparency of the created shadow patch. rho : float, default: 0.3 A scale factor to apply to the rgbFace col...
2
null
Implement the Python class `SimplePatchShadow` described below. Class description: A simple shadow via a filled patch. Method signatures and docstrings: - def __init__(self, offset=(2, -2), shadow_rgbFace=None, alpha=None, rho=0.3, **kwargs): Parameters ---------- offset : (float, float), default: (2, -2) The (x, y) ...
Implement the Python class `SimplePatchShadow` described below. Class description: A simple shadow via a filled patch. Method signatures and docstrings: - def __init__(self, offset=(2, -2), shadow_rgbFace=None, alpha=None, rho=0.3, **kwargs): Parameters ---------- offset : (float, float), default: (2, -2) The (x, y) ...
f5042e35b945aded77b23470ead62d7eacefde92
<|skeleton|> class SimplePatchShadow: """A simple shadow via a filled patch.""" def __init__(self, offset=(2, -2), shadow_rgbFace=None, alpha=None, rho=0.3, **kwargs): """Parameters ---------- offset : (float, float), default: (2, -2) The (x, y) offset of the shadow in points. shadow_rgbFace : color Th...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SimplePatchShadow: """A simple shadow via a filled patch.""" def __init__(self, offset=(2, -2), shadow_rgbFace=None, alpha=None, rho=0.3, **kwargs): """Parameters ---------- offset : (float, float), default: (2, -2) The (x, y) offset of the shadow in points. shadow_rgbFace : color The shadow colo...
the_stack_v2_python_sparse
contrib/python/matplotlib/py3/matplotlib/patheffects.py
catboost/catboost
train
8,012
31ac067ee5c9f72a7996e4b9bac5eee0e8fbf0e1
[ "social_key = 'social.%s.id' % social\nquery = {social_key: {'$in': social_ids}}\nzombies = (yield self.find(query))\nreturn zombies", "zombies_ids = []\nfor zombie in zombies:\n zombies_ids.append(zombie.id)\n zombie.users.append(user.id)\nquery = {'_id': {'$in': zombies_ids}}\nyield Op(self.object_db.upda...
<|body_start_0|> social_key = 'social.%s.id' % social query = {social_key: {'$in': social_ids}} zombies = (yield self.find(query)) return zombies <|end_body_0|> <|body_start_1|> zombies_ids = [] for zombie in zombies: zombies_ids.append(zombie.id) ...
ZombieManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ZombieManager: def find_by_social(self, social: str, social_ids: list) -> dict: """Осуществляет поиск зомби в базе по его ID в социальной сети""" <|body_0|> def attach_user(self, user, zombies: list): """Добавляет ко всем зомби в списке пользователя :param user: User...
stack_v2_sparse_classes_36k_train_009280
1,694
no_license
[ { "docstring": "Осуществляет поиск зомби в базе по его ID в социальной сети", "name": "find_by_social", "signature": "def find_by_social(self, social: str, social_ids: list) -> dict" }, { "docstring": "Добавляет ко всем зомби в списке пользователя :param user: User for zombies :type user: ecogam...
2
stack_v2_sparse_classes_30k_train_014647
Implement the Python class `ZombieManager` described below. Class description: Implement the ZombieManager class. Method signatures and docstrings: - def find_by_social(self, social: str, social_ids: list) -> dict: Осуществляет поиск зомби в базе по его ID в социальной сети - def attach_user(self, user, zombies: list...
Implement the Python class `ZombieManager` described below. Class description: Implement the ZombieManager class. Method signatures and docstrings: - def find_by_social(self, social: str, social_ids: list) -> dict: Осуществляет поиск зомби в базе по его ID в социальной сети - def attach_user(self, user, zombies: list...
2127fd093848ed794ae6450e37f225b331cf3d05
<|skeleton|> class ZombieManager: def find_by_social(self, social: str, social_ids: list) -> dict: """Осуществляет поиск зомби в базе по его ID в социальной сети""" <|body_0|> def attach_user(self, user, zombies: list): """Добавляет ко всем зомби в списке пользователя :param user: User...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ZombieManager: def find_by_social(self, social: str, social_ids: list) -> dict: """Осуществляет поиск зомби в базе по его ID в социальной сети""" social_key = 'social.%s.id' % social query = {social_key: {'$in': social_ids}} zombies = (yield self.find(query)) return zom...
the_stack_v2_python_sparse
ecogame/model/zombie.py
octoberry/eco-py
train
0
b2b320e3734311bc67e944f60a44894f3a725c85
[ "super(LSTMCell, self).__init__()\nself.nlayers = nlayers\nself.dropout = nn.Dropout(p=dropout)\nih, hh = ([], [])\nfor i in range(nlayers):\n ih.append(nn.Linear(input_size, 4 * hidden_size))\n hh.append(nn.Linear(hidden_size, 4 * hidden_size))\nself.w_ih = nn.ModuleList(ih)\nself.w_hh = nn.ModuleList(hh)", ...
<|body_start_0|> super(LSTMCell, self).__init__() self.nlayers = nlayers self.dropout = nn.Dropout(p=dropout) ih, hh = ([], []) for i in range(nlayers): ih.append(nn.Linear(input_size, 4 * hidden_size)) hh.append(nn.Linear(hidden_size, 4 * hidden_size)) ...
LSTMCell
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LSTMCell: def __init__(self, input_size, hidden_size, nlayers, dropout): """"Constructor of the class""" <|body_0|> def forward(self, input, hidden): """"Defines the forward computation of the LSTMCell""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_009281
3,098
no_license
[ { "docstring": "\"Constructor of the class", "name": "__init__", "signature": "def __init__(self, input_size, hidden_size, nlayers, dropout)" }, { "docstring": "\"Defines the forward computation of the LSTMCell", "name": "forward", "signature": "def forward(self, input, hidden)" } ]
2
stack_v2_sparse_classes_30k_train_000294
Implement the Python class `LSTMCell` described below. Class description: Implement the LSTMCell class. Method signatures and docstrings: - def __init__(self, input_size, hidden_size, nlayers, dropout): "Constructor of the class - def forward(self, input, hidden): "Defines the forward computation of the LSTMCell
Implement the Python class `LSTMCell` described below. Class description: Implement the LSTMCell class. Method signatures and docstrings: - def __init__(self, input_size, hidden_size, nlayers, dropout): "Constructor of the class - def forward(self, input, hidden): "Defines the forward computation of the LSTMCell <|s...
405a5632dde1fef96ccb301c0994d783776c7108
<|skeleton|> class LSTMCell: def __init__(self, input_size, hidden_size, nlayers, dropout): """"Constructor of the class""" <|body_0|> def forward(self, input, hidden): """"Defines the forward computation of the LSTMCell""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LSTMCell: def __init__(self, input_size, hidden_size, nlayers, dropout): """"Constructor of the class""" super(LSTMCell, self).__init__() self.nlayers = nlayers self.dropout = nn.Dropout(p=dropout) ih, hh = ([], []) for i in range(nlayers): ih.append...
the_stack_v2_python_sparse
project1/NN/RNN.py
dixiyao/CS385
train
0
cfa45054e13e48b95c228ae592937fc425c65a97
[ "self = object.__new__(cls)\nself.name = value\nself.value = value\nself.metadata_type = IntegrationMetadataSubscription\nreturn self", "self.name = name\nself.value = value\nself.metadata_type = metadata_type\nself.INSTANCES[value] = self" ]
<|body_start_0|> self = object.__new__(cls) self.name = value self.value = value self.metadata_type = IntegrationMetadataSubscription return self <|end_body_0|> <|body_start_1|> self.name = name self.value = value self.metadata_type = metadata_type ...
Represents an ``Integration``'s type. Attributes ---------- name : `str` The name of the integration type. value : `int` The Discord side identifier value of the integration type. Class Attributes ---------------- INSTANCES : `dict` of (`str`, ``IntegrationType``) items Stores the predefined ``IntegrationType``-s. Thes...
IntegrationType
[ "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IntegrationType: """Represents an ``Integration``'s type. Attributes ---------- name : `str` The name of the integration type. value : `int` The Discord side identifier value of the integration type. Class Attributes ---------------- INSTANCES : `dict` of (`str`, ``IntegrationType``) items Stores...
stack_v2_sparse_classes_36k_train_009282
4,218
permissive
[ { "docstring": "Creates a new integration type with the given value. Parameters ---------- value : `str` The integration's type. Returns ------- self : ``IntegrationType`` The created instance.", "name": "_from_value", "signature": "def _from_value(cls, value)" }, { "docstring": "Creates a new s...
2
stack_v2_sparse_classes_30k_train_002816
Implement the Python class `IntegrationType` described below. Class description: Represents an ``Integration``'s type. Attributes ---------- name : `str` The name of the integration type. value : `int` The Discord side identifier value of the integration type. Class Attributes ---------------- INSTANCES : `dict` of (`...
Implement the Python class `IntegrationType` described below. Class description: Represents an ``Integration``'s type. Attributes ---------- name : `str` The name of the integration type. value : `int` The Discord side identifier value of the integration type. Class Attributes ---------------- INSTANCES : `dict` of (`...
53f24fdb38459dc5a4fd04f11bdbfee8295b76a4
<|skeleton|> class IntegrationType: """Represents an ``Integration``'s type. Attributes ---------- name : `str` The name of the integration type. value : `int` The Discord side identifier value of the integration type. Class Attributes ---------------- INSTANCES : `dict` of (`str`, ``IntegrationType``) items Stores...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IntegrationType: """Represents an ``Integration``'s type. Attributes ---------- name : `str` The name of the integration type. value : `int` The Discord side identifier value of the integration type. Class Attributes ---------------- INSTANCES : `dict` of (`str`, ``IntegrationType``) items Stores the predefin...
the_stack_v2_python_sparse
hata/discord/integration/integration/preinstanced.py
HuyaneMatsu/hata
train
3
b19bc3628f28734fb6190923b6e4ba05e5cccb45
[ "self.pumps_armed = True\nself.doors_open = False\nself.max_boats = max_boats", "print('Stopping pumps...')\nself.pumps_armed = False\nprint('Opening doors...')\nself.doors_open = True\nprint('Locke ready for boat transit.')\nreturn self", "print('Closing doors...')\nself.doors_open = False\nprint('Starting pum...
<|body_start_0|> self.pumps_armed = True self.doors_open = False self.max_boats = max_boats <|end_body_0|> <|body_start_1|> print('Stopping pumps...') self.pumps_armed = False print('Opening doors...') self.doors_open = True print('Locke ready for boat tr...
A class representing a locke.
Locke
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Locke: """A class representing a locke.""" def __init__(self, max_boats): """Initializes a Locke class. :max_boats: The maximum number of boats the locke can support.""" <|body_0|> def __enter__(self): """Primes the lock by stoping the pumps and opening the doors...
stack_v2_sparse_classes_36k_train_009283
2,014
no_license
[ { "docstring": "Initializes a Locke class. :max_boats: The maximum number of boats the locke can support.", "name": "__init__", "signature": "def __init__(self, max_boats)" }, { "docstring": "Primes the lock by stoping the pumps and opening the doors", "name": "__enter__", "signature": "...
4
stack_v2_sparse_classes_30k_train_018109
Implement the Python class `Locke` described below. Class description: A class representing a locke. Method signatures and docstrings: - def __init__(self, max_boats): Initializes a Locke class. :max_boats: The maximum number of boats the locke can support. - def __enter__(self): Primes the lock by stoping the pumps ...
Implement the Python class `Locke` described below. Class description: A class representing a locke. Method signatures and docstrings: - def __init__(self, max_boats): Initializes a Locke class. :max_boats: The maximum number of boats the locke can support. - def __enter__(self): Primes the lock by stoping the pumps ...
5dac60f39e3909ff05b26721d602ed20f14d6be3
<|skeleton|> class Locke: """A class representing a locke.""" def __init__(self, max_boats): """Initializes a Locke class. :max_boats: The maximum number of boats the locke can support.""" <|body_0|> def __enter__(self): """Primes the lock by stoping the pumps and opening the doors...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Locke: """A class representing a locke.""" def __init__(self, max_boats): """Initializes a Locke class. :max_boats: The maximum number of boats the locke can support.""" self.pumps_armed = True self.doors_open = False self.max_boats = max_boats def __enter__(self): ...
the_stack_v2_python_sparse
students/anthony_mckeever/lesson_9/activity_1/ballard_lockes.py
JavaRod/SP_Python220B_2019
train
1
ee3e1509b5b8c7c763a7f9bb29bf7a3e317fec5c
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn AggregationOption()", "from .bucket_aggregation_definition import BucketAggregationDefinition\nfrom .bucket_aggregation_definition import BucketAggregationDefinition\nfields: Dict[str, Callable[[Any], None]] = {'bucketDefinition': lamb...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return AggregationOption() <|end_body_0|> <|body_start_1|> from .bucket_aggregation_definition import BucketAggregationDefinition from .bucket_aggregation_definition import BucketAggregationDef...
AggregationOption
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AggregationOption: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AggregationOption: """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...
stack_v2_sparse_classes_36k_train_009284
3,368
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: AggregationOption", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_v...
3
stack_v2_sparse_classes_30k_train_009953
Implement the Python class `AggregationOption` described below. Class description: Implement the AggregationOption class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AggregationOption: Creates a new instance of the appropriate class based on discrim...
Implement the Python class `AggregationOption` described below. Class description: Implement the AggregationOption class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AggregationOption: Creates a new instance of the appropriate class based on discrim...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class AggregationOption: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AggregationOption: """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...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AggregationOption: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AggregationOption: """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: Aggr...
the_stack_v2_python_sparse
msgraph/generated/models/aggregation_option.py
microsoftgraph/msgraph-sdk-python
train
135
86c9cd95f68f5d5707b9e226d6284dedc7995839
[ "it = iter(test_inputs.split('\\n')) if test_inputs else None\n\ndef uinput():\n return next(it) if it else sys.stdin.readline().rstrip()\n[self.n, self.m] = map(int, uinput().split())\nself.nums = list(map(int, uinput().split()))\nl, s = (self.n - 1, 2)\ninp = ' '.join((uinput() for i in range(l))).split()\nsel...
<|body_start_0|> it = iter(test_inputs.split('\n')) if test_inputs else None def uinput(): return next(it) if it else sys.stdin.readline().rstrip() [self.n, self.m] = map(int, uinput().split()) self.nums = list(map(int, uinput().split())) l, s = (self.n - 1, 2) ...
Park representation
Park
[ "Unlicense", "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Park: """Park representation""" def __init__(self, test_inputs=None): """Default constructor""" <|body_0|> def calculate(self): """Main calcualtion function of the class""" <|body_1|> <|end_skeleton|> <|body_start_0|> it = iter(test_inputs.split...
stack_v2_sparse_classes_36k_train_009285
4,524
permissive
[ { "docstring": "Default constructor", "name": "__init__", "signature": "def __init__(self, test_inputs=None)" }, { "docstring": "Main calcualtion function of the class", "name": "calculate", "signature": "def calculate(self)" } ]
2
stack_v2_sparse_classes_30k_train_007828
Implement the Python class `Park` described below. Class description: Park representation Method signatures and docstrings: - def __init__(self, test_inputs=None): Default constructor - def calculate(self): Main calcualtion function of the class
Implement the Python class `Park` described below. Class description: Park representation Method signatures and docstrings: - def __init__(self, test_inputs=None): Default constructor - def calculate(self): Main calcualtion function of the class <|skeleton|> class Park: """Park representation""" def __init_...
ae02ea872ca91ef98630cc172a844b82cc56f621
<|skeleton|> class Park: """Park representation""" def __init__(self, test_inputs=None): """Default constructor""" <|body_0|> def calculate(self): """Main calcualtion function of the class""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Park: """Park representation""" def __init__(self, test_inputs=None): """Default constructor""" it = iter(test_inputs.split('\n')) if test_inputs else None def uinput(): return next(it) if it else sys.stdin.readline().rstrip() [self.n, self.m] = map(int, uinpu...
the_stack_v2_python_sparse
codeforces/580C_park.py
snsokolov/contests
train
1
78972ff408306570ac5e4a6af7fa578c5d420361
[ "pred_illum_rgb = tf.constant(np.asarray([[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]]))\ntrue_illum_rgb = tf.constant(np.asarray([[0.0, 1.0, 0.0], [0.0, 0.0, 1.0], [1.0, 0.0, 0.0]]))\nself.assertAllClose(losses.angular_error(pred_illum_rgb, true_illum_rgb), np.repeat(90, pred_illum_rgb.get_shape().as_list()[...
<|body_start_0|> pred_illum_rgb = tf.constant(np.asarray([[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]])) true_illum_rgb = tf.constant(np.asarray([[0.0, 1.0, 0.0], [0.0, 0.0, 1.0], [1.0, 0.0, 0.0]])) self.assertAllClose(losses.angular_error(pred_illum_rgb, true_illum_rgb), np.repeat(90, pre...
Tests losses.angular_error.
AngularErrorTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AngularErrorTest: """Tests losses.angular_error.""" def testOrthogonalVectors(self): """Tests two orthogonal vectors as input.""" <|body_0|> def testAntiParallelVectors(self): """Tests two antiparallel vectors as input.""" <|body_1|> def testAgainstI...
stack_v2_sparse_classes_36k_train_009286
17,094
permissive
[ { "docstring": "Tests two orthogonal vectors as input.", "name": "testOrthogonalVectors", "signature": "def testOrthogonalVectors(self)" }, { "docstring": "Tests two antiparallel vectors as input.", "name": "testAntiParallelVectors", "signature": "def testAntiParallelVectors(self)" }, ...
5
stack_v2_sparse_classes_30k_train_017151
Implement the Python class `AngularErrorTest` described below. Class description: Tests losses.angular_error. Method signatures and docstrings: - def testOrthogonalVectors(self): Tests two orthogonal vectors as input. - def testAntiParallelVectors(self): Tests two antiparallel vectors as input. - def testAgainstIdent...
Implement the Python class `AngularErrorTest` described below. Class description: Tests losses.angular_error. Method signatures and docstrings: - def testOrthogonalVectors(self): Tests two orthogonal vectors as input. - def testAntiParallelVectors(self): Tests two antiparallel vectors as input. - def testAgainstIdent...
c52b225082327ea34bed80357dbff004fc9926ba
<|skeleton|> class AngularErrorTest: """Tests losses.angular_error.""" def testOrthogonalVectors(self): """Tests two orthogonal vectors as input.""" <|body_0|> def testAntiParallelVectors(self): """Tests two antiparallel vectors as input.""" <|body_1|> def testAgainstI...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AngularErrorTest: """Tests losses.angular_error.""" def testOrthogonalVectors(self): """Tests two orthogonal vectors as input.""" pred_illum_rgb = tf.constant(np.asarray([[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]])) true_illum_rgb = tf.constant(np.asarray([[0.0, 1.0, 0.0],...
the_stack_v2_python_sparse
python/losses_test.py
mahmoudnafifi/ffcc
train
1
9f6cdd58a3ff9bd66776551d6b2b1675ef035f48
[ "\"\"\"搜索测试\"\"\"\nsousuo = FenleiPage(self.driver)\nsousuo.going_fenlei()\nsousuo.going_sousuo()\nsousuo.input_sousuo('水果')\nsousuo.click_sousuo()\ndy = sousuo.get_zonghe()\nself.assertEqual(dy, '综合')", "\"\"\"删除搜索测试\"\"\"\nsc = FenleiPage(self.driver)\nsc.going_fenlei()\nsc.going_sousuo()\nsc.click_clear()\nsc....
<|body_start_0|> """搜索测试""" sousuo = FenleiPage(self.driver) sousuo.going_fenlei() sousuo.going_sousuo() sousuo.input_sousuo('水果') sousuo.click_sousuo() dy = sousuo.get_zonghe() self.assertEqual(dy, '综合') <|end_body_0|> <|body_start_1|> """删除搜索测试"...
SousuoTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SousuoTest: def test_sousuo(self): """MRYX_ST_classification_001""" <|body_0|> def test_clear_sousuo(self): """MRYX_ST_classification_007""" <|body_1|> <|end_skeleton|> <|body_start_0|> """搜索测试""" sousuo = FenleiPage(self.driver) sou...
stack_v2_sparse_classes_36k_train_009287
1,296
no_license
[ { "docstring": "MRYX_ST_classification_001", "name": "test_sousuo", "signature": "def test_sousuo(self)" }, { "docstring": "MRYX_ST_classification_007", "name": "test_clear_sousuo", "signature": "def test_clear_sousuo(self)" } ]
2
stack_v2_sparse_classes_30k_train_019890
Implement the Python class `SousuoTest` described below. Class description: Implement the SousuoTest class. Method signatures and docstrings: - def test_sousuo(self): MRYX_ST_classification_001 - def test_clear_sousuo(self): MRYX_ST_classification_007
Implement the Python class `SousuoTest` described below. Class description: Implement the SousuoTest class. Method signatures and docstrings: - def test_sousuo(self): MRYX_ST_classification_001 - def test_clear_sousuo(self): MRYX_ST_classification_007 <|skeleton|> class SousuoTest: def test_sousuo(self): ...
2325c7854c5625babdb51b5c5e40fa860813a400
<|skeleton|> class SousuoTest: def test_sousuo(self): """MRYX_ST_classification_001""" <|body_0|> def test_clear_sousuo(self): """MRYX_ST_classification_007""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SousuoTest: def test_sousuo(self): """MRYX_ST_classification_001""" """搜索测试""" sousuo = FenleiPage(self.driver) sousuo.going_fenlei() sousuo.going_sousuo() sousuo.input_sousuo('水果') sousuo.click_sousuo() dy = sousuo.get_zonghe() self.asse...
the_stack_v2_python_sparse
testcase/test_sousuo.py
danyubiao/mryx
train
0
f949454c0009a6bf9b583fa1dbdc6e5c232453c2
[ "if not s:\n return 0\nlength = len(s)\ndp = [[0 for _ in range(length)] for _ in range(length)]\nfor i in range(length - 1, -1, -1):\n dp[i][i] = 1\n for j in range(i + 1, length):\n if s[i] == s[j]:\n dp[i][j] = dp[i + 1][j - 1] + 2\n else:\n dp[i][j] = max(dp[i + 1][j...
<|body_start_0|> if not s: return 0 length = len(s) dp = [[0 for _ in range(length)] for _ in range(length)] for i in range(length - 1, -1, -1): dp[i][i] = 1 for j in range(i + 1, length): if s[i] == s[j]: dp[i][j] =...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestPalindromeSubseq(self, s: str) -> int: """dp[i][j]代表从i到j的最长的回文子串 这个的点在于,中间是可以跳着的,只要找到两个一样的,就+2""" <|body_0|> def longestPalindromeSubseq2(self, s): """:type s: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if n...
stack_v2_sparse_classes_36k_train_009288
1,470
no_license
[ { "docstring": "dp[i][j]代表从i到j的最长的回文子串 这个的点在于,中间是可以跳着的,只要找到两个一样的,就+2", "name": "longestPalindromeSubseq", "signature": "def longestPalindromeSubseq(self, s: str) -> int" }, { "docstring": ":type s: str :rtype: int", "name": "longestPalindromeSubseq2", "signature": "def longestPalindromeS...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestPalindromeSubseq(self, s: str) -> int: dp[i][j]代表从i到j的最长的回文子串 这个的点在于,中间是可以跳着的,只要找到两个一样的,就+2 - def longestPalindromeSubseq2(self, s): :type s: str :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestPalindromeSubseq(self, s: str) -> int: dp[i][j]代表从i到j的最长的回文子串 这个的点在于,中间是可以跳着的,只要找到两个一样的,就+2 - def longestPalindromeSubseq2(self, s): :type s: str :rtype: int <|skelet...
4105e18050b15fc0409c75353ad31be17187dd34
<|skeleton|> class Solution: def longestPalindromeSubseq(self, s: str) -> int: """dp[i][j]代表从i到j的最长的回文子串 这个的点在于,中间是可以跳着的,只要找到两个一样的,就+2""" <|body_0|> def longestPalindromeSubseq2(self, s): """:type s: str :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def longestPalindromeSubseq(self, s: str) -> int: """dp[i][j]代表从i到j的最长的回文子串 这个的点在于,中间是可以跳着的,只要找到两个一样的,就+2""" if not s: return 0 length = len(s) dp = [[0 for _ in range(length)] for _ in range(length)] for i in range(length - 1, -1, -1): ...
the_stack_v2_python_sparse
longestPalindromeSubseq.py
NeilWangziyu/Leetcode_py
train
2
5d04943a689fe191889ab3ee843fd2fc702f46e6
[ "a = rand7()\nwhile a > 5:\n a = rand7()\nb = rand7()\nwhile b == 7:\n b = rand7()\nreturn a * 2 - b % 2", "x, y = (rand7(), rand7())\nif x == 6 and y >= 6:\n return self.rand10()\nif x == 7:\n return self.rand10()\nreturn (x * 7 + y) % 10 + 1" ]
<|body_start_0|> a = rand7() while a > 5: a = rand7() b = rand7() while b == 7: b = rand7() return a * 2 - b % 2 <|end_body_0|> <|body_start_1|> x, y = (rand7(), rand7()) if x == 6 and y >= 6: return self.rand10() if x ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def rand10(self): """:rtype: int 340 ms""" <|body_0|> def rand10_1(self): """:rtype: int 332ms""" <|body_1|> <|end_skeleton|> <|body_start_0|> a = rand7() while a > 5: a = rand7() b = rand7() while b == ...
stack_v2_sparse_classes_36k_train_009289
1,313
no_license
[ { "docstring": ":rtype: int 340 ms", "name": "rand10", "signature": "def rand10(self)" }, { "docstring": ":rtype: int 332ms", "name": "rand10_1", "signature": "def rand10_1(self)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rand10(self): :rtype: int 340 ms - def rand10_1(self): :rtype: int 332ms
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rand10(self): :rtype: int 340 ms - def rand10_1(self): :rtype: int 332ms <|skeleton|> class Solution: def rand10(self): """:rtype: int 340 ms""" <|body_...
679a2b246b8b6bb7fc55ed1c8096d3047d6d4461
<|skeleton|> class Solution: def rand10(self): """:rtype: int 340 ms""" <|body_0|> def rand10_1(self): """:rtype: int 332ms""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def rand10(self): """:rtype: int 340 ms""" a = rand7() while a > 5: a = rand7() b = rand7() while b == 7: b = rand7() return a * 2 - b % 2 def rand10_1(self): """:rtype: int 332ms""" x, y = (rand7(), rand7()...
the_stack_v2_python_sparse
ImplementRand10UsingRand7_MID_470.py
953250587/leetcode-python
train
2
9da83533feb426dad7194cc78eb79869d4248ff3
[ "roc_reading = {'confidenceThreshold': threshold, 'recall': tpr, 'falsePositiveRate': fpr}\nif 'confidenceMetrics' not in self.metadata.keys():\n self.metadata['confidenceMetrics'] = []\nself.metadata['confidenceMetrics'].append(roc_reading)", "if len(fpr) != len(tpr) or len(fpr) != len(threshold) or len(tpr) ...
<|body_start_0|> roc_reading = {'confidenceThreshold': threshold, 'recall': tpr, 'falsePositiveRate': fpr} if 'confidenceMetrics' not in self.metadata.keys(): self.metadata['confidenceMetrics'] = [] self.metadata['confidenceMetrics'].append(roc_reading) <|end_body_0|> <|body_start_1...
An artifact for storing classification metrics. Args: name: Name of the metrics artifact. uri: The metrics artifact's location on disk or cloud storage. metadata: The key-value scalar metrics.
ClassificationMetrics
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClassificationMetrics: """An artifact for storing classification metrics. Args: name: Name of the metrics artifact. uri: The metrics artifact's location on disk or cloud storage. metadata: The key-value scalar metrics.""" def log_roc_data_point(self, fpr: float, tpr: float, threshold: float)...
stack_v2_sparse_classes_36k_train_009290
17,073
permissive
[ { "docstring": "Logs a single data point in the ROC curve to metadata. Args: fpr: False positive rate value of the data point. tpr: True positive rate value of the data point. threshold: Threshold value for the data point.", "name": "log_roc_data_point", "signature": "def log_roc_data_point(self, fpr: f...
6
stack_v2_sparse_classes_30k_test_000605
Implement the Python class `ClassificationMetrics` described below. Class description: An artifact for storing classification metrics. Args: name: Name of the metrics artifact. uri: The metrics artifact's location on disk or cloud storage. metadata: The key-value scalar metrics. Method signatures and docstrings: - de...
Implement the Python class `ClassificationMetrics` described below. Class description: An artifact for storing classification metrics. Args: name: Name of the metrics artifact. uri: The metrics artifact's location on disk or cloud storage. metadata: The key-value scalar metrics. Method signatures and docstrings: - de...
3fb199658f68e7debf4906d9ce32a9a307e39243
<|skeleton|> class ClassificationMetrics: """An artifact for storing classification metrics. Args: name: Name of the metrics artifact. uri: The metrics artifact's location on disk or cloud storage. metadata: The key-value scalar metrics.""" def log_roc_data_point(self, fpr: float, tpr: float, threshold: float)...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ClassificationMetrics: """An artifact for storing classification metrics. Args: name: Name of the metrics artifact. uri: The metrics artifact's location on disk or cloud storage. metadata: The key-value scalar metrics.""" def log_roc_data_point(self, fpr: float, tpr: float, threshold: float) -> None: ...
the_stack_v2_python_sparse
sdk/python/kfp/dsl/types/artifact_types.py
kubeflow/pipelines
train
3,434
b2075d12114e0d8c70fa7028147d9e8a7e749723
[ "if not hasattr(self, '_validated_data'):\n raise natrix_exceptions.ClassInsideException(message=u'Must call is_valid before using this method')\nterminal_tag = self._validated_data['terminal']\ncommand_uuid = str(self._validated_data['uuid'])\ntimestamp = self._validated_data['generate_timestamp']\ncommand_exis...
<|body_start_0|> if not hasattr(self, '_validated_data'): raise natrix_exceptions.ClassInsideException(message=u'Must call is_valid before using this method') terminal_tag = self._validated_data['terminal'] command_uuid = str(self._validated_data['uuid']) timestamp = self._va...
command终端数据 关于单一终端的command信息
CommandTerminal
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CommandTerminal: """command终端数据 关于单一终端的command信息""" def _update_command_status(self): """更新command状态 :return:""" <|body_0|> def store(self, stage='dead'): """持久化存储 :return:""" <|body_1|> def _get_message(self): """:return:""" <|body_2...
stack_v2_sparse_classes_36k_train_009291
21,256
permissive
[ { "docstring": "更新command状态 :return:", "name": "_update_command_status", "signature": "def _update_command_status(self)" }, { "docstring": "持久化存储 :return:", "name": "store", "signature": "def store(self, stage='dead')" }, { "docstring": ":return:", "name": "_get_message", ...
5
stack_v2_sparse_classes_30k_test_000455
Implement the Python class `CommandTerminal` described below. Class description: command终端数据 关于单一终端的command信息 Method signatures and docstrings: - def _update_command_status(self): 更新command状态 :return: - def store(self, stage='dead'): 持久化存储 :return: - def _get_message(self): :return: - def _dead_message_process(self):...
Implement the Python class `CommandTerminal` described below. Class description: command终端数据 关于单一终端的command信息 Method signatures and docstrings: - def _update_command_status(self): 更新command状态 :return: - def store(self, stage='dead'): 持久化存储 :return: - def _get_message(self): :return: - def _dead_message_process(self):...
4b5948d1fe84d746a696474103daac17a5fa6f4b
<|skeleton|> class CommandTerminal: """command终端数据 关于单一终端的command信息""" def _update_command_status(self): """更新command状态 :return:""" <|body_0|> def store(self, stage='dead'): """持久化存储 :return:""" <|body_1|> def _get_message(self): """:return:""" <|body_2...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CommandTerminal: """command终端数据 关于单一终端的command信息""" def _update_command_status(self): """更新command状态 :return:""" if not hasattr(self, '_validated_data'): raise natrix_exceptions.ClassInsideException(message=u'Must call is_valid before using this method') terminal_tag =...
the_stack_v2_python_sparse
benchmark/backends/command_adapter/serializers.py
sdgdsffdsfff/natrix
train
0
52685abb0d8914dff0d4ba1bdc044e9ef07cd4e9
[ "N = len(nums)\nif N == 1:\n return nums[0]\ndpmax = [0 for i in range(N)]\ndpmin = [0 for i in range(N)]\ndpmax[0] = nums[0]\ndpmin[0] = nums[0]\nres = nums[0]\nfor i in range(1, N):\n dpmax[i] = max(dpmax[i - 1] * nums[i], dpmin[i - 1] * nums[i], nums[i])\n dpmin[i] = min(dpmax[i - 1] * nums[i], dpmin[i ...
<|body_start_0|> N = len(nums) if N == 1: return nums[0] dpmax = [0 for i in range(N)] dpmin = [0 for i in range(N)] dpmax[0] = nums[0] dpmin[0] = nums[0] res = nums[0] for i in range(1, N): dpmax[i] = max(dpmax[i - 1] * nums[i], dp...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxProduct(self, nums): """使用动规,也就是 :param nums: :return:""" <|body_0|> def maxProduct(self, nums): """使用正序和倒叙 两个计算方式,其实是使用 :param nums: :return:""" <|body_1|> def maxProduct(self, nums): """为什么最后是加号???? :param nums: :return:""" ...
stack_v2_sparse_classes_36k_train_009292
1,637
no_license
[ { "docstring": "使用动规,也就是 :param nums: :return:", "name": "maxProduct", "signature": "def maxProduct(self, nums)" }, { "docstring": "使用正序和倒叙 两个计算方式,其实是使用 :param nums: :return:", "name": "maxProduct", "signature": "def maxProduct(self, nums)" }, { "docstring": "为什么最后是加号???? :param ...
3
stack_v2_sparse_classes_30k_train_008639
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProduct(self, nums): 使用动规,也就是 :param nums: :return: - def maxProduct(self, nums): 使用正序和倒叙 两个计算方式,其实是使用 :param nums: :return: - def maxProduct(self, nums): 为什么最后是加号???? :pa...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProduct(self, nums): 使用动规,也就是 :param nums: :return: - def maxProduct(self, nums): 使用正序和倒叙 两个计算方式,其实是使用 :param nums: :return: - def maxProduct(self, nums): 为什么最后是加号???? :pa...
d8ad2da776066ac3fd99f246cb2b41a921c21a73
<|skeleton|> class Solution: def maxProduct(self, nums): """使用动规,也就是 :param nums: :return:""" <|body_0|> def maxProduct(self, nums): """使用正序和倒叙 两个计算方式,其实是使用 :param nums: :return:""" <|body_1|> def maxProduct(self, nums): """为什么最后是加号???? :param nums: :return:""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxProduct(self, nums): """使用动规,也就是 :param nums: :return:""" N = len(nums) if N == 1: return nums[0] dpmax = [0 for i in range(N)] dpmin = [0 for i in range(N)] dpmax[0] = nums[0] dpmin[0] = nums[0] res = nums[0] ...
the_stack_v2_python_sparse
Python/LeetCode/LeetCode152maxProduct.py
540928898/LeetCodeMe
train
0
46a1f61a9f61b70e42207af09d6b08ecbf126e00
[ "super().__init__(param_name, cli_option_name, default)\nif param_value_to_cli_map is None or len(param_value_to_cli_map) <= 0:\n raise MappingArgumentParamValueToCLIMapRequiredError('Mapping argument \"param_value_to_cli_map\" is required. it should contain at least one key/value.')\nself._param_value_to_cli_ma...
<|body_start_0|> super().__init__(param_name, cli_option_name, default) if param_value_to_cli_map is None or len(param_value_to_cli_map) <= 0: raise MappingArgumentParamValueToCLIMapRequiredError('Mapping argument "param_value_to_cli_map" is required. it should contain at least one key/value...
mapping argument class. this class must be used for cli options that have mappings. these are arguments that their real value that should be emitted to cli, will be extracted from a dict based on the input of the python-side method. they could have argument name or could be emitted without any argument name. usually yo...
MappingArgument
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MappingArgument: """mapping argument class. this class must be used for cli options that have mappings. these are arguments that their real value that should be emitted to cli, will be extracted from a dict based on the input of the python-side method. they could have argument name or could be em...
stack_v2_sparse_classes_36k_train_009293
27,947
permissive
[ { "docstring": "initializes an instance of MappingArgument. :param str param_name: param name presented in method signature. :param dict param_value_to_cli_map: a dictionary containing a mapping between different method param values and their representation on cli. for example the `--autogenerate` flag of alemb...
2
null
Implement the Python class `MappingArgument` described below. Class description: mapping argument class. this class must be used for cli options that have mappings. these are arguments that their real value that should be emitted to cli, will be extracted from a dict based on the input of the python-side method. they ...
Implement the Python class `MappingArgument` described below. Class description: mapping argument class. this class must be used for cli options that have mappings. these are arguments that their real value that should be emitted to cli, will be extracted from a dict based on the input of the python-side method. they ...
9d4776498225de4f3d16a4600b5b19212abe8562
<|skeleton|> class MappingArgument: """mapping argument class. this class must be used for cli options that have mappings. these are arguments that their real value that should be emitted to cli, will be extracted from a dict based on the input of the python-side method. they could have argument name or could be em...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MappingArgument: """mapping argument class. this class must be used for cli options that have mappings. these are arguments that their real value that should be emitted to cli, will be extracted from a dict based on the input of the python-side method. they could have argument name or could be emitted without...
the_stack_v2_python_sparse
src/pyrin/cli/arguments.py
mononobi/pyrin
train
20
a950a5bc5157dc48e49794662083127a598459a9
[ "if num >= 0:\n if num < 7:\n return str(num)\n else:\n div_, res_ = self.div(num)\n if div_ < 7:\n return str(div_) + str(res_)\n else:\n return self.convertToBase7(div_) + str(res_)\nelse:\n sev = '-' + self.convertToBase7(abs(num))\n return sev", "d...
<|body_start_0|> if num >= 0: if num < 7: return str(num) else: div_, res_ = self.div(num) if div_ < 7: return str(div_) + str(res_) else: return self.convertToBase7(div_) + str(res_) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def convertToBase7(self, num): """:type num: int :rtype: str""" <|body_0|> def div(self, num): """:type num: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if num >= 0: if num < 7: return str(nu...
stack_v2_sparse_classes_36k_train_009294
916
no_license
[ { "docstring": ":type num: int :rtype: str", "name": "convertToBase7", "signature": "def convertToBase7(self, num)" }, { "docstring": ":type num: int :rtype: int", "name": "div", "signature": "def div(self, num)" } ]
2
stack_v2_sparse_classes_30k_train_021222
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def convertToBase7(self, num): :type num: int :rtype: str - def div(self, num): :type num: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def convertToBase7(self, num): :type num: int :rtype: str - def div(self, num): :type num: int :rtype: int <|skeleton|> class Solution: def convertToBase7(self, num): ...
504a472be267150467903298bc563f8469428a41
<|skeleton|> class Solution: def convertToBase7(self, num): """:type num: int :rtype: str""" <|body_0|> def div(self, num): """:type num: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def convertToBase7(self, num): """:type num: int :rtype: str""" if num >= 0: if num < 7: return str(num) else: div_, res_ = self.div(num) if div_ < 7: return str(div_) + str(res_) ...
the_stack_v2_python_sparse
504.py
ginger21/leetcode
train
0
016b637d0b466ff267d9d45917ee0da0a90c7082
[ "self.assertFalse('mock' in str(time.sleep).lower())\nwith timeout_util.Timeout(30):\n with timeout_util.Timeout(20):\n with timeout_util.Timeout(1):\n self.assertRaises(timeout_util.TimeoutError, time.sleep, 10)\n time.sleep(1)", "with timeout_util.Timeout(1):\n try:\n with ...
<|body_start_0|> self.assertFalse('mock' in str(time.sleep).lower()) with timeout_util.Timeout(30): with timeout_util.Timeout(20): with timeout_util.Timeout(1): self.assertRaises(timeout_util.TimeoutError, time.sleep, 10) time.sleep(1) <|en...
Tests for timeout_util.Timeout.
TestTimeouts
[ "LGPL-2.0-or-later", "GPL-1.0-or-later", "MIT", "Apache-2.0", "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestTimeouts: """Tests for timeout_util.Timeout.""" def testTimeout(self): """Tests that we can nest Timeout correctly.""" <|body_0|> def testTimeoutNested(self): """Tests that we still re-raise an alarm if both are reached.""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_36k_train_009295
5,963
permissive
[ { "docstring": "Tests that we can nest Timeout correctly.", "name": "testTimeout", "signature": "def testTimeout(self)" }, { "docstring": "Tests that we still re-raise an alarm if both are reached.", "name": "testTimeoutNested", "signature": "def testTimeoutNested(self)" } ]
2
stack_v2_sparse_classes_30k_train_010670
Implement the Python class `TestTimeouts` described below. Class description: Tests for timeout_util.Timeout. Method signatures and docstrings: - def testTimeout(self): Tests that we can nest Timeout correctly. - def testTimeoutNested(self): Tests that we still re-raise an alarm if both are reached.
Implement the Python class `TestTimeouts` described below. Class description: Tests for timeout_util.Timeout. Method signatures and docstrings: - def testTimeout(self): Tests that we can nest Timeout correctly. - def testTimeoutNested(self): Tests that we still re-raise an alarm if both are reached. <|skeleton|> cla...
72a05af97787001756bae2511b7985e61498c965
<|skeleton|> class TestTimeouts: """Tests for timeout_util.Timeout.""" def testTimeout(self): """Tests that we can nest Timeout correctly.""" <|body_0|> def testTimeoutNested(self): """Tests that we still re-raise an alarm if both are reached.""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestTimeouts: """Tests for timeout_util.Timeout.""" def testTimeout(self): """Tests that we can nest Timeout correctly.""" self.assertFalse('mock' in str(time.sleep).lower()) with timeout_util.Timeout(30): with timeout_util.Timeout(20): with timeout_uti...
the_stack_v2_python_sparse
third_party/chromite/lib/timeout_util_unittest.py
metux/chromium-suckless
train
5
bd584b25c81d8646bb09cd59b265b0f4bf5d1c30
[ "url = f'{HOST}/api/loginS'\nin_data['password'] = self.get_md5(in_data['password'])\npayload = in_data\nresponse = requests.post(url, json=payload)\nif mode:\n return ''.join(jsonpath(response.json(), '$..token'))\nelse:\n return response.json()", "md5 = hashlib.md5()\nmd5.update(psw.encode('utf-8'))\nretu...
<|body_start_0|> url = f'{HOST}/api/loginS' in_data['password'] = self.get_md5(in_data['password']) payload = in_data response = requests.post(url, json=payload) if mode: return ''.join(jsonpath(response.json(), '$..token')) else: return response.j...
Login
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Login: def login(self, in_data, mode=True): """登陆方法 :return:返回响应体字典""" <|body_0|> def get_md5(self, psw): """md5加密 :param psw: :return: 返回MD5加密值""" <|body_1|> <|end_skeleton|> <|body_start_0|> url = f'{HOST}/api/loginS' in_data['password'] =...
stack_v2_sparse_classes_36k_train_009296
1,515
no_license
[ { "docstring": "登陆方法 :return:返回响应体字典", "name": "login", "signature": "def login(self, in_data, mode=True)" }, { "docstring": "md5加密 :param psw: :return: 返回MD5加密值", "name": "get_md5", "signature": "def get_md5(self, psw)" } ]
2
stack_v2_sparse_classes_30k_train_018561
Implement the Python class `Login` described below. Class description: Implement the Login class. Method signatures and docstrings: - def login(self, in_data, mode=True): 登陆方法 :return:返回响应体字典 - def get_md5(self, psw): md5加密 :param psw: :return: 返回MD5加密值
Implement the Python class `Login` described below. Class description: Implement the Login class. Method signatures and docstrings: - def login(self, in_data, mode=True): 登陆方法 :return:返回响应体字典 - def get_md5(self, psw): md5加密 :param psw: :return: 返回MD5加密值 <|skeleton|> class Login: def login(self, in_data, mode=Tr...
0346bb952823f3cd4c8c383115f2a617f39f7cce
<|skeleton|> class Login: def login(self, in_data, mode=True): """登陆方法 :return:返回响应体字典""" <|body_0|> def get_md5(self, psw): """md5加密 :param psw: :return: 返回MD5加密值""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Login: def login(self, in_data, mode=True): """登陆方法 :return:返回响应体字典""" url = f'{HOST}/api/loginS' in_data['password'] = self.get_md5(in_data['password']) payload = in_data response = requests.post(url, json=payload) if mode: return ''.join(jsonpath(r...
the_stack_v2_python_sparse
在线考试系统测试/libs/login.py
01xu10/myproject
train
0
9e7686d7ed8414960a3a54dab6c136963a34efb6
[ "argument = ''\nwith self.assertRaises(FileNotFoundError):\n file_io.open_text(argument)", "argument = 'this_is_not_existed.txt'\nwith self.assertRaises(FileNotFoundError):\n file_io.open_text(argument)", "file_name = 'doctest_1.txt'\nactual = file_io.open_text(file_name)\nexpected = 'this file is for the...
<|body_start_0|> argument = '' with self.assertRaises(FileNotFoundError): file_io.open_text(argument) <|end_body_0|> <|body_start_1|> argument = 'this_is_not_existed.txt' with self.assertRaises(FileNotFoundError): file_io.open_text(argument) <|end_body_1|> <|bod...
Test
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test: def test_empty_filename(self): """Test function with a empty filename""" <|body_0|> def test_wrong_filename(self): """Test function with a file that is not existed""" <|body_1|> def test_right_file(self): """Test function with a file that i...
stack_v2_sparse_classes_36k_train_009297
830
no_license
[ { "docstring": "Test function with a empty filename", "name": "test_empty_filename", "signature": "def test_empty_filename(self)" }, { "docstring": "Test function with a file that is not existed", "name": "test_wrong_filename", "signature": "def test_wrong_filename(self)" }, { "d...
3
stack_v2_sparse_classes_30k_train_012881
Implement the Python class `Test` described below. Class description: Implement the Test class. Method signatures and docstrings: - def test_empty_filename(self): Test function with a empty filename - def test_wrong_filename(self): Test function with a file that is not existed - def test_right_file(self): Test functi...
Implement the Python class `Test` described below. Class description: Implement the Test class. Method signatures and docstrings: - def test_empty_filename(self): Test function with a empty filename - def test_wrong_filename(self): Test function with a file that is not existed - def test_right_file(self): Test functi...
48df12f90d2b82167606f8573137f34840e2b6b3
<|skeleton|> class Test: def test_empty_filename(self): """Test function with a empty filename""" <|body_0|> def test_wrong_filename(self): """Test function with a file that is not existed""" <|body_1|> def test_right_file(self): """Test function with a file that i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Test: def test_empty_filename(self): """Test function with a empty filename""" argument = '' with self.assertRaises(FileNotFoundError): file_io.open_text(argument) def test_wrong_filename(self): """Test function with a file that is not existed""" argume...
the_stack_v2_python_sparse
lab07/test_open_text.py
dafu2020/Mini-Python-Projects
train
0
571307be1e1d20222afe3cbe4527af5fcb38f445
[ "try:\n return Member.objects.get(pk=pk)\nexcept Member.DoesNotExist:\n raise Http404", "if pk is not None:\n member = self.get_member(int(pk))\nelse:\n member = None\nself.check_object_permissions(request, member)\nsecurities = Security.get_members_securities(member)\nserializer = SecuritySerializer(...
<|body_start_0|> try: return Member.objects.get(pk=pk) except Member.DoesNotExist: raise Http404 <|end_body_0|> <|body_start_1|> if pk is not None: member = self.get_member(int(pk)) else: member = None self.check_object_permissions...
SecurityView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SecurityView: def get_member(self, pk): """Get a member.""" <|body_0|> def get(self, request, pk, format=None): """List Member's Securities --- serializer: loans.serializers.SecuritySerializer""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: ...
stack_v2_sparse_classes_36k_train_009298
13,511
no_license
[ { "docstring": "Get a member.", "name": "get_member", "signature": "def get_member(self, pk)" }, { "docstring": "List Member's Securities --- serializer: loans.serializers.SecuritySerializer", "name": "get", "signature": "def get(self, request, pk, format=None)" } ]
2
stack_v2_sparse_classes_30k_train_004504
Implement the Python class `SecurityView` described below. Class description: Implement the SecurityView class. Method signatures and docstrings: - def get_member(self, pk): Get a member. - def get(self, request, pk, format=None): List Member's Securities --- serializer: loans.serializers.SecuritySerializer
Implement the Python class `SecurityView` described below. Class description: Implement the SecurityView class. Method signatures and docstrings: - def get_member(self, pk): Get a member. - def get(self, request, pk, format=None): List Member's Securities --- serializer: loans.serializers.SecuritySerializer <|skelet...
c5ac11e40a628c93c3865363e97b4f255a104ca8
<|skeleton|> class SecurityView: def get_member(self, pk): """Get a member.""" <|body_0|> def get(self, request, pk, format=None): """List Member's Securities --- serializer: loans.serializers.SecuritySerializer""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SecurityView: def get_member(self, pk): """Get a member.""" try: return Member.objects.get(pk=pk) except Member.DoesNotExist: raise Http404 def get(self, request, pk, format=None): """List Member's Securities --- serializer: loans.serializers.Securi...
the_stack_v2_python_sparse
loans/views.py
lubegamark/gosacco
train
2
6ef2daa89188673b05a275dea530ee33013e6eb2
[ "self._lock.acquire()\ntry:\n key = int(target.__name__.split('_')[-1])\n if self._targets.has_key(key):\n exist_target = self._targets.get(key)\n raise 'target [%d] Already exists, Conflict between the %s and %s' % (key, exist_target.__name__, target.__name__)\n self._targets[...
<|body_start_0|> self._lock.acquire() try: key = int(target.__name__.split('_')[-1]) if self._targets.has_key(key): exist_target = self._targets.get(key) raise 'target [%d] Already exists, Conflict between the %s and %s' % (key, exis...
A remoting service According to Command ID search target
CommandService
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CommandService: """A remoting service According to Command ID search target""" def mapTarget(self, target): """Add a target to the service.""" <|body_0|> def unMapTarget(self, target): """Remove a target from the service.""" <|body_1|> <|end_skeleton|> ...
stack_v2_sparse_classes_36k_train_009299
4,997
permissive
[ { "docstring": "Add a target to the service.", "name": "mapTarget", "signature": "def mapTarget(self, target)" }, { "docstring": "Remove a target from the service.", "name": "unMapTarget", "signature": "def unMapTarget(self, target)" } ]
2
null
Implement the Python class `CommandService` described below. Class description: A remoting service According to Command ID search target Method signatures and docstrings: - def mapTarget(self, target): Add a target to the service. - def unMapTarget(self, target): Remove a target from the service.
Implement the Python class `CommandService` described below. Class description: A remoting service According to Command ID search target Method signatures and docstrings: - def mapTarget(self, target): Add a target to the service. - def unMapTarget(self, target): Remove a target from the service. <|skeleton|> class ...
8205dff0d423aaedfa7fca8790d1d6fe50213e6e
<|skeleton|> class CommandService: """A remoting service According to Command ID search target""" def mapTarget(self, target): """Add a target to the service.""" <|body_0|> def unMapTarget(self, target): """Remove a target from the service.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CommandService: """A remoting service According to Command ID search target""" def mapTarget(self, target): """Add a target to the service.""" self._lock.acquire() try: key = int(target.__name__.split('_')[-1]) if self._targets.has_key(key): ...
the_stack_v2_python_sparse
firefly/utils/services.py
hw233/lolita_son
train
0