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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
dcf85428845646fbecf5c685e43656ad41336640 | [
"with self.current_engine.connect() as conn:\n session = sessionmaker(bind=self.current_engine)()\n session.connection().connection.set_isolation_level(0)\n session.execute(ddl, namespace)\n conn.close()",
"with self.current_engine.connect() as conn:\n rs = self.current_engine.execute(sql, namespac... | <|body_start_0|>
with self.current_engine.connect() as conn:
session = sessionmaker(bind=self.current_engine)()
session.connection().connection.set_isolation_level(0)
session.execute(ddl, namespace)
conn.close()
<|end_body_0|>
<|body_start_1|>
with self.c... | Database functions, inherited by both Redshift and Athena classes. ... Attributes ---------- current_engine : sqlalchemy.engine.Engine, optional A sql alchemy engine (default None). db_url : str, optional A sql alchemy connection string to a database (default None). redshift_role : str, optional The redshift role ARN t... | DatabaseCommon | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DatabaseCommon:
"""Database functions, inherited by both Redshift and Athena classes. ... Attributes ---------- current_engine : sqlalchemy.engine.Engine, optional A sql alchemy engine (default None). db_url : str, optional A sql alchemy connection string to a database (default None). redshift_ro... | stack_v2_sparse_classes_36k_train_026900 | 38,834 | permissive | [
{
"docstring": "Executes a SQL ddl statement. Parameters ---------- ddl : str The data descrption language statement to execute in SQL. namespace : dict(), optional Mapping namespace keys to values if the values do not already exist. Returns ------- None None. Examples -------- >>> from aws.utils.notebooks.data... | 2 | null | Implement the Python class `DatabaseCommon` described below.
Class description:
Database functions, inherited by both Redshift and Athena classes. ... Attributes ---------- current_engine : sqlalchemy.engine.Engine, optional A sql alchemy engine (default None). db_url : str, optional A sql alchemy connection string to... | Implement the Python class `DatabaseCommon` described below.
Class description:
Database functions, inherited by both Redshift and Athena classes. ... Attributes ---------- current_engine : sqlalchemy.engine.Engine, optional A sql alchemy engine (default None). db_url : str, optional A sql alchemy connection string to... | bd4ef11f05decfcf287ba295787ddd89a774839d | <|skeleton|>
class DatabaseCommon:
"""Database functions, inherited by both Redshift and Athena classes. ... Attributes ---------- current_engine : sqlalchemy.engine.Engine, optional A sql alchemy engine (default None). db_url : str, optional A sql alchemy connection string to a database (default None). redshift_ro... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DatabaseCommon:
"""Database functions, inherited by both Redshift and Athena classes. ... Attributes ---------- current_engine : sqlalchemy.engine.Engine, optional A sql alchemy engine (default None). db_url : str, optional A sql alchemy connection string to a database (default None). redshift_role : str, opt... | the_stack_v2_python_sparse | sdk/aws_orbit_sdk/database.py | hyderali87/aws-orbit-workbench | train | 0 |
130ec3856d9f35b437d248f0fbddabfd3a371d3c | [
"self.idx = idx\nself.iterable = iterable\nself.loop = loop\nself.known_symb = known_symb\nself.name = 'for'",
"out = []\nfor loop_var in self.iterable.eval():\n if len(self.idx) > 1:\n for i, var_name in enumerate(self.idx):\n self.known_symb[var_name] = loop_var[i]\n else:\n self.... | <|body_start_0|>
self.idx = idx
self.iterable = iterable
self.loop = loop
self.known_symb = known_symb
self.name = 'for'
<|end_body_0|>
<|body_start_1|>
out = []
for loop_var in self.iterable.eval():
if len(self.idx) > 1:
for i, var_na... | Delayed evaluator for ``for ... endfor`` statement. | ForStmtEvaluator | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ForStmtEvaluator:
"""Delayed evaluator for ``for ... endfor`` statement."""
def __init__(self, idx, iterable, loop, known_symb):
"""Initialize for-statement evaluator. :param str idx: name of the loop variable. :param DelayedEvaluator iterable: the object to be iterated over. :param ... | stack_v2_sparse_classes_36k_train_026901 | 8,962 | permissive | [
{
"docstring": "Initialize for-statement evaluator. :param str idx: name of the loop variable. :param DelayedEvaluator iterable: the object to be iterated over. :param list loop: empty list to store evaluators in the for loop. :param dict known_symb: all known symbols.",
"name": "__init__",
"signature":... | 2 | stack_v2_sparse_classes_30k_train_003224 | Implement the Python class `ForStmtEvaluator` described below.
Class description:
Delayed evaluator for ``for ... endfor`` statement.
Method signatures and docstrings:
- def __init__(self, idx, iterable, loop, known_symb): Initialize for-statement evaluator. :param str idx: name of the loop variable. :param DelayedEv... | Implement the Python class `ForStmtEvaluator` described below.
Class description:
Delayed evaluator for ``for ... endfor`` statement.
Method signatures and docstrings:
- def __init__(self, idx, iterable, loop, known_symb): Initialize for-statement evaluator. :param str idx: name of the loop variable. :param DelayedEv... | 1efe0a6a2e1b7fa8ca6168c64ef24631778494d4 | <|skeleton|>
class ForStmtEvaluator:
"""Delayed evaluator for ``for ... endfor`` statement."""
def __init__(self, idx, iterable, loop, known_symb):
"""Initialize for-statement evaluator. :param str idx: name of the loop variable. :param DelayedEvaluator iterable: the object to be iterated over. :param ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ForStmtEvaluator:
"""Delayed evaluator for ``for ... endfor`` statement."""
def __init__(self, idx, iterable, loop, known_symb):
"""Initialize for-statement evaluator. :param str idx: name of the loop variable. :param DelayedEvaluator iterable: the object to be iterated over. :param list loop: em... | the_stack_v2_python_sparse | pyBabyMaker/engine/eval.py | umd-lhcb/pyBabyMaker | train | 0 |
af788f1b33b24a6c2c3e80cb974c69b73c94106a | [
"request_json = request.get_json()\nvalid_format, errors = schema_utils.validate(request_json, 'org')\nif not valid_format:\n return ({'message': schema_utils.serialize(errors)}, http_status.HTTP_400_BAD_REQUEST)\ntry:\n user = UserService.find_by_jwt_token()\n if user is None:\n response, status = ... | <|body_start_0|>
request_json = request.get_json()
valid_format, errors = schema_utils.validate(request_json, 'org')
if not valid_format:
return ({'message': schema_utils.serialize(errors)}, http_status.HTTP_400_BAD_REQUEST)
try:
user = UserService.find_by_jwt_tok... | Resource for managing orgs. | Orgs | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Orgs:
"""Resource for managing orgs."""
def post():
"""Post a new org using the request body. If the org already exists, update the attributes."""
<|body_0|>
def get():
"""Search orgs."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
request_json... | stack_v2_sparse_classes_36k_train_026902 | 30,185 | permissive | [
{
"docstring": "Post a new org using the request body. If the org already exists, update the attributes.",
"name": "post",
"signature": "def post()"
},
{
"docstring": "Search orgs.",
"name": "get",
"signature": "def get()"
}
] | 2 | stack_v2_sparse_classes_30k_train_007462 | Implement the Python class `Orgs` described below.
Class description:
Resource for managing orgs.
Method signatures and docstrings:
- def post(): Post a new org using the request body. If the org already exists, update the attributes.
- def get(): Search orgs. | Implement the Python class `Orgs` described below.
Class description:
Resource for managing orgs.
Method signatures and docstrings:
- def post(): Post a new org using the request body. If the org already exists, update the attributes.
- def get(): Search orgs.
<|skeleton|>
class Orgs:
"""Resource for managing or... | 923cb8a3ee88dcbaf0fe800ca70022b3c13c1d01 | <|skeleton|>
class Orgs:
"""Resource for managing orgs."""
def post():
"""Post a new org using the request body. If the org already exists, update the attributes."""
<|body_0|>
def get():
"""Search orgs."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Orgs:
"""Resource for managing orgs."""
def post():
"""Post a new org using the request body. If the org already exists, update the attributes."""
request_json = request.get_json()
valid_format, errors = schema_utils.validate(request_json, 'org')
if not valid_format:
... | the_stack_v2_python_sparse | auth-api/src/auth_api/resources/org.py | bcgov/sbc-auth | train | 13 |
712593f46117529a9b18d8af877ce3f4a7b38e4e | [
"order = []\nlevel_nodes = deque()\nq = deque([root, None])\nis_left = True\nwhile q:\n curr_node = q.popleft()\n if curr_node:\n if is_left:\n level_nodes.append(curr_node.val)\n else:\n level_nodes.appendleft(curr_node.val)\n if curr_node.left:\n q.appen... | <|body_start_0|>
order = []
level_nodes = deque()
q = deque([root, None])
is_left = True
while q:
curr_node = q.popleft()
if curr_node:
if is_left:
level_nodes.append(curr_node.val)
else:
... | ZigZag | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ZigZag:
def level_order_traversal_bfs(self, root: 'TreeNode') -> List[List[int]]:
"""Approach: BFS Time Complexity: O(N) Space Complexity: O(H) :param root: :return:"""
<|body_0|>
def level_order_traversal_dfs(self, root: 'TreeNode') -> List[List[int]]:
"""Approach: ... | stack_v2_sparse_classes_36k_train_026903 | 2,641 | no_license | [
{
"docstring": "Approach: BFS Time Complexity: O(N) Space Complexity: O(H) :param root: :return:",
"name": "level_order_traversal_bfs",
"signature": "def level_order_traversal_bfs(self, root: 'TreeNode') -> List[List[int]]"
},
{
"docstring": "Approach: DFS Time Complexity: O(N) Space Complexity:... | 2 | null | Implement the Python class `ZigZag` described below.
Class description:
Implement the ZigZag class.
Method signatures and docstrings:
- def level_order_traversal_bfs(self, root: 'TreeNode') -> List[List[int]]: Approach: BFS Time Complexity: O(N) Space Complexity: O(H) :param root: :return:
- def level_order_traversal... | Implement the Python class `ZigZag` described below.
Class description:
Implement the ZigZag class.
Method signatures and docstrings:
- def level_order_traversal_bfs(self, root: 'TreeNode') -> List[List[int]]: Approach: BFS Time Complexity: O(N) Space Complexity: O(H) :param root: :return:
- def level_order_traversal... | 65cc78b5afa0db064f9fe8f06597e3e120f7363d | <|skeleton|>
class ZigZag:
def level_order_traversal_bfs(self, root: 'TreeNode') -> List[List[int]]:
"""Approach: BFS Time Complexity: O(N) Space Complexity: O(H) :param root: :return:"""
<|body_0|>
def level_order_traversal_dfs(self, root: 'TreeNode') -> List[List[int]]:
"""Approach: ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ZigZag:
def level_order_traversal_bfs(self, root: 'TreeNode') -> List[List[int]]:
"""Approach: BFS Time Complexity: O(N) Space Complexity: O(H) :param root: :return:"""
order = []
level_nodes = deque()
q = deque([root, None])
is_left = True
while q:
... | the_stack_v2_python_sparse | goldman_sachs/binary_tree_zigzag_level_order_traversal.py | Shiv2157k/leet_code | train | 1 | |
25a943b1f72d4e9d5ca6ef0f986885f3cfeaa44a | [
"parser.add_argument('source', help='Cloud SQL instance ID of the source.')\nparser.add_argument('destination', help='Cloud SQL instance ID of the clone.')\nparser.add_argument('--bin-log-file-name', required=False, help='Binary log file for the source instance.')\nparser.add_argument('--bin-log-position', type=int... | <|body_start_0|>
parser.add_argument('source', help='Cloud SQL instance ID of the source.')
parser.add_argument('destination', help='Cloud SQL instance ID of the clone.')
parser.add_argument('--bin-log-file-name', required=False, help='Binary log file for the source instance.')
parser.ad... | Clones a Cloud SQL instance. | Clone | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Clone:
"""Clones a Cloud SQL instance."""
def Args(parser):
"""Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use it to add arguments that go on the command line after this command. Positional arguments are allowed."""
... | stack_v2_sparse_classes_36k_train_026904 | 4,897 | permissive | [
{
"docstring": "Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use it to add arguments that go on the command line after this command. Positional arguments are allowed.",
"name": "Args",
"signature": "def Args(parser)"
},
{
"docstri... | 3 | null | Implement the Python class `Clone` described below.
Class description:
Clones a Cloud SQL instance.
Method signatures and docstrings:
- def Args(parser): Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use it to add arguments that go on the command line a... | Implement the Python class `Clone` described below.
Class description:
Clones a Cloud SQL instance.
Method signatures and docstrings:
- def Args(parser): Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use it to add arguments that go on the command line a... | 90d87b2adb1eab7f218b075886aa620d8d6eeedb | <|skeleton|>
class Clone:
"""Clones a Cloud SQL instance."""
def Args(parser):
"""Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use it to add arguments that go on the command line after this command. Positional arguments are allowed."""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Clone:
"""Clones a Cloud SQL instance."""
def Args(parser):
"""Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use it to add arguments that go on the command line after this command. Positional arguments are allowed."""
parser... | the_stack_v2_python_sparse | old/google-cloud-sdk/lib/googlecloudsdk/sql/tools/instances/clone.py | altock/dev | train | 0 |
dca670118fdf9cd7866c2eef6bbe3a260d115fec | [
"CookieUtils.__init__(self)\nManagerUtils.__init__(self)\nOrthologUtils.__init__(self)",
"proc = sp.Popen(cmd, **kwargs, encoding='utf-8')\nstdout_list = []\nfor line in iter(proc.stdout.readline, ''):\n stdout_list.append(line.rstrip())\n if print_flag:\n utils_log.info(line, end='')\n sys.stdout... | <|body_start_0|>
CookieUtils.__init__(self)
ManagerUtils.__init__(self)
OrthologUtils.__init__(self)
<|end_body_0|>
<|body_start_1|>
proc = sp.Popen(cmd, **kwargs, encoding='utf-8')
stdout_list = []
for line in iter(proc.stdout.readline, ''):
stdout_list.appe... | FullUtilities | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FullUtilities:
def __init__(self):
"""A class to help bring utility functions to other modules."""
<|body_0|>
def system_cmd(self, cmd, timeout=None, print_flag=True, write_flag=False, file_name=None, **kwargs):
"""A function for making system calls, while preforming... | stack_v2_sparse_classes_36k_train_026905 | 45,355 | no_license | [
{
"docstring": "A class to help bring utility functions to other modules.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "A function for making system calls, while preforming proper exception handling. :param cmd: A list that contains the arguments for Popen. :param ti... | 3 | stack_v2_sparse_classes_30k_train_002561 | Implement the Python class `FullUtilities` described below.
Class description:
Implement the FullUtilities class.
Method signatures and docstrings:
- def __init__(self): A class to help bring utility functions to other modules.
- def system_cmd(self, cmd, timeout=None, print_flag=True, write_flag=False, file_name=Non... | Implement the Python class `FullUtilities` described below.
Class description:
Implement the FullUtilities class.
Method signatures and docstrings:
- def __init__(self): A class to help bring utility functions to other modules.
- def system_cmd(self, cmd, timeout=None, print_flag=True, write_flag=False, file_name=Non... | e207046ec36387751fe2bba8b6782fdc2a580107 | <|skeleton|>
class FullUtilities:
def __init__(self):
"""A class to help bring utility functions to other modules."""
<|body_0|>
def system_cmd(self, cmd, timeout=None, print_flag=True, write_flag=False, file_name=None, **kwargs):
"""A function for making system calls, while preforming... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FullUtilities:
def __init__(self):
"""A class to help bring utility functions to other modules."""
CookieUtils.__init__(self)
ManagerUtils.__init__(self)
OrthologUtils.__init__(self)
def system_cmd(self, cmd, timeout=None, print_flag=True, write_flag=False, file_name=None,... | the_stack_v2_python_sparse | OrthoEvol/utilities.py | datasnakes/OrthoEvolution | train | 19 | |
ec31171c670921b7098b89c7f4def7138c8db5b4 | [
"from collections import deque\nself.nums = deque()\nself.size = size\nself.sum = 0",
"if len(self.nums) == self.size:\n self.sum -= self.nums.popleft()\nself.nums.append(val)\nself.sum += val\nreturn float(self.sum) / len(self.nums)"
] | <|body_start_0|>
from collections import deque
self.nums = deque()
self.size = size
self.sum = 0
<|end_body_0|>
<|body_start_1|>
if len(self.nums) == self.size:
self.sum -= self.nums.popleft()
self.nums.append(val)
self.sum += val
return float... | MovingAverage | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MovingAverage:
def __init__(self, size):
"""Initialize your data structure here. :type size: int"""
<|body_0|>
def next(self, val):
""":type val: int :rtype: float"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
from collections import deque
... | stack_v2_sparse_classes_36k_train_026906 | 812 | no_license | [
{
"docstring": "Initialize your data structure here. :type size: int",
"name": "__init__",
"signature": "def __init__(self, size)"
},
{
"docstring": ":type val: int :rtype: float",
"name": "next",
"signature": "def next(self, val)"
}
] | 2 | stack_v2_sparse_classes_30k_train_021091 | Implement the Python class `MovingAverage` described below.
Class description:
Implement the MovingAverage class.
Method signatures and docstrings:
- def __init__(self, size): Initialize your data structure here. :type size: int
- def next(self, val): :type val: int :rtype: float | Implement the Python class `MovingAverage` described below.
Class description:
Implement the MovingAverage class.
Method signatures and docstrings:
- def __init__(self, size): Initialize your data structure here. :type size: int
- def next(self, val): :type val: int :rtype: float
<|skeleton|>
class MovingAverage:
... | fe79161211cc08c269cde9e1fdcfed27de11f2cb | <|skeleton|>
class MovingAverage:
def __init__(self, size):
"""Initialize your data structure here. :type size: int"""
<|body_0|>
def next(self, val):
""":type val: int :rtype: float"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MovingAverage:
def __init__(self, size):
"""Initialize your data structure here. :type size: int"""
from collections import deque
self.nums = deque()
self.size = size
self.sum = 0
def next(self, val):
""":type val: int :rtype: float"""
if len(self.n... | the_stack_v2_python_sparse | MyLeetCode/python/Moving Average from Data Stream.py | ihuei801/leetcode | train | 0 | |
b7293fd0aeb59073eec5b99675899588b6cca2c7 | [
"self.driver_make = prompt.text('Driver Make')\nself.driver_model = prompt.text('Driver Model')\nself.driver_name = prompt.text('Driver Name')\nself.metadata = Metadata(self.driver_make, self.driver_model, self.driver_name)",
"config_path = '%s/%s' % (self.metadata.driver_dir(), CommConfig.config_filename())\nsel... | <|body_start_0|>
self.driver_make = prompt.text('Driver Make')
self.driver_model = prompt.text('Driver Model')
self.driver_name = prompt.text('Driver Name')
self.metadata = Metadata(self.driver_make, self.driver_model, self.driver_name)
<|end_body_0|>
<|body_start_1|>
config_pat... | Main class for running the switch driver process. | SwitchDriver | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SwitchDriver:
"""Main class for running the switch driver process."""
def fetch_metadata(self):
"""@brief collect metadata from the user"""
<|body_0|>
def fetch_comm_config(self):
"""@brief collect connection information for the logger from the user"""
<|... | stack_v2_sparse_classes_36k_train_026907 | 1,415 | no_license | [
{
"docstring": "@brief collect metadata from the user",
"name": "fetch_metadata",
"signature": "def fetch_metadata(self)"
},
{
"docstring": "@brief collect connection information for the logger from the user",
"name": "fetch_comm_config",
"signature": "def fetch_comm_config(self)"
},
... | 3 | null | Implement the Python class `SwitchDriver` described below.
Class description:
Main class for running the switch driver process.
Method signatures and docstrings:
- def fetch_metadata(self): @brief collect metadata from the user
- def fetch_comm_config(self): @brief collect connection information for the logger from t... | Implement the Python class `SwitchDriver` described below.
Class description:
Main class for running the switch driver process.
Method signatures and docstrings:
- def fetch_metadata(self): @brief collect metadata from the user
- def fetch_comm_config(self): @brief collect connection information for the logger from t... | 1d5dbd711b9e5e26837aa1e737124605bdd606e4 | <|skeleton|>
class SwitchDriver:
"""Main class for running the switch driver process."""
def fetch_metadata(self):
"""@brief collect metadata from the user"""
<|body_0|>
def fetch_comm_config(self):
"""@brief collect connection information for the logger from the user"""
<|... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SwitchDriver:
"""Main class for running the switch driver process."""
def fetch_metadata(self):
"""@brief collect metadata from the user"""
self.driver_make = prompt.text('Driver Make')
self.driver_model = prompt.text('Driver Model')
self.driver_name = prompt.text('Driver ... | the_stack_v2_python_sparse | ion/idk/switch_driver.py | ooici-dm/coi-services | train | 4 |
47d07d27879c591979bfea06cfb6154c3e92493c | [
"if not root:\n return None\nroot.left, root.right = (self.mirrorTree(root.right), self.mirrorTree(root.left))\nreturn root",
"if not root:\n return None\ndeque = []\ncur = root\ndeque.append(root)\nwhile deque:\n n = len(deque)\n for i in range(n):\n cur = deque.pop(0)\n if cur.left:\n ... | <|body_start_0|>
if not root:
return None
root.left, root.right = (self.mirrorTree(root.right), self.mirrorTree(root.left))
return root
<|end_body_0|>
<|body_start_1|>
if not root:
return None
deque = []
cur = root
deque.append(root)
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def mirrorTree0(self, root):
""":type root: TreeNode :rtype: TreeNode"""
<|body_0|>
def mirrorTree(self, root):
""":type root: TreeNode :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not root:
return None
... | stack_v2_sparse_classes_36k_train_026908 | 1,316 | no_license | [
{
"docstring": ":type root: TreeNode :rtype: TreeNode",
"name": "mirrorTree0",
"signature": "def mirrorTree0(self, root)"
},
{
"docstring": ":type root: TreeNode :rtype: TreeNode",
"name": "mirrorTree",
"signature": "def mirrorTree(self, root)"
}
] | 2 | stack_v2_sparse_classes_30k_train_016803 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def mirrorTree0(self, root): :type root: TreeNode :rtype: TreeNode
- def mirrorTree(self, root): :type root: TreeNode :rtype: TreeNode | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def mirrorTree0(self, root): :type root: TreeNode :rtype: TreeNode
- def mirrorTree(self, root): :type root: TreeNode :rtype: TreeNode
<|skeleton|>
class Solution:
def mirr... | 6e18c5d257840489cc3fb1079ae3804c743982a4 | <|skeleton|>
class Solution:
def mirrorTree0(self, root):
""":type root: TreeNode :rtype: TreeNode"""
<|body_0|>
def mirrorTree(self, root):
""":type root: TreeNode :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def mirrorTree0(self, root):
""":type root: TreeNode :rtype: TreeNode"""
if not root:
return None
root.left, root.right = (self.mirrorTree(root.right), self.mirrorTree(root.left))
return root
def mirrorTree(self, root):
""":type root: TreeNode... | the_stack_v2_python_sparse | 剑指 Offer 27. 二叉树的镜像.py | yangyuxiang1996/leetcode | train | 0 | |
e196f3d7092cddac0a11bd4ec35ea0fd11b590a7 | [
"self.name = name\nself.document = document\nself.document_type = document_type\nself.bank_account = bank_account",
"if dictionary is None:\n return None\nbank_account = dictionary.get('bank_account')\nname = dictionary.get('name')\ndocument = dictionary.get('document')\ndocument_type = dictionary.get('documen... | <|body_start_0|>
self.name = name
self.document = document
self.document_type = document_type
self.bank_account = bank_account
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
bank_account = dictionary.get('bank_account')
name = dict... | Implementation of the 'GetPixPayerResponse' model. Pix payer data. Attributes: name (string): TODO: type description here. document (string): TODO: type description here. document_type (string): TODO: type description here. bank_account (object): TODO: type description here. | GetPixPayerResponse | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GetPixPayerResponse:
"""Implementation of the 'GetPixPayerResponse' model. Pix payer data. Attributes: name (string): TODO: type description here. document (string): TODO: type description here. document_type (string): TODO: type description here. bank_account (object): TODO: type description her... | stack_v2_sparse_classes_36k_train_026909 | 2,146 | permissive | [
{
"docstring": "Constructor for the GetPixPayerResponse class",
"name": "__init__",
"signature": "def __init__(self, bank_account=None, name=None, document=None, document_type=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionar... | 2 | stack_v2_sparse_classes_30k_train_016441 | Implement the Python class `GetPixPayerResponse` described below.
Class description:
Implementation of the 'GetPixPayerResponse' model. Pix payer data. Attributes: name (string): TODO: type description here. document (string): TODO: type description here. document_type (string): TODO: type description here. bank_accou... | Implement the Python class `GetPixPayerResponse` described below.
Class description:
Implementation of the 'GetPixPayerResponse' model. Pix payer data. Attributes: name (string): TODO: type description here. document (string): TODO: type description here. document_type (string): TODO: type description here. bank_accou... | 95c80c35dd57bb2a238faeaf30d1e3b4544d2298 | <|skeleton|>
class GetPixPayerResponse:
"""Implementation of the 'GetPixPayerResponse' model. Pix payer data. Attributes: name (string): TODO: type description here. document (string): TODO: type description here. document_type (string): TODO: type description here. bank_account (object): TODO: type description her... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GetPixPayerResponse:
"""Implementation of the 'GetPixPayerResponse' model. Pix payer data. Attributes: name (string): TODO: type description here. document (string): TODO: type description here. document_type (string): TODO: type description here. bank_account (object): TODO: type description here."""
de... | the_stack_v2_python_sparse | mundiapi/models/get_pix_payer_response.py | mundipagg/MundiAPI-PYTHON | train | 10 |
e5a54d1d7cceb16f3c6170a8e90c0cb444ab892d | [
"v_icon = v.Icon(left=True, children=['fa-solid fa-download'])\nkwargs.setdefault('class_', 'ma-2')\nkwargs.setdefault('xs5', True)\nkwargs.setdefault('color', 'success')\nkwargs['children'] = [v_icon, text]\nkwargs['target'] = '_blank'\nkwargs['attributes'] = {'download': None}\nsuper().__init__(**kwargs)\nself.se... | <|body_start_0|>
v_icon = v.Icon(left=True, children=['fa-solid fa-download'])
kwargs.setdefault('class_', 'ma-2')
kwargs.setdefault('xs5', True)
kwargs.setdefault('color', 'success')
kwargs['children'] = [v_icon, text]
kwargs['target'] = '_blank'
kwargs['attribut... | DownloadBtn | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DownloadBtn:
def __init__(self, text: str, path: Union[str, Path]='#', **kwargs) -> None:
"""Custom download Btn filled with the provided text. The download icon is automatically embedded and green. The btn only accepts absolute links, if non is provided then the btn stays disabled. Args... | stack_v2_sparse_classes_36k_train_026910 | 5,577 | permissive | [
{
"docstring": "Custom download Btn filled with the provided text. The download icon is automatically embedded and green. The btn only accepts absolute links, if non is provided then the btn stays disabled. Args: text: the message inside the btn path: the absoluteor relative path to a downloadable content kwarg... | 2 | stack_v2_sparse_classes_30k_train_009650 | Implement the Python class `DownloadBtn` described below.
Class description:
Implement the DownloadBtn class.
Method signatures and docstrings:
- def __init__(self, text: str, path: Union[str, Path]='#', **kwargs) -> None: Custom download Btn filled with the provided text. The download icon is automatically embedded ... | Implement the Python class `DownloadBtn` described below.
Class description:
Implement the DownloadBtn class.
Method signatures and docstrings:
- def __init__(self, text: str, path: Union[str, Path]='#', **kwargs) -> None: Custom download Btn filled with the provided text. The download icon is automatically embedded ... | b26c7d698659d5c5a2029d02fc94dcd9daf0df98 | <|skeleton|>
class DownloadBtn:
def __init__(self, text: str, path: Union[str, Path]='#', **kwargs) -> None:
"""Custom download Btn filled with the provided text. The download icon is automatically embedded and green. The btn only accepts absolute links, if non is provided then the btn stays disabled. Args... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DownloadBtn:
def __init__(self, text: str, path: Union[str, Path]='#', **kwargs) -> None:
"""Custom download Btn filled with the provided text. The download icon is automatically embedded and green. The btn only accepts absolute links, if non is provided then the btn stays disabled. Args: text: the me... | the_stack_v2_python_sparse | sepal_ui/sepalwidgets/btn.py | 12rambau/sepal_ui | train | 17 | |
b9571a2a02f9511a1b263bcd61b36e8f62230583 | [
"Component.__init__(self)\nself.name = 'H2_refuel_default_name'\nself.bus_el = None\nself.nominal_value = 1\nself.csv_filename = None\nself.csv_separator = ','\nself.column_title = 0\nself.path = os.path.dirname(__file__)\nself.cool_spec_energy = 730\nself.standby_energy = 8100\nself.life_time = 20\nself.number_of_... | <|body_start_0|>
Component.__init__(self)
self.name = 'H2_refuel_default_name'
self.bus_el = None
self.nominal_value = 1
self.csv_filename = None
self.csv_separator = ','
self.column_title = 0
self.path = os.path.dirname(__file__)
self.cool_spec_en... | :param name: unique name given to the H2 refuel cooling system component :type name: str :param bus_el: electricity bus that is the input of the cooling system :type bus_el: str :param nominal_value: value that the timeseries should be multiplied by, default is 1 :type nominal_value: numerical :param csv_filename: csv ... | H2RefuelCoolingSystem | [
"MIT",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class H2RefuelCoolingSystem:
""":param name: unique name given to the H2 refuel cooling system component :type name: str :param bus_el: electricity bus that is the input of the cooling system :type bus_el: str :param nominal_value: value that the timeseries should be multiplied by, default is 1 :type n... | stack_v2_sparse_classes_36k_train_026911 | 4,958 | permissive | [
{
"docstring": "Constructor method",
"name": "__init__",
"signature": "def __init__(self, params)"
},
{
"docstring": "Creates an oemof Sink component from information given in the H2RefuelCoolingSystem class, to be used in the oemof model :param busses: virtual buses used in the energy system :t... | 2 | stack_v2_sparse_classes_30k_train_002700 | Implement the Python class `H2RefuelCoolingSystem` described below.
Class description:
:param name: unique name given to the H2 refuel cooling system component :type name: str :param bus_el: electricity bus that is the input of the cooling system :type bus_el: str :param nominal_value: value that the timeseries should... | Implement the Python class `H2RefuelCoolingSystem` described below.
Class description:
:param name: unique name given to the H2 refuel cooling system component :type name: str :param bus_el: electricity bus that is the input of the cooling system :type bus_el: str :param nominal_value: value that the timeseries should... | 0d4d55d587c18d9e05258f85c1bb41c0b5fdaee7 | <|skeleton|>
class H2RefuelCoolingSystem:
""":param name: unique name given to the H2 refuel cooling system component :type name: str :param bus_el: electricity bus that is the input of the cooling system :type bus_el: str :param nominal_value: value that the timeseries should be multiplied by, default is 1 :type n... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class H2RefuelCoolingSystem:
""":param name: unique name given to the H2 refuel cooling system component :type name: str :param bus_el: electricity bus that is the input of the cooling system :type bus_el: str :param nominal_value: value that the timeseries should be multiplied by, default is 1 :type nominal_value:... | the_stack_v2_python_sparse | smooth/components/component_h2_refuel_cooling_system.py | rl-institut/smooth | train | 7 |
74454f487b399c1d06e3245182b84481425b4fa5 | [
"render = self.scene.render\ncamera = render.camera\nnp.random.seed(3421)\nR = np.random.permutation(range(camera.imageHeight))\nC = np.random.permutation(range(camera.imageWidth))\nNPixels = 100\nPixels = np.empty((NPixels, 2))\nPixels[:, 0] = C[:NPixels]\nPixels[:, 1] = R[:NPixels]\nfor pixel in Pixels:\n ray ... | <|body_start_0|>
render = self.scene.render
camera = render.camera
np.random.seed(3421)
R = np.random.permutation(range(camera.imageHeight))
C = np.random.permutation(range(camera.imageWidth))
NPixels = 100
Pixels = np.empty((NPixels, 2))
Pixels[:, 0] = C[... | Base class for all test cases. The derived classes override the default setUp method. Tests performed for create_ray(pixel) are: Test if the ray origin in correct Test if the ray is going towards the general direction of lookat Test if the ray going through the center of the image passes through the lookat point in the... | RayCreationFromPixelBaseTests | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RayCreationFromPixelBaseTests:
"""Base class for all test cases. The derived classes override the default setUp method. Tests performed for create_ray(pixel) are: Test if the ray origin in correct Test if the ray is going towards the general direction of lookat Test if the ray going through the c... | stack_v2_sparse_classes_36k_train_026912 | 8,575 | no_license | [
{
"docstring": "Test if the ray origin is set correctly",
"name": "test_ray_through_center_eyePoint",
"signature": "def test_ray_through_center_eyePoint(self)"
},
{
"docstring": "ray direction should be towards the lookat direction",
"name": "test_ray_through_center_towards_neg_z_direction",... | 5 | stack_v2_sparse_classes_30k_train_011766 | Implement the Python class `RayCreationFromPixelBaseTests` described below.
Class description:
Base class for all test cases. The derived classes override the default setUp method. Tests performed for create_ray(pixel) are: Test if the ray origin in correct Test if the ray is going towards the general direction of loo... | Implement the Python class `RayCreationFromPixelBaseTests` described below.
Class description:
Base class for all test cases. The derived classes override the default setUp method. Tests performed for create_ray(pixel) are: Test if the ray origin in correct Test if the ray is going towards the general direction of loo... | 43cf6e7c7c1851c725252a7b6684edaef432bc29 | <|skeleton|>
class RayCreationFromPixelBaseTests:
"""Base class for all test cases. The derived classes override the default setUp method. Tests performed for create_ray(pixel) are: Test if the ray origin in correct Test if the ray is going towards the general direction of lookat Test if the ray going through the c... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RayCreationFromPixelBaseTests:
"""Base class for all test cases. The derived classes override the default setUp method. Tests performed for create_ray(pixel) are: Test if the ray origin in correct Test if the ray is going towards the general direction of lookat Test if the ray going through the center of the ... | the_stack_v2_python_sparse | asses/557/3/Daniel Pham 260526252/TestCreateRay.py | danhp/socs | train | 0 |
87cb2b84b7fb4a62fde3925fb0de75487186f056 | [
"self.x = np.random.randint(0, 16, size=(100, 2)).astype('int64')\ny = count(self.x, 16)\nself.cum_count = np.cumsum(y).astype(self.x.dtype)\nself.out = assign_pos(self.x, self.cum_count)\nself.place = paddle.CUDAPlace(0)",
"paddle.enable_static()\nwith paddle.static.program_guard(paddle.static.Program()):\n x... | <|body_start_0|>
self.x = np.random.randint(0, 16, size=(100, 2)).astype('int64')
y = count(self.x, 16)
self.cum_count = np.cumsum(y).astype(self.x.dtype)
self.out = assign_pos(self.x, self.cum_count)
self.place = paddle.CUDAPlace(0)
<|end_body_0|>
<|body_start_1|>
paddl... | TestAssignPosAPI | TestAssignPosAPI | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestAssignPosAPI:
"""TestAssignPosAPI"""
def setUp(self):
"""setUp"""
<|body_0|>
def test_MoE_assign_pos_static(self):
"""test_MoE_assign_pos_static"""
<|body_1|>
def test_MoE_assign_pos_dygraph(self):
"""test_MoE_assign_pos_dygraph"""
... | stack_v2_sparse_classes_36k_train_026913 | 3,262 | no_license | [
{
"docstring": "setUp",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "test_MoE_assign_pos_static",
"name": "test_MoE_assign_pos_static",
"signature": "def test_MoE_assign_pos_static(self)"
},
{
"docstring": "test_MoE_assign_pos_dygraph",
"name": "test_MoE... | 3 | stack_v2_sparse_classes_30k_train_002486 | Implement the Python class `TestAssignPosAPI` described below.
Class description:
TestAssignPosAPI
Method signatures and docstrings:
- def setUp(self): setUp
- def test_MoE_assign_pos_static(self): test_MoE_assign_pos_static
- def test_MoE_assign_pos_dygraph(self): test_MoE_assign_pos_dygraph | Implement the Python class `TestAssignPosAPI` described below.
Class description:
TestAssignPosAPI
Method signatures and docstrings:
- def setUp(self): setUp
- def test_MoE_assign_pos_static(self): test_MoE_assign_pos_static
- def test_MoE_assign_pos_dygraph(self): test_MoE_assign_pos_dygraph
<|skeleton|>
class Test... | bd3790ce72a2a26611b5eda3901651b5a809348f | <|skeleton|>
class TestAssignPosAPI:
"""TestAssignPosAPI"""
def setUp(self):
"""setUp"""
<|body_0|>
def test_MoE_assign_pos_static(self):
"""test_MoE_assign_pos_static"""
<|body_1|>
def test_MoE_assign_pos_dygraph(self):
"""test_MoE_assign_pos_dygraph"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestAssignPosAPI:
"""TestAssignPosAPI"""
def setUp(self):
"""setUp"""
self.x = np.random.randint(0, 16, size=(100, 2)).astype('int64')
y = count(self.x, 16)
self.cum_count = np.cumsum(y).astype(self.x.dtype)
self.out = assign_pos(self.x, self.cum_count)
sel... | the_stack_v2_python_sparse | distributed/CE_API/case/dist_MoE_assign_pos.py | PaddlePaddle/PaddleTest | train | 42 |
ab027da3cc2b6395a31887ef32303a32bf45527b | [
"self.run_id = run_id\nself.accounts = accounts\nself.athena_queries = athena_queries\nself.sender_email_address = sender_email_address\nself.recipient_email_addresses = recipient_email_addresses\nself.is_smoke_test = is_smoke_test\nself.athena_database_name = athena_database_name\nself.athena_table_name = athena_t... | <|body_start_0|>
self.run_id = run_id
self.accounts = accounts
self.athena_queries = athena_queries
self.sender_email_address = sender_email_address
self.recipient_email_addresses = recipient_email_addresses
self.is_smoke_test = is_smoke_test
self.athena_database_... | S3InsightsInput | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class S3InsightsInput:
def __init__(self, run_id, accounts: List[AccountDetails], athena_queries: List[AthenaQuery], sender_email_address, recipient_email_addresses, is_smoke_test, athena_database_name, athena_table_name, supported_regions):
"""Constructor for S3InsightsInput Arguments: object... | stack_v2_sparse_classes_36k_train_026914 | 7,418 | permissive | [
{
"docstring": "Constructor for S3InsightsInput Arguments: object {S3InsightsInput} -- Instance of S3InsightsInput run_id {string} -- run_id for the current Step Function execution accounts {List[AccountDetails]} -- List of accounts to include in the analysis athena_queries {List[AthenaQuery]} -- List of Athena... | 2 | stack_v2_sparse_classes_30k_train_021146 | Implement the Python class `S3InsightsInput` described below.
Class description:
Implement the S3InsightsInput class.
Method signatures and docstrings:
- def __init__(self, run_id, accounts: List[AccountDetails], athena_queries: List[AthenaQuery], sender_email_address, recipient_email_addresses, is_smoke_test, athena... | Implement the Python class `S3InsightsInput` described below.
Class description:
Implement the S3InsightsInput class.
Method signatures and docstrings:
- def __init__(self, run_id, accounts: List[AccountDetails], athena_queries: List[AthenaQuery], sender_email_address, recipient_email_addresses, is_smoke_test, athena... | 6134347eea980cf9c04c9adcff1906aa0d0912b9 | <|skeleton|>
class S3InsightsInput:
def __init__(self, run_id, accounts: List[AccountDetails], athena_queries: List[AthenaQuery], sender_email_address, recipient_email_addresses, is_smoke_test, athena_database_name, athena_table_name, supported_regions):
"""Constructor for S3InsightsInput Arguments: object... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class S3InsightsInput:
def __init__(self, run_id, accounts: List[AccountDetails], athena_queries: List[AthenaQuery], sender_email_address, recipient_email_addresses, is_smoke_test, athena_database_name, athena_table_name, supported_regions):
"""Constructor for S3InsightsInput Arguments: object {S3InsightsIn... | the_stack_v2_python_sparse | s3insights/lib/config.py | kurmiashish/S3Insights | train | 10 | |
3f50cdff9d0323d2880ddeaf534eb66b5046d6ca | [
"self.n1, self.n2 = (self.initialize_ngram(ngram_file_name1, sep), self.initialize_ngram(ngram_file_name2, sep))\nself.ngrams1, self.floor1, self.L1 = (self.n1[0], self.n1[1], self.n1[2])\nself.ngrams2, self.floor2, self.L2 = (self.n2[0], self.n2[1], self.n2[2])",
"log_score = 0\nfor i in range(len(text) - self.L... | <|body_start_0|>
self.n1, self.n2 = (self.initialize_ngram(ngram_file_name1, sep), self.initialize_ngram(ngram_file_name2, sep))
self.ngrams1, self.floor1, self.L1 = (self.n1[0], self.n1[1], self.n1[2])
self.ngrams2, self.floor2, self.L2 = (self.n2[0], self.n2[1], self.n2[2])
<|end_body_0|>
<|b... | ngram_score | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ngram_score:
def __init__(self, ngram_file_name1, ngram_file_name2, sep=' '):
"""Generally - scorer = ngram_score('english_trigrams.txt', 'english_quadgrams.txt') Initializes log10 probability dictionaries self.ngrams1 & 2, as well as corresponding self.floors1 & 2, and self.L1 & 2 (leng... | stack_v2_sparse_classes_36k_train_026915 | 12,572 | permissive | [
{
"docstring": "Generally - scorer = ngram_score('english_trigrams.txt', 'english_quadgrams.txt') Initializes log10 probability dictionaries self.ngrams1 & 2, as well as corresponding self.floors1 & 2, and self.L1 & 2 (length of ngram) . self.L1 should be of length one shorter than self.L2, e.g. trigram and qua... | 3 | stack_v2_sparse_classes_30k_train_008703 | Implement the Python class `ngram_score` described below.
Class description:
Implement the ngram_score class.
Method signatures and docstrings:
- def __init__(self, ngram_file_name1, ngram_file_name2, sep=' '): Generally - scorer = ngram_score('english_trigrams.txt', 'english_quadgrams.txt') Initializes log10 probabi... | Implement the Python class `ngram_score` described below.
Class description:
Implement the ngram_score class.
Method signatures and docstrings:
- def __init__(self, ngram_file_name1, ngram_file_name2, sep=' '): Generally - scorer = ngram_score('english_trigrams.txt', 'english_quadgrams.txt') Initializes log10 probabi... | afac5a4b3c31ec78e6c8ef211ba9dd664a4070f7 | <|skeleton|>
class ngram_score:
def __init__(self, ngram_file_name1, ngram_file_name2, sep=' '):
"""Generally - scorer = ngram_score('english_trigrams.txt', 'english_quadgrams.txt') Initializes log10 probability dictionaries self.ngrams1 & 2, as well as corresponding self.floors1 & 2, and self.L1 & 2 (leng... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ngram_score:
def __init__(self, ngram_file_name1, ngram_file_name2, sep=' '):
"""Generally - scorer = ngram_score('english_trigrams.txt', 'english_quadgrams.txt') Initializes log10 probability dictionaries self.ngrams1 & 2, as well as corresponding self.floors1 & 2, and self.L1 & 2 (length of ngram) .... | the_stack_v2_python_sparse | basics_less_old.py | BenjiDayan/national_cipher_challenge | train | 0 | |
ce43b92f5b3b349459131776dc4053f9c0fb9126 | [
"out = np.mean(self.detrend(veldat) ** 2, -1, dtype=np.float64).astype('float32')\nout[0] -= noise[0] ** 2\nout[1] -= noise[1] ** 2\nout[2] -= noise[2] ** 2\nreturn out",
"out = np.empty(self._outshape(veldat.shape)[:-1], dtype=np.float32)\nout[0] = np.mean(self.detrend(veldat[0]) * self.detrend(veldat[1]), -1, d... | <|body_start_0|>
out = np.mean(self.detrend(veldat) ** 2, -1, dtype=np.float64).astype('float32')
out[0] -= noise[0] ** 2
out[1] -= noise[1] ** 2
out[2] -= noise[2] ** 2
return out
<|end_body_0|>
<|body_start_1|>
out = np.empty(self._outshape(veldat.shape)[:-1], dtype=np... | VelBinnerTke | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VelBinnerTke:
def calc_tke(self, veldat, noise=[0, 0, 0]):
"""Calculate the tke (variances of u,v,w). Parameters ---------- veldat : a velocity data array. The last dimension is assumed to be time. noise : a three-element vector of the noise levels of the velocity data for ach component ... | stack_v2_sparse_classes_36k_train_026916 | 15,509 | permissive | [
{
"docstring": "Calculate the tke (variances of u,v,w). Parameters ---------- veldat : a velocity data array. The last dimension is assumed to be time. noise : a three-element vector of the noise levels of the velocity data for ach component of velocity. Returns ------- out : An array of tke values.",
"name... | 2 | stack_v2_sparse_classes_30k_train_007660 | Implement the Python class `VelBinnerTke` described below.
Class description:
Implement the VelBinnerTke class.
Method signatures and docstrings:
- def calc_tke(self, veldat, noise=[0, 0, 0]): Calculate the tke (variances of u,v,w). Parameters ---------- veldat : a velocity data array. The last dimension is assumed t... | Implement the Python class `VelBinnerTke` described below.
Class description:
Implement the VelBinnerTke class.
Method signatures and docstrings:
- def calc_tke(self, veldat, noise=[0, 0, 0]): Calculate the tke (variances of u,v,w). Parameters ---------- veldat : a velocity data array. The last dimension is assumed t... | d807d0188f9e5f11845bc3f9efc7d154f729850a | <|skeleton|>
class VelBinnerTke:
def calc_tke(self, veldat, noise=[0, 0, 0]):
"""Calculate the tke (variances of u,v,w). Parameters ---------- veldat : a velocity data array. The last dimension is assumed to be time. noise : a three-element vector of the noise levels of the velocity data for ach component ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class VelBinnerTke:
def calc_tke(self, veldat, noise=[0, 0, 0]):
"""Calculate the tke (variances of u,v,w). Parameters ---------- veldat : a velocity data array. The last dimension is assumed to be time. noise : a three-element vector of the noise levels of the velocity data for ach component of velocity. R... | the_stack_v2_python_sparse | dolfyn/data/velocity_legacy.py | MRE-Code-Hub/dolfyn | train | 0 | |
3ca7612feb92e3bad6d9d06856901e370437829a | [
"class NodeSubgSampler(Sampler):\n\n def __init__(self):\n super(NodeSubgSampler, self).__init__()\n\n def sample(self, g, nids):\n return dgl.node_subgraph(g, nids)\n\nclass EdgeSubgSampler(Sampler):\n\n def __init__(self):\n super(EdgeSubgSampler, self).__init__()\n\n def sample(s... | <|body_start_0|>
class NodeSubgSampler(Sampler):
def __init__(self):
super(NodeSubgSampler, self).__init__()
def sample(self, g, nids):
return dgl.node_subgraph(g, nids)
class EdgeSubgSampler(Sampler):
def __init__(self):
... | Sampler: generate subgraph samples from original graph. Dataloader: iterables over subgraph samples. Together they form the basic primitives of the data pipeline | SamplerTest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SamplerTest:
"""Sampler: generate subgraph samples from original graph. Dataloader: iterables over subgraph samples. Together they form the basic primitives of the data pipeline"""
def test_sampler(self):
"""dgl.dataloading.Sampler:Sampler抽象基类, 核心方法sample(g, indices)"""
<|bod... | stack_v2_sparse_classes_36k_train_026917 | 4,392 | no_license | [
{
"docstring": "dgl.dataloading.Sampler:Sampler抽象基类, 核心方法sample(g, indices)",
"name": "test_sampler",
"signature": "def test_sampler(self)"
},
{
"docstring": "基类: BlockSampler(prefetch_node_feats=None, prefetch_labels=None, prefetch_edge_feats=None) 从原图采样mfgs的Sampler抽象基类 构造参数: - prefetch_node_fe... | 2 | null | Implement the Python class `SamplerTest` described below.
Class description:
Sampler: generate subgraph samples from original graph. Dataloader: iterables over subgraph samples. Together they form the basic primitives of the data pipeline
Method signatures and docstrings:
- def test_sampler(self): dgl.dataloading.Sam... | Implement the Python class `SamplerTest` described below.
Class description:
Sampler: generate subgraph samples from original graph. Dataloader: iterables over subgraph samples. Together they form the basic primitives of the data pipeline
Method signatures and docstrings:
- def test_sampler(self): dgl.dataloading.Sam... | 4f4bd55d7f0502c188976dda2f95fd25614283f3 | <|skeleton|>
class SamplerTest:
"""Sampler: generate subgraph samples from original graph. Dataloader: iterables over subgraph samples. Together they form the basic primitives of the data pipeline"""
def test_sampler(self):
"""dgl.dataloading.Sampler:Sampler抽象基类, 核心方法sample(g, indices)"""
<|bod... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SamplerTest:
"""Sampler: generate subgraph samples from original graph. Dataloader: iterables over subgraph samples. Together they form the basic primitives of the data pipeline"""
def test_sampler(self):
"""dgl.dataloading.Sampler:Sampler抽象基类, 核心方法sample(g, indices)"""
class NodeSubgSamp... | the_stack_v2_python_sparse | com.xulf.learn.ml.dgl/dgl_data/sampler_test.py | sankoudai/py-knowledge-center | train | 0 |
3b9139e709d296580eff8d60daaea3a68cfdde33 | [
"if n == 1:\n return [0]\nif n == 0:\n return []\nadj = [[] for i in range(n)]\nfor e in edges:\n adj[e[0]].append(e[1])\n adj[e[1]].append(e[0])\nq = []\nfor i in range(n):\n if len(adj[i]) == 1:\n q.append(i)\nwhile True:\n next_leaves = []\n for cur in q:\n for e in adj[cur]:\n... | <|body_start_0|>
if n == 1:
return [0]
if n == 0:
return []
adj = [[] for i in range(n)]
for e in edges:
adj[e[0]].append(e[1])
adj[e[1]].append(e[0])
q = []
for i in range(n):
if len(adj[i]) == 1:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findMinHeightTrees(self, n, edges):
""":type n: int :type edges: List[List[int]] :rtype: List[int]"""
<|body_0|>
def findMinHeightTreesDP(self, n, edges):
""":type n: int :type edges: List[List[int]] :rtype: List[int]"""
<|body_1|>
<|end_skelet... | stack_v2_sparse_classes_36k_train_026918 | 2,722 | no_license | [
{
"docstring": ":type n: int :type edges: List[List[int]] :rtype: List[int]",
"name": "findMinHeightTrees",
"signature": "def findMinHeightTrees(self, n, edges)"
},
{
"docstring": ":type n: int :type edges: List[List[int]] :rtype: List[int]",
"name": "findMinHeightTreesDP",
"signature": ... | 2 | stack_v2_sparse_classes_30k_train_005884 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findMinHeightTrees(self, n, edges): :type n: int :type edges: List[List[int]] :rtype: List[int]
- def findMinHeightTreesDP(self, n, edges): :type n: int :type edges: List[Lis... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findMinHeightTrees(self, n, edges): :type n: int :type edges: List[List[int]] :rtype: List[int]
- def findMinHeightTreesDP(self, n, edges): :type n: int :type edges: List[Lis... | 34c21f87eb8cb4dc3cf4bb342345c86ef81d7e81 | <|skeleton|>
class Solution:
def findMinHeightTrees(self, n, edges):
""":type n: int :type edges: List[List[int]] :rtype: List[int]"""
<|body_0|>
def findMinHeightTreesDP(self, n, edges):
""":type n: int :type edges: List[List[int]] :rtype: List[int]"""
<|body_1|>
<|end_skelet... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def findMinHeightTrees(self, n, edges):
""":type n: int :type edges: List[List[int]] :rtype: List[int]"""
if n == 1:
return [0]
if n == 0:
return []
adj = [[] for i in range(n)]
for e in edges:
adj[e[0]].append(e[1])
... | the_stack_v2_python_sparse | leetcode/summer2017/minheighttrees.py | buiducanh/CompetitiveProgramming | train | 0 | |
dba68d4485364fa26db1cbc8a52e061d388a8914 | [
"self._atoms = atoms\nself._max_executors = max_executors\nself._atom_time_map = atom_time_map\nself._project_directory = project_directory",
"try:\n total_estimated_runtime = self._set_expected_atom_times(self._atoms, self._atom_time_map, self._project_directory)\nexcept _AtomTimingDataError:\n grouper = A... | <|body_start_0|>
self._atoms = atoms
self._max_executors = max_executors
self._atom_time_map = atom_time_map
self._project_directory = project_directory
<|end_body_0|>
<|body_start_1|>
try:
total_estimated_runtime = self._set_expected_atom_times(self._atoms, self._at... | This class implements the algorithm to best split & group atoms based on historic time values. This algorithm is somewhat complicated, so I'm going to give a summary here. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Let N be the number of concurrent... | TimeBasedAtomGrouper | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TimeBasedAtomGrouper:
"""This class implements the algorithm to best split & group atoms based on historic time values. This algorithm is somewhat complicated, so I'm going to give a summary here. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~... | stack_v2_sparse_classes_36k_train_026919 | 11,090 | permissive | [
{
"docstring": ":param atoms: the list of atoms for this build :type atoms: list[app.master.atom.Atom] :param max_executors: the maximum number of executors for this build :type max_executors: int :param atom_time_map: a dictionary containing the historic times for atoms for this particular job :type atom_time_... | 4 | stack_v2_sparse_classes_30k_train_000809 | Implement the Python class `TimeBasedAtomGrouper` described below.
Class description:
This class implements the algorithm to best split & group atoms based on historic time values. This algorithm is somewhat complicated, so I'm going to give a summary here. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~... | Implement the Python class `TimeBasedAtomGrouper` described below.
Class description:
This class implements the algorithm to best split & group atoms based on historic time values. This algorithm is somewhat complicated, so I'm going to give a summary here. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~... | 55d18016f2c7d2dbb8aec5879459cae654edb045 | <|skeleton|>
class TimeBasedAtomGrouper:
"""This class implements the algorithm to best split & group atoms based on historic time values. This algorithm is somewhat complicated, so I'm going to give a summary here. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TimeBasedAtomGrouper:
"""This class implements the algorithm to best split & group atoms based on historic time values. This algorithm is somewhat complicated, so I'm going to give a summary here. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~... | the_stack_v2_python_sparse | app/master/time_based_atom_grouper.py | box/ClusterRunner | train | 168 |
8fc4ad8eb0af74968a7f7bec0dd034117fdc371b | [
"self.explanation_type = explanation_type\nself._internal_obj = internal_obj\nself.feature_names = feature_names\nself.feature_types = feature_types\nself.name = name\nself.selector = selector",
"if key is None:\n return self._internal_obj['overall']\nreturn self._internal_obj['specific'][key]",
"from ..visu... | <|body_start_0|>
self.explanation_type = explanation_type
self._internal_obj = internal_obj
self.feature_names = feature_names
self.feature_types = feature_types
self.name = name
self.selector = selector
<|end_body_0|>
<|body_start_1|>
if key is None:
... | Visualizes explanation as a partial dependence plot. | PDPExplanation | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PDPExplanation:
"""Visualizes explanation as a partial dependence plot."""
def __init__(self, explanation_type, internal_obj, feature_names=None, feature_types=None, name=None, selector=None):
"""Initializes class. Args: explanation_type: Type of explanation. internal_obj: A jsonable... | stack_v2_sparse_classes_36k_train_026920 | 8,611 | permissive | [
{
"docstring": "Initializes class. Args: explanation_type: Type of explanation. internal_obj: A jsonable object that backs the explanation. feature_names: List of feature names. feature_types: List of feature types. name: User-defined name of explanation. selector: A dataframe whose indices correspond to explan... | 3 | stack_v2_sparse_classes_30k_train_012529 | Implement the Python class `PDPExplanation` described below.
Class description:
Visualizes explanation as a partial dependence plot.
Method signatures and docstrings:
- def __init__(self, explanation_type, internal_obj, feature_names=None, feature_types=None, name=None, selector=None): Initializes class. Args: explan... | Implement the Python class `PDPExplanation` described below.
Class description:
Visualizes explanation as a partial dependence plot.
Method signatures and docstrings:
- def __init__(self, explanation_type, internal_obj, feature_names=None, feature_types=None, name=None, selector=None): Initializes class. Args: explan... | e6f38ea195aecbbd9d28c7183a83c65ada16e1ae | <|skeleton|>
class PDPExplanation:
"""Visualizes explanation as a partial dependence plot."""
def __init__(self, explanation_type, internal_obj, feature_names=None, feature_types=None, name=None, selector=None):
"""Initializes class. Args: explanation_type: Type of explanation. internal_obj: A jsonable... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PDPExplanation:
"""Visualizes explanation as a partial dependence plot."""
def __init__(self, explanation_type, internal_obj, feature_names=None, feature_types=None, name=None, selector=None):
"""Initializes class. Args: explanation_type: Type of explanation. internal_obj: A jsonable object that ... | the_stack_v2_python_sparse | python/interpret-core/interpret/blackbox/_partialdependence.py | interpretml/interpret | train | 3,731 |
894dbcf15930f474cba7782ddcc6383ada21ac3e | [
"key = 'uatspdbcccgame2014061800'\nk = pyDes.triple_des(key, pyDes.ECB, IV=None, pad=None, padmode=pyDes.PAD_PKCS5)\nd = k.encrypt(json.dumps(text))\nresult = base64.standard_b64encode(d)\nres = result.decode(encoding='utf-8')\nres.replace('\\n', '')\nres.replace('\\r', '')\nreturn res",
"while True:\n user_mo... | <|body_start_0|>
key = 'uatspdbcccgame2014061800'
k = pyDes.triple_des(key, pyDes.ECB, IV=None, pad=None, padmode=pyDes.PAD_PKCS5)
d = k.encrypt(json.dumps(text))
result = base64.standard_b64encode(d)
res = result.decode(encoding='utf-8')
res.replace('\n', '')
res... | s trade端用户登录接口 | TradeLoginApi | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TradeLoginApi:
"""s trade端用户登录接口"""
def login_encrypt(self, text):
"""DES加密,用与登录 :param key: :param text: :return:"""
<|body_0|>
def get_new_mobile(self):
"""获取新手机号,确保数据库中该手机号不存在 :return:"""
<|body_1|>
def login(self, user_type=40, mobile=None, open_... | stack_v2_sparse_classes_36k_train_026921 | 5,620 | permissive | [
{
"docstring": "DES加密,用与登录 :param key: :param text: :return:",
"name": "login_encrypt",
"signature": "def login_encrypt(self, text)"
},
{
"docstring": "获取新手机号,确保数据库中该手机号不存在 :return:",
"name": "get_new_mobile",
"signature": "def get_new_mobile(self)"
},
{
"docstring": "用户登录",
... | 3 | null | Implement the Python class `TradeLoginApi` described below.
Class description:
s trade端用户登录接口
Method signatures and docstrings:
- def login_encrypt(self, text): DES加密,用与登录 :param key: :param text: :return:
- def get_new_mobile(self): 获取新手机号,确保数据库中该手机号不存在 :return:
- def login(self, user_type=40, mobile=None, open_sign... | Implement the Python class `TradeLoginApi` described below.
Class description:
s trade端用户登录接口
Method signatures and docstrings:
- def login_encrypt(self, text): DES加密,用与登录 :param key: :param text: :return:
- def get_new_mobile(self): 获取新手机号,确保数据库中该手机号不存在 :return:
- def login(self, user_type=40, mobile=None, open_sign... | 7e91570fccafa69881be09a1eccb6dfa15ed9039 | <|skeleton|>
class TradeLoginApi:
"""s trade端用户登录接口"""
def login_encrypt(self, text):
"""DES加密,用与登录 :param key: :param text: :return:"""
<|body_0|>
def get_new_mobile(self):
"""获取新手机号,确保数据库中该手机号不存在 :return:"""
<|body_1|>
def login(self, user_type=40, mobile=None, open_... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TradeLoginApi:
"""s trade端用户登录接口"""
def login_encrypt(self, text):
"""DES加密,用与登录 :param key: :param text: :return:"""
key = 'uatspdbcccgame2014061800'
k = pyDes.triple_des(key, pyDes.ECB, IV=None, pad=None, padmode=pyDes.PAD_PKCS5)
d = k.encrypt(json.dumps(text))
r... | the_stack_v2_python_sparse | httpTest/ApiManager/pf_netcar_api/login_api.py | dufuhaoo/httptest | train | 0 |
5546a8028653a9127c578d207a19c50555507e2c | [
"self.kernel = kernel\nself.current_state = state\nself.results = results\nself.reductions = self.all_states = self.trace = None\nself.new_step_size = None\nself._process_results()",
"if unnest.has_nested(self.kernel, 'reducer'):\n reducers = unnest.get_outermost(self.kernel, 'reducer')\n self.reductions = ... | <|body_start_0|>
self.kernel = kernel
self.current_state = state
self.results = results
self.reductions = self.all_states = self.trace = None
self.new_step_size = None
self._process_results()
<|end_body_0|>
<|body_start_1|>
if unnest.has_nested(self.kernel, 'redu... | Facade around outputs of `step_kernel`. Processes results and extracts useful data for analysis and further sampling. | KernelOutputs | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KernelOutputs:
"""Facade around outputs of `step_kernel`. Processes results and extracts useful data for analysis and further sampling."""
def __init__(self, kernel, state, results):
"""Construct `KernelOutputs`. This processes the results, including calling `finalize` on all reducti... | stack_v2_sparse_classes_36k_train_026922 | 3,720 | permissive | [
{
"docstring": "Construct `KernelOutputs`. This processes the results, including calling `finalize` on all reductions. Args: kernel: The `TransitionKernel` which generated the outputs. state: The final chain state as returned by `step_kernel`. results: The final kernel results as returned by `step_kernel`.",
... | 4 | stack_v2_sparse_classes_30k_train_010388 | Implement the Python class `KernelOutputs` described below.
Class description:
Facade around outputs of `step_kernel`. Processes results and extracts useful data for analysis and further sampling.
Method signatures and docstrings:
- def __init__(self, kernel, state, results): Construct `KernelOutputs`. This processes... | Implement the Python class `KernelOutputs` described below.
Class description:
Facade around outputs of `step_kernel`. Processes results and extracts useful data for analysis and further sampling.
Method signatures and docstrings:
- def __init__(self, kernel, state, results): Construct `KernelOutputs`. This processes... | 42a64ba0d9e0973b1707fcd9b8bd8d14b2d4e3e5 | <|skeleton|>
class KernelOutputs:
"""Facade around outputs of `step_kernel`. Processes results and extracts useful data for analysis and further sampling."""
def __init__(self, kernel, state, results):
"""Construct `KernelOutputs`. This processes the results, including calling `finalize` on all reducti... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class KernelOutputs:
"""Facade around outputs of `step_kernel`. Processes results and extracts useful data for analysis and further sampling."""
def __init__(self, kernel, state, results):
"""Construct `KernelOutputs`. This processes the results, including calling `finalize` on all reductions. Args: ke... | the_stack_v2_python_sparse | tensorflow_probability/python/experimental/mcmc/kernel_outputs.py | tensorflow/probability | train | 4,055 |
42ece86291718186ccba119ea83cdbd23002a696 | [
"m, n = (len(nums1), len(nums2))\nif k > m + n:\n return [0] * k\nresult = [0] * k\nfor i in range(max(0, k - n), min(k + 1, m + 1)):\n candidate = self.merge(self.generate_max_array(nums1, i), self.generate_max_array(nums2, k - i), k)\n if self.compare(candidate, result, 0, 0):\n result = candidate... | <|body_start_0|>
m, n = (len(nums1), len(nums2))
if k > m + n:
return [0] * k
result = [0] * k
for i in range(max(0, k - n), min(k + 1, m + 1)):
candidate = self.merge(self.generate_max_array(nums1, i), self.generate_max_array(nums2, k - i), k)
if self... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxNumber(self, nums1, nums2, k):
""":type nums1: List[int] :type nums2: List[int] :type k: int :rtype: List[int]"""
<|body_0|>
def generate_max_array(self, nums, length):
"""generate a maximum subsequence of array with length."""
<|body_1|>
... | stack_v2_sparse_classes_36k_train_026923 | 2,443 | no_license | [
{
"docstring": ":type nums1: List[int] :type nums2: List[int] :type k: int :rtype: List[int]",
"name": "maxNumber",
"signature": "def maxNumber(self, nums1, nums2, k)"
},
{
"docstring": "generate a maximum subsequence of array with length.",
"name": "generate_max_array",
"signature": "de... | 4 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxNumber(self, nums1, nums2, k): :type nums1: List[int] :type nums2: List[int] :type k: int :rtype: List[int]
- def generate_max_array(self, nums, length): generate a maximu... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxNumber(self, nums1, nums2, k): :type nums1: List[int] :type nums2: List[int] :type k: int :rtype: List[int]
- def generate_max_array(self, nums, length): generate a maximu... | 488782d3f1e759da2d32b4e82dbf55b96c431244 | <|skeleton|>
class Solution:
def maxNumber(self, nums1, nums2, k):
""":type nums1: List[int] :type nums2: List[int] :type k: int :rtype: List[int]"""
<|body_0|>
def generate_max_array(self, nums, length):
"""generate a maximum subsequence of array with length."""
<|body_1|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def maxNumber(self, nums1, nums2, k):
""":type nums1: List[int] :type nums2: List[int] :type k: int :rtype: List[int]"""
m, n = (len(nums1), len(nums2))
if k > m + n:
return [0] * k
result = [0] * k
for i in range(max(0, k - n), min(k + 1, m + 1)):... | the_stack_v2_python_sparse | Python/Create Maximum Number.py | ganjingcatherine/LeetCode-1 | train | 0 | |
57d352fdaa44d87c10609d3caffce00a5c219578 | [
"serializer = serializers.LoginUserSerializer(data=request.data)\nserializer.is_valid(raise_exception=True)\nauth.login(request, serializer.instance)\nresp = self.profile(request, *args, **kwargs)\nresp.status_code = status.HTTP_201_CREATED\nreturn resp",
"if request.user:\n auth.logout(request)\nreturn respon... | <|body_start_0|>
serializer = serializers.LoginUserSerializer(data=request.data)
serializer.is_valid(raise_exception=True)
auth.login(request, serializer.instance)
resp = self.profile(request, *args, **kwargs)
resp.status_code = status.HTTP_201_CREATED
return resp
<|end_b... | 登入/登出/帐号 | AuthViewSet | [
"LicenseRef-scancode-unknown-license-reference",
"MulanPSL-1.0",
"LicenseRef-scancode-mulanpsl-1.0-en"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AuthViewSet:
"""登入/登出/帐号"""
def login(self, request, *args, **kwargs):
"""登入"""
<|body_0|>
def logout(self, request, *args, **kwargs):
"""登出"""
<|body_1|>
def profile(self, request, *args, **kwargs):
"""帐号"""
<|body_2|>
def token... | stack_v2_sparse_classes_36k_train_026924 | 3,088 | permissive | [
{
"docstring": "登入",
"name": "login",
"signature": "def login(self, request, *args, **kwargs)"
},
{
"docstring": "登出",
"name": "logout",
"signature": "def logout(self, request, *args, **kwargs)"
},
{
"docstring": "帐号",
"name": "profile",
"signature": "def profile(self, re... | 4 | null | Implement the Python class `AuthViewSet` described below.
Class description:
登入/登出/帐号
Method signatures and docstrings:
- def login(self, request, *args, **kwargs): 登入
- def logout(self, request, *args, **kwargs): 登出
- def profile(self, request, *args, **kwargs): 帐号
- def token(self, request, *args, **kwargs): 令牌 | Implement the Python class `AuthViewSet` described below.
Class description:
登入/登出/帐号
Method signatures and docstrings:
- def login(self, request, *args, **kwargs): 登入
- def logout(self, request, *args, **kwargs): 登出
- def profile(self, request, *args, **kwargs): 帐号
- def token(self, request, *args, **kwargs): 令牌
<|... | aa153919389784354d1efa0c9669393a7ffe7cf7 | <|skeleton|>
class AuthViewSet:
"""登入/登出/帐号"""
def login(self, request, *args, **kwargs):
"""登入"""
<|body_0|>
def logout(self, request, *args, **kwargs):
"""登出"""
<|body_1|>
def profile(self, request, *args, **kwargs):
"""帐号"""
<|body_2|>
def token... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AuthViewSet:
"""登入/登出/帐号"""
def login(self, request, *args, **kwargs):
"""登入"""
serializer = serializers.LoginUserSerializer(data=request.data)
serializer.is_valid(raise_exception=True)
auth.login(request, serializer.instance)
resp = self.profile(request, *args, **... | the_stack_v2_python_sparse | libs/libtest/libtest/biz/viewsets.py | cnicgpaul123/killNCP | train | 6 |
f0c17853e7df6e4cf41e4a159b841b9efdd73201 | [
"m = len(haystack)\nn = len(needle)\nif n == 0:\n return 0\nelif n > m:\n return -1\ni = 0\nwhile i < m - n + 1:\n k = 0\n while k < n and haystack[i + k] == needle[k]:\n k += 1\n if k == len(needle):\n return i\n i += 1\nreturn -1",
"m = len(haystack)\nn = len(needle)\nif n == 0:\... | <|body_start_0|>
m = len(haystack)
n = len(needle)
if n == 0:
return 0
elif n > m:
return -1
i = 0
while i < m - n + 1:
k = 0
while k < n and haystack[i + k] == needle[k]:
k += 1
if k == len(needl... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def strStr(self, haystack: str, needle: str) -> int:
"""LC 28. Implement strStr() Naive implementation Time complexity: O(M*N)"""
<|body_0|>
def strStr(self, haystack: str, needle: str) -> int:
"""KMP implementation"""
<|body_1|>
<|end_skeleton|>
... | stack_v2_sparse_classes_36k_train_026925 | 1,232 | no_license | [
{
"docstring": "LC 28. Implement strStr() Naive implementation Time complexity: O(M*N)",
"name": "strStr",
"signature": "def strStr(self, haystack: str, needle: str) -> int"
},
{
"docstring": "KMP implementation",
"name": "strStr",
"signature": "def strStr(self, haystack: str, needle: st... | 2 | stack_v2_sparse_classes_30k_train_012042 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def strStr(self, haystack: str, needle: str) -> int: LC 28. Implement strStr() Naive implementation Time complexity: O(M*N)
- def strStr(self, haystack: str, needle: str) -> int:... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def strStr(self, haystack: str, needle: str) -> int: LC 28. Implement strStr() Naive implementation Time complexity: O(M*N)
- def strStr(self, haystack: str, needle: str) -> int:... | 89b6c180bb772978b6646131f9734b122e745f9c | <|skeleton|>
class Solution:
def strStr(self, haystack: str, needle: str) -> int:
"""LC 28. Implement strStr() Naive implementation Time complexity: O(M*N)"""
<|body_0|>
def strStr(self, haystack: str, needle: str) -> int:
"""KMP implementation"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def strStr(self, haystack: str, needle: str) -> int:
"""LC 28. Implement strStr() Naive implementation Time complexity: O(M*N)"""
m = len(haystack)
n = len(needle)
if n == 0:
return 0
elif n > m:
return -1
i = 0
while i ... | the_stack_v2_python_sparse | string/python/strstr.py | dyf102/LC-daily | train | 2 | |
b55279ee802c714a05ee4efbddbe13cf4ebf2c6e | [
"self.count = []\nself.val = []\ntotal = 0\nfor i in range(0, len(encoding), 2):\n if encoding[i] == 0:\n continue\n total += encoding[i]\n self.count.append(total)\n self.val.append(encoding[i + 1])\nself.cur = 0",
"self.cur += n\ni = bisect.bisect_left(self.count, self.cur)\nif i == len(self.... | <|body_start_0|>
self.count = []
self.val = []
total = 0
for i in range(0, len(encoding), 2):
if encoding[i] == 0:
continue
total += encoding[i]
self.count.append(total)
self.val.append(encoding[i + 1])
self.cur = 0
... | RLEIterator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RLEIterator:
def __init__(self, encoding):
""":type encoding: List[int] binary search 09/29/2022 15:19 Accepted 51 ms 14 MB python prefix sum + binary search medium"""
<|body_0|>
def next(self, n):
""":type n: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
... | stack_v2_sparse_classes_36k_train_026926 | 3,450 | no_license | [
{
"docstring": ":type encoding: List[int] binary search 09/29/2022 15:19 Accepted 51 ms 14 MB python prefix sum + binary search medium",
"name": "__init__",
"signature": "def __init__(self, encoding)"
},
{
"docstring": ":type n: int :rtype: int",
"name": "next",
"signature": "def next(se... | 2 | stack_v2_sparse_classes_30k_train_013400 | Implement the Python class `RLEIterator` described below.
Class description:
Implement the RLEIterator class.
Method signatures and docstrings:
- def __init__(self, encoding): :type encoding: List[int] binary search 09/29/2022 15:19 Accepted 51 ms 14 MB python prefix sum + binary search medium
- def next(self, n): :t... | Implement the Python class `RLEIterator` described below.
Class description:
Implement the RLEIterator class.
Method signatures and docstrings:
- def __init__(self, encoding): :type encoding: List[int] binary search 09/29/2022 15:19 Accepted 51 ms 14 MB python prefix sum + binary search medium
- def next(self, n): :t... | 02726da394971ef02616a038dadc126c6ff260de | <|skeleton|>
class RLEIterator:
def __init__(self, encoding):
""":type encoding: List[int] binary search 09/29/2022 15:19 Accepted 51 ms 14 MB python prefix sum + binary search medium"""
<|body_0|>
def next(self, n):
""":type n: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RLEIterator:
def __init__(self, encoding):
""":type encoding: List[int] binary search 09/29/2022 15:19 Accepted 51 ms 14 MB python prefix sum + binary search medium"""
self.count = []
self.val = []
total = 0
for i in range(0, len(encoding), 2):
if encoding[i... | the_stack_v2_python_sparse | design/N900_RLEIterator.py | zerghua/leetcode-python | train | 2 | |
4d7a4390b447ea6fa2e0f1b0bc3749b4866b057c | [
"self.recipients = recipients\nself.subject = subject\nself.body = body",
"result = 'To: '\nfor contact in self.recipients:\n result = result + '{0}, '.format(contact)\nresult = result + '\\nSubject: {0}'.format(self.subject)\nresult = result + '\\n{0}'.format(self.body)\nreturn result"
] | <|body_start_0|>
self.recipients = recipients
self.subject = subject
self.body = body
<|end_body_0|>
<|body_start_1|>
result = 'To: '
for contact in self.recipients:
result = result + '{0}, '.format(contact)
result = result + '\nSubject: {0}'.format(self.subj... | An email with a list of recipients, a subject and a body. | Email | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Email:
"""An email with a list of recipients, a subject and a body."""
def __init__(self, recipients, subject, body):
"""(Email, list of Contact, str, str) -> NoneType Initialize this Email with recipients, subject and body."""
<|body_0|>
def __str__(self):
"""(E... | stack_v2_sparse_classes_36k_train_026927 | 2,775 | no_license | [
{
"docstring": "(Email, list of Contact, str, str) -> NoneType Initialize this Email with recipients, subject and body.",
"name": "__init__",
"signature": "def __init__(self, recipients, subject, body)"
},
{
"docstring": "(Email) -> str Return a string representation of this email.",
"name":... | 2 | stack_v2_sparse_classes_30k_train_014172 | Implement the Python class `Email` described below.
Class description:
An email with a list of recipients, a subject and a body.
Method signatures and docstrings:
- def __init__(self, recipients, subject, body): (Email, list of Contact, str, str) -> NoneType Initialize this Email with recipients, subject and body.
- ... | Implement the Python class `Email` described below.
Class description:
An email with a list of recipients, a subject and a body.
Method signatures and docstrings:
- def __init__(self, recipients, subject, body): (Email, list of Contact, str, str) -> NoneType Initialize this Email with recipients, subject and body.
- ... | 4d431edb3c089267b07639f0badf34240db02335 | <|skeleton|>
class Email:
"""An email with a list of recipients, a subject and a body."""
def __init__(self, recipients, subject, body):
"""(Email, list of Contact, str, str) -> NoneType Initialize this Email with recipients, subject and body."""
<|body_0|>
def __str__(self):
"""(E... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Email:
"""An email with a list of recipients, a subject and a body."""
def __init__(self, recipients, subject, body):
"""(Email, list of Contact, str, str) -> NoneType Initialize this Email with recipients, subject and body."""
self.recipients = recipients
self.subject = subject
... | the_stack_v2_python_sparse | week4/wk4ex1.py | scottreeves10/ltp2 | train | 0 |
398b915735411802256219193d101cb7ee456561 | [
"helpMessage = 'Bump the skelebot.yaml project version'\nargHelp = 'Select the version number that should be bumped'\nparser = subparsers.add_parser('bump', help=helpMessage)\nparser.add_argument('version', help=argHelp, choices=[MAJOR, MINOR, PATCH])\nreturn subparsers",
"oldVersion = config.version\nversion = a... | <|body_start_0|>
helpMessage = 'Bump the skelebot.yaml project version'
argHelp = 'Select the version number that should be bumped'
parser = subparsers.add_parser('bump', help=helpMessage)
parser.add_argument('version', help=argHelp, choices=[MAJOR, MINOR, PATCH])
return subparse... | Bump Class Provides the ability to bump the major, minor, or patch version of a project based on Semantic Versioning standards with the 'bump' command | Bump | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Bump:
"""Bump Class Provides the ability to bump the major, minor, or patch version of a project based on Semantic Versioning standards with the 'bump' command"""
def addParsers(self, subparsers):
"""SkeleParser Hook Adds a parser for the bump command that takes in a single argument ... | stack_v2_sparse_classes_36k_train_026928 | 1,763 | permissive | [
{
"docstring": "SkeleParser Hook Adds a parser for the bump command that takes in a single argument called version to define whether it should bump the major, minor, or patch version of the project",
"name": "addParsers",
"signature": "def addParsers(self, subparsers)"
},
{
"docstring": "Executi... | 2 | stack_v2_sparse_classes_30k_train_015320 | Implement the Python class `Bump` described below.
Class description:
Bump Class Provides the ability to bump the major, minor, or patch version of a project based on Semantic Versioning standards with the 'bump' command
Method signatures and docstrings:
- def addParsers(self, subparsers): SkeleParser Hook Adds a par... | Implement the Python class `Bump` described below.
Class description:
Bump Class Provides the ability to bump the major, minor, or patch version of a project based on Semantic Versioning standards with the 'bump' command
Method signatures and docstrings:
- def addParsers(self, subparsers): SkeleParser Hook Adds a par... | c4299702994cdd55738de4591e85f4dc2a424d19 | <|skeleton|>
class Bump:
"""Bump Class Provides the ability to bump the major, minor, or patch version of a project based on Semantic Versioning standards with the 'bump' command"""
def addParsers(self, subparsers):
"""SkeleParser Hook Adds a parser for the bump command that takes in a single argument ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Bump:
"""Bump Class Provides the ability to bump the major, minor, or patch version of a project based on Semantic Versioning standards with the 'bump' command"""
def addParsers(self, subparsers):
"""SkeleParser Hook Adds a parser for the bump command that takes in a single argument called versio... | the_stack_v2_python_sparse | skelebot/components/bump.py | carsdotcom/skelebot | train | 37 |
e3d8fd40944709a6c8a2b49af14c7fb9174ac4f8 | [
"if not root:\n return 0\ndepth = 0\nstack = [root.left, root.right]\nwhile stack:\n for i in range(len(stack) // 2):\n node1, node2 = (stack.pop(0), stack.pop(0))\n if node1:\n stack.extend([node1.left, node1.right])\n if node2:\n stack.extend([node2.left, node2.rig... | <|body_start_0|>
if not root:
return 0
depth = 0
stack = [root.left, root.right]
while stack:
for i in range(len(stack) // 2):
node1, node2 = (stack.pop(0), stack.pop(0))
if node1:
stack.extend([node1.left, node1... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxDepth(self, root):
""":type root: TreeNode :rtype: int"""
<|body_0|>
def maxDepth1(self, root):
""":type root: TreeNode :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not root:
return 0
depth = 0
... | stack_v2_sparse_classes_36k_train_026929 | 990 | no_license | [
{
"docstring": ":type root: TreeNode :rtype: int",
"name": "maxDepth",
"signature": "def maxDepth(self, root)"
},
{
"docstring": ":type root: TreeNode :rtype: int",
"name": "maxDepth1",
"signature": "def maxDepth1(self, root)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxDepth(self, root): :type root: TreeNode :rtype: int
- def maxDepth1(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 maxDepth(self, root): :type root: TreeNode :rtype: int
- def maxDepth1(self, root): :type root: TreeNode :rtype: int
<|skeleton|>
class Solution:
def maxDepth(self, roo... | b8ec1350e904665f1375c29a53f443ecf262d723 | <|skeleton|>
class Solution:
def maxDepth(self, root):
""":type root: TreeNode :rtype: int"""
<|body_0|>
def maxDepth1(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 maxDepth(self, root):
""":type root: TreeNode :rtype: int"""
if not root:
return 0
depth = 0
stack = [root.left, root.right]
while stack:
for i in range(len(stack) // 2):
node1, node2 = (stack.pop(0), stack.pop(0))
... | the_stack_v2_python_sparse | leetcode/104二叉树的最大深度.py | ShawDa/Coding | train | 0 | |
3cb2059fc9c54c2f688feaf52eb7d1cef724f5de | [
"s = ''\nq = []\nif root:\n q.append(root)\nwhile not q:\n t = q.pop(0)\n if t:\n s += ',' + str(t.val)\n q.append(t.left)\n q.append(t.right)\n else:\n s += ',' + 'null'\nreturn s.lstrip(',')",
"if not data:\n return None\ntokens = data.split(',')\nif not tokens and tok... | <|body_start_0|>
s = ''
q = []
if root:
q.append(root)
while not q:
t = q.pop(0)
if t:
s += ',' + str(t.val)
q.append(t.left)
q.append(t.right)
else:
s += ',' + 'null'
... | 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_026930 | 1,563 | 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:... | be47d32fb11b9dcb8ab7368a4294461b5819c7b1 | <|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"""
s = ''
q = []
if root:
q.append(root)
while not q:
t = q.pop(0)
if t:
s += ',' + str(t.val)
q.... | the_stack_v2_python_sparse | python/Interview/S297.py | liqiushui/leetcode | train | 0 | |
eb26eba4159df0beaa4c30e15334d8697486ae93 | [
"for validator in self.validators:\n if not validator(product):\n return False\nreturn True",
"filtered_products = []\nfor product in products:\n if self.is_valid(product):\n filtered_products.append(product)\nreturn filtered_products"
] | <|body_start_0|>
for validator in self.validators:
if not validator(product):
return False
return True
<|end_body_0|>
<|body_start_1|>
filtered_products = []
for product in products:
if self.is_valid(product):
filtered_products.app... | Objet responsable de valider les produits par rapport aux règles dans validators et de ne conserver que ceux qui sont valides. | ProductValidator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProductValidator:
"""Objet responsable de valider les produits par rapport aux règles dans validators et de ne conserver que ceux qui sont valides."""
def is_valid(self, product):
"""Retourne True si le product passé en argument est valide. Args: product (dict): dictionnaire contenan... | stack_v2_sparse_classes_36k_train_026931 | 1,781 | no_license | [
{
"docstring": "Retourne True si le product passé en argument est valide. Args: product (dict): dictionnaire contenant les données d'un produit Return: True si le produit est valide.",
"name": "is_valid",
"signature": "def is_valid(self, product)"
},
{
"docstring": "Elimine les produits invalide... | 2 | stack_v2_sparse_classes_30k_train_011022 | Implement the Python class `ProductValidator` described below.
Class description:
Objet responsable de valider les produits par rapport aux règles dans validators et de ne conserver que ceux qui sont valides.
Method signatures and docstrings:
- def is_valid(self, product): Retourne True si le product passé en argumen... | Implement the Python class `ProductValidator` described below.
Class description:
Objet responsable de valider les produits par rapport aux règles dans validators et de ne conserver que ceux qui sont valides.
Method signatures and docstrings:
- def is_valid(self, product): Retourne True si le product passé en argumen... | d28e6ea70d6afa0e47bc42cfbbf4a3cd7da00bfb | <|skeleton|>
class ProductValidator:
"""Objet responsable de valider les produits par rapport aux règles dans validators et de ne conserver que ceux qui sont valides."""
def is_valid(self, product):
"""Retourne True si le product passé en argument est valide. Args: product (dict): dictionnaire contenan... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ProductValidator:
"""Objet responsable de valider les produits par rapport aux règles dans validators et de ne conserver que ceux qui sont valides."""
def is_valid(self, product):
"""Retourne True si le product passé en argument est valide. Args: product (dict): dictionnaire contenant les données... | the_stack_v2_python_sparse | products/requests_to_OFF/validator.py | pythonmentor/clelio-p8 | train | 0 |
b3e49dd7b807ec6346a079cb37bb958035e058c8 | [
"query_params = request.query_params.copy()\nis_active_list = query_params.getlist('is_active', [])\nif len(is_active_list) == 0:\n return None\nelif len(is_active_list) > 1:\n raise APIException(\"'is_active' parameter appears more than once\")\nelse:\n return is_active_list[0]",
"is_active = self.get_i... | <|body_start_0|>
query_params = request.query_params.copy()
is_active_list = query_params.getlist('is_active', [])
if len(is_active_list) == 0:
return None
elif len(is_active_list) > 1:
raise APIException("'is_active' parameter appears more than once")
els... | Filter the Queryset to show 'is_active' models only by default. This Filter can be applied to any model that has a field called 'is_active'. | ActiveModelFilter | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ActiveModelFilter:
"""Filter the Queryset to show 'is_active' models only by default. This Filter can be applied to any model that has a field called 'is_active'."""
def get_is_active_query_param(self, request):
"""Get the 'is_active' parameter value from the request object :param re... | stack_v2_sparse_classes_36k_train_026932 | 8,566 | permissive | [
{
"docstring": "Get the 'is_active' parameter value from the request object :param request: :return:",
"name": "get_is_active_query_param",
"signature": "def get_is_active_query_param(self, request)"
},
{
"docstring": "Apply a filter the queryset based on the value of 'is_active' :param request:... | 2 | stack_v2_sparse_classes_30k_train_020353 | Implement the Python class `ActiveModelFilter` described below.
Class description:
Filter the Queryset to show 'is_active' models only by default. This Filter can be applied to any model that has a field called 'is_active'.
Method signatures and docstrings:
- def get_is_active_query_param(self, request): Get the 'is_... | Implement the Python class `ActiveModelFilter` described below.
Class description:
Filter the Queryset to show 'is_active' models only by default. This Filter can be applied to any model that has a field called 'is_active'.
Method signatures and docstrings:
- def get_is_active_query_param(self, request): Get the 'is_... | 6db6794fd1811b316dee6f6661986e027d8a594b | <|skeleton|>
class ActiveModelFilter:
"""Filter the Queryset to show 'is_active' models only by default. This Filter can be applied to any model that has a field called 'is_active'."""
def get_is_active_query_param(self, request):
"""Get the 'is_active' parameter value from the request object :param re... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ActiveModelFilter:
"""Filter the Queryset to show 'is_active' models only by default. This Filter can be applied to any model that has a field called 'is_active'."""
def get_is_active_query_param(self, request):
"""Get the 'is_active' parameter value from the request object :param request: :retur... | the_stack_v2_python_sparse | api/radiam/api/filters.py | usask-rc/radiam | train | 2 |
5b6dfc6561fb2ca17103d9d165fe42f058231750 | [
"if not graph.is_directed():\n raise ValueError('the graph is not directed')\nself.graph = graph\nself.parent = dict(((node, None) for node in self.graph.iternodes()))\nself.distance = dict(((node, float('inf')) for node in self.graph.iternodes()))\nself.source = None",
"self.source = source\nself.distance[sou... | <|body_start_0|>
if not graph.is_directed():
raise ValueError('the graph is not directed')
self.graph = graph
self.parent = dict(((node, None) for node in self.graph.iternodes()))
self.distance = dict(((node, float('inf')) for node in self.graph.iternodes()))
self.sou... | The Bellman-Ford algorithm for the shortest path problem. Attributes ---------- graph : input directed weighted graph parent : dict with nodes (shortest path tree) distance : dict with nodes (distances to source node) source : node Examples -------- >>> from graphtheory.structures.edges import Edge >>> from graphtheory... | BellmanFord | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BellmanFord:
"""The Bellman-Ford algorithm for the shortest path problem. Attributes ---------- graph : input directed weighted graph parent : dict with nodes (shortest path tree) distance : dict with nodes (distances to source node) source : node Examples -------- >>> from graphtheory.structures... | stack_v2_sparse_classes_36k_train_026933 | 3,084 | permissive | [
{
"docstring": "The algorithm initialization. Parameters ---------- graph : directed weighted graph",
"name": "__init__",
"signature": "def __init__(self, graph)"
},
{
"docstring": "Finding shortest paths from the source. Parameters ---------- source : node",
"name": "run",
"signature": ... | 4 | stack_v2_sparse_classes_30k_train_016785 | Implement the Python class `BellmanFord` described below.
Class description:
The Bellman-Ford algorithm for the shortest path problem. Attributes ---------- graph : input directed weighted graph parent : dict with nodes (shortest path tree) distance : dict with nodes (distances to source node) source : node Examples -... | Implement the Python class `BellmanFord` described below.
Class description:
The Bellman-Ford algorithm for the shortest path problem. Attributes ---------- graph : input directed weighted graph parent : dict with nodes (shortest path tree) distance : dict with nodes (distances to source node) source : node Examples -... | 0ff4ae303e8824e6bb8474d23b29a7b3e5ed8e60 | <|skeleton|>
class BellmanFord:
"""The Bellman-Ford algorithm for the shortest path problem. Attributes ---------- graph : input directed weighted graph parent : dict with nodes (shortest path tree) distance : dict with nodes (distances to source node) source : node Examples -------- >>> from graphtheory.structures... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BellmanFord:
"""The Bellman-Ford algorithm for the shortest path problem. Attributes ---------- graph : input directed weighted graph parent : dict with nodes (shortest path tree) distance : dict with nodes (distances to source node) source : node Examples -------- >>> from graphtheory.structures.edges import... | the_stack_v2_python_sparse | graphtheory/shortestpaths/bellmanford.py | kgashok/graphs-dict | train | 0 |
35c1c558537f07acdb4f2470cb96e1cf791c61ff | [
"self.surface = pygame.Surface(dim)\nself.height = dim[1]\nself.chunk = dim[0]\nself.format = pyaudio.paInt16\naudio = pyaudio.PyAudio()\nself.stream = audio.open(format=pyaudio.paInt16, channels=1, rate=rate, input=True, frames_per_buffer=self.chunk)\nself.colors = get_rgb_color_gradient((255, 0, 0), (0, 0, 255), ... | <|body_start_0|>
self.surface = pygame.Surface(dim)
self.height = dim[1]
self.chunk = dim[0]
self.format = pyaudio.paInt16
audio = pyaudio.PyAudio()
self.stream = audio.open(format=pyaudio.paInt16, channels=1, rate=rate, input=True, frames_per_buffer=self.chunk)
s... | audio spectrograph effect for background | SpectrumBar | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SpectrumBar:
"""audio spectrograph effect for background"""
def __init__(self, dim: tuple, rate: int=44100):
"""bar spectrograph :param dim: dimension in (x, y) :param rate: sampling rate"""
<|body_0|>
def update(self):
"""update every frame"""
<|body_1|>... | stack_v2_sparse_classes_36k_train_026934 | 4,338 | no_license | [
{
"docstring": "bar spectrograph :param dim: dimension in (x, y) :param rate: sampling rate",
"name": "__init__",
"signature": "def __init__(self, dim: tuple, rate: int=44100)"
},
{
"docstring": "update every frame",
"name": "update",
"signature": "def update(self)"
}
] | 2 | null | Implement the Python class `SpectrumBar` described below.
Class description:
audio spectrograph effect for background
Method signatures and docstrings:
- def __init__(self, dim: tuple, rate: int=44100): bar spectrograph :param dim: dimension in (x, y) :param rate: sampling rate
- def update(self): update every frame | Implement the Python class `SpectrumBar` described below.
Class description:
audio spectrograph effect for background
Method signatures and docstrings:
- def __init__(self, dim: tuple, rate: int=44100): bar spectrograph :param dim: dimension in (x, y) :param rate: sampling rate
- def update(self): update every frame
... | 1fd421195a2888c0588a49f5a043a1110eedcdbf | <|skeleton|>
class SpectrumBar:
"""audio spectrograph effect for background"""
def __init__(self, dim: tuple, rate: int=44100):
"""bar spectrograph :param dim: dimension in (x, y) :param rate: sampling rate"""
<|body_0|>
def update(self):
"""update every frame"""
<|body_1|>... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SpectrumBar:
"""audio spectrograph effect for background"""
def __init__(self, dim: tuple, rate: int=44100):
"""bar spectrograph :param dim: dimension in (x, y) :param rate: sampling rate"""
self.surface = pygame.Surface(dim)
self.height = dim[1]
self.chunk = dim[0]
... | the_stack_v2_python_sparse | effects/Spectrographs.py | gunny26/pygame | train | 5 |
a819a1bd35a6d46f448fd4facf8c50c11460d70e | [
"self.qa_yaml_name = os.environ['qa_yaml_name']\nself.rd_yaml_path = os.environ['rd_yaml_path']\nlogger.info('###self.qa_yaml_name: {}'.format(self.qa_yaml_name))\nself.reponame = os.environ['reponame']\nself.system = os.environ['system']\nself.step = os.environ['step']\nself.paddle_whl = os.environ['paddle_whl']\n... | <|body_start_0|>
self.qa_yaml_name = os.environ['qa_yaml_name']
self.rd_yaml_path = os.environ['rd_yaml_path']
logger.info('###self.qa_yaml_name: {}'.format(self.qa_yaml_name))
self.reponame = os.environ['reponame']
self.system = os.environ['system']
self.step = os.enviro... | 自定义环境准备 | Paddle3D_Start | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Paddle3D_Start:
"""自定义环境准备"""
def __init__(self):
"""初始化变量"""
<|body_0|>
def prepare_config_params(self):
"""准备配置参数"""
<|body_1|>
def prepare_pretrained_model(self):
"""prepare_pretrained_model"""
<|body_2|>
def gengrate_test_cas... | stack_v2_sparse_classes_36k_train_026935 | 6,691 | no_license | [
{
"docstring": "初始化变量",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "准备配置参数",
"name": "prepare_config_params",
"signature": "def prepare_config_params(self)"
},
{
"docstring": "prepare_pretrained_model",
"name": "prepare_pretrained_model",
"sig... | 5 | null | Implement the Python class `Paddle3D_Start` described below.
Class description:
自定义环境准备
Method signatures and docstrings:
- def __init__(self): 初始化变量
- def prepare_config_params(self): 准备配置参数
- def prepare_pretrained_model(self): prepare_pretrained_model
- def gengrate_test_case(self): gengrate_test_case
- def build_... | Implement the Python class `Paddle3D_Start` described below.
Class description:
自定义环境准备
Method signatures and docstrings:
- def __init__(self): 初始化变量
- def prepare_config_params(self): 准备配置参数
- def prepare_pretrained_model(self): prepare_pretrained_model
- def gengrate_test_case(self): gengrate_test_case
- def build_... | bd3790ce72a2a26611b5eda3901651b5a809348f | <|skeleton|>
class Paddle3D_Start:
"""自定义环境准备"""
def __init__(self):
"""初始化变量"""
<|body_0|>
def prepare_config_params(self):
"""准备配置参数"""
<|body_1|>
def prepare_pretrained_model(self):
"""prepare_pretrained_model"""
<|body_2|>
def gengrate_test_cas... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Paddle3D_Start:
"""自定义环境准备"""
def __init__(self):
"""初始化变量"""
self.qa_yaml_name = os.environ['qa_yaml_name']
self.rd_yaml_path = os.environ['rd_yaml_path']
logger.info('###self.qa_yaml_name: {}'.format(self.qa_yaml_name))
self.reponame = os.environ['reponame']
... | the_stack_v2_python_sparse | models_restruct/Paddle3D/tools/start.py | PaddlePaddle/PaddleTest | train | 42 |
b0cfb0a69a332180635526a386becb6f22e55cd4 | [
"self.assertFalse(module_info.AidegenModuleInfo.is_target_module({}))\nself.assertFalse(module_info.AidegenModuleInfo.is_target_module({'path': ''}))\nself.assertFalse(module_info.AidegenModuleInfo.is_target_module({'class': ''}))\nself.assertTrue(module_info.AidegenModuleInfo.is_target_module({'class': ['APPS']}))... | <|body_start_0|>
self.assertFalse(module_info.AidegenModuleInfo.is_target_module({}))
self.assertFalse(module_info.AidegenModuleInfo.is_target_module({'path': ''}))
self.assertFalse(module_info.AidegenModuleInfo.is_target_module({'class': ''}))
self.assertTrue(module_info.AidegenModuleIn... | Unit tests for module_info.py | AidegenModuleInfoUnittests | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AidegenModuleInfoUnittests:
"""Unit tests for module_info.py"""
def test_is_target_module(self):
"""Test is_target_module with different conditions."""
<|body_0|>
def test_is_project_path_relative_module(self):
"""Test is_project_path_relative_module handling."""... | stack_v2_sparse_classes_36k_train_026936 | 4,465 | no_license | [
{
"docstring": "Test is_target_module with different conditions.",
"name": "test_is_target_module",
"signature": "def test_is_target_module(self)"
},
{
"docstring": "Test is_project_path_relative_module handling.",
"name": "test_is_project_path_relative_module",
"signature": "def test_is... | 3 | null | Implement the Python class `AidegenModuleInfoUnittests` described below.
Class description:
Unit tests for module_info.py
Method signatures and docstrings:
- def test_is_target_module(self): Test is_target_module with different conditions.
- def test_is_project_path_relative_module(self): Test is_project_path_relativ... | Implement the Python class `AidegenModuleInfoUnittests` described below.
Class description:
Unit tests for module_info.py
Method signatures and docstrings:
- def test_is_target_module(self): Test is_target_module with different conditions.
- def test_is_project_path_relative_module(self): Test is_project_path_relativ... | 78a61ca023cbf1a0cecfef8b97df2b274ac3a988 | <|skeleton|>
class AidegenModuleInfoUnittests:
"""Unit tests for module_info.py"""
def test_is_target_module(self):
"""Test is_target_module with different conditions."""
<|body_0|>
def test_is_project_path_relative_module(self):
"""Test is_project_path_relative_module handling."""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AidegenModuleInfoUnittests:
"""Unit tests for module_info.py"""
def test_is_target_module(self):
"""Test is_target_module with different conditions."""
self.assertFalse(module_info.AidegenModuleInfo.is_target_module({}))
self.assertFalse(module_info.AidegenModuleInfo.is_target_mod... | the_stack_v2_python_sparse | tools/asuite/aidegen/lib/module_info_unittest.py | ZYHGOD-1/Aosp11 | train | 0 |
3883730c611e1d50c29c8c2b3739550aa415269a | [
"listener = self[event_name] = _EventListener(event_name)\ngame_event_manager.add_listener(listener.listener, event_name, True)\nreturn listener",
"if not callable(callback):\n raise TypeError(\"'\" + type(callback).__name__ + \"' object is not callable.\")\nself[event_name].append(callback)",
"if event_name... | <|body_start_0|>
listener = self[event_name] = _EventListener(event_name)
game_event_manager.add_listener(listener.listener, event_name, True)
return listener
<|end_body_0|>
<|body_start_1|>
if not callable(callback):
raise TypeError("'" + type(callback).__name__ + "' object... | Stores Event names with all registered callbacks. | _EventManager | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _EventManager:
"""Stores Event names with all registered callbacks."""
def __missing__(self, event_name):
"""Add an event to the dictionary and registers for it."""
<|body_0|>
def register_for_event(self, event_name, callback):
"""Register the callback for the gi... | stack_v2_sparse_classes_36k_train_026937 | 3,036 | no_license | [
{
"docstring": "Add an event to the dictionary and registers for it.",
"name": "__missing__",
"signature": "def __missing__(self, event_name)"
},
{
"docstring": "Register the callback for the given event.",
"name": "register_for_event",
"signature": "def register_for_event(self, event_na... | 3 | null | Implement the Python class `_EventManager` described below.
Class description:
Stores Event names with all registered callbacks.
Method signatures and docstrings:
- def __missing__(self, event_name): Add an event to the dictionary and registers for it.
- def register_for_event(self, event_name, callback): Register th... | Implement the Python class `_EventManager` described below.
Class description:
Stores Event names with all registered callbacks.
Method signatures and docstrings:
- def __missing__(self, event_name): Add an event to the dictionary and registers for it.
- def register_for_event(self, event_name, callback): Register th... | 2d6fc3d0e0534e6eb2046fb11e40706ca42a2a59 | <|skeleton|>
class _EventManager:
"""Stores Event names with all registered callbacks."""
def __missing__(self, event_name):
"""Add an event to the dictionary and registers for it."""
<|body_0|>
def register_for_event(self, event_name, callback):
"""Register the callback for the gi... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class _EventManager:
"""Stores Event names with all registered callbacks."""
def __missing__(self, event_name):
"""Add an event to the dictionary and registers for it."""
listener = self[event_name] = _EventListener(event_name)
game_event_manager.add_listener(listener.listener, event_na... | the_stack_v2_python_sparse | addons/source-python/packages/source-python/events/manager.py | Doldol/Source.Python | train | 0 |
baf4a738af1b0c61be70af3276c6a1f7467a7f0e | [
"self.title.append(title)\nself.description.append(description)\nself.assignee.append(assignee)\nself.status.append(status)\nself.dueDate.append(dueDate)\nself.tags.append(tags)\nsuper(Issue, self).__init__()",
"self.validate_object()\nif kind is None or kind == 'create':\n self.only_available_attrs(['title', ... | <|body_start_0|>
self.title.append(title)
self.description.append(description)
self.assignee.append(assignee)
self.status.append(status)
self.dueDate.append(dueDate)
self.tags.append(tags)
super(Issue, self).__init__()
<|end_body_0|>
<|body_start_1|>
self... | Issue | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Issue:
def __init__(self, title: str=Empty, description=Empty, assignee: str=Empty, status: str=Empty, dueDate: str=Empty, tags: list=Empty):
""":param title: :param description: :param assignee: :param status: :param dueDate: :param tags:"""
<|body_0|>
def __todict__(self, ... | stack_v2_sparse_classes_36k_train_026938 | 1,941 | no_license | [
{
"docstring": ":param title: :param description: :param assignee: :param status: :param dueDate: :param tags:",
"name": "__init__",
"signature": "def __init__(self, title: str=Empty, description=Empty, assignee: str=Empty, status: str=Empty, dueDate: str=Empty, tags: list=Empty)"
},
{
"docstrin... | 2 | null | Implement the Python class `Issue` described below.
Class description:
Implement the Issue class.
Method signatures and docstrings:
- def __init__(self, title: str=Empty, description=Empty, assignee: str=Empty, status: str=Empty, dueDate: str=Empty, tags: list=Empty): :param title: :param description: :param assignee... | Implement the Python class `Issue` described below.
Class description:
Implement the Issue class.
Method signatures and docstrings:
- def __init__(self, title: str=Empty, description=Empty, assignee: str=Empty, status: str=Empty, dueDate: str=Empty, tags: list=Empty): :param title: :param description: :param assignee... | 623d23917ecf6761e7254d7d6a4881b6a05e11f8 | <|skeleton|>
class Issue:
def __init__(self, title: str=Empty, description=Empty, assignee: str=Empty, status: str=Empty, dueDate: str=Empty, tags: list=Empty):
""":param title: :param description: :param assignee: :param status: :param dueDate: :param tags:"""
<|body_0|>
def __todict__(self, ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Issue:
def __init__(self, title: str=Empty, description=Empty, assignee: str=Empty, status: str=Empty, dueDate: str=Empty, tags: list=Empty):
""":param title: :param description: :param assignee: :param status: :param dueDate: :param tags:"""
self.title.append(title)
self.description.a... | the_stack_v2_python_sparse | space_sdk/space_types/issue.py | AnthraxisBR/jetbrains-space-python-sdk | train | 0 | |
88cdd6ab9c9d1656f6c8583593e74fad61766dc5 | [
"self.width = int(width)\nself.height = int(height)\nself.circle_radius = int(circle_radius)\nself.image_counter = 0",
"if not os.path.exists(path):\n os.makedirs(path)\npath_bbtxt = os.path.join(path, 'annotations.bbtxt')\nwith open(path_bbtxt, 'w') as outfile:\n for i in range(size):\n image, label... | <|body_start_0|>
self.width = int(width)
self.height = int(height)
self.circle_radius = int(circle_radius)
self.image_counter = 0
<|end_body_0|>
<|body_start_1|>
if not os.path.exists(path):
os.makedirs(path)
path_bbtxt = os.path.join(path, 'annotations.bbtxt... | CircleGenerator | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CircleGenerator:
def __init__(self, width, height, circle_radius=15):
"""Input: width: width of each generated image height: height of each generated image circle_radius: radius of the circle to be placed on the images"""
<|body_0|>
def create_dataset(self, path, size):
... | stack_v2_sparse_classes_36k_train_026939 | 4,828 | permissive | [
{
"docstring": "Input: width: width of each generated image height: height of each generated image circle_radius: radius of the circle to be placed on the images",
"name": "__init__",
"signature": "def __init__(self, width, height, circle_radius=15)"
},
{
"docstring": "Generates a dataset of ima... | 3 | stack_v2_sparse_classes_30k_train_017000 | Implement the Python class `CircleGenerator` described below.
Class description:
Implement the CircleGenerator class.
Method signatures and docstrings:
- def __init__(self, width, height, circle_radius=15): Input: width: width of each generated image height: height of each generated image circle_radius: radius of the... | Implement the Python class `CircleGenerator` described below.
Class description:
Implement the CircleGenerator class.
Method signatures and docstrings:
- def __init__(self, width, height, circle_radius=15): Input: width: width of each generated image height: height of each generated image circle_radius: radius of the... | 6eca474ed3cae673afde010caef338cf7349f839 | <|skeleton|>
class CircleGenerator:
def __init__(self, width, height, circle_radius=15):
"""Input: width: width of each generated image height: height of each generated image circle_radius: radius of the circle to be placed on the images"""
<|body_0|>
def create_dataset(self, path, size):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CircleGenerator:
def __init__(self, width, height, circle_radius=15):
"""Input: width: width of each generated image height: height of each generated image circle_radius: radius of the circle to be placed on the images"""
self.width = int(width)
self.height = int(height)
self.c... | the_stack_v2_python_sparse | scripts/data/generators/circle_generator.py | Wavelet303/master_thesis_code | train | 0 | |
d669ac2f2757a9e51ccbc057e9e46499375445de | [
"super().__init__(fmc, **kwargs)\nlogging.debug('In __init__() for AdvancedSettings class.')\nself.parse_kwargs(**kwargs)\nself.type = 'AdvancedSettings'",
"logging.debug('In vpn_policy() for AdvancedSettings class.')\nftd_s2s = FTDS2SVPNs(fmc=self.fmc)\nftd_s2s.get(name=pol_name)\nif 'id' in ftd_s2s.__dict__:\n ... | <|body_start_0|>
super().__init__(fmc, **kwargs)
logging.debug('In __init__() for AdvancedSettings class.')
self.parse_kwargs(**kwargs)
self.type = 'AdvancedSettings'
<|end_body_0|>
<|body_start_1|>
logging.debug('In vpn_policy() for AdvancedSettings class.')
ftd_s2s = F... | The AdvancedSettings Object in the FMC. | AdvancedSettings | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AdvancedSettings:
"""The AdvancedSettings Object in the FMC."""
def __init__(self, fmc, **kwargs):
"""Initialize AdvancedSettings object. :param fmc: (object) FMC object :param **kwargs: Set initial variables during instantiation of AdvancedSettings object. :return: None"""
<... | stack_v2_sparse_classes_36k_train_026940 | 1,750 | permissive | [
{
"docstring": "Initialize AdvancedSettings object. :param fmc: (object) FMC object :param **kwargs: Set initial variables during instantiation of AdvancedSettings object. :return: None",
"name": "__init__",
"signature": "def __init__(self, fmc, **kwargs)"
},
{
"docstring": "Associate a Policy w... | 2 | null | Implement the Python class `AdvancedSettings` described below.
Class description:
The AdvancedSettings Object in the FMC.
Method signatures and docstrings:
- def __init__(self, fmc, **kwargs): Initialize AdvancedSettings object. :param fmc: (object) FMC object :param **kwargs: Set initial variables during instantiati... | Implement the Python class `AdvancedSettings` described below.
Class description:
The AdvancedSettings Object in the FMC.
Method signatures and docstrings:
- def __init__(self, fmc, **kwargs): Initialize AdvancedSettings object. :param fmc: (object) FMC object :param **kwargs: Set initial variables during instantiati... | fd924de96e200ca8e0d5088b27a5abaf6f915bc6 | <|skeleton|>
class AdvancedSettings:
"""The AdvancedSettings Object in the FMC."""
def __init__(self, fmc, **kwargs):
"""Initialize AdvancedSettings object. :param fmc: (object) FMC object :param **kwargs: Set initial variables during instantiation of AdvancedSettings object. :return: None"""
<... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AdvancedSettings:
"""The AdvancedSettings Object in the FMC."""
def __init__(self, fmc, **kwargs):
"""Initialize AdvancedSettings object. :param fmc: (object) FMC object :param **kwargs: Set initial variables during instantiation of AdvancedSettings object. :return: None"""
super().__init... | the_stack_v2_python_sparse | fmcapi/api_objects/policy_services/advancedsettings.py | banzigaga/fmcapi | train | 1 |
fba3376677f92d7a540e963718542dc890874c76 | [
"levels = len(true_measure)\nif levels != 1:\n raise NotYetImplemented('\\n CLTRep not implemented for multi-level problems.\\n Use CLT stopping criterion with an iid distribution for multi-level problems ')\nif log(n_init) / log(2) % 1 != 0:\n warning_s = ' n_init must be a powe... | <|body_start_0|>
levels = len(true_measure)
if levels != 1:
raise NotYetImplemented('\n CLTRep not implemented for multi-level problems.\n Use CLT stopping criterion with an iid distribution for multi-level problems ')
if log(n_init) / log(2) % 1 != 0:
... | Stopping criterion based on var(stream_1_estimate, ..., stream_16_estimate) < errorTol | CLTRep | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CLTRep:
"""Stopping criterion based on var(stream_1_estimate, ..., stream_16_estimate) < errorTol"""
def __init__(self, discrete_distrib, true_measure, replications=16, inflate=1.2, alpha=0.01, abs_tol=0.01, rel_tol=0, n_init=32, n_max=2 ** 30):
"""Args: discrete_distrib true_measure... | stack_v2_sparse_classes_36k_train_026941 | 3,479 | no_license | [
{
"docstring": "Args: discrete_distrib true_measure (DiscreteDistribution): an instance of DiscreteDistribution replications (int): number of random nxm matrices to generate inflate (float): inflation factor when estimating variance alpha (float): significance level for confidence interval abs_tol (float): abso... | 2 | stack_v2_sparse_classes_30k_train_009668 | Implement the Python class `CLTRep` described below.
Class description:
Stopping criterion based on var(stream_1_estimate, ..., stream_16_estimate) < errorTol
Method signatures and docstrings:
- def __init__(self, discrete_distrib, true_measure, replications=16, inflate=1.2, alpha=0.01, abs_tol=0.01, rel_tol=0, n_ini... | Implement the Python class `CLTRep` described below.
Class description:
Stopping criterion based on var(stream_1_estimate, ..., stream_16_estimate) < errorTol
Method signatures and docstrings:
- def __init__(self, discrete_distrib, true_measure, replications=16, inflate=1.2, alpha=0.01, abs_tol=0.01, rel_tol=0, n_ini... | 9f37eb67f74c4b1a4ccfb5547a2b284cb5897d37 | <|skeleton|>
class CLTRep:
"""Stopping criterion based on var(stream_1_estimate, ..., stream_16_estimate) < errorTol"""
def __init__(self, discrete_distrib, true_measure, replications=16, inflate=1.2, alpha=0.01, abs_tol=0.01, rel_tol=0, n_init=32, n_max=2 ** 30):
"""Args: discrete_distrib true_measure... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CLTRep:
"""Stopping criterion based on var(stream_1_estimate, ..., stream_16_estimate) < errorTol"""
def __init__(self, discrete_distrib, true_measure, replications=16, inflate=1.2, alpha=0.01, abs_tol=0.01, rel_tol=0, n_init=32, n_max=2 ** 30):
"""Args: discrete_distrib true_measure (DiscreteDis... | the_stack_v2_python_sparse | python_prototype/qmcpy/stopping_criterion/clt_rep.py | jagadeesr/QMCSoftware | train | 0 |
e18ff5ad5decdeea49cc6adff14c680752e47853 | [
"url = '/openstack/quotas/'\nif regions:\n url += '?%s' % parse.urlencode({'regions': regions})\nreturn self.client.get(url).json()",
"url = '/openstack/quotas/'\nfields = {'size': size, 'regions': regions}\nreturn self.client.post(url, data=fields)"
] | <|body_start_0|>
url = '/openstack/quotas/'
if regions:
url += '?%s' % parse.urlencode({'regions': regions})
return self.client.get(url).json()
<|end_body_0|>
<|body_start_1|>
url = '/openstack/quotas/'
fields = {'size': size, 'regions': regions}
return self.... | QuotaManager | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class QuotaManager:
def get(self, regions=None):
"""Gets data about current quota settings"""
<|body_0|>
def update(self, size, regions=None):
"""Updates the quota to a specified size. If region is not set it will update all regions"""
<|body_1|>
<|end_skeleton|>
... | stack_v2_sparse_classes_36k_train_026942 | 1,330 | permissive | [
{
"docstring": "Gets data about current quota settings",
"name": "get",
"signature": "def get(self, regions=None)"
},
{
"docstring": "Updates the quota to a specified size. If region is not set it will update all regions",
"name": "update",
"signature": "def update(self, size, regions=No... | 2 | stack_v2_sparse_classes_30k_train_002753 | Implement the Python class `QuotaManager` described below.
Class description:
Implement the QuotaManager class.
Method signatures and docstrings:
- def get(self, regions=None): Gets data about current quota settings
- def update(self, size, regions=None): Updates the quota to a specified size. If region is not set it... | Implement the Python class `QuotaManager` described below.
Class description:
Implement the QuotaManager class.
Method signatures and docstrings:
- def get(self, regions=None): Gets data about current quota settings
- def update(self, size, regions=None): Updates the quota to a specified size. If region is not set it... | 2f405f1c394a472c274581474206ddd1763b064e | <|skeleton|>
class QuotaManager:
def get(self, regions=None):
"""Gets data about current quota settings"""
<|body_0|>
def update(self, size, regions=None):
"""Updates the quota to a specified size. If region is not set it will update all regions"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class QuotaManager:
def get(self, regions=None):
"""Gets data about current quota settings"""
url = '/openstack/quotas/'
if regions:
url += '?%s' % parse.urlencode({'regions': regions})
return self.client.get(url).json()
def update(self, size, regions=None):
... | the_stack_v2_python_sparse | adjutantclient/v1/quota.py | openstack/python-adjutantclient | train | 8 | |
3aeb41a80c0dc58eba2cdb659f09a718dcf681db | [
"self.linux_current_password = linux_current_password\nself.linux_password = linux_password\nself.linux_username = linux_username\nself.verify_password = verify_password",
"if dictionary is None:\n return None\nlinux_current_password = dictionary.get('linuxCurrentPassword')\nlinux_password = dictionary.get('li... | <|body_start_0|>
self.linux_current_password = linux_current_password
self.linux_password = linux_password
self.linux_username = linux_username
self.verify_password = verify_password
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
linux_cur... | Implementation of the 'UpdateLinuxPasswordReqParams' model. Specifies the user input parameters. Attributes: linux_current_password (string): Specifies the current password. linux_password (string, required): Specifies the new linux password. linux_username (string, required): Specifies the linux username for which the... | UpdateLinuxPasswordReqParams | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UpdateLinuxPasswordReqParams:
"""Implementation of the 'UpdateLinuxPasswordReqParams' model. Specifies the user input parameters. Attributes: linux_current_password (string): Specifies the current password. linux_password (string, required): Specifies the new linux password. linux_username (strin... | stack_v2_sparse_classes_36k_train_026943 | 2,432 | permissive | [
{
"docstring": "Constructor for the UpdateLinuxPasswordReqParams class",
"name": "__init__",
"signature": "def __init__(self, linux_current_password=None, linux_password=None, linux_username=None, verify_password=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args:... | 2 | null | Implement the Python class `UpdateLinuxPasswordReqParams` described below.
Class description:
Implementation of the 'UpdateLinuxPasswordReqParams' model. Specifies the user input parameters. Attributes: linux_current_password (string): Specifies the current password. linux_password (string, required): Specifies the ne... | Implement the Python class `UpdateLinuxPasswordReqParams` described below.
Class description:
Implementation of the 'UpdateLinuxPasswordReqParams' model. Specifies the user input parameters. Attributes: linux_current_password (string): Specifies the current password. linux_password (string, required): Specifies the ne... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class UpdateLinuxPasswordReqParams:
"""Implementation of the 'UpdateLinuxPasswordReqParams' model. Specifies the user input parameters. Attributes: linux_current_password (string): Specifies the current password. linux_password (string, required): Specifies the new linux password. linux_username (strin... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UpdateLinuxPasswordReqParams:
"""Implementation of the 'UpdateLinuxPasswordReqParams' model. Specifies the user input parameters. Attributes: linux_current_password (string): Specifies the current password. linux_password (string, required): Specifies the new linux password. linux_username (string, required):... | the_stack_v2_python_sparse | cohesity_management_sdk/models/update_linux_password_req_params.py | cohesity/management-sdk-python | train | 24 |
223fc37cf941cfa2beeb582b00d4ac7e36801f86 | [
"if self.extra_sensor_mapping is None:\n LOGGER.debug('extra_sensors: No extra_sensor_mapping defined.')\n return None\nextra_sensors = []\nfor sensor_name in self.extra_sensor_mapping.keys():\n for chan in self.extra_channels:\n if chan in self.extra_sensor_mapping[sensor_name]:\n extra_... | <|body_start_0|>
if self.extra_sensor_mapping is None:
LOGGER.debug('extra_sensors: No extra_sensor_mapping defined.')
return None
extra_sensors = []
for sensor_name in self.extra_sensor_mapping.keys():
for chan in self.extra_channels:
if chan ... | Represents a station as metadata attributes. Note - this is currently defined as a tuple and thus most properties are read-only. The 'extra_sensor_mapping' is one exception - itcan be set after object creation. | SeismicStationMetadata | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SeismicStationMetadata:
"""Represents a station as metadata attributes. Note - this is currently defined as a tuple and thus most properties are read-only. The 'extra_sensor_mapping' is one exception - itcan be set after object creation."""
def extra_sensors(self):
"""Sensors in addi... | stack_v2_sparse_classes_36k_train_026944 | 16,855 | no_license | [
{
"docstring": "Sensors in addition to the normal seismic suite.",
"name": "extra_sensors",
"signature": "def extra_sensors(self)"
},
{
"docstring": "Check if the station is active in the dbmaster before the given time. Args: time (numeric): Antelope timestamp value, will be compared with the st... | 4 | stack_v2_sparse_classes_30k_train_004401 | Implement the Python class `SeismicStationMetadata` described below.
Class description:
Represents a station as metadata attributes. Note - this is currently defined as a tuple and thus most properties are read-only. The 'extra_sensor_mapping' is one exception - itcan be set after object creation.
Method signatures a... | Implement the Python class `SeismicStationMetadata` described below.
Class description:
Represents a station as metadata attributes. Note - this is currently defined as a tuple and thus most properties are read-only. The 'extra_sensor_mapping' is one exception - itcan be set after object creation.
Method signatures a... | 0b30093c240a72b7cfe52ee835eafa452510b56b | <|skeleton|>
class SeismicStationMetadata:
"""Represents a station as metadata attributes. Note - this is currently defined as a tuple and thus most properties are read-only. The 'extra_sensor_mapping' is one exception - itcan be set after object creation."""
def extra_sensors(self):
"""Sensors in addi... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SeismicStationMetadata:
"""Represents a station as metadata attributes. Note - this is currently defined as a tuple and thus most properties are read-only. The 'extra_sensor_mapping' is one exception - itcan be set after object creation."""
def extra_sensors(self):
"""Sensors in addition to the n... | the_stack_v2_python_sparse | anf/bin/web/usarray_deploy_map/anf/deploymentmap/database.py | UCSD-ANF/anfsrc | train | 6 |
5b2f09f39e2073541fa836def1c994817a55a5a5 | [
"self.color = color\nself.SPACING = spacing\nself.DIAMATER = diamater\nself.LOCATION = location\nself.x = x\nself.y = y",
"stroke(STROKE_COLOR)\nfill(self.color)\nellipse(self.x * self.SPACING + self.LOCATION, self.y * self.SPACING + self.LOCATION, self.DIAMATER, self.DIAMATER)"
] | <|body_start_0|>
self.color = color
self.SPACING = spacing
self.DIAMATER = diamater
self.LOCATION = location
self.x = x
self.y = y
<|end_body_0|>
<|body_start_1|>
stroke(STROKE_COLOR)
fill(self.color)
ellipse(self.x * self.SPACING + self.LOCATION,... | draw a disk | Disk | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Disk:
"""draw a disk"""
def __init__(self, color, spacing, diamater, location, x, y):
"""initiate a disk"""
<|body_0|>
def display(self):
"""display one disk"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.color = color
self.SPACING... | stack_v2_sparse_classes_36k_train_026945 | 601 | no_license | [
{
"docstring": "initiate a disk",
"name": "__init__",
"signature": "def __init__(self, color, spacing, diamater, location, x, y)"
},
{
"docstring": "display one disk",
"name": "display",
"signature": "def display(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_002777 | Implement the Python class `Disk` described below.
Class description:
draw a disk
Method signatures and docstrings:
- def __init__(self, color, spacing, diamater, location, x, y): initiate a disk
- def display(self): display one disk | Implement the Python class `Disk` described below.
Class description:
draw a disk
Method signatures and docstrings:
- def __init__(self, color, spacing, diamater, location, x, y): initiate a disk
- def display(self): display one disk
<|skeleton|>
class Disk:
"""draw a disk"""
def __init__(self, color, spaci... | 311ed6e161b32e4139c9cd97c88fdf3be8c884aa | <|skeleton|>
class Disk:
"""draw a disk"""
def __init__(self, color, spacing, diamater, location, x, y):
"""initiate a disk"""
<|body_0|>
def display(self):
"""display one disk"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Disk:
"""draw a disk"""
def __init__(self, color, spacing, diamater, location, x, y):
"""initiate a disk"""
self.color = color
self.SPACING = spacing
self.DIAMATER = diamater
self.LOCATION = location
self.x = x
self.y = y
def display(self):
... | the_stack_v2_python_sparse | disk.py | yiyu-t/Othello | train | 0 |
1156989b42a28434e153949055e626000e3fd15a | [
"for l, res in self.knownLines:\n cf = cfloader.NannyConfig()\n cf.parseline(l, 0)\n self.assertEqual(str(cf), res)\n cf = cfloader.NannyConfig()\n cf.parseline(res[:-1], 0)\n self.assertEqual(str(cf), res)",
"cf = cfloader.NannyConfig()\ncf.parseline('user cks', 0)\ncf.parseline('actionfile 10'... | <|body_start_0|>
for l, res in self.knownLines:
cf = cfloader.NannyConfig()
cf.parseline(l, 0)
self.assertEqual(str(cf), res)
cf = cfloader.NannyConfig()
cf.parseline(res[:-1], 0)
self.assertEqual(str(cf), res)
<|end_body_0|>
<|body_start_... | basicTests | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class basicTests:
def testKnownLines(self):
"""Test cfloader's direct parsing of known lines and the invertability of its output."""
<|body_0|>
def testDictAccess(self):
"""Test access to the configuration object as a dictionary."""
<|body_1|>
def testFromfile... | stack_v2_sparse_classes_36k_train_026946 | 4,828 | no_license | [
{
"docstring": "Test cfloader's direct parsing of known lines and the invertability of its output.",
"name": "testKnownLines",
"signature": "def testKnownLines(self)"
},
{
"docstring": "Test access to the configuration object as a dictionary.",
"name": "testDictAccess",
"signature": "def... | 3 | stack_v2_sparse_classes_30k_train_018040 | Implement the Python class `basicTests` described below.
Class description:
Implement the basicTests class.
Method signatures and docstrings:
- def testKnownLines(self): Test cfloader's direct parsing of known lines and the invertability of its output.
- def testDictAccess(self): Test access to the configuration obje... | Implement the Python class `basicTests` described below.
Class description:
Implement the basicTests class.
Method signatures and docstrings:
- def testKnownLines(self): Test cfloader's direct parsing of known lines and the invertability of its output.
- def testDictAccess(self): Test access to the configuration obje... | 41341606e831a42ba36f8e64640e98f098bf0489 | <|skeleton|>
class basicTests:
def testKnownLines(self):
"""Test cfloader's direct parsing of known lines and the invertability of its output."""
<|body_0|>
def testDictAccess(self):
"""Test access to the configuration object as a dictionary."""
<|body_1|>
def testFromfile... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class basicTests:
def testKnownLines(self):
"""Test cfloader's direct parsing of known lines and the invertability of its output."""
for l, res in self.knownLines:
cf = cfloader.NannyConfig()
cf.parseline(l, 0)
self.assertEqual(str(cf), res)
cf = cfloa... | the_stack_v2_python_sparse | test_cfloader.py | siebenmann/portnanny | train | 2 | |
c911ad9ad9d5d642c49a3911647dcf2839268888 | [
"self.id_ddi_interact_DB = id_ddi_interact_DB\nself.date_creation = date_creation\nself.FK_DDI_interaction = FK_DDI_interaction\nself.FK_DB_source = FK_DB_source\nself.database_name = database_name",
"listOfDDIIntDB = []\nsqlObj = _DDI_interaction_DB_SQL()\nresults = sqlObj.select_all_DDI_DB()\nfor element in res... | <|body_start_0|>
self.id_ddi_interact_DB = id_ddi_interact_DB
self.date_creation = date_creation
self.FK_DDI_interaction = FK_DDI_interaction
self.FK_DB_source = FK_DB_source
self.database_name = database_name
<|end_body_0|>
<|body_start_1|>
listOfDDIIntDB = []
s... | NOTE: Here the date is only the date and it create automatically when an DDI_interaction_DB is inserted (only the day of the insertion is considered) This class treat the DDI interaction DB object has it exists in DDI_INTERACTIONS_DB table database It consistes on a conection class (N to N) to know for each DDI which s... | DDI_interaction_DB | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DDI_interaction_DB:
"""NOTE: Here the date is only the date and it create automatically when an DDI_interaction_DB is inserted (only the day of the insertion is considered) This class treat the DDI interaction DB object has it exists in DDI_INTERACTIONS_DB table database It consistes on a conecti... | stack_v2_sparse_classes_36k_train_026947 | 4,149 | permissive | [
{
"docstring": "Constructor of the DDI_interactionDB object. All the parameters have a default value :param id_ddi_interact_DB: id of DDI interaction DB - -1 if unknown :param date_creation: Date of the creation - -1 if unknown :param FK_DDI_interaction: id of the DDI :param FK_DB_source: id of the Source :para... | 5 | stack_v2_sparse_classes_30k_train_008340 | Implement the Python class `DDI_interaction_DB` described below.
Class description:
NOTE: Here the date is only the date and it create automatically when an DDI_interaction_DB is inserted (only the day of the insertion is considered) This class treat the DDI interaction DB object has it exists in DDI_INTERACTIONS_DB t... | Implement the Python class `DDI_interaction_DB` described below.
Class description:
NOTE: Here the date is only the date and it create automatically when an DDI_interaction_DB is inserted (only the day of the insertion is considered) This class treat the DDI interaction DB object has it exists in DDI_INTERACTIONS_DB t... | 862eb85746e8a3a9bbc0d6aef9abbd5eebe9765f | <|skeleton|>
class DDI_interaction_DB:
"""NOTE: Here the date is only the date and it create automatically when an DDI_interaction_DB is inserted (only the day of the insertion is considered) This class treat the DDI interaction DB object has it exists in DDI_INTERACTIONS_DB table database It consistes on a conecti... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DDI_interaction_DB:
"""NOTE: Here the date is only the date and it create automatically when an DDI_interaction_DB is inserted (only the day of the insertion is considered) This class treat the DDI interaction DB object has it exists in DDI_INTERACTIONS_DB table database It consistes on a conection class (N t... | the_stack_v2_python_sparse | objects_new/DDI_interactions_DB_new.py | diogo1790/inphinity | train | 1 |
601034d873d29dac934b7c63ff0f0a33d36bb082 | [
"super(EltwiseProdScoring, self).__init__()\nself.linear_in_h = nn.Linear(h_dim, dot_dim, bias=True)\nself.linear_in_a = nn.Linear(a_dim, dot_dim, bias=True)\nself.linear_out = nn.Linear(dot_dim, 1, bias=True)",
"target = self.linear_in_h(h).unsqueeze(1)\ncontext = self.linear_in_a(all_u_t)\neltprod = torch.mul(t... | <|body_start_0|>
super(EltwiseProdScoring, self).__init__()
self.linear_in_h = nn.Linear(h_dim, dot_dim, bias=True)
self.linear_in_a = nn.Linear(a_dim, dot_dim, bias=True)
self.linear_out = nn.Linear(dot_dim, 1, bias=True)
<|end_body_0|>
<|body_start_1|>
target = self.linear_in_... | Linearly mapping h and v to the same dimension, and do a elementwise multiplication and a linear scoring | EltwiseProdScoring | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EltwiseProdScoring:
"""Linearly mapping h and v to the same dimension, and do a elementwise multiplication and a linear scoring"""
def __init__(self, h_dim, a_dim, dot_dim=256):
"""Initialize layer."""
<|body_0|>
def forward(self, h, all_u_t, mask=None):
"""Propa... | stack_v2_sparse_classes_36k_train_026948 | 22,228 | permissive | [
{
"docstring": "Initialize layer.",
"name": "__init__",
"signature": "def __init__(self, h_dim, a_dim, dot_dim=256)"
},
{
"docstring": "Propagate h through the network. h: batch x h_dim all_u_t: batch x a_num x a_dim",
"name": "forward",
"signature": "def forward(self, h, all_u_t, mask=N... | 2 | stack_v2_sparse_classes_30k_train_012258 | Implement the Python class `EltwiseProdScoring` described below.
Class description:
Linearly mapping h and v to the same dimension, and do a elementwise multiplication and a linear scoring
Method signatures and docstrings:
- def __init__(self, h_dim, a_dim, dot_dim=256): Initialize layer.
- def forward(self, h, all_u... | Implement the Python class `EltwiseProdScoring` described below.
Class description:
Linearly mapping h and v to the same dimension, and do a elementwise multiplication and a linear scoring
Method signatures and docstrings:
- def __init__(self, h_dim, a_dim, dot_dim=256): Initialize layer.
- def forward(self, h, all_u... | 868fb53d6b7978bbb10439a59e65044c811ee5c2 | <|skeleton|>
class EltwiseProdScoring:
"""Linearly mapping h and v to the same dimension, and do a elementwise multiplication and a linear scoring"""
def __init__(self, h_dim, a_dim, dot_dim=256):
"""Initialize layer."""
<|body_0|>
def forward(self, h, all_u_t, mask=None):
"""Propa... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class EltwiseProdScoring:
"""Linearly mapping h and v to the same dimension, and do a elementwise multiplication and a linear scoring"""
def __init__(self, h_dim, a_dim, dot_dim=256):
"""Initialize layer."""
super(EltwiseProdScoring, self).__init__()
self.linear_in_h = nn.Linear(h_dim, ... | the_stack_v2_python_sparse | tasks/R2R/speaker/model.py | weituo12321/PREVALENT_R2R | train | 8 |
48252c83901333ad3f362942a439badd820c5fcf | [
"super().__init__()\nassert namespace is not None\nassert namespace != ''\nself.namespace = namespace\nself.type_ = type_\nself.variable = variable",
"context.search_namespaces.add(self.namespace)\nif self.type_:\n self.type_.namespace = self.namespace\n lam = self.type_.execute(session, context)\n if la... | <|body_start_0|>
super().__init__()
assert namespace is not None
assert namespace != ''
self.namespace = namespace
self.type_ = type_
self.variable = variable
<|end_body_0|>
<|body_start_1|>
context.search_namespaces.add(self.namespace)
if self.type_:
... | Import | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Import:
def __init__(self, namespace=None, type_=None, variable=None):
"""Import the namespace, if the variable name is given, the imported type is cloned to the current context with the variable name :param namespace: the namespace :type namespace: str :param type_: the type :type type_... | stack_v2_sparse_classes_36k_train_026949 | 3,613 | permissive | [
{
"docstring": "Import the namespace, if the variable name is given, the imported type is cloned to the current context with the variable name :param namespace: the namespace :type namespace: str :param type_: the type :type type_: TypeName :param variable: the variable :type variable: str",
"name": "__init... | 2 | stack_v2_sparse_classes_30k_train_005151 | Implement the Python class `Import` described below.
Class description:
Implement the Import class.
Method signatures and docstrings:
- def __init__(self, namespace=None, type_=None, variable=None): Import the namespace, if the variable name is given, the imported type is cloned to the current context with the variab... | Implement the Python class `Import` described below.
Class description:
Implement the Import class.
Method signatures and docstrings:
- def __init__(self, namespace=None, type_=None, variable=None): Import the namespace, if the variable name is given, the imported type is cloned to the current context with the variab... | ff76e030d7cebdca51c72d5d7e789d90f0e1e565 | <|skeleton|>
class Import:
def __init__(self, namespace=None, type_=None, variable=None):
"""Import the namespace, if the variable name is given, the imported type is cloned to the current context with the variable name :param namespace: the namespace :type namespace: str :param type_: the type :type type_... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Import:
def __init__(self, namespace=None, type_=None, variable=None):
"""Import the namespace, if the variable name is given, the imported type is cloned to the current context with the variable name :param namespace: the namespace :type namespace: str :param type_: the type :type type_: TypeName :pa... | the_stack_v2_python_sparse | norm/executable/namespace.py | xumiao/supernorm | train | 0 | |
c087f4d77d5d512700c1e82c3f2aab62dcf88fff | [
"assert isinstance(nameRef, str), 'Invalid reference name %s' % nameRef\nassert isinstance(accessible, OrderedDict) and accessible, 'Invalid accessible invokers %s' % accessible\nself.nameRef = nameRef\nself.accessible = accessible",
"assert isinstance(target, IRender), 'Invalid target %s' % target\nindexes = dic... | <|body_start_0|>
assert isinstance(nameRef, str), 'Invalid reference name %s' % nameRef
assert isinstance(accessible, OrderedDict) and accessible, 'Invalid accessible invokers %s' % accessible
self.nameRef = nameRef
self.accessible = accessible
<|end_body_0|>
<|body_start_1|>
as... | Implementation for a @see: ITransfrom for model paths. | EncoderAccessiblePath | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EncoderAccessiblePath:
"""Implementation for a @see: ITransfrom for model paths."""
def __init__(self, nameRef, accessible):
"""Construct the model paths encoder."""
<|body_0|>
def transform(self, value, target, support):
"""@see: ITransfrom.transform"""
... | stack_v2_sparse_classes_36k_train_026950 | 4,858 | no_license | [
{
"docstring": "Construct the model paths encoder.",
"name": "__init__",
"signature": "def __init__(self, nameRef, accessible)"
},
{
"docstring": "@see: ITransfrom.transform",
"name": "transform",
"signature": "def transform(self, value, target, support)"
}
] | 2 | null | Implement the Python class `EncoderAccessiblePath` described below.
Class description:
Implementation for a @see: ITransfrom for model paths.
Method signatures and docstrings:
- def __init__(self, nameRef, accessible): Construct the model paths encoder.
- def transform(self, value, target, support): @see: ITransfrom.... | Implement the Python class `EncoderAccessiblePath` described below.
Class description:
Implementation for a @see: ITransfrom for model paths.
Method signatures and docstrings:
- def __init__(self, nameRef, accessible): Construct the model paths encoder.
- def transform(self, value, target, support): @see: ITransfrom.... | e0b3466b34d31548996d57be4a9dac134d904380 | <|skeleton|>
class EncoderAccessiblePath:
"""Implementation for a @see: ITransfrom for model paths."""
def __init__(self, nameRef, accessible):
"""Construct the model paths encoder."""
<|body_0|>
def transform(self, value, target, support):
"""@see: ITransfrom.transform"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class EncoderAccessiblePath:
"""Implementation for a @see: ITransfrom for model paths."""
def __init__(self, nameRef, accessible):
"""Construct the model paths encoder."""
assert isinstance(nameRef, str), 'Invalid reference name %s' % nameRef
assert isinstance(accessible, OrderedDict) a... | the_stack_v2_python_sparse | components/ally-core-http/ally/core/http/impl/processor/encoder/accessible_paths.py | cristidomsa/Ally-Py | train | 0 |
cf827b6645b25cdf3f34dd200355da1b2f8396c5 | [
"self.agents = agents\nself.cluster_source_type = cluster_source_type\nself.host_name = host_name\nself.host_type = host_type\nself.id = id\nself.is_proxy_host = is_proxy_host\nself.memory_size_bytes = memory_size_bytes\nself.name = name\nself.networking_info = networking_info\nself.num_processors = num_processors\... | <|body_start_0|>
self.agents = agents
self.cluster_source_type = cluster_source_type
self.host_name = host_name
self.host_type = host_type
self.id = id
self.is_proxy_host = is_proxy_host
self.memory_size_bytes = memory_size_bytes
self.name = name
s... | Implementation of the 'PhysicalProtectionSource' model. Specifies a Protection Source in a Physical environment. Attributes: agents (list of AgentInformation): Array of Agents on the Physical Protection Source. Specifiles the agents running on the Physical Protection Source and the status information. cluster_source_ty... | PhysicalProtectionSource | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PhysicalProtectionSource:
"""Implementation of the 'PhysicalProtectionSource' model. Specifies a Protection Source in a Physical environment. Attributes: agents (list of AgentInformation): Array of Agents on the Physical Protection Source. Specifiles the agents running on the Physical Protection ... | stack_v2_sparse_classes_36k_train_026951 | 7,793 | permissive | [
{
"docstring": "Constructor for the PhysicalProtectionSource class",
"name": "__init__",
"signature": "def __init__(self, agents=None, cluster_source_type=None, host_name=None, host_type=None, id=None, is_proxy_host=None, memory_size_bytes=None, name=None, networking_info=None, num_processors=None, os_n... | 2 | stack_v2_sparse_classes_30k_train_012356 | Implement the Python class `PhysicalProtectionSource` described below.
Class description:
Implementation of the 'PhysicalProtectionSource' model. Specifies a Protection Source in a Physical environment. Attributes: agents (list of AgentInformation): Array of Agents on the Physical Protection Source. Specifiles the age... | Implement the Python class `PhysicalProtectionSource` described below.
Class description:
Implementation of the 'PhysicalProtectionSource' model. Specifies a Protection Source in a Physical environment. Attributes: agents (list of AgentInformation): Array of Agents on the Physical Protection Source. Specifiles the age... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class PhysicalProtectionSource:
"""Implementation of the 'PhysicalProtectionSource' model. Specifies a Protection Source in a Physical environment. Attributes: agents (list of AgentInformation): Array of Agents on the Physical Protection Source. Specifiles the agents running on the Physical Protection ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PhysicalProtectionSource:
"""Implementation of the 'PhysicalProtectionSource' model. Specifies a Protection Source in a Physical environment. Attributes: agents (list of AgentInformation): Array of Agents on the Physical Protection Source. Specifiles the agents running on the Physical Protection Source and th... | the_stack_v2_python_sparse | cohesity_management_sdk/models/physical_protection_source.py | cohesity/management-sdk-python | train | 24 |
ed41bfc5515008d62eee2b4e11ec55f39c8710c4 | [
"query = request.GET.get('q')\nsort = request.GET.get('sort', 'name')\nasearch = Asignacion.objects.filter(id=kwargs['id']).first()\nform = AsignacionForm(instance=asearch)\nlist_assign = None\nif query:\n list_assign = Asignacion.objects.filter(Q(server__name__icontains=query) | Q(interface__name_interface__ico... | <|body_start_0|>
query = request.GET.get('q')
sort = request.GET.get('sort', 'name')
asearch = Asignacion.objects.filter(id=kwargs['id']).first()
form = AsignacionForm(instance=asearch)
list_assign = None
if query:
list_assign = Asignacion.objects.filter(Q(ser... | Clase para editar las asignaciones | AssignEditView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AssignEditView:
"""Clase para editar las asignaciones"""
def get(self, request, *args, **kwargs):
"""Método get"""
<|body_0|>
def post(self, request, *args, **kwargs):
"""Método post"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
query = reques... | stack_v2_sparse_classes_36k_train_026952 | 22,221 | no_license | [
{
"docstring": "Método get",
"name": "get",
"signature": "def get(self, request, *args, **kwargs)"
},
{
"docstring": "Método post",
"name": "post",
"signature": "def post(self, request, *args, **kwargs)"
}
] | 2 | stack_v2_sparse_classes_30k_train_013927 | Implement the Python class `AssignEditView` described below.
Class description:
Clase para editar las asignaciones
Method signatures and docstrings:
- def get(self, request, *args, **kwargs): Método get
- def post(self, request, *args, **kwargs): Método post | Implement the Python class `AssignEditView` described below.
Class description:
Clase para editar las asignaciones
Method signatures and docstrings:
- def get(self, request, *args, **kwargs): Método get
- def post(self, request, *args, **kwargs): Método post
<|skeleton|>
class AssignEditView:
"""Clase para edita... | e28e2d968372609ad396c42fb572a00c2410a117 | <|skeleton|>
class AssignEditView:
"""Clase para editar las asignaciones"""
def get(self, request, *args, **kwargs):
"""Método get"""
<|body_0|>
def post(self, request, *args, **kwargs):
"""Método post"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AssignEditView:
"""Clase para editar las asignaciones"""
def get(self, request, *args, **kwargs):
"""Método get"""
query = request.GET.get('q')
sort = request.GET.get('sort', 'name')
asearch = Asignacion.objects.filter(id=kwargs['id']).first()
form = AsignacionForm... | the_stack_v2_python_sparse | list/views.py | damaos/server_list2 | train | 0 |
0f0ae79e0686d19dfd8222faadfa36fc6868cf22 | [
"self.size = len(nums)\nself.nums = [0] * self.size\nself.array = [0] * (self.size + 1)\nfor i, val in enumerate(nums):\n self.update(i, val)",
"val -= self.nums[i]\nself.nums[i] += val\nindex = i + 1\nwhile index < self.size + 1:\n self.array[index] += val\n index += index & -index",
"total = 0\nright... | <|body_start_0|>
self.size = len(nums)
self.nums = [0] * self.size
self.array = [0] * (self.size + 1)
for i, val in enumerate(nums):
self.update(i, val)
<|end_body_0|>
<|body_start_1|>
val -= self.nums[i]
self.nums[i] += val
index = i + 1
whil... | NumArray | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NumArray:
def __init__(self, nums):
"""initialize your data structure here. :type nums: List[int]"""
<|body_0|>
def update(self, i, val):
""":type i: int :type val: int :rtype: int"""
<|body_1|>
def sumRange(self, i, j):
"""sum of elements nums[i... | stack_v2_sparse_classes_36k_train_026953 | 2,352 | no_license | [
{
"docstring": "initialize your data structure here. :type nums: List[int]",
"name": "__init__",
"signature": "def __init__(self, nums)"
},
{
"docstring": ":type i: int :type val: int :rtype: int",
"name": "update",
"signature": "def update(self, i, val)"
},
{
"docstring": "sum o... | 3 | null | Implement the Python class `NumArray` described below.
Class description:
Implement the NumArray class.
Method signatures and docstrings:
- def __init__(self, nums): initialize your data structure here. :type nums: List[int]
- def update(self, i, val): :type i: int :type val: int :rtype: int
- def sumRange(self, i, j... | Implement the Python class `NumArray` described below.
Class description:
Implement the NumArray class.
Method signatures and docstrings:
- def __init__(self, nums): initialize your data structure here. :type nums: List[int]
- def update(self, i, val): :type i: int :type val: int :rtype: int
- def sumRange(self, i, j... | dda63f5b196bfcdc4062bdad8d47076f36a9d89a | <|skeleton|>
class NumArray:
def __init__(self, nums):
"""initialize your data structure here. :type nums: List[int]"""
<|body_0|>
def update(self, i, val):
""":type i: int :type val: int :rtype: int"""
<|body_1|>
def sumRange(self, i, j):
"""sum of elements nums[i... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NumArray:
def __init__(self, nums):
"""initialize your data structure here. :type nums: List[int]"""
self.size = len(nums)
self.nums = [0] * self.size
self.array = [0] * (self.size + 1)
for i, val in enumerate(nums):
self.update(i, val)
def update(self,... | the_stack_v2_python_sparse | Google/307_Range_Sum_Query_Mutable.py | bwang8482/LeetCode | train | 1 | |
0f645ee91782f286c68d418dd060752e7354a76d | [
"self._host = host\nself._port = port\nself._dsmr_version = dsmr_version\nself._telegram = {}",
"if obis_ref.EQUIPMENT_IDENTIFIER in self._telegram:\n dsmr_object = self._telegram[obis_ref.EQUIPMENT_IDENTIFIER]\n return getattr(dsmr_object, 'value', None)",
"if obis_ref.EQUIPMENT_IDENTIFIER_GAS in self._t... | <|body_start_0|>
self._host = host
self._port = port
self._dsmr_version = dsmr_version
self._telegram = {}
<|end_body_0|>
<|body_start_1|>
if obis_ref.EQUIPMENT_IDENTIFIER in self._telegram:
dsmr_object = self._telegram[obis_ref.EQUIPMENT_IDENTIFIER]
retu... | Test the connection to DSMR and receive telegram to read serial ids. | DSMRConnection | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DSMRConnection:
"""Test the connection to DSMR and receive telegram to read serial ids."""
def __init__(self, host, port, dsmr_version):
"""Initialize."""
<|body_0|>
def equipment_identifier(self):
"""Equipment identifier."""
<|body_1|>
def equipment... | stack_v2_sparse_classes_36k_train_026954 | 6,055 | permissive | [
{
"docstring": "Initialize.",
"name": "__init__",
"signature": "def __init__(self, host, port, dsmr_version)"
},
{
"docstring": "Equipment identifier.",
"name": "equipment_identifier",
"signature": "def equipment_identifier(self)"
},
{
"docstring": "Equipment identifier gas.",
... | 4 | stack_v2_sparse_classes_30k_train_007162 | Implement the Python class `DSMRConnection` described below.
Class description:
Test the connection to DSMR and receive telegram to read serial ids.
Method signatures and docstrings:
- def __init__(self, host, port, dsmr_version): Initialize.
- def equipment_identifier(self): Equipment identifier.
- def equipment_ide... | Implement the Python class `DSMRConnection` described below.
Class description:
Test the connection to DSMR and receive telegram to read serial ids.
Method signatures and docstrings:
- def __init__(self, host, port, dsmr_version): Initialize.
- def equipment_identifier(self): Equipment identifier.
- def equipment_ide... | ed4ab403deaed9e8c95e0db728477fcb012bf4fa | <|skeleton|>
class DSMRConnection:
"""Test the connection to DSMR and receive telegram to read serial ids."""
def __init__(self, host, port, dsmr_version):
"""Initialize."""
<|body_0|>
def equipment_identifier(self):
"""Equipment identifier."""
<|body_1|>
def equipment... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DSMRConnection:
"""Test the connection to DSMR and receive telegram to read serial ids."""
def __init__(self, host, port, dsmr_version):
"""Initialize."""
self._host = host
self._port = port
self._dsmr_version = dsmr_version
self._telegram = {}
def equipment_i... | the_stack_v2_python_sparse | homeassistant/components/dsmr/config_flow.py | tchellomello/home-assistant | train | 8 |
eb74eaf7bf59841c4786644a4840f9fd030aa8ad | [
"head = ListNode(-1)\np = head\nwhile l1 and l2:\n if l1.val < l2.val:\n p.next = l1\n l1 = l1.next\n else:\n p.next = l2\n l2 = l2.next\n p = p.next\nif l1:\n p.next = l1\nif l2:\n p.next = l2\nreturn head.next",
"if l1 is None:\n return l2\nelif l2 is None:\n ret... | <|body_start_0|>
head = ListNode(-1)
p = head
while l1 and l2:
if l1.val < l2.val:
p.next = l1
l1 = l1.next
else:
p.next = l2
l2 = l2.next
p = p.next
if l1:
p.next = l1
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode:
"""双指针法"""
<|body_0|>
def mergeTwoLists2(self, l1: ListNode, l2: ListNode) -> ListNode:
"""递归法"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
head = ListNode(-1)
p =... | stack_v2_sparse_classes_36k_train_026955 | 1,496 | no_license | [
{
"docstring": "双指针法",
"name": "mergeTwoLists",
"signature": "def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode"
},
{
"docstring": "递归法",
"name": "mergeTwoLists2",
"signature": "def mergeTwoLists2(self, l1: ListNode, l2: ListNode) -> ListNode"
}
] | 2 | stack_v2_sparse_classes_30k_train_012972 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode: 双指针法
- def mergeTwoLists2(self, l1: ListNode, l2: ListNode) -> ListNode: 递归法 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode: 双指针法
- def mergeTwoLists2(self, l1: ListNode, l2: ListNode) -> ListNode: 递归法
<|skeleton|>
class Solution:
d... | 13e7ec9fe7a92ab13b247bd4edeb1ada5de81a08 | <|skeleton|>
class Solution:
def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode:
"""双指针法"""
<|body_0|>
def mergeTwoLists2(self, l1: ListNode, l2: ListNode) -> ListNode:
"""递归法"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode:
"""双指针法"""
head = ListNode(-1)
p = head
while l1 and l2:
if l1.val < l2.val:
p.next = l1
l1 = l1.next
else:
p.next = l2
... | the_stack_v2_python_sparse | Algorithms/21_Merge_Two_Sorted_Lists/Merge_Two_Sorted_Lists.py | lirui-ML/my_leetcode | train | 1 | |
22dba2c5cf6c001c17dbedd38e4cd64a2c9be617 | [
"self._export_dir = export_dir\nself._best = None\nself.cmp_fn = cmp_fn\nself._best_result = None",
"log.debug('New evaluate result: %s \\nold: %s' % (repr(eval_result), repr(self._best)))\nif self._best is None and state['best_model'] is not None:\n self._best = state['best_model']\n log.debug('restoring b... | <|body_start_0|>
self._export_dir = export_dir
self._best = None
self.cmp_fn = cmp_fn
self._best_result = None
<|end_body_0|>
<|body_start_1|>
log.debug('New evaluate result: %s \nold: %s' % (repr(eval_result), repr(self._best)))
if self._best is None and state['best_mod... | export saved model accordingto `cmp_fn` | BestExporter | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BestExporter:
"""export saved model accordingto `cmp_fn`"""
def __init__(self, export_dir, cmp_fn):
"""doc"""
<|body_0|>
def export(self, exe, program, eval_model_spec, eval_result, state):
"""doc"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_36k_train_026956 | 8,759 | permissive | [
{
"docstring": "doc",
"name": "__init__",
"signature": "def __init__(self, export_dir, cmp_fn)"
},
{
"docstring": "doc",
"name": "export",
"signature": "def export(self, exe, program, eval_model_spec, eval_result, state)"
}
] | 2 | stack_v2_sparse_classes_30k_train_007680 | Implement the Python class `BestExporter` described below.
Class description:
export saved model accordingto `cmp_fn`
Method signatures and docstrings:
- def __init__(self, export_dir, cmp_fn): doc
- def export(self, exe, program, eval_model_spec, eval_result, state): doc | Implement the Python class `BestExporter` described below.
Class description:
export saved model accordingto `cmp_fn`
Method signatures and docstrings:
- def __init__(self, export_dir, cmp_fn): doc
- def export(self, exe, program, eval_model_spec, eval_result, state): doc
<|skeleton|>
class BestExporter:
"""expo... | e6ab0261eb719c21806bbadfd94001ecfe27de45 | <|skeleton|>
class BestExporter:
"""export saved model accordingto `cmp_fn`"""
def __init__(self, export_dir, cmp_fn):
"""doc"""
<|body_0|>
def export(self, exe, program, eval_model_spec, eval_result, state):
"""doc"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BestExporter:
"""export saved model accordingto `cmp_fn`"""
def __init__(self, export_dir, cmp_fn):
"""doc"""
self._export_dir = export_dir
self._best = None
self.cmp_fn = cmp_fn
self._best_result = None
def export(self, exe, program, eval_model_spec, eval_res... | the_stack_v2_python_sparse | competition/ogbg_molhiv/propeller/paddle/train/exporter.py | PaddlePaddle/PaddleHelix | train | 771 |
bb0b624d45c5420a3f3c2df5737b76e47d58a7a4 | [
"l_int = 0\nl_bytes = convert.int_2_bigend(l_int, 4)\nself.assertEqual(l_bytes, b'\\x00\\x00\\x00\\x00')",
"l_int = 0\nl_bytes = convert.int_2_bigend(l_int, 2)\nself.assertEqual(l_bytes, b'\\x00\\x00')",
"l_int = 15\nl_bytes = convert.int_2_bigend(l_int, 4)\nself.assertEqual(l_bytes, b'\\x00\\x00\\x00\\x0f')",
... | <|body_start_0|>
l_int = 0
l_bytes = convert.int_2_bigend(l_int, 4)
self.assertEqual(l_bytes, b'\x00\x00\x00\x00')
<|end_body_0|>
<|body_start_1|>
l_int = 0
l_bytes = convert.int_2_bigend(l_int, 2)
self.assertEqual(l_bytes, b'\x00\x00')
<|end_body_1|>
<|body_start_2|>
... | Test fetching big endian byte strings | D3_BigEnd | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class D3_BigEnd:
"""Test fetching big endian byte strings"""
def test_01_zero4(self):
"""Convert a datetime to Minutes"""
<|body_0|>
def test_02_zero2(self):
"""Convert a datetime to Minutes"""
<|body_1|>
def test_03_15_4(self):
"""Convert a dateti... | stack_v2_sparse_classes_36k_train_026957 | 6,756 | permissive | [
{
"docstring": "Convert a datetime to Minutes",
"name": "test_01_zero4",
"signature": "def test_01_zero4(self)"
},
{
"docstring": "Convert a datetime to Minutes",
"name": "test_02_zero2",
"signature": "def test_02_zero2(self)"
},
{
"docstring": "Convert a datetime to Minutes",
... | 6 | stack_v2_sparse_classes_30k_train_014813 | Implement the Python class `D3_BigEnd` described below.
Class description:
Test fetching big endian byte strings
Method signatures and docstrings:
- def test_01_zero4(self): Convert a datetime to Minutes
- def test_02_zero2(self): Convert a datetime to Minutes
- def test_03_15_4(self): Convert a datetime to Minutes
-... | Implement the Python class `D3_BigEnd` described below.
Class description:
Test fetching big endian byte strings
Method signatures and docstrings:
- def test_01_zero4(self): Convert a datetime to Minutes
- def test_02_zero2(self): Convert a datetime to Minutes
- def test_03_15_4(self): Convert a datetime to Minutes
-... | a100fc67761a22ae47ed6f21f3c9464e2de5d54f | <|skeleton|>
class D3_BigEnd:
"""Test fetching big endian byte strings"""
def test_01_zero4(self):
"""Convert a datetime to Minutes"""
<|body_0|>
def test_02_zero2(self):
"""Convert a datetime to Minutes"""
<|body_1|>
def test_03_15_4(self):
"""Convert a dateti... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class D3_BigEnd:
"""Test fetching big endian byte strings"""
def test_01_zero4(self):
"""Convert a datetime to Minutes"""
l_int = 0
l_bytes = convert.int_2_bigend(l_int, 4)
self.assertEqual(l_bytes, b'\x00\x00\x00\x00')
def test_02_zero2(self):
"""Convert a datetime... | the_stack_v2_python_sparse | Project/src/Modules/Core/Utilities/_test/test_convert.py | DBrianKimmel/PyHouse | train | 3 |
838323aff0a041d6247f646dddccf10cb0b6c602 | [
"super(Net, self).__init__()\nconv1_shape = (height, 1)\nconv2_shape = 5\npool_1_shape = 2\npool_2_shape = 2\nconv1_outshape = 20\nconv2_outshape = 40\nself.output = output_size\nself.conv1 = nn.Sequential(nn.Conv2d(in_channels=channels, out_channels=conv1_outshape, kernel_size=conv1_shape, stride=1, padding=2), nn... | <|body_start_0|>
super(Net, self).__init__()
conv1_shape = (height, 1)
conv2_shape = 5
pool_1_shape = 2
pool_2_shape = 2
conv1_outshape = 20
conv2_outshape = 40
self.output = output_size
self.conv1 = nn.Sequential(nn.Conv2d(in_channels=channels, ou... | Basic CNN. Using as basis for evantual netork Input of form: Batch Size - Channels - Height - Width | Net | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Net:
"""Basic CNN. Using as basis for evantual netork Input of form: Batch Size - Channels - Height - Width"""
def __init__(self, batch_size, channels, height, width, output_size):
"""Instances. Might make function in order to most accurately create Dense layers"""
<|body_0|>... | stack_v2_sparse_classes_36k_train_026958 | 3,331 | no_license | [
{
"docstring": "Instances. Might make function in order to most accurately create Dense layers",
"name": "__init__",
"signature": "def __init__(self, batch_size, channels, height, width, output_size)"
},
{
"docstring": "Forward. Moving the image through the convulutions have two maxpools for cha... | 4 | stack_v2_sparse_classes_30k_train_006651 | Implement the Python class `Net` described below.
Class description:
Basic CNN. Using as basis for evantual netork Input of form: Batch Size - Channels - Height - Width
Method signatures and docstrings:
- def __init__(self, batch_size, channels, height, width, output_size): Instances. Might make function in order to ... | Implement the Python class `Net` described below.
Class description:
Basic CNN. Using as basis for evantual netork Input of form: Batch Size - Channels - Height - Width
Method signatures and docstrings:
- def __init__(self, batch_size, channels, height, width, output_size): Instances. Might make function in order to ... | 4c4b8fb381c8d98980e119f7f73f393034393468 | <|skeleton|>
class Net:
"""Basic CNN. Using as basis for evantual netork Input of form: Batch Size - Channels - Height - Width"""
def __init__(self, batch_size, channels, height, width, output_size):
"""Instances. Might make function in order to most accurately create Dense layers"""
<|body_0|>... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Net:
"""Basic CNN. Using as basis for evantual netork Input of form: Batch Size - Channels - Height - Width"""
def __init__(self, batch_size, channels, height, width, output_size):
"""Instances. Might make function in order to most accurately create Dense layers"""
super(Net, self).__init... | the_stack_v2_python_sparse | Python_Scripts/network/CNN.py | jommysmoth/ECE_Music | train | 0 |
761d059bc51ee29c9b235411e3002479972c7202 | [
"adm = ProjectAdministration()\nperson_list = adm.get_all_persons()\nreturn person_list",
"adm = ProjectAdministration()\nproposal = Person.from_dict(api.payload)\nif proposal is not None:\n pers = adm.create_person(proposal.get_creation_date(), proposal.get_name(), proposal.get_google_id(), proposal.get_role_... | <|body_start_0|>
adm = ProjectAdministration()
person_list = adm.get_all_persons()
return person_list
<|end_body_0|>
<|body_start_1|>
adm = ProjectAdministration()
proposal = Person.from_dict(api.payload)
if proposal is not None:
pers = adm.create_person(prop... | PersonListOperations | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PersonListOperations:
def get(self):
"""Auslesen aller Personen-Objekte"""
<|body_0|>
def post(self):
"""Anlegen eines neuen Personen-Objekts"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
adm = ProjectAdministration()
person_list = adm.get... | stack_v2_sparse_classes_36k_train_026959 | 44,493 | no_license | [
{
"docstring": "Auslesen aller Personen-Objekte",
"name": "get",
"signature": "def get(self)"
},
{
"docstring": "Anlegen eines neuen Personen-Objekts",
"name": "post",
"signature": "def post(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_007193 | Implement the Python class `PersonListOperations` described below.
Class description:
Implement the PersonListOperations class.
Method signatures and docstrings:
- def get(self): Auslesen aller Personen-Objekte
- def post(self): Anlegen eines neuen Personen-Objekts | Implement the Python class `PersonListOperations` described below.
Class description:
Implement the PersonListOperations class.
Method signatures and docstrings:
- def get(self): Auslesen aller Personen-Objekte
- def post(self): Anlegen eines neuen Personen-Objekts
<|skeleton|>
class PersonListOperations:
def g... | 4b2826225525ae855e15e1174f5cf90466097021 | <|skeleton|>
class PersonListOperations:
def get(self):
"""Auslesen aller Personen-Objekte"""
<|body_0|>
def post(self):
"""Anlegen eines neuen Personen-Objekts"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PersonListOperations:
def get(self):
"""Auslesen aller Personen-Objekte"""
adm = ProjectAdministration()
person_list = adm.get_all_persons()
return person_list
def post(self):
"""Anlegen eines neuen Personen-Objekts"""
adm = ProjectAdministration()
... | the_stack_v2_python_sparse | src/main.py | KieserChristian/SW_Praktikum_Gruppe1 | train | 0 | |
5d83f18176fe55297724ea70d01072e46ff869c0 | [
"i = 0\nsums = [0]\nwhile i < k:\n sums[0] += nums[i]\n i += 1\nwhile i < len(nums):\n sums.append(sums[-1] + nums[i] - nums[i - k])\n i += 1\n\n@lru_cache(None)\ndef dp(i, n):\n if i >= len(sums) or n == 0:\n return ([], 0)\n if n == 1:\n idx = i\n val = sums[i]\n for ... | <|body_start_0|>
i = 0
sums = [0]
while i < k:
sums[0] += nums[i]
i += 1
while i < len(nums):
sums.append(sums[-1] + nums[i] - nums[i - k])
i += 1
@lru_cache(None)
def dp(i, n):
if i >= len(sums) or n == 0:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxSumOfThreeSubarrays(self, nums: List[int], k: int) -> List[int]:
"""11/28/2022 14:21 TLE Top down recursion"""
<|body_0|>
def maxSumOfThreeSubarrays(self, nums: List[int], k: int) -> List[int]:
"""11/28/2022 15:22 Bottom up dp"""
<|body_1|>
... | stack_v2_sparse_classes_36k_train_026960 | 3,313 | no_license | [
{
"docstring": "11/28/2022 14:21 TLE Top down recursion",
"name": "maxSumOfThreeSubarrays",
"signature": "def maxSumOfThreeSubarrays(self, nums: List[int], k: int) -> List[int]"
},
{
"docstring": "11/28/2022 15:22 Bottom up dp",
"name": "maxSumOfThreeSubarrays",
"signature": "def maxSumO... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxSumOfThreeSubarrays(self, nums: List[int], k: int) -> List[int]: 11/28/2022 14:21 TLE Top down recursion
- def maxSumOfThreeSubarrays(self, nums: List[int], k: int) -> Lis... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxSumOfThreeSubarrays(self, nums: List[int], k: int) -> List[int]: 11/28/2022 14:21 TLE Top down recursion
- def maxSumOfThreeSubarrays(self, nums: List[int], k: int) -> Lis... | 1389a009a02e90e8700a7a00e0b7f797c129cdf4 | <|skeleton|>
class Solution:
def maxSumOfThreeSubarrays(self, nums: List[int], k: int) -> List[int]:
"""11/28/2022 14:21 TLE Top down recursion"""
<|body_0|>
def maxSumOfThreeSubarrays(self, nums: List[int], k: int) -> List[int]:
"""11/28/2022 15:22 Bottom up dp"""
<|body_1|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def maxSumOfThreeSubarrays(self, nums: List[int], k: int) -> List[int]:
"""11/28/2022 14:21 TLE Top down recursion"""
i = 0
sums = [0]
while i < k:
sums[0] += nums[i]
i += 1
while i < len(nums):
sums.append(sums[-1] + nums[i... | the_stack_v2_python_sparse | leetcode/solved/689_Maximum_Sum_of_3_Non-Overlapping_Subarrays/solution.py | sungminoh/algorithms | train | 0 | |
4204b8a2431c487b010458b942143e239a9103dc | [
"super().__init__(old_link=bot.pageToUnlink, new_link=False, default='u')\nself._always = AlwaysChoice(self, 'unlink all pages', 'a')\nself._always.always = bot.opt.always\nself.additional_choices = [AlwaysChoice(self, 'unlink all on page', 'p'), self._always, EditReplacementError()]\nself._bot = bot\nself.context ... | <|body_start_0|>
super().__init__(old_link=bot.pageToUnlink, new_link=False, default='u')
self._always = AlwaysChoice(self, 'unlink all pages', 'a')
self._always.always = bot.opt.always
self.additional_choices = [AlwaysChoice(self, 'unlink all on page', 'p'), self._always, EditReplacemen... | An implementation which just allows unlinking. | InteractiveUnlink | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InteractiveUnlink:
"""An implementation which just allows unlinking."""
def __init__(self, bot) -> None:
"""Create default settings."""
<|body_0|>
def handle_answer(self, choice):
"""Handle choice and store in bot's options."""
<|body_1|>
<|end_skeleton|... | stack_v2_sparse_classes_36k_train_026961 | 3,015 | permissive | [
{
"docstring": "Create default settings.",
"name": "__init__",
"signature": "def __init__(self, bot) -> None"
},
{
"docstring": "Handle choice and store in bot's options.",
"name": "handle_answer",
"signature": "def handle_answer(self, choice)"
}
] | 2 | stack_v2_sparse_classes_30k_train_001199 | Implement the Python class `InteractiveUnlink` described below.
Class description:
An implementation which just allows unlinking.
Method signatures and docstrings:
- def __init__(self, bot) -> None: Create default settings.
- def handle_answer(self, choice): Handle choice and store in bot's options. | Implement the Python class `InteractiveUnlink` described below.
Class description:
An implementation which just allows unlinking.
Method signatures and docstrings:
- def __init__(self, bot) -> None: Create default settings.
- def handle_answer(self, choice): Handle choice and store in bot's options.
<|skeleton|>
cla... | 5c01e6bfcd328bc6eae643e661f1a0ae57612808 | <|skeleton|>
class InteractiveUnlink:
"""An implementation which just allows unlinking."""
def __init__(self, bot) -> None:
"""Create default settings."""
<|body_0|>
def handle_answer(self, choice):
"""Handle choice and store in bot's options."""
<|body_1|>
<|end_skeleton|... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class InteractiveUnlink:
"""An implementation which just allows unlinking."""
def __init__(self, bot) -> None:
"""Create default settings."""
super().__init__(old_link=bot.pageToUnlink, new_link=False, default='u')
self._always = AlwaysChoice(self, 'unlink all pages', 'a')
self.... | the_stack_v2_python_sparse | pywikibot/specialbots/_unlink.py | wikimedia/pywikibot | train | 432 |
73002fff89b9e51474aa192cf7800d20e6af9147 | [
"self.wait_for_ajax()\nself.locator_finder_by_id(self.navbar_id)\nitem = self.locator_finder_by_id(tag)\nitem.click()\nself.wait_for_ajax()",
"click_twitter_link_sitem = self.locator_finder_by_xpath(self.click_twitter_link_id)\ntitle = self.switch_tab(click_twitter_link_sitem)\nexpected_title = 'ArangoDB (@arango... | <|body_start_0|>
self.wait_for_ajax()
self.locator_finder_by_id(self.navbar_id)
item = self.locator_finder_by_id(tag)
item.click()
self.wait_for_ajax()
<|end_body_0|>
<|body_start_1|>
click_twitter_link_sitem = self.locator_finder_by_xpath(self.click_twitter_link_id)
... | Page object representing the navigation bar | NavigationBarPage | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NavigationBarPage:
"""Page object representing the navigation bar"""
def navbar_goto(self, tag):
"""click on any of the items in the 'navbar'"""
<|body_0|>
def click_twitter_link(self):
"""Clicking on twitter link on dashboard"""
<|body_1|>
def click... | stack_v2_sparse_classes_36k_train_026962 | 3,510 | no_license | [
{
"docstring": "click on any of the items in the 'navbar'",
"name": "navbar_goto",
"signature": "def navbar_goto(self, tag)"
},
{
"docstring": "Clicking on twitter link on dashboard",
"name": "click_twitter_link",
"signature": "def click_twitter_link(self)"
},
{
"docstring": "Cli... | 6 | null | Implement the Python class `NavigationBarPage` described below.
Class description:
Page object representing the navigation bar
Method signatures and docstrings:
- def navbar_goto(self, tag): click on any of the items in the 'navbar'
- def click_twitter_link(self): Clicking on twitter link on dashboard
- def click_sla... | Implement the Python class `NavigationBarPage` described below.
Class description:
Page object representing the navigation bar
Method signatures and docstrings:
- def navbar_goto(self, tag): click on any of the items in the 'navbar'
- def click_twitter_link(self): Clicking on twitter link on dashboard
- def click_sla... | 4d4a0b049eb83625df41d86f2066ddb0c6c9c85b | <|skeleton|>
class NavigationBarPage:
"""Page object representing the navigation bar"""
def navbar_goto(self, tag):
"""click on any of the items in the 'navbar'"""
<|body_0|>
def click_twitter_link(self):
"""Clicking on twitter link on dashboard"""
<|body_1|>
def click... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NavigationBarPage:
"""Page object representing the navigation bar"""
def navbar_goto(self, tag):
"""click on any of the items in the 'navbar'"""
self.wait_for_ajax()
self.locator_finder_by_id(self.navbar_id)
item = self.locator_finder_by_id(tag)
item.click()
... | the_stack_v2_python_sparse | release_tester/selenium_ui_test/pages/navbar.py | arangodb/release-test-automation | train | 14 |
74740fad7b96eeb46118e5d97bf81abef5df8f6e | [
"super().__init__(coordinator, device, 'power', 'Energy usage', f'phase_{phase}_power')\nself._attr_name = f'Phase {phase} power'\nself._phase = phase",
"phase_sensor = getattr(self.coordinator.data, f'phase{self._phase}', None)\nif phase_sensor is None:\n return None\nreturn phase_sensor.power"
] | <|body_start_0|>
super().__init__(coordinator, device, 'power', 'Energy usage', f'phase_{phase}_power')
self._attr_name = f'Phase {phase} power'
self._phase = phase
<|end_body_0|>
<|body_start_1|>
phase_sensor = getattr(self.coordinator.data, f'phase{self._phase}', None)
if phas... | The current power usage of a single phase. | PhasePowerSensor | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PhasePowerSensor:
"""The current power usage of a single phase."""
def __init__(self, coordinator: DataUpdateCoordinator[YoulessAPI], device: str, phase: int) -> None:
"""Initialize the power phase sensor."""
<|body_0|>
def get_sensor(self) -> YoulessSensor | None:
... | stack_v2_sparse_classes_36k_train_026963 | 11,812 | permissive | [
{
"docstring": "Initialize the power phase sensor.",
"name": "__init__",
"signature": "def __init__(self, coordinator: DataUpdateCoordinator[YoulessAPI], device: str, phase: int) -> None"
},
{
"docstring": "Get the sensor value from the coordinator.",
"name": "get_sensor",
"signature": "... | 2 | null | Implement the Python class `PhasePowerSensor` described below.
Class description:
The current power usage of a single phase.
Method signatures and docstrings:
- def __init__(self, coordinator: DataUpdateCoordinator[YoulessAPI], device: str, phase: int) -> None: Initialize the power phase sensor.
- def get_sensor(self... | Implement the Python class `PhasePowerSensor` described below.
Class description:
The current power usage of a single phase.
Method signatures and docstrings:
- def __init__(self, coordinator: DataUpdateCoordinator[YoulessAPI], device: str, phase: int) -> None: Initialize the power phase sensor.
- def get_sensor(self... | 80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743 | <|skeleton|>
class PhasePowerSensor:
"""The current power usage of a single phase."""
def __init__(self, coordinator: DataUpdateCoordinator[YoulessAPI], device: str, phase: int) -> None:
"""Initialize the power phase sensor."""
<|body_0|>
def get_sensor(self) -> YoulessSensor | None:
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PhasePowerSensor:
"""The current power usage of a single phase."""
def __init__(self, coordinator: DataUpdateCoordinator[YoulessAPI], device: str, phase: int) -> None:
"""Initialize the power phase sensor."""
super().__init__(coordinator, device, 'power', 'Energy usage', f'phase_{phase}_p... | the_stack_v2_python_sparse | homeassistant/components/youless/sensor.py | home-assistant/core | train | 35,501 |
c4b591a7f4eb67e42c640a75c5e1fadbf6e77cf7 | [
"super(DeiTClsHead, self)._init_layers()\nif self.hidden_dim is None:\n head_dist = nn.Linear(self.in_channels, self.num_classes)\nelse:\n head_dist = nn.Linear(self.hidden_dim, self.num_classes)\nself.layers.add_module('head_dist', head_dist)",
"feat = feats[-1]\nif len(feat) == 3:\n _, cls_token, dist_... | <|body_start_0|>
super(DeiTClsHead, self)._init_layers()
if self.hidden_dim is None:
head_dist = nn.Linear(self.in_channels, self.num_classes)
else:
head_dist = nn.Linear(self.hidden_dim, self.num_classes)
self.layers.add_module('head_dist', head_dist)
<|end_body_... | Distilled Vision Transformer classifier head. Comparing with the :class:`VisionTransformerClsHead`, this head adds an extra linear layer to handle the dist token. The final classification score is the average of both linear transformation results of ``cls_token`` and ``dist_token``. Args: num_classes (int): Number of c... | DeiTClsHead | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DeiTClsHead:
"""Distilled Vision Transformer classifier head. Comparing with the :class:`VisionTransformerClsHead`, this head adds an extra linear layer to handle the dist token. The final classification score is the average of both linear transformation results of ``cls_token`` and ``dist_token`... | stack_v2_sparse_classes_36k_train_026964 | 3,023 | permissive | [
{
"docstring": "\"Init extra hidden linear layer to handle dist token if exists.",
"name": "_init_layers",
"signature": "def _init_layers(self)"
},
{
"docstring": "The process before the final classification head. The input ``feats`` is a tuple of list of tensor, and each tensor is the feature o... | 3 | null | Implement the Python class `DeiTClsHead` described below.
Class description:
Distilled Vision Transformer classifier head. Comparing with the :class:`VisionTransformerClsHead`, this head adds an extra linear layer to handle the dist token. The final classification score is the average of both linear transformation res... | Implement the Python class `DeiTClsHead` described below.
Class description:
Distilled Vision Transformer classifier head. Comparing with the :class:`VisionTransformerClsHead`, this head adds an extra linear layer to handle the dist token. The final classification score is the average of both linear transformation res... | d2ccc44a2c8e5d49bb26187aff42f2abc90aee28 | <|skeleton|>
class DeiTClsHead:
"""Distilled Vision Transformer classifier head. Comparing with the :class:`VisionTransformerClsHead`, this head adds an extra linear layer to handle the dist token. The final classification score is the average of both linear transformation results of ``cls_token`` and ``dist_token`... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DeiTClsHead:
"""Distilled Vision Transformer classifier head. Comparing with the :class:`VisionTransformerClsHead`, this head adds an extra linear layer to handle the dist token. The final classification score is the average of both linear transformation results of ``cls_token`` and ``dist_token``. Args: num_... | the_stack_v2_python_sparse | mmpretrain/models/heads/deit_head.py | open-mmlab/mmpretrain | train | 652 |
d64c76b5393487e8c15da4b87ccd3962c8d72a24 | [
"self.client = Client()\nself.test_user = User.objects.create_user('testuser', 'blah@blah.com', 'testpassword')\nself.test_user.is_superuser = True\nself.test_user.is_active = True\nself.test_user.save()\nself.assertEqual(self.test_user.is_superuser, True)\nlogin = self.client.login(username='testuser', password='t... | <|body_start_0|>
self.client = Client()
self.test_user = User.objects.create_user('testuser', 'blah@blah.com', 'testpassword')
self.test_user.is_superuser = True
self.test_user.is_active = True
self.test_user.save()
self.assertEqual(self.test_user.is_superuser, True)
... | This class tests varios aspects of the :class:`~projects.api.ProjectResource` API model. | ProjectResourceTests | [
"CC0-1.0",
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProjectResourceTests:
"""This class tests varios aspects of the :class:`~projects.api.ProjectResource` API model."""
def setUp(self):
"""Instantiate the test client. Creates a test user."""
<|body_0|>
def tearDown(self):
"""Depopulate created model instances from... | stack_v2_sparse_classes_36k_train_026965 | 16,895 | permissive | [
{
"docstring": "Instantiate the test client. Creates a test user.",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "Depopulate created model instances from test database.",
"name": "tearDown",
"signature": "def tearDown(self)"
},
{
"docstring": "This tests that... | 4 | stack_v2_sparse_classes_30k_train_020909 | Implement the Python class `ProjectResourceTests` described below.
Class description:
This class tests varios aspects of the :class:`~projects.api.ProjectResource` API model.
Method signatures and docstrings:
- def setUp(self): Instantiate the test client. Creates a test user.
- def tearDown(self): Depopulate created... | Implement the Python class `ProjectResourceTests` described below.
Class description:
This class tests varios aspects of the :class:`~projects.api.ProjectResource` API model.
Method signatures and docstrings:
- def setUp(self): Instantiate the test client. Creates a test user.
- def tearDown(self): Depopulate created... | d6f6c9c068bbf668c253e5943d9514947023e66d | <|skeleton|>
class ProjectResourceTests:
"""This class tests varios aspects of the :class:`~projects.api.ProjectResource` API model."""
def setUp(self):
"""Instantiate the test client. Creates a test user."""
<|body_0|>
def tearDown(self):
"""Depopulate created model instances from... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ProjectResourceTests:
"""This class tests varios aspects of the :class:`~projects.api.ProjectResource` API model."""
def setUp(self):
"""Instantiate the test client. Creates a test user."""
self.client = Client()
self.test_user = User.objects.create_user('testuser', 'blah@blah.com... | the_stack_v2_python_sparse | projects/tests.py | BridgesLab/Lab-Website | train | 0 |
e9b8e24fe6ad82416d65ccf6a39742bf7257fbeb | [
"if base == tgt:\n a = tmp[:]\n lst.append(a)\n return\nfor i in xrange(depth, len(ref)):\n if base + ref[i] <= tgt:\n tmp.append(ref[i])\n self.CS(base + ref[i], tgt, lst, ref, tmp, i)\n tmp.pop()",
"candidates.sort()\nres, tmp = ([], [])\nself.CS(0, target, res, candidates, tmp,... | <|body_start_0|>
if base == tgt:
a = tmp[:]
lst.append(a)
return
for i in xrange(depth, len(ref)):
if base + ref[i] <= tgt:
tmp.append(ref[i])
self.CS(base + ref[i], tgt, lst, ref, tmp, i)
tmp.pop()
<|end_bod... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def CS(self, base, tgt, lst, ref, tmp, depth):
"""base: value already calculated tgt: target number lst: result List ref: candidates List tmp: one answer depth: 到了第几个数"""
<|body_0|>
def combinationSum(self, candidates, target):
""":type candidates: List[int... | stack_v2_sparse_classes_36k_train_026966 | 3,337 | no_license | [
{
"docstring": "base: value already calculated tgt: target number lst: result List ref: candidates List tmp: one answer depth: 到了第几个数",
"name": "CS",
"signature": "def CS(self, base, tgt, lst, ref, tmp, depth)"
},
{
"docstring": ":type candidates: List[int] :type target: int :rtype: List[List[in... | 2 | stack_v2_sparse_classes_30k_train_013138 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def CS(self, base, tgt, lst, ref, tmp, depth): base: value already calculated tgt: target number lst: result List ref: candidates List tmp: one answer depth: 到了第几个数
- def combina... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def CS(self, base, tgt, lst, ref, tmp, depth): base: value already calculated tgt: target number lst: result List ref: candidates List tmp: one answer depth: 到了第几个数
- def combina... | 507ed2efeff7818ca9cf53a8ee7fb80d3c530d67 | <|skeleton|>
class Solution:
def CS(self, base, tgt, lst, ref, tmp, depth):
"""base: value already calculated tgt: target number lst: result List ref: candidates List tmp: one answer depth: 到了第几个数"""
<|body_0|>
def combinationSum(self, candidates, target):
""":type candidates: List[int... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def CS(self, base, tgt, lst, ref, tmp, depth):
"""base: value already calculated tgt: target number lst: result List ref: candidates List tmp: one answer depth: 到了第几个数"""
if base == tgt:
a = tmp[:]
lst.append(a)
return
for i in xrange(depth... | the_stack_v2_python_sparse | Leetcode/Backtracking/#39-Combination Sum/main.py | qizongjun/Algorithms-1 | train | 0 | |
ae54c0737fa287fe1a7c27d6533ecd71c3376132 | [
"self.num_layers = num_layers\nself.threshold = threshold\nself.contact_graph = contact_graph\nself.weights = weights\nself.freq_input = freq_input\noutput_shapes = ([None, 20], [None, None]) if self.contact_graph else ([None, 20],)\noutput_types = ('float32', 'float32') if self.contact_graph else ('float32',)\nout... | <|body_start_0|>
self.num_layers = num_layers
self.threshold = threshold
self.contact_graph = contact_graph
self.weights = weights
self.freq_input = freq_input
output_shapes = ([None, 20], [None, None]) if self.contact_graph else ([None, 20],)
output_types = ('flo... | ProteinNetPy LabeledFunction returning the required data for the sequence UNET model. LabeledFunction taking a ProteinNetPy record and returning the data required to run Sequence UNET on that record. This can be used with a ProteinNetPy map to generate input data for training or predictions. The function outputs a tupl... | SequenceUNETMapFunction | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SequenceUNETMapFunction:
"""ProteinNetPy LabeledFunction returning the required data for the sequence UNET model. LabeledFunction taking a ProteinNetPy record and returning the data required to run Sequence UNET on that record. This can be used with a ProteinNetPy map to generate input data for t... | stack_v2_sparse_classes_36k_train_026967 | 13,717 | permissive | [
{
"docstring": "Initialise the SequenceUNETMapFunction. Parameters ---------- num_layers : int Number of layers in the Sequence UNET model. threshold : float or None Return categorical output, with variants below this threshold classed as deleterious. contact_graph : bool Return a contact graph in addition to t... | 2 | stack_v2_sparse_classes_30k_train_019044 | Implement the Python class `SequenceUNETMapFunction` described below.
Class description:
ProteinNetPy LabeledFunction returning the required data for the sequence UNET model. LabeledFunction taking a ProteinNetPy record and returning the data required to run Sequence UNET on that record. This can be used with a Protei... | Implement the Python class `SequenceUNETMapFunction` described below.
Class description:
ProteinNetPy LabeledFunction returning the required data for the sequence UNET model. LabeledFunction taking a ProteinNetPy record and returning the data required to run Sequence UNET on that record. This can be used with a Protei... | cfd0a32f11c733c52c2818b697077feb991ff788 | <|skeleton|>
class SequenceUNETMapFunction:
"""ProteinNetPy LabeledFunction returning the required data for the sequence UNET model. LabeledFunction taking a ProteinNetPy record and returning the data required to run Sequence UNET on that record. This can be used with a ProteinNetPy map to generate input data for t... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SequenceUNETMapFunction:
"""ProteinNetPy LabeledFunction returning the required data for the sequence UNET model. LabeledFunction taking a ProteinNetPy record and returning the data required to run Sequence UNET on that record. This can be used with a ProteinNetPy map to generate input data for training or pr... | the_stack_v2_python_sparse | sequence_unet/predict.py | allydunham/sequence_unet | train | 16 |
a0cbe4ae7b5fbbff15dfa0293319b376abaac5f1 | [
"N = prior.size\nself.lims = (-1, 1)\nself.pdf_ref, self.bins = np.histogram(prior, bins=N, range=self.lims)",
"if np.min(x) < self.lims[0]:\n tqdm.write('XHAT MIN WAS LOWER THAN X MIN: %g' % np.min(x))\nif np.max(x) > self.lims[1]:\n tqdm.write('XHAT MAX WAS HIGHER THAN X MAX: %g' % np.max(x))\nreturn np.h... | <|body_start_0|>
N = prior.size
self.lims = (-1, 1)
self.pdf_ref, self.bins = np.histogram(prior, bins=N, range=self.lims)
<|end_body_0|>
<|body_start_1|>
if np.min(x) < self.lims[0]:
tqdm.write('XHAT MIN WAS LOWER THAN X MIN: %g' % np.min(x))
if np.max(x) > self.lim... | Picklable object for computing pdfs. Uses histogram to estimate pdf. Attributes ---------- N : int Size of signal. lims : array_like or tuple Upper and lower bounds for range of histogram. pdf_ref : array_like pdf estimate of prior. Used to compare to pdf(xhat). bins : array_like bin locations used for construction of ... | pdf_default | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class pdf_default:
"""Picklable object for computing pdfs. Uses histogram to estimate pdf. Attributes ---------- N : int Size of signal. lims : array_like or tuple Upper and lower bounds for range of histogram. pdf_ref : array_like pdf estimate of prior. Used to compare to pdf(xhat). bins : array_like ... | stack_v2_sparse_classes_36k_train_026968 | 9,248 | no_license | [
{
"docstring": "Note that prior should be normalized between lims=(-1, 1).",
"name": "__init__",
"signature": "def __init__(self, prior)"
},
{
"docstring": "Estimate the pdf of x. Parameters ---------- x : array_like Signal to get pdf estimate of. Returns ------- array_like Histogram of x. Notes... | 2 | stack_v2_sparse_classes_30k_train_008792 | Implement the Python class `pdf_default` described below.
Class description:
Picklable object for computing pdfs. Uses histogram to estimate pdf. Attributes ---------- N : int Size of signal. lims : array_like or tuple Upper and lower bounds for range of histogram. pdf_ref : array_like pdf estimate of prior. Used to c... | Implement the Python class `pdf_default` described below.
Class description:
Picklable object for computing pdfs. Uses histogram to estimate pdf. Attributes ---------- N : int Size of signal. lims : array_like or tuple Upper and lower bounds for range of histogram. pdf_ref : array_like pdf estimate of prior. Used to c... | 08cb43dcf53fd6fddd3304e3514a608842310a34 | <|skeleton|>
class pdf_default:
"""Picklable object for computing pdfs. Uses histogram to estimate pdf. Attributes ---------- N : int Size of signal. lims : array_like or tuple Upper and lower bounds for range of histogram. pdf_ref : array_like pdf estimate of prior. Used to compare to pdf(xhat). bins : array_like ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class pdf_default:
"""Picklable object for computing pdfs. Uses histogram to estimate pdf. Attributes ---------- N : int Size of signal. lims : array_like or tuple Upper and lower bounds for range of histogram. pdf_ref : array_like pdf estimate of prior. Used to compare to pdf(xhat). bins : array_like bin locations... | the_stack_v2_python_sparse | mr_utils/cs/ordinator.py | zongjg/mr_utils | train | 0 |
3573dfda0110b4ce5554f97eee881b5b87387e2d | [
"skips = [k for k in settings.keys() if k.endswith(tuple(settings.skip))]\ncomponent_keys = [k for k in settings.keys() if k not in skips]\nif name is None:\n try:\n name = component_keys[0]\n except IndexError:\n raise ValueError('No sections in settings indicate how to construct a project outl... | <|body_start_0|>
skips = [k for k in settings.keys() if k.endswith(tuple(settings.skip))]
component_keys = [k for k in settings.keys() if k not in skips]
if name is None:
try:
name = component_keys[0]
except IndexError:
raise ValueError('No... | Information needed to construct and execute a Workflow. Args: name (str): designates the name of a class instance that is used for internal referencing throughout sourdough. For example, if a sourdough instance needs settings from a Configuration instance, 'name' should match the appropriate section name in a Configura... | Outline | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Outline:
"""Information needed to construct and execute a Workflow. Args: name (str): designates the name of a class instance that is used for internal referencing throughout sourdough. For example, if a sourdough instance needs settings from a Configuration instance, 'name' should match the appr... | stack_v2_sparse_classes_36k_train_026969 | 14,889 | permissive | [
{
"docstring": "[summary] Args: source (base.Settings): [description] Returns: Outline: [description]",
"name": "from_settings",
"signature": "def from_settings(cls, settings: base.Settings, name: str=None) -> Outline"
},
{
"docstring": "[summary] Args: name (str): [description] settings (base.S... | 5 | stack_v2_sparse_classes_30k_train_015524 | Implement the Python class `Outline` described below.
Class description:
Information needed to construct and execute a Workflow. Args: name (str): designates the name of a class instance that is used for internal referencing throughout sourdough. For example, if a sourdough instance needs settings from a Configuration... | Implement the Python class `Outline` described below.
Class description:
Information needed to construct and execute a Workflow. Args: name (str): designates the name of a class instance that is used for internal referencing throughout sourdough. For example, if a sourdough instance needs settings from a Configuration... | 5302da8bf4944ac518d22cc37c181e5a09baaabe | <|skeleton|>
class Outline:
"""Information needed to construct and execute a Workflow. Args: name (str): designates the name of a class instance that is used for internal referencing throughout sourdough. For example, if a sourdough instance needs settings from a Configuration instance, 'name' should match the appr... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Outline:
"""Information needed to construct and execute a Workflow. Args: name (str): designates the name of a class instance that is used for internal referencing throughout sourdough. For example, if a sourdough instance needs settings from a Configuration instance, 'name' should match the appropriate secti... | the_stack_v2_python_sparse | simplify/core/stages.py | WithPrecedent/simplify | train | 1 |
0a33f0a889eea4a5f7a7cd8c4636c45a5d06c67c | [
"assert hasattr(request, 'user'), 'AuthenticationPolicyMiddleware needs a user attribute on request, add AuthenticationMiddleware before AuthenticationPolicyMiddleware in MIDDLEWARE_CLASSES'\nif not request.user.is_authenticated():\n return None\nif 'password_hash' not in request.session:\n update_password(re... | <|body_start_0|>
assert hasattr(request, 'user'), 'AuthenticationPolicyMiddleware needs a user attribute on request, add AuthenticationMiddleware before AuthenticationPolicyMiddleware in MIDDLEWARE_CLASSES'
if not request.user.is_authenticated():
return None
if 'password_hash' not in... | This middleware enforces the following policy. - Change of password when password has expired; - Change of password when user has a temporary password; - Logout disabled users; This is enforced using middleware to prevent users from accessing any page handled by Django without the policy being enforced. | AuthenticationPolicyMiddleware | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AuthenticationPolicyMiddleware:
"""This middleware enforces the following policy. - Change of password when password has expired; - Change of password when user has a temporary password; - Logout disabled users; This is enforced using middleware to prevent users from accessing any page handled by... | stack_v2_sparse_classes_36k_train_026970 | 6,789 | no_license | [
{
"docstring": "Method to handle requests.",
"name": "process_request",
"signature": "def process_request(self, request)"
},
{
"docstring": "Method to handle response.",
"name": "process_response",
"signature": "def process_response(self, request, response)"
},
{
"docstring": "Re... | 4 | null | Implement the Python class `AuthenticationPolicyMiddleware` described below.
Class description:
This middleware enforces the following policy. - Change of password when password has expired; - Change of password when user has a temporary password; - Logout disabled users; This is enforced using middleware to prevent u... | Implement the Python class `AuthenticationPolicyMiddleware` described below.
Class description:
This middleware enforces the following policy. - Change of password when password has expired; - Change of password when user has a temporary password; - Logout disabled users; This is enforced using middleware to prevent u... | cb392be0402543acf074425fcaf8edf054269012 | <|skeleton|>
class AuthenticationPolicyMiddleware:
"""This middleware enforces the following policy. - Change of password when password has expired; - Change of password when user has a temporary password; - Logout disabled users; This is enforced using middleware to prevent users from accessing any page handled by... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AuthenticationPolicyMiddleware:
"""This middleware enforces the following policy. - Change of password when password has expired; - Change of password when user has a temporary password; - Logout disabled users; This is enforced using middleware to prevent users from accessing any page handled by Django witho... | the_stack_v2_python_sparse | cpovc_access/middleware.py | uonafya/cpims-2.3beta | train | 4 |
0242c3d164e4c22a9ffc8f95b949c4c8a7861dcc | [
"i = 0\nflag = 0\nfor _ in range(len(nums)):\n if nums[i] == target:\n if i < 0:\n return i + len(nums)\n return i\n elif nums[i] < target:\n if flag == 1:\n i += 1\n elif flag == 0:\n flag = 1\n i += 1\n elif flag == -1:\n ... | <|body_start_0|>
i = 0
flag = 0
for _ in range(len(nums)):
if nums[i] == target:
if i < 0:
return i + len(nums)
return i
elif nums[i] < target:
if flag == 1:
i += 1
eli... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def search(self, nums, target):
""":type nums: List[int] :type target: int :rtype: int"""
<|body_0|>
def search2(self, nums, target):
""":type nums: List[int] :type target: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
i ... | stack_v2_sparse_classes_36k_train_026971 | 1,104 | no_license | [
{
"docstring": ":type nums: List[int] :type target: int :rtype: int",
"name": "search",
"signature": "def search(self, nums, target)"
},
{
"docstring": ":type nums: List[int] :type target: int :rtype: int",
"name": "search2",
"signature": "def search2(self, nums, target)"
}
] | 2 | stack_v2_sparse_classes_30k_test_000556 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def search(self, nums, target): :type nums: List[int] :type target: int :rtype: int
- def search2(self, nums, target): :type nums: List[int] :type target: int :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def search(self, nums, target): :type nums: List[int] :type target: int :rtype: int
- def search2(self, nums, target): :type nums: List[int] :type target: int :rtype: int
<|skel... | 863b89be674a82eef60c0f33d726ac08d43f2e01 | <|skeleton|>
class Solution:
def search(self, nums, target):
""":type nums: List[int] :type target: int :rtype: int"""
<|body_0|>
def search2(self, nums, target):
""":type nums: List[int] :type target: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def search(self, nums, target):
""":type nums: List[int] :type target: int :rtype: int"""
i = 0
flag = 0
for _ in range(len(nums)):
if nums[i] == target:
if i < 0:
return i + len(nums)
return i
... | the_stack_v2_python_sparse | q33_Search_in_Rotated_Sorted_Array.py | Ryuya1995/leetcode | train | 0 | |
86cad39fe65e24429704134dcefa7a488758a272 | [
"self._logger = get_logger()\nself._cfg = cfg\nself._ckpt_id = None\nself._ckpt = None\nself._ckpt_mngr = None\nself._ckpt_status = None\nreturn",
"assert ckpt2load == 'latest' or isinstance(ckpt2load, int)\nself._ckpt_id = tf.Variable(initial_value=-1, trainable=False, dtype=tf.int64)\nself._ckpt = tf.train.Chec... | <|body_start_0|>
self._logger = get_logger()
self._cfg = cfg
self._ckpt_id = None
self._ckpt = None
self._ckpt_mngr = None
self._ckpt_status = None
return
<|end_body_0|>
<|body_start_1|>
assert ckpt2load == 'latest' or isinstance(ckpt2load, int)
s... | Handles checkpoint related tasks | CheckpointHandler | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CheckpointHandler:
"""Handles checkpoint related tasks"""
def __init__(self, cfg):
""":param cfg: Configuration"""
<|body_0|>
def load_checkpoint(self, to_store, ckpt2load='latest'):
"""Loads checkpoint from directory. :param to_store: A dictionary of Python obje... | stack_v2_sparse_classes_36k_train_026972 | 4,165 | permissive | [
{
"docstring": ":param cfg: Configuration",
"name": "__init__",
"signature": "def __init__(self, cfg)"
},
{
"docstring": "Loads checkpoint from directory. :param to_store: A dictionary of Python object stored in checkpoints :param ckpt2load: Specify which checkpoint to load. Supported values 'la... | 4 | stack_v2_sparse_classes_30k_train_015836 | Implement the Python class `CheckpointHandler` described below.
Class description:
Handles checkpoint related tasks
Method signatures and docstrings:
- def __init__(self, cfg): :param cfg: Configuration
- def load_checkpoint(self, to_store, ckpt2load='latest'): Loads checkpoint from directory. :param to_store: A dict... | Implement the Python class `CheckpointHandler` described below.
Class description:
Handles checkpoint related tasks
Method signatures and docstrings:
- def __init__(self, cfg): :param cfg: Configuration
- def load_checkpoint(self, to_store, ckpt2load='latest'): Loads checkpoint from directory. :param to_store: A dict... | 4651a21d9ba274d49c9a8a8dcf5d98c16eff1510 | <|skeleton|>
class CheckpointHandler:
"""Handles checkpoint related tasks"""
def __init__(self, cfg):
""":param cfg: Configuration"""
<|body_0|>
def load_checkpoint(self, to_store, ckpt2load='latest'):
"""Loads checkpoint from directory. :param to_store: A dictionary of Python obje... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CheckpointHandler:
"""Handles checkpoint related tasks"""
def __init__(self, cfg):
""":param cfg: Configuration"""
self._logger = get_logger()
self._cfg = cfg
self._ckpt_id = None
self._ckpt = None
self._ckpt_mngr = None
self._ckpt_status = None
... | the_stack_v2_python_sparse | squeezenet/checkpoint_handler.py | 9autilus/squeezenet | train | 0 |
2f8e94dd4de6db0b49673e27b220bd8d13830f0a | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn WorkbookFilter()",
"from .entity import Entity\nfrom .workbook_filter_criteria import WorkbookFilterCriteria\nfrom .entity import Entity\nfrom .workbook_filter_criteria import WorkbookFilterCriteria\nfields: Dict[str, Callable[[Any], N... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return WorkbookFilter()
<|end_body_0|>
<|body_start_1|>
from .entity import Entity
from .workbook_filter_criteria import WorkbookFilterCriteria
from .entity import Entity
from .... | WorkbookFilter | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WorkbookFilter:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WorkbookFilter:
"""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 Retur... | stack_v2_sparse_classes_36k_train_026973 | 2,232 | 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: WorkbookFilter",
"name": "create_from_discriminator_value",
"signature": "def create_from_discriminator_valu... | 3 | stack_v2_sparse_classes_30k_val_001068 | Implement the Python class `WorkbookFilter` described below.
Class description:
Implement the WorkbookFilter class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WorkbookFilter: Creates a new instance of the appropriate class based on discriminator va... | Implement the Python class `WorkbookFilter` described below.
Class description:
Implement the WorkbookFilter class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WorkbookFilter: Creates a new instance of the appropriate class based on discriminator va... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class WorkbookFilter:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WorkbookFilter:
"""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 Retur... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class WorkbookFilter:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WorkbookFilter:
"""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: WorkbookFi... | the_stack_v2_python_sparse | msgraph/generated/models/workbook_filter.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
0cb680548459736603a9c09d9f8286f44d899cdc | [
"if key in ['predict_proba', 'decision_function']:\n key = 'predict'\nreturn super().get_args(key=key, obj=obj, deepcopy_args=deepcopy_args)",
"def get_tag(obj, tag_name):\n if isclass(obj):\n return obj.get_class_tag(tag_name)\n else:\n return obj.get_tag(tag_name)\nregr_or_classf = (BaseC... | <|body_start_0|>
if key in ['predict_proba', 'decision_function']:
key = 'predict'
return super().get_args(key=key, obj=obj, deepcopy_args=deepcopy_args)
<|end_body_0|>
<|body_start_1|>
def get_tag(obj, tag_name):
if isclass(obj):
return obj.get_class_tag... | Generic test scenario for classifiers. | ClassifierTestScenario | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ClassifierTestScenario:
"""Generic test scenario for classifiers."""
def get_args(self, key, obj=None, deepcopy_args=True):
"""Return args for key. Can be overridden for dynamic arg generation. If overridden, must not have any side effects on self.args e.g., avoid assignments args[ke... | stack_v2_sparse_classes_36k_train_026974 | 7,126 | permissive | [
{
"docstring": "Return args for key. Can be overridden for dynamic arg generation. If overridden, must not have any side effects on self.args e.g., avoid assignments args[key] = x without deepcopying self.args first Parameters ---------- key : str, argument key to construct/retrieve args for obj : obj, optional... | 2 | stack_v2_sparse_classes_30k_train_017218 | Implement the Python class `ClassifierTestScenario` described below.
Class description:
Generic test scenario for classifiers.
Method signatures and docstrings:
- def get_args(self, key, obj=None, deepcopy_args=True): Return args for key. Can be overridden for dynamic arg generation. If overridden, must not have any ... | Implement the Python class `ClassifierTestScenario` described below.
Class description:
Generic test scenario for classifiers.
Method signatures and docstrings:
- def get_args(self, key, obj=None, deepcopy_args=True): Return args for key. Can be overridden for dynamic arg generation. If overridden, must not have any ... | 70b2bfaaa597eb31bc3a1032366dcc0e1f4c8a9f | <|skeleton|>
class ClassifierTestScenario:
"""Generic test scenario for classifiers."""
def get_args(self, key, obj=None, deepcopy_args=True):
"""Return args for key. Can be overridden for dynamic arg generation. If overridden, must not have any side effects on self.args e.g., avoid assignments args[ke... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ClassifierTestScenario:
"""Generic test scenario for classifiers."""
def get_args(self, key, obj=None, deepcopy_args=True):
"""Return args for key. Can be overridden for dynamic arg generation. If overridden, must not have any side effects on self.args e.g., avoid assignments args[key] = x withou... | the_stack_v2_python_sparse | sktime/utils/_testing/scenarios_classification.py | sktime/sktime | train | 1,117 |
4dfd1f7f86a633fc89ef580bcb06c0868c7f6d19 | [
"try:\n kernel_size = int(kernel_size)\nexcept ValueError:\n raise TypeError('kernel_size must be an int')\nif kernel_size < 1:\n raise ValueError('kernel_size must be >= 1')\nself.kernel_size = kernel_size\nsuper(LocalContrastNormalization, self).__init__(**kwargs)",
"kernel = normal_kernel(self.kernel_... | <|body_start_0|>
try:
kernel_size = int(kernel_size)
except ValueError:
raise TypeError('kernel_size must be an int')
if kernel_size < 1:
raise ValueError('kernel_size must be >= 1')
self.kernel_size = kernel_size
super(LocalContrastNormalizati... | A Keras layer to normalize images using local contrast normalization. | LocalContrastNormalization | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LocalContrastNormalization:
"""A Keras layer to normalize images using local contrast normalization."""
def __init__(self, kernel_size=9, **kwargs):
"""Initialize a new contrast normalization layer. Args: kernel_size: the size of the kernel to use in Gaussian kernels Returns: None"""... | stack_v2_sparse_classes_36k_train_026975 | 3,261 | permissive | [
{
"docstring": "Initialize a new contrast normalization layer. Args: kernel_size: the size of the kernel to use in Gaussian kernels Returns: None",
"name": "__init__",
"signature": "def __init__(self, kernel_size=9, **kwargs)"
},
{
"docstring": "Forward pass through the contrast normalization la... | 2 | stack_v2_sparse_classes_30k_train_012251 | Implement the Python class `LocalContrastNormalization` described below.
Class description:
A Keras layer to normalize images using local contrast normalization.
Method signatures and docstrings:
- def __init__(self, kernel_size=9, **kwargs): Initialize a new contrast normalization layer. Args: kernel_size: the size ... | Implement the Python class `LocalContrastNormalization` described below.
Class description:
A Keras layer to normalize images using local contrast normalization.
Method signatures and docstrings:
- def __init__(self, kernel_size=9, **kwargs): Initialize a new contrast normalization layer. Args: kernel_size: the size ... | dc04ed3cfc3a62a852fcbc5fb38f8c8fbc8ecefc | <|skeleton|>
class LocalContrastNormalization:
"""A Keras layer to normalize images using local contrast normalization."""
def __init__(self, kernel_size=9, **kwargs):
"""Initialize a new contrast normalization layer. Args: kernel_size: the size of the kernel to use in Gaussian kernels Returns: None"""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LocalContrastNormalization:
"""A Keras layer to normalize images using local contrast normalization."""
def __init__(self, kernel_size=9, **kwargs):
"""Initialize a new contrast normalization layer. Args: kernel_size: the size of the kernel to use in Gaussian kernels Returns: None"""
try:... | the_stack_v2_python_sparse | Bayesian_SegNet/src/layers/local_contrast_normalization.py | janisgp/Sampling-free-Epistemic-Uncertainty | train | 91 |
26a715a3e0a306493647936a909dabdb4775cadc | [
"twotuple = json.loads(value)\nif not twotuple:\n twotuple = {}\n twotuple['key'] = 'value'\nret = ''\nif value and len(value) > 0:\n for k, v in twotuple.items():\n key, value = (_(k), v)\n key_input = f'<input type=\"text\" name=\"json_key[{name}]\" value=\"{key}\">'\n val_input = f'... | <|body_start_0|>
twotuple = json.loads(value)
if not twotuple:
twotuple = {}
twotuple['key'] = 'value'
ret = ''
if value and len(value) > 0:
for k, v in twotuple.items():
key, value = (_(k), v)
key_input = f'<input type=... | JsonPairDatasetInputs | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class JsonPairDatasetInputs:
def render(self, name, value, attrs=None, renderer=None):
"""Renders this widget into an html string args: name (str) -- name of the field value (str) -- a json string of a two-tuple list automatically passed in by django attrs (dict) -- automatically passed in by ... | stack_v2_sparse_classes_36k_train_026976 | 2,732 | no_license | [
{
"docstring": "Renders this widget into an html string args: name (str) -- name of the field value (str) -- a json string of a two-tuple list automatically passed in by django attrs (dict) -- automatically passed in by django (unused in this function)",
"name": "render",
"signature": "def render(self, ... | 2 | null | Implement the Python class `JsonPairDatasetInputs` described below.
Class description:
Implement the JsonPairDatasetInputs class.
Method signatures and docstrings:
- def render(self, name, value, attrs=None, renderer=None): Renders this widget into an html string args: name (str) -- name of the field value (str) -- a... | Implement the Python class `JsonPairDatasetInputs` described below.
Class description:
Implement the JsonPairDatasetInputs class.
Method signatures and docstrings:
- def render(self, name, value, attrs=None, renderer=None): Renders this widget into an html string args: name (str) -- name of the field value (str) -- a... | 090dbf82c57633de9d53530f0c93dddf6b43a23b | <|skeleton|>
class JsonPairDatasetInputs:
def render(self, name, value, attrs=None, renderer=None):
"""Renders this widget into an html string args: name (str) -- name of the field value (str) -- a json string of a two-tuple list automatically passed in by django attrs (dict) -- automatically passed in by ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class JsonPairDatasetInputs:
def render(self, name, value, attrs=None, renderer=None):
"""Renders this widget into an html string args: name (str) -- name of the field value (str) -- a json string of a two-tuple list automatically passed in by django attrs (dict) -- automatically passed in by django (unused... | the_stack_v2_python_sparse | mcod/lib/widgets.py | olekstomek/mcod-backend-dane.gov.pl | train | 0 | |
617d919b882fa41abfe7751a931e9af077cc202e | [
"if f == 'e':\n mf = me\nelif f == 'mu':\n mf = mmu\nmu_l = mf / Q\nx = 2 * egam / Q\nret_val = 0.0\nif 4.0 * mf ** 2 <= Q ** 2 - 2.0 * Q * egam <= Q ** 2 and Q > 2.0 * mf and (Q > 2.0 * self.mx):\n val = (2 * alpha_em * (-(sqrt(1 + 4 * mu_l ** 2 / (-1 + x)) * (2 - 2 * x + x ** 2 - 4 * (-1 + x) * mu_l ** 2... | <|body_start_0|>
if f == 'e':
mf = me
elif f == 'mu':
mf = mmu
mu_l = mf / Q
x = 2 * egam / Q
ret_val = 0.0
if 4.0 * mf ** 2 <= Q ** 2 - 2.0 * Q * egam <= Q ** 2 and Q > 2.0 * mf and (Q > 2.0 * self.mx):
val = (2 * alpha_em * (-(sqrt(1 ... | VectorMediatorFSR | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VectorMediatorFSR:
def __dnde_xx_to_v_to_ffg(self, egam, Q, f):
"""Return the fsr spectra for fermions from decay of vector mediator. Computes the final state radiaton spectrum value dNdE from a vector mediator given a gamma ray energy of `egam`, center of mass energy `Q` and final state... | stack_v2_sparse_classes_36k_train_026977 | 4,828 | permissive | [
{
"docstring": "Return the fsr spectra for fermions from decay of vector mediator. Computes the final state radiaton spectrum value dNdE from a vector mediator given a gamma ray energy of `egam`, center of mass energy `Q` and final state fermion `f`. Paramaters ---------- egam : float Gamma ray energy. Q: float... | 4 | null | Implement the Python class `VectorMediatorFSR` described below.
Class description:
Implement the VectorMediatorFSR class.
Method signatures and docstrings:
- def __dnde_xx_to_v_to_ffg(self, egam, Q, f): Return the fsr spectra for fermions from decay of vector mediator. Computes the final state radiaton spectrum value... | Implement the Python class `VectorMediatorFSR` described below.
Class description:
Implement the VectorMediatorFSR class.
Method signatures and docstrings:
- def __dnde_xx_to_v_to_ffg(self, egam, Q, f): Return the fsr spectra for fermions from decay of vector mediator. Computes the final state radiaton spectrum value... | a40ffd3e5643303bb535d9b487faf201450ff4e9 | <|skeleton|>
class VectorMediatorFSR:
def __dnde_xx_to_v_to_ffg(self, egam, Q, f):
"""Return the fsr spectra for fermions from decay of vector mediator. Computes the final state radiaton spectrum value dNdE from a vector mediator given a gamma ray energy of `egam`, center of mass energy `Q` and final state... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class VectorMediatorFSR:
def __dnde_xx_to_v_to_ffg(self, egam, Q, f):
"""Return the fsr spectra for fermions from decay of vector mediator. Computes the final state radiaton spectrum value dNdE from a vector mediator given a gamma ray energy of `egam`, center of mass energy `Q` and final state fermion `f`. ... | the_stack_v2_python_sparse | hazma/vector_mediator/_vector_mediator_fsr.py | LoganAMorrison/Hazma | train | 12 | |
1b198fb4280f326490a1dfb1b49303a94aa19f4c | [
"domish.Element.__init__(self, (None, 'iq'))\nself.addUniqueId()\nself['type'] = stanzaType\nself._xmlstream = xmlstream",
"if to is not None:\n self['to'] = to\nif not ijabber.IIQResponseTracker.providedBy(self._xmlstream):\n upgradeWithIQResponseTracker(self._xmlstream)\nd = defer.Deferred()\nself._xmlstr... | <|body_start_0|>
domish.Element.__init__(self, (None, 'iq'))
self.addUniqueId()
self['type'] = stanzaType
self._xmlstream = xmlstream
<|end_body_0|>
<|body_start_1|>
if to is not None:
self['to'] = to
if not ijabber.IIQResponseTracker.providedBy(self._xmlstre... | Wrapper for an iq stanza. Iq stanzas are used for communications with a request-response behaviour. Each iq request is associated with an XML stream and has its own unique id to be able to track the response. @ivar timeout: if set, a timeout period after which the deferred returned by C{send} will have its errback call... | IQ | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IQ:
"""Wrapper for an iq stanza. Iq stanzas are used for communications with a request-response behaviour. Each iq request is associated with an XML stream and has its own unique id to be able to track the response. @ivar timeout: if set, a timeout period after which the deferred returned by C{se... | stack_v2_sparse_classes_36k_train_026978 | 36,848 | permissive | [
{
"docstring": "@type xmlstream: L{xmlstream.XmlStream} @param xmlstream: XmlStream to use for transmission of this IQ @type stanzaType: C{str} @param stanzaType: IQ type identifier ('get' or 'set')",
"name": "__init__",
"signature": "def __init__(self, xmlstream, stanzaType='set')"
},
{
"docstr... | 2 | stack_v2_sparse_classes_30k_train_005865 | Implement the Python class `IQ` described below.
Class description:
Wrapper for an iq stanza. Iq stanzas are used for communications with a request-response behaviour. Each iq request is associated with an XML stream and has its own unique id to be able to track the response. @ivar timeout: if set, a timeout period af... | Implement the Python class `IQ` described below.
Class description:
Wrapper for an iq stanza. Iq stanzas are used for communications with a request-response behaviour. Each iq request is associated with an XML stream and has its own unique id to be able to track the response. @ivar timeout: if set, a timeout period af... | 40861791ec4ed3bbd14b07875af25cc740f76920 | <|skeleton|>
class IQ:
"""Wrapper for an iq stanza. Iq stanzas are used for communications with a request-response behaviour. Each iq request is associated with an XML stream and has its own unique id to be able to track the response. @ivar timeout: if set, a timeout period after which the deferred returned by C{se... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class IQ:
"""Wrapper for an iq stanza. Iq stanzas are used for communications with a request-response behaviour. Each iq request is associated with an XML stream and has its own unique id to be able to track the response. @ivar timeout: if set, a timeout period after which the deferred returned by C{send} will have... | the_stack_v2_python_sparse | stackoverflow/venv/lib/python3.6/site-packages/twisted/words/protocols/jabber/xmlstream.py | wistbean/learn_python3_spider | train | 14,403 |
7c56c7818b568bfd8f17c80fc95956e8ee7542f8 | [
"logger.info('Loading file list from %s', self.folder)\nfor face in tqdm(os.listdir(self.folder), desc='Reading Face Hashes'):\n if not self.valid_extension(face):\n continue\n filename = os.path.splitext(face)[0]\n file_extension = os.path.splitext(face)[1]\n face_hash = hash_image_file(os.path.... | <|body_start_0|>
logger.info('Loading file list from %s', self.folder)
for face in tqdm(os.listdir(self.folder), desc='Reading Face Hashes'):
if not self.valid_extension(face):
continue
filename = os.path.splitext(face)[0]
file_extension = os.path.spli... | Object to hold the faces that are to be swapped out | Faces | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Faces:
"""Object to hold the faces that are to be swapped out"""
def process_folder(self):
"""Iterate through the faces dir pulling out various information"""
<|body_0|>
def load_items(self):
"""Load the face names into dictionary"""
<|body_1|>
def s... | stack_v2_sparse_classes_36k_train_026979 | 13,433 | permissive | [
{
"docstring": "Iterate through the faces dir pulling out various information",
"name": "process_folder",
"signature": "def process_folder(self)"
},
{
"docstring": "Load the face names into dictionary",
"name": "load_items",
"signature": "def load_items(self)"
},
{
"docstring": "... | 3 | null | Implement the Python class `Faces` described below.
Class description:
Object to hold the faces that are to be swapped out
Method signatures and docstrings:
- def process_folder(self): Iterate through the faces dir pulling out various information
- def load_items(self): Load the face names into dictionary
- def sorte... | Implement the Python class `Faces` described below.
Class description:
Object to hold the faces that are to be swapped out
Method signatures and docstrings:
- def process_folder(self): Iterate through the faces dir pulling out various information
- def load_items(self): Load the face names into dictionary
- def sorte... | e507f94d4f5d74c36e41c386c6fb14bb745a4885 | <|skeleton|>
class Faces:
"""Object to hold the faces that are to be swapped out"""
def process_folder(self):
"""Iterate through the faces dir pulling out various information"""
<|body_0|>
def load_items(self):
"""Load the face names into dictionary"""
<|body_1|>
def s... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Faces:
"""Object to hold the faces that are to be swapped out"""
def process_folder(self):
"""Iterate through the faces dir pulling out various information"""
logger.info('Loading file list from %s', self.folder)
for face in tqdm(os.listdir(self.folder), desc='Reading Face Hashes'... | the_stack_v2_python_sparse | tools/lib_alignments/media.py | oveis/DeepVideoFaceSwap | train | 6 |
c4fbdd0162103f77d9bf954bbd8a146f64f0726c | [
"self.client = client\nself.time_zone = time_zone\nself.data_signals = data_signals",
"if dictionary is None:\n return None\nclient = greenbyteapi.models.client_configuration.ClientConfiguration.from_dictionary(dictionary.get('client')) if dictionary.get('client') else None\ntime_zone = greenbyteapi.models.tim... | <|body_start_0|>
self.client = client
self.time_zone = time_zone
self.data_signals = data_signals
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
client = greenbyteapi.models.client_configuration.ClientConfiguration.from_dictionary(dictionary.get('... | Implementation of the 'ConfigurationItem' model. Your configuration data. Attributes: client (ClientConfiguration): General configuration data. time_zone (TimeZoneConfiguration): The time zone configuration. data_signals (DataSignalConfiguration): Your data signal configuration. These only apply to wind devices. | ConfigurationItem | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ConfigurationItem:
"""Implementation of the 'ConfigurationItem' model. Your configuration data. Attributes: client (ClientConfiguration): General configuration data. time_zone (TimeZoneConfiguration): The time zone configuration. data_signals (DataSignalConfiguration): Your data signal configurat... | stack_v2_sparse_classes_36k_train_026980 | 2,443 | permissive | [
{
"docstring": "Constructor for the ConfigurationItem class",
"name": "__init__",
"signature": "def __init__(self, client=None, time_zone=None, data_signals=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary representation of... | 2 | stack_v2_sparse_classes_30k_train_017003 | Implement the Python class `ConfigurationItem` described below.
Class description:
Implementation of the 'ConfigurationItem' model. Your configuration data. Attributes: client (ClientConfiguration): General configuration data. time_zone (TimeZoneConfiguration): The time zone configuration. data_signals (DataSignalConf... | Implement the Python class `ConfigurationItem` described below.
Class description:
Implementation of the 'ConfigurationItem' model. Your configuration data. Attributes: client (ClientConfiguration): General configuration data. time_zone (TimeZoneConfiguration): The time zone configuration. data_signals (DataSignalConf... | 6835ee1f6a667b5c7827c5248391081f06b75513 | <|skeleton|>
class ConfigurationItem:
"""Implementation of the 'ConfigurationItem' model. Your configuration data. Attributes: client (ClientConfiguration): General configuration data. time_zone (TimeZoneConfiguration): The time zone configuration. data_signals (DataSignalConfiguration): Your data signal configurat... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ConfigurationItem:
"""Implementation of the 'ConfigurationItem' model. Your configuration data. Attributes: client (ClientConfiguration): General configuration data. time_zone (TimeZoneConfiguration): The time zone configuration. data_signals (DataSignalConfiguration): Your data signal configuration. These on... | the_stack_v2_python_sparse | greenbyteapi/models/configuration_item.py | charlie9578/greenbyte-api-sdk | train | 0 |
a132ab0038f7687de592c9afcaed043005b828d9 | [
"self.url_or_view = url_or_view\nself.args = args\nself.kwargs = kwargs",
"if 'request' not in context:\n return ''\nrequest = context['request']\nurl_or_view = Variable(self.url_or_view).resolve(context)\ntry:\n urlconf = getattr(request, 'urlconf', settings.ROOT_URLCONF)\n resolver = urls.RegexURLResol... | <|body_start_0|>
self.url_or_view = url_or_view
self.args = args
self.kwargs = kwargs
<|end_body_0|>
<|body_start_1|>
if 'request' not in context:
return ''
request = context['request']
url_or_view = Variable(self.url_or_view).resolve(context)
try:
... | Insérer le contenu d'une vue Django ou d'une URL dans un template Insertion par nom d'url (paramètre name) ou par chemin complet de fonction La vue peut renvoyer une HttpReponse ou une chaîne de caractères. (Code basé sur un snippet de James G. Pearce, 17 juin 2009) | ViewNode | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ViewNode:
"""Insérer le contenu d'une vue Django ou d'une URL dans un template Insertion par nom d'url (paramètre name) ou par chemin complet de fonction La vue peut renvoyer une HttpReponse ou une chaîne de caractères. (Code basé sur un snippet de James G. Pearce, 17 juin 2009)"""
def __ini... | stack_v2_sparse_classes_36k_train_026981 | 5,870 | no_license | [
{
"docstring": "Initialiser le nœud",
"name": "__init__",
"signature": "def __init__(self, url_or_view, args, kwargs)"
},
{
"docstring": "Effectuer le rendu du nœud",
"name": "render",
"signature": "def render(self, context)"
}
] | 2 | stack_v2_sparse_classes_30k_train_016337 | Implement the Python class `ViewNode` described below.
Class description:
Insérer le contenu d'une vue Django ou d'une URL dans un template Insertion par nom d'url (paramètre name) ou par chemin complet de fonction La vue peut renvoyer une HttpReponse ou une chaîne de caractères. (Code basé sur un snippet de James G. ... | Implement the Python class `ViewNode` described below.
Class description:
Insérer le contenu d'une vue Django ou d'une URL dans un template Insertion par nom d'url (paramètre name) ou par chemin complet de fonction La vue peut renvoyer une HttpReponse ou une chaîne de caractères. (Code basé sur un snippet de James G. ... | 8cef6f6e89c1990e2b25f83e54e0c3481d83b6d7 | <|skeleton|>
class ViewNode:
"""Insérer le contenu d'une vue Django ou d'une URL dans un template Insertion par nom d'url (paramètre name) ou par chemin complet de fonction La vue peut renvoyer une HttpReponse ou une chaîne de caractères. (Code basé sur un snippet de James G. Pearce, 17 juin 2009)"""
def __ini... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ViewNode:
"""Insérer le contenu d'une vue Django ou d'une URL dans un template Insertion par nom d'url (paramètre name) ou par chemin complet de fonction La vue peut renvoyer une HttpReponse ou une chaîne de caractères. (Code basé sur un snippet de James G. Pearce, 17 juin 2009)"""
def __init__(self, url... | the_stack_v2_python_sparse | scoop/core/templatetags/panels.py | artscoop/scoop | train | 0 |
7aeef5c303619919104561504d66054091c7dc36 | [
"batch_next_state = exp_batch['next_state']\nif self.recurrent:\n target_next_qout, _ = pack_and_forward(self.target_model, batch_next_state, exp_batch['next_recurrent_state'])\nelse:\n target_next_qout = self.target_model(batch_next_state)\nbatch_rewards = exp_batch['reward']\nbatch_terminal = exp_batch['is_... | <|body_start_0|>
batch_next_state = exp_batch['next_state']
if self.recurrent:
target_next_qout, _ = pack_and_forward(self.target_model, batch_next_state, exp_batch['next_recurrent_state'])
else:
target_next_qout = self.target_model(batch_next_state)
batch_rewards... | Categorical DQN. See https://arxiv.org/abs/1707.06887. Arguments are the same as those of DQN except q_function must return DistributionalDiscreteActionValue and clip_delta is ignored. | CategoricalDQN | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CategoricalDQN:
"""Categorical DQN. See https://arxiv.org/abs/1707.06887. Arguments are the same as those of DQN except q_function must return DistributionalDiscreteActionValue and clip_delta is ignored."""
def _compute_target_values(self, exp_batch):
"""Compute a batch of target ret... | stack_v2_sparse_classes_36k_train_026982 | 7,017 | permissive | [
{
"docstring": "Compute a batch of target return distributions.",
"name": "_compute_target_values",
"signature": "def _compute_target_values(self, exp_batch)"
},
{
"docstring": "Compute a batch of predicted/target return distributions.",
"name": "_compute_y_and_t",
"signature": "def _com... | 3 | null | Implement the Python class `CategoricalDQN` described below.
Class description:
Categorical DQN. See https://arxiv.org/abs/1707.06887. Arguments are the same as those of DQN except q_function must return DistributionalDiscreteActionValue and clip_delta is ignored.
Method signatures and docstrings:
- def _compute_targ... | Implement the Python class `CategoricalDQN` described below.
Class description:
Categorical DQN. See https://arxiv.org/abs/1707.06887. Arguments are the same as those of DQN except q_function must return DistributionalDiscreteActionValue and clip_delta is ignored.
Method signatures and docstrings:
- def _compute_targ... | b29533b77c82f88fbc074714274ee8aa63dc270f | <|skeleton|>
class CategoricalDQN:
"""Categorical DQN. See https://arxiv.org/abs/1707.06887. Arguments are the same as those of DQN except q_function must return DistributionalDiscreteActionValue and clip_delta is ignored."""
def _compute_target_values(self, exp_batch):
"""Compute a batch of target ret... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CategoricalDQN:
"""Categorical DQN. See https://arxiv.org/abs/1707.06887. Arguments are the same as those of DQN except q_function must return DistributionalDiscreteActionValue and clip_delta is ignored."""
def _compute_target_values(self, exp_batch):
"""Compute a batch of target return distribut... | the_stack_v2_python_sparse | pfrl/agents/categorical_dqn.py | pfnet/pfrl | train | 1,115 |
ed17eee9835c738862da5e5f5d92b3a3fe75340d | [
"self.title = title\nself.content = content\nself.tags = tags\nself.categories = categories\nself.attachment = attachment",
"self.title = None\nself.content = None\nself.tags = []\nself.categories = []\nself.attachment = None"
] | <|body_start_0|>
self.title = title
self.content = content
self.tags = tags
self.categories = categories
self.attachment = attachment
<|end_body_0|>
<|body_start_1|>
self.title = None
self.content = None
self.tags = []
self.categories = []
... | class for a blog entry | BlogEntry | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BlogEntry:
"""class for a blog entry"""
def __init__(self, title=None, content=None, tags=[], categories=[], attachment=None):
"""initiate a blog entry object"""
<|body_0|>
def clear(self):
"""clear the title and content of the blog entry"""
<|body_1|>
<... | stack_v2_sparse_classes_36k_train_026983 | 3,687 | no_license | [
{
"docstring": "initiate a blog entry object",
"name": "__init__",
"signature": "def __init__(self, title=None, content=None, tags=[], categories=[], attachment=None)"
},
{
"docstring": "clear the title and content of the blog entry",
"name": "clear",
"signature": "def clear(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_016684 | Implement the Python class `BlogEntry` described below.
Class description:
class for a blog entry
Method signatures and docstrings:
- def __init__(self, title=None, content=None, tags=[], categories=[], attachment=None): initiate a blog entry object
- def clear(self): clear the title and content of the blog entry | Implement the Python class `BlogEntry` described below.
Class description:
class for a blog entry
Method signatures and docstrings:
- def __init__(self, title=None, content=None, tags=[], categories=[], attachment=None): initiate a blog entry object
- def clear(self): clear the title and content of the blog entry
<|... | f98c6388bf5731dda7b8e1881f1cc533e6aa83ef | <|skeleton|>
class BlogEntry:
"""class for a blog entry"""
def __init__(self, title=None, content=None, tags=[], categories=[], attachment=None):
"""initiate a blog entry object"""
<|body_0|>
def clear(self):
"""clear the title and content of the blog entry"""
<|body_1|>
<... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BlogEntry:
"""class for a blog entry"""
def __init__(self, title=None, content=None, tags=[], categories=[], attachment=None):
"""initiate a blog entry object"""
self.title = title
self.content = content
self.tags = tags
self.categories = categories
self.at... | the_stack_v2_python_sparse | tags/release-1.0.0/pcd/modules/tumblr/tumblr.py | marcelotoledo/PostCanal | train | 0 |
0a1fbcea8b2d35f7a5a97cd8e8ea24474eda85ec | [
"self.app_id = app_id\nself.input_params = input_params\nself.mr_input = mr_input\nself.mr_output = mr_output",
"if dictionary is None:\n return None\napp_id = dictionary.get('appId')\ninput_params = None\nif dictionary.get('inputParams') != None:\n input_params = list()\n for structure in dictionary.get... | <|body_start_0|>
self.app_id = app_id
self.input_params = input_params
self.mr_input = mr_input
self.mr_output = mr_output
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
app_id = dictionary.get('appId')
input_params = None
... | Implementation of the 'RunMapReduceParams' model. RunMapReduceParams specifies the input params to run a map reduce instance. Attributes: app_id (long|int): ApplicationId is the Id of the map reduce application to run. input_params (list of MapReduceInstance_InputParam): InputParams specifies optional list of key=value... | RunMapReduceParams | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RunMapReduceParams:
"""Implementation of the 'RunMapReduceParams' model. RunMapReduceParams specifies the input params to run a map reduce instance. Attributes: app_id (long|int): ApplicationId is the Id of the map reduce application to run. input_params (list of MapReduceInstance_InputParam): In... | stack_v2_sparse_classes_36k_train_026984 | 3,036 | permissive | [
{
"docstring": "Constructor for the RunMapReduceParams class",
"name": "__init__",
"signature": "def __init__(self, app_id=None, input_params=None, mr_input=None, mr_output=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary r... | 2 | null | Implement the Python class `RunMapReduceParams` described below.
Class description:
Implementation of the 'RunMapReduceParams' model. RunMapReduceParams specifies the input params to run a map reduce instance. Attributes: app_id (long|int): ApplicationId is the Id of the map reduce application to run. input_params (li... | Implement the Python class `RunMapReduceParams` described below.
Class description:
Implementation of the 'RunMapReduceParams' model. RunMapReduceParams specifies the input params to run a map reduce instance. Attributes: app_id (long|int): ApplicationId is the Id of the map reduce application to run. input_params (li... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class RunMapReduceParams:
"""Implementation of the 'RunMapReduceParams' model. RunMapReduceParams specifies the input params to run a map reduce instance. Attributes: app_id (long|int): ApplicationId is the Id of the map reduce application to run. input_params (list of MapReduceInstance_InputParam): In... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RunMapReduceParams:
"""Implementation of the 'RunMapReduceParams' model. RunMapReduceParams specifies the input params to run a map reduce instance. Attributes: app_id (long|int): ApplicationId is the Id of the map reduce application to run. input_params (list of MapReduceInstance_InputParam): InputParams spe... | the_stack_v2_python_sparse | cohesity_management_sdk/models/run_map_reduce_params.py | cohesity/management-sdk-python | train | 24 |
e9c4f08fb41979f14ea0af5a35afa726eb233112 | [
"self.game = game\nself.aliostad = Aliostad(name, randomBoostFactor=None)\nself.am_i_second_player = am_i_second_player\nself.quantization_proportion = quantization_proportion",
"if self.am_i_second_player:\n board = board * -1\nhex_board = hydrate_board_from_model(board, self.game.game.radius, self.game.rect_... | <|body_start_0|>
self.game = game
self.aliostad = Aliostad(name, randomBoostFactor=None)
self.am_i_second_player = am_i_second_player
self.quantization_proportion = quantization_proportion
<|end_body_0|>
<|body_start_1|>
if self.am_i_second_player:
board = board * -1... | AliostadPlayer | [
"MIT",
"LicenseRef-scancode-proprietary-license"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AliostadPlayer:
def __init__(self, game, name, am_i_second_player=False, quantization_proportion=0.7):
""":type game: HexagonGame :type name: str"""
<|body_0|>
def play(self, board):
""":type board: ndarray :return:"""
<|body_1|>
<|end_skeleton|>
<|body_sta... | stack_v2_sparse_classes_36k_train_026985 | 28,513 | permissive | [
{
"docstring": ":type game: HexagonGame :type name: str",
"name": "__init__",
"signature": "def __init__(self, game, name, am_i_second_player=False, quantization_proportion=0.7)"
},
{
"docstring": ":type board: ndarray :return:",
"name": "play",
"signature": "def play(self, board)"
}
] | 2 | stack_v2_sparse_classes_30k_train_021137 | Implement the Python class `AliostadPlayer` described below.
Class description:
Implement the AliostadPlayer class.
Method signatures and docstrings:
- def __init__(self, game, name, am_i_second_player=False, quantization_proportion=0.7): :type game: HexagonGame :type name: str
- def play(self, board): :type board: n... | Implement the Python class `AliostadPlayer` described below.
Class description:
Implement the AliostadPlayer class.
Method signatures and docstrings:
- def __init__(self, game, name, am_i_second_player=False, quantization_proportion=0.7): :type game: HexagonGame :type name: str
- def play(self, board): :type board: n... | cd4180bda26f92c0bde11a08aa13c825cd151a10 | <|skeleton|>
class AliostadPlayer:
def __init__(self, game, name, am_i_second_player=False, quantization_proportion=0.7):
""":type game: HexagonGame :type name: str"""
<|body_0|>
def play(self, board):
""":type board: ndarray :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AliostadPlayer:
def __init__(self, game, name, am_i_second_player=False, quantization_proportion=0.7):
""":type game: HexagonGame :type name: str"""
self.game = game
self.aliostad = Aliostad(name, randomBoostFactor=None)
self.am_i_second_player = am_i_second_player
self... | the_stack_v2_python_sparse | hexagon_alphazero.py | aliostad/hexagon-rl | train | 7 | |
5cd2f3e4a43850a1121958ff2fccb8d797c3e004 | [
"try:\n record_id = int(uid)\nexcept ValueError as exc:\n raise cherrypy.HTTPError(400, 'Invalid uid') from exc\ncherrypy.engine.publish('registry:remove:id', record_id)\ncherrypy.response.status = 204",
"try:\n record_id = int(uid or 0)\nexcept ValueError as exc:\n raise cherrypy.HTTPError(400, 'Inva... | <|body_start_0|>
try:
record_id = int(uid)
except ValueError as exc:
raise cherrypy.HTTPError(400, 'Invalid uid') from exc
cherrypy.engine.publish('registry:remove:id', record_id)
cherrypy.response.status = 204
<|end_body_0|>
<|body_start_1|>
try:
... | Controller | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Controller:
def DELETE(uid: str) -> None:
"""Remove an existing entry by its id."""
<|body_0|>
def GET(self, uid: str='', subresource: str='', **kwargs: str) -> bytes:
"""Dispatch to a subhandler based on the URL path."""
<|body_1|>
def POST(uid: str='',... | stack_v2_sparse_classes_36k_train_026986 | 5,858 | no_license | [
{
"docstring": "Remove an existing entry by its id.",
"name": "DELETE",
"signature": "def DELETE(uid: str) -> None"
},
{
"docstring": "Dispatch to a subhandler based on the URL path.",
"name": "GET",
"signature": "def GET(self, uid: str='', subresource: str='', **kwargs: str) -> bytes"
... | 6 | null | Implement the Python class `Controller` described below.
Class description:
Implement the Controller class.
Method signatures and docstrings:
- def DELETE(uid: str) -> None: Remove an existing entry by its id.
- def GET(self, uid: str='', subresource: str='', **kwargs: str) -> bytes: Dispatch to a subhandler based on... | Implement the Python class `Controller` described below.
Class description:
Implement the Controller class.
Method signatures and docstrings:
- def DELETE(uid: str) -> None: Remove an existing entry by its id.
- def GET(self, uid: str='', subresource: str='', **kwargs: str) -> bytes: Dispatch to a subhandler based on... | 7129415303b94d5d10b2c29ec432f0c7d41cc651 | <|skeleton|>
class Controller:
def DELETE(uid: str) -> None:
"""Remove an existing entry by its id."""
<|body_0|>
def GET(self, uid: str='', subresource: str='', **kwargs: str) -> bytes:
"""Dispatch to a subhandler based on the URL path."""
<|body_1|>
def POST(uid: str='',... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Controller:
def DELETE(uid: str) -> None:
"""Remove an existing entry by its id."""
try:
record_id = int(uid)
except ValueError as exc:
raise cherrypy.HTTPError(400, 'Invalid uid') from exc
cherrypy.engine.publish('registry:remove:id', record_id)
... | the_stack_v2_python_sparse | apps/registry/main.py | lovett/medley | train | 6 | |
f8581e7363d1b1eec234cf2d4924e87947d577c4 | [
"form = super().scaffold_form()\nform.division = Select2Field('Division', coerce=int, choices=[(1, 'Upper'), (2, 'Lower')])\nreturn form",
"form_class = super().scaffold_list_form(widget=widget, validators=validators)\nform_class.division = Select2Field('Division', coerce=int, choices=[(1, 'Upper'), (2, 'Lower')]... | <|body_start_0|>
form = super().scaffold_form()
form.division = Select2Field('Division', coerce=int, choices=[(1, 'Upper'), (2, 'Lower')])
return form
<|end_body_0|>
<|body_start_1|>
form_class = super().scaffold_list_form(widget=widget, validators=validators)
form_class.divisio... | Admin view used to view and edit Teams. | TeamManageView | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TeamManageView:
"""Admin view used to view and edit Teams."""
def scaffold_form(self):
"""Replaces Division field with a Select field in the edit form."""
<|body_0|>
def scaffold_list_form(self, widget=None, validators=None):
"""Replaces Division field with a Sel... | stack_v2_sparse_classes_36k_train_026987 | 4,782 | permissive | [
{
"docstring": "Replaces Division field with a Select field in the edit form.",
"name": "scaffold_form",
"signature": "def scaffold_form(self)"
},
{
"docstring": "Replaces Division field with a Select field in the editable column.",
"name": "scaffold_list_form",
"signature": "def scaffol... | 2 | stack_v2_sparse_classes_30k_train_012717 | Implement the Python class `TeamManageView` described below.
Class description:
Admin view used to view and edit Teams.
Method signatures and docstrings:
- def scaffold_form(self): Replaces Division field with a Select field in the edit form.
- def scaffold_list_form(self, widget=None, validators=None): Replaces Divi... | Implement the Python class `TeamManageView` described below.
Class description:
Admin view used to view and edit Teams.
Method signatures and docstrings:
- def scaffold_form(self): Replaces Division field with a Select field in the edit form.
- def scaffold_list_form(self, widget=None, validators=None): Replaces Divi... | b1ca73fe6ac38b3f6e8e0b965a8cb24cd4fd3f73 | <|skeleton|>
class TeamManageView:
"""Admin view used to view and edit Teams."""
def scaffold_form(self):
"""Replaces Division field with a Select field in the edit form."""
<|body_0|>
def scaffold_list_form(self, widget=None, validators=None):
"""Replaces Division field with a Sel... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TeamManageView:
"""Admin view used to view and edit Teams."""
def scaffold_form(self):
"""Replaces Division field with a Select field in the edit form."""
form = super().scaffold_form()
form.division = Select2Field('Division', coerce=int, choices=[(1, 'Upper'), (2, 'Lower')])
... | the_stack_v2_python_sparse | app/views/admin/manage.py | FSU-ACM/Contest-Server | train | 8 |
c30b39416dac2595e237ce80723bff435462093a | [
"super().__init__(url)\nself._endpoint = SPARQLWrapper(url)\nself._endpoint.setReturnFormat(JSON)",
"self._endpoint.setQuery(sparql)\nresponse = self._endpoint.query()\nreturn self.convert(response)",
"converted_response = []\nif response:\n response = response.convert()\n var = response['head']['vars'][0... | <|body_start_0|>
super().__init__(url)
self._endpoint = SPARQLWrapper(url)
self._endpoint.setReturnFormat(JSON)
<|end_body_0|>
<|body_start_1|>
self._endpoint.setQuery(sparql)
response = self._endpoint.query()
return self.convert(response)
<|end_body_1|>
<|body_start_2|... | Class which issues SPARQL queries to an endpoint | SPARQLEndpoint | [
"Apache-2.0",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SPARQLEndpoint:
"""Class which issues SPARQL queries to an endpoint"""
def __init__(self, url):
""":param url: The SPARQL endpoint :url: str"""
<|body_0|>
def query(self, ontology, sparql, err_msg):
"""Issues SPARQL query"""
<|body_1|>
def convert(se... | stack_v2_sparse_classes_36k_train_026988 | 16,768 | permissive | [
{
"docstring": ":param url: The SPARQL endpoint :url: str",
"name": "__init__",
"signature": "def __init__(self, url)"
},
{
"docstring": "Issues SPARQL query",
"name": "query",
"signature": "def query(self, ontology, sparql, err_msg)"
},
{
"docstring": "Converts standard SPARQL q... | 3 | null | Implement the Python class `SPARQLEndpoint` described below.
Class description:
Class which issues SPARQL queries to an endpoint
Method signatures and docstrings:
- def __init__(self, url): :param url: The SPARQL endpoint :url: str
- def query(self, ontology, sparql, err_msg): Issues SPARQL query
- def convert(self, ... | Implement the Python class `SPARQLEndpoint` described below.
Class description:
Class which issues SPARQL queries to an endpoint
Method signatures and docstrings:
- def __init__(self, url): :param url: The SPARQL endpoint :url: str
- def query(self, ontology, sparql, err_msg): Issues SPARQL query
- def convert(self, ... | 84f6d3fced521849657d21ae4cb9681f5897b957 | <|skeleton|>
class SPARQLEndpoint:
"""Class which issues SPARQL queries to an endpoint"""
def __init__(self, url):
""":param url: The SPARQL endpoint :url: str"""
<|body_0|>
def query(self, ontology, sparql, err_msg):
"""Issues SPARQL query"""
<|body_1|>
def convert(se... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SPARQLEndpoint:
"""Class which issues SPARQL queries to an endpoint"""
def __init__(self, url):
""":param url: The SPARQL endpoint :url: str"""
super().__init__(url)
self._endpoint = SPARQLWrapper(url)
self._endpoint.setReturnFormat(JSON)
def query(self, ontology, spa... | the_stack_v2_python_sparse | venv/lib/python3.9/site-packages/tyto/endpoint/endpoint.py | ClassWizard/PodLockParser | train | 2 |
e62e1cad1a77f3ca78c76ae643354ca8ee22cc12 | [
"if self.bad_guesses == 6:\n return 'lost'\nelif '_' not in self.reveal_word:\n return 'won'\nelse:\n return 'active'",
"as_dict = {k: v for k, v in self.__dict__.items() if not k.startswith('_')}\nas_dict['result'] = self._result()\nas_dict['start_time'] = date_to_ordinal(as_dict.get('start_time'))\nas_... | <|body_start_0|>
if self.bad_guesses == 6:
return 'lost'
elif '_' not in self.reveal_word:
return 'won'
else:
return 'active'
<|end_body_0|>
<|body_start_1|>
as_dict = {k: v for k, v in self.__dict__.items() if not k.startswith('_')}
as_dict['... | Table ``games`` with fields: * ``game_id`` - UUID primary key of length 38 * ``player`` - Player key from ``users`` table, length 38 * ``usage_id`` - Integer index usage in ``usages`` table * ``guessed`` - A string of the letters guessed so far * ``reveal_word`` - Secret word with guessed letters filled in * ``bad_gues... | Game | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Game:
"""Table ``games`` with fields: * ``game_id`` - UUID primary key of length 38 * ``player`` - Player key from ``users`` table, length 38 * ``usage_id`` - Integer index usage in ``usages`` table * ``guessed`` - A string of the letters guessed so far * ``reveal_word`` - Secret word with guesse... | stack_v2_sparse_classes_36k_train_026989 | 7,142 | no_license | [
{
"docstring": "Return the result of the game: lost, won, or active",
"name": "_result",
"signature": "def _result(self)"
},
{
"docstring": "Convert the game into a dictionary suitable for JSON serialization Special attention is paid to DateTime fields using the date_to_ordinals function.",
... | 3 | stack_v2_sparse_classes_30k_train_005486 | Implement the Python class `Game` described below.
Class description:
Table ``games`` with fields: * ``game_id`` - UUID primary key of length 38 * ``player`` - Player key from ``users`` table, length 38 * ``usage_id`` - Integer index usage in ``usages`` table * ``guessed`` - A string of the letters guessed so far * ``... | Implement the Python class `Game` described below.
Class description:
Table ``games`` with fields: * ``game_id`` - UUID primary key of length 38 * ``player`` - Player key from ``users`` table, length 38 * ``usage_id`` - Integer index usage in ``usages`` table * ``guessed`` - A string of the letters guessed so far * ``... | 55871c1dd2ae9b79d82a21dd2b73746c77d0bc41 | <|skeleton|>
class Game:
"""Table ``games`` with fields: * ``game_id`` - UUID primary key of length 38 * ``player`` - Player key from ``users`` table, length 38 * ``usage_id`` - Integer index usage in ``usages`` table * ``guessed`` - A string of the letters guessed so far * ``reveal_word`` - Secret word with guesse... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Game:
"""Table ``games`` with fields: * ``game_id`` - UUID primary key of length 38 * ``player`` - Player key from ``users`` table, length 38 * ``usage_id`` - Integer index usage in ``usages`` table * ``guessed`` - A string of the letters guessed so far * ``reveal_word`` - Secret word with guessed letters fil... | the_stack_v2_python_sparse | server/langman_orm.py | socratecha/frapbook-v1.0-langman | train | 2 |
82294e2bf3d64b415b2a22753bcec6c31dbadbd3 | [
"super(FGVCSSLRotation, self).__init__()\nself.model_function = get_object_from_path(config.cfg['model']['model_function_path'])\nself.pretrained = config.cfg['model']['pretrained']\nself.num_classes_classification = config.cfg['model']['classes_count']\nself.num_classes_rot = config.cfg['model']['rotation_classes_... | <|body_start_0|>
super(FGVCSSLRotation, self).__init__()
self.model_function = get_object_from_path(config.cfg['model']['model_function_path'])
self.pretrained = config.cfg['model']['pretrained']
self.num_classes_classification = config.cfg['model']['classes_count']
self.num_clas... | The class adds the rotation as an auxiliary task to the FGVC model from (http://arxiv.org/abs/1912.06842). | FGVCSSLRotation | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FGVCSSLRotation:
"""The class adds the rotation as an auxiliary task to the FGVC model from (http://arxiv.org/abs/1912.06842)."""
def __init__(self, config):
"""Constructor, The function parse the config and initialize the layers of the corresponding model. :param config: Configurati... | stack_v2_sparse_classes_36k_train_026990 | 2,967 | permissive | [
{
"docstring": "Constructor, The function parse the config and initialize the layers of the corresponding model. :param config: Configuration class object",
"name": "__init__",
"signature": "def __init__(self, config)"
},
{
"docstring": "The function implements the forward pass of the model. :pa... | 2 | stack_v2_sparse_classes_30k_train_002125 | Implement the Python class `FGVCSSLRotation` described below.
Class description:
The class adds the rotation as an auxiliary task to the FGVC model from (http://arxiv.org/abs/1912.06842).
Method signatures and docstrings:
- def __init__(self, config): Constructor, The function parse the config and initialize the laye... | Implement the Python class `FGVCSSLRotation` described below.
Class description:
The class adds the rotation as an auxiliary task to the FGVC model from (http://arxiv.org/abs/1912.06842).
Method signatures and docstrings:
- def __init__(self, config): Constructor, The function parse the config and initialize the laye... | 9a4bf0a112b818caca8794868a903dc736839a43 | <|skeleton|>
class FGVCSSLRotation:
"""The class adds the rotation as an auxiliary task to the FGVC model from (http://arxiv.org/abs/1912.06842)."""
def __init__(self, config):
"""Constructor, The function parse the config and initialize the layers of the corresponding model. :param config: Configurati... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FGVCSSLRotation:
"""The class adds the rotation as an auxiliary task to the FGVC model from (http://arxiv.org/abs/1912.06842)."""
def __init__(self, config):
"""Constructor, The function parse the config and initialize the layers of the corresponding model. :param config: Configuration class obje... | the_stack_v2_python_sparse | model/fgvc_ssl_rotation.py | Niousha12/ssl_for_fgvc | train | 0 |
01fc727ce3a3df69c8fed9a881f02ea833319c7f | [
"x, y, theta = start_pose\nif curvature == 0.0:\n x += length * cos(theta)\n y += length * sin(theta)\n return (x, y, theta)\nelse:\n tx = cos(theta)\n ty = sin(theta)\n radius = 1.0 / curvature\n xc = x - radius * ty\n yc = y + radius * tx\n angle = length / radius\n cosa = cos(angle)... | <|body_start_0|>
x, y, theta = start_pose
if curvature == 0.0:
x += length * cos(theta)
y += length * sin(theta)
return (x, y, theta)
else:
tx = cos(theta)
ty = sin(theta)
radius = 1.0 / curvature
xc = x - radius... | CurveSegment | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CurveSegment:
def end_pose(start_pose, curvature, length):
"""Returns end pose, given start pose, curvature and length."""
<|body_0|>
def segment_points(start_pose, curvature, length, delta_length):
"""Return points of segment, at delta_length intervals."""
<... | stack_v2_sparse_classes_36k_train_026991 | 1,212 | permissive | [
{
"docstring": "Returns end pose, given start pose, curvature and length.",
"name": "end_pose",
"signature": "def end_pose(start_pose, curvature, length)"
},
{
"docstring": "Return points of segment, at delta_length intervals.",
"name": "segment_points",
"signature": "def segment_points(... | 2 | stack_v2_sparse_classes_30k_train_020148 | Implement the Python class `CurveSegment` described below.
Class description:
Implement the CurveSegment class.
Method signatures and docstrings:
- def end_pose(start_pose, curvature, length): Returns end pose, given start pose, curvature and length.
- def segment_points(start_pose, curvature, length, delta_length): ... | Implement the Python class `CurveSegment` described below.
Class description:
Implement the CurveSegment class.
Method signatures and docstrings:
- def end_pose(start_pose, curvature, length): Returns end pose, given start pose, curvature and length.
- def segment_points(start_pose, curvature, length, delta_length): ... | 3d7d3c06cc577445a9b5b423f2907f5efa830a0f | <|skeleton|>
class CurveSegment:
def end_pose(start_pose, curvature, length):
"""Returns end pose, given start pose, curvature and length."""
<|body_0|>
def segment_points(start_pose, curvature, length, delta_length):
"""Return points of segment, at delta_length intervals."""
<... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CurveSegment:
def end_pose(start_pose, curvature, length):
"""Returns end pose, given start pose, curvature and length."""
x, y, theta = start_pose
if curvature == 0.0:
x += length * cos(theta)
y += length * sin(theta)
return (x, y, theta)
el... | the_stack_v2_python_sparse | planning_python/utils/CurveSegment.py | yonetaniryo/planning_python | train | 0 | |
f89fbcf1de238dca6961797c28895316b636e362 | [
"serv1 = Service_Type.objects.create(name='things', pretty_name='Things', description='stuff')\nserv2 = Service_Type.objects.create(name='morethings', pretty_name='More Things', description='stuff')\nloc = Region.objects.create(name='place')\nloc.set_new_service(serv1, start_rate=0.5)\nloc.set_new_service(serv2, st... | <|body_start_0|>
serv1 = Service_Type.objects.create(name='things', pretty_name='Things', description='stuff')
serv2 = Service_Type.objects.create(name='morethings', pretty_name='More Things', description='stuff')
loc = Region.objects.create(name='place')
loc.set_new_service(serv1, start... | RegionFunctionTests | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RegionFunctionTests:
def test_set_new_service_1(self):
"""This checks to make sure that you can set new services."""
<|body_0|>
def test_set_new_service_2(self):
"""Checks to make sure that the service added and the rate given, to it are the same as the ones returned... | stack_v2_sparse_classes_36k_train_026992 | 10,508 | no_license | [
{
"docstring": "This checks to make sure that you can set new services.",
"name": "test_set_new_service_1",
"signature": "def test_set_new_service_1(self)"
},
{
"docstring": "Checks to make sure that the service added and the rate given, to it are the same as the ones returned.",
"name": "te... | 5 | stack_v2_sparse_classes_30k_val_000052 | Implement the Python class `RegionFunctionTests` described below.
Class description:
Implement the RegionFunctionTests class.
Method signatures and docstrings:
- def test_set_new_service_1(self): This checks to make sure that you can set new services.
- def test_set_new_service_2(self): Checks to make sure that the s... | Implement the Python class `RegionFunctionTests` described below.
Class description:
Implement the RegionFunctionTests class.
Method signatures and docstrings:
- def test_set_new_service_1(self): This checks to make sure that you can set new services.
- def test_set_new_service_2(self): Checks to make sure that the s... | d6b288e632ccfcd7c8e88ff1e5f496fb8e525710 | <|skeleton|>
class RegionFunctionTests:
def test_set_new_service_1(self):
"""This checks to make sure that you can set new services."""
<|body_0|>
def test_set_new_service_2(self):
"""Checks to make sure that the service added and the rate given, to it are the same as the ones returned... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RegionFunctionTests:
def test_set_new_service_1(self):
"""This checks to make sure that you can set new services."""
serv1 = Service_Type.objects.create(name='things', pretty_name='Things', description='stuff')
serv2 = Service_Type.objects.create(name='morethings', pretty_name='More Th... | the_stack_v2_python_sparse | clerk-vagrant-test/Clerk/clerk/tests.py | unexceptable/clerk | train | 0 | |
e64a288b62eef565085dc358921a209b1fd4eb0e | [
"assert isinstance(type, Type), 'Invalid object type %s' % type\nassert value is not None, 'Provide an object value'\nif type.isOf(str):\n return value\nif type.isOf(int) or type.isOf(float):\n return str(value)\nif type.isOf(bool):\n return 'true' if value is True else 'false'\nif type.isOf(datetime):\n ... | <|body_start_0|>
assert isinstance(type, Type), 'Invalid object type %s' % type
assert value is not None, 'Provide an object value'
if type.isOf(str):
return value
if type.isOf(int) or type.isOf(float):
return str(value)
if type.isOf(bool):
ret... | Provides the conversion of primitive types to strings in vice versa. The converter provides basic conversion, please extend for more complex or custom transformation. | Converter | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Converter:
"""Provides the conversion of primitive types to strings in vice versa. The converter provides basic conversion, please extend for more complex or custom transformation."""
def asString(self, value, type):
"""Converts the provided object to a string. First it will detect t... | stack_v2_sparse_classes_36k_train_026993 | 3,289 | no_license | [
{
"docstring": "Converts the provided object to a string. First it will detect the type and based on that it will call the corresponding convert method. @param value: object The value to be converted to string. @param type: Type The type of object to convert the string to. @return: string The string form of the... | 2 | null | Implement the Python class `Converter` described below.
Class description:
Provides the conversion of primitive types to strings in vice versa. The converter provides basic conversion, please extend for more complex or custom transformation.
Method signatures and docstrings:
- def asString(self, value, type): Convert... | Implement the Python class `Converter` described below.
Class description:
Provides the conversion of primitive types to strings in vice versa. The converter provides basic conversion, please extend for more complex or custom transformation.
Method signatures and docstrings:
- def asString(self, value, type): Convert... | e0b3466b34d31548996d57be4a9dac134d904380 | <|skeleton|>
class Converter:
"""Provides the conversion of primitive types to strings in vice versa. The converter provides basic conversion, please extend for more complex or custom transformation."""
def asString(self, value, type):
"""Converts the provided object to a string. First it will detect t... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Converter:
"""Provides the conversion of primitive types to strings in vice versa. The converter provides basic conversion, please extend for more complex or custom transformation."""
def asString(self, value, type):
"""Converts the provided object to a string. First it will detect the type and b... | the_stack_v2_python_sparse | components/ally-core/ally/core/spec/resources.py | cristidomsa/Ally-Py | train | 0 |
6d72ff1841350f80ddd9c95d37ec177d008f0516 | [
"BaseType.__init__(self, cle)\nself.qualite = 1\nself.remplissant = 1\nself.message_boit = 'Vous buvez {}.'.format(self.nom_singulier)\nself.etendre_editeur('a', 'qualité', Entier, self, 'qualite', 1, 10)\nself.etendre_editeur('r', 'remplissant', Entier, self, 'remplissant', 1, 10)\nself.etendre_editeur('i', \"mess... | <|body_start_0|>
BaseType.__init__(self, cle)
self.qualite = 1
self.remplissant = 1
self.message_boit = 'Vous buvez {}.'.format(self.nom_singulier)
self.etendre_editeur('a', 'qualité', Entier, self, 'qualite', 1, 10)
self.etendre_editeur('r', 'remplissant', Entier, self, ... | Type d'objet: potion. | Potion | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Potion:
"""Type d'objet: potion."""
def __init__(self, cle=''):
"""Constructeur de l'objet"""
<|body_0|>
def etendre_script(self):
"""Extension du scripting."""
<|body_1|>
def travailler_enveloppes(self, enveloppes):
"""Travail sur les envelo... | stack_v2_sparse_classes_36k_train_026994 | 4,245 | permissive | [
{
"docstring": "Constructeur de l'objet",
"name": "__init__",
"signature": "def __init__(self, cle='')"
},
{
"docstring": "Extension du scripting.",
"name": "etendre_script",
"signature": "def etendre_script(self)"
},
{
"docstring": "Travail sur les enveloppes",
"name": "trav... | 3 | null | Implement the Python class `Potion` described below.
Class description:
Type d'objet: potion.
Method signatures and docstrings:
- def __init__(self, cle=''): Constructeur de l'objet
- def etendre_script(self): Extension du scripting.
- def travailler_enveloppes(self, enveloppes): Travail sur les enveloppes | Implement the Python class `Potion` described below.
Class description:
Type d'objet: potion.
Method signatures and docstrings:
- def __init__(self, cle=''): Constructeur de l'objet
- def etendre_script(self): Extension du scripting.
- def travailler_enveloppes(self, enveloppes): Travail sur les enveloppes
<|skeleto... | 7e93bff08cdf891352efba587e89c40f3b4a2301 | <|skeleton|>
class Potion:
"""Type d'objet: potion."""
def __init__(self, cle=''):
"""Constructeur de l'objet"""
<|body_0|>
def etendre_script(self):
"""Extension du scripting."""
<|body_1|>
def travailler_enveloppes(self, enveloppes):
"""Travail sur les envelo... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Potion:
"""Type d'objet: potion."""
def __init__(self, cle=''):
"""Constructeur de l'objet"""
BaseType.__init__(self, cle)
self.qualite = 1
self.remplissant = 1
self.message_boit = 'Vous buvez {}.'.format(self.nom_singulier)
self.etendre_editeur('a', 'quali... | the_stack_v2_python_sparse | src/primaires/objet/types/potion.py | vincent-lg/tsunami | train | 5 |
80548ad0f29a73c069f33334b0b1be6e7d71f9e9 | [
"nums = []\nfor i in range(len(matrix)):\n for j in range(len(matrix[i])):\n nums.append(matrix[i][j])\nnums.sort()\nreturn nums[k - 1]",
"nums = [val for row in matrix for val in row]\nheapq.heapify(nums)\nwhile k > 0:\n kth_smallest = heapq.heappop(nums)\n k -= 1\nreturn kth_smallest"
] | <|body_start_0|>
nums = []
for i in range(len(matrix)):
for j in range(len(matrix[i])):
nums.append(matrix[i][j])
nums.sort()
return nums[k - 1]
<|end_body_0|>
<|body_start_1|>
nums = [val for row in matrix for val in row]
heapq.heapify(nums)
... | Runtime: 240 ms, faster than 51.62% of Python3 online submissions for Kth Smallest Element in a Sorted Matrix. Memory Usage: 20.1 MB, less than 6.06% of Python3 online submissions for Kth Smallest Element in a Sorted Matrix. | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
"""Runtime: 240 ms, faster than 51.62% of Python3 online submissions for Kth Smallest Element in a Sorted Matrix. Memory Usage: 20.1 MB, less than 6.06% of Python3 online submissions for Kth Smallest Element in a Sorted Matrix."""
def kthSmallest(self, matrix, k):
"""Given ... | stack_v2_sparse_classes_36k_train_026995 | 2,223 | no_license | [
{
"docstring": "Given a n x n matrix where each of the rows and columns are sorted in ascending order, find the kth smallest element in the matrix. Note that it is the kth smallest element in the sorted order, not the kth distinct element. Example: matrix = [ [ 1, 5, 9], [10, 11, 13], [12, 13, 15] ], k = 8, ret... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Runtime: 240 ms, faster than 51.62% of Python3 online submissions for Kth Smallest Element in a Sorted Matrix. Memory Usage: 20.1 MB, less than 6.06% of Python3 online submissions for Kth Smallest Element in a Sorted Matrix.
Method signatures a... | Implement the Python class `Solution` described below.
Class description:
Runtime: 240 ms, faster than 51.62% of Python3 online submissions for Kth Smallest Element in a Sorted Matrix. Memory Usage: 20.1 MB, less than 6.06% of Python3 online submissions for Kth Smallest Element in a Sorted Matrix.
Method signatures a... | 01fe893ba2e37c9bda79e3081c556698f0b6d2f0 | <|skeleton|>
class Solution:
"""Runtime: 240 ms, faster than 51.62% of Python3 online submissions for Kth Smallest Element in a Sorted Matrix. Memory Usage: 20.1 MB, less than 6.06% of Python3 online submissions for Kth Smallest Element in a Sorted Matrix."""
def kthSmallest(self, matrix, k):
"""Given ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
"""Runtime: 240 ms, faster than 51.62% of Python3 online submissions for Kth Smallest Element in a Sorted Matrix. Memory Usage: 20.1 MB, less than 6.06% of Python3 online submissions for Kth Smallest Element in a Sorted Matrix."""
def kthSmallest(self, matrix, k):
"""Given a n x n matri... | the_stack_v2_python_sparse | LeetCode/378_kth_smallest_element_in_a_sorted_matrix.py | KKosukeee/CodingQuestions | train | 1 |
c1fe0fbecbd57674395e65d4d7995f70476caa72 | [
"self.barcode = barcode\nself.time_label = time_label\nself.frame_label = frame_label\nself.x_pos = mouse_x\nself.y_pos = mouse_y\nself.window = tkinter.Tk()\nself.window.wm_title('At this point...')\nself.window.iconbitmap(resource_path('kalmus_icon.ico'))\nstart_label = tkinter.Label(master=self.window, text='Sta... | <|body_start_0|>
self.barcode = barcode
self.time_label = time_label
self.frame_label = frame_label
self.x_pos = mouse_x
self.y_pos = mouse_y
self.window = tkinter.Tk()
self.window.wm_title('At this point...')
self.window.iconbitmap(resource_path('kalmus_i... | CalibrateBarcodeTimeWindow Class GUI window for user to recalibrate the time of a barcode | CalibrateBarcodeTimeWindow | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CalibrateBarcodeTimeWindow:
"""CalibrateBarcodeTimeWindow Class GUI window for user to recalibrate the time of a barcode"""
def __init__(self, barcode, time_label, frame_label, mouse_x, mouse_y):
"""Initialize :param barcode: The barcode to recalibrate :param time_label: the text lab... | stack_v2_sparse_classes_36k_train_026996 | 4,396 | permissive | [
{
"docstring": "Initialize :param barcode: The barcode to recalibrate :param time_label: the text label for time :param frame_label: the text label for the frame index :param mouse_x: the x position of the clicked point :param mouse_y: the y position of the clicked point",
"name": "__init__",
"signature... | 2 | stack_v2_sparse_classes_30k_train_002667 | Implement the Python class `CalibrateBarcodeTimeWindow` described below.
Class description:
CalibrateBarcodeTimeWindow Class GUI window for user to recalibrate the time of a barcode
Method signatures and docstrings:
- def __init__(self, barcode, time_label, frame_label, mouse_x, mouse_y): Initialize :param barcode: T... | Implement the Python class `CalibrateBarcodeTimeWindow` described below.
Class description:
CalibrateBarcodeTimeWindow Class GUI window for user to recalibrate the time of a barcode
Method signatures and docstrings:
- def __init__(self, barcode, time_label, frame_label, mouse_x, mouse_y): Initialize :param barcode: T... | fb26d51d086cc509e9394fd6da8ce8043f80cfd2 | <|skeleton|>
class CalibrateBarcodeTimeWindow:
"""CalibrateBarcodeTimeWindow Class GUI window for user to recalibrate the time of a barcode"""
def __init__(self, barcode, time_label, frame_label, mouse_x, mouse_y):
"""Initialize :param barcode: The barcode to recalibrate :param time_label: the text lab... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CalibrateBarcodeTimeWindow:
"""CalibrateBarcodeTimeWindow Class GUI window for user to recalibrate the time of a barcode"""
def __init__(self, barcode, time_label, frame_label, mouse_x, mouse_y):
"""Initialize :param barcode: The barcode to recalibrate :param time_label: the text label for time :... | the_stack_v2_python_sparse | kalmus/tkinter_windows/time_points_windows/CalibrateBarcodeTimeWindow.py | imayuyu/KALMUS | train | 0 |
023b6195184f48824608ca87300910c5b9353b8b | [
"c = Client()\nr = c.get(reverse('entry_example'))\nself.assertEqual(r.content.decode('utf-8').find('Hotel') > -1, True)",
"c = Client()\nr = c.get(reverse('entry_vg', args=('20647',)), follow=True)\nself.assertEqual(r.status_code, 200)\nself.assertEqual(r.content.decode('utf-8').find('Flax') > -1, True)",
"c =... | <|body_start_0|>
c = Client()
r = c.get(reverse('entry_example'))
self.assertEqual(r.content.decode('utf-8').find('Hotel') > -1, True)
<|end_body_0|>
<|body_start_1|>
c = Client()
r = c.get(reverse('entry_vg', args=('20647',)), follow=True)
self.assertEqual(r.status_code... | Tests for the entries. | EntryTest | [
"Zlib"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EntryTest:
"""Tests for the entries."""
def test_view_get_example_entry(self):
"""Test static example entry view."""
<|body_0|>
def test_view_flax(self):
"""Test name of the place."""
<|body_1|>
def test_view_other_enjoy(self):
"""Test catego... | stack_v2_sparse_classes_36k_train_026997 | 3,966 | permissive | [
{
"docstring": "Test static example entry view.",
"name": "test_view_get_example_entry",
"signature": "def test_view_get_example_entry(self)"
},
{
"docstring": "Test name of the place.",
"name": "test_view_flax",
"signature": "def test_view_flax(self)"
},
{
"docstring": "Test cat... | 4 | stack_v2_sparse_classes_30k_test_000938 | Implement the Python class `EntryTest` described below.
Class description:
Tests for the entries.
Method signatures and docstrings:
- def test_view_get_example_entry(self): Test static example entry view.
- def test_view_flax(self): Test name of the place.
- def test_view_other_enjoy(self): Test category other in Enj... | Implement the Python class `EntryTest` described below.
Class description:
Tests for the entries.
Method signatures and docstrings:
- def test_view_get_example_entry(self): Test static example entry view.
- def test_view_flax(self): Test name of the place.
- def test_view_other_enjoy(self): Test category other in Enj... | 652d62bdbfbfbff4872697bcfcde5da4ce44f98a | <|skeleton|>
class EntryTest:
"""Tests for the entries."""
def test_view_get_example_entry(self):
"""Test static example entry view."""
<|body_0|>
def test_view_flax(self):
"""Test name of the place."""
<|body_1|>
def test_view_other_enjoy(self):
"""Test catego... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class EntryTest:
"""Tests for the entries."""
def test_view_get_example_entry(self):
"""Test static example entry view."""
c = Client()
r = c.get(reverse('entry_example'))
self.assertEqual(r.content.decode('utf-8').find('Hotel') > -1, True)
def test_view_flax(self):
... | the_stack_v2_python_sparse | vegbasketapp/vegbasketapp/frontend/tests.py | VeggieSailor/vegbasket | train | 1 |
6c43cbf831e645b1c2e343063347a7a3acd62cc4 | [
"if nums == []:\n return False\nif len(nums) == 1:\n return True\na = nums.copy()\nb = nums.copy()\nfor i in range(len(nums) - 1):\n if nums[i] > nums[i + 1]:\n a[i] = nums[i + 1]\n b[i + 1] = nums[i]\n break\nreturn nums == sorted(a) or nums == sorted(b)",
"mod = False\nfor i in ran... | <|body_start_0|>
if nums == []:
return False
if len(nums) == 1:
return True
a = nums.copy()
b = nums.copy()
for i in range(len(nums) - 1):
if nums[i] > nums[i + 1]:
a[i] = nums[i + 1]
b[i + 1] = nums[i]
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def checkPossibility(self, nums):
""":type nums: List[int] :rtype: bool"""
<|body_0|>
def checkPossibility2(self, nums):
""":type nums: List[int] :rtype: bool"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if nums == []:
retur... | stack_v2_sparse_classes_36k_train_026998 | 2,035 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: bool",
"name": "checkPossibility",
"signature": "def checkPossibility(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: bool",
"name": "checkPossibility2",
"signature": "def checkPossibility2(self, nums)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def checkPossibility(self, nums): :type nums: List[int] :rtype: bool
- def checkPossibility2(self, nums): :type nums: List[int] :rtype: bool | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def checkPossibility(self, nums): :type nums: List[int] :rtype: bool
- def checkPossibility2(self, nums): :type nums: List[int] :rtype: bool
<|skeleton|>
class Solution:
de... | b925bb22d1daa4a56c5a238a5758a926905559b4 | <|skeleton|>
class Solution:
def checkPossibility(self, nums):
""":type nums: List[int] :rtype: bool"""
<|body_0|>
def checkPossibility2(self, nums):
""":type nums: List[int] :rtype: bool"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def checkPossibility(self, nums):
""":type nums: List[int] :rtype: bool"""
if nums == []:
return False
if len(nums) == 1:
return True
a = nums.copy()
b = nums.copy()
for i in range(len(nums) - 1):
if nums[i] > nums[i... | the_stack_v2_python_sparse | Arrays/665. Non-decreasing Array.py | beninghton/notGivenUpToG | train | 0 | |
82cf64e512c3fc503529b95dd6c7b2a66543d31d | [
"if isinstance(key, int):\n return Option(key)\nif key not in Option._member_map_:\n return extend_enum(Option, key, default)\nreturn Option[key]",
"if not (isinstance(value, int) and 0 <= value <= 255):\n raise ValueError('%r is not a valid %s' % (value, cls.__name__))\nif 35 <= value <= 68:\n return... | <|body_start_0|>
if isinstance(key, int):
return Option(key)
if key not in Option._member_map_:
return extend_enum(Option, key, default)
return Option[key]
<|end_body_0|>
<|body_start_1|>
if not (isinstance(value, int) and 0 <= value <= 255):
raise Va... | [Option] TCP Option Kind Numbers | Option | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Option:
"""[Option] TCP Option Kind Numbers"""
def get(key: 'int | str', default: 'int'=-1) -> 'Option':
"""Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:"""
<|body_0|>
def _missing_(cls, value: '... | stack_v2_sparse_classes_36k_train_026999 | 5,805 | permissive | [
{
"docstring": "Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:",
"name": "get",
"signature": "def get(key: 'int | str', default: 'int'=-1) -> 'Option'"
},
{
"docstring": "Lookup function used when value is not found. Args... | 2 | stack_v2_sparse_classes_30k_train_016023 | Implement the Python class `Option` described below.
Class description:
[Option] TCP Option Kind Numbers
Method signatures and docstrings:
- def get(key: 'int | str', default: 'int'=-1) -> 'Option': Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta privat... | Implement the Python class `Option` described below.
Class description:
[Option] TCP Option Kind Numbers
Method signatures and docstrings:
- def get(key: 'int | str', default: 'int'=-1) -> 'Option': Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta privat... | a6fe49ec58f09e105bec5a00fb66d9b3f22730d9 | <|skeleton|>
class Option:
"""[Option] TCP Option Kind Numbers"""
def get(key: 'int | str', default: 'int'=-1) -> 'Option':
"""Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:"""
<|body_0|>
def _missing_(cls, value: '... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Option:
"""[Option] TCP Option Kind Numbers"""
def get(key: 'int | str', default: 'int'=-1) -> 'Option':
"""Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:"""
if isinstance(key, int):
return Option(key)
... | the_stack_v2_python_sparse | pcapkit/const/tcp/option.py | JarryShaw/PyPCAPKit | train | 204 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.