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
4d805f6c5759f328c56ac3b1f0ef110c034b0360
[ "super(EmRecoverNode, self).__init__()\nself.service = GlobalModule.SERVICE_RECOVER_NODE\nself._xml_ns = '{%s}' % GlobalModule.EM_NAME_SPACES[self.service]\nself.scenario_name = 'RecoverNode'", "json_message = super(EmRecoverNode, self)._creating_json(device_message)\ndevice_json_message = json.loads(json_message...
<|body_start_0|> super(EmRecoverNode, self).__init__() self.service = GlobalModule.SERVICE_RECOVER_NODE self._xml_ns = '{%s}' % GlobalModule.EM_NAME_SPACES[self.service] self.scenario_name = 'RecoverNode' <|end_body_0|> <|body_start_1|> json_message = super(EmRecoverNode, self)....
Scenario class for recover node
EmRecoverNode
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EmRecoverNode: """Scenario class for recover node""" def __init__(self): """Constructor""" <|body_0|> def _creating_json(self, device_message): """Merges EC message(XML) devided into that in each device and device registration information received from DB convert...
stack_v2_sparse_classes_36k_train_020600
4,887
permissive
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Merges EC message(XML) devided into that in each device and device registration information received from DB converts them to JSDN and sets QOS information for service resetting Argument: devic...
5
stack_v2_sparse_classes_30k_train_004460
Implement the Python class `EmRecoverNode` described below. Class description: Scenario class for recover node Method signatures and docstrings: - def __init__(self): Constructor - def _creating_json(self, device_message): Merges EC message(XML) devided into that in each device and device registration information rec...
Implement the Python class `EmRecoverNode` described below. Class description: Scenario class for recover node Method signatures and docstrings: - def __init__(self): Constructor - def _creating_json(self, device_message): Merges EC message(XML) devided into that in each device and device registration information rec...
e550d1b5ec9419f1fb3eb6e058ce46b57c92ee2f
<|skeleton|> class EmRecoverNode: """Scenario class for recover node""" def __init__(self): """Constructor""" <|body_0|> def _creating_json(self, device_message): """Merges EC message(XML) devided into that in each device and device registration information received from DB convert...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EmRecoverNode: """Scenario class for recover node""" def __init__(self): """Constructor""" super(EmRecoverNode, self).__init__() self.service = GlobalModule.SERVICE_RECOVER_NODE self._xml_ns = '{%s}' % GlobalModule.EM_NAME_SPACES[self.service] self.scenario_name = ...
the_stack_v2_python_sparse
lib/Scenario/EmRecoverNode.py
lixiaochun/element-manager
train
0
154a503a816eee2159e5a6e0b514bf4e7adba173
[ "self._using_source = None\nself._using_destination = None\nself.device = device\nself.server_device_id = kwargs.get('server_device_id', device.central_server_id)\nif using_source == using_destination:\n raise UsingError(\"Arguments '<source>' and '<destination'> cannot be the same. Got '{0}' and '{1}'\".format(...
<|body_start_0|> self._using_source = None self._using_destination = None self.device = device self.server_device_id = kwargs.get('server_device_id', device.central_server_id) if using_source == using_destination: raise UsingError("Arguments '<source>' and '<destinati...
BaseUsing
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseUsing: def __init__(self, using_source, using_destination, **kwargs): """Initializes and verifies arguments ``using_source`` and ``using_destination``. Args: ``using_source``: settings.DATABASE key for source. Source is the server so must be 'default' if running on the server and 'se...
stack_v2_sparse_classes_36k_train_020601
4,751
no_license
[ { "docstring": "Initializes and verifies arguments ``using_source`` and ``using_destination``. Args: ``using_source``: settings.DATABASE key for source. Source is the server so must be 'default' if running on the server and 'server' if running on the device. ``using_destination``: settings.DATABASE key for dest...
6
null
Implement the Python class `BaseUsing` described below. Class description: Implement the BaseUsing class. Method signatures and docstrings: - def __init__(self, using_source, using_destination, **kwargs): Initializes and verifies arguments ``using_source`` and ``using_destination``. Args: ``using_source``: settings.D...
Implement the Python class `BaseUsing` described below. Class description: Implement the BaseUsing class. Method signatures and docstrings: - def __init__(self, using_source, using_destination, **kwargs): Initializes and verifies arguments ``using_source`` and ``using_destination``. Args: ``using_source``: settings.D...
4f75336ff572babd39d431185677a65bece9e524
<|skeleton|> class BaseUsing: def __init__(self, using_source, using_destination, **kwargs): """Initializes and verifies arguments ``using_source`` and ``using_destination``. Args: ``using_source``: settings.DATABASE key for source. Source is the server so must be 'default' if running on the server and 'se...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BaseUsing: def __init__(self, using_source, using_destination, **kwargs): """Initializes and verifies arguments ``using_source`` and ``using_destination``. Args: ``using_source``: settings.DATABASE key for source. Source is the server so must be 'default' if running on the server and 'server' if runni...
the_stack_v2_python_sparse
edc/core/bhp_using/classes/base_using.py
botswana-harvard/edc
train
0
3dbefb0d2ab526ee1fc8217417bbbca449c4e33a
[ "serializer = PasswordSetSerializer(data=request.data, context={'request': request})\nserializer.is_valid(raise_exception=True)\nplain_password = serializer.validated_data['password']\nPasswordService.set_pasword(request.user, plain_password)\nreturn Response(AccountsResponses.PASSWORD_ADDED, status=status.HTTP_201...
<|body_start_0|> serializer = PasswordSetSerializer(data=request.data, context={'request': request}) serializer.is_valid(raise_exception=True) plain_password = serializer.validated_data['password'] PasswordService.set_pasword(request.user, plain_password) return Response(Accounts...
Contains all accounts endpoints.
PasswordActionsViewSet
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PasswordActionsViewSet: """Contains all accounts endpoints.""" def set_password(self, request): """Sets the user password.""" <|body_0|> def update_password(self, request): """Updates the useer passwrod.""" <|body_1|> def reset_password(self, request...
stack_v2_sparse_classes_36k_train_020602
3,392
permissive
[ { "docstring": "Sets the user password.", "name": "set_password", "signature": "def set_password(self, request)" }, { "docstring": "Updates the useer passwrod.", "name": "update_password", "signature": "def update_password(self, request)" }, { "docstring": "Request a password res...
4
null
Implement the Python class `PasswordActionsViewSet` described below. Class description: Contains all accounts endpoints. Method signatures and docstrings: - def set_password(self, request): Sets the user password. - def update_password(self, request): Updates the useer passwrod. - def reset_password(self, request): R...
Implement the Python class `PasswordActionsViewSet` described below. Class description: Contains all accounts endpoints. Method signatures and docstrings: - def set_password(self, request): Sets the user password. - def update_password(self, request): Updates the useer passwrod. - def reset_password(self, request): R...
3fdc01eabdff459b31e016f9f6d1cafc19c5a292
<|skeleton|> class PasswordActionsViewSet: """Contains all accounts endpoints.""" def set_password(self, request): """Sets the user password.""" <|body_0|> def update_password(self, request): """Updates the useer passwrod.""" <|body_1|> def reset_password(self, request...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PasswordActionsViewSet: """Contains all accounts endpoints.""" def set_password(self, request): """Sets the user password.""" serializer = PasswordSetSerializer(data=request.data, context={'request': request}) serializer.is_valid(raise_exception=True) plain_password = seri...
the_stack_v2_python_sparse
apps/accounts/api/v1/views/password.py
jimialex/django-wise
train
0
5ba6e3554063e263c24297241943151e3f6634c1
[ "try:\n job = self.build_objects_async(build_table=build_table, delete_dataset_contents=delete_dataset_contents, delete_templates=delete_templates)\nexcept IngestionException as e:\n if self.raise_errors:\n raise e\n else:\n return IngestionStatus.from_exception(e)\nstatus = self.poll_for_job...
<|body_start_0|> try: job = self.build_objects_async(build_table=build_table, delete_dataset_contents=delete_dataset_contents, delete_templates=delete_templates) except IngestionException as e: if self.raise_errors: raise e else: return...
[ALPHA] A job that uploads new information to the platform. Datasets are the basic unit of access control. A user with read access to a dataset can view every object in that dataset. A user with write access to a dataset can create, update, and delete objects in the dataset. Attributes ---------- uid: UUID Unique uuid4...
Ingestion
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Ingestion: """[ALPHA] A job that uploads new information to the platform. Datasets are the basic unit of access control. A user with read access to a dataset can view every object in that dataset. A user with write access to a dataset can create, update, and delete objects in the dataset. Attribu...
stack_v2_sparse_classes_36k_train_020603
18,706
permissive
[ { "docstring": "[ALPHA] Perform a complete ingestion operation, from start to finish. Initiates an ingestion operation, polls the server to determine when the job has finished, and returns the outcome. Parameters ---------- build_table: bool Whether to build a table immediately after ingestion. Default : False ...
4
stack_v2_sparse_classes_30k_train_015615
Implement the Python class `Ingestion` described below. Class description: [ALPHA] A job that uploads new information to the platform. Datasets are the basic unit of access control. A user with read access to a dataset can view every object in that dataset. A user with write access to a dataset can create, update, and...
Implement the Python class `Ingestion` described below. Class description: [ALPHA] A job that uploads new information to the platform. Datasets are the basic unit of access control. A user with read access to a dataset can view every object in that dataset. A user with write access to a dataset can create, update, and...
43898bfc66edbe10fab00f614ee68c9ea20c4c52
<|skeleton|> class Ingestion: """[ALPHA] A job that uploads new information to the platform. Datasets are the basic unit of access control. A user with read access to a dataset can view every object in that dataset. A user with write access to a dataset can create, update, and delete objects in the dataset. Attribu...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Ingestion: """[ALPHA] A job that uploads new information to the platform. Datasets are the basic unit of access control. A user with read access to a dataset can view every object in that dataset. A user with write access to a dataset can create, update, and delete objects in the dataset. Attributes ---------...
the_stack_v2_python_sparse
src/citrine/resources/ingestion.py
CitrineInformatics/citrine-python
train
30
80833736cc9046af69fe29a3a92578b345443be2
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn BlobEvidence()", "from .alert_evidence import AlertEvidence\nfrom .blob_container_evidence import BlobContainerEvidence\nfrom .file_hash import FileHash\nfrom .alert_evidence import AlertEvidence\nfrom .blob_container_evidence import B...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return BlobEvidence() <|end_body_0|> <|body_start_1|> from .alert_evidence import AlertEvidence from .blob_container_evidence import BlobContainerEvidence from .file_hash import FileHas...
BlobEvidence
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BlobEvidence: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> BlobEvidence: """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_020604
3,308
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: BlobEvidence", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_value(...
3
null
Implement the Python class `BlobEvidence` described below. Class description: Implement the BlobEvidence class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> BlobEvidence: Creates a new instance of the appropriate class based on discriminator value Ar...
Implement the Python class `BlobEvidence` described below. Class description: Implement the BlobEvidence class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> BlobEvidence: Creates a new instance of the appropriate class based on discriminator value Ar...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class BlobEvidence: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> BlobEvidence: """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 BlobEvidence: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> BlobEvidence: """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: BlobEvidence""...
the_stack_v2_python_sparse
msgraph/generated/models/security/blob_evidence.py
microsoftgraph/msgraph-sdk-python
train
135
bc20bea485cdde9ef5c50c7ac33a8b7714b7db5e
[ "super(MaskHeadNetwork, self).__init__()\nself._net = _get_deepmac_network_by_type(network_type, num_init_channels, mask_size)\nself._use_instance_embedding = use_instance_embedding\nself.project_out = tf.keras.layers.Conv2D(filters=1, kernel_size=1, activation=None)", "height = tf.shape(pixel_embedding)[1]\nwidt...
<|body_start_0|> super(MaskHeadNetwork, self).__init__() self._net = _get_deepmac_network_by_type(network_type, num_init_channels, mask_size) self._use_instance_embedding = use_instance_embedding self.project_out = tf.keras.layers.Conv2D(filters=1, kernel_size=1, activation=None) <|end_b...
Mask head class for DeepMAC.
MaskHeadNetwork
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MaskHeadNetwork: """Mask head class for DeepMAC.""" def __init__(self, network_type, num_init_channels=64, use_instance_embedding=True, mask_size=None): """Initializes the network. Args: network_type: A string denoting the kind of network we want to use internally. num_init_channels:...
stack_v2_sparse_classes_36k_train_020605
35,958
permissive
[ { "docstring": "Initializes the network. Args: network_type: A string denoting the kind of network we want to use internally. num_init_channels: int, the number of channels in the first block. The number of channels in the following blocks depend on the network type used. use_instance_embedding: bool, if set, w...
2
null
Implement the Python class `MaskHeadNetwork` described below. Class description: Mask head class for DeepMAC. Method signatures and docstrings: - def __init__(self, network_type, num_init_channels=64, use_instance_embedding=True, mask_size=None): Initializes the network. Args: network_type: A string denoting the kind...
Implement the Python class `MaskHeadNetwork` described below. Class description: Mask head class for DeepMAC. Method signatures and docstrings: - def __init__(self, network_type, num_init_channels=64, use_instance_embedding=True, mask_size=None): Initializes the network. Args: network_type: A string denoting the kind...
192ae544169c1230c21141c033800aa1bd94e9b6
<|skeleton|> class MaskHeadNetwork: """Mask head class for DeepMAC.""" def __init__(self, network_type, num_init_channels=64, use_instance_embedding=True, mask_size=None): """Initializes the network. Args: network_type: A string denoting the kind of network we want to use internally. num_init_channels:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MaskHeadNetwork: """Mask head class for DeepMAC.""" def __init__(self, network_type, num_init_channels=64, use_instance_embedding=True, mask_size=None): """Initializes the network. Args: network_type: A string denoting the kind of network we want to use internally. num_init_channels: int, the num...
the_stack_v2_python_sparse
object_detection/meta_architectures/deepmac_meta_arch.py
DemonDamon/mask-detection-based-on-tf2odapi
train
2
d67c2c88a6bfd0ed6550aa5232cb9d3d92a74f3c
[ "root = TreeNode(preorder[0])\nstk = [root]\nfor a in preorder[1:]:\n node = TreeNode(a)\n if a < stk[-1].val:\n stk[-1].left = node\n else:\n while len(stk) >= 2 and stk[-2].val < a:\n stk.pop()\n stk[-1].right = node\n stk.pop()\n stk.append(node)\nreturn root", ...
<|body_start_0|> root = TreeNode(preorder[0]) stk = [root] for a in preorder[1:]: node = TreeNode(a) if a < stk[-1].val: stk[-1].left = node else: while len(stk) >= 2 and stk[-2].val < a: stk.pop() ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def bstFromPreorder2(self, preorder: List[int]) -> TreeNode: """need to be BST scan the list to break left and right part F(n) = 2 F(n/2) + O(n), then it is O(n log n) Make it O(n) maintain a stack After walking through example, left child can be determined quickly since it is ...
stack_v2_sparse_classes_36k_train_020606
2,292
no_license
[ { "docstring": "need to be BST scan the list to break left and right part F(n) = 2 F(n/2) + O(n), then it is O(n log n) Make it O(n) maintain a stack After walking through example, left child can be determined quickly since it is pre-order. Left comes first. Stack maintain a node that is missing right child dec...
2
stack_v2_sparse_classes_30k_train_012772
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def bstFromPreorder2(self, preorder: List[int]) -> TreeNode: need to be BST scan the list to break left and right part F(n) = 2 F(n/2) + O(n), then it is O(n log n) Make it O(n) ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def bstFromPreorder2(self, preorder: List[int]) -> TreeNode: need to be BST scan the list to break left and right part F(n) = 2 F(n/2) + O(n), then it is O(n log n) Make it O(n) ...
929dde1723fb2f54870c8a9badc80fc23e8400d3
<|skeleton|> class Solution: def bstFromPreorder2(self, preorder: List[int]) -> TreeNode: """need to be BST scan the list to break left and right part F(n) = 2 F(n/2) + O(n), then it is O(n log n) Make it O(n) maintain a stack After walking through example, left child can be determined quickly since it is ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def bstFromPreorder2(self, preorder: List[int]) -> TreeNode: """need to be BST scan the list to break left and right part F(n) = 2 F(n/2) + O(n), then it is O(n log n) Make it O(n) maintain a stack After walking through example, left child can be determined quickly since it is pre-order. Lef...
the_stack_v2_python_sparse
_algorithms_challenges/leetcode/LeetCode/1008 Construct Binary Search Tree from Preorder Traversal.py
syurskyi/Algorithms_and_Data_Structure
train
4
c0be08f7221bcc06fcfd245da0c480d03c642443
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "conte...
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
Proto file describing the OfflineUserDataJobService. Service to manage offline user data jobs.
OfflineUserDataJobServiceServicer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OfflineUserDataJobServiceServicer: """Proto file describing the OfflineUserDataJobService. Service to manage offline user data jobs.""" def CreateOfflineUserDataJob(self, request, context): """Creates an offline user data job.""" <|body_0|> def GetOfflineUserDataJob(self...
stack_v2_sparse_classes_36k_train_020607
6,246
permissive
[ { "docstring": "Creates an offline user data job.", "name": "CreateOfflineUserDataJob", "signature": "def CreateOfflineUserDataJob(self, request, context)" }, { "docstring": "Returns the offline user data job.", "name": "GetOfflineUserDataJob", "signature": "def GetOfflineUserDataJob(sel...
4
stack_v2_sparse_classes_30k_train_009715
Implement the Python class `OfflineUserDataJobServiceServicer` described below. Class description: Proto file describing the OfflineUserDataJobService. Service to manage offline user data jobs. Method signatures and docstrings: - def CreateOfflineUserDataJob(self, request, context): Creates an offline user data job. ...
Implement the Python class `OfflineUserDataJobServiceServicer` described below. Class description: Proto file describing the OfflineUserDataJobService. Service to manage offline user data jobs. Method signatures and docstrings: - def CreateOfflineUserDataJob(self, request, context): Creates an offline user data job. ...
a5b6cede64f4d9912ae6ad26927a54e40448c9fe
<|skeleton|> class OfflineUserDataJobServiceServicer: """Proto file describing the OfflineUserDataJobService. Service to manage offline user data jobs.""" def CreateOfflineUserDataJob(self, request, context): """Creates an offline user data job.""" <|body_0|> def GetOfflineUserDataJob(self...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OfflineUserDataJobServiceServicer: """Proto file describing the OfflineUserDataJobService. Service to manage offline user data jobs.""" def CreateOfflineUserDataJob(self, request, context): """Creates an offline user data job.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) con...
the_stack_v2_python_sparse
google/ads/google_ads/v3/proto/services/offline_user_data_job_service_pb2_grpc.py
fiboknacky/google-ads-python
train
0
2009ec73734a942cf5072a14be018edd1550ac39
[ "if not root:\n return 0\nleft = right = root\nd = 0\nwhile left and right:\n d += 1\n left = left.left\n right = right.right\nif not left:\n return (1 << d) - 1\nreturn 1 + self.countNodes(root.left) + self.countNodes(root.right)", "def height(node):\n cnt = 0\n while node:\n node = n...
<|body_start_0|> if not root: return 0 left = right = root d = 0 while left and right: d += 1 left = left.left right = right.right if not left: return (1 << d) - 1 return 1 + self.countNodes(root.left) + self.cou...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def countNodes(self, root): """:type root: TreeNode :rtype: int""" <|body_0|> def countNodes(self, root): """:type root: TreeNode :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not root: return 0 left = ...
stack_v2_sparse_classes_36k_train_020608
1,481
no_license
[ { "docstring": ":type root: TreeNode :rtype: int", "name": "countNodes", "signature": "def countNodes(self, root)" }, { "docstring": ":type root: TreeNode :rtype: int", "name": "countNodes", "signature": "def countNodes(self, root)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countNodes(self, root): :type root: TreeNode :rtype: int - def countNodes(self, root): :type root: TreeNode :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countNodes(self, root): :type root: TreeNode :rtype: int - def countNodes(self, root): :type root: TreeNode :rtype: int <|skeleton|> class Solution: def countNodes(self...
3a7f20f79281fcaedb10696723dcb39c816ce258
<|skeleton|> class Solution: def countNodes(self, root): """:type root: TreeNode :rtype: int""" <|body_0|> def countNodes(self, root): """:type root: TreeNode :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def countNodes(self, root): """:type root: TreeNode :rtype: int""" if not root: return 0 left = right = root d = 0 while left and right: d += 1 left = left.left right = right.right if not left: ...
the_stack_v2_python_sparse
222_count_complete_treenodes.py
haohanz/Leetcode-Solution
train
1
c50aad0a5485fdcd5c06801aca94751854e9e8a3
[ "n = len(nums)\nres = [0] * n\ni, j, pos = (0, n - 1, n - 1)\nwhile i <= j:\n if nums[i] ** 2 > nums[j] ** 2:\n res[pos] = nums[i] ** 2\n i += 1\n else:\n res[pos] = nums[j] ** 2\n j -= 1\n pos -= 1\nreturn res", "tmp1 = []\ntmp = [0] * len(nums)\nj = 0\nfor i in range(len(num...
<|body_start_0|> n = len(nums) res = [0] * n i, j, pos = (0, n - 1, n - 1) while i <= j: if nums[i] ** 2 > nums[j] ** 2: res[pos] = nums[i] ** 2 i += 1 else: res[pos] = nums[j] ** 2 j -= 1 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def sortedSquares(self, nums): """:type nums: List[int] :rtype: List[int] 双指针""" <|body_0|> def sortedSquares0(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|> n = len(nums) re...
stack_v2_sparse_classes_36k_train_020609
1,494
no_license
[ { "docstring": ":type nums: List[int] :rtype: List[int] 双指针", "name": "sortedSquares", "signature": "def sortedSquares(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: List[int]", "name": "sortedSquares0", "signature": "def sortedSquares0(self, nums)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def sortedSquares(self, nums): :type nums: List[int] :rtype: List[int] 双指针 - def sortedSquares0(self, nums): :type nums: List[int] :rtype: List[int]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def sortedSquares(self, nums): :type nums: List[int] :rtype: List[int] 双指针 - def sortedSquares0(self, nums): :type nums: List[int] :rtype: List[int] <|skeleton|> class Solution:...
6e18c5d257840489cc3fb1079ae3804c743982a4
<|skeleton|> class Solution: def sortedSquares(self, nums): """:type nums: List[int] :rtype: List[int] 双指针""" <|body_0|> def sortedSquares0(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def sortedSquares(self, nums): """:type nums: List[int] :rtype: List[int] 双指针""" n = len(nums) res = [0] * n i, j, pos = (0, n - 1, n - 1) while i <= j: if nums[i] ** 2 > nums[j] ** 2: res[pos] = nums[i] ** 2 i += 1 ...
the_stack_v2_python_sparse
977.有序数组的平方.py
yangyuxiang1996/leetcode
train
0
1db4f57ddb282be18d823a1d9e9d5849cf3075cd
[ "temp_list = []\nwith open(cls.ingested_file) as txt:\n for line in txt:\n temp_list.append(line.rstrip())\nreturn list(sorted(temp_list))", "def wrapper_loop(*args, **kwargs):\n pln_list = os.listdir(cls.input_dir)\n cls.nasa_frame = CustomNASA(cls.nasa_data_file, *args)\n results_list = []\n ...
<|body_start_0|> temp_list = [] with open(cls.ingested_file) as txt: for line in txt: temp_list.append(line.rstrip()) return list(sorted(temp_list)) <|end_body_0|> <|body_start_1|> def wrapper_loop(*args, **kwargs): pln_list = os.listdir(cls.input...
We want to define a decorator that will loop through some or all of the .pln files we've created, since just about every finalization routine will need to do this. New subclasses can be defined for different file schemes. ..module:: _get_list_to_skip ..synopsis:: Read in a list of planets that have already been ingeste...
NewPlnDecorator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NewPlnDecorator: """We want to define a decorator that will loop through some or all of the .pln files we've created, since just about every finalization routine will need to do this. New subclasses can be defined for different file schemes. ..module:: _get_list_to_skip ..synopsis:: Read in a lis...
stack_v2_sparse_classes_36k_train_020610
30,643
no_license
[ { "docstring": "Read in a list of planets that have already been ingested to EOD so we can skip these.", "name": "_get_list_to_skip", "signature": "def _get_list_to_skip(cls)" }, { "docstring": "Insert the provided function into a loop that iterates through all .pln files found in input_dir.", ...
3
stack_v2_sparse_classes_30k_train_009123
Implement the Python class `NewPlnDecorator` described below. Class description: We want to define a decorator that will loop through some or all of the .pln files we've created, since just about every finalization routine will need to do this. New subclasses can be defined for different file schemes. ..module:: _get_...
Implement the Python class `NewPlnDecorator` described below. Class description: We want to define a decorator that will loop through some or all of the .pln files we've created, since just about every finalization routine will need to do this. New subclasses can be defined for different file schemes. ..module:: _get_...
a2daec6ec4a85fc15e6a9a602b94eb9f847381f1
<|skeleton|> class NewPlnDecorator: """We want to define a decorator that will loop through some or all of the .pln files we've created, since just about every finalization routine will need to do this. New subclasses can be defined for different file schemes. ..module:: _get_list_to_skip ..synopsis:: Read in a lis...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NewPlnDecorator: """We want to define a decorator that will loop through some or all of the .pln files we've created, since just about every finalization routine will need to do this. New subclasses can be defined for different file schemes. ..module:: _get_list_to_skip ..synopsis:: Read in a list of planets ...
the_stack_v2_python_sparse
python/Reconciler.py
pforshay/exoplanets_org_work
train
0
60014608146cb20e89e8802abb2693fffeec27da
[ "res = 0\nfor i in range(len(s) + 1):\n temp = self.helper(s, i)\n res = max(res, temp)\nreturn res", "res = len(s)\nfor i in range(len(s)):\n if s[i] == '0' and i < left_end:\n res += 1\n elif s[i] == '1' and i >= left_end:\n res += 1\nreturn res" ]
<|body_start_0|> res = 0 for i in range(len(s) + 1): temp = self.helper(s, i) res = max(res, temp) return res <|end_body_0|> <|body_start_1|> res = len(s) for i in range(len(s)): if s[i] == '0' and i < left_end: res += 1 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def func(self, s): """Args: s: list[int] Return: int""" <|body_0|> def helper(self, s, left_end): """Args: s: str left_end: int Return: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> res = 0 for i in range(len(s) + 1): ...
stack_v2_sparse_classes_36k_train_020611
744
no_license
[ { "docstring": "Args: s: list[int] Return: int", "name": "func", "signature": "def func(self, s)" }, { "docstring": "Args: s: str left_end: int Return: int", "name": "helper", "signature": "def helper(self, s, left_end)" } ]
2
stack_v2_sparse_classes_30k_train_006625
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def func(self, s): Args: s: list[int] Return: int - def helper(self, s, left_end): Args: s: str left_end: int Return: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def func(self, s): Args: s: list[int] Return: int - def helper(self, s, left_end): Args: s: str left_end: int Return: int <|skeleton|> class Solution: def func(self, s): ...
101bce2fac8b188a4eb2f5e017293d21ad0ecb21
<|skeleton|> class Solution: def func(self, s): """Args: s: list[int] Return: int""" <|body_0|> def helper(self, s, left_end): """Args: s: str left_end: int Return: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def func(self, s): """Args: s: list[int] Return: int""" res = 0 for i in range(len(s) + 1): temp = self.helper(s, i) res = max(res, temp) return res def helper(self, s, left_end): """Args: s: str left_end: int Return: int""" ...
the_stack_v2_python_sparse
秋招/网易/网易云音乐/1.py
AiZhanghan/Leetcode
train
0
5183e6a0b106040bf9348fc4e1a71ae8553c5b27
[ "super(PetscTgtVecWrapper, self).setup(parent_params_vec, params_dict, srcvec, my_params, connections, relevance=relevance, var_of_interest=var_of_interest, store_byobjs=store_byobjs, shared_vec=shared_vec, alloc_complex=alloc_complex)\nif trace:\n debug(\"'%s': creating tgt petsc_vec: (size %d) %s: vec=%s\" % (...
<|body_start_0|> super(PetscTgtVecWrapper, self).setup(parent_params_vec, params_dict, srcvec, my_params, connections, relevance=relevance, var_of_interest=var_of_interest, store_byobjs=store_byobjs, shared_vec=shared_vec, alloc_complex=alloc_complex) if trace: debug("'%s': creating tgt pets...
PetscTgtVecWrapper
[ "LicenseRef-scancode-other-permissive" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PetscTgtVecWrapper: def setup(self, parent_params_vec, params_dict, srcvec, my_params, connections, relevance, var_of_interest=None, store_byobjs=False, shared_vec=None, alloc_complex=False): """Configure this vector to store a flattened array of the variables in params_dict. Variable sh...
stack_v2_sparse_classes_36k_train_020612
19,322
permissive
[ { "docstring": "Configure this vector to store a flattened array of the variables in params_dict. Variable shape and value are retrieved from srcvec. Args ---- parent_params_vec : `VecWrapper` or None `VecWrapper` of parameters from the parent `System`. params_dict : `OrderedDict` Dictionary of parameter absolu...
2
null
Implement the Python class `PetscTgtVecWrapper` described below. Class description: Implement the PetscTgtVecWrapper class. Method signatures and docstrings: - def setup(self, parent_params_vec, params_dict, srcvec, my_params, connections, relevance, var_of_interest=None, store_byobjs=False, shared_vec=None, alloc_co...
Implement the Python class `PetscTgtVecWrapper` described below. Class description: Implement the PetscTgtVecWrapper class. Method signatures and docstrings: - def setup(self, parent_params_vec, params_dict, srcvec, my_params, connections, relevance, var_of_interest=None, store_byobjs=False, shared_vec=None, alloc_co...
bc7a05e04c7901f477fe553c59e478a837116d92
<|skeleton|> class PetscTgtVecWrapper: def setup(self, parent_params_vec, params_dict, srcvec, my_params, connections, relevance, var_of_interest=None, store_byobjs=False, shared_vec=None, alloc_complex=False): """Configure this vector to store a flattened array of the variables in params_dict. Variable sh...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PetscTgtVecWrapper: def setup(self, parent_params_vec, params_dict, srcvec, my_params, connections, relevance, var_of_interest=None, store_byobjs=False, shared_vec=None, alloc_complex=False): """Configure this vector to store a flattened array of the variables in params_dict. Variable shape and value ...
the_stack_v2_python_sparse
bin/Python27/Lib/site-packages/openmdao/core/petsc_impl.py
metamorph-inc/meta-core
train
25
3b836ce73039cac230755071f731eec10196b938
[ "if len(nums1) > len(nums2):\n return self.intersect_1(nums2, nums1)\nm = collections.Counter()\nfor num in nums1:\n m[num] += 1\nintersection = list()\nfor num in nums2:\n if m.get(num, 0) > 0:\n intersection.append(num)\n m[num] -= 1\n if m[num] == 0:\n m.pop(num)\nreturn ...
<|body_start_0|> if len(nums1) > len(nums2): return self.intersect_1(nums2, nums1) m = collections.Counter() for num in nums1: m[num] += 1 intersection = list() for num in nums2: if m.get(num, 0) > 0: intersection.append(num) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def intersect_1(self, nums1: List[int], nums2: List[int]) -> List[int]: """方法一:哈希表 时间复杂度:O(m+n),其中 m 和 n 分别是两个数组的长度。需要遍历两个数组并对哈希表进行操作, 哈希表操作的时间复杂度是 O(1),因此总时间复杂度与两个数组的长度和呈线性关系。 空间复杂度:O(min(m,n)),其中 m 和 n 分别是两个数组的长度。对较短的数组进行哈希表的操作, 哈希表的大小不会超过较短的数组的长度。为返回值创建一个数组 intersection,其长度为...
stack_v2_sparse_classes_36k_train_020613
3,064
no_license
[ { "docstring": "方法一:哈希表 时间复杂度:O(m+n),其中 m 和 n 分别是两个数组的长度。需要遍历两个数组并对哈希表进行操作, 哈希表操作的时间复杂度是 O(1),因此总时间复杂度与两个数组的长度和呈线性关系。 空间复杂度:O(min(m,n)),其中 m 和 n 分别是两个数组的长度。对较短的数组进行哈希表的操作, 哈希表的大小不会超过较短的数组的长度。为返回值创建一个数组 intersection,其长度为较短的数组的长度。 :param nums1: :param nums2: :return:", "name": "intersect_1", "signature": ...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def intersect_1(self, nums1: List[int], nums2: List[int]) -> List[int]: 方法一:哈希表 时间复杂度:O(m+n),其中 m 和 n 分别是两个数组的长度。需要遍历两个数组并对哈希表进行操作, 哈希表操作的时间复杂度是 O(1),因此总时间复杂度与两个数组的长度和呈线性关系。 空间复杂...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def intersect_1(self, nums1: List[int], nums2: List[int]) -> List[int]: 方法一:哈希表 时间复杂度:O(m+n),其中 m 和 n 分别是两个数组的长度。需要遍历两个数组并对哈希表进行操作, 哈希表操作的时间复杂度是 O(1),因此总时间复杂度与两个数组的长度和呈线性关系。 空间复杂...
62419b49000e79962bcdc99cd98afd2fb82ea345
<|skeleton|> class Solution: def intersect_1(self, nums1: List[int], nums2: List[int]) -> List[int]: """方法一:哈希表 时间复杂度:O(m+n),其中 m 和 n 分别是两个数组的长度。需要遍历两个数组并对哈希表进行操作, 哈希表操作的时间复杂度是 O(1),因此总时间复杂度与两个数组的长度和呈线性关系。 空间复杂度:O(min(m,n)),其中 m 和 n 分别是两个数组的长度。对较短的数组进行哈希表的操作, 哈希表的大小不会超过较短的数组的长度。为返回值创建一个数组 intersection,其长度为...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def intersect_1(self, nums1: List[int], nums2: List[int]) -> List[int]: """方法一:哈希表 时间复杂度:O(m+n),其中 m 和 n 分别是两个数组的长度。需要遍历两个数组并对哈希表进行操作, 哈希表操作的时间复杂度是 O(1),因此总时间复杂度与两个数组的长度和呈线性关系。 空间复杂度:O(min(m,n)),其中 m 和 n 分别是两个数组的长度。对较短的数组进行哈希表的操作, 哈希表的大小不会超过较短的数组的长度。为返回值创建一个数组 intersection,其长度为较短的数组的长度。 :par...
the_stack_v2_python_sparse
软件开发岗刷题(华为笔试准备)/哈希表/intersect.py
MaoningGuan/LeetCode
train
3
da814904d40b66b3e6bd2b8a43af2e420a90ad77
[ "super(DecoderLayer, self).__init__()\nself.masked_multi_head_attention = MultiHeadAttention(d_model, number_of_heads)\nself.multi_head_attention = MultiHeadAttention(d_model, number_of_heads)\nself.feed_forward_network = point_wise_feed_forward_network(d_model, dff)\nself.normalization_layer1 = tf.keras.layers.Lay...
<|body_start_0|> super(DecoderLayer, self).__init__() self.masked_multi_head_attention = MultiHeadAttention(d_model, number_of_heads) self.multi_head_attention = MultiHeadAttention(d_model, number_of_heads) self.feed_forward_network = point_wise_feed_forward_network(d_model, dff) ...
Decoder layer consists of masked multi-head attention followed by normalization layer, multi-head attention followed by normalization layer and point wise feed forward network followed by normalization layer
DecoderLayer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DecoderLayer: """Decoder layer consists of masked multi-head attention followed by normalization layer, multi-head attention followed by normalization layer and point wise feed forward network followed by normalization layer""" def __init__(self, d_model, number_of_heads, dff, rate=0.1): ...
stack_v2_sparse_classes_36k_train_020614
11,425
no_license
[ { "docstring": "Constructor for decoder layer :param d_model: dimension of the word embedding vector :param number_of_heads: number of heads to work in parallel :param dff: inner-layer dimensionality :param rate: dropout rate", "name": "__init__", "signature": "def __init__(self, d_model, number_of_head...
2
stack_v2_sparse_classes_30k_train_017721
Implement the Python class `DecoderLayer` described below. Class description: Decoder layer consists of masked multi-head attention followed by normalization layer, multi-head attention followed by normalization layer and point wise feed forward network followed by normalization layer Method signatures and docstrings...
Implement the Python class `DecoderLayer` described below. Class description: Decoder layer consists of masked multi-head attention followed by normalization layer, multi-head attention followed by normalization layer and point wise feed forward network followed by normalization layer Method signatures and docstrings...
f164c21ed852dfd10a4701f4050d72dc87bd302a
<|skeleton|> class DecoderLayer: """Decoder layer consists of masked multi-head attention followed by normalization layer, multi-head attention followed by normalization layer and point wise feed forward network followed by normalization layer""" def __init__(self, d_model, number_of_heads, dff, rate=0.1): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DecoderLayer: """Decoder layer consists of masked multi-head attention followed by normalization layer, multi-head attention followed by normalization layer and point wise feed forward network followed by normalization layer""" def __init__(self, d_model, number_of_heads, dff, rate=0.1): """Const...
the_stack_v2_python_sparse
backend/code/transformer_model.py
sovaso/NewsHeadlineGenerator
train
3
352133aa362159d87233d28cc876028e2850040b
[ "dp = [False] * len(nums)\ndp[0] = True\nfor i in range(1, len(nums)):\n dp[i] = any([j + nums[j] >= i if dp[j] else False for j in range(i)])\nreturn dp[-1]", "dp = [0] * len(nums)\nfor i in range(1, len(nums)):\n dp[i] = max(dp[i - 1], nums[i - 1]) - 1\n if dp[i] < 0:\n return False\nreturn True...
<|body_start_0|> dp = [False] * len(nums) dp[0] = True for i in range(1, len(nums)): dp[i] = any([j + nums[j] >= i if dp[j] else False for j in range(i)]) return dp[-1] <|end_body_0|> <|body_start_1|> dp = [0] * len(nums) for i in range(1, len(nums)): ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def canJump(self, nums): """dp[i] 表示是否能从 [0,i) 跳到 i 能跳到 i 的条件是存在一个从 [0,i) 的某处+当时的最大跳力比 i 大 dp[i] = any(j+nums[j]>=i) 0 <= j < i :type nums: List[int] :rtype: bool""" <|body_0|> def canJump(self, nums): """dp[i] 表示达到 i 位置时剩余的跳力 当前位置的剩余跳力(dp 值)和当前位置新的跳力中较大的决定...
stack_v2_sparse_classes_36k_train_020615
2,700
no_license
[ { "docstring": "dp[i] 表示是否能从 [0,i) 跳到 i 能跳到 i 的条件是存在一个从 [0,i) 的某处+当时的最大跳力比 i 大 dp[i] = any(j+nums[j]>=i) 0 <= j < i :type nums: List[int] :rtype: bool", "name": "canJump", "signature": "def canJump(self, nums)" }, { "docstring": "dp[i] 表示达到 i 位置时剩余的跳力 当前位置的剩余跳力(dp 值)和当前位置新的跳力中较大的决定了当前能到的最远距离 下一个...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canJump(self, nums): dp[i] 表示是否能从 [0,i) 跳到 i 能跳到 i 的条件是存在一个从 [0,i) 的某处+当时的最大跳力比 i 大 dp[i] = any(j+nums[j]>=i) 0 <= j < i :type nums: List[int] :rtype: bool - def canJump(self...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canJump(self, nums): dp[i] 表示是否能从 [0,i) 跳到 i 能跳到 i 的条件是存在一个从 [0,i) 的某处+当时的最大跳力比 i 大 dp[i] = any(j+nums[j]>=i) 0 <= j < i :type nums: List[int] :rtype: bool - def canJump(self...
860590239da0618c52967a55eda8d6bbe00bfa96
<|skeleton|> class Solution: def canJump(self, nums): """dp[i] 表示是否能从 [0,i) 跳到 i 能跳到 i 的条件是存在一个从 [0,i) 的某处+当时的最大跳力比 i 大 dp[i] = any(j+nums[j]>=i) 0 <= j < i :type nums: List[int] :rtype: bool""" <|body_0|> def canJump(self, nums): """dp[i] 表示达到 i 位置时剩余的跳力 当前位置的剩余跳力(dp 值)和当前位置新的跳力中较大的决定...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def canJump(self, nums): """dp[i] 表示是否能从 [0,i) 跳到 i 能跳到 i 的条件是存在一个从 [0,i) 的某处+当时的最大跳力比 i 大 dp[i] = any(j+nums[j]>=i) 0 <= j < i :type nums: List[int] :rtype: bool""" dp = [False] * len(nums) dp[0] = True for i in range(1, len(nums)): dp[i] = any([j + nums[...
the_stack_v2_python_sparse
LeetCode/p0055/II/jump-game.py
Ynjxsjmh/PracticeMakesPerfect
train
0
44fd550eb28b4d9130dbf0576184c3d845b68210
[ "self.words = ['Titan', 'Jupiter', 'Titan', 'Titan', 'Huygens', 'Jupiter']\nself.r = ranking.Ranking('not_existing.txt')\nfor w in self.words:\n self.r.add(w)\nself.r.save()", "try:\n os.remove('not_existing.txt')\nexcept:\n pass", "self.failUnless(self.r.getRank('Titan') == 1)\nself.failUnless(self.r....
<|body_start_0|> self.words = ['Titan', 'Jupiter', 'Titan', 'Titan', 'Huygens', 'Jupiter'] self.r = ranking.Ranking('not_existing.txt') for w in self.words: self.r.add(w) self.r.save() <|end_body_0|> <|body_start_1|> try: os.remove('not_existing.txt') ...
Funktionstests
TestRanking1
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestRanking1: """Funktionstests""" def setUp(self): """Erzeuge Testdaten und Ranking-Objekt""" <|body_0|> def tearDown(self): """Lösche Testdatei""" <|body_1|> def testRank(self): """Prüfe, ob Rang richtig berechnet wird""" <|body_2|>...
stack_v2_sparse_classes_36k_train_020616
2,660
no_license
[ { "docstring": "Erzeuge Testdaten und Ranking-Objekt", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Lösche Testdatei", "name": "tearDown", "signature": "def tearDown(self)" }, { "docstring": "Prüfe, ob Rang richtig berechnet wird", "name": "testRank", ...
5
null
Implement the Python class `TestRanking1` described below. Class description: Funktionstests Method signatures and docstrings: - def setUp(self): Erzeuge Testdaten und Ranking-Objekt - def tearDown(self): Lösche Testdatei - def testRank(self): Prüfe, ob Rang richtig berechnet wird - def testSave(self): Pruefe, ob all...
Implement the Python class `TestRanking1` described below. Class description: Funktionstests Method signatures and docstrings: - def setUp(self): Erzeuge Testdaten und Ranking-Objekt - def tearDown(self): Lösche Testdatei - def testRank(self): Prüfe, ob Rang richtig berechnet wird - def testSave(self): Pruefe, ob all...
6acc4cc3ca1a7ed8143f5533a956d11fc3a76dff
<|skeleton|> class TestRanking1: """Funktionstests""" def setUp(self): """Erzeuge Testdaten und Ranking-Objekt""" <|body_0|> def tearDown(self): """Lösche Testdatei""" <|body_1|> def testRank(self): """Prüfe, ob Rang richtig berechnet wird""" <|body_2|>...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestRanking1: """Funktionstests""" def setUp(self): """Erzeuge Testdaten und Ranking-Objekt""" self.words = ['Titan', 'Jupiter', 'Titan', 'Titan', 'Huygens', 'Jupiter'] self.r = ranking.Ranking('not_existing.txt') for w in self.words: self.r.add(w) self...
the_stack_v2_python_sparse
book/kap_25/wort_des_jahres/rankingtest_fortgeschritten.py
Nachtalb/python_book_exercises
train
0
683aa450de08efbc5807f226a4e7b562771af962
[ "super(LazyProperty, self).__init__()\nself.dependency = depends_on\nself.handlers = WeakKeyDictionary()\nif trait is not None:\n self.default_value_type = trait.default_value_type", "cache_name = '_%s_lazy_property_cache' % name\ndct = obj.__dict__\nif cache_name not in dct:\n method_name = '_get_%s' % nam...
<|body_start_0|> super(LazyProperty, self).__init__() self.dependency = depends_on self.handlers = WeakKeyDictionary() if trait is not None: self.default_value_type = trait.default_value_type <|end_body_0|> <|body_start_1|> cache_name = '_%s_lazy_property_cache' % na...
A trait which behaves like a read-only cached property, but which lazily defers binding the dependency notifiers until the first time the value is retrieved. It is used to avoid situations where a property dependency in prematurely evaluated during component instantiation.
LazyProperty
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LazyProperty: """A trait which behaves like a read-only cached property, but which lazily defers binding the dependency notifiers until the first time the value is retrieved. It is used to avoid situations where a property dependency in prematurely evaluated during component instantiation.""" ...
stack_v2_sparse_classes_36k_train_020617
20,546
permissive
[ { "docstring": "Initialize a LazyProperty. Parameters ---------- trait : TraitType, optional An optional trait type for the values returned by the property. List is required if using extending trait name syntax for e.g. list listeners. depends_on : string, optional The traits notification string for the depende...
3
null
Implement the Python class `LazyProperty` described below. Class description: A trait which behaves like a read-only cached property, but which lazily defers binding the dependency notifiers until the first time the value is retrieved. It is used to avoid situations where a property dependency in prematurely evaluated...
Implement the Python class `LazyProperty` described below. Class description: A trait which behaves like a read-only cached property, but which lazily defers binding the dependency notifiers until the first time the value is retrieved. It is used to avoid situations where a property dependency in prematurely evaluated...
96828b254ac9fdfa2e5b6b31eff93a4933cbc0aa
<|skeleton|> class LazyProperty: """A trait which behaves like a read-only cached property, but which lazily defers binding the dependency notifiers until the first time the value is retrieved. It is used to avoid situations where a property dependency in prematurely evaluated during component instantiation.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LazyProperty: """A trait which behaves like a read-only cached property, but which lazily defers binding the dependency notifiers until the first time the value is retrieved. It is used to avoid situations where a property dependency in prematurely evaluated during component instantiation.""" def __init_...
the_stack_v2_python_sparse
enaml/core/trait_types.py
agrawalprash/enaml
train
0
01429cf2f85a8c1b0b70cc09bc86cecabd6fb5c8
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "conte...
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
RPCApi are "private" rpc methods for an instance. This should only be available to trusted parties.
RPCApiServicer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RPCApiServicer: """RPCApi are "private" rpc methods for an instance. This should only be available to trusted parties.""" def Logs(self, request, context): """Get a list of all logs published/subscribed by this node""" <|body_0|> def Decide(self, request, context): ...
stack_v2_sparse_classes_36k_train_020618
12,917
no_license
[ { "docstring": "Get a list of all logs published/subscribed by this node", "name": "Logs", "signature": "def Logs(self, request, context)" }, { "docstring": "Decide on an output for key based on the configured decision method", "name": "Decide", "signature": "def Decide(self, request, co...
3
stack_v2_sparse_classes_30k_train_005427
Implement the Python class `RPCApiServicer` described below. Class description: RPCApi are "private" rpc methods for an instance. This should only be available to trusted parties. Method signatures and docstrings: - def Logs(self, request, context): Get a list of all logs published/subscribed by this node - def Decid...
Implement the Python class `RPCApiServicer` described below. Class description: RPCApi are "private" rpc methods for an instance. This should only be available to trusted parties. Method signatures and docstrings: - def Logs(self, request, context): Get a list of all logs published/subscribed by this node - def Decid...
9bf6f32ab9b28c49fdc12c6e7a847a2b6dc1aa00
<|skeleton|> class RPCApiServicer: """RPCApi are "private" rpc methods for an instance. This should only be available to trusted parties.""" def Logs(self, request, context): """Get a list of all logs published/subscribed by this node""" <|body_0|> def Decide(self, request, context): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RPCApiServicer: """RPCApi are "private" rpc methods for an instance. This should only be available to trusted parties.""" def Logs(self, request, context): """Get a list of all logs published/subscribed by this node""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_de...
the_stack_v2_python_sparse
packages/trustix-python/trustix_python/rpc/rpc_pb2_grpc.py
daotlresearch/trustix
train
0
7e967f9dee523d2cfea0f0eb6ec019c763ca8106
[ "self.current_frame_index = None\nself.packets_data = []\nself.remaining_packets = None", "full_frame = b''\nis_first_packet = self.current_frame_index is None\nif is_first_packet or p.frame_index > self.current_frame_index:\n if not is_first_packet and self.remaining_packets != 0:\n full_frame = b''\n ...
<|body_start_0|> self.current_frame_index = None self.packets_data = [] self.remaining_packets = None <|end_body_0|> <|body_start_1|> full_frame = b'' is_first_packet = self.current_frame_index is None if is_first_packet or p.frame_index > self.current_frame_index: ...
Definition of the class UdpPacketsHandler.
UdpPacketsHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UdpPacketsHandler: """Definition of the class UdpPacketsHandler.""" def __init__(self): """Constructor.""" <|body_0|> def process_packet(self, p: UdpPacket) -> Union[bytes, None]: """Processes a given packet. If all the packets were collected, returns the full fr...
stack_v2_sparse_classes_36k_train_020619
3,250
no_license
[ { "docstring": "Constructor.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Processes a given packet. If all the packets were collected, returns the full frame. Otherwise, returns None.", "name": "process_packet", "signature": "def process_packet(self, p: UdpP...
3
stack_v2_sparse_classes_30k_train_003281
Implement the Python class `UdpPacketsHandler` described below. Class description: Definition of the class UdpPacketsHandler. Method signatures and docstrings: - def __init__(self): Constructor. - def process_packet(self, p: UdpPacket) -> Union[bytes, None]: Processes a given packet. If all the packets were collected...
Implement the Python class `UdpPacketsHandler` described below. Class description: Definition of the class UdpPacketsHandler. Method signatures and docstrings: - def __init__(self): Constructor. - def process_packet(self, p: UdpPacket) -> Union[bytes, None]: Processes a given packet. If all the packets were collected...
d88933620286e655c39776e0a4e99de9d9067172
<|skeleton|> class UdpPacketsHandler: """Definition of the class UdpPacketsHandler.""" def __init__(self): """Constructor.""" <|body_0|> def process_packet(self, p: UdpPacket) -> Union[bytes, None]: """Processes a given packet. If all the packets were collected, returns the full fr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UdpPacketsHandler: """Definition of the class UdpPacketsHandler.""" def __init__(self): """Constructor.""" self.current_frame_index = None self.packets_data = [] self.remaining_packets = None def process_packet(self, p: UdpPacket) -> Union[bytes, None]: """Pro...
the_stack_v2_python_sparse
client/video/udp_packets_handler.py
HadarShahar/zoom
train
0
ee76899e0695cdb1d9025f72a320cd7b53625418
[ "self.queue_config = queue_config\nself.storage_obj = storage_obj\nif 'type' not in self.queue_config.keys():\n raise ValueError(f'Queue type not found. Please update creds.json with one of the following supported queue types.\\n{SUPPORTED_QUEUES}')\nself.queue_type = queue_config['type']\nassert self.queue_type...
<|body_start_0|> self.queue_config = queue_config self.storage_obj = storage_obj if 'type' not in self.queue_config.keys(): raise ValueError(f'Queue type not found. Please update creds.json with one of the following supported queue types.\n{SUPPORTED_QUEUES}') self.queue_type...
This class will be sent a queue config dictionary and determine which queue to use by the information contained in that config. Acceptable queue types: - sqs (AWS Simple Queuing Service) - rmq (Rabbit MQ Queuing Service) - local (locally run queuing service)
QueueLifecycleManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QueueLifecycleManager: """This class will be sent a queue config dictionary and determine which queue to use by the information contained in that config. Acceptable queue types: - sqs (AWS Simple Queuing Service) - rmq (Rabbit MQ Queuing Service) - local (locally run queuing service)""" def ...
stack_v2_sparse_classes_36k_train_020620
3,444
no_license
[ { "docstring": "The constructor will take in the queue and storage config files and validate them. :param queue_config: :param storage_obj:", "name": "__init__", "signature": "def __init__(self, queue_config, storage_obj=None)" }, { "docstring": "This function builds the queue object according t...
3
stack_v2_sparse_classes_30k_val_000192
Implement the Python class `QueueLifecycleManager` described below. Class description: This class will be sent a queue config dictionary and determine which queue to use by the information contained in that config. Acceptable queue types: - sqs (AWS Simple Queuing Service) - rmq (Rabbit MQ Queuing Service) - local (lo...
Implement the Python class `QueueLifecycleManager` described below. Class description: This class will be sent a queue config dictionary and determine which queue to use by the information contained in that config. Acceptable queue types: - sqs (AWS Simple Queuing Service) - rmq (Rabbit MQ Queuing Service) - local (lo...
f21a89a011256047814e12ffc370c41a3346a3d7
<|skeleton|> class QueueLifecycleManager: """This class will be sent a queue config dictionary and determine which queue to use by the information contained in that config. Acceptable queue types: - sqs (AWS Simple Queuing Service) - rmq (Rabbit MQ Queuing Service) - local (locally run queuing service)""" def ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QueueLifecycleManager: """This class will be sent a queue config dictionary and determine which queue to use by the information contained in that config. Acceptable queue types: - sqs (AWS Simple Queuing Service) - rmq (Rabbit MQ Queuing Service) - local (locally run queuing service)""" def __init__(self...
the_stack_v2_python_sparse
queuingservices/managers/queue_lifecycle_manager.py
aj132608/CloudRunner
train
0
238cef92c07aa1d5c8b7d6049c3d117346c8c5b5
[ "super(Client, self).__init__()\nself.Unexport(['Alias'])\ntype(self).Chaddr.Set(self, chaddr)\nself.IPv4AddressList = {'1': ClientIPv4Address(ip=ipaddr, expiry=expiry)}\nself.next_ipv4 = 2\nself.OptionList = {}\nif clientid:\n self.OptionList['1'] = ClientOption(tag=CL, value=clientid)\nif hostname:\n self.O...
<|body_start_0|> super(Client, self).__init__() self.Unexport(['Alias']) type(self).Chaddr.Set(self, chaddr) self.IPv4AddressList = {'1': ClientIPv4Address(ip=ipaddr, expiry=expiry)} self.next_ipv4 = 2 self.OptionList = {} if clientid: self.OptionList[...
tr-181 Device.DHCPv4.Server.{i}.Client.{i}.
Client
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Client: """tr-181 Device.DHCPv4.Server.{i}.Client.{i}.""" def __init__(self, chaddr, ipaddr, expiry=0, clientid=None, hostname=None, userclassid=None, vendorclassid=None): """tr-181 Device.DHCPv4.Server.{i}.Client.{i}. Args: chaddr: a MAC address. ipaddr: a dotted-quad IP address. ex...
stack_v2_sparse_classes_36k_train_020621
4,090
permissive
[ { "docstring": "tr-181 Device.DHCPv4.Server.{i}.Client.{i}. Args: chaddr: a MAC address. ipaddr: a dotted-quad IP address. expiry: an integer number of seconds since the epoch UTC when the lease will expire, OR a string timestamp, OR a datetime object. clientid: DHCP ClientID from the client, if any. hostname: ...
2
null
Implement the Python class `Client` described below. Class description: tr-181 Device.DHCPv4.Server.{i}.Client.{i}. Method signatures and docstrings: - def __init__(self, chaddr, ipaddr, expiry=0, clientid=None, hostname=None, userclassid=None, vendorclassid=None): tr-181 Device.DHCPv4.Server.{i}.Client.{i}. Args: ch...
Implement the Python class `Client` described below. Class description: tr-181 Device.DHCPv4.Server.{i}.Client.{i}. Method signatures and docstrings: - def __init__(self, chaddr, ipaddr, expiry=0, clientid=None, hostname=None, userclassid=None, vendorclassid=None): tr-181 Device.DHCPv4.Server.{i}.Client.{i}. Args: ch...
b01e4444f3c7f12b1af7837203b37060fd443bb7
<|skeleton|> class Client: """tr-181 Device.DHCPv4.Server.{i}.Client.{i}.""" def __init__(self, chaddr, ipaddr, expiry=0, clientid=None, hostname=None, userclassid=None, vendorclassid=None): """tr-181 Device.DHCPv4.Server.{i}.Client.{i}. Args: chaddr: a MAC address. ipaddr: a dotted-quad IP address. ex...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Client: """tr-181 Device.DHCPv4.Server.{i}.Client.{i}.""" def __init__(self, chaddr, ipaddr, expiry=0, clientid=None, hostname=None, userclassid=None, vendorclassid=None): """tr-181 Device.DHCPv4.Server.{i}.Client.{i}. Args: chaddr: a MAC address. ipaddr: a dotted-quad IP address. expiry: an inte...
the_stack_v2_python_sparse
dm/dhcp.py
pombredanne/catawampus-1
train
0
4d447a9fb6e1ece148aefc5449b2b8de8bb3dee8
[ "cls._check_subclass()\ncls._check_col_names(train_data, is_train=True)\ncls.user_unique_vals = np.sort(train_data['user'].unique())\ncls.item_unique_vals = np.sort(train_data['item'].unique())\nif shuffle:\n train_data = cls.shuffle_data(train_data, seed)\ntrain_transformed, user_indices, item_indices = _build_...
<|body_start_0|> cls._check_subclass() cls._check_col_names(train_data, is_train=True) cls.user_unique_vals = np.sort(train_data['user'].unique()) cls.item_unique_vals = np.sort(train_data['item'].unique()) if shuffle: train_data = cls.shuffle_data(train_data, seed) ...
Dataset class used for building pure collaborative filtering data. Examples -------- >>> from libreco.data import DatasetPure >>> train_data, data_info = DatasetPure.build_trainset(train_data) >>> eval_data = DatasetPure.build_evalset(eval_data) >>> test_data = DatasetPure.build_testset(test_data)
DatasetPure
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DatasetPure: """Dataset class used for building pure collaborative filtering data. Examples -------- >>> from libreco.data import DatasetPure >>> train_data, data_info = DatasetPure.build_trainset(train_data) >>> eval_data = DatasetPure.build_evalset(eval_data) >>> test_data = DatasetPure.build_t...
stack_v2_sparse_classes_36k_train_020622
27,116
permissive
[ { "docstring": "Build transformed train data and data_info from original data. .. versionchanged:: 1.0.0 Data construction in :ref:`Model Retrain <retrain_data>` has been moved to :meth:`merge_trainset` Parameters ---------- train_data : pandas.DataFrame Data must contain at least three columns, i.e. ``user``, ...
2
null
Implement the Python class `DatasetPure` described below. Class description: Dataset class used for building pure collaborative filtering data. Examples -------- >>> from libreco.data import DatasetPure >>> train_data, data_info = DatasetPure.build_trainset(train_data) >>> eval_data = DatasetPure.build_evalset(eval_da...
Implement the Python class `DatasetPure` described below. Class description: Dataset class used for building pure collaborative filtering data. Examples -------- >>> from libreco.data import DatasetPure >>> train_data, data_info = DatasetPure.build_trainset(train_data) >>> eval_data = DatasetPure.build_evalset(eval_da...
8d5fbe9c177f5b91c2b6f19a155a83320dd0e20c
<|skeleton|> class DatasetPure: """Dataset class used for building pure collaborative filtering data. Examples -------- >>> from libreco.data import DatasetPure >>> train_data, data_info = DatasetPure.build_trainset(train_data) >>> eval_data = DatasetPure.build_evalset(eval_data) >>> test_data = DatasetPure.build_t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DatasetPure: """Dataset class used for building pure collaborative filtering data. Examples -------- >>> from libreco.data import DatasetPure >>> train_data, data_info = DatasetPure.build_trainset(train_data) >>> eval_data = DatasetPure.build_evalset(eval_data) >>> test_data = DatasetPure.build_testset(test_d...
the_stack_v2_python_sparse
libreco/data/dataset.py
massquantity/LibRecommender
train
251
5a1f619715fe8aa4dbed410b83d63e008bb246ad
[ "for i in range(n):\n nums1[m + i] = nums2[i]\nnums1.sort()", "if n == 0:\n return None\nfor i in range(n):\n nums1[m + i] = nums2[i]\n for j in range(m + i, 0, -1):\n if nums1[j] < nums1[j - 1]:\n nums1[j], nums1[j - 1] = (nums1[j - 1], nums1[j])\n else:\n break" ]
<|body_start_0|> for i in range(n): nums1[m + i] = nums2[i] nums1.sort() <|end_body_0|> <|body_start_1|> if n == 0: return None for i in range(n): nums1[m + i] = nums2[i] for j in range(m + i, 0, -1): if nums1[j] < nums1[j ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def merge(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None: """Do not return anything, modify nums1 in-place instead.""" <|body_0|> def merge2(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None: """双指针(插入排序思想)。 首先选择 nums2 第 1...
stack_v2_sparse_classes_36k_train_020623
5,205
no_license
[ { "docstring": "Do not return anything, modify nums1 in-place instead.", "name": "merge", "signature": "def merge(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None" }, { "docstring": "双指针(插入排序思想)。 首先选择 nums2 第 1 个元素,将其插入到 nums1 中正确的位置; 然后再从 nums2 选择第 2 位元素,沿着 nums1 中上次插入的位置,向右寻找合...
2
stack_v2_sparse_classes_30k_train_017395
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def merge(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None: Do not return anything, modify nums1 in-place instead. - def merge2(self, nums1: List[int], m: int, n...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def merge(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None: Do not return anything, modify nums1 in-place instead. - def merge2(self, nums1: List[int], m: int, n...
6932d69353b94ec824dd0ddc86a92453f6673232
<|skeleton|> class Solution: def merge(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None: """Do not return anything, modify nums1 in-place instead.""" <|body_0|> def merge2(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None: """双指针(插入排序思想)。 首先选择 nums2 第 1...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def merge(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None: """Do not return anything, modify nums1 in-place instead.""" for i in range(n): nums1[m + i] = nums2[i] nums1.sort() def merge2(self, nums1: List[int], m: int, nums2: List[int], n: i...
the_stack_v2_python_sparse
0088_merge-sorted-array.py
Nigirimeshi/leetcode
train
0
d3a6ce2f3d97d3e76d4d5f12bdc327f5fcac3f6f
[ "metrics = set(metrics)\npersist_metrics = set()\nwith self.get_cursor() as cursor:\n cursor.execute(self.GET_STAGE_METRICS_SQL, (stage,))\n for id, metric in cursor.fetchall():\n persist_metrics.add(metric)\n creates = [(stage, m) for m in metrics.difference(persist_metrics)]\n cursor.executeman...
<|body_start_0|> metrics = set(metrics) persist_metrics = set() with self.get_cursor() as cursor: cursor.execute(self.GET_STAGE_METRICS_SQL, (stage,)) for id, metric in cursor.fetchall(): persist_metrics.add(metric) creates = [(stage, m) for m ...
MetricHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MetricHandler: def declare(self, stage, metrics): """Get/Create metrics""" <|body_0|> def add_data(self, values): """Add a specified value for a specified metric id.""" <|body_1|> def get_data(self, metric_id, start, end): """Get the metric times...
stack_v2_sparse_classes_36k_train_020624
6,662
no_license
[ { "docstring": "Get/Create metrics", "name": "declare", "signature": "def declare(self, stage, metrics)" }, { "docstring": "Add a specified value for a specified metric id.", "name": "add_data", "signature": "def add_data(self, values)" }, { "docstring": "Get the metric timeserie...
5
stack_v2_sparse_classes_30k_train_007550
Implement the Python class `MetricHandler` described below. Class description: Implement the MetricHandler class. Method signatures and docstrings: - def declare(self, stage, metrics): Get/Create metrics - def add_data(self, values): Add a specified value for a specified metric id. - def get_data(self, metric_id, sta...
Implement the Python class `MetricHandler` described below. Class description: Implement the MetricHandler class. Method signatures and docstrings: - def declare(self, stage, metrics): Get/Create metrics - def add_data(self, values): Add a specified value for a specified metric id. - def get_data(self, metric_id, sta...
02e482e00b8d6c09bdbd6cb1f99ce8f2617e47cd
<|skeleton|> class MetricHandler: def declare(self, stage, metrics): """Get/Create metrics""" <|body_0|> def add_data(self, values): """Add a specified value for a specified metric id.""" <|body_1|> def get_data(self, metric_id, start, end): """Get the metric times...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MetricHandler: def declare(self, stage, metrics): """Get/Create metrics""" metrics = set(metrics) persist_metrics = set() with self.get_cursor() as cursor: cursor.execute(self.GET_STAGE_METRICS_SQL, (stage,)) for id, metric in cursor.fetchall(): ...
the_stack_v2_python_sparse
unshadow/server/metric.py
iakinsey/unshadow
train
1
ac3406a3f310aa7b6b23bc100254bf586e6f2fdd
[ "self.__logger = State().getLogger('Preprocessing_Component_Logger')\nself.__logger.info('Starting __init__()', 'AdaptiveThresholdBinarizationPreprocessor:__init__')\nself.__maxValue = maxValue\nself.__adaptiveMethode = adaptiveMethode\nself.__thresholdType = thresholdType\nself.__blockSize = blockSize\nself.__C = ...
<|body_start_0|> self.__logger = State().getLogger('Preprocessing_Component_Logger') self.__logger.info('Starting __init__()', 'AdaptiveThresholdBinarizationPreprocessor:__init__') self.__maxValue = maxValue self.__adaptiveMethode = adaptiveMethode self.__thresholdType = threshol...
AdaptiveThresholdBinarizationPreprocessor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdaptiveThresholdBinarizationPreprocessor: def __init__(self, maxValue, adaptiveMethode, thresholdType, blockSize, C, showImagesInWindow=False): """To-Do: Bitte Kommentar bzw. Dokumentaion erstellen!""" <|body_0|> def preProcess(self, mat): """Führt die adaptive thre...
stack_v2_sparse_classes_36k_train_020625
2,935
no_license
[ { "docstring": "To-Do: Bitte Kommentar bzw. Dokumentaion erstellen!", "name": "__init__", "signature": "def __init__(self, maxValue, adaptiveMethode, thresholdType, blockSize, C, showImagesInWindow=False)" }, { "docstring": "Führt die adaptive threshold binarization auf eine Bildmatrix aus. Para...
2
stack_v2_sparse_classes_30k_train_017676
Implement the Python class `AdaptiveThresholdBinarizationPreprocessor` described below. Class description: Implement the AdaptiveThresholdBinarizationPreprocessor class. Method signatures and docstrings: - def __init__(self, maxValue, adaptiveMethode, thresholdType, blockSize, C, showImagesInWindow=False): To-Do: Bit...
Implement the Python class `AdaptiveThresholdBinarizationPreprocessor` described below. Class description: Implement the AdaptiveThresholdBinarizationPreprocessor class. Method signatures and docstrings: - def __init__(self, maxValue, adaptiveMethode, thresholdType, blockSize, C, showImagesInWindow=False): To-Do: Bit...
3daaa72b193ebfb55894b47b6a752cdc2192bb6b
<|skeleton|> class AdaptiveThresholdBinarizationPreprocessor: def __init__(self, maxValue, adaptiveMethode, thresholdType, blockSize, C, showImagesInWindow=False): """To-Do: Bitte Kommentar bzw. Dokumentaion erstellen!""" <|body_0|> def preProcess(self, mat): """Führt die adaptive thre...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AdaptiveThresholdBinarizationPreprocessor: def __init__(self, maxValue, adaptiveMethode, thresholdType, blockSize, C, showImagesInWindow=False): """To-Do: Bitte Kommentar bzw. Dokumentaion erstellen!""" self.__logger = State().getLogger('Preprocessing_Component_Logger') self.__logger.i...
the_stack_v2_python_sparse
SheetMusicScanner/Preprocessing_Component/PreprocessingUnit/AdaptiveThresholdBinarizationPreProcessor.py
jadeskon/score-scan
train
0
bc79fa3ea8a668440f2fbd14fcb2021915be62de
[ "self.passages_extract = no_passages_to_extract\nself.outline_file = outline_file\nself.paragraph_file = paragraph_file\nself.pages = self.gather_pages()\nself.stop_words = stopwords.words('english')", "with open(self.outline_file, 'rb') as f:\n pages = [p for p in itertools.islice(iter_annotations(f), 0, 1000...
<|body_start_0|> self.passages_extract = no_passages_to_extract self.outline_file = outline_file self.paragraph_file = paragraph_file self.pages = self.gather_pages() self.stop_words = stopwords.words('english') <|end_body_0|> <|body_start_1|> with open(self.outline_file...
PartialRanking
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PartialRanking: def __init__(self, outline_file, paragraph_file, no_passages_to_extract): """Constructor :param outline_file: path of the outline file :param paragraph_file: path of the paragraph file""" <|body_0|> def gather_pages(self): """Gets the pages from cbor ...
stack_v2_sparse_classes_36k_train_020626
3,433
no_license
[ { "docstring": "Constructor :param outline_file: path of the outline file :param paragraph_file: path of the paragraph file", "name": "__init__", "signature": "def __init__(self, outline_file, paragraph_file, no_passages_to_extract)" }, { "docstring": "Gets the pages from cbor :return: list of p...
5
stack_v2_sparse_classes_30k_train_011883
Implement the Python class `PartialRanking` described below. Class description: Implement the PartialRanking class. Method signatures and docstrings: - def __init__(self, outline_file, paragraph_file, no_passages_to_extract): Constructor :param outline_file: path of the outline file :param paragraph_file: path of the...
Implement the Python class `PartialRanking` described below. Class description: Implement the PartialRanking class. Method signatures and docstrings: - def __init__(self, outline_file, paragraph_file, no_passages_to_extract): Constructor :param outline_file: path of the outline file :param paragraph_file: path of the...
009707f9f0df81bc4b2163a474aae4244fbd3f77
<|skeleton|> class PartialRanking: def __init__(self, outline_file, paragraph_file, no_passages_to_extract): """Constructor :param outline_file: path of the outline file :param paragraph_file: path of the paragraph file""" <|body_0|> def gather_pages(self): """Gets the pages from cbor ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PartialRanking: def __init__(self, outline_file, paragraph_file, no_passages_to_extract): """Constructor :param outline_file: path of the outline file :param paragraph_file: path of the paragraph file""" self.passages_extract = no_passages_to_extract self.outline_file = outline_file ...
the_stack_v2_python_sparse
tc_modified_ranking_7million.py
shilpadhagat/TREC-complex-answer-retrieval
train
4
e53fa32c6f7514d55befe19faf7765d0c2746ca9
[ "first, last = (0, len(nums) - 1)\nwhile first < last:\n if nums[first] % 2 == 1:\n first += 1\n continue\n if nums[last] % 2 == 0:\n last -= 1\n continue\n nums[first], nums[last] = (nums[last], nums[first])\nreturn nums", "low = fast = 0\nwhile fast < len(nums):\n if nums...
<|body_start_0|> first, last = (0, len(nums) - 1) while first < last: if nums[first] % 2 == 1: first += 1 continue if nums[last] % 2 == 0: last -= 1 continue nums[first], nums[last] = (nums[last], nums[fi...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def exchange(self, nums: List[int]) -> List[int]: """前后双指针法 first指向第一个,last指向最后一个,两个指针向中间靠拢 时间复杂度:O(n) 空间复杂度:O(1)""" <|body_0|> def exchange_2(self, nums: List[int]) -> List[int]: """快慢双指针法 low与fast同时从首位移动,fast 的作用是向前搜索奇数位置,low 的作用是指向下一个奇数应当存放的位置 时间复杂度:O(n)...
stack_v2_sparse_classes_36k_train_020627
2,049
no_license
[ { "docstring": "前后双指针法 first指向第一个,last指向最后一个,两个指针向中间靠拢 时间复杂度:O(n) 空间复杂度:O(1)", "name": "exchange", "signature": "def exchange(self, nums: List[int]) -> List[int]" }, { "docstring": "快慢双指针法 low与fast同时从首位移动,fast 的作用是向前搜索奇数位置,low 的作用是指向下一个奇数应当存放的位置 时间复杂度:O(n) 空间复杂度:O(1)", "name": "exchange_2", ...
2
stack_v2_sparse_classes_30k_train_017470
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def exchange(self, nums: List[int]) -> List[int]: 前后双指针法 first指向第一个,last指向最后一个,两个指针向中间靠拢 时间复杂度:O(n) 空间复杂度:O(1) - def exchange_2(self, nums: List[int]) -> List[int]: 快慢双指针法 low与fa...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def exchange(self, nums: List[int]) -> List[int]: 前后双指针法 first指向第一个,last指向最后一个,两个指针向中间靠拢 时间复杂度:O(n) 空间复杂度:O(1) - def exchange_2(self, nums: List[int]) -> List[int]: 快慢双指针法 low与fa...
c92a5ddcc56e3f69be1e6fb25e9c8ed277e57ee0
<|skeleton|> class Solution: def exchange(self, nums: List[int]) -> List[int]: """前后双指针法 first指向第一个,last指向最后一个,两个指针向中间靠拢 时间复杂度:O(n) 空间复杂度:O(1)""" <|body_0|> def exchange_2(self, nums: List[int]) -> List[int]: """快慢双指针法 low与fast同时从首位移动,fast 的作用是向前搜索奇数位置,low 的作用是指向下一个奇数应当存放的位置 时间复杂度:O(n)...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def exchange(self, nums: List[int]) -> List[int]: """前后双指针法 first指向第一个,last指向最后一个,两个指针向中间靠拢 时间复杂度:O(n) 空间复杂度:O(1)""" first, last = (0, len(nums) - 1) while first < last: if nums[first] % 2 == 1: first += 1 continue if nu...
the_stack_v2_python_sparse
SwordOffer/SwordOffer_21.py
EachenKuang/LeetCode
train
28
f275cb47faca3b046385f94c356da4ad879ec7ac
[ "self.main_window = QtGui.QWidget()\nself.gui = Ui_StopwatchGui()\nself.gui.setupUi(self.main_window)\nself.gui.start_stop_button.clicked.connect(self.start_stop)\nself.stop_event = Event()\nself.stop_event.set()\nself.main_window.show()", "if self.stop_event.is_set():\n self.stop_event.clear()\n self.timer...
<|body_start_0|> self.main_window = QtGui.QWidget() self.gui = Ui_StopwatchGui() self.gui.setupUi(self.main_window) self.gui.start_stop_button.clicked.connect(self.start_stop) self.stop_event = Event() self.stop_event.set() self.main_window.show() <|end_body_0|> ...
Application class to instantiate and control a StopwatchGui.
StopwatchApp
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StopwatchApp: """Application class to instantiate and control a StopwatchGui.""" def __init__(self): """Initialize and show the gui.""" <|body_0|> def start_stop(self): """Start the stopwatch if it is not running; stop it if it is running.""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_020628
2,727
no_license
[ { "docstring": "Initialize and show the gui.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Start the stopwatch if it is not running; stop it if it is running.", "name": "start_stop", "signature": "def start_stop(self)" }, { "docstring": "Runs a stopwa...
3
stack_v2_sparse_classes_30k_train_001539
Implement the Python class `StopwatchApp` described below. Class description: Application class to instantiate and control a StopwatchGui. Method signatures and docstrings: - def __init__(self): Initialize and show the gui. - def start_stop(self): Start the stopwatch if it is not running; stop it if it is running. - ...
Implement the Python class `StopwatchApp` described below. Class description: Application class to instantiate and control a StopwatchGui. Method signatures and docstrings: - def __init__(self): Initialize and show the gui. - def start_stop(self): Start the stopwatch if it is not running; stop it if it is running. - ...
e1ad9c8f3e09aec3ee72821bd8374c957f047589
<|skeleton|> class StopwatchApp: """Application class to instantiate and control a StopwatchGui.""" def __init__(self): """Initialize and show the gui.""" <|body_0|> def start_stop(self): """Start the stopwatch if it is not running; stop it if it is running.""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StopwatchApp: """Application class to instantiate and control a StopwatchGui.""" def __init__(self): """Initialize and show the gui.""" self.main_window = QtGui.QWidget() self.gui = Ui_StopwatchGui() self.gui.setupUi(self.main_window) self.gui.start_stop_button.cli...
the_stack_v2_python_sparse
DailyLabs/Lsn35/StopwatchApp.py
NathanRuprecht/CS210_IntroToProgramming
train
0
3c8ca1d1107be824d97e590133b8f1d13d75c0a9
[ "i, j = (0, 0)\nwhile nums[i] != val:\n i += 1\n j += 1\nwhile j != len(nums):\n print(i, j)\n while nums[j] == val:\n j += 1\n if j == len(nums):\n return i\n nums[i] = nums[j]\n i += 1\n j += 1\nreturn i", "i = 0\nj = len(nums) - 1\nwhile i <= j:\n if nums[i] == ...
<|body_start_0|> i, j = (0, 0) while nums[i] != val: i += 1 j += 1 while j != len(nums): print(i, j) while nums[j] == val: j += 1 if j == len(nums): return i nums[i] = nums[j] ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def removeElement1(self, nums, val): """:type nums: List[int] :type val: int :rtype: int""" <|body_0|> def removeElement2(self, nums, val): """:type nums: List[int] :type val: int :rtype: int""" <|body_1|> def removeElement3(self, nums, val): ...
stack_v2_sparse_classes_36k_train_020629
3,223
no_license
[ { "docstring": ":type nums: List[int] :type val: int :rtype: int", "name": "removeElement1", "signature": "def removeElement1(self, nums, val)" }, { "docstring": ":type nums: List[int] :type val: int :rtype: int", "name": "removeElement2", "signature": "def removeElement2(self, nums, val...
3
stack_v2_sparse_classes_30k_train_017204
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeElement1(self, nums, val): :type nums: List[int] :type val: int :rtype: int - def removeElement2(self, nums, val): :type nums: List[int] :type val: int :rtype: int - de...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeElement1(self, nums, val): :type nums: List[int] :type val: int :rtype: int - def removeElement2(self, nums, val): :type nums: List[int] :type val: int :rtype: int - de...
416fed6e441612e1ad82467d07ee1b5570386a94
<|skeleton|> class Solution: def removeElement1(self, nums, val): """:type nums: List[int] :type val: int :rtype: int""" <|body_0|> def removeElement2(self, nums, val): """:type nums: List[int] :type val: int :rtype: int""" <|body_1|> def removeElement3(self, nums, val): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def removeElement1(self, nums, val): """:type nums: List[int] :type val: int :rtype: int""" i, j = (0, 0) while nums[i] != val: i += 1 j += 1 while j != len(nums): print(i, j) while nums[j] == val: j += 1...
the_stack_v2_python_sparse
src/python/remove_element.py
liadbiz/Leetcode-Solutions
train
1
a601a5abae3309dc3df0559f4a6781dc766bbf5f
[ "res = requests.post(url=self.url, headers=self.headers, json=self.data)\nself.assertEquals(res.status_code, 200)\nself.assertEqual(res.json().get('user_info').get('id'), 378392)\nself.assertEqual(res.json().get('user_info').get('nickname'), '陈柏霖')", "data = self.data.copy()\ndata['identity'] = ''\nres = requests...
<|body_start_0|> res = requests.post(url=self.url, headers=self.headers, json=self.data) self.assertEquals(res.status_code, 200) self.assertEqual(res.json().get('user_info').get('id'), 378392) self.assertEqual(res.json().get('user_info').get('nickname'), '陈柏霖') <|end_body_0|> <|body_sta...
wood登录接口
Login
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Login: """wood登录接口""" def test_01_wood_login01(self): """正常登录-账号密码正确""" <|body_0|> def test_02_wood_login02(self): """异常登录-账号/密码为空""" <|body_1|> def test_03_wood_login03(self): """异常登录-账号/密码错误""" <|body_2|> <|end_skeleton|> <|body_s...
stack_v2_sparse_classes_36k_train_020630
1,706
no_license
[ { "docstring": "正常登录-账号密码正确", "name": "test_01_wood_login01", "signature": "def test_01_wood_login01(self)" }, { "docstring": "异常登录-账号/密码为空", "name": "test_02_wood_login02", "signature": "def test_02_wood_login02(self)" }, { "docstring": "异常登录-账号/密码错误", "name": "test_03_wood_...
3
stack_v2_sparse_classes_30k_train_017385
Implement the Python class `Login` described below. Class description: wood登录接口 Method signatures and docstrings: - def test_01_wood_login01(self): 正常登录-账号密码正确 - def test_02_wood_login02(self): 异常登录-账号/密码为空 - def test_03_wood_login03(self): 异常登录-账号/密码错误
Implement the Python class `Login` described below. Class description: wood登录接口 Method signatures and docstrings: - def test_01_wood_login01(self): 正常登录-账号密码正确 - def test_02_wood_login02(self): 异常登录-账号/密码为空 - def test_03_wood_login03(self): 异常登录-账号/密码错误 <|skeleton|> class Login: """wood登录接口""" def test_01_w...
e75039fcd2361977a2a5dc7ea95b7fb2fbc96bb0
<|skeleton|> class Login: """wood登录接口""" def test_01_wood_login01(self): """正常登录-账号密码正确""" <|body_0|> def test_02_wood_login02(self): """异常登录-账号/密码为空""" <|body_1|> def test_03_wood_login03(self): """异常登录-账号/密码错误""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Login: """wood登录接口""" def test_01_wood_login01(self): """正常登录-账号密码正确""" res = requests.post(url=self.url, headers=self.headers, json=self.data) self.assertEquals(res.status_code, 200) self.assertEqual(res.json().get('user_info').get('id'), 378392) self.assertEqual(...
the_stack_v2_python_sparse
API_study/Wood/A_Login.py
JmeterChen/api_wood
train
1
5d9aaa0422098bfa6a3c9002460492d59000f002
[ "self.n = len(multipliers[0])\nassert binom(self.n, 2) == len(multipliers[1]), 'Wrong number of couplings.'\nassert binom(self.n, 3) == len(multipliers[2]), 'Wrong number of triplet interactions.'\nmultipliers = np.concatenate(multipliers)\nself.calc_e = define_triplet_helper_functions()[0]\ntry:\n ising = impor...
<|body_start_0|> self.n = len(multipliers[0]) assert binom(self.n, 2) == len(multipliers[1]), 'Wrong number of couplings.' assert binom(self.n, 3) == len(multipliers[2]), 'Wrong number of triplet interactions.' multipliers = np.concatenate(multipliers) self.calc_e = define_triple...
Third order maxent model constraining means, pairwise correlations, and triplet correlations.
Triplet
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Triplet: """Third order maxent model constraining means, pairwise correlations, and triplet correlations.""" def __init__(self, multipliers, rng=None, n_cpus=None, verbose=False): """Parameters ---------- multipliers : list of ndarray or ndarray Can be a list of vectors [fields, coup...
stack_v2_sparse_classes_36k_train_020631
12,395
permissive
[ { "docstring": "Parameters ---------- multipliers : list of ndarray or ndarray Can be a list of vectors [fields, couplings], a vector of fields and couplings concatenated together, or a matrix of parameters where the diagonal entries are the fields.", "name": "__init__", "signature": "def __init__(self,...
2
stack_v2_sparse_classes_30k_train_018444
Implement the Python class `Triplet` described below. Class description: Third order maxent model constraining means, pairwise correlations, and triplet correlations. Method signatures and docstrings: - def __init__(self, multipliers, rng=None, n_cpus=None, verbose=False): Parameters ---------- multipliers : list of ...
Implement the Python class `Triplet` described below. Class description: Third order maxent model constraining means, pairwise correlations, and triplet correlations. Method signatures and docstrings: - def __init__(self, multipliers, rng=None, n_cpus=None, verbose=False): Parameters ---------- multipliers : list of ...
f25863705f8e459771ef60ea51c4bd6587904c78
<|skeleton|> class Triplet: """Third order maxent model constraining means, pairwise correlations, and triplet correlations.""" def __init__(self, multipliers, rng=None, n_cpus=None, verbose=False): """Parameters ---------- multipliers : list of ndarray or ndarray Can be a list of vectors [fields, coup...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Triplet: """Third order maxent model constraining means, pairwise correlations, and triplet correlations.""" def __init__(self, multipliers, rng=None, n_cpus=None, verbose=False): """Parameters ---------- multipliers : list of ndarray or ndarray Can be a list of vectors [fields, couplings], a vec...
the_stack_v2_python_sparse
coniii/models.py
eltrompetero/coniii
train
18
27497175e67a23b396b5523e6ddffdfe17ca787a
[ "if isinstance(hypothesis, str):\n hypothesis = {hypothesis}\n references = {references}\nelse:\n hypothesis = set(hypothesis)\n references = set(references)\nassert len(hypothesis) == len(references), 'Hypothesis and reference lists must have the same length'\nscore = self.metric(test=hypothesis, refer...
<|body_start_0|> if isinstance(hypothesis, str): hypothesis = {hypothesis} references = {references} else: hypothesis = set(hypothesis) references = set(references) assert len(hypothesis) == len(references), 'Hypothesis and reference lists must hav...
NLTKScore template metric class
NLTKScore
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NLTKScore: """NLTKScore template metric class""" def __call__(self, hypothesis: Union[str, List[str]], references: Union[str, List[str]], **kwargs) -> float: """Compute NLTKScore score of a hypothesis and a reference. Params: hypothesis (str): a hypothesis sentence or a list of hypot...
stack_v2_sparse_classes_36k_train_020632
7,252
permissive
[ { "docstring": "Compute NLTKScore score of a hypothesis and a reference. Params: hypothesis (str): a hypothesis sentence or a list of hypothesis sentences reference (str): a reference sentence or a list of reference sentences kwargs: see complete list at: https://www.nltk.org/_modules/nltk/metrics/scores.html R...
2
stack_v2_sparse_classes_30k_train_021020
Implement the Python class `NLTKScore` described below. Class description: NLTKScore template metric class Method signatures and docstrings: - def __call__(self, hypothesis: Union[str, List[str]], references: Union[str, List[str]], **kwargs) -> float: Compute NLTKScore score of a hypothesis and a reference. Params: h...
Implement the Python class `NLTKScore` described below. Class description: NLTKScore template metric class Method signatures and docstrings: - def __call__(self, hypothesis: Union[str, List[str]], references: Union[str, List[str]], **kwargs) -> float: Compute NLTKScore score of a hypothesis and a reference. Params: h...
bef8033d9b9d7ea9797b5a0fdc7558d388bb0bfd
<|skeleton|> class NLTKScore: """NLTKScore template metric class""" def __call__(self, hypothesis: Union[str, List[str]], references: Union[str, List[str]], **kwargs) -> float: """Compute NLTKScore score of a hypothesis and a reference. Params: hypothesis (str): a hypothesis sentence or a list of hypot...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NLTKScore: """NLTKScore template metric class""" def __call__(self, hypothesis: Union[str, List[str]], references: Union[str, List[str]], **kwargs) -> float: """Compute NLTKScore score of a hypothesis and a reference. Params: hypothesis (str): a hypothesis sentence or a list of hypothesis sentenc...
the_stack_v2_python_sparse
platiagro/metrics_nlp/base.py
platiagro/sdk
train
1
6815c30386a904b0d1f9a12476307995e9fead0d
[ "self.ensure_one()\ndomain = [('product_id', '=', self.id), ('remaining_qty', '>', 0.0), ('location_dest_id', '=', location_id)] + self.env['stock.move']._get_in_base_domain()\ncandidates = self.env['stock.move'].search(domain, order='date, id')\nreturn candidates", "self.ensure_one()\ndomain = [('product_id', '=...
<|body_start_0|> self.ensure_one() domain = [('product_id', '=', self.id), ('remaining_qty', '>', 0.0), ('location_dest_id', '=', location_id)] + self.env['stock.move']._get_in_base_domain() candidates = self.env['stock.move'].search(domain, order='date, id') return candidates <|end_body...
ProductProduct
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProductProduct: def _get_fifo_candidates_in_move_location(self, location_id): """Buscar movimientos por ubicacion""" <|body_0|> def _get_fifo_candidates_in_move_location_lot(self, location_id, lot_id): """Buscar movimientos por ubicacion""" <|body_1|> <|end_...
stack_v2_sparse_classes_36k_train_020633
3,276
no_license
[ { "docstring": "Buscar movimientos por ubicacion", "name": "_get_fifo_candidates_in_move_location", "signature": "def _get_fifo_candidates_in_move_location(self, location_id)" }, { "docstring": "Buscar movimientos por ubicacion", "name": "_get_fifo_candidates_in_move_location_lot", "sign...
2
stack_v2_sparse_classes_30k_val_000166
Implement the Python class `ProductProduct` described below. Class description: Implement the ProductProduct class. Method signatures and docstrings: - def _get_fifo_candidates_in_move_location(self, location_id): Buscar movimientos por ubicacion - def _get_fifo_candidates_in_move_location_lot(self, location_id, lot_...
Implement the Python class `ProductProduct` described below. Class description: Implement the ProductProduct class. Method signatures and docstrings: - def _get_fifo_candidates_in_move_location(self, location_id): Buscar movimientos por ubicacion - def _get_fifo_candidates_in_move_location_lot(self, location_id, lot_...
6682e60630064641474ddb2d8cbc520e30f64832
<|skeleton|> class ProductProduct: def _get_fifo_candidates_in_move_location(self, location_id): """Buscar movimientos por ubicacion""" <|body_0|> def _get_fifo_candidates_in_move_location_lot(self, location_id, lot_id): """Buscar movimientos por ubicacion""" <|body_1|> <|end_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProductProduct: def _get_fifo_candidates_in_move_location(self, location_id): """Buscar movimientos por ubicacion""" self.ensure_one() domain = [('product_id', '=', self.id), ('remaining_qty', '>', 0.0), ('location_dest_id', '=', location_id)] + self.env['stock.move']._get_in_base_doma...
the_stack_v2_python_sparse
poi_purchase_imports/models/product.py
blue-connect/illuminati
train
0
fe668ccd05a105915ac46ec0fcab245e1c1ef886
[ "try:\n path = os.path.join(ROOT_DIR, '../tests/results.json')\n results = self.__get_mock_results(path)\nexcept Exception as ex:\n raise ex\nraise gen.Return(results)", "try:\n results = '{\"$oid\": \"59dc3e8c8f54a9000d1fb89f\"}'\n if not results:\n raise Exception('Failed to write results ...
<|body_start_0|> try: path = os.path.join(ROOT_DIR, '../tests/results.json') results = self.__get_mock_results(path) except Exception as ex: raise ex raise gen.Return(results) <|end_body_0|> <|body_start_1|> try: results = '{"$oid": "59dc3...
Provides a testing mock for the mongo results handler
TestResultsProvider
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestResultsProvider: """Provides a testing mock for the mongo results handler""" def get_results(self, result_id=None): """Method implements the results mock of mongo args: result_id: key to get data from results db Returns: data responding to the result_id""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_020634
3,775
no_license
[ { "docstring": "Method implements the results mock of mongo args: result_id: key to get data from results db Returns: data responding to the result_id", "name": "get_results", "signature": "def get_results(self, result_id=None)" }, { "docstring": "Method implements the write results mock of mong...
6
stack_v2_sparse_classes_30k_train_017222
Implement the Python class `TestResultsProvider` described below. Class description: Provides a testing mock for the mongo results handler Method signatures and docstrings: - def get_results(self, result_id=None): Method implements the results mock of mongo args: result_id: key to get data from results db Returns: da...
Implement the Python class `TestResultsProvider` described below. Class description: Provides a testing mock for the mongo results handler Method signatures and docstrings: - def get_results(self, result_id=None): Method implements the results mock of mongo args: result_id: key to get data from results db Returns: da...
7c3edfbb6c2708b96b8c8d61fe865dbb1357690e
<|skeleton|> class TestResultsProvider: """Provides a testing mock for the mongo results handler""" def get_results(self, result_id=None): """Method implements the results mock of mongo args: result_id: key to get data from results db Returns: data responding to the result_id""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestResultsProvider: """Provides a testing mock for the mongo results handler""" def get_results(self, result_id=None): """Method implements the results mock of mongo args: result_id: key to get data from results db Returns: data responding to the result_id""" try: path = os.p...
the_stack_v2_python_sparse
results/webapi/providers/test_results_provider.py
KamilBabayev/webapi_temp
train
0
f59c9bf73253544f8295c3f367fd0232caa4d9c0
[ "memory = []\n\ndef add_coor(a, b):\n ans = 0\n while a != 0:\n ans += a % 10\n a //= 10\n while b != 0:\n ans += b % 10\n b //= 10\n return ans\n\ndef __dfs(col, row):\n if col >= m or row >= n:\n return\n if [col, row] in memory:\n return\n if add_coo...
<|body_start_0|> memory = [] def add_coor(a, b): ans = 0 while a != 0: ans += a % 10 a //= 10 while b != 0: ans += b % 10 b //= 10 return ans def __dfs(col, row): if col ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def movingCount(self, m: int, n: int, k: int) -> int: """递归 巨慢无比""" <|body_0|> def movingCount1(self, m: int, n: int, k: int) -> int: """比递归快了十倍""" <|body_1|> <|end_skeleton|> <|body_start_0|> memory = [] def add_coor(a, b): ...
stack_v2_sparse_classes_36k_train_020635
2,545
no_license
[ { "docstring": "递归 巨慢无比", "name": "movingCount", "signature": "def movingCount(self, m: int, n: int, k: int) -> int" }, { "docstring": "比递归快了十倍", "name": "movingCount1", "signature": "def movingCount1(self, m: int, n: int, k: int) -> int" } ]
2
stack_v2_sparse_classes_30k_train_021087
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def movingCount(self, m: int, n: int, k: int) -> int: 递归 巨慢无比 - def movingCount1(self, m: int, n: int, k: int) -> int: 比递归快了十倍
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def movingCount(self, m: int, n: int, k: int) -> int: 递归 巨慢无比 - def movingCount1(self, m: int, n: int, k: int) -> int: 比递归快了十倍 <|skeleton|> class Solution: def movingCount(...
40726506802d2d60028fdce206696b1df2f63ece
<|skeleton|> class Solution: def movingCount(self, m: int, n: int, k: int) -> int: """递归 巨慢无比""" <|body_0|> def movingCount1(self, m: int, n: int, k: int) -> int: """比递归快了十倍""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def movingCount(self, m: int, n: int, k: int) -> int: """递归 巨慢无比""" memory = [] def add_coor(a, b): ans = 0 while a != 0: ans += a % 10 a //= 10 while b != 0: ans += b % 10 b ...
the_stack_v2_python_sparse
二刷+题解/每日一题/movingCount.py
1oser5/LeetCode
train
0
efee257ca15193f95673f1d5d97d2225691dedfb
[ "from django.contrib.auth.models import User\nu = User.objects.create(username='test', password='test')\nself.failUnless(u.get_profile())", "from django.contrib.auth.models import User\nr = self.client.post('/account/register/', {'first_name': 'Test', 'last_name': 'Example', 'username': 'test', 'email': 'test.use...
<|body_start_0|> from django.contrib.auth.models import User u = User.objects.create(username='test', password='test') self.failUnless(u.get_profile()) <|end_body_0|> <|body_start_1|> from django.contrib.auth.models import User r = self.client.post('/account/register/', {'first_...
UserTest
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserTest: def test_profile_created(self): """Tests that a new user gets a default profile""" <|body_0|> def test_profile_filled(self): """Test that registration profile values are populated in the Profile.""" <|body_1|> def test_first_last_name(self): ...
stack_v2_sparse_classes_36k_train_020636
2,523
permissive
[ { "docstring": "Tests that a new user gets a default profile", "name": "test_profile_created", "signature": "def test_profile_created(self)" }, { "docstring": "Test that registration profile values are populated in the Profile.", "name": "test_profile_filled", "signature": "def test_prof...
4
null
Implement the Python class `UserTest` described below. Class description: Implement the UserTest class. Method signatures and docstrings: - def test_profile_created(self): Tests that a new user gets a default profile - def test_profile_filled(self): Test that registration profile values are populated in the Profile. ...
Implement the Python class `UserTest` described below. Class description: Implement the UserTest class. Method signatures and docstrings: - def test_profile_created(self): Tests that a new user gets a default profile - def test_profile_filled(self): Test that registration profile values are populated in the Profile. ...
651da880a3d4295243205bdae4de88504edc91de
<|skeleton|> class UserTest: def test_profile_created(self): """Tests that a new user gets a default profile""" <|body_0|> def test_profile_filled(self): """Test that registration profile values are populated in the Profile.""" <|body_1|> def test_first_last_name(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserTest: def test_profile_created(self): """Tests that a new user gets a default profile""" from django.contrib.auth.models import User u = User.objects.create(username='test', password='test') self.failUnless(u.get_profile()) def test_profile_filled(self): """Tes...
the_stack_v2_python_sparse
communityprofiles/account/tests.py
216software/Profiles
train
3
2f8be3e29d5f38fee2c29cec8682943e6b6c626a
[ "try:\n query = self.request.dbsession.query(models.Service)\n one = query.filter(models.Service.name == name).first()\n if one:\n one.url = baseurl(url)\n one.type = kwargs.get('type', 'WPS')\n one.purl = kwargs.get('purl', '')\n one._verify = int(kwargs.get('verify', 1))\n ...
<|body_start_0|> try: query = self.request.dbsession.query(models.Service) one = query.filter(models.Service.name == name).first() if one: one.url = baseurl(url) one.type = kwargs.get('type', 'WPS') one.purl = kwargs.get('purl',...
Stores a services. It inserts or updates the service with a given name.
ServiceStore
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ServiceStore: """Stores a services. It inserts or updates the service with a given name.""" def save_service(self, name, url, *args, **kwargs): """Stores an OWS service in database (insert or update). :param name: A service name string. :param url: A URL string.""" <|body_0|>...
stack_v2_sparse_classes_36k_train_020637
3,805
permissive
[ { "docstring": "Stores an OWS service in database (insert or update). :param name: A service name string. :param url: A URL string.", "name": "save_service", "signature": "def save_service(self, name, url, *args, **kwargs)" }, { "docstring": "Removes service identified by name.", "name": "de...
6
stack_v2_sparse_classes_30k_train_000547
Implement the Python class `ServiceStore` described below. Class description: Stores a services. It inserts or updates the service with a given name. Method signatures and docstrings: - def save_service(self, name, url, *args, **kwargs): Stores an OWS service in database (insert or update). :param name: A service nam...
Implement the Python class `ServiceStore` described below. Class description: Stores a services. It inserts or updates the service with a given name. Method signatures and docstrings: - def save_service(self, name, url, *args, **kwargs): Stores an OWS service in database (insert or update). :param name: A service nam...
aca67f1fb7f9014ccb8718666b865287da7c61d5
<|skeleton|> class ServiceStore: """Stores a services. It inserts or updates the service with a given name.""" def save_service(self, name, url, *args, **kwargs): """Stores an OWS service in database (insert or update). :param name: A service name string. :param url: A URL string.""" <|body_0|>...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ServiceStore: """Stores a services. It inserts or updates the service with a given name.""" def save_service(self, name, url, *args, **kwargs): """Stores an OWS service in database (insert or update). :param name: A service name string. :param url: A URL string.""" try: query ...
the_stack_v2_python_sparse
twitcher/store.py
bird-house/twitcher
train
16
718a5b320ad44ab875739eaca61bdb58f48e1bdf
[ "super(SrcmapsCatalog_SG, self).__init__(link, **kwargs)\nself._comp_dict_file = None\nself._comp_dict = None", "for val in catalog_info_dict.values():\n val.roi_model.write_xml(val.srcmdl_name)\nfor val in comp_info_dict.values():\n for val2 in val.values():\n val2.roi_model.write_xml(val2.srcmdl_na...
<|body_start_0|> super(SrcmapsCatalog_SG, self).__init__(link, **kwargs) self._comp_dict_file = None self._comp_dict = None <|end_body_0|> <|body_start_1|> for val in catalog_info_dict.values(): val.roi_model.write_xml(val.srcmdl_name) for val in comp_info_dict.value...
Small class to generate configurations for gtsrcmaps for catalog sources
SrcmapsCatalog_SG
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SrcmapsCatalog_SG: """Small class to generate configurations for gtsrcmaps for catalog sources""" def __init__(self, link, **kwargs): """C'tor""" <|body_0|> def _make_xml_files(catalog_info_dict, comp_info_dict): """Make all the xml file for individual components...
stack_v2_sparse_classes_36k_train_020638
8,377
permissive
[ { "docstring": "C'tor", "name": "__init__", "signature": "def __init__(self, link, **kwargs)" }, { "docstring": "Make all the xml file for individual components", "name": "_make_xml_files", "signature": "def _make_xml_files(catalog_info_dict, comp_info_dict)" }, { "docstring": "H...
3
null
Implement the Python class `SrcmapsCatalog_SG` described below. Class description: Small class to generate configurations for gtsrcmaps for catalog sources Method signatures and docstrings: - def __init__(self, link, **kwargs): C'tor - def _make_xml_files(catalog_info_dict, comp_info_dict): Make all the xml file for ...
Implement the Python class `SrcmapsCatalog_SG` described below. Class description: Small class to generate configurations for gtsrcmaps for catalog sources Method signatures and docstrings: - def __init__(self, link, **kwargs): C'tor - def _make_xml_files(catalog_info_dict, comp_info_dict): Make all the xml file for ...
fbd4c95ffadbff31cbb9cc862ff84a78dc734ef5
<|skeleton|> class SrcmapsCatalog_SG: """Small class to generate configurations for gtsrcmaps for catalog sources""" def __init__(self, link, **kwargs): """C'tor""" <|body_0|> def _make_xml_files(catalog_info_dict, comp_info_dict): """Make all the xml file for individual components...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SrcmapsCatalog_SG: """Small class to generate configurations for gtsrcmaps for catalog sources""" def __init__(self, link, **kwargs): """C'tor""" super(SrcmapsCatalog_SG, self).__init__(link, **kwargs) self._comp_dict_file = None self._comp_dict = None def _make_xml_f...
the_stack_v2_python_sparse
fermipy/diffuse/gt_srcmaps_catalog.py
fermiPy/fermipy
train
51
595aadebe16a5805138498eadec06422403841a0
[ "if not (head and head.next):\n return head\nfirst = head.next\nsecond = head\nhead.next = None\nwhile first.next:\n p = first\n first = first.next\n p.next = second\n second = p\nfirst.next = second\nreturn first", "if not head or not head.next:\n return head\ntail = self.reverseList2(head.next...
<|body_start_0|> if not (head and head.next): return head first = head.next second = head head.next = None while first.next: p = first first = first.next p.next = second second = p first.next = second ret...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reverseList(self, head): """:type head: ListNode :rtype: ListNode 迭代思路: 两个指针 first(初始位置:head.next) second(初始位置:head) 迭代(循环)条件:first到达链表末尾 1. 设置中间指针:p.使得 p = first 2. first 前进到它next指针的位置 3. 调整p的next指针,将其指向second 4. second 指向 p. 返回值:first 边界情况1:头节点为空 或者 只有一个头节点 ---- 不满足,需单独处理...
stack_v2_sparse_classes_36k_train_020639
3,995
no_license
[ { "docstring": ":type head: ListNode :rtype: ListNode 迭代思路: 两个指针 first(初始位置:head.next) second(初始位置:head) 迭代(循环)条件:first到达链表末尾 1. 设置中间指针:p.使得 p = first 2. first 前进到它next指针的位置 3. 调整p的next指针,将其指向second 4. second 指向 p. 返回值:first 边界情况1:头节点为空 或者 只有一个头节点 ---- 不满足,需单独处理 易错点: 一定要记得把头节点的后继节点蛇者为空(None)否则会再链表中出现无限循环的环!", ...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseList(self, head): :type head: ListNode :rtype: ListNode 迭代思路: 两个指针 first(初始位置:head.next) second(初始位置:head) 迭代(循环)条件:first到达链表末尾 1. 设置中间指针:p.使得 p = first 2. first 前进到它n...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseList(self, head): :type head: ListNode :rtype: ListNode 迭代思路: 两个指针 first(初始位置:head.next) second(初始位置:head) 迭代(循环)条件:first到达链表末尾 1. 设置中间指针:p.使得 p = first 2. first 前进到它n...
ca88c13392e971b64fc1704351cfe654b905d586
<|skeleton|> class Solution: def reverseList(self, head): """:type head: ListNode :rtype: ListNode 迭代思路: 两个指针 first(初始位置:head.next) second(初始位置:head) 迭代(循环)条件:first到达链表末尾 1. 设置中间指针:p.使得 p = first 2. first 前进到它next指针的位置 3. 调整p的next指针,将其指向second 4. second 指向 p. 返回值:first 边界情况1:头节点为空 或者 只有一个头节点 ---- 不满足,需单独处理...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def reverseList(self, head): """:type head: ListNode :rtype: ListNode 迭代思路: 两个指针 first(初始位置:head.next) second(初始位置:head) 迭代(循环)条件:first到达链表末尾 1. 设置中间指针:p.使得 p = first 2. first 前进到它next指针的位置 3. 调整p的next指针,将其指向second 4. second 指向 p. 返回值:first 边界情况1:头节点为空 或者 只有一个头节点 ---- 不满足,需单独处理 易错点: 一定要记得把头节...
the_stack_v2_python_sparse
linkedList_Part/leetcode206.py
Jackie1995/leetcode_answers
train
0
0b6b9fe093eda8c6aa22e7ba4f8f9f0fac416e14
[ "self.cluster_id = cluster_id\nself.cluster_incarnation_id = cluster_incarnation_id\nself.document_ids = document_ids\nself.entity_id = entity_id\nself.job_id = job_id\nself.job_instance_ids = job_instance_ids\nself.tag_ids = tag_ids\nself.tags = tags", "if dictionary is None:\n return None\ncluster_id = dicti...
<|body_start_0|> self.cluster_id = cluster_id self.cluster_incarnation_id = cluster_incarnation_id self.document_ids = document_ids self.entity_id = entity_id self.job_id = job_id self.job_instance_ids = job_instance_ids self.tag_ids = tag_ids self.tags = ...
Implementation of the 'TagsOperationParameters' model. TODO: type description here. Attributes: cluster_id (long|int): ClusterId is the Id of the cluster used for constructing JobUid. cluster_incarnation_id (long|int): ClusterIncarnationId is the incarnation Id of the cluster used for constructing JobUid. document_ids ...
TagsOperationParameters
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TagsOperationParameters: """Implementation of the 'TagsOperationParameters' model. TODO: type description here. Attributes: cluster_id (long|int): ClusterId is the Id of the cluster used for constructing JobUid. cluster_incarnation_id (long|int): ClusterIncarnationId is the incarnation Id of the ...
stack_v2_sparse_classes_36k_train_020640
3,511
permissive
[ { "docstring": "Constructor for the TagsOperationParameters class", "name": "__init__", "signature": "def __init__(self, cluster_id=None, cluster_incarnation_id=None, document_ids=None, entity_id=None, job_id=None, job_instance_ids=None, tag_ids=None, tags=None)" }, { "docstring": "Creates an in...
2
null
Implement the Python class `TagsOperationParameters` described below. Class description: Implementation of the 'TagsOperationParameters' model. TODO: type description here. Attributes: cluster_id (long|int): ClusterId is the Id of the cluster used for constructing JobUid. cluster_incarnation_id (long|int): ClusterInca...
Implement the Python class `TagsOperationParameters` described below. Class description: Implementation of the 'TagsOperationParameters' model. TODO: type description here. Attributes: cluster_id (long|int): ClusterId is the Id of the cluster used for constructing JobUid. cluster_incarnation_id (long|int): ClusterInca...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class TagsOperationParameters: """Implementation of the 'TagsOperationParameters' model. TODO: type description here. Attributes: cluster_id (long|int): ClusterId is the Id of the cluster used for constructing JobUid. cluster_incarnation_id (long|int): ClusterIncarnationId is the incarnation Id of the ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TagsOperationParameters: """Implementation of the 'TagsOperationParameters' model. TODO: type description here. Attributes: cluster_id (long|int): ClusterId is the Id of the cluster used for constructing JobUid. cluster_incarnation_id (long|int): ClusterIncarnationId is the incarnation Id of the cluster used ...
the_stack_v2_python_sparse
cohesity_management_sdk/models/tags_operation_parameters.py
cohesity/management-sdk-python
train
24
31e5f727d55c324bd3931ceb70519d5533cd67e7
[ "pagination = req.context.get('pagination')\npost_collection_dto = PostCollectionV2Dto(posts=[post_to_v2_dto(post, href=PostResource.url_to(req.netloc, post_id=post.id), links=get_post_links(req, post)) for post in get_posts(start=pagination.get('start'), count=pagination.get('count'))])\nresp.body = post_collectio...
<|body_start_0|> pagination = req.context.get('pagination') post_collection_dto = PostCollectionV2Dto(posts=[post_to_v2_dto(post, href=PostResource.url_to(req.netloc, post_id=post.id), links=get_post_links(req, post)) for post in get_posts(start=pagination.get('start'), count=pagination.get('count'))]) ...
PostCollectionResource
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PostCollectionResource: def on_get(self, req, resp): """Fetch grid view for all post resources. Note: This endpoint supports pagination, pagination arguments must be provided via query args.""" <|body_0|> def on_post(self, req, resp): """Create a new post resource.""...
stack_v2_sparse_classes_36k_train_020641
7,743
permissive
[ { "docstring": "Fetch grid view for all post resources. Note: This endpoint supports pagination, pagination arguments must be provided via query args.", "name": "on_get", "signature": "def on_get(self, req, resp)" }, { "docstring": "Create a new post resource.", "name": "on_post", "signa...
2
stack_v2_sparse_classes_30k_train_016741
Implement the Python class `PostCollectionResource` described below. Class description: Implement the PostCollectionResource class. Method signatures and docstrings: - def on_get(self, req, resp): Fetch grid view for all post resources. Note: This endpoint supports pagination, pagination arguments must be provided vi...
Implement the Python class `PostCollectionResource` described below. Class description: Implement the PostCollectionResource class. Method signatures and docstrings: - def on_get(self, req, resp): Fetch grid view for all post resources. Note: This endpoint supports pagination, pagination arguments must be provided vi...
e507fe0307d1a7ea29d6c3e20be62fa82a8f109f
<|skeleton|> class PostCollectionResource: def on_get(self, req, resp): """Fetch grid view for all post resources. Note: This endpoint supports pagination, pagination arguments must be provided via query args.""" <|body_0|> def on_post(self, req, resp): """Create a new post resource.""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PostCollectionResource: def on_get(self, req, resp): """Fetch grid view for all post resources. Note: This endpoint supports pagination, pagination arguments must be provided via query args.""" pagination = req.context.get('pagination') post_collection_dto = PostCollectionV2Dto(posts=[...
the_stack_v2_python_sparse
blog/resources/posts.py
neetjn/py-blog
train
0
52a66f541ca28c9c9f057087084ecc6a24d6bad5
[ "super(Info, self).__init__(gis=gis, url=url)\nself._con = gis\nself._url = url\nif initialize:\n self._init(gis)", "url = self._url + '/getAvailableTimeZones'\nparams = {'f': 'json'}\nreturn self._con.get(path=url, params=params)" ]
<|body_start_0|> super(Info, self).__init__(gis=gis, url=url) self._con = gis self._url = url if initialize: self._init(gis) <|end_body_0|> <|body_start_1|> url = self._url + '/getAvailableTimeZones' params = {'f': 'json'} return self._con.get(path=ur...
A read-only resource that returns meta information about the server.
Info
[ "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Info: """A read-only resource that returns meta information about the server.""" def __init__(self, url, gis, initialize=False): """Constructor =============== ==================================================================== **Argument** **Description** --------------- ----------...
stack_v2_sparse_classes_36k_train_020642
1,998
permissive
[ { "docstring": "Constructor =============== ==================================================================== **Argument** **Description** --------------- -------------------------------------------------------------------- url Required string. The administration URL for the ArcGIS Server. --------------- --...
2
null
Implement the Python class `Info` described below. Class description: A read-only resource that returns meta information about the server. Method signatures and docstrings: - def __init__(self, url, gis, initialize=False): Constructor =============== ===================================================================...
Implement the Python class `Info` described below. Class description: A read-only resource that returns meta information about the server. Method signatures and docstrings: - def __init__(self, url, gis, initialize=False): Constructor =============== ===================================================================...
a874fe7e5c95196e4de68db2da0e2a05eb70e5d8
<|skeleton|> class Info: """A read-only resource that returns meta information about the server.""" def __init__(self, url, gis, initialize=False): """Constructor =============== ==================================================================== **Argument** **Description** --------------- ----------...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Info: """A read-only resource that returns meta information about the server.""" def __init__(self, url, gis, initialize=False): """Constructor =============== ==================================================================== **Argument** **Description** --------------- -----------------------...
the_stack_v2_python_sparse
arcpyenv/arcgispro-py3-clone/Lib/site-packages/arcgis/gis/server/admin/_info.py
SherbazHashmi/HackathonServer
train
3
512fa7d7c5fe95444ef6b8b6d2eae9f9aea660cf
[ "assert not kwargs, kwargs\nattributes = AttributesHelper(self, attributes)\nif not attributes.iswildcard:\n warnings.warn(UnsupportedSelectiveCommunitySetConfig, 'IOS-XR does not support selective community-set configuration.')\n attributes = AttributesHelper(self)\nconfigurations = CliConfigBuilder()\nif Fa...
<|body_start_0|> assert not kwargs, kwargs attributes = AttributesHelper(self, attributes) if not attributes.iswildcard: warnings.warn(UnsupportedSelectiveCommunitySetConfig, 'IOS-XR does not support selective community-set configuration.') attributes = AttributesHelper(s...
DeviceAttributes
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeviceAttributes: def build_config(self, apply=True, attributes=None, **kwargs): """IOS-XR CommunitySet configuration. Note: Selective configuration is not supported on IOS-XR; The whole community-set is always removed and re-configured.""" <|body_0|> def build_unconfig(self...
stack_v2_sparse_classes_36k_train_020643
7,073
permissive
[ { "docstring": "IOS-XR CommunitySet configuration. Note: Selective configuration is not supported on IOS-XR; The whole community-set is always removed and re-configured.", "name": "build_config", "signature": "def build_config(self, apply=True, attributes=None, **kwargs)" }, { "docstring": "IOS-...
2
stack_v2_sparse_classes_30k_train_005983
Implement the Python class `DeviceAttributes` described below. Class description: Implement the DeviceAttributes class. Method signatures and docstrings: - def build_config(self, apply=True, attributes=None, **kwargs): IOS-XR CommunitySet configuration. Note: Selective configuration is not supported on IOS-XR; The wh...
Implement the Python class `DeviceAttributes` described below. Class description: Implement the DeviceAttributes class. Method signatures and docstrings: - def build_config(self, apply=True, attributes=None, **kwargs): IOS-XR CommunitySet configuration. Note: Selective configuration is not supported on IOS-XR; The wh...
e42e51475cddcb10f5c7814d0fe892ac865742ba
<|skeleton|> class DeviceAttributes: def build_config(self, apply=True, attributes=None, **kwargs): """IOS-XR CommunitySet configuration. Note: Selective configuration is not supported on IOS-XR; The whole community-set is always removed and re-configured.""" <|body_0|> def build_unconfig(self...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DeviceAttributes: def build_config(self, apply=True, attributes=None, **kwargs): """IOS-XR CommunitySet configuration. Note: Selective configuration is not supported on IOS-XR; The whole community-set is always removed and re-configured.""" assert not kwargs, kwargs attributes = Attrib...
the_stack_v2_python_sparse
pkgs/conf-pkg/src/genie/libs/conf/community_set/iosxr/community_set.py
CiscoTestAutomation/genielibs
train
109
7ed0bfb8fe3b5a4bbcf560ff48a43f238a1a2414
[ "edges = collections.defaultdict(list)\nindeg = [0] * numCourses\nresult = []\nfor info in prerequisites:\n edges[info[1]].append(info[0])\n indeg[info[0]] += 1\nq = collections.deque([u for u in range(numCourses) if indeg[u] == 0])\nvisited = 0\nwhile q:\n visited += 1\n u = q.popleft()\n result.app...
<|body_start_0|> edges = collections.defaultdict(list) indeg = [0] * numCourses result = [] for info in prerequisites: edges[info[1]].append(info[0]) indeg[info[0]] += 1 q = collections.deque([u for u in range(numCourses) if indeg[u] == 0]) visited...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findOrder(self, numCourses: int, prerequisites: 'List[List[int]]') -> 'List[int]': """BFS 广度优先遍历 时间复杂度 O(m+n) 空间复杂度 O(m+n)""" <|body_0|> def findOrder_DFS(self, numCourses: int, prerequisites: 'List[List[int]]') -> 'List[int]': """DFS 深度优先遍历 较难理解 每个节点有三...
stack_v2_sparse_classes_36k_train_020644
2,713
no_license
[ { "docstring": "BFS 广度优先遍历 时间复杂度 O(m+n) 空间复杂度 O(m+n)", "name": "findOrder", "signature": "def findOrder(self, numCourses: int, prerequisites: 'List[List[int]]') -> 'List[int]'" }, { "docstring": "DFS 深度优先遍历 较难理解 每个节点有三种状态 0:未搜索;京东:搜索中;2:搜索完毕", "name": "findOrder_DFS", "signature": "def f...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findOrder(self, numCourses: int, prerequisites: 'List[List[int]]') -> 'List[int]': BFS 广度优先遍历 时间复杂度 O(m+n) 空间复杂度 O(m+n) - def findOrder_DFS(self, numCourses: int, prerequisit...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findOrder(self, numCourses: int, prerequisites: 'List[List[int]]') -> 'List[int]': BFS 广度优先遍历 时间复杂度 O(m+n) 空间复杂度 O(m+n) - def findOrder_DFS(self, numCourses: int, prerequisit...
57f303aa6e76f7c5292fa60bffdfddcb4ff9ddfb
<|skeleton|> class Solution: def findOrder(self, numCourses: int, prerequisites: 'List[List[int]]') -> 'List[int]': """BFS 广度优先遍历 时间复杂度 O(m+n) 空间复杂度 O(m+n)""" <|body_0|> def findOrder_DFS(self, numCourses: int, prerequisites: 'List[List[int]]') -> 'List[int]': """DFS 深度优先遍历 较难理解 每个节点有三...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findOrder(self, numCourses: int, prerequisites: 'List[List[int]]') -> 'List[int]': """BFS 广度优先遍历 时间复杂度 O(m+n) 空间复杂度 O(m+n)""" edges = collections.defaultdict(list) indeg = [0] * numCourses result = [] for info in prerequisites: edges[info[1]].a...
the_stack_v2_python_sparse
4_LEETCODE/1_DataStructure/6_Graph/拓扑排序/210_课程表II.py
fzingithub/SwordRefers2Offer
train
1
97a6684f34c27af5775881fc8c889c5c3bf7234f
[ "self.project_id = project_id\nself.datastore = datastore\nself.filestore = filestore\nself.datasets: Dict[str, DatasetDescriptor] = {name: cast(DatasetDescriptor, artifacts[name]) for name in artifacts if artifacts[name].is_dataset}\nself.resources = resources\nself.dataobjects: Dict[str, ArtifactDescriptor] = {na...
<|body_start_0|> self.project_id = project_id self.datastore = datastore self.filestore = filestore self.datasets: Dict[str, DatasetDescriptor] = {name: cast(DatasetDescriptor, artifacts[name]) for name in artifacts if artifacts[name].is_dataset} self.resources = resources ...
The task context contains references to the datastore and filestore that are associated with the project that executes the task. The context also contains the current database state against which a task is executed. The database state is represented as a mapping of user-defined dataset names to unique dataset identifie...
TaskContext
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TaskContext: """The task context contains references to the datastore and filestore that are associated with the project that executes the task. The context also contains the current database state against which a task is executed. The database state is represented as a mapping of user-defined da...
stack_v2_sparse_classes_36k_train_020645
5,610
permissive
[ { "docstring": "Initialize the components of the task context. Parameters ---------- project_id: string project_id of the task datastore: vizier.datastore.base.Datastore Datastore for the project that execute the task filestore: vizier.filestore.Filestore Filestore for the project that executes the task dataset...
3
null
Implement the Python class `TaskContext` described below. Class description: The task context contains references to the datastore and filestore that are associated with the project that executes the task. The context also contains the current database state against which a task is executed. The database state is repr...
Implement the Python class `TaskContext` described below. Class description: The task context contains references to the datastore and filestore that are associated with the project that executes the task. The context also contains the current database state against which a task is executed. The database state is repr...
e99f43df3df80ad5647f57d805c339257336ac73
<|skeleton|> class TaskContext: """The task context contains references to the datastore and filestore that are associated with the project that executes the task. The context also contains the current database state against which a task is executed. The database state is represented as a mapping of user-defined da...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TaskContext: """The task context contains references to the datastore and filestore that are associated with the project that executes the task. The context also contains the current database state against which a task is executed. The database state is represented as a mapping of user-defined dataset names t...
the_stack_v2_python_sparse
vizier/engine/task/base.py
VizierDB/web-api-async
train
2
558d56f7b12cc69848044feba82b7a4fb63f1586
[ "self.cube = set_up_variable_cube(np.ones((5, 5), dtype=np.float32), spatial_grid='equalarea')\ncoord_points_x = np.linspace(10.0, 50.0, 5)\nx_bounds = np.array([coord_points_x - 5, coord_points_x + 5]).T\ncoord_points_y = np.linspace(5.0, 85.0, 5)\ny_bounds = np.array([coord_points_y - 10, coord_points_y + 10]).T\...
<|body_start_0|> self.cube = set_up_variable_cube(np.ones((5, 5), dtype=np.float32), spatial_grid='equalarea') coord_points_x = np.linspace(10.0, 50.0, 5) x_bounds = np.array([coord_points_x - 5, coord_points_x + 5]).T coord_points_y = np.linspace(5.0, 85.0, 5) y_bounds = np.arra...
Test the padding of a coordinate.
Test_pad_coord
[ "BSD-3-Clause", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test_pad_coord: """Test the padding of a coordinate.""" def setUp(self): """Set up a cube.""" <|body_0|> def test_add(self): """Test the functionality to add padding to the chosen coordinate. Includes a test that the coordinate bounds array is modified to reflect...
stack_v2_sparse_classes_36k_train_020646
25,212
permissive
[ { "docstring": "Set up a cube.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test the functionality to add padding to the chosen coordinate. Includes a test that the coordinate bounds array is modified to reflect the new values.", "name": "test_add", "signature": "...
5
null
Implement the Python class `Test_pad_coord` described below. Class description: Test the padding of a coordinate. Method signatures and docstrings: - def setUp(self): Set up a cube. - def test_add(self): Test the functionality to add padding to the chosen coordinate. Includes a test that the coordinate bounds array i...
Implement the Python class `Test_pad_coord` described below. Class description: Test the padding of a coordinate. Method signatures and docstrings: - def setUp(self): Set up a cube. - def test_add(self): Test the functionality to add padding to the chosen coordinate. Includes a test that the coordinate bounds array i...
cd2c9019944345df1e703bf8f625db537ad9f559
<|skeleton|> class Test_pad_coord: """Test the padding of a coordinate.""" def setUp(self): """Set up a cube.""" <|body_0|> def test_add(self): """Test the functionality to add padding to the chosen coordinate. Includes a test that the coordinate bounds array is modified to reflect...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Test_pad_coord: """Test the padding of a coordinate.""" def setUp(self): """Set up a cube.""" self.cube = set_up_variable_cube(np.ones((5, 5), dtype=np.float32), spatial_grid='equalarea') coord_points_x = np.linspace(10.0, 50.0, 5) x_bounds = np.array([coord_points_x - 5, ...
the_stack_v2_python_sparse
improver_tests/utilities/test_pad_spatial.py
metoppv/improver
train
101
445ebe2f8dedf5332f8e9ce4f94af0b56f7c848d
[ "params = dict({'quiet': ''})\nregressor = SupportVectorRegressor(len(self.fncs))\ninput_data = np.random.rand(self.input_vecs, self.input_length)\nassert len(regressor.regressors) == len(self.fncs)\ntestRegressor(regressor, input_data, self.fncs, params)", "regressor = LinearRegressor()\ninput_data = np.random.r...
<|body_start_0|> params = dict({'quiet': ''}) regressor = SupportVectorRegressor(len(self.fncs)) input_data = np.random.rand(self.input_vecs, self.input_length) assert len(regressor.regressors) == len(self.fncs) testRegressor(regressor, input_data, self.fncs, params) <|end_body_0...
RegressorTestCase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RegressorTestCase: def testSupportVectorRegressor(self): """Test the Support Vector Regressor""" <|body_0|> def testLinearRegressor(self): """Test the Linear Regressor""" <|body_1|> def testFeedforwardNeuralNetworkRegressor(self): """Test the Fee...
stack_v2_sparse_classes_36k_train_020647
2,989
no_license
[ { "docstring": "Test the Support Vector Regressor", "name": "testSupportVectorRegressor", "signature": "def testSupportVectorRegressor(self)" }, { "docstring": "Test the Linear Regressor", "name": "testLinearRegressor", "signature": "def testLinearRegressor(self)" }, { "docstring...
3
stack_v2_sparse_classes_30k_train_014292
Implement the Python class `RegressorTestCase` described below. Class description: Implement the RegressorTestCase class. Method signatures and docstrings: - def testSupportVectorRegressor(self): Test the Support Vector Regressor - def testLinearRegressor(self): Test the Linear Regressor - def testFeedforwardNeuralNe...
Implement the Python class `RegressorTestCase` described below. Class description: Implement the RegressorTestCase class. Method signatures and docstrings: - def testSupportVectorRegressor(self): Test the Support Vector Regressor - def testLinearRegressor(self): Test the Linear Regressor - def testFeedforwardNeuralNe...
0486b769c8168a675d7fba25f90ae05c6759bee1
<|skeleton|> class RegressorTestCase: def testSupportVectorRegressor(self): """Test the Support Vector Regressor""" <|body_0|> def testLinearRegressor(self): """Test the Linear Regressor""" <|body_1|> def testFeedforwardNeuralNetworkRegressor(self): """Test the Fee...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RegressorTestCase: def testSupportVectorRegressor(self): """Test the Support Vector Regressor""" params = dict({'quiet': ''}) regressor = SupportVectorRegressor(len(self.fncs)) input_data = np.random.rand(self.input_vecs, self.input_length) assert len(regressor.regresso...
the_stack_v2_python_sparse
pysandbox/minerva_test/regressor_test.py
yanatan16/minerva
train
0
cc1c2205217f75f37d71bda4f8d25b589c4b4e00
[ "cur_time = datetime.datetime.now().strftime('%Y-%m-%d %H-%M-%S')\nprint('-------------------------------------------')\nprint('Start to test check ota update result', cur_time)\npath = judge_path()\nassert path", "try:\n update_res = check_update_res_fumo()\n assert update_res\nexcept Exception as msg:\n ...
<|body_start_0|> cur_time = datetime.datetime.now().strftime('%Y-%m-%d %H-%M-%S') print('-------------------------------------------') print('Start to test check ota update result', cur_time) path = judge_path() assert path <|end_body_0|> <|body_start_1|> try: ...
TestOtaSmokeClass
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestOtaSmokeClass: def setup_class(self): """Execute one time before run all test cases""" <|body_0|> def test_check_update_result(self): """Usage: To verify the result after executing ota download and update action. Success Value: 90 or 100""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_020648
1,596
permissive
[ { "docstring": "Execute one time before run all test cases", "name": "setup_class", "signature": "def setup_class(self)" }, { "docstring": "Usage: To verify the result after executing ota download and update action. Success Value: 90 or 100", "name": "test_check_update_result", "signatur...
3
stack_v2_sparse_classes_30k_train_014829
Implement the Python class `TestOtaSmokeClass` described below. Class description: Implement the TestOtaSmokeClass class. Method signatures and docstrings: - def setup_class(self): Execute one time before run all test cases - def test_check_update_result(self): Usage: To verify the result after executing ota download...
Implement the Python class `TestOtaSmokeClass` described below. Class description: Implement the TestOtaSmokeClass class. Method signatures and docstrings: - def setup_class(self): Execute one time before run all test cases - def test_check_update_result(self): Usage: To verify the result after executing ota download...
e4afa8944785c1dc1dc80550073858d03a77d629
<|skeleton|> class TestOtaSmokeClass: def setup_class(self): """Execute one time before run all test cases""" <|body_0|> def test_check_update_result(self): """Usage: To verify the result after executing ota download and update action. Success Value: 90 or 100""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestOtaSmokeClass: def setup_class(self): """Execute one time before run all test cases""" cur_time = datetime.datetime.now().strftime('%Y-%m-%d %H-%M-%S') print('-------------------------------------------') print('Start to test check ota update result', cur_time) path...
the_stack_v2_python_sparse
testcases/smoke/dongfeng/test_dongfeng_smoke/test_8check_update_result.py
uniquelover/ota_smoke_auto
train
0
3ee692616775e596d4aab8b84f2de73dd7f6369d
[ "self.init_config(app)\nif app.config['LOGGING_FS_LOGFILE'] is None:\n return\nself.install_handler(app)\napp.extensions['invenio-logging-fs'] = self", "app.config.setdefault('LOGGING_FS_LEVEL', 'DEBUG' if app.debug else 'WARNING')\nfor k in dir(config):\n if k.startswith('LOGGING_FS'):\n app.config....
<|body_start_0|> self.init_config(app) if app.config['LOGGING_FS_LOGFILE'] is None: return self.install_handler(app) app.extensions['invenio-logging-fs'] = self <|end_body_0|> <|body_start_1|> app.config.setdefault('LOGGING_FS_LEVEL', 'DEBUG' if app.debug else 'WARNI...
Invenio-Logging extension. Filesystem handler.
InvenioLoggingFS
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InvenioLoggingFS: """Invenio-Logging extension. Filesystem handler.""" def init_app(self, app): """Flask application initialization.""" <|body_0|> def init_config(self, app): """Initialize config.""" <|body_1|> def install_handler(self, app): ...
stack_v2_sparse_classes_36k_train_020649
3,344
no_license
[ { "docstring": "Flask application initialization.", "name": "init_app", "signature": "def init_app(self, app)" }, { "docstring": "Initialize config.", "name": "init_config", "signature": "def init_config(self, app)" }, { "docstring": "Install log handler on Flask application.", ...
3
stack_v2_sparse_classes_30k_train_010060
Implement the Python class `InvenioLoggingFS` described below. Class description: Invenio-Logging extension. Filesystem handler. Method signatures and docstrings: - def init_app(self, app): Flask application initialization. - def init_config(self, app): Initialize config. - def install_handler(self, app): Install log...
Implement the Python class `InvenioLoggingFS` described below. Class description: Invenio-Logging extension. Filesystem handler. Method signatures and docstrings: - def init_app(self, app): Flask application initialization. - def init_config(self, app): Initialize config. - def install_handler(self, app): Install log...
54eb34c7e1594cc50a5347ba93e12a991ba8b7f3
<|skeleton|> class InvenioLoggingFS: """Invenio-Logging extension. Filesystem handler.""" def init_app(self, app): """Flask application initialization.""" <|body_0|> def init_config(self, app): """Initialize config.""" <|body_1|> def install_handler(self, app): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InvenioLoggingFS: """Invenio-Logging extension. Filesystem handler.""" def init_app(self, app): """Flask application initialization.""" self.init_config(app) if app.config['LOGGING_FS_LOGFILE'] is None: return self.install_handler(app) app.extensions['i...
the_stack_v2_python_sparse
.virtualenvs/invenio/lib/python2.7/site-packages/invenio_logging/fs.py
N03/invenio
train
0
67217bba10145e7e96089f3444cdf7d4ecf1451c
[ "from django.conf.urls import url\n\ndef wrap(view):\n\n def wrapper(*args, **kwargs):\n return self.admin_site.admin_view(view, cacheable=True)(*args, **kwargs)\n return update_wrapper(wrapper, view)\ninfo = self.get_model_info()\nurls = super(RMLModelReportMixin, self).get_urls()\nreport_url = [url('...
<|body_start_0|> from django.conf.urls import url def wrap(view): def wrapper(*args, **kwargs): return self.admin_site.admin_view(view, cacheable=True)(*args, **kwargs) return update_wrapper(wrapper, view) info = self.get_model_info() urls = supe...
RML Admin Mixin for django admin to Generate model object detail in pdf format report with ReportLab *.rml template
RMLModelReportMixin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RMLModelReportMixin: """RML Admin Mixin for django admin to Generate model object detail in pdf format report with ReportLab *.rml template""" def get_urls(self): """Get default django admin urls then add custom url for report link""" <|body_0|> def get_context_object_na...
stack_v2_sparse_classes_36k_train_020650
6,508
no_license
[ { "docstring": "Get default django admin urls then add custom url for report link", "name": "get_urls", "signature": "def get_urls(self)" }, { "docstring": "Get the context name to used in template", "name": "get_context_object_name", "signature": "def get_context_object_name(self)" },...
6
stack_v2_sparse_classes_30k_train_011390
Implement the Python class `RMLModelReportMixin` described below. Class description: RML Admin Mixin for django admin to Generate model object detail in pdf format report with ReportLab *.rml template Method signatures and docstrings: - def get_urls(self): Get default django admin urls then add custom url for report ...
Implement the Python class `RMLModelReportMixin` described below. Class description: RML Admin Mixin for django admin to Generate model object detail in pdf format report with ReportLab *.rml template Method signatures and docstrings: - def get_urls(self): Get default django admin urls then add custom url for report ...
0cf8fb1be8ac3c27304807ed7aac7eb0032c2cb6
<|skeleton|> class RMLModelReportMixin: """RML Admin Mixin for django admin to Generate model object detail in pdf format report with ReportLab *.rml template""" def get_urls(self): """Get default django admin urls then add custom url for report link""" <|body_0|> def get_context_object_na...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RMLModelReportMixin: """RML Admin Mixin for django admin to Generate model object detail in pdf format report with ReportLab *.rml template""" def get_urls(self): """Get default django admin urls then add custom url for report link""" from django.conf.urls import url def wrap(vie...
the_stack_v2_python_sparse
reporting/admin.py
andrewidya/littleerp
train
1
f94f13bdc2496c726a5ec344fef0b2274ee8e13c
[ "self.NAME = EVITA\nself.tarsqidoc = tarsqidoc\nself.docelement = docelement\nself.doctree = None\nself.imported_events = imported_events", "self.doctree = create_tarsqi_tree(self.tarsqidoc, self.docelement)\nfor sentence in self.doctree:\n logger.debug('SENTENCE: %s' % get_words_as_string(sentence))\n for ...
<|body_start_0|> self.NAME = EVITA self.tarsqidoc = tarsqidoc self.docelement = docelement self.doctree = None self.imported_events = imported_events <|end_body_0|> <|body_start_1|> self.doctree = create_tarsqi_tree(self.tarsqidoc, self.docelement) for sentence i...
Class that implements Evita's event recognizer. Instance variables contain the name of the component, the TarsqiDocument, a docelement Tag and a TarsqiTree instance. The TarsqiTree instance in the doctree variable is the tree for just one element and not for the whole document or string.
Evita
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Evita: """Class that implements Evita's event recognizer. Instance variables contain the name of the component, the TarsqiDocument, a docelement Tag and a TarsqiTree instance. The TarsqiTree instance in the doctree variable is the tree for just one element and not for the whole document or string...
stack_v2_sparse_classes_36k_train_020651
1,998
permissive
[ { "docstring": "Set the NAME instance variable. The doctree variables is filled in during processing.", "name": "__init__", "signature": "def __init__(self, tarsqidoc, docelement, imported_events)" }, { "docstring": "Process the element slice of the TarsqiDocument. Loop through all sentences in ...
2
stack_v2_sparse_classes_30k_test_000988
Implement the Python class `Evita` described below. Class description: Class that implements Evita's event recognizer. Instance variables contain the name of the component, the TarsqiDocument, a docelement Tag and a TarsqiTree instance. The TarsqiTree instance in the doctree variable is the tree for just one element a...
Implement the Python class `Evita` described below. Class description: Class that implements Evita's event recognizer. Instance variables contain the name of the component, the TarsqiDocument, a docelement Tag and a TarsqiTree instance. The TarsqiTree instance in the doctree variable is the tree for just one element a...
085007047ab591426d5c08b123906c070deb6627
<|skeleton|> class Evita: """Class that implements Evita's event recognizer. Instance variables contain the name of the component, the TarsqiDocument, a docelement Tag and a TarsqiTree instance. The TarsqiTree instance in the doctree variable is the tree for just one element and not for the whole document or string...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Evita: """Class that implements Evita's event recognizer. Instance variables contain the name of the component, the TarsqiDocument, a docelement Tag and a TarsqiTree instance. The TarsqiTree instance in the doctree variable is the tree for just one element and not for the whole document or string.""" def...
the_stack_v2_python_sparse
components/evita/main.py
tarsqi/ttk
train
26
957b78e29cf69664f62a167ca39a226dfb80fadc
[ "self.M_min = -20\nself.M_max = -18\nself.a_min = -20\nself.a_max = 20\nself.b_min = -20\nself.b_max = 20\nif g_lim != None:\n self.g_min = g_lim[0]\n self.g_max = g_lim[1]", "m = rng.rand()\nM = 1000.0 * rng.rand()\nM = dnest4.wrap(M, self.M_min, self.M_max)\na = 1000.0 * rng.rand()\na = dnest4.wrap(a, sel...
<|body_start_0|> self.M_min = -20 self.M_max = -18 self.a_min = -20 self.a_max = 20 self.b_min = -20 self.b_max = 20 if g_lim != None: self.g_min = g_lim[0] self.g_max = g_lim[1] <|end_body_0|> <|body_start_1|> m = rng.rand() ...
Specify the model in Python.
Model
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Model: """Specify the model in Python.""" def __init__(self, g_lim=None): """Parameter values *are not* stored inside the class""" <|body_0|> def from_prior(self): """Unlike in C++, this must *return* a numpy array of parameters.""" <|body_1|> def pe...
stack_v2_sparse_classes_36k_train_020652
13,227
permissive
[ { "docstring": "Parameter values *are not* stored inside the class", "name": "__init__", "signature": "def __init__(self, g_lim=None)" }, { "docstring": "Unlike in C++, this must *return* a numpy array of parameters.", "name": "from_prior", "signature": "def from_prior(self)" }, { ...
4
stack_v2_sparse_classes_30k_train_009689
Implement the Python class `Model` described below. Class description: Specify the model in Python. Method signatures and docstrings: - def __init__(self, g_lim=None): Parameter values *are not* stored inside the class - def from_prior(self): Unlike in C++, this must *return* a numpy array of parameters. - def pertur...
Implement the Python class `Model` described below. Class description: Specify the model in Python. Method signatures and docstrings: - def __init__(self, g_lim=None): Parameter values *are not* stored inside the class - def from_prior(self): Unlike in C++, this must *return* a numpy array of parameters. - def pertur...
c355d18021467cf92546cf2fc9cb1d1abe59b8d8
<|skeleton|> class Model: """Specify the model in Python.""" def __init__(self, g_lim=None): """Parameter values *are not* stored inside the class""" <|body_0|> def from_prior(self): """Unlike in C++, this must *return* a numpy array of parameters.""" <|body_1|> def pe...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Model: """Specify the model in Python.""" def __init__(self, g_lim=None): """Parameter values *are not* stored inside the class""" self.M_min = -20 self.M_max = -18 self.a_min = -20 self.a_max = 20 self.b_min = -20 self.b_max = 20 if g_lim !...
the_stack_v2_python_sparse
zprev versions/Models_py_backup/Models backup/Bfactor.py
lefthandedroo/Cosmodels
train
1
ee9e8d4f83795b0bf19f75559f1cde6a102998f8
[ "self.msg_type = msg_type\nself.result = result\nself.args = args\nself.kwargs = kwargs", "msg = cls(CC3DPyGraphicsFrameConnectionMsgType.REQUESTING, None, *args, **kwargs)\nconn.send(msg)\nif return_result:\n msg = conn.recv()\n if not isinstance(msg, CC3DPyGraphicsFrameConnectionMsg):\n raise Runti...
<|body_start_0|> self.msg_type = msg_type self.result = result self.args = args self.kwargs = kwargs <|end_body_0|> <|body_start_1|> msg = cls(CC3DPyGraphicsFrameConnectionMsgType.REQUESTING, None, *args, **kwargs) conn.send(msg) if return_result: msg...
Basic message container for message passing between a client processes and a rendering process running a graphics frame. The class attribute :attr:`method` is called on the object connected on the other side of the pipe, with positional and keyword arguments as specified in the call to :meth:`request`.
CC3DPyGraphicsFrameConnectionMsg
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CC3DPyGraphicsFrameConnectionMsg: """Basic message container for message passing between a client processes and a rendering process running a graphics frame. The class attribute :attr:`method` is called on the object connected on the other side of the pipe, with positional and keyword arguments a...
stack_v2_sparse_classes_36k_train_020653
14,357
no_license
[ { "docstring": ":param msg_type: message type :type msg_type: CC3DPyGraphicsFrameConnectionMsgType :param result: message result :type result: Any :param args: message arguments :param kwargs: message keyword arguments", "name": "__init__", "signature": "def __init__(self, msg_type: CC3DPyGraphicsFrameC...
3
null
Implement the Python class `CC3DPyGraphicsFrameConnectionMsg` described below. Class description: Basic message container for message passing between a client processes and a rendering process running a graphics frame. The class attribute :attr:`method` is called on the object connected on the other side of the pipe, ...
Implement the Python class `CC3DPyGraphicsFrameConnectionMsg` described below. Class description: Basic message container for message passing between a client processes and a rendering process running a graphics frame. The class attribute :attr:`method` is called on the object connected on the other side of the pipe, ...
65a65eaa693a6d2b3aab303f9b41e71819f4eed4
<|skeleton|> class CC3DPyGraphicsFrameConnectionMsg: """Basic message container for message passing between a client processes and a rendering process running a graphics frame. The class attribute :attr:`method` is called on the object connected on the other side of the pipe, with positional and keyword arguments a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CC3DPyGraphicsFrameConnectionMsg: """Basic message container for message passing between a client processes and a rendering process running a graphics frame. The class attribute :attr:`method` is called on the object connected on the other side of the pipe, with positional and keyword arguments as specified i...
the_stack_v2_python_sparse
cc3d/core/GraphicsUtils/CC3DPyGraphicsFrameIO.py
CompuCell3D/CompuCell3D
train
51
1ff9e23224657f47a46d9c937cc14f53cf30ac26
[ "res = 0\nfor i in range(len(heights)):\n mh = heights[i]\n res = max(res, heights[i])\n for j in range(i + 1, len(heights)):\n mh = min(mh, heights[j])\n res = max(res, mh * (j - i + 1))\nreturn res", "def dfs(l, r):\n if l > r:\n return 0\n if l == r:\n return heights[...
<|body_start_0|> res = 0 for i in range(len(heights)): mh = heights[i] res = max(res, heights[i]) for j in range(i + 1, len(heights)): mh = min(mh, heights[j]) res = max(res, mh * (j - i + 1)) return res <|end_body_0|> <|body_s...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def largest_rectangle_in_histogram(self, heights: List[int]) -> int: """Bruteforce T: O(N2) S: O(1)""" <|body_0|> def largest_rectangle_in_histogram(self, heights: List[int]) -> int: """Divide and conquer T: O(NlogN) average case, O(N2) worst case (sorted) ...
stack_v2_sparse_classes_36k_train_020654
2,351
no_license
[ { "docstring": "Bruteforce T: O(N2) S: O(1)", "name": "largest_rectangle_in_histogram", "signature": "def largest_rectangle_in_histogram(self, heights: List[int]) -> int" }, { "docstring": "Divide and conquer T: O(NlogN) average case, O(N2) worst case (sorted) S: O(N) stack space", "name": "...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def largest_rectangle_in_histogram(self, heights: List[int]) -> int: Bruteforce T: O(N2) S: O(1) - def largest_rectangle_in_histogram(self, heights: List[int]) -> int: Divide and...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def largest_rectangle_in_histogram(self, heights: List[int]) -> int: Bruteforce T: O(N2) S: O(1) - def largest_rectangle_in_histogram(self, heights: List[int]) -> int: Divide and...
9882fdc58a24d852ebf9ee85bc10883454bd76a7
<|skeleton|> class Solution: def largest_rectangle_in_histogram(self, heights: List[int]) -> int: """Bruteforce T: O(N2) S: O(1)""" <|body_0|> def largest_rectangle_in_histogram(self, heights: List[int]) -> int: """Divide and conquer T: O(NlogN) average case, O(N2) worst case (sorted) ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def largest_rectangle_in_histogram(self, heights: List[int]) -> int: """Bruteforce T: O(N2) S: O(1)""" res = 0 for i in range(len(heights)): mh = heights[i] res = max(res, heights[i]) for j in range(i + 1, len(heights)): mh ...
the_stack_v2_python_sparse
python/dp/optimization/largest_rectangle_in_histogram.py
pondycrane/algorithms
train
0
0454283d33cae7fb384f8ea432ca3f005e621e7a
[ "if not head:\n return\nif not head.next:\n return head\ncurrent = head\nwhile current and current.next:\n next = current.next\n if current.val == next.val:\n current.next = next.next\n else:\n current = current.next\nreturn head", "if not head:\n return\nif not head.next:\n ret...
<|body_start_0|> if not head: return if not head.next: return head current = head while current and current.next: next = current.next if current.val == next.val: current.next = next.next else: cur...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def deleteDuplicates(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def deleteDuplicates1(self, head): """82. Remove Duplicates from Sorted List II Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only d...
stack_v2_sparse_classes_36k_train_020655
1,622
no_license
[ { "docstring": ":type head: ListNode :rtype: ListNode", "name": "deleteDuplicates", "signature": "def deleteDuplicates(self, head)" }, { "docstring": "82. Remove Duplicates from Sorted List II Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers...
2
stack_v2_sparse_classes_30k_train_003641
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def deleteDuplicates(self, head): :type head: ListNode :rtype: ListNode - def deleteDuplicates1(self, head): 82. Remove Duplicates from Sorted List II Given a sorted linked list,...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def deleteDuplicates(self, head): :type head: ListNode :rtype: ListNode - def deleteDuplicates1(self, head): 82. Remove Duplicates from Sorted List II Given a sorted linked list,...
11ad9d3841de09c0b4dc3a667e7e63c3558656a5
<|skeleton|> class Solution: def deleteDuplicates(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def deleteDuplicates1(self, head): """82. Remove Duplicates from Sorted List II Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only d...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def deleteDuplicates(self, head): """:type head: ListNode :rtype: ListNode""" if not head: return if not head.next: return head current = head while current and current.next: next = current.next if current.val ==...
the_stack_v2_python_sparse
remove_duplicate_from_linklist.py
ganlanshu/leetcode
train
0
42e73af0a8a0595994a59e3400f84348ec0959e1
[ "try:\n medication: models.Medication = models.Medication.create_from_json(data=request.data, patient_profile=request.user.patient_profile)\nexcept custom_exceptions.DataNotProvided as e:\n return response.Response(data=e.get_response_format(), status=status.HTTP_400_BAD_REQUEST)\nserialized_medication = seri...
<|body_start_0|> try: medication: models.Medication = models.Medication.create_from_json(data=request.data, patient_profile=request.user.patient_profile) except custom_exceptions.DataNotProvided as e: return response.Response(data=e.get_response_format(), status=status.HTTP_400_B...
Endpoints for Medication objects.
MedicationsEndpoint
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MedicationsEndpoint: """Endpoints for Medication objects.""" def post(self, request: Request) -> response.Response: """Adds a new medication for the user.""" <|body_0|> def put(self, request: Request) -> response.Response: """Updates an existing medication.""" ...
stack_v2_sparse_classes_36k_train_020656
14,860
no_license
[ { "docstring": "Adds a new medication for the user.", "name": "post", "signature": "def post(self, request: Request) -> response.Response" }, { "docstring": "Updates an existing medication.", "name": "put", "signature": "def put(self, request: Request) -> response.Response" }, { ...
3
stack_v2_sparse_classes_30k_train_014989
Implement the Python class `MedicationsEndpoint` described below. Class description: Endpoints for Medication objects. Method signatures and docstrings: - def post(self, request: Request) -> response.Response: Adds a new medication for the user. - def put(self, request: Request) -> response.Response: Updates an exist...
Implement the Python class `MedicationsEndpoint` described below. Class description: Endpoints for Medication objects. Method signatures and docstrings: - def post(self, request: Request) -> response.Response: Adds a new medication for the user. - def put(self, request: Request) -> response.Response: Updates an exist...
b6d757895132b9b3c8c6682c11efadf993d5905b
<|skeleton|> class MedicationsEndpoint: """Endpoints for Medication objects.""" def post(self, request: Request) -> response.Response: """Adds a new medication for the user.""" <|body_0|> def put(self, request: Request) -> response.Response: """Updates an existing medication.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MedicationsEndpoint: """Endpoints for Medication objects.""" def post(self, request: Request) -> response.Response: """Adds a new medication for the user.""" try: medication: models.Medication = models.Medication.create_from_json(data=request.data, patient_profile=request.user...
the_stack_v2_python_sparse
main/model_api.py
kalolad1/cosmos
train
0
041bde86e8c4db19fffd4293b9e8132d958d7768
[ "try:\n code, resp = get_order_detail(request, sn)\n if code == RespCode.Succeed.value:\n return Response(resp)\n else:\n return error_resp(code, resp)\nexcept Exception as e:\n print(e)\n return error_resp(RespCode.Exception.value, _('Server exception, please try again'))", "try:\n ...
<|body_start_0|> try: code, resp = get_order_detail(request, sn) if code == RespCode.Succeed.value: return Response(resp) else: return error_resp(code, resp) except Exception as e: print(e) return error_resp(Resp...
OrderDetailView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OrderDetailView: def get(self, request, sn): """订单支付页面""" <|body_0|> def delete(self, request, sn): """订单删除(逻辑删除)""" <|body_1|> def put(self, request, sn): """取消订单""" <|body_2|> def post(self, request, sn): """立即支付""" ...
stack_v2_sparse_classes_36k_train_020657
4,027
no_license
[ { "docstring": "订单支付页面", "name": "get", "signature": "def get(self, request, sn)" }, { "docstring": "订单删除(逻辑删除)", "name": "delete", "signature": "def delete(self, request, sn)" }, { "docstring": "取消订单", "name": "put", "signature": "def put(self, request, sn)" }, { ...
4
stack_v2_sparse_classes_30k_test_000180
Implement the Python class `OrderDetailView` described below. Class description: Implement the OrderDetailView class. Method signatures and docstrings: - def get(self, request, sn): 订单支付页面 - def delete(self, request, sn): 订单删除(逻辑删除) - def put(self, request, sn): 取消订单 - def post(self, request, sn): 立即支付
Implement the Python class `OrderDetailView` described below. Class description: Implement the OrderDetailView class. Method signatures and docstrings: - def get(self, request, sn): 订单支付页面 - def delete(self, request, sn): 订单删除(逻辑删除) - def put(self, request, sn): 取消订单 - def post(self, request, sn): 立即支付 <|skeleton|> ...
14c94075094e1657b90b0bb3f94544d008255f45
<|skeleton|> class OrderDetailView: def get(self, request, sn): """订单支付页面""" <|body_0|> def delete(self, request, sn): """订单删除(逻辑删除)""" <|body_1|> def put(self, request, sn): """取消订单""" <|body_2|> def post(self, request, sn): """立即支付""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OrderDetailView: def get(self, request, sn): """订单支付页面""" try: code, resp = get_order_detail(request, sn) if code == RespCode.Succeed.value: return Response(resp) else: return error_resp(code, resp) except Exception as...
the_stack_v2_python_sparse
order/views.py
Tsurol/trip-server
train
1
295047fc94bc33bb6ef83c5a907a8d8daefc7077
[ "res = []\nnums1.sort()\nnums2.sort()\ni, j = (0, 0)\nwhile i < len(nums1) and j < len(nums2):\n if nums1[i] < nums2[j]:\n i += 1\n elif nums1[i] > nums2[j]:\n j += 1\n else:\n res.append(nums1[i])\n i += 1\n j += 1\nreturn res", "s, res = (set(), [])\nfor ele in nums1:...
<|body_start_0|> res = [] nums1.sort() nums2.sort() i, j = (0, 0) while i < len(nums1) and j < len(nums2): if nums1[i] < nums2[j]: i += 1 elif nums1[i] > nums2[j]: j += 1 else: res.append(nums1[i]...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def intersection(self, nums1: List[int], nums2: List[int]) -> int: """求出两个数组的交集 Args: nums1: 数组1 nums2: 数组2 Returns: 数组的交集""" <|body_0|> def intersection2(self, nums1: List[int], nums2: List[int]) -> List[int]: """两个数组求交集 Args: nums1: 数组1 nums2: 数组2 Returns...
stack_v2_sparse_classes_36k_train_020658
2,414
permissive
[ { "docstring": "求出两个数组的交集 Args: nums1: 数组1 nums2: 数组2 Returns: 数组的交集", "name": "intersection", "signature": "def intersection(self, nums1: List[int], nums2: List[int]) -> int" }, { "docstring": "两个数组求交集 Args: nums1: 数组1 nums2: 数组2 Returns: 数组交集", "name": "intersection2", "signature": "de...
2
stack_v2_sparse_classes_30k_train_003099
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def intersection(self, nums1: List[int], nums2: List[int]) -> int: 求出两个数组的交集 Args: nums1: 数组1 nums2: 数组2 Returns: 数组的交集 - def intersection2(self, nums1: List[int], nums2: List[in...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def intersection(self, nums1: List[int], nums2: List[int]) -> int: 求出两个数组的交集 Args: nums1: 数组1 nums2: 数组2 Returns: 数组的交集 - def intersection2(self, nums1: List[int], nums2: List[in...
50f35eef6a0ad63173efed10df3c835b1dceaa3f
<|skeleton|> class Solution: def intersection(self, nums1: List[int], nums2: List[int]) -> int: """求出两个数组的交集 Args: nums1: 数组1 nums2: 数组2 Returns: 数组的交集""" <|body_0|> def intersection2(self, nums1: List[int], nums2: List[int]) -> List[int]: """两个数组求交集 Args: nums1: 数组1 nums2: 数组2 Returns...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def intersection(self, nums1: List[int], nums2: List[int]) -> int: """求出两个数组的交集 Args: nums1: 数组1 nums2: 数组2 Returns: 数组的交集""" res = [] nums1.sort() nums2.sort() i, j = (0, 0) while i < len(nums1) and j < len(nums2): if nums1[i] < nums2[j]: ...
the_stack_v2_python_sparse
src/leetcodepython/array/intersection_two_array_349.py
zhangyu345293721/leetcode
train
101
f070749868f5ba2b7c0382cc2c8c12088889f72d
[ "super().__init__(model=acq_function.model)\nself.acq_func = acq_function\nself.prior_module = prior_module\nself._log = log\nself._prior_exponent = prior_exponent\nself._is_sample_reducing_af = isinstance(acq_function, SampleReducingMCAcquisitionFunction)\nself.set_X_pending(X_pending=X_pending)", "prior = self....
<|body_start_0|> super().__init__(model=acq_function.model) self.acq_func = acq_function self.prior_module = prior_module self._log = log self._prior_exponent = prior_exponent self._is_sample_reducing_af = isinstance(acq_function, SampleReducingMCAcquisitionFunction) ...
Class for weighting acquisition functions by a prior distribution. Supports MC and batch acquisition functions via SampleReducingAcquisitionFunction. See [Hvarfner2022]_ for details.
PriorGuidedAcquisitionFunction
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PriorGuidedAcquisitionFunction: """Class for weighting acquisition functions by a prior distribution. Supports MC and batch acquisition functions via SampleReducingAcquisitionFunction. See [Hvarfner2022]_ for details.""" def __init__(self, acq_function: AcquisitionFunction, prior_module: Mod...
stack_v2_sparse_classes_36k_train_020659
3,750
permissive
[ { "docstring": "Initialize the prior-guided acquisition function. Args: acq_function: The base acquisition function. prior_module: A Module that computes the probability (or log probability) for the provided inputs. `prior_module.forward` should take a `batch_shape x q`-dim tensor of inputs and return a `batch_...
2
stack_v2_sparse_classes_30k_train_004136
Implement the Python class `PriorGuidedAcquisitionFunction` described below. Class description: Class for weighting acquisition functions by a prior distribution. Supports MC and batch acquisition functions via SampleReducingAcquisitionFunction. See [Hvarfner2022]_ for details. Method signatures and docstrings: - def...
Implement the Python class `PriorGuidedAcquisitionFunction` described below. Class description: Class for weighting acquisition functions by a prior distribution. Supports MC and batch acquisition functions via SampleReducingAcquisitionFunction. See [Hvarfner2022]_ for details. Method signatures and docstrings: - def...
4cc5ed59b2e8a9c780f786830c548e05cc74d53c
<|skeleton|> class PriorGuidedAcquisitionFunction: """Class for weighting acquisition functions by a prior distribution. Supports MC and batch acquisition functions via SampleReducingAcquisitionFunction. See [Hvarfner2022]_ for details.""" def __init__(self, acq_function: AcquisitionFunction, prior_module: Mod...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PriorGuidedAcquisitionFunction: """Class for weighting acquisition functions by a prior distribution. Supports MC and batch acquisition functions via SampleReducingAcquisitionFunction. See [Hvarfner2022]_ for details.""" def __init__(self, acq_function: AcquisitionFunction, prior_module: Module, log: boo...
the_stack_v2_python_sparse
botorch/acquisition/prior_guided.py
pytorch/botorch
train
2,891
639e2df453845137d4f08f8788514c4bbd16fe2e
[ "uri = '%s/sms/send' % self.uri_prefix\npost_body = {'phone': phone, 'sms': message}\npost_body = json.dumps(post_body)\nresp, body = self.post(uri, post_body)\nself.expected_success(201, resp.status)\nbody = json.loads(body)\nreturn service_client.ResponseBody(resp, body)", "uri = '%s/sms/config' % self.uri_pref...
<|body_start_0|> uri = '%s/sms/send' % self.uri_prefix post_body = {'phone': phone, 'sms': message} post_body = json.dumps(post_body) resp, body = self.post(uri, post_body) self.expected_success(201, resp.status) body = json.loads(body) return service_client.Respo...
SfNotifySmsClient
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SfNotifySmsClient: def sms_create(self, phone, message): """create sms :param phone(required): The phone number to send :param message(required): Content of short message""" <|body_0|> def sms_config_set(self, cfg, **kwargs): """update config ini file :param cfg: dic...
stack_v2_sparse_classes_36k_train_020660
2,272
permissive
[ { "docstring": "create sms :param phone(required): The phone number to send :param message(required): Content of short message", "name": "sms_create", "signature": "def sms_create(self, phone, message)" }, { "docstring": "update config ini file :param cfg: dict of config like this: {section:{opt...
3
stack_v2_sparse_classes_30k_train_017803
Implement the Python class `SfNotifySmsClient` described below. Class description: Implement the SfNotifySmsClient class. Method signatures and docstrings: - def sms_create(self, phone, message): create sms :param phone(required): The phone number to send :param message(required): Content of short message - def sms_c...
Implement the Python class `SfNotifySmsClient` described below. Class description: Implement the SfNotifySmsClient class. Method signatures and docstrings: - def sms_create(self, phone, message): create sms :param phone(required): The phone number to send :param message(required): Content of short message - def sms_c...
1ccdab06d5800572ee0fc569c87d56332efe1538
<|skeleton|> class SfNotifySmsClient: def sms_create(self, phone, message): """create sms :param phone(required): The phone number to send :param message(required): Content of short message""" <|body_0|> def sms_config_set(self, cfg, **kwargs): """update config ini file :param cfg: dic...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SfNotifySmsClient: def sms_create(self, phone, message): """create sms :param phone(required): The phone number to send :param message(required): Content of short message""" uri = '%s/sms/send' % self.uri_prefix post_body = {'phone': phone, 'sms': message} post_body = json.dump...
the_stack_v2_python_sparse
yibo/tempest/tempest/services/sf_notify/json/sf_notify_sms_client.py
laoyigrace/files
train
0
9003dd21cb8c403c2aa2935edf6a750781ac3ed4
[ "first = None\nheapq.heapify(letters)\nwhile len(letters) != 0:\n source = heapq.heappop(letters)\n if source > target:\n return source\n if first is None:\n first = source\nreturn first", "for letter in letters:\n if letter > target:\n return letter\nreturn letters[0]" ]
<|body_start_0|> first = None heapq.heapify(letters) while len(letters) != 0: source = heapq.heappop(letters) if source > target: return source if first is None: first = source return first <|end_body_0|> <|body_start_1...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def nextGreatestLetter(self, letters, target): """:type letters: List[str] :type target: str :rtype: str""" <|body_0|> def nextGreatestLetter1(self, letters, target): """:type letters: List[str] :type target: str :rtype: str""" <|body_1|> <|end_ske...
stack_v2_sparse_classes_36k_train_020661
3,138
no_license
[ { "docstring": ":type letters: List[str] :type target: str :rtype: str", "name": "nextGreatestLetter", "signature": "def nextGreatestLetter(self, letters, target)" }, { "docstring": ":type letters: List[str] :type target: str :rtype: str", "name": "nextGreatestLetter1", "signature": "def...
2
stack_v2_sparse_classes_30k_train_000832
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def nextGreatestLetter(self, letters, target): :type letters: List[str] :type target: str :rtype: str - def nextGreatestLetter1(self, letters, target): :type letters: List[str] :...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def nextGreatestLetter(self, letters, target): :type letters: List[str] :type target: str :rtype: str - def nextGreatestLetter1(self, letters, target): :type letters: List[str] :...
233d12deca34f51c3bb0406831cc07f3b72b50cf
<|skeleton|> class Solution: def nextGreatestLetter(self, letters, target): """:type letters: List[str] :type target: str :rtype: str""" <|body_0|> def nextGreatestLetter1(self, letters, target): """:type letters: List[str] :type target: str :rtype: str""" <|body_1|> <|end_ske...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def nextGreatestLetter(self, letters, target): """:type letters: List[str] :type target: str :rtype: str""" first = None heapq.heapify(letters) while len(letters) != 0: source = heapq.heappop(letters) if source > target: return ...
the_stack_v2_python_sparse
Python/Find Smallest Letter Greater Than Target/main.py
briansu2004/MyLeet
train
1
15a5c96388208cf62f15be574b615a6971609528
[ "py_typecheck.check_callable(executor_stack_fn)\nself._executor_stack_fn = executor_stack_fn\nself._executors = cachetools.LRUCache(_EXECUTOR_CACHE_SIZE)\nif ensure_closed is None:\n ensure_closed = ()\nself._ensure_closed = ensure_closed", "py_typecheck.check_type(cardinalities, dict)\nkey = _get_hashable_key...
<|body_start_0|> py_typecheck.check_callable(executor_stack_fn) self._executor_stack_fn = executor_stack_fn self._executors = cachetools.LRUCache(_EXECUTOR_CACHE_SIZE) if ensure_closed is None: ensure_closed = () self._ensure_closed = ensure_closed <|end_body_0|> <|b...
Implementation of executor factory holding an executor per cardinality.
ResourceManagingExecutorFactory
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResourceManagingExecutorFactory: """Implementation of executor factory holding an executor per cardinality.""" def __init__(self, executor_stack_fn: Callable[[executor_factory.CardinalitiesType], executor_base.Executor], ensure_closed: Optional[Sequence[executor_base.Executor]]=None): ...
stack_v2_sparse_classes_36k_train_020662
43,780
permissive
[ { "docstring": "Initializes `ResourceManagingExecutorFactory`. `ResourceManagingExecutorFactory` manages a mapping from `cardinalities` to `executor_base.Executors`, closing and destroying the executors in this mapping when asked. Args: executor_stack_fn: Callable taking a mapping from `placements.PlacementLite...
3
stack_v2_sparse_classes_30k_train_013976
Implement the Python class `ResourceManagingExecutorFactory` described below. Class description: Implementation of executor factory holding an executor per cardinality. Method signatures and docstrings: - def __init__(self, executor_stack_fn: Callable[[executor_factory.CardinalitiesType], executor_base.Executor], ens...
Implement the Python class `ResourceManagingExecutorFactory` described below. Class description: Implementation of executor factory holding an executor per cardinality. Method signatures and docstrings: - def __init__(self, executor_stack_fn: Callable[[executor_factory.CardinalitiesType], executor_base.Executor], ens...
9c08381a172a26957d7c50f74214c74fe9a9fb1c
<|skeleton|> class ResourceManagingExecutorFactory: """Implementation of executor factory holding an executor per cardinality.""" def __init__(self, executor_stack_fn: Callable[[executor_factory.CardinalitiesType], executor_base.Executor], ensure_closed: Optional[Sequence[executor_base.Executor]]=None): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ResourceManagingExecutorFactory: """Implementation of executor factory holding an executor per cardinality.""" def __init__(self, executor_stack_fn: Callable[[executor_factory.CardinalitiesType], executor_base.Executor], ensure_closed: Optional[Sequence[executor_base.Executor]]=None): """Initiali...
the_stack_v2_python_sparse
tensorflow_federated/python/core/impl/executors/executor_stacks.py
Saiprasad16/federated
train
1
837865c2e0b9c7e69d141b4a30ee76ca7ebf023d
[ "self.total_records = total_records\nself.total_pages = total_pages\nself.page_number = page_number\nself.number_of_records_per_page = number_of_records_per_page\nself.applications = applications\nself.additional_properties = additional_properties", "if dictionary is None:\n return None\ntotal_records = dictio...
<|body_start_0|> self.total_records = total_records self.total_pages = total_pages self.page_number = page_number self.number_of_records_per_page = number_of_records_per_page self.applications = applications self.additional_properties = additional_properties <|end_body_0|...
Implementation of the 'App Statuses' model. The response for the Get App Registration Status endpoint which returns an array of App Status objects to be able to determine their registration status. This is version 2 of this response. Attributes: total_records (long|int): Total number of applications in query total_page...
AppStatuses
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AppStatuses: """Implementation of the 'App Statuses' model. The response for the Get App Registration Status endpoint which returns an array of App Status objects to be able to determine their registration status. This is version 2 of this response. Attributes: total_records (long|int): Total num...
stack_v2_sparse_classes_36k_train_020663
3,503
permissive
[ { "docstring": "Constructor for the AppStatuses class", "name": "__init__", "signature": "def __init__(self, total_records=None, total_pages=None, page_number=None, number_of_records_per_page=None, applications=None, additional_properties={})" }, { "docstring": "Creates an instance of this model...
2
stack_v2_sparse_classes_30k_train_011974
Implement the Python class `AppStatuses` described below. Class description: Implementation of the 'App Statuses' model. The response for the Get App Registration Status endpoint which returns an array of App Status objects to be able to determine their registration status. This is version 2 of this response. Attribut...
Implement the Python class `AppStatuses` described below. Class description: Implementation of the 'App Statuses' model. The response for the Get App Registration Status endpoint which returns an array of App Status objects to be able to determine their registration status. This is version 2 of this response. Attribut...
b2ab1ded435db75c78d42261f5e4acd2a3061487
<|skeleton|> class AppStatuses: """Implementation of the 'App Statuses' model. The response for the Get App Registration Status endpoint which returns an array of App Status objects to be able to determine their registration status. This is version 2 of this response. Attributes: total_records (long|int): Total num...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AppStatuses: """Implementation of the 'App Statuses' model. The response for the Get App Registration Status endpoint which returns an array of App Status objects to be able to determine their registration status. This is version 2 of this response. Attributes: total_records (long|int): Total number of applic...
the_stack_v2_python_sparse
finicityapi/models/app_statuses.py
monarchmoney/finicity-python
train
0
59087b571033dc1da1a770c0396ae6bd5bbcb9b6
[ "size = len(prices)\nif size <= 0:\n return 0\nmemo = [-1] * size\n\ndef dp(start):\n if start >= size:\n return 0\n if memo[start] != -1:\n return memo[start]\n minIdx = start\n maxPro = 0\n for i in range(start + 1, size):\n if prices[i] < prices[minIdx]:\n minIdx...
<|body_start_0|> size = len(prices) if size <= 0: return 0 memo = [-1] * size def dp(start): if start >= size: return 0 if memo[start] != -1: return memo[start] minIdx = start maxPro = 0 ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxProfit(self, prices: List[int], fee: int) -> int: """暴力优化2:消除一层循环+备忘录,超时,区分题122,含手续费 - fee""" <|body_0|> def maxProfit_dp(self, prices: List[int], fee: int) -> int: """动态规划:三个操作状态buy, sell, rest。 通用状态转移方程:s[0,1]两种(有无股票)状态的两种情况,昨天的股票持有状态和今天的操作影响今天的收益情...
stack_v2_sparse_classes_36k_train_020664
4,570
permissive
[ { "docstring": "暴力优化2:消除一层循环+备忘录,超时,区分题122,含手续费 - fee", "name": "maxProfit", "signature": "def maxProfit(self, prices: List[int], fee: int) -> int" }, { "docstring": "动态规划:三个操作状态buy, sell, rest。 通用状态转移方程:s[0,1]两种(有无股票)状态的两种情况,昨天的股票持有状态和今天的操作影响今天的收益情况 dp[i][k][0] = max(dp[i - 1][k][0], dp[i - 1][...
3
stack_v2_sparse_classes_30k_train_002068
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices: List[int], fee: int) -> int: 暴力优化2:消除一层循环+备忘录,超时,区分题122,含手续费 - fee - def maxProfit_dp(self, prices: List[int], fee: int) -> int: 动态规划:三个操作状态buy, sell,...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices: List[int], fee: int) -> int: 暴力优化2:消除一层循环+备忘录,超时,区分题122,含手续费 - fee - def maxProfit_dp(self, prices: List[int], fee: int) -> int: 动态规划:三个操作状态buy, sell,...
e8a1c6cae6547cbcb6e8494be6df685f3e7c837c
<|skeleton|> class Solution: def maxProfit(self, prices: List[int], fee: int) -> int: """暴力优化2:消除一层循环+备忘录,超时,区分题122,含手续费 - fee""" <|body_0|> def maxProfit_dp(self, prices: List[int], fee: int) -> int: """动态规划:三个操作状态buy, sell, rest。 通用状态转移方程:s[0,1]两种(有无股票)状态的两种情况,昨天的股票持有状态和今天的操作影响今天的收益情...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxProfit(self, prices: List[int], fee: int) -> int: """暴力优化2:消除一层循环+备忘录,超时,区分题122,含手续费 - fee""" size = len(prices) if size <= 0: return 0 memo = [-1] * size def dp(start): if start >= size: return 0 if ...
the_stack_v2_python_sparse
714-best-time-to-buy-and-sell-stock-with-transaction-fee.py
yuenliou/leetcode
train
0
7f633def5a460ca1040268cd047a402b363c383c
[ "super(AdamWeightDecayOptimizer, self).__init__(False, name)\nself.learning_rate = learning_rate\nself.weight_decay_rate = weight_decay_rate\nself.beta_1 = beta_1\nself.beta_2 = beta_2\nself.epsilon = epsilon\nself.exclude_from_weight_decay = exclude_from_weight_decay\nself.beta_1_t = 1.0\nself.beta_2_t = 1.0", "...
<|body_start_0|> super(AdamWeightDecayOptimizer, self).__init__(False, name) self.learning_rate = learning_rate self.weight_decay_rate = weight_decay_rate self.beta_1 = beta_1 self.beta_2 = beta_2 self.epsilon = epsilon self.exclude_from_weight_decay = exclude_fro...
包含修正L2正则化(权重衰减)的Adam优化器
AdamWeightDecayOptimizer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdamWeightDecayOptimizer: """包含修正L2正则化(权重衰减)的Adam优化器""" def __init__(self, learning_rate, weight_decay_rate=0.0, beta_1=0.9, beta_2=0.999, epsilon=1e-06, exclude_from_weight_decay=None, name='AdamWeightDecayOptimizer'): """创建一个Adam权重衰减优化器 :param learning_rate: float,学习率 :param weight...
stack_v2_sparse_classes_36k_train_020665
10,671
no_license
[ { "docstring": "创建一个Adam权重衰减优化器 :param learning_rate: float,学习率 :param weight_decay_rate: float,权重衰减比率 :param beta_1: float, 默认0.9,梯度一阶矩估计用的参数 :param beta_2: float, 默认0.999,梯度二阶矩估计用的参数 :param epsilon: float,防止程序计算除0 :param exclude_from_weight_decay: list,不需要L2正则化(权重衰减)的参数名称 :param name: str,优化器名称", "name": ...
5
stack_v2_sparse_classes_30k_train_021094
Implement the Python class `AdamWeightDecayOptimizer` described below. Class description: 包含修正L2正则化(权重衰减)的Adam优化器 Method signatures and docstrings: - def __init__(self, learning_rate, weight_decay_rate=0.0, beta_1=0.9, beta_2=0.999, epsilon=1e-06, exclude_from_weight_decay=None, name='AdamWeightDecayOptimizer'): 创建一个...
Implement the Python class `AdamWeightDecayOptimizer` described below. Class description: 包含修正L2正则化(权重衰减)的Adam优化器 Method signatures and docstrings: - def __init__(self, learning_rate, weight_decay_rate=0.0, beta_1=0.9, beta_2=0.999, epsilon=1e-06, exclude_from_weight_decay=None, name='AdamWeightDecayOptimizer'): 创建一个...
e41b10ee42eb435e665abde4c62d13f5f3c10c5c
<|skeleton|> class AdamWeightDecayOptimizer: """包含修正L2正则化(权重衰减)的Adam优化器""" def __init__(self, learning_rate, weight_decay_rate=0.0, beta_1=0.9, beta_2=0.999, epsilon=1e-06, exclude_from_weight_decay=None, name='AdamWeightDecayOptimizer'): """创建一个Adam权重衰减优化器 :param learning_rate: float,学习率 :param weight...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AdamWeightDecayOptimizer: """包含修正L2正则化(权重衰减)的Adam优化器""" def __init__(self, learning_rate, weight_decay_rate=0.0, beta_1=0.9, beta_2=0.999, epsilon=1e-06, exclude_from_weight_decay=None, name='AdamWeightDecayOptimizer'): """创建一个Adam权重衰减优化器 :param learning_rate: float,学习率 :param weight_decay_rate: ...
the_stack_v2_python_sparse
read_source/bert/optimization.py
43reyerhrstj/nlp_store
train
0
de0cfb2150dc0563751f7726ed24a8eb69e804f7
[ "self.language = language\nself.available_languages = ['akkadian', 'arabic', 'french', 'greek', 'latin', 'old_norse', 'middle_english', 'middle_high_german']\nassert self.language in self.available_languages, \"Specific tokenizer not available for '{0}'. Only available for: '{1}'.\".format(self.language, self.avail...
<|body_start_0|> self.language = language self.available_languages = ['akkadian', 'arabic', 'french', 'greek', 'latin', 'old_norse', 'middle_english', 'middle_high_german'] assert self.language in self.available_languages, "Specific tokenizer not available for '{0}'. Only available for: '{1}'."....
Tokenize according to rules specific to a given language.
WordTokenizer
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WordTokenizer: """Tokenize according to rules specific to a given language.""" def __init__(self, language): """Take language as argument to the class. Check availability and setup class variables.""" <|body_0|> def tokenize(self, string): """Tokenize incoming st...
stack_v2_sparse_classes_36k_train_020666
16,196
permissive
[ { "docstring": "Take language as argument to the class. Check availability and setup class variables.", "name": "__init__", "signature": "def __init__(self, language)" }, { "docstring": "Tokenize incoming string.", "name": "tokenize", "signature": "def tokenize(self, string)" }, { ...
3
stack_v2_sparse_classes_30k_train_017008
Implement the Python class `WordTokenizer` described below. Class description: Tokenize according to rules specific to a given language. Method signatures and docstrings: - def __init__(self, language): Take language as argument to the class. Check availability and setup class variables. - def tokenize(self, string):...
Implement the Python class `WordTokenizer` described below. Class description: Tokenize according to rules specific to a given language. Method signatures and docstrings: - def __init__(self, language): Take language as argument to the class. Check availability and setup class variables. - def tokenize(self, string):...
085420eaed7055fbcb311714eebb67861fd1b241
<|skeleton|> class WordTokenizer: """Tokenize according to rules specific to a given language.""" def __init__(self, language): """Take language as argument to the class. Check availability and setup class variables.""" <|body_0|> def tokenize(self, string): """Tokenize incoming st...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WordTokenizer: """Tokenize according to rules specific to a given language.""" def __init__(self, language): """Take language as argument to the class. Check availability and setup class variables.""" self.language = language self.available_languages = ['akkadian', 'arabic', 'fren...
the_stack_v2_python_sparse
cltk/tokenize/word.py
jerryfrancis-97/cltk
train
1
942a1b7180ca41a8a3f2996b4b7f16f2f4ff2ae7
[ "patient_id = data['patient_id']\npatient = Patient(data['patient'])\nanamnesis = Anamnesis(data['anamnesis'])\nrecord = Record(patient_id, patient, anamnesis)\nfilename = '{}.json'.format(str(random.randint(10000, 99999)))\nfilepath = os.path.join(os.getcwd(), self.DEFAULT_PATH_TO_PENDING_BLOCK, filename)\nwith op...
<|body_start_0|> patient_id = data['patient_id'] patient = Patient(data['patient']) anamnesis = Anamnesis(data['anamnesis']) record = Record(patient_id, patient, anamnesis) filename = '{}.json'.format(str(random.randint(10000, 99999))) filepath = os.path.join(os.getcwd(),...
Controller
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Controller: def add(self, data): """Data akan ditambahkan ke folder pending sebelum dibuat menjadi satu blok utuh Data terdiri dari 2 class yaitu : Patient, Anamnesis""" <|body_0|> def get(self, id): """Mengambil data berdasarkan ID yang ada""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_020667
1,571
no_license
[ { "docstring": "Data akan ditambahkan ke folder pending sebelum dibuat menjadi satu blok utuh Data terdiri dari 2 class yaitu : Patient, Anamnesis", "name": "add", "signature": "def add(self, data)" }, { "docstring": "Mengambil data berdasarkan ID yang ada", "name": "get", "signature": "...
3
stack_v2_sparse_classes_30k_train_021264
Implement the Python class `Controller` described below. Class description: Implement the Controller class. Method signatures and docstrings: - def add(self, data): Data akan ditambahkan ke folder pending sebelum dibuat menjadi satu blok utuh Data terdiri dari 2 class yaitu : Patient, Anamnesis - def get(self, id): M...
Implement the Python class `Controller` described below. Class description: Implement the Controller class. Method signatures and docstrings: - def add(self, data): Data akan ditambahkan ke folder pending sebelum dibuat menjadi satu blok utuh Data terdiri dari 2 class yaitu : Patient, Anamnesis - def get(self, id): M...
8e55e77f6a89e0e4fef60da38c318fcf97b551a3
<|skeleton|> class Controller: def add(self, data): """Data akan ditambahkan ke folder pending sebelum dibuat menjadi satu blok utuh Data terdiri dari 2 class yaitu : Patient, Anamnesis""" <|body_0|> def get(self, id): """Mengambil data berdasarkan ID yang ada""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Controller: def add(self, data): """Data akan ditambahkan ke folder pending sebelum dibuat menjadi satu blok utuh Data terdiri dari 2 class yaitu : Patient, Anamnesis""" patient_id = data['patient_id'] patient = Patient(data['patient']) anamnesis = Anamnesis(data['anamnesis']) ...
the_stack_v2_python_sparse
Distributed/Puskesmas Manado/Data/components/Controller.py
chlengkey/medchain-peer
train
0
c40dcb3ebbac21ef940d239897b0c12bd2374741
[ "self.vault_id = vault_id\nself.vault_name = vault_name\nself.vault_type = vault_type", "if dictionary is None:\n return None\nvault_id = dictionary.get('vaultId')\nvault_name = dictionary.get('vaultName')\nvault_type = dictionary.get('vaultType')\nreturn cls(vault_id, vault_name, vault_type)" ]
<|body_start_0|> self.vault_id = vault_id self.vault_name = vault_name self.vault_type = vault_type <|end_body_0|> <|body_start_1|> if dictionary is None: return None vault_id = dictionary.get('vaultId') vault_name = dictionary.get('vaultName') vault_...
Implementation of the 'ArchivalExternalTarget' model. Specifies settings about the Archival External Target (such as Tape or AWS). Attributes: vault_id (long|int): Specifies the id of Archival Vault assigned by the Cohesity Cluster. vault_name (string): Name of the Archival Vault. vault_type (VaultTypeArchivalExternalT...
ArchivalExternalTarget
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ArchivalExternalTarget: """Implementation of the 'ArchivalExternalTarget' model. Specifies settings about the Archival External Target (such as Tape or AWS). Attributes: vault_id (long|int): Specifies the id of Archival Vault assigned by the Cohesity Cluster. vault_name (string): Name of the Arch...
stack_v2_sparse_classes_36k_train_020668
2,202
permissive
[ { "docstring": "Constructor for the ArchivalExternalTarget class", "name": "__init__", "signature": "def __init__(self, vault_id=None, vault_name=None, vault_type=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary representat...
2
null
Implement the Python class `ArchivalExternalTarget` described below. Class description: Implementation of the 'ArchivalExternalTarget' model. Specifies settings about the Archival External Target (such as Tape or AWS). Attributes: vault_id (long|int): Specifies the id of Archival Vault assigned by the Cohesity Cluster...
Implement the Python class `ArchivalExternalTarget` described below. Class description: Implementation of the 'ArchivalExternalTarget' model. Specifies settings about the Archival External Target (such as Tape or AWS). Attributes: vault_id (long|int): Specifies the id of Archival Vault assigned by the Cohesity Cluster...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class ArchivalExternalTarget: """Implementation of the 'ArchivalExternalTarget' model. Specifies settings about the Archival External Target (such as Tape or AWS). Attributes: vault_id (long|int): Specifies the id of Archival Vault assigned by the Cohesity Cluster. vault_name (string): Name of the Arch...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ArchivalExternalTarget: """Implementation of the 'ArchivalExternalTarget' model. Specifies settings about the Archival External Target (such as Tape or AWS). Attributes: vault_id (long|int): Specifies the id of Archival Vault assigned by the Cohesity Cluster. vault_name (string): Name of the Archival Vault. v...
the_stack_v2_python_sparse
cohesity_management_sdk/models/archival_external_target.py
cohesity/management-sdk-python
train
24
b6743954953cb860b6a18ac2f42bccfa79235d5e
[ "graph = [[] for _ in range(numCourses)]\nneigh = [[] for _ in range(numCourses)]\nfor c, p in prerequisites:\n graph[c].append(p)\n neigh[p].append(c)\nstack = [i for i in range(numCourses) if not graph[i]]\nres = []\nwhile stack:\n prerequisites = stack.pop()\n res.append(prerequisites)\n for cours...
<|body_start_0|> graph = [[] for _ in range(numCourses)] neigh = [[] for _ in range(numCourses)] for c, p in prerequisites: graph[c].append(p) neigh[p].append(c) stack = [i for i in range(numCourses) if not graph[i]] res = [] while stack: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findOrder_dfs(self, numCourses, prerequisites): """:type numCourses: int :type prerequisites: List[List[int]] :rtype: List[int]""" <|body_0|> def findOrder_bfs(self, numCourses, prerequisites): """:type numCourses: int :type prerequisites: List[List[int...
stack_v2_sparse_classes_36k_train_020669
4,347
no_license
[ { "docstring": ":type numCourses: int :type prerequisites: List[List[int]] :rtype: List[int]", "name": "findOrder_dfs", "signature": "def findOrder_dfs(self, numCourses, prerequisites)" }, { "docstring": ":type numCourses: int :type prerequisites: List[List[int]] :rtype: List[int]", "name": ...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findOrder_dfs(self, numCourses, prerequisites): :type numCourses: int :type prerequisites: List[List[int]] :rtype: List[int] - def findOrder_bfs(self, numCourses, prerequisit...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findOrder_dfs(self, numCourses, prerequisites): :type numCourses: int :type prerequisites: List[List[int]] :rtype: List[int] - def findOrder_bfs(self, numCourses, prerequisit...
f3fc71f344cd758cfce77f16ab72992c99ab288e
<|skeleton|> class Solution: def findOrder_dfs(self, numCourses, prerequisites): """:type numCourses: int :type prerequisites: List[List[int]] :rtype: List[int]""" <|body_0|> def findOrder_bfs(self, numCourses, prerequisites): """:type numCourses: int :type prerequisites: List[List[int...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findOrder_dfs(self, numCourses, prerequisites): """:type numCourses: int :type prerequisites: List[List[int]] :rtype: List[int]""" graph = [[] for _ in range(numCourses)] neigh = [[] for _ in range(numCourses)] for c, p in prerequisites: graph[c].appen...
the_stack_v2_python_sparse
210_CourseSchedule2.py
jennyChing/leetCode
train
2
58597a932a7e6a3d5af23dfbb1cbe3f92ba2ce26
[ "d = {}\ndfs(tree, None, d)\nreturn Graph(list(d.values()))", "for node in graph.nodes:\n if node.val == val:\n targetNode = node\ndist = targetNode.distance = 0\nl = [targetNode]\ns = set()\nwhile len(l) > 0:\n node = l.pop()\n if node.val in s or len(node.neighbors) == 0:\n continue\n ...
<|body_start_0|> d = {} dfs(tree, None, d) return Graph(list(d.values())) <|end_body_0|> <|body_start_1|> for node in graph.nodes: if node.val == val: targetNode = node dist = targetNode.distance = 0 l = [targetNode] s = set() ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def fromTreeToGraph(self, tree): """:type tree: TreeNode :rtype: Graph""" <|body_0|> def updateDistance(self, graph, val): """:type graph: Graph""" <|body_1|> def distanceK(self, root, target, K): """:type root: TreeNode :type target: T...
stack_v2_sparse_classes_36k_train_020670
2,490
no_license
[ { "docstring": ":type tree: TreeNode :rtype: Graph", "name": "fromTreeToGraph", "signature": "def fromTreeToGraph(self, tree)" }, { "docstring": ":type graph: Graph", "name": "updateDistance", "signature": "def updateDistance(self, graph, val)" }, { "docstring": ":type root: Tree...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def fromTreeToGraph(self, tree): :type tree: TreeNode :rtype: Graph - def updateDistance(self, graph, val): :type graph: Graph - def distanceK(self, root, target, K): :type root:...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def fromTreeToGraph(self, tree): :type tree: TreeNode :rtype: Graph - def updateDistance(self, graph, val): :type graph: Graph - def distanceK(self, root, target, K): :type root:...
f08b8a3f7de7a456a55573f3c4d8920a80f03a1a
<|skeleton|> class Solution: def fromTreeToGraph(self, tree): """:type tree: TreeNode :rtype: Graph""" <|body_0|> def updateDistance(self, graph, val): """:type graph: Graph""" <|body_1|> def distanceK(self, root, target, K): """:type root: TreeNode :type target: T...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def fromTreeToGraph(self, tree): """:type tree: TreeNode :rtype: Graph""" d = {} dfs(tree, None, d) return Graph(list(d.values())) def updateDistance(self, graph, val): """:type graph: Graph""" for node in graph.nodes: if node.val == v...
the_stack_v2_python_sparse
py/863.py
pipi32167/LeetCode
train
1
cb1ffcc43c6c875cbff0bc4c1baf50283c85937a
[ "logging.info('=============测试血糖=============')\nl = SignsDataView(self.driver)\nself.assertTrue(l.login_health())\na = random.randint(1, 3)\nif a == 1:\n b = '餐前半小时'\n c = random.uniform(2, 9)\n l.bloodGlucose('%.2f' % c, b)\n self.assertTrue(l.check_signsData())\nelif a == 2:\n b = '餐后1小时'\n c =...
<|body_start_0|> logging.info('=============测试血糖=============') l = SignsDataView(self.driver) self.assertTrue(l.login_health()) a = random.randint(1, 3) if a == 1: b = '餐前半小时' c = random.uniform(2, 9) l.bloodGlucose('%.2f' % c, b) ...
TestSignsData
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestSignsData: def test_bloodGlucose(self): """测试血糖 :return:""" <|body_0|> def test_bloodPressure(self): """测试血压 :return:""" <|body_1|> def test_bloodOxygen(self): """测试血氧 :return:""" <|body_2|> def test_pules(self): """测试脉搏 ...
stack_v2_sparse_classes_36k_train_020671
3,123
no_license
[ { "docstring": "测试血糖 :return:", "name": "test_bloodGlucose", "signature": "def test_bloodGlucose(self)" }, { "docstring": "测试血压 :return:", "name": "test_bloodPressure", "signature": "def test_bloodPressure(self)" }, { "docstring": "测试血氧 :return:", "name": "test_bloodOxygen", ...
6
null
Implement the Python class `TestSignsData` described below. Class description: Implement the TestSignsData class. Method signatures and docstrings: - def test_bloodGlucose(self): 测试血糖 :return: - def test_bloodPressure(self): 测试血压 :return: - def test_bloodOxygen(self): 测试血氧 :return: - def test_pules(self): 测试脉搏 :retur...
Implement the Python class `TestSignsData` described below. Class description: Implement the TestSignsData class. Method signatures and docstrings: - def test_bloodGlucose(self): 测试血糖 :return: - def test_bloodPressure(self): 测试血压 :return: - def test_bloodOxygen(self): 测试血氧 :return: - def test_pules(self): 测试脉搏 :retur...
d2b7819fd3687e0a011988fefab3e6fd70bb014a
<|skeleton|> class TestSignsData: def test_bloodGlucose(self): """测试血糖 :return:""" <|body_0|> def test_bloodPressure(self): """测试血压 :return:""" <|body_1|> def test_bloodOxygen(self): """测试血氧 :return:""" <|body_2|> def test_pules(self): """测试脉搏 ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestSignsData: def test_bloodGlucose(self): """测试血糖 :return:""" logging.info('=============测试血糖=============') l = SignsDataView(self.driver) self.assertTrue(l.login_health()) a = random.randint(1, 3) if a == 1: b = '餐前半小时' c = random.uni...
the_stack_v2_python_sparse
care_user/test_case/test_signsData.py
vothin/code
train
0
fefe4314a7e38bd4b026125831965d044fe2c171
[ "self.list = nums\nself.dic = {}\nself.k = len(nums)\nfor i, n in enumerate(self.list):\n self.dic[i] = n", "for i in range(self.k):\n self.list[i] = self.dic[i]\nreturn self.list", "index = list(range(self.k))\nrandom.shuffle(index)\nfor i, j in enumerate(index):\n self.list[i] = self.dic[j]\nreturn s...
<|body_start_0|> self.list = nums self.dic = {} self.k = len(nums) for i, n in enumerate(self.list): self.dic[i] = n <|end_body_0|> <|body_start_1|> for i in range(self.k): self.list[i] = self.dic[i] return self.list <|end_body_1|> <|body_start_2...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def reset(self): """Resets the array to its original configuration and return it. :rtype: List[int]""" <|body_1|> def shuffle(self): """Returns a random shuffling of the a...
stack_v2_sparse_classes_36k_train_020672
954
no_license
[ { "docstring": ":type nums: List[int]", "name": "__init__", "signature": "def __init__(self, nums)" }, { "docstring": "Resets the array to its original configuration and return it. :rtype: List[int]", "name": "reset", "signature": "def reset(self)" }, { "docstring": "Returns a ra...
3
stack_v2_sparse_classes_30k_train_011173
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] - def reset(self): Resets the array to its original configuration and return it. :rtype: List[int] - def shuffle(self): Returns a ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] - def reset(self): Resets the array to its original configuration and return it. :rtype: List[int] - def shuffle(self): Returns a ...
2f46f85e1e297b0a50fdb66956b1d05622a4063d
<|skeleton|> class Solution: def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def reset(self): """Resets the array to its original configuration and return it. :rtype: List[int]""" <|body_1|> def shuffle(self): """Returns a random shuffling of the a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def __init__(self, nums): """:type nums: List[int]""" self.list = nums self.dic = {} self.k = len(nums) for i, n in enumerate(self.list): self.dic[i] = n def reset(self): """Resets the array to its original configuration and return it....
the_stack_v2_python_sparse
dan/Problems/Medium/Array/384. Shuffle an Array/solution.py
xudaaaaan/Leetcode
train
0
9c9a19a0824d37c16807943e2598fd544c597393
[ "if not root:\n return None\nstack = [root]\nwhile len(stack) != 0:\n res = stack.pop()\n if node.left:\n stack.append(node.left)\n if node.right:\n stack.append(node.right)\n temp = node.left\n node.left = node.right\n node.right = temp\nreturn root", "if not root:\n return ...
<|body_start_0|> if not root: return None stack = [root] while len(stack) != 0: res = stack.pop() if node.left: stack.append(node.left) if node.right: stack.append(node.right) temp = node.left ...
Solution1
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution1: def mirrorTree(self, root: TreeNode) -> TreeNode: """辅助栈,或者辅助队列 利用栈(队列)遍历树的所有节点 node,并交换每个node的左右子树节点 算法流程: 1,特例处理:当root为空时候,直接返回null 2,初始化:栈,加入根节点root 3,循环交换:当栈stack为空时跳出: 1,出栈:记为node 2,添加子节点:将node左右节点入栈 3,交换:交换node的左右节点 4,返回值:返回根节点root 复杂度分析: 时间复杂度:O(n) n为二叉树的节点数量,建立二叉树镜像需要遍...
stack_v2_sparse_classes_36k_train_020673
4,378
no_license
[ { "docstring": "辅助栈,或者辅助队列 利用栈(队列)遍历树的所有节点 node,并交换每个node的左右子树节点 算法流程: 1,特例处理:当root为空时候,直接返回null 2,初始化:栈,加入根节点root 3,循环交换:当栈stack为空时跳出: 1,出栈:记为node 2,添加子节点:将node左右节点入栈 3,交换:交换node的左右节点 4,返回值:返回根节点root 复杂度分析: 时间复杂度:O(n) n为二叉树的节点数量,建立二叉树镜像需要遍历树的所有节点 空间复杂度:O(n) 最差情况下,栈最多同时存储n/2个结点", "name": "mirrorTree", "...
2
null
Implement the Python class `Solution1` described below. Class description: Implement the Solution1 class. Method signatures and docstrings: - def mirrorTree(self, root: TreeNode) -> TreeNode: 辅助栈,或者辅助队列 利用栈(队列)遍历树的所有节点 node,并交换每个node的左右子树节点 算法流程: 1,特例处理:当root为空时候,直接返回null 2,初始化:栈,加入根节点root 3,循环交换:当栈stack为空时跳出: 1,出栈:记...
Implement the Python class `Solution1` described below. Class description: Implement the Solution1 class. Method signatures and docstrings: - def mirrorTree(self, root: TreeNode) -> TreeNode: 辅助栈,或者辅助队列 利用栈(队列)遍历树的所有节点 node,并交换每个node的左右子树节点 算法流程: 1,特例处理:当root为空时候,直接返回null 2,初始化:栈,加入根节点root 3,循环交换:当栈stack为空时跳出: 1,出栈:记...
51943e2c2c4ec70c7c1d5b53c9fdf0a719428d7a
<|skeleton|> class Solution1: def mirrorTree(self, root: TreeNode) -> TreeNode: """辅助栈,或者辅助队列 利用栈(队列)遍历树的所有节点 node,并交换每个node的左右子树节点 算法流程: 1,特例处理:当root为空时候,直接返回null 2,初始化:栈,加入根节点root 3,循环交换:当栈stack为空时跳出: 1,出栈:记为node 2,添加子节点:将node左右节点入栈 3,交换:交换node的左右节点 4,返回值:返回根节点root 复杂度分析: 时间复杂度:O(n) n为二叉树的节点数量,建立二叉树镜像需要遍...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution1: def mirrorTree(self, root: TreeNode) -> TreeNode: """辅助栈,或者辅助队列 利用栈(队列)遍历树的所有节点 node,并交换每个node的左右子树节点 算法流程: 1,特例处理:当root为空时候,直接返回null 2,初始化:栈,加入根节点root 3,循环交换:当栈stack为空时跳出: 1,出栈:记为node 2,添加子节点:将node左右节点入栈 3,交换:交换node的左右节点 4,返回值:返回根节点root 复杂度分析: 时间复杂度:O(n) n为二叉树的节点数量,建立二叉树镜像需要遍历树的所有节点 空间复杂度:...
the_stack_v2_python_sparse
剑指offer/PythonVersion/27_二叉树的镜像.py
LeBron-Jian/BasicAlgorithmPractice
train
13
e37bc3396897627da9d3448800fdf4878fa9ffcd
[ "from diplomacy_research.utils.tensorflow import tf\nfrom diplomacy_research.models.layers.graph_convolution import GraphConvolution, preprocess_adjacency\nhps = lambda hparam_name: self.hparams[hparam_name]\nrelu = tf.nn.relu\nnorm_adjacency = preprocess_adjacency(get_adjacency_matrix())\nnorm_adjacency = tf.tile(...
<|body_start_0|> from diplomacy_research.utils.tensorflow import tf from diplomacy_research.models.layers.graph_convolution import GraphConvolution, preprocess_adjacency hps = lambda hparam_name: self.hparams[hparam_name] relu = tf.nn.relu norm_adjacency = preprocess_adjacency(ge...
Value Model - Evaluates the value of a state for a given power
ValueModel
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ValueModel: """Value Model - Evaluates the value of a state for a given power""" def _get_board_value(self, board_state, current_power, name='board_state_value', reuse=None): """Computes the estimated value of a board state :param board_state: The board state - (batch, NB_NODES, NB_F...
stack_v2_sparse_classes_36k_train_020674
7,397
permissive
[ { "docstring": "Computes the estimated value of a board state :param board_state: The board state - (batch, NB_NODES, NB_FEATURES) :param current_power: The power for which we want the board value - (batch,) :param name: The name to use for the operaton :param reuse: Whether to reuse or not the weights from ano...
2
stack_v2_sparse_classes_30k_train_006105
Implement the Python class `ValueModel` described below. Class description: Value Model - Evaluates the value of a state for a given power Method signatures and docstrings: - def _get_board_value(self, board_state, current_power, name='board_state_value', reuse=None): Computes the estimated value of a board state :pa...
Implement the Python class `ValueModel` described below. Class description: Value Model - Evaluates the value of a state for a given power Method signatures and docstrings: - def _get_board_value(self, board_state, current_power, name='board_state_value', reuse=None): Computes the estimated value of a board state :pa...
e752f02f34936bbae904815708904cabda554b57
<|skeleton|> class ValueModel: """Value Model - Evaluates the value of a state for a given power""" def _get_board_value(self, board_state, current_power, name='board_state_value', reuse=None): """Computes the estimated value of a board state :param board_state: The board state - (batch, NB_NODES, NB_F...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ValueModel: """Value Model - Evaluates the value of a state for a given power""" def _get_board_value(self, board_state, current_power, name='board_state_value', reuse=None): """Computes the estimated value of a board state :param board_state: The board state - (batch, NB_NODES, NB_FEATURES) :par...
the_stack_v2_python_sparse
diplomacy_research/models/value/v001_val_relu_7/model.py
JACKHAHA363/research
train
0
bd0113a620af4243dc01c49558ab8b5d01229913
[ "if nums is None or target is None:\n return []\nlength = len(nums)\nif length < 2:\n return []\nrvt = sorted(enumerate(nums), key=lambda x: x[1])\nleft = 0\nright = length - 1\nwhile left < right:\n sum = rvt[left][1] + rvt[right][1]\n if sum == target:\n return sorted([rvt[left][0], rvt[right][...
<|body_start_0|> if nums is None or target is None: return [] length = len(nums) if length < 2: return [] rvt = sorted(enumerate(nums), key=lambda x: x[1]) left = 0 right = length - 1 while left < right: sum = rvt[left][1] + rvt...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def twoSum(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" <|body_0|> def findTarget(self, root, k): """:type root: TreeNode :type k: int :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> if ...
stack_v2_sparse_classes_36k_train_020675
1,777
no_license
[ { "docstring": ":type nums: List[int] :type target: int :rtype: List[int]", "name": "twoSum", "signature": "def twoSum(self, nums, target)" }, { "docstring": ":type root: TreeNode :type k: int :rtype: bool", "name": "findTarget", "signature": "def findTarget(self, root, k)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def twoSum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int] - def findTarget(self, root, k): :type root: TreeNode :type k: int :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def twoSum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int] - def findTarget(self, root, k): :type root: TreeNode :type k: int :rtype: bool <|skele...
c1f27c0cec80585095ce98a678ab85079e1a4c46
<|skeleton|> class Solution: def twoSum(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" <|body_0|> def findTarget(self, root, k): """:type root: TreeNode :type k: int :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def twoSum(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" if nums is None or target is None: return [] length = len(nums) if length < 2: return [] rvt = sorted(enumerate(nums), key=lambda x: x[1]) ...
the_stack_v2_python_sparse
Leetcode/1_TwoSum.py
wbq9224/Leetcode_Python
train
0
9144553dbf29ab5bef749d0eedf3439cbfa05ab7
[ "self.rects = rects\nself.range = [0]\nself.summ = 0\nfor rect in rects:\n self.summ += (rect[2] - rect[0] + 1) * (rect[3] - rect[1] + 1)\n self.range.append(self.summ)", "n = random.randint(0, self.summ - 1)\ni = bisect.bisect(self.range, n)\nrect = self.rects[i - 1]\nn -= self.range[i - 1]\nx = rect[0] + ...
<|body_start_0|> self.rects = rects self.range = [0] self.summ = 0 for rect in rects: self.summ += (rect[2] - rect[0] + 1) * (rect[3] - rect[1] + 1) self.range.append(self.summ) <|end_body_0|> <|body_start_1|> n = random.randint(0, self.summ - 1) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def __init__(self, rects): """:type rects: List[List[int]]""" <|body_0|> def pick(self): """:rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.rects = rects self.range = [0] self.summ = 0 for rec...
stack_v2_sparse_classes_36k_train_020676
2,975
no_license
[ { "docstring": ":type rects: List[List[int]]", "name": "__init__", "signature": "def __init__(self, rects)" }, { "docstring": ":rtype: List[int]", "name": "pick", "signature": "def pick(self)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, rects): :type rects: List[List[int]] - def pick(self): :rtype: List[int]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, rects): :type rects: List[List[int]] - def pick(self): :rtype: List[int] <|skeleton|> class Solution: def __init__(self, rects): """:type rects: ...
7a459e9742958e63be8886874904e5ab2489411a
<|skeleton|> class Solution: def __init__(self, rects): """:type rects: List[List[int]]""" <|body_0|> def pick(self): """:rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def __init__(self, rects): """:type rects: List[List[int]]""" self.rects = rects self.range = [0] self.summ = 0 for rect in rects: self.summ += (rect[2] - rect[0] + 1) * (rect[3] - rect[1] + 1) self.range.append(self.summ) def pick...
the_stack_v2_python_sparse
Medium/497.py
Hellofafar/Leetcode
train
6
8fd103c2892d529f5fd66ed603ad285900c9f5c9
[ "nbm = self.notebook_manager\nnbm.restore_checkpoint(notebook_id, checkpoint_id)\nself.set_status(204)\nself.finish()", "nbm = self.notebook_manager\nnbm.delte_checkpoint(notebook_id, checkpoint_id)\nself.set_status(204)\nself.finish()" ]
<|body_start_0|> nbm = self.notebook_manager nbm.restore_checkpoint(notebook_id, checkpoint_id) self.set_status(204) self.finish() <|end_body_0|> <|body_start_1|> nbm = self.notebook_manager nbm.delte_checkpoint(notebook_id, checkpoint_id) self.set_status(204) ...
ModifyNotebookCheckpointsHandler
[ "Apache-2.0", "BSD-3-Clause", "LicenseRef-scancode-unknown" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ModifyNotebookCheckpointsHandler: def post(self, notebook_id, checkpoint_id): """post restores a notebook from a checkpoint""" <|body_0|> def delete(self, notebook_id, checkpoint_id): """delete clears a checkpoint for a given notebook""" <|body_1|> <|end_ske...
stack_v2_sparse_classes_36k_train_020677
5,267
permissive
[ { "docstring": "post restores a notebook from a checkpoint", "name": "post", "signature": "def post(self, notebook_id, checkpoint_id)" }, { "docstring": "delete clears a checkpoint for a given notebook", "name": "delete", "signature": "def delete(self, notebook_id, checkpoint_id)" } ]
2
stack_v2_sparse_classes_30k_train_016858
Implement the Python class `ModifyNotebookCheckpointsHandler` described below. Class description: Implement the ModifyNotebookCheckpointsHandler class. Method signatures and docstrings: - def post(self, notebook_id, checkpoint_id): post restores a notebook from a checkpoint - def delete(self, notebook_id, checkpoint_...
Implement the Python class `ModifyNotebookCheckpointsHandler` described below. Class description: Implement the ModifyNotebookCheckpointsHandler class. Method signatures and docstrings: - def post(self, notebook_id, checkpoint_id): post restores a notebook from a checkpoint - def delete(self, notebook_id, checkpoint_...
2c9002f16bb5c265e0d14f4a2314c86eeaa35cb6
<|skeleton|> class ModifyNotebookCheckpointsHandler: def post(self, notebook_id, checkpoint_id): """post restores a notebook from a checkpoint""" <|body_0|> def delete(self, notebook_id, checkpoint_id): """delete clears a checkpoint for a given notebook""" <|body_1|> <|end_ske...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ModifyNotebookCheckpointsHandler: def post(self, notebook_id, checkpoint_id): """post restores a notebook from a checkpoint""" nbm = self.notebook_manager nbm.restore_checkpoint(notebook_id, checkpoint_id) self.set_status(204) self.finish() def delete(self, noteboo...
the_stack_v2_python_sparse
pkgs/ipython-1.2.1-py27_0/lib/python2.7/site-packages/IPython/html/services/notebooks/handlers.py
wangyum/Anaconda
train
11
c2d15232d2f0fa7e58e0256d8f67549389b49b26
[ "engine = db_connect()\ncreate_table(engine)\nself.Session = sessionmaker(bind=engine)", "session = self.Session()\ndoc = Docs()\ndoc.authors = item['authors']\ndoc.year = item['year']\ndoc.title = item['title']\ndoc.journal = item['journal']\ndoc.bibref_details = item['bibref_details']\ndoc.volume = item['volume...
<|body_start_0|> engine = db_connect() create_table(engine) self.Session = sessionmaker(bind=engine) <|end_body_0|> <|body_start_1|> session = self.Session() doc = Docs() doc.authors = item['authors'] doc.year = item['year'] doc.title = item['title'] ...
This is a custom Item Pipeline class.
ZbPipeline
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ZbPipeline: """This is a custom Item Pipeline class.""" def __init__(self): """Init method, that instantiates an engine and create a table by calling zb.models.py methods, and start a Session.""" <|body_0|> def process_item(self, item, spider): """Overwrited the ...
stack_v2_sparse_classes_36k_train_020678
2,127
permissive
[ { "docstring": "Init method, that instantiates an engine and create a table by calling zb.models.py methods, and start a Session.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Overwrited the process_item() required method for custom Item Proces- sors. Args: item (scr...
2
stack_v2_sparse_classes_30k_val_000971
Implement the Python class `ZbPipeline` described below. Class description: This is a custom Item Pipeline class. Method signatures and docstrings: - def __init__(self): Init method, that instantiates an engine and create a table by calling zb.models.py methods, and start a Session. - def process_item(self, item, spi...
Implement the Python class `ZbPipeline` described below. Class description: This is a custom Item Pipeline class. Method signatures and docstrings: - def __init__(self): Init method, that instantiates an engine and create a table by calling zb.models.py methods, and start a Session. - def process_item(self, item, spi...
c684be7345988ec518a406a42bd95a0778e1d4e9
<|skeleton|> class ZbPipeline: """This is a custom Item Pipeline class.""" def __init__(self): """Init method, that instantiates an engine and create a table by calling zb.models.py methods, and start a Session.""" <|body_0|> def process_item(self, item, spider): """Overwrited the ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ZbPipeline: """This is a custom Item Pipeline class.""" def __init__(self): """Init method, that instantiates an engine and create a table by calling zb.models.py methods, and start a Session.""" engine = db_connect() create_table(engine) self.Session = sessionmaker(bind=e...
the_stack_v2_python_sparse
etl/extract/zb/pipelines.py
mguidoti/DSND-p6-capstone
train
0
8c9c14c67e2c0dd60900ff0110504cb21224f1f2
[ "user = create_user()\nlist_sensor = []\nsensor1 = create_sensor('test1', 'code1', user)\nlist_sensor.append(sensor1)\nsensor2 = create_sensor('test2', 'code2', user)\nlist_sensor.append(sensor2)\nself.assertEqual(len(list_sensor), 2)", "user = create_user()\ncode_mouse_event = 'The event is attached to its targe...
<|body_start_0|> user = create_user() list_sensor = [] sensor1 = create_sensor('test1', 'code1', user) list_sensor.append(sensor1) sensor2 = create_sensor('test2', 'code2', user) list_sensor.append(sensor2) self.assertEqual(len(list_sensor), 2) <|end_body_0|> <|b...
SensorTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SensorTests: def test_list_Sensor(self): """Test for a list of Sensor :return:""" <|body_0|> def test_create_Sensor(self): """Test for a created Sensor :return:""" <|body_1|> def test_update_Sensor(self): """Test for a update Sensor :return:""" ...
stack_v2_sparse_classes_36k_train_020679
3,684
no_license
[ { "docstring": "Test for a list of Sensor :return:", "name": "test_list_Sensor", "signature": "def test_list_Sensor(self)" }, { "docstring": "Test for a created Sensor :return:", "name": "test_create_Sensor", "signature": "def test_create_Sensor(self)" }, { "docstring": "Test for...
4
stack_v2_sparse_classes_30k_train_003860
Implement the Python class `SensorTests` described below. Class description: Implement the SensorTests class. Method signatures and docstrings: - def test_list_Sensor(self): Test for a list of Sensor :return: - def test_create_Sensor(self): Test for a created Sensor :return: - def test_update_Sensor(self): Test for a...
Implement the Python class `SensorTests` described below. Class description: Implement the SensorTests class. Method signatures and docstrings: - def test_list_Sensor(self): Test for a list of Sensor :return: - def test_create_Sensor(self): Test for a created Sensor :return: - def test_update_Sensor(self): Test for a...
8c8f76acb85baff1cd2d8258f686515d08678350
<|skeleton|> class SensorTests: def test_list_Sensor(self): """Test for a list of Sensor :return:""" <|body_0|> def test_create_Sensor(self): """Test for a created Sensor :return:""" <|body_1|> def test_update_Sensor(self): """Test for a update Sensor :return:""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SensorTests: def test_list_Sensor(self): """Test for a list of Sensor :return:""" user = create_user() list_sensor = [] sensor1 = create_sensor('test1', 'code1', user) list_sensor.append(sensor1) sensor2 = create_sensor('test2', 'code2', user) list_senso...
the_stack_v2_python_sparse
probe_project/apps/probe_dispatcher/tests.py
liflab/cornipickle-probe
train
0
684ac5d020af54b814e062e5262026b8dfb17b83
[ "test_user1 = self.add_user('something@email.com', 'Some', 'Thing', 'Mr')\ntest_user2 = self.add_user('something2@email.com', 'Some', 'Thing2', 'Ms')\nevent_admin = self.add_user('event_admin@ea.com', 'event_admin', is_admin=True)\nevent = self.add_event(name={'en': 'Tech Talk'}, description={'en': 'tech talking'},...
<|body_start_0|> test_user1 = self.add_user('something@email.com', 'Some', 'Thing', 'Mr') test_user2 = self.add_user('something2@email.com', 'Some', 'Thing2', 'Ms') event_admin = self.add_user('event_admin@ea.com', 'event_admin', is_admin=True) event = self.add_event(name={'en': 'Tech Ta...
OfferListAPITest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OfferListAPITest: def _seed_static_data(self): """Seed static data for the tests.""" <|body_0|> def test_offer_list(self): """Test that an offer list is returned.""" <|body_1|> <|end_skeleton|> <|body_start_0|> test_user1 = self.add_user('something@...
stack_v2_sparse_classes_36k_train_020680
22,229
permissive
[ { "docstring": "Seed static data for the tests.", "name": "_seed_static_data", "signature": "def _seed_static_data(self)" }, { "docstring": "Test that an offer list is returned.", "name": "test_offer_list", "signature": "def test_offer_list(self)" } ]
2
null
Implement the Python class `OfferListAPITest` described below. Class description: Implement the OfferListAPITest class. Method signatures and docstrings: - def _seed_static_data(self): Seed static data for the tests. - def test_offer_list(self): Test that an offer list is returned.
Implement the Python class `OfferListAPITest` described below. Class description: Implement the OfferListAPITest class. Method signatures and docstrings: - def _seed_static_data(self): Seed static data for the tests. - def test_offer_list(self): Test that an offer list is returned. <|skeleton|> class OfferListAPITes...
c0002c877ee65dbed282283614be8f3ea5ec750b
<|skeleton|> class OfferListAPITest: def _seed_static_data(self): """Seed static data for the tests.""" <|body_0|> def test_offer_list(self): """Test that an offer list is returned.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OfferListAPITest: def _seed_static_data(self): """Seed static data for the tests.""" test_user1 = self.add_user('something@email.com', 'Some', 'Thing', 'Mr') test_user2 = self.add_user('something2@email.com', 'Some', 'Thing2', 'Ms') event_admin = self.add_user('event_admin@ea.c...
the_stack_v2_python_sparse
api/app/registration/tests.py
deep-learning-indaba/Baobab
train
59
35b393ed44d3d82c6785f03beb2b1ae969e9d63b
[ "currency_id = False\naccount_move = self.account_move_id\nif account_move:\n if account_move.currency_id:\n currency_id = account_move.currency_id\n elif account_move.account_id.currency_id:\n currency_id = account_move.account_id.currency_id.id\n else:\n currency_id = account_move.co...
<|body_start_0|> currency_id = False account_move = self.account_move_id if account_move: if account_move.currency_id: currency_id = account_move.currency_id elif account_move.account_id.currency_id: currency_id = account_move.account_id.cu...
Credit lines to reconcile payments from an invoice
invoice_reconciliation_credit_line
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class invoice_reconciliation_credit_line: """Credit lines to reconcile payments from an invoice""" def _compute_currency_id(self): """On récupère la devise de l'écriture comptable, ou celle du compte de l'écriture comptable, ou celle de la société de l'écriture comptable""" <|body_...
stack_v2_sparse_classes_36k_train_020681
36,478
no_license
[ { "docstring": "On récupère la devise de l'écriture comptable, ou celle du compte de l'écriture comptable, ou celle de la société de l'écriture comptable", "name": "_compute_currency_id", "signature": "def _compute_currency_id(self)" }, { "docstring": "Au changement du montant à réconcilier, on ...
2
null
Implement the Python class `invoice_reconciliation_credit_line` described below. Class description: Credit lines to reconcile payments from an invoice Method signatures and docstrings: - def _compute_currency_id(self): On récupère la devise de l'écriture comptable, ou celle du compte de l'écriture comptable, ou celle...
Implement the Python class `invoice_reconciliation_credit_line` described below. Class description: Credit lines to reconcile payments from an invoice Method signatures and docstrings: - def _compute_currency_id(self): On récupère la devise de l'écriture comptable, ou celle du compte de l'écriture comptable, ou celle...
eb394e1f79ba1995da2dcd81adfdd511c22caff9
<|skeleton|> class invoice_reconciliation_credit_line: """Credit lines to reconcile payments from an invoice""" def _compute_currency_id(self): """On récupère la devise de l'écriture comptable, ou celle du compte de l'écriture comptable, ou celle de la société de l'écriture comptable""" <|body_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class invoice_reconciliation_credit_line: """Credit lines to reconcile payments from an invoice""" def _compute_currency_id(self): """On récupère la devise de l'écriture comptable, ou celle du compte de l'écriture comptable, ou celle de la société de l'écriture comptable""" currency_id = False ...
the_stack_v2_python_sparse
OpenPROD/openprod-addons/account_openprod/wizard/invoice_reconciliation.py
kazacube-mziouadi/ceci
train
0
5d23d239ab717bcc29c49d9e6d08c13efd5cd720
[ "if not root:\n return ''\nqueue = collections.deque([root])\nres = []\nwhile queue:\n node = queue.popleft()\n res.append(str(node.val) if node else 'null')\n if node:\n queue.append(node.left)\n queue.append(node.right)\nreturn ' '.join(res)", "if not data:\n return None\nbfs_order ...
<|body_start_0|> if not root: return '' queue = collections.deque([root]) res = [] while queue: node = queue.popleft() res.append(str(node.val) if node else 'null') if node: queue.append(node.left) queue.appe...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_020682
4,000
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
14193efc60bd3ec9cef48e777fdba022ce190285
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" if not root: return '' queue = collections.deque([root]) res = [] while queue: node = queue.popleft() res.append(str(node.val)...
the_stack_v2_python_sparse
src/297.py
liuyaqiao/Algorithms
train
0
b47fdae17486036f89ab53ec02ffb1d4390ee209
[ "shape_list = x.get_shape().as_list()\nassert len(shape_list) == 3\nself.x = x\nself.layer_index = layer_index\nself.d_model = d_model\nself.d_ff = d_ff\nself.initializer = tf.random_normal_initializer(stddev=0.1)", "output = None\ninput = tf.expand_dims(self.x, axis=3)\noutput_conv1 = tf.layers.conv2d(input, fil...
<|body_start_0|> shape_list = x.get_shape().as_list() assert len(shape_list) == 3 self.x = x self.layer_index = layer_index self.d_model = d_model self.d_ff = d_ff self.initializer = tf.random_normal_initializer(stddev=0.1) <|end_body_0|> <|body_start_1|> ...
position-wise feed forward networks. formula as below: FFN(x)=max(0,xW1+b1)W2+b2
PositionWiseFeedFoward
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PositionWiseFeedFoward: """position-wise feed forward networks. formula as below: FFN(x)=max(0,xW1+b1)W2+b2""" def __init__(self, x, layer_index, d_model=512, d_ff=2048): """:param x: shape should be:[batch,sequence_length,d_model] :param layer_index: index of layer :return: shape:[s...
stack_v2_sparse_classes_36k_train_020683
3,327
permissive
[ { "docstring": ":param x: shape should be:[batch,sequence_length,d_model] :param layer_index: index of layer :return: shape:[sequence_length,d_model]", "name": "__init__", "signature": "def __init__(self, x, layer_index, d_model=512, d_ff=2048)" }, { "docstring": "x: [batch,sequence_length,d_mod...
2
stack_v2_sparse_classes_30k_train_020359
Implement the Python class `PositionWiseFeedFoward` described below. Class description: position-wise feed forward networks. formula as below: FFN(x)=max(0,xW1+b1)W2+b2 Method signatures and docstrings: - def __init__(self, x, layer_index, d_model=512, d_ff=2048): :param x: shape should be:[batch,sequence_length,d_mo...
Implement the Python class `PositionWiseFeedFoward` described below. Class description: position-wise feed forward networks. formula as below: FFN(x)=max(0,xW1+b1)W2+b2 Method signatures and docstrings: - def __init__(self, x, layer_index, d_model=512, d_ff=2048): :param x: shape should be:[batch,sequence_length,d_mo...
091ff9910839ba5053302383af99762c0c91a992
<|skeleton|> class PositionWiseFeedFoward: """position-wise feed forward networks. formula as below: FFN(x)=max(0,xW1+b1)W2+b2""" def __init__(self, x, layer_index, d_model=512, d_ff=2048): """:param x: shape should be:[batch,sequence_length,d_model] :param layer_index: index of layer :return: shape:[s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PositionWiseFeedFoward: """position-wise feed forward networks. formula as below: FFN(x)=max(0,xW1+b1)W2+b2""" def __init__(self, x, layer_index, d_model=512, d_ff=2048): """:param x: shape should be:[batch,sequence_length,d_model] :param layer_index: index of layer :return: shape:[sequence_lengt...
the_stack_v2_python_sparse
a07_Transformer/a2_poistion_wise_feed_forward.py
SunYanCN/text_classification
train
2
639f990371bf20341eeb8b78734bac7be8cf8876
[ "oper = {'and': 'intersection', 'or': 'union', 'not': 'complement'}\nif len(item) < 2 or len(item) > 3:\n raise TypeError('{} must be exactly 1 operator and 1-2 items'.format(item))\nself._check('operator', item[0], str, choices=oper.keys())\nself._check('operand1', item[1], (int, tuple))\nif len(item) == 3:\n ...
<|body_start_0|> oper = {'and': 'intersection', 'or': 'union', 'not': 'complement'} if len(item) < 2 or len(item) > 3: raise TypeError('{} must be exactly 1 operator and 1-2 items'.format(item)) self._check('operator', item[0], str, choices=oper.keys()) self._check('operand1'...
SCEndpoint
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SCEndpoint: def _combo_expansion(self, item): """Expands the asset combination expressions from nested tuples to the nested dictionary structure that's expected. Args: item Returns: :obj:`dict`: The dictionary structure of the expanded asset list combinations.""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_020684
12,037
permissive
[ { "docstring": "Expands the asset combination expressions from nested tuples to the nested dictionary structure that's expected. Args: item Returns: :obj:`dict`: The dictionary structure of the expanded asset list combinations.", "name": "_combo_expansion", "signature": "def _combo_expansion(self, item)...
3
stack_v2_sparse_classes_30k_train_014850
Implement the Python class `SCEndpoint` described below. Class description: Implement the SCEndpoint class. Method signatures and docstrings: - def _combo_expansion(self, item): Expands the asset combination expressions from nested tuples to the nested dictionary structure that's expected. Args: item Returns: :obj:`d...
Implement the Python class `SCEndpoint` described below. Class description: Implement the SCEndpoint class. Method signatures and docstrings: - def _combo_expansion(self, item): Expands the asset combination expressions from nested tuples to the nested dictionary structure that's expected. Args: item Returns: :obj:`d...
4e31049891f55016168b14ae30d332a965523640
<|skeleton|> class SCEndpoint: def _combo_expansion(self, item): """Expands the asset combination expressions from nested tuples to the nested dictionary structure that's expected. Args: item Returns: :obj:`dict`: The dictionary structure of the expanded asset list combinations.""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SCEndpoint: def _combo_expansion(self, item): """Expands the asset combination expressions from nested tuples to the nested dictionary structure that's expected. Args: item Returns: :obj:`dict`: The dictionary structure of the expanded asset list combinations.""" oper = {'and': 'intersection',...
the_stack_v2_python_sparse
tenable/sc/base.py
tenable/pyTenable
train
300
3d085d472f1e2d7c8ab69f1b449bc40a005b486d
[ "if self.parent_stack:\n return self.parent_stack[-1].segments[:self.segment_idx]\nelse:\n return tuple()", "if self.parent_stack:\n return self.parent_stack[-1].segments[self.segment_idx + 1:]\nelse:\n return tuple()" ]
<|body_start_0|> if self.parent_stack: return self.parent_stack[-1].segments[:self.segment_idx] else: return tuple() <|end_body_0|> <|body_start_1|> if self.parent_stack: return self.parent_stack[-1].segments[self.segment_idx + 1:] else: r...
Class for holding the context passed to rule eval functions.
RuleContext
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RuleContext: """Class for holding the context passed to rule eval functions.""" def siblings_pre(self) -> Tuple[BaseSegment, ...]: """Return sibling segments prior to self.segment.""" <|body_0|> def siblings_post(self) -> Tuple[BaseSegment, ...]: """Return siblin...
stack_v2_sparse_classes_36k_train_020685
1,767
permissive
[ { "docstring": "Return sibling segments prior to self.segment.", "name": "siblings_pre", "signature": "def siblings_pre(self) -> Tuple[BaseSegment, ...]" }, { "docstring": "Return sibling segments after self.segment.", "name": "siblings_post", "signature": "def siblings_post(self) -> Tup...
2
null
Implement the Python class `RuleContext` described below. Class description: Class for holding the context passed to rule eval functions. Method signatures and docstrings: - def siblings_pre(self) -> Tuple[BaseSegment, ...]: Return sibling segments prior to self.segment. - def siblings_post(self) -> Tuple[BaseSegment...
Implement the Python class `RuleContext` described below. Class description: Class for holding the context passed to rule eval functions. Method signatures and docstrings: - def siblings_pre(self) -> Tuple[BaseSegment, ...]: Return sibling segments prior to self.segment. - def siblings_post(self) -> Tuple[BaseSegment...
a66da908907ee1eaf09d88a731025da29e7fca07
<|skeleton|> class RuleContext: """Class for holding the context passed to rule eval functions.""" def siblings_pre(self) -> Tuple[BaseSegment, ...]: """Return sibling segments prior to self.segment.""" <|body_0|> def siblings_post(self) -> Tuple[BaseSegment, ...]: """Return siblin...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RuleContext: """Class for holding the context passed to rule eval functions.""" def siblings_pre(self) -> Tuple[BaseSegment, ...]: """Return sibling segments prior to self.segment.""" if self.parent_stack: return self.parent_stack[-1].segments[:self.segment_idx] else: ...
the_stack_v2_python_sparse
src/sqlfluff/core/rules/context.py
sqlfluff/sqlfluff
train
5,931
79eabc0e2877e04d2205ef39e5139fd615cd71b6
[ "self.screen = screen\nself.rect = rect\nself.font_size = font_size\nself.txt_color = (255, 255, 255)\nself.images = images\nself.text = ''\nself.set_text(text)\nself.action = action\nself.is_down = False\nself.user_data = None\nself.enabled = True\nself.prev_image = None\nself.buttonClick = pygame.mixer.Sound('dat...
<|body_start_0|> self.screen = screen self.rect = rect self.font_size = font_size self.txt_color = (255, 255, 255) self.images = images self.text = '' self.set_text(text) self.action = action self.is_down = False self.user_data = None ...
Button
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Button: def __init__(self, screen, rect, text='', font_size=20, action=None, images=None): """The button needs a rect (to set position and size), a label and (optionally) an action. (the action is a function to be called when the button is pressed). Finaly a tuple of 4 images can be pass...
stack_v2_sparse_classes_36k_train_020686
4,970
no_license
[ { "docstring": "The button needs a rect (to set position and size), a label and (optionally) an action. (the action is a function to be called when the button is pressed). Finaly a tuple of 4 images can be passed: normal, hover, down & disabled. when a button is clicked, it also creates an event of type Events....
5
stack_v2_sparse_classes_30k_train_014814
Implement the Python class `Button` described below. Class description: Implement the Button class. Method signatures and docstrings: - def __init__(self, screen, rect, text='', font_size=20, action=None, images=None): The button needs a rect (to set position and size), a label and (optionally) an action. (the action...
Implement the Python class `Button` described below. Class description: Implement the Button class. Method signatures and docstrings: - def __init__(self, screen, rect, text='', font_size=20, action=None, images=None): The button needs a rect (to set position and size), a label and (optionally) an action. (the action...
cbec4381d940a80ac4f888777ccbdee3f4fa0941
<|skeleton|> class Button: def __init__(self, screen, rect, text='', font_size=20, action=None, images=None): """The button needs a rect (to set position and size), a label and (optionally) an action. (the action is a function to be called when the button is pressed). Finaly a tuple of 4 images can be pass...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Button: def __init__(self, screen, rect, text='', font_size=20, action=None, images=None): """The button needs a rect (to set position and size), a label and (optionally) an action. (the action is a function to be called when the button is pressed). Finaly a tuple of 4 images can be passed: normal, ho...
the_stack_v2_python_sparse
project/build/exe.win-amd64-3.6/GUI/button.py
MatisseGh/RiskProject
train
0
4d1eb8d7db518a4fcaf6c84aad66d55505a3e4c8
[ "result = 0\nwhile n != 0:\n digit = n % 10\n result += digit\n n /= 10\n if n != 0:\n result *= 10\nreturn result", "if x < 0:\n return False\nreturn self.reverseInteger(abs(x)) == abs(x)" ]
<|body_start_0|> result = 0 while n != 0: digit = n % 10 result += digit n /= 10 if n != 0: result *= 10 return result <|end_body_0|> <|body_start_1|> if x < 0: return False return self.reverseInteger(ab...
Solution reverses the integer, then checks if the reversed integer equals the original integer. If it does, it's a palindrome
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """Solution reverses the integer, then checks if the reversed integer equals the original integer. If it does, it's a palindrome""" def reverseInteger(self, n): """Reverses a number and returns the reversed number""" <|body_0|> def isPalindrome(self, x): ...
stack_v2_sparse_classes_36k_train_020687
776
no_license
[ { "docstring": "Reverses a number and returns the reversed number", "name": "reverseInteger", "signature": "def reverseInteger(self, n)" }, { "docstring": ":type x: int :rtype: bool", "name": "isPalindrome", "signature": "def isPalindrome(self, x)" } ]
2
stack_v2_sparse_classes_30k_train_013292
Implement the Python class `Solution` described below. Class description: Solution reverses the integer, then checks if the reversed integer equals the original integer. If it does, it's a palindrome Method signatures and docstrings: - def reverseInteger(self, n): Reverses a number and returns the reversed number - d...
Implement the Python class `Solution` described below. Class description: Solution reverses the integer, then checks if the reversed integer equals the original integer. If it does, it's a palindrome Method signatures and docstrings: - def reverseInteger(self, n): Reverses a number and returns the reversed number - d...
f5bb79266f2bfed9fba0b92e06b93b308eb49767
<|skeleton|> class Solution: """Solution reverses the integer, then checks if the reversed integer equals the original integer. If it does, it's a palindrome""" def reverseInteger(self, n): """Reverses a number and returns the reversed number""" <|body_0|> def isPalindrome(self, x): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: """Solution reverses the integer, then checks if the reversed integer equals the original integer. If it does, it's a palindrome""" def reverseInteger(self, n): """Reverses a number and returns the reversed number""" result = 0 while n != 0: digit = n % 10 ...
the_stack_v2_python_sparse
palindrome_number.py
DarinM223/leetcode
train
0
a9dda2b5872527b3da007e45701ac6982b8b5fa6
[ "cls._insert_properties(model=model, interface=cls)\ncls._insert_methods(model=model, interface=cls)\ncls._insert_functions(model=model, interface=cls)", "for property_name, default_value in interface._PROPERTIES.items():\n if property_name not in model.__dir__():\n setattr(model, property_name, copy.co...
<|body_start_0|> cls._insert_properties(model=model, interface=cls) cls._insert_methods(model=model, interface=cls) cls._insert_functions(model=model, interface=cls) <|end_body_0|> <|body_start_1|> for property_name, default_value in interface._PROPERTIES.items(): if propert...
An abstract class for enriching an object interface with the properties, methods and functions written below. A class inheriting MLRun interface should insert what ever it needs to be inserted to the object to the following private attributes: '_PROPERTIES', '_METHODS' and '_FUNCTIONS'. Then it should implement 'add_in...
MLRunInterface
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MLRunInterface: """An abstract class for enriching an object interface with the properties, methods and functions written below. A class inheriting MLRun interface should insert what ever it needs to be inserted to the object to the following private attributes: '_PROPERTIES', '_METHODS' and '_FU...
stack_v2_sparse_classes_36k_train_020688
3,226
permissive
[ { "docstring": "Enrich the model object with this class properties, methods and functions so it will have MLRun specific features. :param model: The object to enrich his interface", "name": "add_interface", "signature": "def add_interface(cls, model: Model)" }, { "docstring": "Insert the propert...
4
null
Implement the Python class `MLRunInterface` described below. Class description: An abstract class for enriching an object interface with the properties, methods and functions written below. A class inheriting MLRun interface should insert what ever it needs to be inserted to the object to the following private attribu...
Implement the Python class `MLRunInterface` described below. Class description: An abstract class for enriching an object interface with the properties, methods and functions written below. A class inheriting MLRun interface should insert what ever it needs to be inserted to the object to the following private attribu...
97209b27ccf3daf8f202a1a2bb1b01abd537ad70
<|skeleton|> class MLRunInterface: """An abstract class for enriching an object interface with the properties, methods and functions written below. A class inheriting MLRun interface should insert what ever it needs to be inserted to the object to the following private attributes: '_PROPERTIES', '_METHODS' and '_FU...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MLRunInterface: """An abstract class for enriching an object interface with the properties, methods and functions written below. A class inheriting MLRun interface should insert what ever it needs to be inserted to the object to the following private attributes: '_PROPERTIES', '_METHODS' and '_FUNCTIONS'. The...
the_stack_v2_python_sparse
mlrun/frameworks/_common/mlrun_interface.py
eran-nussbaum/mlrun
train
0
e8f7cbbde808a8878f904bf9f211dad0917ca9a6
[ "self.sensor = sensor = eyesensor\nself.sensor_view = sensor.view\nself.sensor.view = self.view\nself.age = 0\nself.samples = []\nnumber_of_samples = min(number_of_samples, sample_period)\nself.schedule = random.sample(range(sample_period), number_of_samples)\nself.schedule.sort(reverse=True)", "retval = self.sen...
<|body_start_0|> self.sensor = sensor = eyesensor self.sensor_view = sensor.view self.sensor.view = self.view self.age = 0 self.samples = [] number_of_samples = min(number_of_samples, sample_period) self.schedule = random.sample(range(sample_period), number_of_sam...
Samples eyesensor.rgb, the eye's view. Attribute samples is list of RGB numpy arrays.
EyeSensorSampler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EyeSensorSampler: """Samples eyesensor.rgb, the eye's view. Attribute samples is list of RGB numpy arrays.""" def __init__(self, eyesensor, sample_period, number_of_samples=30): """This draws its samples directly from the output of eyesensor.view() by wrapping the method.""" ...
stack_v2_sparse_classes_36k_train_020689
38,944
permissive
[ { "docstring": "This draws its samples directly from the output of eyesensor.view() by wrapping the method.", "name": "__init__", "signature": "def __init__(self, eyesensor, sample_period, number_of_samples=30)" }, { "docstring": "Wrapper around eyesensor.view which takes samples", "name": "...
3
stack_v2_sparse_classes_30k_train_020601
Implement the Python class `EyeSensorSampler` described below. Class description: Samples eyesensor.rgb, the eye's view. Attribute samples is list of RGB numpy arrays. Method signatures and docstrings: - def __init__(self, eyesensor, sample_period, number_of_samples=30): This draws its samples directly from the outpu...
Implement the Python class `EyeSensorSampler` described below. Class description: Samples eyesensor.rgb, the eye's view. Attribute samples is list of RGB numpy arrays. Method signatures and docstrings: - def __init__(self, eyesensor, sample_period, number_of_samples=30): This draws its samples directly from the outpu...
367f8701ec18226029d7ef070e70e9a8248a1374
<|skeleton|> class EyeSensorSampler: """Samples eyesensor.rgb, the eye's view. Attribute samples is list of RGB numpy arrays.""" def __init__(self, eyesensor, sample_period, number_of_samples=30): """This draws its samples directly from the output of eyesensor.view() by wrapping the method.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EyeSensorSampler: """Samples eyesensor.rgb, the eye's view. Attribute samples is list of RGB numpy arrays.""" def __init__(self, eyesensor, sample_period, number_of_samples=30): """This draws its samples directly from the output of eyesensor.view() by wrapping the method.""" self.sensor =...
the_stack_v2_python_sparse
encoders.py
ctrl-z-9000-times/HTM_experiments
train
15
321badeb5eebfb5b264d02aab1da193677c8edb2
[ "discussion = Discussion(title='Sample Discussion')\ntime = discussion.last_modified\ndiscussion.update_last_modified()\nself.assertNotEqual(time, discussion.last_modified)", "time = timezone.now() + datetime.timedelta(days=30)\nfuture_discussion = Discussion(create_date=time)\nself.assertEqual(future_discussion....
<|body_start_0|> discussion = Discussion(title='Sample Discussion') time = discussion.last_modified discussion.update_last_modified() self.assertNotEqual(time, discussion.last_modified) <|end_body_0|> <|body_start_1|> time = timezone.now() + datetime.timedelta(days=30) f...
DiscussionMethodTestCase
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DiscussionMethodTestCase: def test_update_last_modified(self): """If a discussion is created it should have a default last_modified time. When calling update_last_modified() the discussion last_modified should be reset to the current time. Thus it should not equal the time of instantiati...
stack_v2_sparse_classes_36k_train_020690
2,139
permissive
[ { "docstring": "If a discussion is created it should have a default last_modified time. When calling update_last_modified() the discussion last_modified should be reset to the current time. Thus it should not equal the time of instantiation.", "name": "test_update_last_modified", "signature": "def test_...
4
stack_v2_sparse_classes_30k_train_006152
Implement the Python class `DiscussionMethodTestCase` described below. Class description: Implement the DiscussionMethodTestCase class. Method signatures and docstrings: - def test_update_last_modified(self): If a discussion is created it should have a default last_modified time. When calling update_last_modified() t...
Implement the Python class `DiscussionMethodTestCase` described below. Class description: Implement the DiscussionMethodTestCase class. Method signatures and docstrings: - def test_update_last_modified(self): If a discussion is created it should have a default last_modified time. When calling update_last_modified() t...
59f3f3ae727fe52c7897beaf73d157b02cdcb7a3
<|skeleton|> class DiscussionMethodTestCase: def test_update_last_modified(self): """If a discussion is created it should have a default last_modified time. When calling update_last_modified() the discussion last_modified should be reset to the current time. Thus it should not equal the time of instantiati...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DiscussionMethodTestCase: def test_update_last_modified(self): """If a discussion is created it should have a default last_modified time. When calling update_last_modified() the discussion last_modified should be reset to the current time. Thus it should not equal the time of instantiation.""" ...
the_stack_v2_python_sparse
discussions/tests.py
pabulumm/neighbors
train
0
fb3c46559c97249ec61dc3c112ce70ada3c8b605
[ "self.price = price\nspecial = list(filter(lambda x: x[-1] < sum((x[i] * price[i] for i in range(len(price)))), special))\nreturn self.shopping(special, needs)", "if not needs:\n return 0\nspcial = list(filter(lambda x: all((x[i] <= needs[i] for i in range(len(needs)))), spcial))\nif not spcial:\n return su...
<|body_start_0|> self.price = price special = list(filter(lambda x: x[-1] < sum((x[i] * price[i] for i in range(len(price)))), special)) return self.shopping(special, needs) <|end_body_0|> <|body_start_1|> if not needs: return 0 spcial = list(filter(lambda x: all((x[...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def shoppingOffers(self, price, special, needs): """:type price: List[int] :type special: List[List[int]] :type needs: List[int] :rtype: int""" <|body_0|> def shopping(self, spcial, needs): """从 spcial中 刚刚好购买needs所需的最低花费 :param spcial: :param needs: :return...
stack_v2_sparse_classes_36k_train_020691
2,735
no_license
[ { "docstring": ":type price: List[int] :type special: List[List[int]] :type needs: List[int] :rtype: int", "name": "shoppingOffers", "signature": "def shoppingOffers(self, price, special, needs)" }, { "docstring": "从 spcial中 刚刚好购买needs所需的最低花费 :param spcial: :param needs: :return:", "name": "...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def shoppingOffers(self, price, special, needs): :type price: List[int] :type special: List[List[int]] :type needs: List[int] :rtype: int - def shopping(self, spcial, needs): 从 s...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def shoppingOffers(self, price, special, needs): :type price: List[int] :type special: List[List[int]] :type needs: List[int] :rtype: int - def shopping(self, spcial, needs): 从 s...
c0807a7f31a265b3090ef3d32a0ad5a2b10579f7
<|skeleton|> class Solution: def shoppingOffers(self, price, special, needs): """:type price: List[int] :type special: List[List[int]] :type needs: List[int] :rtype: int""" <|body_0|> def shopping(self, spcial, needs): """从 spcial中 刚刚好购买needs所需的最低花费 :param spcial: :param needs: :return...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def shoppingOffers(self, price, special, needs): """:type price: List[int] :type special: List[List[int]] :type needs: List[int] :rtype: int""" self.price = price special = list(filter(lambda x: x[-1] < sum((x[i] * price[i] for i in range(len(price)))), special)) retu...
the_stack_v2_python_sparse
six_hundred_thirty_eight.py
Yanl05/LeetCode
train
0
e496289bdc2f5d4e224a682c3b466c3ccb78d0ee
[ "if codecs is None:\n encoding = None\nConcurrentRotatingFileHandler.__init__(self, filename, mode, encoding, delay)\nself.suffix = '%Y-%m-%d'\nself.suffix_time = ''", "try:\n if self.check_baseFilename(record):\n self.build_baseFilename()\n ConcurrentRotatingFileHandler.emit(self, record)\nexcept...
<|body_start_0|> if codecs is None: encoding = None ConcurrentRotatingFileHandler.__init__(self, filename, mode, encoding, delay) self.suffix = '%Y-%m-%d' self.suffix_time = '' <|end_body_0|> <|body_start_1|> try: if self.check_baseFilename(record): ...
SafeFileHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SafeFileHandler: def __init__(self, filename, mode, encoding=None, delay=0): """Use the specified filename for streamed logging""" <|body_0|> def emit(self, record): """Emit a record. Always check time""" <|body_1|> def check_baseFilename(self, record): ...
stack_v2_sparse_classes_36k_train_020692
3,518
no_license
[ { "docstring": "Use the specified filename for streamed logging", "name": "__init__", "signature": "def __init__(self, filename, mode, encoding=None, delay=0)" }, { "docstring": "Emit a record. Always check time", "name": "emit", "signature": "def emit(self, record)" }, { "docstr...
4
stack_v2_sparse_classes_30k_train_015854
Implement the Python class `SafeFileHandler` described below. Class description: Implement the SafeFileHandler class. Method signatures and docstrings: - def __init__(self, filename, mode, encoding=None, delay=0): Use the specified filename for streamed logging - def emit(self, record): Emit a record. Always check ti...
Implement the Python class `SafeFileHandler` described below. Class description: Implement the SafeFileHandler class. Method signatures and docstrings: - def __init__(self, filename, mode, encoding=None, delay=0): Use the specified filename for streamed logging - def emit(self, record): Emit a record. Always check ti...
fa608a9fab7fe9293e728c8051186d95b4a15fc1
<|skeleton|> class SafeFileHandler: def __init__(self, filename, mode, encoding=None, delay=0): """Use the specified filename for streamed logging""" <|body_0|> def emit(self, record): """Emit a record. Always check time""" <|body_1|> def check_baseFilename(self, record): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SafeFileHandler: def __init__(self, filename, mode, encoding=None, delay=0): """Use the specified filename for streamed logging""" if codecs is None: encoding = None ConcurrentRotatingFileHandler.__init__(self, filename, mode, encoding, delay) self.suffix = '%Y-%m-%...
the_stack_v2_python_sparse
utilPackage/utilLog/classLogMgr.py
wangxindev/apiServer
train
1
0a1a023e88e4ea6742fa0ed7791e517e3065cb0e
[ "logger.debug('Visiting %s', self.novel_url)\nsoup = self.get_soup(self.novel_url)\nself.novel_title = soup.select_one('h1.bookinfo-title').text.strip()\nlogger.info('Novel title: %s', self.novel_title)\nself.novel_author = soup.select_one('span', {'itemprop': 'creator'}).text.strip()\nlogger.info('Novel author: %s...
<|body_start_0|> logger.debug('Visiting %s', self.novel_url) soup = self.get_soup(self.novel_url) self.novel_title = soup.select_one('h1.bookinfo-title').text.strip() logger.info('Novel title: %s', self.novel_title) self.novel_author = soup.select_one('span', {'itemprop': 'creato...
NovelCool
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NovelCool: def read_novel_info(self): """Get novel title, autor, cover etc""" <|body_0|> def download_chapter_body(self, chapter): """Download body of a single chapter and return as clean html format.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_020693
2,362
permissive
[ { "docstring": "Get novel title, autor, cover etc", "name": "read_novel_info", "signature": "def read_novel_info(self)" }, { "docstring": "Download body of a single chapter and return as clean html format.", "name": "download_chapter_body", "signature": "def download_chapter_body(self, c...
2
stack_v2_sparse_classes_30k_train_015754
Implement the Python class `NovelCool` described below. Class description: Implement the NovelCool class. Method signatures and docstrings: - def read_novel_info(self): Get novel title, autor, cover etc - def download_chapter_body(self, chapter): Download body of a single chapter and return as clean html format.
Implement the Python class `NovelCool` described below. Class description: Implement the NovelCool class. Method signatures and docstrings: - def read_novel_info(self): Get novel title, autor, cover etc - def download_chapter_body(self, chapter): Download body of a single chapter and return as clean html format. <|s...
451e816ab03c8466be90f6f0b3eaa52d799140ce
<|skeleton|> class NovelCool: def read_novel_info(self): """Get novel title, autor, cover etc""" <|body_0|> def download_chapter_body(self, chapter): """Download body of a single chapter and return as clean html format.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NovelCool: def read_novel_info(self): """Get novel title, autor, cover etc""" logger.debug('Visiting %s', self.novel_url) soup = self.get_soup(self.novel_url) self.novel_title = soup.select_one('h1.bookinfo-title').text.strip() logger.info('Novel title: %s', self.novel_...
the_stack_v2_python_sparse
lncrawl/sources/novelcool.py
NNTin/lightnovel-crawler
train
2
d118d974bd80a86234af86120d34ef80603c890f
[ "if dialect.name == 'postgresql':\n return dialect.type_descriptor(sqlalchemy.dialects.postgresql.UUID)\nreturn dialect.type_descriptor(String)", "if dialect.name == 'postgres':\n return value\nif value is None:\n return value\nreturn str(value)", "if dialect.name == 'postgresql':\n return value\nif...
<|body_start_0|> if dialect.name == 'postgresql': return dialect.type_descriptor(sqlalchemy.dialects.postgresql.UUID) return dialect.type_descriptor(String) <|end_body_0|> <|body_start_1|> if dialect.name == 'postgres': return value if value is None: ...
Converts UUID to string before storing to database. Converts string to UUID when retrieving from database.
UUID
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UUID: """Converts UUID to string before storing to database. Converts string to UUID when retrieving from database.""" def load_dialect_impl(self, dialect): """When using Postgres database, use the Postgres UUID column type. Otherwise, use String column type.""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_020694
1,449
permissive
[ { "docstring": "When using Postgres database, use the Postgres UUID column type. Otherwise, use String column type.", "name": "load_dialect_impl", "signature": "def load_dialect_impl(self, dialect)" }, { "docstring": "When using Postgres database, no conversion. Otherwise, convert to string befo...
3
stack_v2_sparse_classes_30k_train_018746
Implement the Python class `UUID` described below. Class description: Converts UUID to string before storing to database. Converts string to UUID when retrieving from database. Method signatures and docstrings: - def load_dialect_impl(self, dialect): When using Postgres database, use the Postgres UUID column type. Ot...
Implement the Python class `UUID` described below. Class description: Converts UUID to string before storing to database. Converts string to UUID when retrieving from database. Method signatures and docstrings: - def load_dialect_impl(self, dialect): When using Postgres database, use the Postgres UUID column type. Ot...
665d39a2bd82543d5196555f0801ef8fd4a3ee48
<|skeleton|> class UUID: """Converts UUID to string before storing to database. Converts string to UUID when retrieving from database.""" def load_dialect_impl(self, dialect): """When using Postgres database, use the Postgres UUID column type. Otherwise, use String column type.""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UUID: """Converts UUID to string before storing to database. Converts string to UUID when retrieving from database.""" def load_dialect_impl(self, dialect): """When using Postgres database, use the Postgres UUID column type. Otherwise, use String column type.""" if dialect.name == 'postgr...
the_stack_v2_python_sparse
all-gists/9262225/snippet.py
gistable/gistable
train
76
3681cb6c081bb8a31dc2cd5b762e7f4c6d8a005d
[ "Thread.__init__(self)\nself.setDaemon(True)\nself.output = output\nself.done = False", "while not self.done:\n input_text = input()\n if input_text:\n _send(self.output, input_text + '\\r\\n')" ]
<|body_start_0|> Thread.__init__(self) self.setDaemon(True) self.output = output self.done = False <|end_body_0|> <|body_start_1|> while not self.done: input_text = input() if input_text: _send(self.output, input_text + '\r\n') <|end_body_...
A class that mirrors standard input to the chat server until it's told to stop.
PropagateStandardInput
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PropagateStandardInput: """A class that mirrors standard input to the chat server until it's told to stop.""" def __init__(self, output): """Make this thread a daemon thread, so that if the Python interpreter needs to quit it won't be held up waiting for this thread to die.""" ...
stack_v2_sparse_classes_36k_train_020695
2,957
permissive
[ { "docstring": "Make this thread a daemon thread, so that if the Python interpreter needs to quit it won't be held up waiting for this thread to die.", "name": "__init__", "signature": "def __init__(self, output)" }, { "docstring": "Echo standard input to the chat server until told to stop.", ...
2
stack_v2_sparse_classes_30k_train_000383
Implement the Python class `PropagateStandardInput` described below. Class description: A class that mirrors standard input to the chat server until it's told to stop. Method signatures and docstrings: - def __init__(self, output): Make this thread a daemon thread, so that if the Python interpreter needs to quit it w...
Implement the Python class `PropagateStandardInput` described below. Class description: A class that mirrors standard input to the chat server until it's told to stop. Method signatures and docstrings: - def __init__(self, output): Make this thread a daemon thread, so that if the Python interpreter needs to quit it w...
df7e1ff1739bf32d896faecbb2b7554dd4f9e214
<|skeleton|> class PropagateStandardInput: """A class that mirrors standard input to the chat server until it's told to stop.""" def __init__(self, output): """Make this thread a daemon thread, so that if the Python interpreter needs to quit it won't be held up waiting for this thread to die.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PropagateStandardInput: """A class that mirrors standard input to the chat server until it's told to stop.""" def __init__(self, output): """Make this thread a daemon thread, so that if the Python interpreter needs to quit it won't be held up waiting for this thread to die.""" Thread.__in...
the_stack_v2_python_sparse
cookbook/network/chat_client.py
fyabc/Toys
train
1
a34831456df7220cf831a8265786bce62d6e91d0
[ "default_attr = {'keep_slides': None, 'discard_slides': []}\ndefault_attr.update(kwargs)\nsuper().__init__(default_attr=default_attr)\nself.gc = gc\nself.source_folder_id = source_folder_id\nself.set_slide_ids()", "resp = self.gc.get('item?folderId=%s&limit=1000000' % self.source_folder_id)\nself.slide_ids = {j['...
<|body_start_0|> default_attr = {'keep_slides': None, 'discard_slides': []} default_attr.update(kwargs) super().__init__(default_attr=default_attr) self.gc = gc self.source_folder_id = source_folder_id self.set_slide_ids() <|end_body_0|> <|body_start_1|> resp = s...
Iterate through large_image items in a girder folder.
Slide_iterator
[ "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Slide_iterator: """Iterate through large_image items in a girder folder.""" def __init__(self, gc, source_folder_id, **kwargs): """Init Slide_iterator object. Arguments ----------- gc : object girder client object source_folder_id : str girder ID of folder in which slides are located...
stack_v2_sparse_classes_36k_train_020696
8,437
permissive
[ { "docstring": "Init Slide_iterator object. Arguments ----------- gc : object girder client object source_folder_id : str girder ID of folder in which slides are located keep_slides : list List of slide names to keep. If None, all are kept. discard_slides : list List of slide names to discard. kwargs : key-valu...
3
stack_v2_sparse_classes_30k_train_010568
Implement the Python class `Slide_iterator` described below. Class description: Iterate through large_image items in a girder folder. Method signatures and docstrings: - def __init__(self, gc, source_folder_id, **kwargs): Init Slide_iterator object. Arguments ----------- gc : object girder client object source_folder...
Implement the Python class `Slide_iterator` described below. Class description: Iterate through large_image items in a girder folder. Method signatures and docstrings: - def __init__(self, gc, source_folder_id, **kwargs): Init Slide_iterator object. Arguments ----------- gc : object girder client object source_folder...
c03c852e72f1497d22535c6b7d5aba25c74e620d
<|skeleton|> class Slide_iterator: """Iterate through large_image items in a girder folder.""" def __init__(self, gc, source_folder_id, **kwargs): """Init Slide_iterator object. Arguments ----------- gc : object girder client object source_folder_id : str girder ID of folder in which slides are located...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Slide_iterator: """Iterate through large_image items in a girder folder.""" def __init__(self, gc, source_folder_id, **kwargs): """Init Slide_iterator object. Arguments ----------- gc : object girder client object source_folder_id : str girder ID of folder in which slides are located keep_slides ...
the_stack_v2_python_sparse
histomicstk/workflows/workflow_runner.py
DigitalSlideArchive/HistomicsTK
train
351
572d5d12bb177bc53625d3de3b5fa50ae218e790
[ "self.dist = dist\nself.alias_initialisation()\nself.table_prob_list = list(self.table_prob)", "n = len(self.dist)\nself.table_prob = {}\nself.table_alias = {}\nscaled_prob = {}\nsmall = []\nlarge = []\nfor o, p in self.dist.items():\n scaled_prob[o] = Decimal(p) * n\n if scaled_prob[o] < 1:\n small....
<|body_start_0|> self.dist = dist self.alias_initialisation() self.table_prob_list = list(self.table_prob) <|end_body_0|> <|body_start_1|> n = len(self.dist) self.table_prob = {} self.table_alias = {} scaled_prob = {} small = [] large = [] ...
A probability distribution for discrete weighted random variables and its probability/alias tables for efficient sampling via Vose's Alias Method (a good explanation of which can be found at http://www.keithschwarz.com/darts-dice-coins/).
VoseAlias
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VoseAlias: """A probability distribution for discrete weighted random variables and its probability/alias tables for efficient sampling via Vose's Alias Method (a good explanation of which can be found at http://www.keithschwarz.com/darts-dice-coins/).""" def __init__(self, dist): ""...
stack_v2_sparse_classes_36k_train_020697
9,862
permissive
[ { "docstring": "Given a definition try matching a word to the definition :) Parameters ---------- key : str Your dictionary.com api key wordlist : str Path to any wordlist you want by default it uses the OSX built in word list Raises ------ TypeError If the randomly generated word is not found on dictionary.com...
4
stack_v2_sparse_classes_30k_train_013001
Implement the Python class `VoseAlias` described below. Class description: A probability distribution for discrete weighted random variables and its probability/alias tables for efficient sampling via Vose's Alias Method (a good explanation of which can be found at http://www.keithschwarz.com/darts-dice-coins/). Meth...
Implement the Python class `VoseAlias` described below. Class description: A probability distribution for discrete weighted random variables and its probability/alias tables for efficient sampling via Vose's Alias Method (a good explanation of which can be found at http://www.keithschwarz.com/darts-dice-coins/). Meth...
c61bbe8a41dcd76898813c846ea99a275d0af6f3
<|skeleton|> class VoseAlias: """A probability distribution for discrete weighted random variables and its probability/alias tables for efficient sampling via Vose's Alias Method (a good explanation of which can be found at http://www.keithschwarz.com/darts-dice-coins/).""" def __init__(self, dist): ""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VoseAlias: """A probability distribution for discrete weighted random variables and its probability/alias tables for efficient sampling via Vose's Alias Method (a good explanation of which can be found at http://www.keithschwarz.com/darts-dice-coins/).""" def __init__(self, dist): """Given a defi...
the_stack_v2_python_sparse
src/dictogram.py
imthaghost/tweetGen
train
1
b3142e8642d2a6f5aa3657bc549a46a7b6aab754
[ "collection: Final[str] = 'profile_armor_map'\nquery = Query(collection, service_id=self._client.service_id)\nquery.add_term(field=self.id_field, value=self.id)\nquery.limit(20)\njoin = query.create_join(ArmourInfo.collection)\njoin.set_fields(ArmourInfo.id_field)\nreturn SequenceProxy(ArmourInfo, query, client=sel...
<|body_start_0|> collection: Final[str] = 'profile_armor_map' query = Query(collection, service_id=self._client.service_id) query.add_term(field=self.id_field, value=self.id) query.limit(20) join = query.create_join(ArmourInfo.collection) join.set_fields(ArmourInfo.id_fie...
An entity in the game world. This is used to specify the resistance and armour values to apply to a given object. Profiles include faction-specific classes, vehicles, facility infrastructure such as turrets, generators or shields, as well as other non-static entities such as Cortium nodes or pumpkins. .. attribute:: id...
Profile
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Profile: """An entity in the game world. This is used to specify the resistance and armour values to apply to a given object. Profiles include faction-specific classes, vehicles, facility infrastructure such as turrets, generators or shields, as well as other non-static entities such as Cortium n...
stack_v2_sparse_classes_36k_train_020698
5,971
permissive
[ { "docstring": "Return the armour info of the profile. This returns a :class:`auraxium.SequenceProxy`.", "name": "armour_info", "signature": "def armour_info(self) -> SequenceProxy[ArmourInfo]" }, { "docstring": "Return the resist info of the profile. This returns a :class:`auraxium.SequenceProx...
2
stack_v2_sparse_classes_30k_train_005304
Implement the Python class `Profile` described below. Class description: An entity in the game world. This is used to specify the resistance and armour values to apply to a given object. Profiles include faction-specific classes, vehicles, facility infrastructure such as turrets, generators or shields, as well as othe...
Implement the Python class `Profile` described below. Class description: An entity in the game world. This is used to specify the resistance and armour values to apply to a given object. Profiles include faction-specific classes, vehicles, facility infrastructure such as turrets, generators or shields, as well as othe...
23dcf927a199c8d7c917d89fe96b470a34cf4bba
<|skeleton|> class Profile: """An entity in the game world. This is used to specify the resistance and armour values to apply to a given object. Profiles include faction-specific classes, vehicles, facility infrastructure such as turrets, generators or shields, as well as other non-static entities such as Cortium n...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Profile: """An entity in the game world. This is used to specify the resistance and armour values to apply to a given object. Profiles include faction-specific classes, vehicles, facility infrastructure such as turrets, generators or shields, as well as other non-static entities such as Cortium nodes or pumpk...
the_stack_v2_python_sparse
auraxium/ps2/_profile.py
leonhard-s/auraxium
train
29
ef8495f4415279d10c485d25a04cdbe32618085a
[ "if threshold is None:\n threshold = self._threshold\nif self._classifier is not None:\n top_matches = min(top_matches, self._matcher_tup.length - 1)\n dists, inds = self._classifier.search(np.array(emb).astype('float32'), k=top_matches)\n dists = np.squeeze(dists).tolist()\n inds = np.squeeze(inds)....
<|body_start_0|> if threshold is None: threshold = self._threshold if self._classifier is not None: top_matches = min(top_matches, self._matcher_tup.length - 1) dists, inds = self._classifier.search(np.array(emb).astype('float32'), k=top_matches) dists = n...
Classify face id using Faiss
FaissMatcher
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FaissMatcher: """Classify face id using Faiss""" def match(self, emb, top_matches=Config.Matcher.MAX_TOP_MATCHES, threshold=None, return_dists=False, always_return_closest=True): """See superclass doc""" <|body_0|> def fit(self, embs, labels): """Fit current matc...
stack_v2_sparse_classes_36k_train_020699
16,051
no_license
[ { "docstring": "See superclass doc", "name": "match", "signature": "def match(self, emb, top_matches=Config.Matcher.MAX_TOP_MATCHES, threshold=None, return_dists=False, always_return_closest=True)" }, { "docstring": "Fit current matcher to new embs and labels :param embs: list of embs :param lab...
3
stack_v2_sparse_classes_30k_train_007793
Implement the Python class `FaissMatcher` described below. Class description: Classify face id using Faiss Method signatures and docstrings: - def match(self, emb, top_matches=Config.Matcher.MAX_TOP_MATCHES, threshold=None, return_dists=False, always_return_closest=True): See superclass doc - def fit(self, embs, labe...
Implement the Python class `FaissMatcher` described below. Class description: Classify face id using Faiss Method signatures and docstrings: - def match(self, emb, top_matches=Config.Matcher.MAX_TOP_MATCHES, threshold=None, return_dists=False, always_return_closest=True): See superclass doc - def fit(self, embs, labe...
0f97af4e110b0e8de8d1b9f18fcd3f69c69b54cc
<|skeleton|> class FaissMatcher: """Classify face id using Faiss""" def match(self, emb, top_matches=Config.Matcher.MAX_TOP_MATCHES, threshold=None, return_dists=False, always_return_closest=True): """See superclass doc""" <|body_0|> def fit(self, embs, labels): """Fit current matc...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FaissMatcher: """Classify face id using Faiss""" def match(self, emb, top_matches=Config.Matcher.MAX_TOP_MATCHES, threshold=None, return_dists=False, always_return_closest=True): """See superclass doc""" if threshold is None: threshold = self._threshold if self._classi...
the_stack_v2_python_sparse
src/matcher.py
duongle98/Face-Rec
train
1