blob_id stringlengths 40 40 | bodies listlengths 2 6 | bodies_text stringlengths 196 7.73k | class_docstring stringlengths 0 700 | class_name stringlengths 1 86 | detected_licenses listlengths 0 45 | format_version stringclasses 1
value | full_text stringlengths 378 8.64k | id stringlengths 44 44 | length_bytes int64 505 50k | license_type stringclasses 2
values | methods listlengths 2 6 | n_methods int64 2 6 | original_id stringlengths 38 40 ⌀ | prompt stringlengths 153 4.88k | prompted_full_text stringlengths 565 12.5k | revision_id stringlengths 40 40 | skeleton stringlengths 162 5.05k | snapshot_name stringclasses 1
value | snapshot_source_dir stringclasses 1
value | snapshot_total_rows int64 75.8k 75.8k | solution stringlengths 242 8.3k | source stringclasses 1
value | source_path stringlengths 4 177 | source_repo stringlengths 6 110 | split stringclasses 1
value | star_events_count int64 0 209k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
36ac13e427925ca974989d5913ab10bfb76b2f64 | [
"change_dict = {f: vals.get(f) for f in track_fields}\nfor line in lines:\n msg_title = line.display_name\n self.env['pabi.utils']._track_line_change(msg_title, fk_field, line, change_dict)",
"detail = []\nfor f, new_val in change_dict.iteritems():\n field = line._fields[f]\n if new_val:\n old_... | <|body_start_0|>
change_dict = {f: vals.get(f) for f in track_fields}
for line in lines:
msg_title = line.display_name
self.env['pabi.utils']._track_line_change(msg_title, fk_field, line, change_dict)
<|end_body_0|>
<|body_start_1|>
detail = []
for f, new_val in ... | PABIUtils | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PABIUtils:
def track_lines(self, vals, fk_field, track_fields, lines):
"""Helper method"""
<|body_0|>
def _track_line_change(self, msg_title, fk_field, line, change_dict):
"""This method is called from line object (i.e., sale.order.line) to post message in head objec... | stack_v2_sparse_classes_75kplus_train_008800 | 2,252 | no_license | [
{
"docstring": "Helper method",
"name": "track_lines",
"signature": "def track_lines(self, vals, fk_field, track_fields, lines)"
},
{
"docstring": "This method is called from line object (i.e., sale.order.line) to post message in head object (i..e, sale.order) :param msg_title: char, message tit... | 2 | null | Implement the Python class `PABIUtils` described below.
Class description:
Implement the PABIUtils class.
Method signatures and docstrings:
- def track_lines(self, vals, fk_field, track_fields, lines): Helper method
- def _track_line_change(self, msg_title, fk_field, line, change_dict): This method is called from lin... | Implement the Python class `PABIUtils` described below.
Class description:
Implement the PABIUtils class.
Method signatures and docstrings:
- def track_lines(self, vals, fk_field, track_fields, lines): Helper method
- def _track_line_change(self, msg_title, fk_field, line, change_dict): This method is called from lin... | e8c21082c187f4639373b29a7a0905d069d770f2 | <|skeleton|>
class PABIUtils:
def track_lines(self, vals, fk_field, track_fields, lines):
"""Helper method"""
<|body_0|>
def _track_line_change(self, msg_title, fk_field, line, change_dict):
"""This method is called from line object (i.e., sale.order.line) to post message in head objec... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PABIUtils:
def track_lines(self, vals, fk_field, track_fields, lines):
"""Helper method"""
change_dict = {f: vals.get(f) for f in track_fields}
for line in lines:
msg_title = line.display_name
self.env['pabi.utils']._track_line_change(msg_title, fk_field, line, ... | the_stack_v2_python_sparse | pabi_utils/models/utils.py | pabi2/pb2_addons | train | 6 | |
7477bd83ae52fb237851348415d9eea7588128e8 | [
"self.number = 1\nself.title = 'Generate 3 random integers between 100 and 999 which is divisible by 5'\nself.question = 'Question 1: Generate 3 random integers between100 and 999 which is divisible by 5'\nself.solution = self.solve()",
"print(f'## Question {self.number} ##')\nprint(f'* {self.question}')\nprint('... | <|body_start_0|>
self.number = 1
self.title = 'Generate 3 random integers between 100 and 999 which is divisible by 5'
self.question = 'Question 1: Generate 3 random integers between100 and 999 which is divisible by 5'
self.solution = self.solve()
<|end_body_0|>
<|body_start_1|>
... | QuestionOne Class. | QuestionOne | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class QuestionOne:
"""QuestionOne Class."""
def __init__(self, *args, **kwargs):
"""Create QuestionOne object."""
<|body_0|>
def solve(self, print_=False):
"""Find a solution for the question."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.numbe... | stack_v2_sparse_classes_75kplus_train_008801 | 2,479 | permissive | [
{
"docstring": "Create QuestionOne object.",
"name": "__init__",
"signature": "def __init__(self, *args, **kwargs)"
},
{
"docstring": "Find a solution for the question.",
"name": "solve",
"signature": "def solve(self, print_=False)"
}
] | 2 | null | Implement the Python class `QuestionOne` described below.
Class description:
QuestionOne Class.
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): Create QuestionOne object.
- def solve(self, print_=False): Find a solution for the question. | Implement the Python class `QuestionOne` described below.
Class description:
QuestionOne Class.
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): Create QuestionOne object.
- def solve(self, print_=False): Find a solution for the question.
<|skeleton|>
class QuestionOne:
"""QuestionOne Cla... | 140c96ada87ec5e9faa4622504ddee18840dce4a | <|skeleton|>
class QuestionOne:
"""QuestionOne Class."""
def __init__(self, *args, **kwargs):
"""Create QuestionOne object."""
<|body_0|>
def solve(self, print_=False):
"""Find a solution for the question."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class QuestionOne:
"""QuestionOne Class."""
def __init__(self, *args, **kwargs):
"""Create QuestionOne object."""
self.number = 1
self.title = 'Generate 3 random integers between 100 and 999 which is divisible by 5'
self.question = 'Question 1: Generate 3 random integers between... | the_stack_v2_python_sparse | python/misc/random_number_generation_exercises.py | christopher-burke/warmups | train | 0 |
57a580c3bf6d823c05223df1d15ecd1a13c90a6e | [
"self.safe_update(**kwargs)\nslot = self.config.slot\nbias_files = data['BIAS']\nmask_files = self.get_mask_files()\nsuperbias_frame = self.get_superbias_frame(mask_files=mask_files)\nself.log_info_slot_msg(self.config, '%i files' % len(bias_files))\nbiasstruct_data = {}\nfor ifile, bias_file in enumerate(bias_file... | <|body_start_0|>
self.safe_update(**kwargs)
slot = self.config.slot
bias_files = data['BIAS']
mask_files = self.get_mask_files()
superbias_frame = self.get_superbias_frame(mask_files=mask_files)
self.log_info_slot_msg(self.config, '%i files' % len(bias_files))
bia... | Analyze the structure of the bias frames | BiasStructTask | [
"BSD-2-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BiasStructTask:
"""Analyze the structure of the bias frames"""
def extract(self, butler, data, **kwargs):
"""Plot the row-wise and col-wise struture in a series of bias frames Parameters ---------- butler : `Butler` The data butler data : `dict` Dictionary (or other structure) contai... | stack_v2_sparse_classes_75kplus_train_008802 | 8,793 | permissive | [
{
"docstring": "Plot the row-wise and col-wise struture in a series of bias frames Parameters ---------- butler : `Butler` The data butler data : `dict` Dictionary (or other structure) contain the input data kwargs Used to override default configuration Returns ------- dtables : `TableDict` The resulting data",... | 3 | null | Implement the Python class `BiasStructTask` described below.
Class description:
Analyze the structure of the bias frames
Method signatures and docstrings:
- def extract(self, butler, data, **kwargs): Plot the row-wise and col-wise struture in a series of bias frames Parameters ---------- butler : `Butler` The data bu... | Implement the Python class `BiasStructTask` described below.
Class description:
Analyze the structure of the bias frames
Method signatures and docstrings:
- def extract(self, butler, data, **kwargs): Plot the row-wise and col-wise struture in a series of bias frames Parameters ---------- butler : `Butler` The data bu... | 28418284fdaf2b2fb0afbeccd4324f7ad3e676c8 | <|skeleton|>
class BiasStructTask:
"""Analyze the structure of the bias frames"""
def extract(self, butler, data, **kwargs):
"""Plot the row-wise and col-wise struture in a series of bias frames Parameters ---------- butler : `Butler` The data butler data : `dict` Dictionary (or other structure) contai... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BiasStructTask:
"""Analyze the structure of the bias frames"""
def extract(self, butler, data, **kwargs):
"""Plot the row-wise and col-wise struture in a series of bias frames Parameters ---------- butler : `Butler` The data butler data : `dict` Dictionary (or other structure) contain the input d... | the_stack_v2_python_sparse | python/lsst/eo_utils/bias/bias_struct.py | lsst-camera-dh/EO-utilities | train | 2 |
86ef44fdca4a098f36ad5cba29a2886a9cee8e54 | [
"copied = matrix.copy()\nrows = set()\ncolumns = set()\nfor i in range(len(matrix)):\n for j in range(len(matrix[0])):\n if matrix[i][j] == 0:\n rows.add(i)\n columns.add(j)\nfor i in range(len(copied)):\n for j in range(len(copied[0])):\n if i in rows or j in columns:\n ... | <|body_start_0|>
copied = matrix.copy()
rows = set()
columns = set()
for i in range(len(matrix)):
for j in range(len(matrix[0])):
if matrix[i][j] == 0:
rows.add(i)
columns.add(j)
for i in range(len(copied)):
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def setZeroes(self, matrix: List[List[int]]) -> None:
"""Purpose: Given an m x n integer matrix, sets its entire row and column to 0's if element is 0. Returns the matrix."""
<|body_0|>
def setZeroes1(self, matrix):
"""Does not return anything, modifies mat... | stack_v2_sparse_classes_75kplus_train_008803 | 1,424 | no_license | [
{
"docstring": "Purpose: Given an m x n integer matrix, sets its entire row and column to 0's if element is 0. Returns the matrix.",
"name": "setZeroes",
"signature": "def setZeroes(self, matrix: List[List[int]]) -> None"
},
{
"docstring": "Does not return anything, modifies matrix in-place inst... | 2 | stack_v2_sparse_classes_30k_train_007114 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def setZeroes(self, matrix: List[List[int]]) -> None: Purpose: Given an m x n integer matrix, sets its entire row and column to 0's if element is 0. Returns the matrix.
- def set... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def setZeroes(self, matrix: List[List[int]]) -> None: Purpose: Given an m x n integer matrix, sets its entire row and column to 0's if element is 0. Returns the matrix.
- def set... | 95a86cbbca28d0c0f6d72d28a2f1cb5a86327934 | <|skeleton|>
class Solution:
def setZeroes(self, matrix: List[List[int]]) -> None:
"""Purpose: Given an m x n integer matrix, sets its entire row and column to 0's if element is 0. Returns the matrix."""
<|body_0|>
def setZeroes1(self, matrix):
"""Does not return anything, modifies mat... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def setZeroes(self, matrix: List[List[int]]) -> None:
"""Purpose: Given an m x n integer matrix, sets its entire row and column to 0's if element is 0. Returns the matrix."""
copied = matrix.copy()
rows = set()
columns = set()
for i in range(len(matrix)):
... | the_stack_v2_python_sparse | setMatrixZeroes.py | tashakim/puzzles_python | train | 8 | |
50bd88ae2aa82057df74b52b640e504b817b3e40 | [
"if not root:\n return ''\nq = [root]\nres = []\nwhile q:\n node = q.pop(0)\n if not node:\n res.append('X')\n else:\n res.append(str(node.val))\n q.append(node.left)\n q.append(node.right)\nreturn ','.join(res)",
"if not data:\n return None\ndata = data.split(',')\nroot... | <|body_start_0|>
if not root:
return ''
q = [root]
res = []
while q:
node = q.pop(0)
if not node:
res.append('X')
else:
res.append(str(node.val))
q.append(node.left)
q.append(n... | 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_75kplus_train_008804 | 2,948 | 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 | stack_v2_sparse_classes_30k_train_053625 | 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:... | 021c77ec5a5cec6401154627134192e42d24cd14 | <|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_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
if not root:
return ''
q = [root]
res = []
while q:
node = q.pop(0)
if not node:
res.append('X')
e... | the_stack_v2_python_sparse | 二叉树专辑/297.二叉树的序列化与反序列化.py | Jaeker0512/gocrack-algorithm | train | 0 | |
ab93cdbc0b11efd397da4d57da69881d0d4f5b7b | [
"self._sources = sources\nself._provides_map = dict()\nfor source in sources:\n for provide in source.provides:\n if provide in self._provides_map:\n raise MultipleProvideError(provide, [self._provides_map[provide], source])\n self._provides_map[provide] = source\nfor source in sources:\... | <|body_start_0|>
self._sources = sources
self._provides_map = dict()
for source in sources:
for provide in source.provides:
if provide in self._provides_map:
raise MultipleProvideError(provide, [self._provides_map[provide], source])
... | Represents the set of dependencies between source files. | DepsTree | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0",
"BSD-3-Clause",
"GPL-1.0-or-later",
"MIT",
"LGPL-2.0-or-later"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DepsTree:
"""Represents the set of dependencies between source files."""
def __init__(self, sources):
"""Initializes the tree with a set of sources. Args: sources: A set of JavaScript sources. Raises: MultipleProvideError: A namespace is provided by muplitple sources. NamespaceNotFou... | stack_v2_sparse_classes_75kplus_train_008805 | 6,397 | permissive | [
{
"docstring": "Initializes the tree with a set of sources. Args: sources: A set of JavaScript sources. Raises: MultipleProvideError: A namespace is provided by muplitple sources. NamespaceNotFoundError: A namespace is required but never provided.",
"name": "__init__",
"signature": "def __init__(self, s... | 3 | stack_v2_sparse_classes_30k_train_018954 | Implement the Python class `DepsTree` described below.
Class description:
Represents the set of dependencies between source files.
Method signatures and docstrings:
- def __init__(self, sources): Initializes the tree with a set of sources. Args: sources: A set of JavaScript sources. Raises: MultipleProvideError: A na... | Implement the Python class `DepsTree` described below.
Class description:
Represents the set of dependencies between source files.
Method signatures and docstrings:
- def __init__(self, sources): Initializes the tree with a set of sources. Args: sources: A set of JavaScript sources. Raises: MultipleProvideError: A na... | a401d6cf4f7bf0e2d2e964c512ebb923c3d8832c | <|skeleton|>
class DepsTree:
"""Represents the set of dependencies between source files."""
def __init__(self, sources):
"""Initializes the tree with a set of sources. Args: sources: A set of JavaScript sources. Raises: MultipleProvideError: A namespace is provided by muplitple sources. NamespaceNotFou... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DepsTree:
"""Represents the set of dependencies between source files."""
def __init__(self, sources):
"""Initializes the tree with a set of sources. Args: sources: A set of JavaScript sources. Raises: MultipleProvideError: A namespace is provided by muplitple sources. NamespaceNotFoundError: A na... | the_stack_v2_python_sparse | third_party/google_input_tools/third_party/closure_library/closure/bin/build/depstree.py | chromium/chromium | train | 17,408 |
ca172e89ebfb68890c41eb36ed29bdbad8ac104f | [
"Exception.__init__(self)\nself.reasons = reasons\nself.status_code = status_code\nself.extra_info = kwargs",
"response = jsonify({'reasons': self.reasons, 'extra_info': self.extra_info})\nresponse.status_code = self.status_code\nreturn response"
] | <|body_start_0|>
Exception.__init__(self)
self.reasons = reasons
self.status_code = status_code
self.extra_info = kwargs
<|end_body_0|>
<|body_start_1|>
response = jsonify({'reasons': self.reasons, 'extra_info': self.extra_info})
response.status_code = self.status_code
... | Base class for all API related errors which are designed to trigger responses to the users. These errors are handled by the application and printed as a standard JSON response to the user. | APIError | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class APIError:
"""Base class for all API related errors which are designed to trigger responses to the users. These errors are handled by the application and printed as a standard JSON response to the user."""
def __init__(self, reasons, status_code=400, **kwargs):
"""Args: reasons (dict)... | stack_v2_sparse_classes_75kplus_train_008806 | 3,118 | permissive | [
{
"docstring": "Args: reasons (dict): A dictionary containing the reason(s) for a failure. status_code (int, optional): status code of the generated response. Defaults to 400. **kwargs: Additional information that will be attached to the generated response.",
"name": "__init__",
"signature": "def __init... | 2 | stack_v2_sparse_classes_30k_train_023278 | Implement the Python class `APIError` described below.
Class description:
Base class for all API related errors which are designed to trigger responses to the users. These errors are handled by the application and printed as a standard JSON response to the user.
Method signatures and docstrings:
- def __init__(self, ... | Implement the Python class `APIError` described below.
Class description:
Base class for all API related errors which are designed to trigger responses to the users. These errors are handled by the application and printed as a standard JSON response to the user.
Method signatures and docstrings:
- def __init__(self, ... | ac44b78919560fd12cd2759cf9056abc3ee4392b | <|skeleton|>
class APIError:
"""Base class for all API related errors which are designed to trigger responses to the users. These errors are handled by the application and printed as a standard JSON response to the user."""
def __init__(self, reasons, status_code=400, **kwargs):
"""Args: reasons (dict)... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class APIError:
"""Base class for all API related errors which are designed to trigger responses to the users. These errors are handled by the application and printed as a standard JSON response to the user."""
def __init__(self, reasons, status_code=400, **kwargs):
"""Args: reasons (dict): A dictionar... | the_stack_v2_python_sparse | kaos/api/errors.py | KMC-70/kaos | train | 2 |
f105f222d58f033bddb76f730e75dd63895e1fea | [
"if not email:\n raise ValueError('Users must have an email address')\nuser = self.model(email=MyUserManager.normalize_email(email), date_of_birth=date_of_birth, type_of=t)\nuser.set_password(password)\nuser.save(using=self._db)\nreturn user",
"u = self.create_user(username, password=password, date_of_birth=da... | <|body_start_0|>
if not email:
raise ValueError('Users must have an email address')
user = self.model(email=MyUserManager.normalize_email(email), date_of_birth=date_of_birth, type_of=t)
user.set_password(password)
user.save(using=self._db)
return user
<|end_body_0|>
... | MyUserManager | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MyUserManager:
def create_user(self, email, date_of_birth, t, password=None):
"""Creates and saves a User with the given email, date of birth and password."""
<|body_0|>
def create_superuser(self, t, username, date_of_birth, password):
"""Creates and saves a superuse... | stack_v2_sparse_classes_75kplus_train_008807 | 13,331 | no_license | [
{
"docstring": "Creates and saves a User with the given email, date of birth and password.",
"name": "create_user",
"signature": "def create_user(self, email, date_of_birth, t, password=None)"
},
{
"docstring": "Creates and saves a superuser with the given email, date of birth and password.",
... | 2 | stack_v2_sparse_classes_30k_val_001094 | Implement the Python class `MyUserManager` described below.
Class description:
Implement the MyUserManager class.
Method signatures and docstrings:
- def create_user(self, email, date_of_birth, t, password=None): Creates and saves a User with the given email, date of birth and password.
- def create_superuser(self, t... | Implement the Python class `MyUserManager` described below.
Class description:
Implement the MyUserManager class.
Method signatures and docstrings:
- def create_user(self, email, date_of_birth, t, password=None): Creates and saves a User with the given email, date of birth and password.
- def create_superuser(self, t... | e6d052ef8998b3e495a64e41b191c124a0a53d6b | <|skeleton|>
class MyUserManager:
def create_user(self, email, date_of_birth, t, password=None):
"""Creates and saves a User with the given email, date of birth and password."""
<|body_0|>
def create_superuser(self, t, username, date_of_birth, password):
"""Creates and saves a superuse... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MyUserManager:
def create_user(self, email, date_of_birth, t, password=None):
"""Creates and saves a User with the given email, date of birth and password."""
if not email:
raise ValueError('Users must have an email address')
user = self.model(email=MyUserManager.normalize_... | the_stack_v2_python_sparse | agritrade/models.py | Django-Nawaz/hello_world | train | 0 | |
b5687245c16c00192c623cde6008d1ce4049e838 | [
"if first_name:\n self.first_name = first_name\nif patronymic:\n self.patronymic = patronymic\nif last_name:\n self.last_name = last_name\nsuper().__init__(username=username, password=password)",
"if order is None:\n order = ('last_name', 'first_name', 'patronymic')\nreturn ' '.join([getattr(self, x) ... | <|body_start_0|>
if first_name:
self.first_name = first_name
if patronymic:
self.patronymic = patronymic
if last_name:
self.last_name = last_name
super().__init__(username=username, password=password)
<|end_body_0|>
<|body_start_1|>
if order i... | Пользователь-физическое лицо. | Human | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Human:
"""Пользователь-физическое лицо."""
def __init__(self, username: str, password: Optional[str]=None, first_name: Optional[str]=None, patronymic: Optional[str]=None, last_name: Optional[str]=None):
""":param str username: имя пользователя :param str password: пароль :param str f... | stack_v2_sparse_classes_75kplus_train_008808 | 4,142 | permissive | [
{
"docstring": ":param str username: имя пользователя :param str password: пароль :param str first_name: реальное имя человека :param str patronymic: отчество :param str last_name: фамилия",
"name": "__init__",
"signature": "def __init__(self, username: str, password: Optional[str]=None, first_name: Opt... | 2 | null | Implement the Python class `Human` described below.
Class description:
Пользователь-физическое лицо.
Method signatures and docstrings:
- def __init__(self, username: str, password: Optional[str]=None, first_name: Optional[str]=None, patronymic: Optional[str]=None, last_name: Optional[str]=None): :param str username: ... | Implement the Python class `Human` described below.
Class description:
Пользователь-физическое лицо.
Method signatures and docstrings:
- def __init__(self, username: str, password: Optional[str]=None, first_name: Optional[str]=None, patronymic: Optional[str]=None, last_name: Optional[str]=None): :param str username: ... | f28f6ae4edf2e0c89abfd9f5e64b8d523c43bbee | <|skeleton|>
class Human:
"""Пользователь-физическое лицо."""
def __init__(self, username: str, password: Optional[str]=None, first_name: Optional[str]=None, patronymic: Optional[str]=None, last_name: Optional[str]=None):
""":param str username: имя пользователя :param str password: пароль :param str f... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Human:
"""Пользователь-физическое лицо."""
def __init__(self, username: str, password: Optional[str]=None, first_name: Optional[str]=None, patronymic: Optional[str]=None, last_name: Optional[str]=None):
""":param str username: имя пользователя :param str password: пароль :param str first_name: ре... | the_stack_v2_python_sparse | bigur/auth/model/user.py | gitter-badger/auth | train | 0 |
7ccf17dd26b3184ca07d1d88133e67196d4802cd | [
"super().__init__(id_)\nself.store_bias = store_bias\nself.callbacks = callbacks\nself.collect_seqs = collect_seqs\nself.collect_kwargs = {} if collect_kwargs is None else collect_kwargs\nself.compose_summary = compose_summary\nself.summary_kwargs = {} if summary_kwargs is None else summary_kwargs\nself.cleanup: bo... | <|body_start_0|>
super().__init__(id_)
self.store_bias = store_bias
self.callbacks = callbacks
self.collect_seqs = collect_seqs
self.collect_kwargs = {} if collect_kwargs is None else collect_kwargs
self.compose_summary = compose_summary
self.summary_kwargs = {} i... | Operator defining the `Worker`'s execution strategy. | GenericExecutor | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GenericExecutor:
"""Operator defining the `Worker`'s execution strategy."""
def __init__(self, id_: Id=None, store_bias: bool=True, callbacks: t.Optional[t.Collection[AbstractCallback]]=None, collect_seqs: bool=True, collect_kwargs: t.Optional[t.Dict[str, t.Any]]=None, compose_summary: bool=... | stack_v2_sparse_classes_75kplus_train_008809 | 3,496 | no_license | [
{
"docstring": ":param id_: Unique Id. Defaults to `id(self)`. :param store_bias: Whether to call `store_bias` method of a `Worker`. :param callbacks: An optional collection of callbacks. `Callback` is an operator accepting and returning a `Worker`. :param collect_seqs: Whether to call `collect_seqs` method of ... | 2 | stack_v2_sparse_classes_30k_train_031641 | Implement the Python class `GenericExecutor` described below.
Class description:
Operator defining the `Worker`'s execution strategy.
Method signatures and docstrings:
- def __init__(self, id_: Id=None, store_bias: bool=True, callbacks: t.Optional[t.Collection[AbstractCallback]]=None, collect_seqs: bool=True, collect... | Implement the Python class `GenericExecutor` described below.
Class description:
Operator defining the `Worker`'s execution strategy.
Method signatures and docstrings:
- def __init__(self, id_: Id=None, store_bias: bool=True, callbacks: t.Optional[t.Collection[AbstractCallback]]=None, collect_seqs: bool=True, collect... | 49d002a3aedece4e122f21d55503898774b43c78 | <|skeleton|>
class GenericExecutor:
"""Operator defining the `Worker`'s execution strategy."""
def __init__(self, id_: Id=None, store_bias: bool=True, callbacks: t.Optional[t.Collection[AbstractCallback]]=None, collect_seqs: bool=True, collect_kwargs: t.Optional[t.Dict[str, t.Any]]=None, compose_summary: bool=... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GenericExecutor:
"""Operator defining the `Worker`'s execution strategy."""
def __init__(self, id_: Id=None, store_bias: bool=True, callbacks: t.Optional[t.Collection[AbstractCallback]]=None, collect_seqs: bool=True, collect_kwargs: t.Optional[t.Dict[str, t.Any]]=None, compose_summary: bool=True, summary... | the_stack_v2_python_sparse | protmc/operators/executor.py | edikedik/ProteusTools | train | 0 |
b99c93fd9ed6c267aa22eb43e1ffa19090f91057 | [
"if 'q' in self.request.GET and self.request.GET['q']:\n return super().dispatch(request, *args, **kwargs)\nelse:\n path_to_redirect = utilities.get_one_level_lower_path(self.request.path)\n return redirect(path_to_redirect)",
"self.query = self.request.GET['q']\nself.model = User.objects.filter(Q(userna... | <|body_start_0|>
if 'q' in self.request.GET and self.request.GET['q']:
return super().dispatch(request, *args, **kwargs)
else:
path_to_redirect = utilities.get_one_level_lower_path(self.request.path)
return redirect(path_to_redirect)
<|end_body_0|>
<|body_start_1|>
... | PermissionEditingViewSearch | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PermissionEditingViewSearch:
def dispatch(self, request, *args, **kwargs):
"""@param request: @type request: @param args: @type args: @param kwargs: @type kwargs: @return: @rtype:"""
<|body_0|>
def get(self, request, *args, **kwargs):
"""@param request: @type request... | stack_v2_sparse_classes_75kplus_train_008810 | 49,724 | permissive | [
{
"docstring": "@param request: @type request: @param args: @type args: @param kwargs: @type kwargs: @return: @rtype:",
"name": "dispatch",
"signature": "def dispatch(self, request, *args, **kwargs)"
},
{
"docstring": "@param request: @type request: @param args: @type args: @param kwargs: @type ... | 3 | null | Implement the Python class `PermissionEditingViewSearch` described below.
Class description:
Implement the PermissionEditingViewSearch class.
Method signatures and docstrings:
- def dispatch(self, request, *args, **kwargs): @param request: @type request: @param args: @type args: @param kwargs: @type kwargs: @return: ... | Implement the Python class `PermissionEditingViewSearch` described below.
Class description:
Implement the PermissionEditingViewSearch class.
Method signatures and docstrings:
- def dispatch(self, request, *args, **kwargs): @param request: @type request: @param args: @type args: @param kwargs: @type kwargs: @return: ... | 9055095cbe796d6d6e2ce744d727ff60e27e09ed | <|skeleton|>
class PermissionEditingViewSearch:
def dispatch(self, request, *args, **kwargs):
"""@param request: @type request: @param args: @type args: @param kwargs: @type kwargs: @return: @rtype:"""
<|body_0|>
def get(self, request, *args, **kwargs):
"""@param request: @type request... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PermissionEditingViewSearch:
def dispatch(self, request, *args, **kwargs):
"""@param request: @type request: @param args: @type args: @param kwargs: @type kwargs: @return: @rtype:"""
if 'q' in self.request.GET and self.request.GET['q']:
return super().dispatch(request, *args, **kwa... | the_stack_v2_python_sparse | author_manage/views.py | VForWaTer/vforwater-portal | train | 8 | |
1155b519a9a3255c0864d4760cad13aafd5602c2 | [
"if '_xml_ns' in kwargs:\n self._xml_ns = kwargs['_xml_ns']\nif '_xml_ns_key' in kwargs:\n self._xml_ns_key = kwargs['_xml_ns_key']\nself.index = index\nsuper(LSVertexType, self).__init__(Line=Line, Sample=Sample, **kwargs)",
"if array is None:\n return None\nif isinstance(array, (numpy.ndarray, list, tu... | <|body_start_0|>
if '_xml_ns' in kwargs:
self._xml_ns = kwargs['_xml_ns']
if '_xml_ns_key' in kwargs:
self._xml_ns_key = kwargs['_xml_ns_key']
self.index = index
super(LSVertexType, self).__init__(Line=Line, Sample=Sample, **kwargs)
<|end_body_0|>
<|body_start_1|... | An array element of LSType. | LSVertexType | [
"MIT",
"LicenseRef-scancode-free-unknown",
"LicenseRef-scancode-public-domain"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LSVertexType:
"""An array element of LSType."""
def __init__(self, Line=None, Sample=None, index=None, **kwargs):
"""Parameters ---------- Line : float Sample : float index : int kwargs"""
<|body_0|>
def from_array(cls, array, index=1):
"""Create from an array ty... | stack_v2_sparse_classes_75kplus_train_008811 | 10,131 | permissive | [
{
"docstring": "Parameters ---------- Line : float Sample : float index : int kwargs",
"name": "__init__",
"signature": "def __init__(self, Line=None, Sample=None, index=None, **kwargs)"
},
{
"docstring": "Create from an array type entry. Parameters ---------- array: numpy.ndarray|list|tuple ass... | 2 | stack_v2_sparse_classes_30k_train_029484 | Implement the Python class `LSVertexType` described below.
Class description:
An array element of LSType.
Method signatures and docstrings:
- def __init__(self, Line=None, Sample=None, index=None, **kwargs): Parameters ---------- Line : float Sample : float index : int kwargs
- def from_array(cls, array, index=1): Cr... | Implement the Python class `LSVertexType` described below.
Class description:
An array element of LSType.
Method signatures and docstrings:
- def __init__(self, Line=None, Sample=None, index=None, **kwargs): Parameters ---------- Line : float Sample : float index : int kwargs
- def from_array(cls, array, index=1): Cr... | de1b1886f161a83b6c89aadc7a2c7cfc4892ef81 | <|skeleton|>
class LSVertexType:
"""An array element of LSType."""
def __init__(self, Line=None, Sample=None, index=None, **kwargs):
"""Parameters ---------- Line : float Sample : float index : int kwargs"""
<|body_0|>
def from_array(cls, array, index=1):
"""Create from an array ty... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LSVertexType:
"""An array element of LSType."""
def __init__(self, Line=None, Sample=None, index=None, **kwargs):
"""Parameters ---------- Line : float Sample : float index : int kwargs"""
if '_xml_ns' in kwargs:
self._xml_ns = kwargs['_xml_ns']
if '_xml_ns_key' in kwa... | the_stack_v2_python_sparse | sarpy/io/phase_history/cphd1_elements/blocks.py | ngageoint/sarpy | train | 192 |
71672e0e28716c9e616da4d1ca891c617c1b0c16 | [
"response = self.client.get(reverse('blog.index'))\nself.assertEqual(response.status_code, 200)\nself.assertContains(response, 'No post')\nself.assertQuerysetEqual(response.context['post_list'], [])",
"create_post(title='first post', slug='first-post', content='test content', publish_time='2014-12-15 08:01:02')\n... | <|body_start_0|>
response = self.client.get(reverse('blog.index'))
self.assertEqual(response.status_code, 200)
self.assertContains(response, 'No post')
self.assertQuerysetEqual(response.context['post_list'], [])
<|end_body_0|>
<|body_start_1|>
create_post(title='first post', slu... | PostListTests | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PostListTests:
def test_index_view_with_no_posts(self):
"""If no questions exist, an appropriate message should be displayed."""
<|body_0|>
def test_index_view_with_one_post(self):
"""Test with one post"""
<|body_1|>
def test_index_view_with_two_post(sel... | stack_v2_sparse_classes_75kplus_train_008812 | 9,880 | no_license | [
{
"docstring": "If no questions exist, an appropriate message should be displayed.",
"name": "test_index_view_with_no_posts",
"signature": "def test_index_view_with_no_posts(self)"
},
{
"docstring": "Test with one post",
"name": "test_index_view_with_one_post",
"signature": "def test_ind... | 4 | null | Implement the Python class `PostListTests` described below.
Class description:
Implement the PostListTests class.
Method signatures and docstrings:
- def test_index_view_with_no_posts(self): If no questions exist, an appropriate message should be displayed.
- def test_index_view_with_one_post(self): Test with one pos... | Implement the Python class `PostListTests` described below.
Class description:
Implement the PostListTests class.
Method signatures and docstrings:
- def test_index_view_with_no_posts(self): If no questions exist, an appropriate message should be displayed.
- def test_index_view_with_one_post(self): Test with one pos... | d3b62c9a2ca5a50b62f9a1f0385bfc11b2234bac | <|skeleton|>
class PostListTests:
def test_index_view_with_no_posts(self):
"""If no questions exist, an appropriate message should be displayed."""
<|body_0|>
def test_index_view_with_one_post(self):
"""Test with one post"""
<|body_1|>
def test_index_view_with_two_post(sel... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PostListTests:
def test_index_view_with_no_posts(self):
"""If no questions exist, an appropriate message should be displayed."""
response = self.client.get(reverse('blog.index'))
self.assertEqual(response.status_code, 200)
self.assertContains(response, 'No post')
self.a... | the_stack_v2_python_sparse | blog/tests.py | dengshilong/dengshilong | train | 3 | |
84ce72485cf018758ec91042e40221b40a24d5d4 | [
"if not head:\n return False\nslow, fast = (head, head)\nwhile fast.next and fast.next.next:\n fast = fast.next.next\n slow = slow.next\n if slow == fast:\n return True\nreturn False",
"visited = set()\ncurr = head\nwhile curr:\n if curr in visited:\n return True\n else:\n v... | <|body_start_0|>
if not head:
return False
slow, fast = (head, head)
while fast.next and fast.next.next:
fast = fast.next.next
slow = slow.next
if slow == fast:
return True
return False
<|end_body_0|>
<|body_start_1|>
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def hasCycle(self, head):
""":type head: ListNode :rtype: bool"""
<|body_0|>
def hasCycle_2(self, head):
""":type head: ListNode :rtype: bool"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not head:
return False
slo... | stack_v2_sparse_classes_75kplus_train_008813 | 1,308 | no_license | [
{
"docstring": ":type head: ListNode :rtype: bool",
"name": "hasCycle",
"signature": "def hasCycle(self, head)"
},
{
"docstring": ":type head: ListNode :rtype: bool",
"name": "hasCycle_2",
"signature": "def hasCycle_2(self, head)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def hasCycle(self, head): :type head: ListNode :rtype: bool
- def hasCycle_2(self, head): :type head: ListNode :rtype: bool | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def hasCycle(self, head): :type head: ListNode :rtype: bool
- def hasCycle_2(self, head): :type head: ListNode :rtype: bool
<|skeleton|>
class Solution:
def hasCycle(self, ... | f2c4f727689567e00ee06560132fca55a6fd9286 | <|skeleton|>
class Solution:
def hasCycle(self, head):
""":type head: ListNode :rtype: bool"""
<|body_0|>
def hasCycle_2(self, head):
""":type head: ListNode :rtype: bool"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def hasCycle(self, head):
""":type head: ListNode :rtype: bool"""
if not head:
return False
slow, fast = (head, head)
while fast.next and fast.next.next:
fast = fast.next.next
slow = slow.next
if slow == fast:
... | the_stack_v2_python_sparse | leetcode/141_Linked_List_Cycle.py | JianxiangWang/python-journey | train | 1 | |
d10467e56e508f04b1804b6c9a068dd6f1a5b2de | [
"print('test_login1_normal is start test...')\npo = LoginPage(self.driver)\npo.Login_action(u'鹿太太', 123456)\nsleep(3)\nself.assertEqual(po.type_loginPass_hint(), u'我的空间')\nfunction.insert_img(self.driver, '51zxw_login1_nomal.jpg')\nprint('test_login1_normal test end')",
"print('test_login2_passworderror is start ... | <|body_start_0|>
print('test_login1_normal is start test...')
po = LoginPage(self.driver)
po.Login_action(u'鹿太太', 123456)
sleep(3)
self.assertEqual(po.type_loginPass_hint(), u'我的空间')
function.insert_img(self.driver, '51zxw_login1_nomal.jpg')
print('test_login1_nor... | LoginTest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LoginTest:
def test_login1_normal(self):
"""username and password is normal"""
<|body_0|>
def test_login2_PasswordError(self):
"""username and password is error"""
<|body_1|>
def test_login3_empty(self):
"""username and passwd is empty"""
... | stack_v2_sparse_classes_75kplus_train_008814 | 1,453 | no_license | [
{
"docstring": "username and password is normal",
"name": "test_login1_normal",
"signature": "def test_login1_normal(self)"
},
{
"docstring": "username and password is error",
"name": "test_login2_PasswordError",
"signature": "def test_login2_PasswordError(self)"
},
{
"docstring"... | 3 | stack_v2_sparse_classes_30k_train_043612 | Implement the Python class `LoginTest` described below.
Class description:
Implement the LoginTest class.
Method signatures and docstrings:
- def test_login1_normal(self): username and password is normal
- def test_login2_PasswordError(self): username and password is error
- def test_login3_empty(self): username and ... | Implement the Python class `LoginTest` described below.
Class description:
Implement the LoginTest class.
Method signatures and docstrings:
- def test_login1_normal(self): username and password is normal
- def test_login2_PasswordError(self): username and password is error
- def test_login3_empty(self): username and ... | 8f41650e31f856f944d9c61a9b8e35f7875f6c03 | <|skeleton|>
class LoginTest:
def test_login1_normal(self):
"""username and password is normal"""
<|body_0|>
def test_login2_PasswordError(self):
"""username and password is error"""
<|body_1|>
def test_login3_empty(self):
"""username and passwd is empty"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LoginTest:
def test_login1_normal(self):
"""username and password is normal"""
print('test_login1_normal is start test...')
po = LoginPage(self.driver)
po.Login_action(u'鹿太太', 123456)
sleep(3)
self.assertEqual(po.type_loginPass_hint(), u'我的空间')
function.... | the_stack_v2_python_sparse | webdriver/AutoTest_Project/Website/test_case/test_login.py | lutaitai/selenium-python | train | 0 | |
d12124a8fb9b85a419f19e752e6167b353b49875 | [
"flag = Flag()\nentered, exited = (False, False)\nasync with until(flag):\n entered = True\n await flag.set()\n exited = True\nassert entered and (not exited)",
"flag = Flag()\nentered, exited = (False, False)\nasync with until(flag) as scope:\n scope.do(flag.set())\n await instant\n entered = T... | <|body_start_0|>
flag = Flag()
entered, exited = (False, False)
async with until(flag):
entered = True
await flag.set()
exited = True
assert entered and (not exited)
<|end_body_0|>
<|body_start_1|>
flag = Flag()
entered, exited = (Fals... | TestContextCondition | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestContextCondition:
async def test_release_self(self):
"""Condition is set synchronously"""
<|body_0|>
async def test_release_concurrent(self):
"""Condition is set concurrently"""
<|body_1|>
async def test_release_early(self):
"""Condition is s... | stack_v2_sparse_classes_75kplus_train_008815 | 4,106 | permissive | [
{
"docstring": "Condition is set synchronously",
"name": "test_release_self",
"signature": "async def test_release_self(self)"
},
{
"docstring": "Condition is set concurrently",
"name": "test_release_concurrent",
"signature": "async def test_release_concurrent(self)"
},
{
"docstr... | 3 | null | Implement the Python class `TestContextCondition` described below.
Class description:
Implement the TestContextCondition class.
Method signatures and docstrings:
- async def test_release_self(self): Condition is set synchronously
- async def test_release_concurrent(self): Condition is set concurrently
- async def tes... | Implement the Python class `TestContextCondition` described below.
Class description:
Implement the TestContextCondition class.
Method signatures and docstrings:
- async def test_release_self(self): Condition is set synchronously
- async def test_release_concurrent(self): Condition is set concurrently
- async def tes... | 28615825fbe23140bbf9efe63fb18410f9453441 | <|skeleton|>
class TestContextCondition:
async def test_release_self(self):
"""Condition is set synchronously"""
<|body_0|>
async def test_release_concurrent(self):
"""Condition is set concurrently"""
<|body_1|>
async def test_release_early(self):
"""Condition is s... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestContextCondition:
async def test_release_self(self):
"""Condition is set synchronously"""
flag = Flag()
entered, exited = (False, False)
async with until(flag):
entered = True
await flag.set()
exited = True
assert entered and (not... | the_stack_v2_python_sparse | usim_pytest/test_types/test_condition.py | MaineKuehn/usim | train | 18 | |
88ce75a526556da2601f88d08cb3bdf460b9b951 | [
"fields = []\ncondition = '1 = 1'\nvalues = []\nif not self.util.is_empty('shop_id', params):\n condition += ' and shop_id = %s'\n values.append(params['shop_id'])\nresult = await self.find(self.tbl_shop, {self.sql_constants.FIELDS: fields, self.sql_constants.CONDITION: condition}, tuple(values))\nreturn resu... | <|body_start_0|>
fields = []
condition = '1 = 1'
values = []
if not self.util.is_empty('shop_id', params):
condition += ' and shop_id = %s'
values.append(params['shop_id'])
result = await self.find(self.tbl_shop, {self.sql_constants.FIELDS: fields, self.sq... | Model | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Model:
async def query_one(self, params):
"""查询店铺信息(单条) @param params: @return:"""
<|body_0|>
async def create(self, params):
"""创建店铺 同时会创建超管和管理员分组数据 @param params: @return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
fields = []
conditi... | stack_v2_sparse_classes_75kplus_train_008816 | 1,814 | no_license | [
{
"docstring": "查询店铺信息(单条) @param params: @return:",
"name": "query_one",
"signature": "async def query_one(self, params)"
},
{
"docstring": "创建店铺 同时会创建超管和管理员分组数据 @param params: @return:",
"name": "create",
"signature": "async def create(self, params)"
}
] | 2 | stack_v2_sparse_classes_30k_train_004182 | Implement the Python class `Model` described below.
Class description:
Implement the Model class.
Method signatures and docstrings:
- async def query_one(self, params): 查询店铺信息(单条) @param params: @return:
- async def create(self, params): 创建店铺 同时会创建超管和管理员分组数据 @param params: @return: | Implement the Python class `Model` described below.
Class description:
Implement the Model class.
Method signatures and docstrings:
- async def query_one(self, params): 查询店铺信息(单条) @param params: @return:
- async def create(self, params): 创建店铺 同时会创建超管和管理员分组数据 @param params: @return:
<|skeleton|>
class Model:
asy... | 9ab7dc87b678fc2a105cf883448cb7aada8494d2 | <|skeleton|>
class Model:
async def query_one(self, params):
"""查询店铺信息(单条) @param params: @return:"""
<|body_0|>
async def create(self, params):
"""创建店铺 同时会创建超管和管理员分组数据 @param params: @return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Model:
async def query_one(self, params):
"""查询店铺信息(单条) @param params: @return:"""
fields = []
condition = '1 = 1'
values = []
if not self.util.is_empty('shop_id', params):
condition += ' and shop_id = %s'
values.append(params['shop_id'])
... | the_stack_v2_python_sparse | src/module/v1/shop/model.py | yuiitsu/DSSP | train | 0 | |
1bad425a9fc17a60774b2f4552df8c9ac532c134 | [
"sim = CommonSimUtils.get_sim_instance(sim_info)\nif sim is None:\n return False\nclub_service = services.get_club_service()\nif club_service is None:\n return False\nreturn sim in club_service.sims_to_gatherings_map",
"if sim_info is None:\n return None\nclub_service = services.get_club_service()\nif cl... | <|body_start_0|>
sim = CommonSimUtils.get_sim_instance(sim_info)
if sim is None:
return False
club_service = services.get_club_service()
if club_service is None:
return False
return sim in club_service.sims_to_gatherings_map
<|end_body_0|>
<|body_start_1|... | Utilities for manipulating the Clubs of Sims. | CommonSimClubUtils | [
"CC-BY-4.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CommonSimClubUtils:
"""Utilities for manipulating the Clubs of Sims."""
def is_engaged_in_club_gathering(sim_info: SimInfo) -> bool:
"""is_engaged_in_club_gathering(sim_info) Determine if a Sim is engaged in a Club Gathering. :param sim_info: An instance of a Sim. :type sim_info: Sim... | stack_v2_sparse_classes_75kplus_train_008817 | 5,456 | permissive | [
{
"docstring": "is_engaged_in_club_gathering(sim_info) Determine if a Sim is engaged in a Club Gathering. :param sim_info: An instance of a Sim. :type sim_info: SimInfo :return: True, if the Sim is engaged in a Club Gathering. False, if not. :rtype: bool",
"name": "is_engaged_in_club_gathering",
"signat... | 5 | stack_v2_sparse_classes_30k_train_044985 | Implement the Python class `CommonSimClubUtils` described below.
Class description:
Utilities for manipulating the Clubs of Sims.
Method signatures and docstrings:
- def is_engaged_in_club_gathering(sim_info: SimInfo) -> bool: is_engaged_in_club_gathering(sim_info) Determine if a Sim is engaged in a Club Gathering. :... | Implement the Python class `CommonSimClubUtils` described below.
Class description:
Utilities for manipulating the Clubs of Sims.
Method signatures and docstrings:
- def is_engaged_in_club_gathering(sim_info: SimInfo) -> bool: is_engaged_in_club_gathering(sim_info) Determine if a Sim is engaged in a Club Gathering. :... | 58e7beb30b9c818b294d35abd2436a0192cd3e82 | <|skeleton|>
class CommonSimClubUtils:
"""Utilities for manipulating the Clubs of Sims."""
def is_engaged_in_club_gathering(sim_info: SimInfo) -> bool:
"""is_engaged_in_club_gathering(sim_info) Determine if a Sim is engaged in a Club Gathering. :param sim_info: An instance of a Sim. :type sim_info: Sim... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CommonSimClubUtils:
"""Utilities for manipulating the Clubs of Sims."""
def is_engaged_in_club_gathering(sim_info: SimInfo) -> bool:
"""is_engaged_in_club_gathering(sim_info) Determine if a Sim is engaged in a Club Gathering. :param sim_info: An instance of a Sim. :type sim_info: SimInfo :return:... | the_stack_v2_python_sparse | Scripts/sims4communitylib/utils/sims/common_sim_club_utils.py | ColonolNutty/Sims4CommunityLibrary | train | 183 |
b9862939e6eaec923acf21e405a2d81220b13a5a | [
"PredictiveModel.__init__(self, dataframe, x_axis, y_axis)\nself._x_coeff = None\nself._y_coeff = None",
"coeff, y_int = self.get_details()\nbase_df = pd.DataFrame(self._handle_until(until, increment_by))\nbase_df.loc[:, self._y_axis] = self._df[self._y_axis]\npredict = coeff * base_df[self._x_axis] + y_int\ncolu... | <|body_start_0|>
PredictiveModel.__init__(self, dataframe, x_axis, y_axis)
self._x_coeff = None
self._y_coeff = None
<|end_body_0|>
<|body_start_1|>
coeff, y_int = self.get_details()
base_df = pd.DataFrame(self._handle_until(until, increment_by))
base_df.loc[:, self._y_a... | A predictive model that uses linear regression | LinearRegressionModel | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LinearRegressionModel:
"""A predictive model that uses linear regression"""
def __init__(self, dataframe, x_axis, y_axis):
"""(PredictiveModel, DataFrame, str, str) -> None Initializes a linear regression model"""
<|body_0|>
def get_model(self, until=None, increment_by=1... | stack_v2_sparse_classes_75kplus_train_008818 | 2,549 | no_license | [
{
"docstring": "(PredictiveModel, DataFrame, str, str) -> None Initializes a linear regression model",
"name": "__init__",
"signature": "def __init__(self, dataframe, x_axis, y_axis)"
},
{
"docstring": "(PredictiveModel, float, float) -> (Dataframe, str) Returns the a DataFrame of the passed x, ... | 3 | null | Implement the Python class `LinearRegressionModel` described below.
Class description:
A predictive model that uses linear regression
Method signatures and docstrings:
- def __init__(self, dataframe, x_axis, y_axis): (PredictiveModel, DataFrame, str, str) -> None Initializes a linear regression model
- def get_model(... | Implement the Python class `LinearRegressionModel` described below.
Class description:
A predictive model that uses linear regression
Method signatures and docstrings:
- def __init__(self, dataframe, x_axis, y_axis): (PredictiveModel, DataFrame, str, str) -> None Initializes a linear regression model
- def get_model(... | 6ff9a2a24e6399a2aa76dc67bb331f2ca3c6f91e | <|skeleton|>
class LinearRegressionModel:
"""A predictive model that uses linear regression"""
def __init__(self, dataframe, x_axis, y_axis):
"""(PredictiveModel, DataFrame, str, str) -> None Initializes a linear regression model"""
<|body_0|>
def get_model(self, until=None, increment_by=1... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LinearRegressionModel:
"""A predictive model that uses linear regression"""
def __init__(self, dataframe, x_axis, y_axis):
"""(PredictiveModel, DataFrame, str, str) -> None Initializes a linear regression model"""
PredictiveModel.__init__(self, dataframe, x_axis, y_axis)
self._x_c... | the_stack_v2_python_sparse | src/predictive_analysis/linear_regression_model.py | obDann/TEQApp | train | 0 |
afc0fdc7fcbc6036770d940b49738d099d6206b1 | [
"self.aurora_cluster_info = aurora_cluster_info\nself.aws_iam_role = aws_iam_role\nself.excluded_object_ids_vec = excluded_object_ids_vec\nself.object_level_params_vec = object_level_params_vec\nself.s3_bucket_prefix = s3_bucket_prefix",
"if dictionary is None:\n return None\naurora_cluster_info = cohesity_man... | <|body_start_0|>
self.aurora_cluster_info = aurora_cluster_info
self.aws_iam_role = aws_iam_role
self.excluded_object_ids_vec = excluded_object_ids_vec
self.object_level_params_vec = object_level_params_vec
self.s3_bucket_prefix = s3_bucket_prefix
<|end_body_0|>
<|body_start_1|>... | Implementation of the 'SfdcBackupSourceParamsProto' model. Message to capture additional backup params for an Sfdc source. This proto is used in object based protection of Sfdc source. Attributes: aurora_cluster_info (AuroraClusterInfo): Details about the AuroraCluster to be used for this object protection. aws_iam_rol... | SfdcBackupSourceParamsProto | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SfdcBackupSourceParamsProto:
"""Implementation of the 'SfdcBackupSourceParamsProto' model. Message to capture additional backup params for an Sfdc source. This proto is used in object based protection of Sfdc source. Attributes: aurora_cluster_info (AuroraClusterInfo): Details about the AuroraClu... | stack_v2_sparse_classes_75kplus_train_008819 | 3,718 | permissive | [
{
"docstring": "Constructor for the SfdcBackupSourceParamsProto class",
"name": "__init__",
"signature": "def __init__(self, aurora_cluster_info=None, aws_iam_role=None, excluded_object_ids_vec=None, object_level_params_vec=None, s3_bucket_prefix=None)"
},
{
"docstring": "Creates an instance of ... | 2 | null | Implement the Python class `SfdcBackupSourceParamsProto` described below.
Class description:
Implementation of the 'SfdcBackupSourceParamsProto' model. Message to capture additional backup params for an Sfdc source. This proto is used in object based protection of Sfdc source. Attributes: aurora_cluster_info (AuroraCl... | Implement the Python class `SfdcBackupSourceParamsProto` described below.
Class description:
Implementation of the 'SfdcBackupSourceParamsProto' model. Message to capture additional backup params for an Sfdc source. This proto is used in object based protection of Sfdc source. Attributes: aurora_cluster_info (AuroraCl... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class SfdcBackupSourceParamsProto:
"""Implementation of the 'SfdcBackupSourceParamsProto' model. Message to capture additional backup params for an Sfdc source. This proto is used in object based protection of Sfdc source. Attributes: aurora_cluster_info (AuroraClusterInfo): Details about the AuroraClu... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SfdcBackupSourceParamsProto:
"""Implementation of the 'SfdcBackupSourceParamsProto' model. Message to capture additional backup params for an Sfdc source. This proto is used in object based protection of Sfdc source. Attributes: aurora_cluster_info (AuroraClusterInfo): Details about the AuroraCluster to be us... | the_stack_v2_python_sparse | cohesity_management_sdk/models/sfdc_backup_source_params_proto.py | cohesity/management-sdk-python | train | 24 |
eab742be4efa01cb84f5fa858663c70b9d639534 | [
"now_date = datetime.now(timezone.utc)\nif object.aktif:\n pub_date = object.yaratilma_tarihi\n return timesince(pub_date, now_date)\nelse:\n return 'Makale aktif değil, lütfen ilk önce makaleyi aktif ediniz.'",
"if pub_date > date.today():\n raise serializers.ValidationError('Yayımlanma tarihi ileri ... | <|body_start_0|>
now_date = datetime.now(timezone.utc)
if object.aktif:
pub_date = object.yaratilma_tarihi
return timesince(pub_date, now_date)
else:
return 'Makale aktif değil, lütfen ilk önce makaleyi aktif ediniz.'
<|end_body_0|>
<|body_start_1|>
i... | ModelSerializer ile daha kolay ve hızlı bir biçimde serializer'ımızı oluşturabiliriz. | MakaleSerializer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MakaleSerializer:
"""ModelSerializer ile daha kolay ve hızlı bir biçimde serializer'ımızı oluşturabiliriz."""
def get_time_pub(self, object):
"""Object Validation. Yaratılma tarihinin üzerinden ne kadar zaman geçtiğini hesaplayıp json içerisinde yeni bir attribute olarak gösterebildi... | stack_v2_sparse_classes_75kplus_train_008820 | 4,989 | no_license | [
{
"docstring": "Object Validation. Yaratılma tarihinin üzerinden ne kadar zaman geçtiğini hesaplayıp json içerisinde yeni bir attribute olarak gösterebildiğimiz fonksiyon.",
"name": "get_time_pub",
"signature": "def get_time_pub(self, object)"
},
{
"docstring": "Field Validation. Ileri bir yayım... | 2 | stack_v2_sparse_classes_30k_train_045036 | Implement the Python class `MakaleSerializer` described below.
Class description:
ModelSerializer ile daha kolay ve hızlı bir biçimde serializer'ımızı oluşturabiliriz.
Method signatures and docstrings:
- def get_time_pub(self, object): Object Validation. Yaratılma tarihinin üzerinden ne kadar zaman geçtiğini hesaplay... | Implement the Python class `MakaleSerializer` described below.
Class description:
ModelSerializer ile daha kolay ve hızlı bir biçimde serializer'ımızı oluşturabiliriz.
Method signatures and docstrings:
- def get_time_pub(self, object): Object Validation. Yaratılma tarihinin üzerinden ne kadar zaman geçtiğini hesaplay... | 3c055f8698ac777bf44c294046ed8c0aa59ee247 | <|skeleton|>
class MakaleSerializer:
"""ModelSerializer ile daha kolay ve hızlı bir biçimde serializer'ımızı oluşturabiliriz."""
def get_time_pub(self, object):
"""Object Validation. Yaratılma tarihinin üzerinden ne kadar zaman geçtiğini hesaplayıp json içerisinde yeni bir attribute olarak gösterebildi... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MakaleSerializer:
"""ModelSerializer ile daha kolay ve hızlı bir biçimde serializer'ımızı oluşturabiliriz."""
def get_time_pub(self, object):
"""Object Validation. Yaratılma tarihinin üzerinden ne kadar zaman geçtiğini hesaplayıp json içerisinde yeni bir attribute olarak gösterebildiğimiz fonksiy... | the_stack_v2_python_sparse | Django Apps/haber_djangorest/main/api/serializers.py | uysalserkan/Python-Topics | train | 4 |
7e211fd2c0414dcfea889002ba45d2d8c6c78b07 | [
"try:\n project = await self.application.objects.get(Project, id=int(project_id))\n await self.application.objects.delete(project)\n return self.json(JsonResponse(code=1, data={'id': project_id}))\nexcept Project.DoesNotExist:\n self.set_status(400)\n return self.json(JsonResponse(code=10007))",
"p... | <|body_start_0|>
try:
project = await self.application.objects.get(Project, id=int(project_id))
await self.application.objects.delete(project)
return self.json(JsonResponse(code=1, data={'id': project_id}))
except Project.DoesNotExist:
self.set_status(400)... | ProjectChangeHandler | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProjectChangeHandler:
async def delete(self, project_id, *args, **kwargs):
"""删除项目数据 :param project_id: 删除的项目id"""
<|body_0|>
async def patch(self, project_id, *args, **kwargs):
"""更新项目数据 :param project_id: 更新的项目id"""
<|body_1|>
<|end_skeleton|>
<|body_star... | stack_v2_sparse_classes_75kplus_train_008821 | 17,374 | permissive | [
{
"docstring": "删除项目数据 :param project_id: 删除的项目id",
"name": "delete",
"signature": "async def delete(self, project_id, *args, **kwargs)"
},
{
"docstring": "更新项目数据 :param project_id: 更新的项目id",
"name": "patch",
"signature": "async def patch(self, project_id, *args, **kwargs)"
}
] | 2 | stack_v2_sparse_classes_30k_train_053953 | Implement the Python class `ProjectChangeHandler` described below.
Class description:
Implement the ProjectChangeHandler class.
Method signatures and docstrings:
- async def delete(self, project_id, *args, **kwargs): 删除项目数据 :param project_id: 删除的项目id
- async def patch(self, project_id, *args, **kwargs): 更新项目数据 :param... | Implement the Python class `ProjectChangeHandler` described below.
Class description:
Implement the ProjectChangeHandler class.
Method signatures and docstrings:
- async def delete(self, project_id, *args, **kwargs): 删除项目数据 :param project_id: 删除的项目id
- async def patch(self, project_id, *args, **kwargs): 更新项目数据 :param... | dc9b4c55f0b3ace180c30b7f080eb5d88bb38fdb | <|skeleton|>
class ProjectChangeHandler:
async def delete(self, project_id, *args, **kwargs):
"""删除项目数据 :param project_id: 删除的项目id"""
<|body_0|>
async def patch(self, project_id, *args, **kwargs):
"""更新项目数据 :param project_id: 更新的项目id"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ProjectChangeHandler:
async def delete(self, project_id, *args, **kwargs):
"""删除项目数据 :param project_id: 删除的项目id"""
try:
project = await self.application.objects.get(Project, id=int(project_id))
await self.application.objects.delete(project)
return self.json(... | the_stack_v2_python_sparse | apps/project/handlers.py | xiaoxiaolulu/MagicTestPlatform | train | 5 | |
9a7d92272274b2a267bead81e1f16bc57496063a | [
"super().__init__(clk, clk_edge, rst, **kwargs)\nself.rst = rst\nself.lvl = rst_lvl\nself.edge = clk_edge",
"@wraps(fn)\ndef wrapper_ClockedRstBlock(*args, **kwargs):\n seq = self.get(self.clk, self.rst, self.edge, self.lvl)\n fn(seq, *args, **kwargs)\n return seq\nreturn wrapper_ClockedRstBlock",
"seq... | <|body_start_0|>
super().__init__(clk, clk_edge, rst, **kwargs)
self.rst = rst
self.lvl = rst_lvl
self.edge = clk_edge
<|end_body_0|>
<|body_start_1|>
@wraps(fn)
def wrapper_ClockedRstBlock(*args, **kwargs):
seq = self.get(self.clk, self.rst, self.edge, self.... | Clocked sequential block with reset. | ClockedRstBlock | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ClockedRstBlock:
"""Clocked sequential block with reset."""
def __init__(self, clk, rst, clk_edge='rise', rst_lvl=1, **kwargs):
"""Initialize."""
<|body_0|>
def __call__(self, fn):
"""Decorate."""
<|body_1|>
def get(clk, rst, edge='rise', lvl=1):
... | stack_v2_sparse_classes_75kplus_train_008822 | 6,509 | permissive | [
{
"docstring": "Initialize.",
"name": "__init__",
"signature": "def __init__(self, clk, rst, clk_edge='rise', rst_lvl=1, **kwargs)"
},
{
"docstring": "Decorate.",
"name": "__call__",
"signature": "def __call__(self, fn)"
},
{
"docstring": "Get sequential block.",
"name": "get... | 3 | null | Implement the Python class `ClockedRstBlock` described below.
Class description:
Clocked sequential block with reset.
Method signatures and docstrings:
- def __init__(self, clk, rst, clk_edge='rise', rst_lvl=1, **kwargs): Initialize.
- def __call__(self, fn): Decorate.
- def get(clk, rst, edge='rise', lvl=1): Get seq... | Implement the Python class `ClockedRstBlock` described below.
Class description:
Clocked sequential block with reset.
Method signatures and docstrings:
- def __init__(self, clk, rst, clk_edge='rise', rst_lvl=1, **kwargs): Initialize.
- def __call__(self, fn): Decorate.
- def get(clk, rst, edge='rise', lvl=1): Get seq... | 463412cf6a72456acc8cb99569e7dc9c9d472f6d | <|skeleton|>
class ClockedRstBlock:
"""Clocked sequential block with reset."""
def __init__(self, clk, rst, clk_edge='rise', rst_lvl=1, **kwargs):
"""Initialize."""
<|body_0|>
def __call__(self, fn):
"""Decorate."""
<|body_1|>
def get(clk, rst, edge='rise', lvl=1):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ClockedRstBlock:
"""Clocked sequential block with reset."""
def __init__(self, clk, rst, clk_edge='rise', rst_lvl=1, **kwargs):
"""Initialize."""
super().__init__(clk, clk_edge, rst, **kwargs)
self.rst = rst
self.lvl = rst_lvl
self.edge = clk_edge
def __call__... | the_stack_v2_python_sparse | hdltools/hdllib/patterns.py | brunosmmm/hdltools | train | 2 |
5680cf4e8db928d8ecb15034e0f75ccf59bb755f | [
"if not any((key.startswith('cat_') for key in kwargs.keys())):\n kwargs['cat_pattern'] = CAT_PATTERN\nCategorizedCorpusReader.__init__(self, kwargs)\nCorpusReader.__init__(self, root, fileids)",
"if fileids is not None and categories is not None:\n raise ValueError('Specify fileids or categories, not both'... | <|body_start_0|>
if not any((key.startswith('cat_') for key in kwargs.keys())):
kwargs['cat_pattern'] = CAT_PATTERN
CategorizedCorpusReader.__init__(self, kwargs)
CorpusReader.__init__(self, root, fileids)
<|end_body_0|>
<|body_start_1|>
if fileids is not None and categories... | PickledCorpusReader | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PickledCorpusReader:
def __init__(self, root, fileids=PKL_PATTERN, **kwargs):
"""Initialize the corpus reader. Categorization arguments (``cat_pattern``, ``cat_map``, and ``cat_file``) are passed to the ``CategorizedCorpusReader`` constructor. The remaining arguments are passed to the ``... | stack_v2_sparse_classes_75kplus_train_008823 | 7,518 | no_license | [
{
"docstring": "Initialize the corpus reader. Categorization arguments (``cat_pattern``, ``cat_map``, and ``cat_file``) are passed to the ``CategorizedCorpusReader`` constructor. The remaining arguments are passed to the ``CorpusReader`` constructor.",
"name": "__init__",
"signature": "def __init__(self... | 6 | stack_v2_sparse_classes_30k_train_012029 | Implement the Python class `PickledCorpusReader` described below.
Class description:
Implement the PickledCorpusReader class.
Method signatures and docstrings:
- def __init__(self, root, fileids=PKL_PATTERN, **kwargs): Initialize the corpus reader. Categorization arguments (``cat_pattern``, ``cat_map``, and ``cat_fil... | Implement the Python class `PickledCorpusReader` described below.
Class description:
Implement the PickledCorpusReader class.
Method signatures and docstrings:
- def __init__(self, root, fileids=PKL_PATTERN, **kwargs): Initialize the corpus reader. Categorization arguments (``cat_pattern``, ``cat_map``, and ``cat_fil... | 4f1b1f23d36844d4f27c0205e3e62592d7de006e | <|skeleton|>
class PickledCorpusReader:
def __init__(self, root, fileids=PKL_PATTERN, **kwargs):
"""Initialize the corpus reader. Categorization arguments (``cat_pattern``, ``cat_map``, and ``cat_file``) are passed to the ``CategorizedCorpusReader`` constructor. The remaining arguments are passed to the ``... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PickledCorpusReader:
def __init__(self, root, fileids=PKL_PATTERN, **kwargs):
"""Initialize the corpus reader. Categorization arguments (``cat_pattern``, ``cat_map``, and ``cat_file``) are passed to the ``CategorizedCorpusReader`` constructor. The remaining arguments are passed to the ``CorpusReader``... | the_stack_v2_python_sparse | vectorization/vectorization.py | jmarusak/nlp | train | 0 | |
2958add66dc7611b7228a0680f445c9291953189 | [
"time = timezone.now() + datetime.timedelta(days=30)\nfuture_question = Question(pub_date=time)\nself.assertIs(future_question.was_published_recently(), False)",
"time = timezone.now() - datetime.timedelta(days=1, seconds=1)\nold_question = Question(pub_date=time)\nself.assertIs(old_question.was_published_recentl... | <|body_start_0|>
time = timezone.now() + datetime.timedelta(days=30)
future_question = Question(pub_date=time)
self.assertIs(future_question.was_published_recently(), False)
<|end_body_0|>
<|body_start_1|>
time = timezone.now() - datetime.timedelta(days=1, seconds=1)
old_questio... | QuestionModelTests | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class QuestionModelTests:
def test_was_published_recently_with_future_question(self):
"""was_published_recently() returns False for questions whose pub_date is in the future."""
<|body_0|>
def test_was_published_recently_with_old_question(self):
"""was_published_recently()... | stack_v2_sparse_classes_75kplus_train_008824 | 15,128 | no_license | [
{
"docstring": "was_published_recently() returns False for questions whose pub_date is in the future.",
"name": "test_was_published_recently_with_future_question",
"signature": "def test_was_published_recently_with_future_question(self)"
},
{
"docstring": "was_published_recently() returns False ... | 3 | stack_v2_sparse_classes_30k_train_006894 | Implement the Python class `QuestionModelTests` described below.
Class description:
Implement the QuestionModelTests class.
Method signatures and docstrings:
- def test_was_published_recently_with_future_question(self): was_published_recently() returns False for questions whose pub_date is in the future.
- def test_w... | Implement the Python class `QuestionModelTests` described below.
Class description:
Implement the QuestionModelTests class.
Method signatures and docstrings:
- def test_was_published_recently_with_future_question(self): was_published_recently() returns False for questions whose pub_date is in the future.
- def test_w... | b87ed454c539ce172795c952fafccbc81693006d | <|skeleton|>
class QuestionModelTests:
def test_was_published_recently_with_future_question(self):
"""was_published_recently() returns False for questions whose pub_date is in the future."""
<|body_0|>
def test_was_published_recently_with_old_question(self):
"""was_published_recently()... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class QuestionModelTests:
def test_was_published_recently_with_future_question(self):
"""was_published_recently() returns False for questions whose pub_date is in the future."""
time = timezone.now() + datetime.timedelta(days=30)
future_question = Question(pub_date=time)
self.assertI... | the_stack_v2_python_sparse | polls/tests.py | arizakevin/Pollster | train | 0 | |
35134a0b7f7b9fa786f613844caaffa15f45440d | [
"storage = get_storage()\nvalues = storage.read_report_values(report_id)\nreturn jsonify(values)",
"raw_values = request.get_json()\ntry:\n report_values = ReportValuesPostSchema().load(raw_values)\nexcept ValidationError as err:\n raise BadAPIRequest(err.messages)\nstorage = get_storage()\nvalue_id = stora... | <|body_start_0|>
storage = get_storage()
values = storage.read_report_values(report_id)
return jsonify(values)
<|end_body_0|>
<|body_start_1|>
raw_values = request.get_json()
try:
report_values = ReportValuesPostSchema().load(raw_values)
except ValidationErro... | ReportValuesView | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ReportValuesView:
def get(self, report_id):
"""--- summary: Get the processed values used in a report tags: - Reports parameters: - report_id responses: 200: description: Successfully retrieved content: application/json: schema: $ref: '#/components/schemas/ReportValuesSchema' 401: $ref: ... | stack_v2_sparse_classes_75kplus_train_008825 | 15,383 | permissive | [
{
"docstring": "--- summary: Get the processed values used in a report tags: - Reports parameters: - report_id responses: 200: description: Successfully retrieved content: application/json: schema: $ref: '#/components/schemas/ReportValuesSchema' 401: $ref: '#/components/responses/401-Unauthorized' 404: $ref: '#... | 2 | null | Implement the Python class `ReportValuesView` described below.
Class description:
Implement the ReportValuesView class.
Method signatures and docstrings:
- def get(self, report_id): --- summary: Get the processed values used in a report tags: - Reports parameters: - report_id responses: 200: description: Successfully... | Implement the Python class `ReportValuesView` described below.
Class description:
Implement the ReportValuesView class.
Method signatures and docstrings:
- def get(self, report_id): --- summary: Get the processed values used in a report tags: - Reports parameters: - report_id responses: 200: description: Successfully... | 280800c73eb7cfd49029462b352887e78f1ff91b | <|skeleton|>
class ReportValuesView:
def get(self, report_id):
"""--- summary: Get the processed values used in a report tags: - Reports parameters: - report_id responses: 200: description: Successfully retrieved content: application/json: schema: $ref: '#/components/schemas/ReportValuesSchema' 401: $ref: ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ReportValuesView:
def get(self, report_id):
"""--- summary: Get the processed values used in a report tags: - Reports parameters: - report_id responses: 200: description: Successfully retrieved content: application/json: schema: $ref: '#/components/schemas/ReportValuesSchema' 401: $ref: '#/components/... | the_stack_v2_python_sparse | sfa_api/reports.py | SolarArbiter/solarforecastarbiter-api | train | 9 | |
95ad40702480c8e4793ba8be143461ed32fddb4a | [
"self._name = name\nself._freevars = freevars\nself._extra_locals = extra_locals\nself._unbound_factory = None\nself.module = None\nself.source_map = None",
"if self._unbound_factory is not None:\n raise ValueError('double initialization; create a new object instead')\ninner_factory_name = namer.new_symbol(inn... | <|body_start_0|>
self._name = name
self._freevars = freevars
self._extra_locals = extra_locals
self._unbound_factory = None
self.module = None
self.source_map = None
<|end_body_0|>
<|body_start_1|>
if self._unbound_factory is not None:
raise ValueErro... | Helper object that wraps a Python function factory. | _PythonFnFactory | [
"Apache-2.0",
"LicenseRef-scancode-generic-cla",
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _PythonFnFactory:
"""Helper object that wraps a Python function factory."""
def __init__(self, name, freevars, extra_locals):
"""Creates a new factory for a Python function. Args: name: The function name. freevars: The list of non-global free variables for the function. extra_locals:... | stack_v2_sparse_classes_75kplus_train_008826 | 17,496 | permissive | [
{
"docstring": "Creates a new factory for a Python function. Args: name: The function name. freevars: The list of non-global free variables for the function. extra_locals: Dict[Text, Any], names and values for custom variables that are accessible to the generated code as local variables.",
"name": "__init__... | 3 | stack_v2_sparse_classes_30k_train_025151 | Implement the Python class `_PythonFnFactory` described below.
Class description:
Helper object that wraps a Python function factory.
Method signatures and docstrings:
- def __init__(self, name, freevars, extra_locals): Creates a new factory for a Python function. Args: name: The function name. freevars: The list of ... | Implement the Python class `_PythonFnFactory` described below.
Class description:
Helper object that wraps a Python function factory.
Method signatures and docstrings:
- def __init__(self, name, freevars, extra_locals): Creates a new factory for a Python function. Args: name: The function name. freevars: The list of ... | a7f3934a67900720af3d3b15389551483bee50b8 | <|skeleton|>
class _PythonFnFactory:
"""Helper object that wraps a Python function factory."""
def __init__(self, name, freevars, extra_locals):
"""Creates a new factory for a Python function. Args: name: The function name. freevars: The list of non-global free variables for the function. extra_locals:... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class _PythonFnFactory:
"""Helper object that wraps a Python function factory."""
def __init__(self, name, freevars, extra_locals):
"""Creates a new factory for a Python function. Args: name: The function name. freevars: The list of non-global free variables for the function. extra_locals: Dict[Text, A... | the_stack_v2_python_sparse | tensorflow/python/autograph/pyct/transpiler.py | tensorflow/tensorflow | train | 208,740 |
1d4bf16cede0f8688702ef4f98dc7ea51d318dc6 | [
"if root is None:\n return 0\nleft_height = self.maxDepth(root.left)\nright_height = self.maxDepth(root.right)\nreturn max(left_height, right_height) + 1",
"stack = []\nif root is not None:\n stack.append((1, root))\ndepth = 0\nwhile stack != []:\n current_depth, root = stack.pop()\n if root is not No... | <|body_start_0|>
if root is None:
return 0
left_height = self.maxDepth(root.left)
right_height = self.maxDepth(root.right)
return max(left_height, right_height) + 1
<|end_body_0|>
<|body_start_1|>
stack = []
if root is not None:
stack.append((1, r... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxDepth(self, root: TreeNode) -> int:
"""递归实现 DFS"""
<|body_0|>
def maxDepth2(self, root: TreeNode) -> int:
"""栈实现 DFS 76 ms 14.9 MB"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if root is None:
return 0
left_he... | stack_v2_sparse_classes_75kplus_train_008827 | 1,790 | no_license | [
{
"docstring": "递归实现 DFS",
"name": "maxDepth",
"signature": "def maxDepth(self, root: TreeNode) -> int"
},
{
"docstring": "栈实现 DFS 76 ms 14.9 MB",
"name": "maxDepth2",
"signature": "def maxDepth2(self, root: TreeNode) -> int"
}
] | 2 | stack_v2_sparse_classes_30k_train_007116 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxDepth(self, root: TreeNode) -> int: 递归实现 DFS
- def maxDepth2(self, root: TreeNode) -> int: 栈实现 DFS 76 ms 14.9 MB | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxDepth(self, root: TreeNode) -> int: 递归实现 DFS
- def maxDepth2(self, root: TreeNode) -> int: 栈实现 DFS 76 ms 14.9 MB
<|skeleton|>
class Solution:
def maxDepth(self, root... | 40726506802d2d60028fdce206696b1df2f63ece | <|skeleton|>
class Solution:
def maxDepth(self, root: TreeNode) -> int:
"""递归实现 DFS"""
<|body_0|>
def maxDepth2(self, root: TreeNode) -> int:
"""栈实现 DFS 76 ms 14.9 MB"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def maxDepth(self, root: TreeNode) -> int:
"""递归实现 DFS"""
if root is None:
return 0
left_height = self.maxDepth(root.left)
right_height = self.maxDepth(root.right)
return max(left_height, right_height) + 1
def maxDepth2(self, root: TreeNode) -... | the_stack_v2_python_sparse | 算法/maxDepth.py | 1oser5/LeetCode | train | 0 | |
b0f4d590cd91afffdbde0e552dd8b3d40e70b4c0 | [
"super(CPlaneEdgeEmbedding, self).__init__(connection, 'CPlaneEdgeEmbedding', vsdn_id)\nself._logical_edge_id = logical_edge_id\nnode1 = self._connection.get_object(dbi.NetworkNode, start_node_id)\nnode2 = self._connection.get_object(dbi.NetworkNode, target_node_id)\nself._switch = None\nself._controller = None\nif... | <|body_start_0|>
super(CPlaneEdgeEmbedding, self).__init__(connection, 'CPlaneEdgeEmbedding', vsdn_id)
self._logical_edge_id = logical_edge_id
node1 = self._connection.get_object(dbi.NetworkNode, start_node_id)
node2 = self._connection.get_object(dbi.NetworkNode, target_node_id)
... | Class for embedding a logical link in the control plane. This type of link connects tennant controller to control network. | CPlaneEdgeEmbedding | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CPlaneEdgeEmbedding:
"""Class for embedding a logical link in the control plane. This type of link connects tennant controller to control network."""
def __init__(self, connection, vsdn_id, start_node_id, target_node_id, logical_edge_id):
"""Initializes object. Args: connection (data... | stack_v2_sparse_classes_75kplus_train_008828 | 25,606 | no_license | [
{
"docstring": "Initializes object. Args: connection (data.dbinterfaces.StormConnector): connection to database vsdn_id (int): Id for Vsdn edge belongs to start_node_id (int): ID of one endpoint of the edge target_node_id (int): ID of second endpoint of edge logical_edge_id (int): ID of corresponding logical ed... | 4 | null | Implement the Python class `CPlaneEdgeEmbedding` described below.
Class description:
Class for embedding a logical link in the control plane. This type of link connects tennant controller to control network.
Method signatures and docstrings:
- def __init__(self, connection, vsdn_id, start_node_id, target_node_id, log... | Implement the Python class `CPlaneEdgeEmbedding` described below.
Class description:
Class for embedding a logical link in the control plane. This type of link connects tennant controller to control network.
Method signatures and docstrings:
- def __init__(self, connection, vsdn_id, start_node_id, target_node_id, log... | ce8633cd95614696c9b3158fae160a5f104695a8 | <|skeleton|>
class CPlaneEdgeEmbedding:
"""Class for embedding a logical link in the control plane. This type of link connects tennant controller to control network."""
def __init__(self, connection, vsdn_id, start_node_id, target_node_id, logical_edge_id):
"""Initializes object. Args: connection (data... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CPlaneEdgeEmbedding:
"""Class for embedding a logical link in the control plane. This type of link connects tennant controller to control network."""
def __init__(self, connection, vsdn_id, start_node_id, target_node_id, logical_edge_id):
"""Initializes object. Args: connection (data.dbinterfaces... | the_stack_v2_python_sparse | hyperflexcomplete/hyperflexcore/hyperflexcore/intelligence/embedding.py | bornaivankovic/HyperFLEX | train | 0 |
0e9ffe02893a0e2712fa4c2fe0a32ea2f806f9d8 | [
"if len(prices) < 2:\n return 0\ndp = [[0 for _ in range(3)] for _ in range(len(prices))]\ndp[0][0] = 0\ndp[0][1] = -prices[0]\ndp[0][2] = 0\nfor i in range(1, len(prices)):\n dp[i][0] = max(dp[i - 1][2], dp[i - 1][1] + prices[i])\n dp[i][1] = max(dp[i - 1][2] - prices[i], dp[i - 1][1])\n dp[i][2] = max... | <|body_start_0|>
if len(prices) < 2:
return 0
dp = [[0 for _ in range(3)] for _ in range(len(prices))]
dp[0][0] = 0
dp[0][1] = -prices[0]
dp[0][2] = 0
for i in range(1, len(prices)):
dp[i][0] = max(dp[i - 1][2], dp[i - 1][1] + prices[i])
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxProfit(self, prices: List[int]) -> int:
"""动态规划: dp[i][0] 表示第i天 未持有股票,dp[i][1] 表示第i天 持有股票 dp[i][0] 未持有并冻结股票有2种情况: 1. 昨天未持有,今天未持有 2. 昨天持有,今天卖出 dp[i][0] = max(dp[i - 1][0], dp[i - 1][1] + prices[i]) dp[i][1] 持有股票有2种情况: 1. 昨天持有,今天继续持有 2. 前天未持有,今天买入 dp[i][1] = max(dp[i - 1][... | stack_v2_sparse_classes_75kplus_train_008829 | 3,831 | no_license | [
{
"docstring": "动态规划: dp[i][0] 表示第i天 未持有股票,dp[i][1] 表示第i天 持有股票 dp[i][0] 未持有并冻结股票有2种情况: 1. 昨天未持有,今天未持有 2. 昨天持有,今天卖出 dp[i][0] = max(dp[i - 1][0], dp[i - 1][1] + prices[i]) dp[i][1] 持有股票有2种情况: 1. 昨天持有,今天继续持有 2. 前天未持有,今天买入 dp[i][1] = max(dp[i - 1][1], dp[i - 1][2] - prices[i]) dp[i][2] 未持有股票并未冻结的情况: 1. 昨天未持有但被冻结 2.... | 3 | stack_v2_sparse_classes_30k_train_003190 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxProfit(self, prices: List[int]) -> int: 动态规划: dp[i][0] 表示第i天 未持有股票,dp[i][1] 表示第i天 持有股票 dp[i][0] 未持有并冻结股票有2种情况: 1. 昨天未持有,今天未持有 2. 昨天持有,今天卖出 dp[i][0] = max(dp[i - 1][0], dp[... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxProfit(self, prices: List[int]) -> int: 动态规划: dp[i][0] 表示第i天 未持有股票,dp[i][1] 表示第i天 持有股票 dp[i][0] 未持有并冻结股票有2种情况: 1. 昨天未持有,今天未持有 2. 昨天持有,今天卖出 dp[i][0] = max(dp[i - 1][0], dp[... | 9acba92695c06406f12f997a720bfe1deb9464a8 | <|skeleton|>
class Solution:
def maxProfit(self, prices: List[int]) -> int:
"""动态规划: dp[i][0] 表示第i天 未持有股票,dp[i][1] 表示第i天 持有股票 dp[i][0] 未持有并冻结股票有2种情况: 1. 昨天未持有,今天未持有 2. 昨天持有,今天卖出 dp[i][0] = max(dp[i - 1][0], dp[i - 1][1] + prices[i]) dp[i][1] 持有股票有2种情况: 1. 昨天持有,今天继续持有 2. 前天未持有,今天买入 dp[i][1] = max(dp[i - 1][... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def maxProfit(self, prices: List[int]) -> int:
"""动态规划: dp[i][0] 表示第i天 未持有股票,dp[i][1] 表示第i天 持有股票 dp[i][0] 未持有并冻结股票有2种情况: 1. 昨天未持有,今天未持有 2. 昨天持有,今天卖出 dp[i][0] = max(dp[i - 1][0], dp[i - 1][1] + prices[i]) dp[i][1] 持有股票有2种情况: 1. 昨天持有,今天继续持有 2. 前天未持有,今天买入 dp[i][1] = max(dp[i - 1][1], dp[i - 1][... | the_stack_v2_python_sparse | datastructure/dp_exercise/MaxProfit4.py | yinhuax/leet_code | train | 0 | |
8a35436bde9bbdd0a901a119fd6a1817af63f825 | [
"username = self.cleaned_data['username']\nif User.objects.filter(username=username):\n raise forms.ValidationError('Nombre de usuario ya registrado, ingrese otro usuario')\nreturn username",
"email = self.cleaned_data['email']\nif User.objects.filter(email=email):\n raise forms.ValidationError('Correo ya r... | <|body_start_0|>
username = self.cleaned_data['username']
if User.objects.filter(username=username):
raise forms.ValidationError('Nombre de usuario ya registrado, ingrese otro usuario')
return username
<|end_body_0|>
<|body_start_1|>
email = self.cleaned_data['email']
... | UserForm | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserForm:
def clean_username(self):
"""Comprueba que no exista un username igual en la db"""
<|body_0|>
def clean_email(self):
"""Comprueba que no exista un email igual en la db"""
<|body_1|>
def clean_ruc(self):
"""Comprueba que no exista un ema... | stack_v2_sparse_classes_75kplus_train_008830 | 1,667 | no_license | [
{
"docstring": "Comprueba que no exista un username igual en la db",
"name": "clean_username",
"signature": "def clean_username(self)"
},
{
"docstring": "Comprueba que no exista un email igual en la db",
"name": "clean_email",
"signature": "def clean_email(self)"
},
{
"docstring"... | 3 | null | Implement the Python class `UserForm` described below.
Class description:
Implement the UserForm class.
Method signatures and docstrings:
- def clean_username(self): Comprueba que no exista un username igual en la db
- def clean_email(self): Comprueba que no exista un email igual en la db
- def clean_ruc(self): Compr... | Implement the Python class `UserForm` described below.
Class description:
Implement the UserForm class.
Method signatures and docstrings:
- def clean_username(self): Comprueba que no exista un username igual en la db
- def clean_email(self): Comprueba que no exista un email igual en la db
- def clean_ruc(self): Compr... | cbc5357f941704498f1ea4ab204f6687120a3b2e | <|skeleton|>
class UserForm:
def clean_username(self):
"""Comprueba que no exista un username igual en la db"""
<|body_0|>
def clean_email(self):
"""Comprueba que no exista un email igual en la db"""
<|body_1|>
def clean_ruc(self):
"""Comprueba que no exista un ema... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class UserForm:
def clean_username(self):
"""Comprueba que no exista un username igual en la db"""
username = self.cleaned_data['username']
if User.objects.filter(username=username):
raise forms.ValidationError('Nombre de usuario ya registrado, ingrese otro usuario')
retu... | the_stack_v2_python_sparse | SistemaCine/inicio/forms.py | emlopezg/SistemaCine | train | 0 | |
254fe63d337b4ad07e5bb446e03181efb825ec0c | [
"self.game = game\nscreen = GameScreen()\nConsoleController.__init__(self, screen, commands={ENDL: self.nextMessage})",
"while not self.game.over:\n self.runController(RoundController(self.game))\nself.stopRunning()"
] | <|body_start_0|>
self.game = game
screen = GameScreen()
ConsoleController.__init__(self, screen, commands={ENDL: self.nextMessage})
<|end_body_0|>
<|body_start_1|>
while not self.game.over:
self.runController(RoundController(self.game))
self.stopRunning()
<|end_body_... | Controller for running a game of Chess | GameController | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GameController:
"""Controller for running a game of Chess"""
def __init__(self, game):
"""Initialize the Game Controller"""
<|body_0|>
def nextMessage(self, event):
"""Tell the screen to print the next message"""
<|body_1|>
<|end_skeleton|>
<|body_start... | stack_v2_sparse_classes_75kplus_train_008831 | 750 | permissive | [
{
"docstring": "Initialize the Game Controller",
"name": "__init__",
"signature": "def __init__(self, game)"
},
{
"docstring": "Tell the screen to print the next message",
"name": "nextMessage",
"signature": "def nextMessage(self, event)"
}
] | 2 | stack_v2_sparse_classes_30k_train_045246 | Implement the Python class `GameController` described below.
Class description:
Controller for running a game of Chess
Method signatures and docstrings:
- def __init__(self, game): Initialize the Game Controller
- def nextMessage(self, event): Tell the screen to print the next message | Implement the Python class `GameController` described below.
Class description:
Controller for running a game of Chess
Method signatures and docstrings:
- def __init__(self, game): Initialize the Game Controller
- def nextMessage(self, event): Tell the screen to print the next message
<|skeleton|>
class GameControll... | 2a54293181c1c2b1a2b840ddee4d4d80177efb33 | <|skeleton|>
class GameController:
"""Controller for running a game of Chess"""
def __init__(self, game):
"""Initialize the Game Controller"""
<|body_0|>
def nextMessage(self, event):
"""Tell the screen to print the next message"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GameController:
"""Controller for running a game of Chess"""
def __init__(self, game):
"""Initialize the Game Controller"""
self.game = game
screen = GameScreen()
ConsoleController.__init__(self, screen, commands={ENDL: self.nextMessage})
def nextMessage(self, event):... | the_stack_v2_python_sparse | data/train/python/12fdeac9f767a584f3dd82dcead3c9177be1a75fgame_controller.py | harshp8l/deep-learning-lang-detection | train | 0 |
1803ccddf9e1f3f2015200e31620e5ab9827e29b | [
"self._lib_name = library_name\nself._lib_func_name = func_name\nself._lib_func = getattr(cdll.LoadLibrary(library_name), func_name)\nself._lib_func.argtypes = [c_char_p]\nself._lib_func.restype = c_int\nself._logger = logger or LoggingBase()",
"if self._lib_func is None:\n raise RuntimeError('Consistency chec... | <|body_start_0|>
self._lib_name = library_name
self._lib_func_name = func_name
self._lib_func = getattr(cdll.LoadLibrary(library_name), func_name)
self._lib_func.argtypes = [c_char_p]
self._lib_func.restype = c_int
self._logger = logger or LoggingBase()
<|end_body_0|>
<|... | Allows registration of a consistency checking function and verifying the consistency of a file. The function has to be in a shared library. It is then used to check consistency of an arbitrary file. The function has to take a file name as the only parameter and return an int: 0 for inconsistent, 1 for consistent. The p... | LibChecker | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LibChecker:
"""Allows registration of a consistency checking function and verifying the consistency of a file. The function has to be in a shared library. It is then used to check consistency of an arbitrary file. The function has to take a file name as the only parameter and return an int: 0 for... | stack_v2_sparse_classes_75kplus_train_008832 | 5,858 | permissive | [
{
"docstring": "Loads the consistency checking function from the given library. :param library_name: The full name of the library. :type library_name: str :param func_name: The name of the consistency checking function within the library. :type func_name: str :param logger: logger handle, default: empty logger ... | 2 | stack_v2_sparse_classes_30k_train_020357 | Implement the Python class `LibChecker` described below.
Class description:
Allows registration of a consistency checking function and verifying the consistency of a file. The function has to be in a shared library. It is then used to check consistency of an arbitrary file. The function has to take a file name as the ... | Implement the Python class `LibChecker` described below.
Class description:
Allows registration of a consistency checking function and verifying the consistency of a file. The function has to be in a shared library. It is then used to check consistency of an arbitrary file. The function has to take a file name as the ... | ccadb16227bddea1bdcc518bd8f298d551b2baad | <|skeleton|>
class LibChecker:
"""Allows registration of a consistency checking function and verifying the consistency of a file. The function has to be in a shared library. It is then used to check consistency of an arbitrary file. The function has to take a file name as the only parameter and return an int: 0 for... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LibChecker:
"""Allows registration of a consistency checking function and verifying the consistency of a file. The function has to be in a shared library. It is then used to check consistency of an arbitrary file. The function has to take a file name as the only parameter and return an int: 0 for inconsistent... | the_stack_v2_python_sparse | src/tools/pmreorder/consistencycheckwrap.py | pmem/pmdk | train | 1,017 |
b0c966dff277a10aea78a9a9491dc19206387314 | [
"if isinstance(other, TheCloud):\n return self is other\nreturn NotImplemented",
"if isinstance(other, TheCloud):\n return TheCloud()\nreturn NotImplemented",
"if isinstance(other, TheCloud):\n return self is other\nreturn NotImplemented"
] | <|body_start_0|>
if isinstance(other, TheCloud):
return self is other
return NotImplemented
<|end_body_0|>
<|body_start_1|>
if isinstance(other, TheCloud):
return TheCloud()
return NotImplemented
<|end_body_1|>
<|body_start_2|>
if isinstance(other, TheCl... | Arbitrary class declaring a method exercising this test. | TheCloud | [
"MIT",
"LicenseRef-scancode-free-unknown",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TheCloud:
"""Arbitrary class declaring a method exercising this test."""
def __eq__(self, other: object) -> bool:
"""Arbitrary binary dunder method correctly returning the ``NotImplemented`` singleton."""
<|body_0|>
def __add__(self, other: object) -> 'TheCloud':
... | stack_v2_sparse_classes_75kplus_train_008833 | 6,036 | permissive | [
{
"docstring": "Arbitrary binary dunder method correctly returning the ``NotImplemented`` singleton.",
"name": "__eq__",
"signature": "def __eq__(self, other: object) -> bool"
},
{
"docstring": "Another arbitrary binary dunder method correctly returning the ``NotImplemented`` singleton.",
"n... | 3 | stack_v2_sparse_classes_30k_train_025865 | Implement the Python class `TheCloud` described below.
Class description:
Arbitrary class declaring a method exercising this test.
Method signatures and docstrings:
- def __eq__(self, other: object) -> bool: Arbitrary binary dunder method correctly returning the ``NotImplemented`` singleton.
- def __add__(self, other... | Implement the Python class `TheCloud` described below.
Class description:
Arbitrary class declaring a method exercising this test.
Method signatures and docstrings:
- def __eq__(self, other: object) -> bool: Arbitrary binary dunder method correctly returning the ``NotImplemented`` singleton.
- def __add__(self, other... | 0cfd53391eb4de2f8297a4632aa5895b8d82a5b7 | <|skeleton|>
class TheCloud:
"""Arbitrary class declaring a method exercising this test."""
def __eq__(self, other: object) -> bool:
"""Arbitrary binary dunder method correctly returning the ``NotImplemented`` singleton."""
<|body_0|>
def __add__(self, other: object) -> 'TheCloud':
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TheCloud:
"""Arbitrary class declaring a method exercising this test."""
def __eq__(self, other: object) -> bool:
"""Arbitrary binary dunder method correctly returning the ``NotImplemented`` singleton."""
if isinstance(other, TheCloud):
return self is other
return NotI... | the_stack_v2_python_sparse | beartype_test/a00_unit/a70_decor/a40_code/a00_mod/test_decor_mypy.py | beartype/beartype | train | 1,992 |
8d79179cdd6581db7c1f93a3bb753b4cdb1d53e7 | [
"if 'TITLE' not in PAR:\n setattr(PAR, 'TITLE', basename(abspath('.')))\nif 'WALLTIME' not in PAR:\n setattr(PAR, 'WALLTIME', 30.0)\nif 'NTASK' not in PAR:\n raise ParameterError(PAR, 'NTASK')\nif 'NPROC' not in PAR:\n raise ParameterError(PAR, 'NPROC')\nif 'MPIEXEC' not in PAR:\n setattr(PAR, 'MPIEX... | <|body_start_0|>
if 'TITLE' not in PAR:
setattr(PAR, 'TITLE', basename(abspath('.')))
if 'WALLTIME' not in PAR:
setattr(PAR, 'WALLTIME', 30.0)
if 'NTASK' not in PAR:
raise ParameterError(PAR, 'NTASK')
if 'NPROC' not in PAR:
raise ParameterE... | System interface for University of Alaska Fairbanks CHINOOK For important additional information, please see http://seisflows.readthedocs.org/en/latest/manual/manual.html#system-configuration | chinook_sm | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class chinook_sm:
"""System interface for University of Alaska Fairbanks CHINOOK For important additional information, please see http://seisflows.readthedocs.org/en/latest/manual/manual.html#system-configuration"""
def check(self):
"""Checks parameters and paths"""
<|body_0|>
... | stack_v2_sparse_classes_75kplus_train_008834 | 3,246 | no_license | [
{
"docstring": "Checks parameters and paths",
"name": "check",
"signature": "def check(self)"
},
{
"docstring": "Submits workflow",
"name": "submit",
"signature": "def submit(self, workflow)"
}
] | 2 | stack_v2_sparse_classes_30k_train_031465 | Implement the Python class `chinook_sm` described below.
Class description:
System interface for University of Alaska Fairbanks CHINOOK For important additional information, please see http://seisflows.readthedocs.org/en/latest/manual/manual.html#system-configuration
Method signatures and docstrings:
- def check(self... | Implement the Python class `chinook_sm` described below.
Class description:
System interface for University of Alaska Fairbanks CHINOOK For important additional information, please see http://seisflows.readthedocs.org/en/latest/manual/manual.html#system-configuration
Method signatures and docstrings:
- def check(self... | 5cb182f55d49fdc114b725da3d785b64ee81f9ae | <|skeleton|>
class chinook_sm:
"""System interface for University of Alaska Fairbanks CHINOOK For important additional information, please see http://seisflows.readthedocs.org/en/latest/manual/manual.html#system-configuration"""
def check(self):
"""Checks parameters and paths"""
<|body_0|>
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class chinook_sm:
"""System interface for University of Alaska Fairbanks CHINOOK For important additional information, please see http://seisflows.readthedocs.org/en/latest/manual/manual.html#system-configuration"""
def check(self):
"""Checks parameters and paths"""
if 'TITLE' not in PAR:
... | the_stack_v2_python_sparse | seisflows/system/chinook_sm.py | rmodrak/seisflows-hpc | train | 3 |
1b605d881a1a4607c7aebb5eccf9071daad06edc | [
"self.__robot = robot\nself.__weight_attr = weight_attr\nself.__weight_rep = weight_rep\nself.__radius_obs = radius_obs\nself.__trigger_obs = trigger_obs\nself.__max_obs = max_obs\nself.__max_attr = max_attr",
"forces = {'gen_force': None, 'attr_force': None, 'rep_force': None}\nforces['attr_force'] = self.__get_... | <|body_start_0|>
self.__robot = robot
self.__weight_attr = weight_attr
self.__weight_rep = weight_rep
self.__radius_obs = radius_obs
self.__trigger_obs = trigger_obs
self.__max_obs = max_obs
self.__max_attr = max_attr
<|end_body_0|>
<|body_start_1|>
force... | Class that implements a PotentialField, used to compute the force to apply to the robot to make it reach the goal point while avoiding obstacles. | PotentialField | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PotentialField:
"""Class that implements a PotentialField, used to compute the force to apply to the robot to make it reach the goal point while avoiding obstacles."""
def __init__(self, robot, max_attr=15, weight_attr=0.5, weight_rep=2.4, radius_obs=7, max_obs=6, trigger_obs=0.75):
... | stack_v2_sparse_classes_75kplus_train_008835 | 5,282 | permissive | [
{
"docstring": "Instantiates a PotentialField. :param robot: The robot. :type robot: Robot :param weight_attr: The weight to apply to the attractive force. :type weight_attr: float :param weight_rep: The weight to apply to the repulsive force. :type weight_rep: float :param radius_obs: Radius of the circle to a... | 4 | stack_v2_sparse_classes_30k_train_050821 | Implement the Python class `PotentialField` described below.
Class description:
Class that implements a PotentialField, used to compute the force to apply to the robot to make it reach the goal point while avoiding obstacles.
Method signatures and docstrings:
- def __init__(self, robot, max_attr=15, weight_attr=0.5, ... | Implement the Python class `PotentialField` described below.
Class description:
Class that implements a PotentialField, used to compute the force to apply to the robot to make it reach the goal point while avoiding obstacles.
Method signatures and docstrings:
- def __init__(self, robot, max_attr=15, weight_attr=0.5, ... | e36ddcc7d5959957d83fae778d8ef715c79712e7 | <|skeleton|>
class PotentialField:
"""Class that implements a PotentialField, used to compute the force to apply to the robot to make it reach the goal point while avoiding obstacles."""
def __init__(self, robot, max_attr=15, weight_attr=0.5, weight_rep=2.4, radius_obs=7, max_obs=6, trigger_obs=0.75):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PotentialField:
"""Class that implements a PotentialField, used to compute the force to apply to the robot to make it reach the goal point while avoiding obstacles."""
def __init__(self, robot, max_attr=15, weight_attr=0.5, weight_rep=2.4, radius_obs=7, max_obs=6, trigger_obs=0.75):
"""Instantiat... | the_stack_v2_python_sparse | submission/potential_field.py | ThomasRanvier/map_maker | train | 0 |
9f535299e27fef251c1590c24ef29381a4471be0 | [
"pygame.init()\nself._screen = pygame.display.set_mode(SCREEN_SIZE, pygame.HWSURFACE | pygame.DOUBLEBUF)\nself._screen.fill(WHITE)\nself._mouse_down = False\nself._map = Map(SCREEN_SIZE)\nself.render_drawables([], datetime.now())",
"self._screen.fill(WHITE)\nself._screen.blit(self._map.get_current_view(), (0, 0))... | <|body_start_0|>
pygame.init()
self._screen = pygame.display.set_mode(SCREEN_SIZE, pygame.HWSURFACE | pygame.DOUBLEBUF)
self._screen.fill(WHITE)
self._mouse_down = False
self._map = Map(SCREEN_SIZE)
self.render_drawables([], datetime.now())
<|end_body_0|>
<|body_start_1|... | Visualizer for the current state of a simulation. | Visualizer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Visualizer:
"""Visualizer for the current state of a simulation."""
def __init__(self) -> None:
"""Initialize this visualization."""
<|body_0|>
def render_drawables(self, drawables: List[Drawable], time: datetime) -> None:
"""Render the simulation objects to the ... | stack_v2_sparse_classes_75kplus_train_008836 | 7,397 | permissive | [
{
"docstring": "Initialize this visualization.",
"name": "__init__",
"signature": "def __init__(self) -> None"
},
{
"docstring": "Render the simulation objects to the screen for the given time.",
"name": "render_drawables",
"signature": "def render_drawables(self, drawables: List[Drawabl... | 3 | stack_v2_sparse_classes_30k_train_025795 | Implement the Python class `Visualizer` described below.
Class description:
Visualizer for the current state of a simulation.
Method signatures and docstrings:
- def __init__(self) -> None: Initialize this visualization.
- def render_drawables(self, drawables: List[Drawable], time: datetime) -> None: Render the simul... | Implement the Python class `Visualizer` described below.
Class description:
Visualizer for the current state of a simulation.
Method signatures and docstrings:
- def __init__(self) -> None: Initialize this visualization.
- def render_drawables(self, drawables: List[Drawable], time: datetime) -> None: Render the simul... | 214525afeeb2da2409f451bf269e792c6940a1ba | <|skeleton|>
class Visualizer:
"""Visualizer for the current state of a simulation."""
def __init__(self) -> None:
"""Initialize this visualization."""
<|body_0|>
def render_drawables(self, drawables: List[Drawable], time: datetime) -> None:
"""Render the simulation objects to the ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Visualizer:
"""Visualizer for the current state of a simulation."""
def __init__(self) -> None:
"""Initialize this visualization."""
pygame.init()
self._screen = pygame.display.set_mode(SCREEN_SIZE, pygame.HWSURFACE | pygame.DOUBLEBUF)
self._screen.fill(WHITE)
self... | the_stack_v2_python_sparse | Programming-OOP/BikeShare/visualizer.py | LilyYC/legendary-train | train | 0 |
dffe148df558e00b55ab2743ad037ecd5f084682 | [
"if not nums:\n return -1\nleft, right = (0, len(nums) - 1)\nwhile 1:\n mid = (left + right) // 2\n if nums[mid] == target:\n return mid\n if nums[left] == target:\n return left\n if nums[right] == target:\n return right\n if left > right:\n return -1\n if nums[mid] ... | <|body_start_0|>
if not nums:
return -1
left, right = (0, len(nums) - 1)
while 1:
mid = (left + right) // 2
if nums[mid] == target:
return mid
if nums[left] == target:
return left
if nums[right] == target... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def search(self, nums, target):
""":type nums: List[int] :type target: int :rtype: int 0,1,2,3,4,5,6,7,8,9 3,4,5,6,7,8,9,|0,1,2 8,9,|0,1,2,3,4,5,6,7"""
<|body_0|>
def search2(self, nums, target):
""":type nums: List[int] :type target: int :rtype: int"""
... | stack_v2_sparse_classes_75kplus_train_008837 | 1,851 | no_license | [
{
"docstring": ":type nums: List[int] :type target: int :rtype: int 0,1,2,3,4,5,6,7,8,9 3,4,5,6,7,8,9,|0,1,2 8,9,|0,1,2,3,4,5,6,7",
"name": "search",
"signature": "def search(self, nums, target)"
},
{
"docstring": ":type nums: List[int] :type target: int :rtype: int",
"name": "search2",
... | 2 | stack_v2_sparse_classes_30k_train_000858 | 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 0,1,2,3,4,5,6,7,8,9 3,4,5,6,7,8,9,|0,1,2 8,9,|0,1,2,3,4,5,6,7
- def search2(self, nums, target... | 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 0,1,2,3,4,5,6,7,8,9 3,4,5,6,7,8,9,|0,1,2 8,9,|0,1,2,3,4,5,6,7
- def search2(self, nums, target... | 85128e7d26157b3c36eb43868269de42ea2fcb98 | <|skeleton|>
class Solution:
def search(self, nums, target):
""":type nums: List[int] :type target: int :rtype: int 0,1,2,3,4,5,6,7,8,9 3,4,5,6,7,8,9,|0,1,2 8,9,|0,1,2,3,4,5,6,7"""
<|body_0|>
def search2(self, nums, target):
""":type nums: List[int] :type target: int :rtype: int"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def search(self, nums, target):
""":type nums: List[int] :type target: int :rtype: int 0,1,2,3,4,5,6,7,8,9 3,4,5,6,7,8,9,|0,1,2 8,9,|0,1,2,3,4,5,6,7"""
if not nums:
return -1
left, right = (0, len(nums) - 1)
while 1:
mid = (left + right) // 2
... | the_stack_v2_python_sparse | src/Search in Rotated Sorted Array.py | jsdiuf/leetcode | train | 1 | |
17e53c2d1ec849c5183c7fa34d24eedefd2d707f | [
"if not valid_email(email):\n return make_response('', 422)\nwith create_session() as session:\n response = session.read_transaction(get_user_by_email, email)\n response = response.single()\n if response:\n data = response.data()\n user = dict(data['user'].items())\n user['passions'... | <|body_start_0|>
if not valid_email(email):
return make_response('', 422)
with create_session() as session:
response = session.read_transaction(get_user_by_email, email)
response = response.single()
if response:
data = response.data()
... | Users | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Users:
def get(self, email: str) -> Response:
"""Fetch a user given its email."""
<|body_0|>
def delete(self, email: str) -> Response:
"""Delete a user given its email."""
<|body_1|>
def put(self, email: str) -> Response:
"""Update a user by the ... | stack_v2_sparse_classes_75kplus_train_008838 | 11,477 | no_license | [
{
"docstring": "Fetch a user given its email.",
"name": "get",
"signature": "def get(self, email: str) -> Response"
},
{
"docstring": "Delete a user given its email.",
"name": "delete",
"signature": "def delete(self, email: str) -> Response"
},
{
"docstring": "Update a user by th... | 3 | stack_v2_sparse_classes_30k_train_031699 | Implement the Python class `Users` described below.
Class description:
Implement the Users class.
Method signatures and docstrings:
- def get(self, email: str) -> Response: Fetch a user given its email.
- def delete(self, email: str) -> Response: Delete a user given its email.
- def put(self, email: str) -> Response:... | Implement the Python class `Users` described below.
Class description:
Implement the Users class.
Method signatures and docstrings:
- def get(self, email: str) -> Response: Fetch a user given its email.
- def delete(self, email: str) -> Response: Delete a user given its email.
- def put(self, email: str) -> Response:... | 2c71a26d1efbee85d04ce9c51b209c8b97f0ec06 | <|skeleton|>
class Users:
def get(self, email: str) -> Response:
"""Fetch a user given its email."""
<|body_0|>
def delete(self, email: str) -> Response:
"""Delete a user given its email."""
<|body_1|>
def put(self, email: str) -> Response:
"""Update a user by the ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Users:
def get(self, email: str) -> Response:
"""Fetch a user given its email."""
if not valid_email(email):
return make_response('', 422)
with create_session() as session:
response = session.read_transaction(get_user_by_email, email)
response = resp... | the_stack_v2_python_sparse | backend/graph/graph_api/apis/users.py | WilliamZard/PintroAppSEG-Major | train | 0 | |
8604bb86a08cbefba22f18d9eb0bfe6ab994f57b | [
"self.name = name\nself.interpreter = Interpreter()\nself.filename = filename\nsignal.signal(signal.SIGINT, sighandler)\nif Main.myself is None:\n Main.myself = self\nelse:\n raise Exception('plambda.actor.pyactor.Main should have a singleton instance!')\nif self.filename is not None:\n notify(f'Loading {s... | <|body_start_0|>
self.name = name
self.interpreter = Interpreter()
self.filename = filename
signal.signal(signal.SIGINT, sighandler)
if Main.myself is None:
Main.myself = self
else:
raise Exception('plambda.actor.pyactor.Main should have a singleto... | The main class/thread of the python actor. | Main | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Main:
"""The main class/thread of the python actor."""
def __init__(self, name, filename=None):
"""Creates an plambda Actor object with the given name."""
<|body_0|>
def run(self):
"""The main thread ever ready to launch the console."""
<|body_1|>
<|end_... | stack_v2_sparse_classes_75kplus_train_008839 | 5,140 | permissive | [
{
"docstring": "Creates an plambda Actor object with the given name.",
"name": "__init__",
"signature": "def __init__(self, name, filename=None)"
},
{
"docstring": "The main thread ever ready to launch the console.",
"name": "run",
"signature": "def run(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_016681 | Implement the Python class `Main` described below.
Class description:
The main class/thread of the python actor.
Method signatures and docstrings:
- def __init__(self, name, filename=None): Creates an plambda Actor object with the given name.
- def run(self): The main thread ever ready to launch the console. | Implement the Python class `Main` described below.
Class description:
The main class/thread of the python actor.
Method signatures and docstrings:
- def __init__(self, name, filename=None): Creates an plambda Actor object with the given name.
- def run(self): The main thread ever ready to launch the console.
<|skele... | 62c40c3b344b322478429284afd9c77393309813 | <|skeleton|>
class Main:
"""The main class/thread of the python actor."""
def __init__(self, name, filename=None):
"""Creates an plambda Actor object with the given name."""
<|body_0|>
def run(self):
"""The main thread ever ready to launch the console."""
<|body_1|>
<|end_... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Main:
"""The main class/thread of the python actor."""
def __init__(self, name, filename=None):
"""Creates an plambda Actor object with the given name."""
self.name = name
self.interpreter = Interpreter()
self.filename = filename
signal.signal(signal.SIGINT, sighan... | the_stack_v2_python_sparse | plambda/actors/pyactor.py | SRI-CSL/PLambda | train | 2 |
ba31ca8777acd74e6c8cf9a5bf51a05e8f47f6d0 | [
"player_info = PlayerInfo(PlayerColor.BLACK, 3)\nself.assertEqual(PlayerColor.BLACK, player_info.get_color())\nself.assertEqual(0, player_info.get_fish())\nself.assertEqual([], player_info.get_penguin_posns())\nself.assertEqual(3, player_info._amount_penguins_placeable)",
"player_info = PlayerInfo(PlayerColor.BLA... | <|body_start_0|>
player_info = PlayerInfo(PlayerColor.BLACK, 3)
self.assertEqual(PlayerColor.BLACK, player_info.get_color())
self.assertEqual(0, player_info.get_fish())
self.assertEqual([], player_info.get_penguin_posns())
self.assertEqual(3, player_info._amount_penguins_placeabl... | InfoTest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InfoTest:
def test_normal_player_info(self):
"""Purpose: Test what happens when you initialize the player info with a valid age, color, and number of penguins placeable Signature: Void -> Void"""
<|body_0|>
def test_adding_single_penguin(self):
"""Purpose: Test what ... | stack_v2_sparse_classes_75kplus_train_008840 | 2,375 | no_license | [
{
"docstring": "Purpose: Test what happens when you initialize the player info with a valid age, color, and number of penguins placeable Signature: Void -> Void",
"name": "test_normal_player_info",
"signature": "def test_normal_player_info(self)"
},
{
"docstring": "Purpose: Test what happens whe... | 4 | null | Implement the Python class `InfoTest` described below.
Class description:
Implement the InfoTest class.
Method signatures and docstrings:
- def test_normal_player_info(self): Purpose: Test what happens when you initialize the player info with a valid age, color, and number of penguins placeable Signature: Void -> Voi... | Implement the Python class `InfoTest` described below.
Class description:
Implement the InfoTest class.
Method signatures and docstrings:
- def test_normal_player_info(self): Purpose: Test what happens when you initialize the player info with a valid age, color, and number of penguins placeable Signature: Void -> Voi... | 0f77418fedb345f8fcb17b9b40f9287c93629302 | <|skeleton|>
class InfoTest:
def test_normal_player_info(self):
"""Purpose: Test what happens when you initialize the player info with a valid age, color, and number of penguins placeable Signature: Void -> Void"""
<|body_0|>
def test_adding_single_penguin(self):
"""Purpose: Test what ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class InfoTest:
def test_normal_player_info(self):
"""Purpose: Test what happens when you initialize the player info with a valid age, color, and number of penguins placeable Signature: Void -> Void"""
player_info = PlayerInfo(PlayerColor.BLACK, 3)
self.assertEqual(PlayerColor.BLACK, player_... | the_stack_v2_python_sparse | tournament_services/Fish/Common/unit_test/player_info_test.py | zachwdawson/Software-Development | train | 0 | |
fb24979088c8898572071938c343aa0db6c7df86 | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn LocationConstraintItem()",
"from .location import Location\nfrom .location import Location\nfields: Dict[str, Callable[[Any], None]] = {'resolveAvailability': lambda n: setattr(self, 'resolve_availability', n.get_bool_value())}\nsuper_... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return LocationConstraintItem()
<|end_body_0|>
<|body_start_1|>
from .location import Location
from .location import Location
fields: Dict[str, Callable[[Any], None]] = {'resolveAvailab... | LocationConstraintItem | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LocationConstraintItem:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> LocationConstraintItem:
"""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 ... | stack_v2_sparse_classes_75kplus_train_008841 | 2,348 | 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: LocationConstraintItem",
"name": "create_from_discriminator_value",
"signature": "def create_from_discrimina... | 3 | stack_v2_sparse_classes_30k_train_022992 | Implement the Python class `LocationConstraintItem` described below.
Class description:
Implement the LocationConstraintItem class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> LocationConstraintItem: Creates a new instance of the appropriate class b... | Implement the Python class `LocationConstraintItem` described below.
Class description:
Implement the LocationConstraintItem class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> LocationConstraintItem: Creates a new instance of the appropriate class b... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class LocationConstraintItem:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> LocationConstraintItem:
"""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 ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LocationConstraintItem:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> LocationConstraintItem:
"""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 Ret... | the_stack_v2_python_sparse | msgraph/generated/models/location_constraint_item.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
8bb95bee81ebd03a651d5a3f8907338291582dc1 | [
"parser = flask_restful.reqparse.RequestParser()\nparser.add_argument('member_uuid', required=True)\nargs = parser.parse_args()\nmember = models.Member.get_member(member_uuid=args['member_uuid']).first()\nreturn member",
"parser = reqparse.RequestParser()\nparser.add_argument('first_name', required=True)\nparser.... | <|body_start_0|>
parser = flask_restful.reqparse.RequestParser()
parser.add_argument('member_uuid', required=True)
args = parser.parse_args()
member = models.Member.get_member(member_uuid=args['member_uuid']).first()
return member
<|end_body_0|>
<|body_start_1|>
parser =... | Top-level password policy endpoint. | MemberResource | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MemberResource:
"""Top-level password policy endpoint."""
def get(self) -> flask.Response:
"""Get a dict of the member when given their uuid Return data structure: ```json { "id": ... "created_at": ... "first_name": ... "last_name": ... "address": ... "email": ... } ``` Example: ```b... | stack_v2_sparse_classes_75kplus_train_008842 | 2,104 | no_license | [
{
"docstring": "Get a dict of the member when given their uuid Return data structure: ```json { \"id\": ... \"created_at\": ... \"first_name\": ... \"last_name\": ... \"address\": ... \"email\": ... } ``` Example: ```bash % curl -X GET -H Content-Type:application/json -d '{\"member_uuid\":\"992a54a8-3d3d-43de-a... | 2 | stack_v2_sparse_classes_30k_test_002573 | Implement the Python class `MemberResource` described below.
Class description:
Top-level password policy endpoint.
Method signatures and docstrings:
- def get(self) -> flask.Response: Get a dict of the member when given their uuid Return data structure: ```json { "id": ... "created_at": ... "first_name": ... "last_n... | Implement the Python class `MemberResource` described below.
Class description:
Top-level password policy endpoint.
Method signatures and docstrings:
- def get(self) -> flask.Response: Get a dict of the member when given their uuid Return data structure: ```json { "id": ... "created_at": ... "first_name": ... "last_n... | ea45a96b38c0f172e1284fc15ff54e7c2399dd16 | <|skeleton|>
class MemberResource:
"""Top-level password policy endpoint."""
def get(self) -> flask.Response:
"""Get a dict of the member when given their uuid Return data structure: ```json { "id": ... "created_at": ... "first_name": ... "last_name": ... "address": ... "email": ... } ``` Example: ```b... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MemberResource:
"""Top-level password policy endpoint."""
def get(self) -> flask.Response:
"""Get a dict of the member when given their uuid Return data structure: ```json { "id": ... "created_at": ... "first_name": ... "last_name": ... "address": ... "email": ... } ``` Example: ```bash % curl -X... | the_stack_v2_python_sparse | app/app/resources/member.py | rory-lamendola/katacoda-scenarios | train | 0 |
2e4357d3efbb41dec5efcf860ed2f2e500a4ec0d | [
"server, validation_resources = self._create_server()\nvolume = self.create_volume()\nself.attach_volume(server, volume)\nself.assertRaises(lib_exc.BadRequest, self.delete_volume, volume['id'])",
"server, validation_resources = self._create_server()\nvolume = self.create_volume()\nself.attach_volume(server, volum... | <|body_start_0|>
server, validation_resources = self._create_server()
volume = self.create_volume()
self.attach_volume(server, volume)
self.assertRaises(lib_exc.BadRequest, self.delete_volume, volume['id'])
<|end_body_0|>
<|body_start_1|>
server, validation_resources = self._cre... | Negative tests of volume attaching | AttachVolumeNegativeTest | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AttachVolumeNegativeTest:
"""Negative tests of volume attaching"""
def test_delete_attached_volume(self):
"""Test deleting attachemd volume should fail"""
<|body_0|>
def test_attach_attached_volume_to_same_server(self):
"""Test attaching attached volume to same s... | stack_v2_sparse_classes_75kplus_train_008843 | 2,824 | permissive | [
{
"docstring": "Test deleting attachemd volume should fail",
"name": "test_delete_attached_volume",
"signature": "def test_delete_attached_volume(self)"
},
{
"docstring": "Test attaching attached volume to same server should fail Test attaching the same volume to the same instance once it's alre... | 3 | stack_v2_sparse_classes_30k_train_013134 | Implement the Python class `AttachVolumeNegativeTest` described below.
Class description:
Negative tests of volume attaching
Method signatures and docstrings:
- def test_delete_attached_volume(self): Test deleting attachemd volume should fail
- def test_attach_attached_volume_to_same_server(self): Test attaching atta... | Implement the Python class `AttachVolumeNegativeTest` described below.
Class description:
Negative tests of volume attaching
Method signatures and docstrings:
- def test_delete_attached_volume(self): Test deleting attachemd volume should fail
- def test_attach_attached_volume_to_same_server(self): Test attaching atta... | 3932a799e620a20d7abf7b89e21b520683a1809b | <|skeleton|>
class AttachVolumeNegativeTest:
"""Negative tests of volume attaching"""
def test_delete_attached_volume(self):
"""Test deleting attachemd volume should fail"""
<|body_0|>
def test_attach_attached_volume_to_same_server(self):
"""Test attaching attached volume to same s... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AttachVolumeNegativeTest:
"""Negative tests of volume attaching"""
def test_delete_attached_volume(self):
"""Test deleting attachemd volume should fail"""
server, validation_resources = self._create_server()
volume = self.create_volume()
self.attach_volume(server, volume)
... | the_stack_v2_python_sparse | tempest/api/compute/volumes/test_attach_volume_negative.py | openstack/tempest | train | 270 |
b2e0277ea967a30fb862f4995eaed1f20a191a7b | [
"super().__init__(name, x, y)\nself.game = game\nself.fire_time = 0\nself.target = None\nif hasattr(self, 'images'):\n self.image = self.images[0]\n self.rect = self.image.get_rect()\n self.rect.x = x\n self.rect.y = y\nif hasattr(self, 'block'):\n self.game.level.collision.block_rect(x, y, self.rect... | <|body_start_0|>
super().__init__(name, x, y)
self.game = game
self.fire_time = 0
self.target = None
if hasattr(self, 'images'):
self.image = self.images[0]
self.rect = self.image.get_rect()
self.rect.x = x
self.rect.y = y
i... | 用户放置的炮塔的基类 | Defence | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Defence:
"""用户放置的炮塔的基类"""
def __init__(self, game, name, x, y):
"""Args: game (Game): game实例 name (str): 炮塔类型的名称 x (int): x坐标 y (int): y坐标"""
<|body_0|>
def update(self, delta):
"""每帧调用一次,更新目标并启动攻击 Args: delta (float): 距上次更新的时间(秒)"""
<|body_1|>
def g... | stack_v2_sparse_classes_75kplus_train_008844 | 4,523 | no_license | [
{
"docstring": "Args: game (Game): game实例 name (str): 炮塔类型的名称 x (int): x坐标 y (int): y坐标",
"name": "__init__",
"signature": "def __init__(self, game, name, x, y)"
},
{
"docstring": "每帧调用一次,更新目标并启动攻击 Args: delta (float): 距上次更新的时间(秒)",
"name": "update",
"signature": "def update(self, delta)... | 4 | stack_v2_sparse_classes_30k_train_036604 | Implement the Python class `Defence` described below.
Class description:
用户放置的炮塔的基类
Method signatures and docstrings:
- def __init__(self, game, name, x, y): Args: game (Game): game实例 name (str): 炮塔类型的名称 x (int): x坐标 y (int): y坐标
- def update(self, delta): 每帧调用一次,更新目标并启动攻击 Args: delta (float): 距上次更新的时间(秒)
- def get_t... | Implement the Python class `Defence` described below.
Class description:
用户放置的炮塔的基类
Method signatures and docstrings:
- def __init__(self, game, name, x, y): Args: game (Game): game实例 name (str): 炮塔类型的名称 x (int): x坐标 y (int): y坐标
- def update(self, delta): 每帧调用一次,更新目标并启动攻击 Args: delta (float): 距上次更新的时间(秒)
- def get_t... | 4dfcab372fe3d0562e685b9f553f2af4a83f7f5f | <|skeleton|>
class Defence:
"""用户放置的炮塔的基类"""
def __init__(self, game, name, x, y):
"""Args: game (Game): game实例 name (str): 炮塔类型的名称 x (int): x坐标 y (int): y坐标"""
<|body_0|>
def update(self, delta):
"""每帧调用一次,更新目标并启动攻击 Args: delta (float): 距上次更新的时间(秒)"""
<|body_1|>
def g... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Defence:
"""用户放置的炮塔的基类"""
def __init__(self, game, name, x, y):
"""Args: game (Game): game实例 name (str): 炮塔类型的名称 x (int): x坐标 y (int): y坐标"""
super().__init__(name, x, y)
self.game = game
self.fire_time = 0
self.target = None
if hasattr(self, 'images'):
... | the_stack_v2_python_sparse | 高级编程技术/python-game/tower-defence-master/core/defence.py | ZhuangXuward/Learning-data-backup | train | 0 |
a307cc2ed575ed40b30d1e8497d7e45dbc706aeb | [
"t = super(SafeString, self).__add__(rhs)\nif isinstance(rhs, SafeUnicode):\n return SafeUnicode(t)\nelif isinstance(rhs, SafeString):\n return SafeString(t)\nreturn t",
"method = kwargs.pop('method')\ndata = method(self, *args, **kwargs)\nif isinstance(data, str):\n return SafeString(data)\nelse:\n r... | <|body_start_0|>
t = super(SafeString, self).__add__(rhs)
if isinstance(rhs, SafeUnicode):
return SafeUnicode(t)
elif isinstance(rhs, SafeString):
return SafeString(t)
return t
<|end_body_0|>
<|body_start_1|>
method = kwargs.pop('method')
data = m... | A string subclass that has been specifically marked as "safe" (requires no further escaping) for HTML output purposes. | SafeString | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SafeString:
"""A string subclass that has been specifically marked as "safe" (requires no further escaping) for HTML output purposes."""
def __add__(self, rhs):
"""Concatenating a safe string with another safe string or safe unicode object is safe. Otherwise, the result is no longer ... | stack_v2_sparse_classes_75kplus_train_008845 | 3,000 | no_license | [
{
"docstring": "Concatenating a safe string with another safe string or safe unicode object is safe. Otherwise, the result is no longer safe.",
"name": "__add__",
"signature": "def __add__(self, rhs)"
},
{
"docstring": "Wrap a call to a normal unicode method up so that we return safe results. Th... | 2 | null | Implement the Python class `SafeString` described below.
Class description:
A string subclass that has been specifically marked as "safe" (requires no further escaping) for HTML output purposes.
Method signatures and docstrings:
- def __add__(self, rhs): Concatenating a safe string with another safe string or safe un... | Implement the Python class `SafeString` described below.
Class description:
A string subclass that has been specifically marked as "safe" (requires no further escaping) for HTML output purposes.
Method signatures and docstrings:
- def __add__(self, rhs): Concatenating a safe string with another safe string or safe un... | a68e5587d658e843058bb62fa3c478b216ca199e | <|skeleton|>
class SafeString:
"""A string subclass that has been specifically marked as "safe" (requires no further escaping) for HTML output purposes."""
def __add__(self, rhs):
"""Concatenating a safe string with another safe string or safe unicode object is safe. Otherwise, the result is no longer ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SafeString:
"""A string subclass that has been specifically marked as "safe" (requires no further escaping) for HTML output purposes."""
def __add__(self, rhs):
"""Concatenating a safe string with another safe string or safe unicode object is safe. Otherwise, the result is no longer safe."""
... | the_stack_v2_python_sparse | heroshi/storage/safestring.py | GunioRobot/heroshi | train | 0 |
07fdf4b40622247a5a0efcdafdc81429cb091e19 | [
"self.disk_blocks = disk_blocks\nself.disk_format = disk_format\nself.disk_partitions = disk_partitions\nself.partition_table_format = partition_table_format\nself.sector_size_bytes = sector_size_bytes\nself.uuid = uuid\nself.vmdk_file_name = vmdk_file_name\nself.vmdk_size_bytes = vmdk_size_bytes",
"if dictionary... | <|body_start_0|>
self.disk_blocks = disk_blocks
self.disk_format = disk_format
self.disk_partitions = disk_partitions
self.partition_table_format = partition_table_format
self.sector_size_bytes = sector_size_bytes
self.uuid = uuid
self.vmdk_file_name = vmdk_file_n... | Implementation of the 'Disk' model. Specifies information about a disk and partitions in a volume. Attributes: disk_blocks (list of DiskBlock): Array of Disk Blocks. Specifies a set of disk blocks by defining the location and offset of disk blocks in a disk. disk_format (DiskFormatEnum): Specifies the format of the vir... | Disk | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Disk:
"""Implementation of the 'Disk' model. Specifies information about a disk and partitions in a volume. Attributes: disk_blocks (list of DiskBlock): Array of Disk Blocks. Specifies a set of disk blocks by defining the location and offset of disk blocks in a disk. disk_format (DiskFormatEnum):... | stack_v2_sparse_classes_75kplus_train_008846 | 4,974 | permissive | [
{
"docstring": "Constructor for the Disk class",
"name": "__init__",
"signature": "def __init__(self, disk_blocks=None, disk_format=None, disk_partitions=None, partition_table_format=None, sector_size_bytes=None, uuid=None, vmdk_file_name=None, vmdk_size_bytes=None)"
},
{
"docstring": "Creates a... | 2 | stack_v2_sparse_classes_30k_train_005843 | Implement the Python class `Disk` described below.
Class description:
Implementation of the 'Disk' model. Specifies information about a disk and partitions in a volume. Attributes: disk_blocks (list of DiskBlock): Array of Disk Blocks. Specifies a set of disk blocks by defining the location and offset of disk blocks i... | Implement the Python class `Disk` described below.
Class description:
Implementation of the 'Disk' model. Specifies information about a disk and partitions in a volume. Attributes: disk_blocks (list of DiskBlock): Array of Disk Blocks. Specifies a set of disk blocks by defining the location and offset of disk blocks i... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class Disk:
"""Implementation of the 'Disk' model. Specifies information about a disk and partitions in a volume. Attributes: disk_blocks (list of DiskBlock): Array of Disk Blocks. Specifies a set of disk blocks by defining the location and offset of disk blocks in a disk. disk_format (DiskFormatEnum):... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Disk:
"""Implementation of the 'Disk' model. Specifies information about a disk and partitions in a volume. Attributes: disk_blocks (list of DiskBlock): Array of Disk Blocks. Specifies a set of disk blocks by defining the location and offset of disk blocks in a disk. disk_format (DiskFormatEnum): Specifies th... | the_stack_v2_python_sparse | cohesity_management_sdk/models/disk.py | cohesity/management-sdk-python | train | 24 |
981bbba3b5dabec51c84caa55a23571a6ede6db4 | [
"if sentence.isspace() or not sentence:\n return ''\ntry:\n from .. import langdetect_fasttext\n lang_type = langdetect_fasttext.detect(text=sentence.replace('\\n', '').replace('\\r', ''), low_memory=True).get('lang').upper()\n\n def is_japanese(string):\n for ch in string:\n if 12352 ... | <|body_start_0|>
if sentence.isspace() or not sentence:
return ''
try:
from .. import langdetect_fasttext
lang_type = langdetect_fasttext.detect(text=sentence.replace('\n', '').replace('\r', ''), low_memory=True).get('lang').upper()
def is_japanese(string... | 检测句子 | DetectSentence | [
"BSD-3-Clause",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DetectSentence:
"""检测句子"""
def detect_language(sentence: str):
"""Detect language :param sentence: sentence :return: 两位大写语言代码 (EN, ZH, JA, KO, FR, DE, ES, ....)"""
<|body_0|>
def detect_help(sentence: str) -> bool:
"""检测是否是包含帮助要求,如果是,返回True,否则返回False"""
<... | stack_v2_sparse_classes_75kplus_train_008847 | 3,549 | permissive | [
{
"docstring": "Detect language :param sentence: sentence :return: 两位大写语言代码 (EN, ZH, JA, KO, FR, DE, ES, ....)",
"name": "detect_language",
"signature": "def detect_language(sentence: str)"
},
{
"docstring": "检测是否是包含帮助要求,如果是,返回True,否则返回False",
"name": "detect_help",
"signature": "def det... | 3 | null | Implement the Python class `DetectSentence` described below.
Class description:
检测句子
Method signatures and docstrings:
- def detect_language(sentence: str): Detect language :param sentence: sentence :return: 两位大写语言代码 (EN, ZH, JA, KO, FR, DE, ES, ....)
- def detect_help(sentence: str) -> bool: 检测是否是包含帮助要求,如果是,返回True,否... | Implement the Python class `DetectSentence` described below.
Class description:
检测句子
Method signatures and docstrings:
- def detect_language(sentence: str): Detect language :param sentence: sentence :return: 两位大写语言代码 (EN, ZH, JA, KO, FR, DE, ES, ....)
- def detect_help(sentence: str) -> bool: 检测是否是包含帮助要求,如果是,返回True,否... | 569101fa7f473793f7d1d7c2c47b61f15341da82 | <|skeleton|>
class DetectSentence:
"""检测句子"""
def detect_language(sentence: str):
"""Detect language :param sentence: sentence :return: 两位大写语言代码 (EN, ZH, JA, KO, FR, DE, ES, ....)"""
<|body_0|>
def detect_help(sentence: str) -> bool:
"""检测是否是包含帮助要求,如果是,返回True,否则返回False"""
<... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DetectSentence:
"""检测句子"""
def detect_language(sentence: str):
"""Detect language :param sentence: sentence :return: 两位大写语言代码 (EN, ZH, JA, KO, FR, DE, ES, ....)"""
if sentence.isspace() or not sentence:
return ''
try:
from .. import langdetect_fasttext
... | the_stack_v2_python_sparse | component/nlp_utils/detect.py | LlmKira/VitsServer | train | 85 |
1bc9aa4066fd8fae2ef646c5a1694a0cc88fdc47 | [
"super().__init__(host, port, ssl_channel, ca_file)\nconfiguration()\nself._metadata = Metadata(api_key, secret_key, aud=aud['tts'])\nself._stub = TextToSpeechStub(self._channel)",
"validate(config, config_schema.streaming_synthesize_config_schema)\nrequest = get_proto_synthesize_request(config)\nutterances = get... | <|body_start_0|>
super().__init__(host, port, ssl_channel, ca_file)
configuration()
self._metadata = Metadata(api_key, secret_key, aud=aud['tts'])
self._stub = TextToSpeechStub(self._channel)
<|end_body_0|>
<|body_start_1|>
validate(config, config_schema.streaming_synthesize_con... | ClientTTS | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ClientTTS:
def __init__(self, api_key: str, secret_key: str, host: str=client_config['host_tts'], port: int=client_config['port'], ssl_channel: bool=True, ca_file: str=None):
"""Create client for speech synthesis. :param api_key: client public api key :param secret_key: client secret api... | stack_v2_sparse_classes_75kplus_train_008848 | 4,664 | permissive | [
{
"docstring": "Create client for speech synthesis. :param api_key: client public api key :param secret_key: client secret api key :param host: Tinkoff Voicekit speech synthesize host url :param port: Tinkoff Voicekit speech synthesize port, default value: 443 :param ca_file: optional certificate file",
"na... | 3 | stack_v2_sparse_classes_30k_train_031120 | Implement the Python class `ClientTTS` described below.
Class description:
Implement the ClientTTS class.
Method signatures and docstrings:
- def __init__(self, api_key: str, secret_key: str, host: str=client_config['host_tts'], port: int=client_config['port'], ssl_channel: bool=True, ca_file: str=None): Create clien... | Implement the Python class `ClientTTS` described below.
Class description:
Implement the ClientTTS class.
Method signatures and docstrings:
- def __init__(self, api_key: str, secret_key: str, host: str=client_config['host_tts'], port: int=client_config['port'], ssl_channel: bool=True, ca_file: str=None): Create clien... | d9103b88cdfa8fc3afb9164bd9dd87a1b6f7f2f5 | <|skeleton|>
class ClientTTS:
def __init__(self, api_key: str, secret_key: str, host: str=client_config['host_tts'], port: int=client_config['port'], ssl_channel: bool=True, ca_file: str=None):
"""Create client for speech synthesis. :param api_key: client public api key :param secret_key: client secret api... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ClientTTS:
def __init__(self, api_key: str, secret_key: str, host: str=client_config['host_tts'], port: int=client_config['port'], ssl_channel: bool=True, ca_file: str=None):
"""Create client for speech synthesis. :param api_key: client public api key :param secret_key: client secret api key :param ho... | the_stack_v2_python_sparse | tinkoff_voicekit_client/TTS/client_tts.py | Morracheg/voicekit_client_python | train | 0 | |
4ade24baff66daa44ecfc0010d597d1df486f7c3 | [
"response = super().to_representation(instance)\nif hasattr(response, 'user'):\n response['user'] = {'id': instance.user.id}\nif hasattr(response, 'listing'):\n response['listing'] = {'id': instance.listing.id}\nreturn response",
"request = self.context.get('request')\ndata['user'] = request.user\nif data['... | <|body_start_0|>
response = super().to_representation(instance)
if hasattr(response, 'user'):
response['user'] = {'id': instance.user.id}
if hasattr(response, 'listing'):
response['listing'] = {'id': instance.listing.id}
return response
<|end_body_0|>
<|body_star... | Serializer to create galleries | GallerySerializer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GallerySerializer:
"""Serializer to create galleries"""
def to_representation(self, instance):
"""Return only the id of the user or listing for the gallery and not the entire object."""
<|body_0|>
def validate(self, data):
"""Validate creation of gallery. - Check... | stack_v2_sparse_classes_75kplus_train_008849 | 2,374 | no_license | [
{
"docstring": "Return only the id of the user or listing for the gallery and not the entire object.",
"name": "to_representation",
"signature": "def to_representation(self, instance)"
},
{
"docstring": "Validate creation of gallery. - Check if user exists or has listing to make gallery - Check ... | 2 | stack_v2_sparse_classes_30k_test_002305 | Implement the Python class `GallerySerializer` described below.
Class description:
Serializer to create galleries
Method signatures and docstrings:
- def to_representation(self, instance): Return only the id of the user or listing for the gallery and not the entire object.
- def validate(self, data): Validate creatio... | Implement the Python class `GallerySerializer` described below.
Class description:
Serializer to create galleries
Method signatures and docstrings:
- def to_representation(self, instance): Return only the id of the user or listing for the gallery and not the entire object.
- def validate(self, data): Validate creatio... | 1f2c8c232372de6a40089c8b867ce1798d2296c7 | <|skeleton|>
class GallerySerializer:
"""Serializer to create galleries"""
def to_representation(self, instance):
"""Return only the id of the user or listing for the gallery and not the entire object."""
<|body_0|>
def validate(self, data):
"""Validate creation of gallery. - Check... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GallerySerializer:
"""Serializer to create galleries"""
def to_representation(self, instance):
"""Return only the id of the user or listing for the gallery and not the entire object."""
response = super().to_representation(instance)
if hasattr(response, 'user'):
respon... | the_stack_v2_python_sparse | core/roommates_api/serializers/gallery_serializers.py | harmanT23/yournextroommates | train | 1 |
b09db8a6ae43d53ee7fc44f6bb91bca1235d5e62 | [
"url = f'https://qyapi.weixin.qq.com/cgi-bin/department/create?access_token={self.token}'\nkwargs = {'method': 'post', 'url': url, 'json': data}\nr = self.requests(kwargs)\nreturn r.json()",
"url = f'https://qyapi.weixin.qq.com/cgi-bin/department/update?access_token={self.token}'\nkwargs = {'method': 'post', 'url... | <|body_start_0|>
url = f'https://qyapi.weixin.qq.com/cgi-bin/department/create?access_token={self.token}'
kwargs = {'method': 'post', 'url': url, 'json': data}
r = self.requests(kwargs)
return r.json()
<|end_body_0|>
<|body_start_1|>
url = f'https://qyapi.weixin.qq.com/cgi-bin/d... | Department | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Department:
def create_department(self, data):
"""创建部门 :param data: 创建部门信息 :return: json格式响应信息"""
<|body_0|>
def update_department(self, data):
"""更新部门 :param data: 更新部门信息 :return: json格式响应信息"""
<|body_1|>
def delete_department(self, id):
"""删除部门... | stack_v2_sparse_classes_75kplus_train_008850 | 2,038 | no_license | [
{
"docstring": "创建部门 :param data: 创建部门信息 :return: json格式响应信息",
"name": "create_department",
"signature": "def create_department(self, data)"
},
{
"docstring": "更新部门 :param data: 更新部门信息 :return: json格式响应信息",
"name": "update_department",
"signature": "def update_department(self, data)"
}... | 5 | null | Implement the Python class `Department` described below.
Class description:
Implement the Department class.
Method signatures and docstrings:
- def create_department(self, data): 创建部门 :param data: 创建部门信息 :return: json格式响应信息
- def update_department(self, data): 更新部门 :param data: 更新部门信息 :return: json格式响应信息
- def delete... | Implement the Python class `Department` described below.
Class description:
Implement the Department class.
Method signatures and docstrings:
- def create_department(self, data): 创建部门 :param data: 创建部门信息 :return: json格式响应信息
- def update_department(self, data): 更新部门 :param data: 更新部门信息 :return: json格式响应信息
- def delete... | 1a095821fea2bcc8d84fe2a479365a0421b4f6d5 | <|skeleton|>
class Department:
def create_department(self, data):
"""创建部门 :param data: 创建部门信息 :return: json格式响应信息"""
<|body_0|>
def update_department(self, data):
"""更新部门 :param data: 更新部门信息 :return: json格式响应信息"""
<|body_1|>
def delete_department(self, id):
"""删除部门... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Department:
def create_department(self, data):
"""创建部门 :param data: 创建部门信息 :return: json格式响应信息"""
url = f'https://qyapi.weixin.qq.com/cgi-bin/department/create?access_token={self.token}'
kwargs = {'method': 'post', 'url': url, 'json': data}
r = self.requests(kwargs)
ret... | the_stack_v2_python_sparse | Assignment/E10_TestAPI/apis/department.py | Lusilucy/RoseExcercise | train | 2 | |
6a130813f7c4c3f11851511a738240c112b01f91 | [
"def rec(node: TreeNode):\n if node.right:\n rec(node.right)\n res.append(node.val)\n if node.left:\n rec(node.left)\nres = []\nrec(root)\nreturn res[k - 1]",
"stack = []\np = root\ncount = 0\nwhile stack or p:\n while p:\n stack.append(p)\n p = p.right\n cur = stack.pop... | <|body_start_0|>
def rec(node: TreeNode):
if node.right:
rec(node.right)
res.append(node.val)
if node.left:
rec(node.left)
res = []
rec(root)
return res[k - 1]
<|end_body_0|>
<|body_start_1|>
stack = []
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def kthLargest(self, root: TreeNode, k: int) -> int:
"""倒过来的中序遍历 :param root: :param k: :return:"""
<|body_0|>
def kthLargest(self, root: TreeNode, k: int) -> int:
"""不递归 :param root: :param k: :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_... | stack_v2_sparse_classes_75kplus_train_008851 | 1,882 | no_license | [
{
"docstring": "倒过来的中序遍历 :param root: :param k: :return:",
"name": "kthLargest",
"signature": "def kthLargest(self, root: TreeNode, k: int) -> int"
},
{
"docstring": "不递归 :param root: :param k: :return:",
"name": "kthLargest",
"signature": "def kthLargest(self, root: TreeNode, k: int) ->... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def kthLargest(self, root: TreeNode, k: int) -> int: 倒过来的中序遍历 :param root: :param k: :return:
- def kthLargest(self, root: TreeNode, k: int) -> int: 不递归 :param root: :param k: :r... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def kthLargest(self, root: TreeNode, k: int) -> int: 倒过来的中序遍历 :param root: :param k: :return:
- def kthLargest(self, root: TreeNode, k: int) -> int: 不递归 :param root: :param k: :r... | b1680014ce3f55ba952a1e64241c0cbb783cc436 | <|skeleton|>
class Solution:
def kthLargest(self, root: TreeNode, k: int) -> int:
"""倒过来的中序遍历 :param root: :param k: :return:"""
<|body_0|>
def kthLargest(self, root: TreeNode, k: int) -> int:
"""不递归 :param root: :param k: :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def kthLargest(self, root: TreeNode, k: int) -> int:
"""倒过来的中序遍历 :param root: :param k: :return:"""
def rec(node: TreeNode):
if node.right:
rec(node.right)
res.append(node.val)
if node.left:
rec(node.left)
re... | the_stack_v2_python_sparse | 54.py | sun510001/leetcode_jianzhi_offer_2 | train | 0 | |
cba7a500f720314998b806e07249b0856f963d60 | [
"self.auto_lock_after_duration_idle = auto_lock_after_duration_idle\nself.default_file_retention_duration_msecs = default_file_retention_duration_msecs\nself.expiry_timestamp_msecs = expiry_timestamp_msecs\nself.locking_protocol = locking_protocol\nself.max_retention_duration_msecs = max_retention_duration_msecs\ns... | <|body_start_0|>
self.auto_lock_after_duration_idle = auto_lock_after_duration_idle
self.default_file_retention_duration_msecs = default_file_retention_duration_msecs
self.expiry_timestamp_msecs = expiry_timestamp_msecs
self.locking_protocol = locking_protocol
self.max_retention_... | Implementation of the 'FileLevelDataLockConfig' model. Specifies a config to lock files in a view - to protect from malicious or an accidental attempt to delete or modify the files in this view. Attributes: auto_lock_after_duration_idle (long|int): Specifies the duration to lock a file that has not been accessed or mod... | FileLevelDataLockConfig | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FileLevelDataLockConfig:
"""Implementation of the 'FileLevelDataLockConfig' model. Specifies a config to lock files in a view - to protect from malicious or an accidental attempt to delete or modify the files in this view. Attributes: auto_lock_after_duration_idle (long|int): Specifies the durati... | stack_v2_sparse_classes_75kplus_train_008852 | 6,693 | permissive | [
{
"docstring": "Constructor for the FileLevelDataLockConfig class",
"name": "__init__",
"signature": "def __init__(self, auto_lock_after_duration_idle=None, default_file_retention_duration_msecs=None, expiry_timestamp_msecs=None, locking_protocol=None, max_retention_duration_msecs=None, min_retention_du... | 2 | stack_v2_sparse_classes_30k_train_045736 | Implement the Python class `FileLevelDataLockConfig` described below.
Class description:
Implementation of the 'FileLevelDataLockConfig' model. Specifies a config to lock files in a view - to protect from malicious or an accidental attempt to delete or modify the files in this view. Attributes: auto_lock_after_duratio... | Implement the Python class `FileLevelDataLockConfig` described below.
Class description:
Implementation of the 'FileLevelDataLockConfig' model. Specifies a config to lock files in a view - to protect from malicious or an accidental attempt to delete or modify the files in this view. Attributes: auto_lock_after_duratio... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class FileLevelDataLockConfig:
"""Implementation of the 'FileLevelDataLockConfig' model. Specifies a config to lock files in a view - to protect from malicious or an accidental attempt to delete or modify the files in this view. Attributes: auto_lock_after_duration_idle (long|int): Specifies the durati... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class FileLevelDataLockConfig:
"""Implementation of the 'FileLevelDataLockConfig' model. Specifies a config to lock files in a view - to protect from malicious or an accidental attempt to delete or modify the files in this view. Attributes: auto_lock_after_duration_idle (long|int): Specifies the duration to lock a ... | the_stack_v2_python_sparse | cohesity_management_sdk/models/file_level_data_lock_config.py | cohesity/management-sdk-python | train | 24 |
0e2229b616d9f49e9080b271842340ed4c456852 | [
"eps = 1e-09\nout = -np.sum(y * np.log(x + eps), axis=1).mean()\nreturn out",
"eps = 1e-09\ndx = -y / (len(y) * (x + eps))\nreturn dx"
] | <|body_start_0|>
eps = 1e-09
out = -np.sum(y * np.log(x + eps), axis=1).mean()
return out
<|end_body_0|>
<|body_start_1|>
eps = 1e-09
dx = -y / (len(y) * (x + eps))
return dx
<|end_body_1|>
| Cross entropy loss module. | CrossEntropyModule | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CrossEntropyModule:
"""Cross entropy loss module."""
def forward(self, x, y):
"""Forward pass. Args: x: input to the module y: labels of the input Returns: out: cross entropy loss"""
<|body_0|>
def backward(self, x, y):
"""Backward pass. Args: x: input to the mod... | stack_v2_sparse_classes_75kplus_train_008853 | 5,181 | no_license | [
{
"docstring": "Forward pass. Args: x: input to the module y: labels of the input Returns: out: cross entropy loss",
"name": "forward",
"signature": "def forward(self, x, y)"
},
{
"docstring": "Backward pass. Args: x: input to the module y: labels of the input Returns: dx: gradient of the loss w... | 2 | stack_v2_sparse_classes_30k_train_006321 | Implement the Python class `CrossEntropyModule` described below.
Class description:
Cross entropy loss module.
Method signatures and docstrings:
- def forward(self, x, y): Forward pass. Args: x: input to the module y: labels of the input Returns: out: cross entropy loss
- def backward(self, x, y): Backward pass. Args... | Implement the Python class `CrossEntropyModule` described below.
Class description:
Cross entropy loss module.
Method signatures and docstrings:
- def forward(self, x, y): Forward pass. Args: x: input to the module y: labels of the input Returns: out: cross entropy loss
- def backward(self, x, y): Backward pass. Args... | b2cd0d67337b101f3e204e519625e1aaf3cea43b | <|skeleton|>
class CrossEntropyModule:
"""Cross entropy loss module."""
def forward(self, x, y):
"""Forward pass. Args: x: input to the module y: labels of the input Returns: out: cross entropy loss"""
<|body_0|>
def backward(self, x, y):
"""Backward pass. Args: x: input to the mod... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CrossEntropyModule:
"""Cross entropy loss module."""
def forward(self, x, y):
"""Forward pass. Args: x: input to the module y: labels of the input Returns: out: cross entropy loss"""
eps = 1e-09
out = -np.sum(y * np.log(x + eps), axis=1).mean()
return out
def backward... | the_stack_v2_python_sparse | assignment_1/code/modules.py | Ivan-Yovchev/uvadlc_practicals_2019 | train | 0 |
58048b9e6835721f5c462c2ee00e00790515184c | [
"app_dir = os.environ['APP_DIR']\napp_module = os.environ['APP_MODULE']\nscript_dir = os.environ['SCRIPT_DIR']\npublic_dir = os.environ['PUBLIC_DIR']\nos.chdir(app_dir)\napp = load_definition_from_string('{0}.app.application'.format(app_module))\nkwargs = {'app': app, 'script_dir': script_dir, 'public_dir': public_... | <|body_start_0|>
app_dir = os.environ['APP_DIR']
app_module = os.environ['APP_MODULE']
script_dir = os.environ['SCRIPT_DIR']
public_dir = os.environ['PUBLIC_DIR']
os.chdir(app_dir)
app = load_definition_from_string('{0}.app.application'.format(app_module))
kwargs ... | Development related tasks. Example: .. code-block:: ./console.py dev runserver Provides access to the following commands during development: - runserver | Dev | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Dev:
"""Development related tasks. Example: .. code-block:: ./console.py dev runserver Provides access to the following commands during development: - runserver"""
def runserver(self, host, port, noreload):
"""Runs the development server for the current application. Args: host: The h... | stack_v2_sparse_classes_75kplus_train_008854 | 1,834 | permissive | [
{
"docstring": "Runs the development server for the current application. Args: host: The host to bind to port: The port to run on",
"name": "runserver",
"signature": "def runserver(self, host, port, noreload)"
},
{
"docstring": "Run an interactive shell based on the current application. The curr... | 2 | stack_v2_sparse_classes_30k_train_002394 | Implement the Python class `Dev` described below.
Class description:
Development related tasks. Example: .. code-block:: ./console.py dev runserver Provides access to the following commands during development: - runserver
Method signatures and docstrings:
- def runserver(self, host, port, noreload): Runs the developm... | Implement the Python class `Dev` described below.
Class description:
Development related tasks. Example: .. code-block:: ./console.py dev runserver Provides access to the following commands during development: - runserver
Method signatures and docstrings:
- def runserver(self, host, port, noreload): Runs the developm... | ffe157cb3fe24366ee55869d4260cce778012b4a | <|skeleton|>
class Dev:
"""Development related tasks. Example: .. code-block:: ./console.py dev runserver Provides access to the following commands during development: - runserver"""
def runserver(self, host, port, noreload):
"""Runs the development server for the current application. Args: host: The h... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Dev:
"""Development related tasks. Example: .. code-block:: ./console.py dev runserver Provides access to the following commands during development: - runserver"""
def runserver(self, host, port, noreload):
"""Runs the development server for the current application. Args: host: The host to bind t... | the_stack_v2_python_sparse | watson/framework/support/console/commands/development.py | watsonpy/watson-framework | train | 69 |
964964a23a07ff5cdfd58fc23863081689afaab5 | [
"total = sum(nums)\nlength = 2 * total + 1\noffset = total\ndp = [False] * length\ndp[offset] = True\nfor n in nums:\n temp = [False] * length\n for i in range(n, length - n):\n if dp[i]:\n temp[i - n] = True\n temp[i + n] = True\n dp = temp\nreturn dp[offset]",
"total = sum(... | <|body_start_0|>
total = sum(nums)
length = 2 * total + 1
offset = total
dp = [False] * length
dp[offset] = True
for n in nums:
temp = [False] * length
for i in range(n, length - n):
if dp[i]:
temp[i - n] = True
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def canPartition(self, nums):
""":type nums: List[int] :rtype: bool"""
<|body_0|>
def canPartition1(self, nums):
""":type nums: List[int] :rtype: bool"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
total = sum(nums)
length = 2 * t... | stack_v2_sparse_classes_75kplus_train_008855 | 1,600 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: bool",
"name": "canPartition",
"signature": "def canPartition(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: bool",
"name": "canPartition1",
"signature": "def canPartition1(self, nums)"
}
] | 2 | stack_v2_sparse_classes_30k_train_016053 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def canPartition(self, nums): :type nums: List[int] :rtype: bool
- def canPartition1(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 canPartition(self, nums): :type nums: List[int] :rtype: bool
- def canPartition1(self, nums): :type nums: List[int] :rtype: bool
<|skeleton|>
class Solution:
def canPar... | 857b8c7fccfe8216da59228c1cf3675444855673 | <|skeleton|>
class Solution:
def canPartition(self, nums):
""":type nums: List[int] :rtype: bool"""
<|body_0|>
def canPartition1(self, nums):
""":type nums: List[int] :rtype: bool"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def canPartition(self, nums):
""":type nums: List[int] :rtype: bool"""
total = sum(nums)
length = 2 * total + 1
offset = total
dp = [False] * length
dp[offset] = True
for n in nums:
temp = [False] * length
for i in range... | the_stack_v2_python_sparse | algorithm/Partition-Equal-Subset-Sum.py | atashi/LLL | train | 0 | |
d435788c17e92654e33e6184cebc04b118a7bf02 | [
"self.parameters = parameters\nself.optimize = optimize\nself.param_values = kwargs",
"params = self.param_values.copy()\nindex = 0\nfor param_name in self.optimize:\n if not isinstance(self.param_values[param_name], np.ndarray) or len(self.param_values[param_name].shape) == 0:\n params[param_name] = x[... | <|body_start_0|>
self.parameters = parameters
self.optimize = optimize
self.param_values = kwargs
<|end_body_0|>
<|body_start_1|>
params = self.param_values.copy()
index = 0
for param_name in self.optimize:
if not isinstance(self.param_values[param_name], np.... | ParameterManager | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ParameterManager:
def __init__(self, parameters, optimize, **kwargs):
"""Create a parameter manager :param parameters: The parameters to manage :type parameters: list of strings :param optimize: The parameters that should be optimized. Has to be a subset of parameters :type optimize: lis... | stack_v2_sparse_classes_75kplus_train_008856 | 9,249 | permissive | [
{
"docstring": "Create a parameter manager :param parameters: The parameters to manage :type parameters: list of strings :param optimize: The parameters that should be optimized. Has to be a subset of parameters :type optimize: list of strings :param **kwargs: Initial values of the parameters",
"name": "__i... | 4 | stack_v2_sparse_classes_30k_train_032557 | Implement the Python class `ParameterManager` described below.
Class description:
Implement the ParameterManager class.
Method signatures and docstrings:
- def __init__(self, parameters, optimize, **kwargs): Create a parameter manager :param parameters: The parameters to manage :type parameters: list of strings :para... | Implement the Python class `ParameterManager` described below.
Class description:
Implement the ParameterManager class.
Method signatures and docstrings:
- def __init__(self, parameters, optimize, **kwargs): Create a parameter manager :param parameters: The parameters to manage :type parameters: list of strings :para... | 0664dba9b637f64b089b3a44b191dd24da84a30e | <|skeleton|>
class ParameterManager:
def __init__(self, parameters, optimize, **kwargs):
"""Create a parameter manager :param parameters: The parameters to manage :type parameters: list of strings :param optimize: The parameters that should be optimized. Has to be a subset of parameters :type optimize: lis... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ParameterManager:
def __init__(self, parameters, optimize, **kwargs):
"""Create a parameter manager :param parameters: The parameters to manage :type parameters: list of strings :param optimize: The parameters that should be optimized. Has to be a subset of parameters :type optimize: list of strings :... | the_stack_v2_python_sparse | pysaliency/optpy/optimization.py | matthias-k/pysaliency | train | 142 | |
bd3ffce8f8f65094804a0236b96ac7d1da1d6cfe | [
"self.config = config_\nself.logger = logging.getLogger('cuda_logger')\nself.radius = self.config['RL_parameters']['neighborhood_radius']",
"self.logger.info('Starting job: NeighborhoodDataExportJob\\n')\ndata_provider = DataProvider(self.config)\ndata_exporter = DataExporter(self.config)\nhex_attr_df = data_prov... | <|body_start_0|>
self.config = config_
self.logger = logging.getLogger('cuda_logger')
self.radius = self.config['RL_parameters']['neighborhood_radius']
<|end_body_0|>
<|body_start_1|>
self.logger.info('Starting job: NeighborhoodDataExportJob\n')
data_provider = DataProvider(self... | This class implements a job to export the neighborhood data | NeighborhoodDataExportJob | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NeighborhoodDataExportJob:
"""This class implements a job to export the neighborhood data"""
def __init__(self, config_):
"""Constructor :param config_: :param viz_name: :return:"""
<|body_0|>
def run(self):
"""This method executes the job :param: :return:"""
... | stack_v2_sparse_classes_75kplus_train_008857 | 1,581 | no_license | [
{
"docstring": "Constructor :param config_: :param viz_name: :return:",
"name": "__init__",
"signature": "def __init__(self, config_)"
},
{
"docstring": "This method executes the job :param: :return:",
"name": "run",
"signature": "def run(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_054376 | Implement the Python class `NeighborhoodDataExportJob` described below.
Class description:
This class implements a job to export the neighborhood data
Method signatures and docstrings:
- def __init__(self, config_): Constructor :param config_: :param viz_name: :return:
- def run(self): This method executes the job :p... | Implement the Python class `NeighborhoodDataExportJob` described below.
Class description:
This class implements a job to export the neighborhood data
Method signatures and docstrings:
- def __init__(self, config_): Constructor :param config_: :param viz_name: :return:
- def run(self): This method executes the job :p... | f7fcd2cc1d6ba18b199d176d4d39193f025ee281 | <|skeleton|>
class NeighborhoodDataExportJob:
"""This class implements a job to export the neighborhood data"""
def __init__(self, config_):
"""Constructor :param config_: :param viz_name: :return:"""
<|body_0|>
def run(self):
"""This method executes the job :param: :return:"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class NeighborhoodDataExportJob:
"""This class implements a job to export the neighborhood data"""
def __init__(self, config_):
"""Constructor :param config_: :param viz_name: :return:"""
self.config = config_
self.logger = logging.getLogger('cuda_logger')
self.radius = self.con... | the_stack_v2_python_sparse | learn_to_earn_framework/jobs/export_neighborhood_data.py | transparent-framework/optimize-ride-sharing-earnings | train | 7 |
aa431b9798c5148574f25fee0ee21204fef0165f | [
"instructions = {}\nif flatten:\n obj, unflatten_kwargs = cls._flatten_dataframe(dataframe=obj)\n instructions['unflatten_kwargs'] = unflatten_kwargs\nobj.to_csv(path_or_buf=file_path, **to_kwargs)\nreturn instructions",
"obj = pd.read_csv(filepath_or_buffer=file_path, **read_kwargs)\nif unflatten_kwargs is... | <|body_start_0|>
instructions = {}
if flatten:
obj, unflatten_kwargs = cls._flatten_dataframe(dataframe=obj)
instructions['unflatten_kwargs'] = unflatten_kwargs
obj.to_csv(path_or_buf=file_path, **to_kwargs)
return instructions
<|end_body_0|>
<|body_start_1|>
... | A static class for managing pandas csv files. | _CSVFormatter | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _CSVFormatter:
"""A static class for managing pandas csv files."""
def to(cls, obj: pd.DataFrame, file_path: str, flatten: bool=True, **to_kwargs) -> dict:
"""Save the given dataframe to the csv file path given. :param obj: The dataframe to save. :param file_path: The file to save to... | stack_v2_sparse_classes_75kplus_train_008858 | 35,951 | permissive | [
{
"docstring": "Save the given dataframe to the csv file path given. :param obj: The dataframe to save. :param file_path: The file to save to. :param flatten: Whether to flatten the dataframe before saving. For some formats it is mandatory to enable flattening, otherwise saving and loading the dataframe will ca... | 2 | stack_v2_sparse_classes_30k_val_002180 | Implement the Python class `_CSVFormatter` described below.
Class description:
A static class for managing pandas csv files.
Method signatures and docstrings:
- def to(cls, obj: pd.DataFrame, file_path: str, flatten: bool=True, **to_kwargs) -> dict: Save the given dataframe to the csv file path given. :param obj: The... | Implement the Python class `_CSVFormatter` described below.
Class description:
A static class for managing pandas csv files.
Method signatures and docstrings:
- def to(cls, obj: pd.DataFrame, file_path: str, flatten: bool=True, **to_kwargs) -> dict: Save the given dataframe to the csv file path given. :param obj: The... | b5fe0c05ae7f5818a4a5a5a40245c851ff9b2c77 | <|skeleton|>
class _CSVFormatter:
"""A static class for managing pandas csv files."""
def to(cls, obj: pd.DataFrame, file_path: str, flatten: bool=True, **to_kwargs) -> dict:
"""Save the given dataframe to the csv file path given. :param obj: The dataframe to save. :param file_path: The file to save to... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class _CSVFormatter:
"""A static class for managing pandas csv files."""
def to(cls, obj: pd.DataFrame, file_path: str, flatten: bool=True, **to_kwargs) -> dict:
"""Save the given dataframe to the csv file path given. :param obj: The dataframe to save. :param file_path: The file to save to. :param flat... | the_stack_v2_python_sparse | mlrun/package/packagers/pandas_packagers.py | mlrun/mlrun | train | 1,093 |
a662e6bb68bf40c9ab2a7e7c0fea7a4d66a6a2b3 | [
"self.vk = []\nself.vkstat = []\nself.x = x\nself.y = y\nself.mu0 = 0\nself.var0 = 0\nfor x in self.x:\n for y in self.y:\n if x != 0 or y != 0:\n q = qmtx[x][y]\n vki = dct[x * 8 + y, :]\n if np.sum(np.array(vki) != 0) > 10:\n vki_stat = stats.DCTstat(vki, ... | <|body_start_0|>
self.vk = []
self.vkstat = []
self.x = x
self.y = y
self.mu0 = 0
self.var0 = 0
for x in self.x:
for y in self.y:
if x != 0 or y != 0:
q = qmtx[x][y]
vki = dct[x * 8 + y, :]
... | The purpose of this class is to gather all the dct-statistics from 1 image (from the 63 AC modes), and then building the required statistics to conduct the delta star test to check wether the image is detected as a cover image or a stego one. | IMGstat | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IMGstat:
"""The purpose of this class is to gather all the dct-statistics from 1 image (from the 63 AC modes), and then building the required statistics to conduct the delta star test to check wether the image is detected as a cover image or a stego one."""
def __init__(self, dct, qmtx, x=ra... | stack_v2_sparse_classes_75kplus_train_008859 | 5,047 | no_license | [
{
"docstring": "The input array is expected to be a 2-D array of the DCTed image we want to test.",
"name": "__init__",
"signature": "def __init__(self, dct, qmtx, x=range(8), y=range(8), payload=None)"
},
{
"docstring": "We start by computing the LAMBDA(V) as expressed in Eq. (47).",
"name"... | 2 | stack_v2_sparse_classes_30k_train_024422 | Implement the Python class `IMGstat` described below.
Class description:
The purpose of this class is to gather all the dct-statistics from 1 image (from the 63 AC modes), and then building the required statistics to conduct the delta star test to check wether the image is detected as a cover image or a stego one.
Me... | Implement the Python class `IMGstat` described below.
Class description:
The purpose of this class is to gather all the dct-statistics from 1 image (from the 63 AC modes), and then building the required statistics to conduct the delta star test to check wether the image is detected as a cover image or a stego one.
Me... | f2a96704b0eac37b86a6f3955b86b840039c5806 | <|skeleton|>
class IMGstat:
"""The purpose of this class is to gather all the dct-statistics from 1 image (from the 63 AC modes), and then building the required statistics to conduct the delta star test to check wether the image is detected as a cover image or a stego one."""
def __init__(self, dct, qmtx, x=ra... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class IMGstat:
"""The purpose of this class is to gather all the dct-statistics from 1 image (from the 63 AC modes), and then building the required statistics to conduct the delta star test to check wether the image is detected as a cover image or a stego one."""
def __init__(self, dct, qmtx, x=range(8), y=ran... | the_stack_v2_python_sparse | jstegclass.py | malletan/ST09-Antoine-Mallet | train | 0 |
81a0a63d74b046d0352f5a8e440ad5238b91a287 | [
"foto = []\ncursor = db.foto_collection.find()\nfor document in await cursor.to_list(length=2000):\n foto.append(document)\n logging.debug(document)\nreturn foto",
"foto = []\ncursor = db.foto_collection.find({'Løpsklasse': lopsklasse})\nfor document in await cursor.to_list(length=500):\n foto.append(doc... | <|body_start_0|>
foto = []
cursor = db.foto_collection.find()
for document in await cursor.to_list(length=2000):
foto.append(document)
logging.debug(document)
return foto
<|end_body_0|>
<|body_start_1|>
foto = []
cursor = db.foto_collection.find({... | Class representing foto service. | FotoService | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FotoService:
"""Class representing foto service."""
async def get_all_foto(self, db: Any) -> List:
"""Get all foto function."""
<|body_0|>
async def get_foto_by_klasse(self, db: Any, lopsklasse: str) -> List:
"""Get all foto for a given klasse."""
<|body_... | stack_v2_sparse_classes_75kplus_train_008860 | 7,953 | permissive | [
{
"docstring": "Get all foto function.",
"name": "get_all_foto",
"signature": "async def get_all_foto(self, db: Any) -> List"
},
{
"docstring": "Get all foto for a given klasse.",
"name": "get_foto_by_klasse",
"signature": "async def get_foto_by_klasse(self, db: Any, lopsklasse: str) -> ... | 5 | stack_v2_sparse_classes_30k_train_037197 | Implement the Python class `FotoService` described below.
Class description:
Class representing foto service.
Method signatures and docstrings:
- async def get_all_foto(self, db: Any) -> List: Get all foto function.
- async def get_foto_by_klasse(self, db: Any, lopsklasse: str) -> List: Get all foto for a given klass... | Implement the Python class `FotoService` described below.
Class description:
Class representing foto service.
Method signatures and docstrings:
- async def get_all_foto(self, db: Any) -> List: Get all foto function.
- async def get_foto_by_klasse(self, db: Any, lopsklasse: str) -> List: Get all foto for a given klass... | 065a96d102a6658e5422ea6a0be5abde4b6558e1 | <|skeleton|>
class FotoService:
"""Class representing foto service."""
async def get_all_foto(self, db: Any) -> List:
"""Get all foto function."""
<|body_0|>
async def get_foto_by_klasse(self, db: Any, lopsklasse: str) -> List:
"""Get all foto for a given klasse."""
<|body_... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class FotoService:
"""Class representing foto service."""
async def get_all_foto(self, db: Any) -> List:
"""Get all foto function."""
foto = []
cursor = db.foto_collection.find()
for document in await cursor.to_list(length=2000):
foto.append(document)
log... | the_stack_v2_python_sparse | src/sprint_webserver/services/foto_service.py | langrenn-sprint/sprint-webserver | train | 0 |
ee9293970ded784a2562a0a0430868e4e9eb8848 | [
"try:\n category = GoodsCategory.objects.get(id=value, parent=None)\nexcept GoodsCategory.DoesNotExist:\n raise serializers.ValidationError('一级分类不存在')\nreturn value",
"try:\n group = GoodsChannelGroup.objects.get(id=value)\nexcept GoodsChannelGroup.DoesNotExist:\n raise serializers.ValidationError('频道... | <|body_start_0|>
try:
category = GoodsCategory.objects.get(id=value, parent=None)
except GoodsCategory.DoesNotExist:
raise serializers.ValidationError('一级分类不存在')
return value
<|end_body_0|>
<|body_start_1|>
try:
group = GoodsChannelGroup.objects.get(i... | 频道序列化器类 | ChannelSerializer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ChannelSerializer:
"""频道序列化器类"""
def validate_category_id(self, value):
"""一级分类是否存在"""
<|body_0|>
def validate_group_id(self, value):
"""频道组是否存在"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
try:
category = GoodsCategory.objects.ge... | stack_v2_sparse_classes_75kplus_train_008861 | 1,607 | no_license | [
{
"docstring": "一级分类是否存在",
"name": "validate_category_id",
"signature": "def validate_category_id(self, value)"
},
{
"docstring": "频道组是否存在",
"name": "validate_group_id",
"signature": "def validate_group_id(self, value)"
}
] | 2 | stack_v2_sparse_classes_30k_train_024542 | Implement the Python class `ChannelSerializer` described below.
Class description:
频道序列化器类
Method signatures and docstrings:
- def validate_category_id(self, value): 一级分类是否存在
- def validate_group_id(self, value): 频道组是否存在 | Implement the Python class `ChannelSerializer` described below.
Class description:
频道序列化器类
Method signatures and docstrings:
- def validate_category_id(self, value): 一级分类是否存在
- def validate_group_id(self, value): 频道组是否存在
<|skeleton|>
class ChannelSerializer:
"""频道序列化器类"""
def validate_category_id(self, valu... | cd23ae5fa4261f92dc92d4444dc58ff2e703d541 | <|skeleton|>
class ChannelSerializer:
"""频道序列化器类"""
def validate_category_id(self, value):
"""一级分类是否存在"""
<|body_0|>
def validate_group_id(self, value):
"""频道组是否存在"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ChannelSerializer:
"""频道序列化器类"""
def validate_category_id(self, value):
"""一级分类是否存在"""
try:
category = GoodsCategory.objects.get(id=value, parent=None)
except GoodsCategory.DoesNotExist:
raise serializers.ValidationError('一级分类不存在')
return value
... | the_stack_v2_python_sparse | meiduo_mall/meiduo_mall/apps/meiduo_admin/serializers/channels.py | YumiVan/meiduo | train | 1 |
c35bc2cab39f6d75fa3f2d72b4cf57ffec99e69c | [
"self._pool = pool\nself._connected = False\nself._lock = Lock()",
"if self._connected:\n return\nwith (yield self._lock.acquire()):\n if not self._connected:\n yield self._pool.connect()\n self._connected = True",
"yield self._connect()\nprint(operation)\nreturn (yield self._pool.execute(op... | <|body_start_0|>
self._pool = pool
self._connected = False
self._lock = Lock()
<|end_body_0|>
<|body_start_1|>
if self._connected:
return
with (yield self._lock.acquire()):
if not self._connected:
yield self._pool.connect()
... | A connection pool of the PostgreSQL. This wraps the `momoko.Pool` to initialize the connection when the first SQL statement is run. | PSQLConnPool | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PSQLConnPool:
"""A connection pool of the PostgreSQL. This wraps the `momoko.Pool` to initialize the connection when the first SQL statement is run."""
def __init__(self, pool):
"""Initializes PSQLConnPool Parameters ---------- pool : momoko.Pool A connection pool to run SQL queries.... | stack_v2_sparse_classes_75kplus_train_008862 | 4,530 | permissive | [
{
"docstring": "Initializes PSQLConnPool Parameters ---------- pool : momoko.Pool A connection pool to run SQL queries.",
"name": "__init__",
"signature": "def __init__(self, pool)"
},
{
"docstring": "Open connections in this pool. This is safe to call after connections are opened",
"name": ... | 3 | null | Implement the Python class `PSQLConnPool` described below.
Class description:
A connection pool of the PostgreSQL. This wraps the `momoko.Pool` to initialize the connection when the first SQL statement is run.
Method signatures and docstrings:
- def __init__(self, pool): Initializes PSQLConnPool Parameters ----------... | Implement the Python class `PSQLConnPool` described below.
Class description:
A connection pool of the PostgreSQL. This wraps the `momoko.Pool` to initialize the connection when the first SQL statement is run.
Method signatures and docstrings:
- def __init__(self, pool): Initializes PSQLConnPool Parameters ----------... | dacb2e6bd44cc641ebc79bbd7a06abce3d74800c | <|skeleton|>
class PSQLConnPool:
"""A connection pool of the PostgreSQL. This wraps the `momoko.Pool` to initialize the connection when the first SQL statement is run."""
def __init__(self, pool):
"""Initializes PSQLConnPool Parameters ---------- pool : momoko.Pool A connection pool to run SQL queries.... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PSQLConnPool:
"""A connection pool of the PostgreSQL. This wraps the `momoko.Pool` to initialize the connection when the first SQL statement is run."""
def __init__(self, pool):
"""Initializes PSQLConnPool Parameters ---------- pool : momoko.Pool A connection pool to run SQL queries."""
s... | the_stack_v2_python_sparse | workspace/utility.py | Azrealy/WorkSpace | train | 4 |
c8891271d8d984f723e2054ed2f82f1fceb2d087 | [
"user = self.new_user()\nsubscription = user.subscription_set.create(level=self.level10, amount=0)\nsubscription.recalculate()\nuser = get_user_model().objects.get(id=user.id)\nself.assertEqual(user.level.id, self.level10.id)\norder_id = self.add_to_cart(self.session1.sessionproduct)\nself.assertEqual(Order.objects... | <|body_start_0|>
user = self.new_user()
subscription = user.subscription_set.create(level=self.level10, amount=0)
subscription.recalculate()
user = get_user_model().objects.get(id=user.id)
self.assertEqual(user.level.id, self.level10.id)
order_id = self.add_to_cart(self.s... | MembershipTestCase | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MembershipTestCase:
def test_membership_discount(self):
"""Test to make sure that discounts are given for having an active membership"""
<|body_0|>
def test_membership_emails(self):
"""Sign up users at evere (test) membership level and verify that they get that disco... | stack_v2_sparse_classes_75kplus_train_008863 | 5,760 | no_license | [
{
"docstring": "Test to make sure that discounts are given for having an active membership",
"name": "test_membership_discount",
"signature": "def test_membership_discount(self)"
},
{
"docstring": "Sign up users at evere (test) membership level and verify that they get that discount.",
"name... | 2 | stack_v2_sparse_classes_30k_train_013259 | Implement the Python class `MembershipTestCase` described below.
Class description:
Implement the MembershipTestCase class.
Method signatures and docstrings:
- def test_membership_discount(self): Test to make sure that discounts are given for having an active membership
- def test_membership_emails(self): Sign up use... | Implement the Python class `MembershipTestCase` described below.
Class description:
Implement the MembershipTestCase class.
Method signatures and docstrings:
- def test_membership_discount(self): Test to make sure that discounts are given for having an active membership
- def test_membership_emails(self): Sign up use... | 4786ea8ba7cd4db42a70a2e43156ffdb1da91d21 | <|skeleton|>
class MembershipTestCase:
def test_membership_discount(self):
"""Test to make sure that discounts are given for having an active membership"""
<|body_0|>
def test_membership_emails(self):
"""Sign up users at evere (test) membership level and verify that they get that disco... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MembershipTestCase:
def test_membership_discount(self):
"""Test to make sure that discounts are given for having an active membership"""
user = self.new_user()
subscription = user.subscription_set.create(level=self.level10, amount=0)
subscription.recalculate()
user = ge... | the_stack_v2_python_sparse | membership/tests.py | morgantxrx/txrx.org | train | 0 | |
494464dd0e8f3ad3ac1f5e1d1e6810ca7927e742 | [
"if version == 0:\n version = [0]\nif version is None:\n version = []\nsuper().__init__(version)",
"d = decodeBA(d)\nlenBytes = intToBytes(len(d))\nbLen = len(lenBytes)\nif bLen > 2:\n raise DecredError('cannot push data longer than 65535')\nif bLen == 2:\n lBytes = bytearray((255, lenBytes[0], lenByt... | <|body_start_0|>
if version == 0:
version = [0]
if version is None:
version = []
super().__init__(version)
<|end_body_0|>
<|body_start_1|>
d = decodeBA(d)
lenBytes = intToBytes(len(d))
bLen = len(lenBytes)
if bLen > 2:
raise De... | The BuildyBytes class is used to construct (optionally versioned) linearly- encoded 2-D byte arrays. | BuildyBytes | [
"ISC"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BuildyBytes:
"""The BuildyBytes class is used to construct (optionally versioned) linearly- encoded 2-D byte arrays."""
def __init__(self, version=None):
"""Constructor for a BuildyBytes. Args: version (int): optinonal. The version to encode. Default encodes no version byte."""
... | stack_v2_sparse_classes_75kplus_train_008864 | 13,121 | permissive | [
{
"docstring": "Constructor for a BuildyBytes. Args: version (int): optinonal. The version to encode. Default encodes no version byte.",
"name": "__init__",
"signature": "def __init__(self, version=None)"
},
{
"docstring": "addData adds the data to the BuildyBytes. self is returned to enable cha... | 2 | stack_v2_sparse_classes_30k_train_039645 | Implement the Python class `BuildyBytes` described below.
Class description:
The BuildyBytes class is used to construct (optionally versioned) linearly- encoded 2-D byte arrays.
Method signatures and docstrings:
- def __init__(self, version=None): Constructor for a BuildyBytes. Args: version (int): optinonal. The ver... | Implement the Python class `BuildyBytes` described below.
Class description:
The BuildyBytes class is used to construct (optionally versioned) linearly- encoded 2-D byte arrays.
Method signatures and docstrings:
- def __init__(self, version=None): Constructor for a BuildyBytes. Args: version (int): optinonal. The ver... | f7f7d9f7da8d49d9ae9a72e5579b07a3b8572267 | <|skeleton|>
class BuildyBytes:
"""The BuildyBytes class is used to construct (optionally versioned) linearly- encoded 2-D byte arrays."""
def __init__(self, version=None):
"""Constructor for a BuildyBytes. Args: version (int): optinonal. The version to encode. Default encodes no version byte."""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BuildyBytes:
"""The BuildyBytes class is used to construct (optionally versioned) linearly- encoded 2-D byte arrays."""
def __init__(self, version=None):
"""Constructor for a BuildyBytes. Args: version (int): optinonal. The version to encode. Default encodes no version byte."""
if version... | the_stack_v2_python_sparse | decred/decred/util/encode.py | decred/tinydecred | train | 17 |
62bac999e14c362d9c79eb25ec950da3a56ce329 | [
"if not head or not head.next:\n return head\np1 = head\np2 = head.next\np1.next = None\nwhile p2:\n p2Next = p2.next\n p2.next = p1\n p1 = p2\n if p2Next:\n p2 = p2Next\n else:\n return p2",
"length = 0\nptr = head\nwhile ptr:\n length += 1\n ptr = ptr.next\nprint(length)\nh... | <|body_start_0|>
if not head or not head.next:
return head
p1 = head
p2 = head.next
p1.next = None
while p2:
p2Next = p2.next
p2.next = p1
p1 = p2
if p2Next:
p2 = p2Next
else:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def reverseList(self, head):
""":type head: ListNode :rtype: ListNode"""
<|body_0|>
def reorderList(self, head):
""":type head: ListNode :rtype: void Do not return anything, modify head in-place instead."""
<|body_1|>
<|end_skeleton|>
<|body_start... | stack_v2_sparse_classes_75kplus_train_008865 | 1,532 | no_license | [
{
"docstring": ":type head: ListNode :rtype: ListNode",
"name": "reverseList",
"signature": "def reverseList(self, head)"
},
{
"docstring": ":type head: ListNode :rtype: void Do not return anything, modify head in-place instead.",
"name": "reorderList",
"signature": "def reorderList(self... | 2 | stack_v2_sparse_classes_30k_train_052582 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def reverseList(self, head): :type head: ListNode :rtype: ListNode
- def reorderList(self, head): :type head: ListNode :rtype: void Do not return anything, modify head in-place i... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def reverseList(self, head): :type head: ListNode :rtype: ListNode
- def reorderList(self, head): :type head: ListNode :rtype: void Do not return anything, modify head in-place i... | 5fed58c0cbbaf7dfa6b27282e4914b691f9e0759 | <|skeleton|>
class Solution:
def reverseList(self, head):
""":type head: ListNode :rtype: ListNode"""
<|body_0|>
def reorderList(self, head):
""":type head: ListNode :rtype: void Do not return anything, modify head in-place instead."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def reverseList(self, head):
""":type head: ListNode :rtype: ListNode"""
if not head or not head.next:
return head
p1 = head
p2 = head.next
p1.next = None
while p2:
p2Next = p2.next
p2.next = p1
p1 = p2
... | the_stack_v2_python_sparse | LinkedList/reorderList.py | misa5555/py | train | 0 | |
de456300fedc1eaba50264732437b6b7ac9b127c | [
"params = dict()\nparams['rootobjectguid'] = rootobjectguid\nexecutionparams['rootobjecttype'] = 'drpdb'\nreturn q.workflowengine.actionmanager.startRootobjectActionSynchronous('drpdb', 'getObject', params, jobguid=jobguid, executionparams=executionparams)",
"params = dict()\nparams['name'] = name\nexecutionparam... | <|body_start_0|>
params = dict()
params['rootobjectguid'] = rootobjectguid
executionparams['rootobjecttype'] = 'drpdb'
return q.workflowengine.actionmanager.startRootobjectActionSynchronous('drpdb', 'getObject', params, jobguid=jobguid, executionparams=executionparams)
<|end_body_0|>
<|... | drpdb | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class drpdb:
def getObject(self, rootobjectguid, jobguid='', executionparams={}):
"""Gets the rootobject. @execution_method = sync @param rootobjectguid: guid of the rootobject @type rootobjectguid: guid @param executionparams: dictionary of job specific params e.g. userErrormsg, maxduration .... | stack_v2_sparse_classes_75kplus_train_008866 | 2,048 | no_license | [
{
"docstring": "Gets the rootobject. @execution_method = sync @param rootobjectguid: guid of the rootobject @type rootobjectguid: guid @param executionparams: dictionary of job specific params e.g. userErrormsg, maxduration ... @type executionparams: dictionary @return: rootobject @rtype: string",
"name": "... | 2 | stack_v2_sparse_classes_30k_train_002272 | Implement the Python class `drpdb` described below.
Class description:
Implement the drpdb class.
Method signatures and docstrings:
- def getObject(self, rootobjectguid, jobguid='', executionparams={}): Gets the rootobject. @execution_method = sync @param rootobjectguid: guid of the rootobject @type rootobjectguid: g... | Implement the Python class `drpdb` described below.
Class description:
Implement the drpdb class.
Method signatures and docstrings:
- def getObject(self, rootobjectguid, jobguid='', executionparams={}): Gets the rootobject. @execution_method = sync @param rootobjectguid: guid of the rootobject @type rootobjectguid: g... | 53d349fa6bee0ccead29afd6676979b44c109a61 | <|skeleton|>
class drpdb:
def getObject(self, rootobjectguid, jobguid='', executionparams={}):
"""Gets the rootobject. @execution_method = sync @param rootobjectguid: guid of the rootobject @type rootobjectguid: guid @param executionparams: dictionary of job specific params e.g. userErrormsg, maxduration .... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class drpdb:
def getObject(self, rootobjectguid, jobguid='', executionparams={}):
"""Gets the rootobject. @execution_method = sync @param rootobjectguid: guid of the rootobject @type rootobjectguid: guid @param executionparams: dictionary of job specific params e.g. userErrormsg, maxduration ... @type execu... | the_stack_v2_python_sparse | apps/cloud_api_generator/generatedServer/cloud_api_rootobjects/cloud_api_drpdb.py | racktivity/ext-pylabs-core | train | 0 | |
9cd2dd36a4a22783770982a41cd08beb2419702c | [
"response = requests.get(self.url, stream=True)\ntotal_size = int(response.headers.get('content-length'))\nblock_size = int(total_size / 1024)\nzip_file = BytesIO()\nfor data in tqdm(response.iter_content(chunk_size=block_size), total=1024):\n zip_file.write(data)\nzip_archive = zipfile.ZipFile(zip_file)\nfile_n... | <|body_start_0|>
response = requests.get(self.url, stream=True)
total_size = int(response.headers.get('content-length'))
block_size = int(total_size / 1024)
zip_file = BytesIO()
for data in tqdm(response.iter_content(chunk_size=block_size), total=1024):
zip_file.write... | Provides access to a forestry production and trade databases from http://www.fao.org/faostat/en/#data/FO The download method gets data from a bulk file specified in the url attribute of this class. The forestry method returns a data frame containing round wood and fuel wood harvest volumes. | Faostat | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Faostat:
"""Provides access to a forestry production and trade databases from http://www.fao.org/faostat/en/#data/FO The download method gets data from a bulk file specified in the url attribute of this class. The forestry method returns a data frame containing round wood and fuel wood harvest vo... | stack_v2_sparse_classes_75kplus_train_008867 | 5,193 | permissive | [
{
"docstring": "A method to automatically downloaded the needed CSV file. You should only need to run this once. Use it like this: >>> from cbmcfs3_runner.faostat import faostat >>> faostat.download()",
"name": "download",
"signature": "def download(self)"
},
{
"docstring": "Transform the raw da... | 2 | null | Implement the Python class `Faostat` described below.
Class description:
Provides access to a forestry production and trade databases from http://www.fao.org/faostat/en/#data/FO The download method gets data from a bulk file specified in the url attribute of this class. The forestry method returns a data frame contain... | Implement the Python class `Faostat` described below.
Class description:
Provides access to a forestry production and trade databases from http://www.fao.org/faostat/en/#data/FO The download method gets data from a bulk file specified in the url attribute of this class. The forestry method returns a data frame contain... | ec532819e0a086077475bfd479836a378f187f6f | <|skeleton|>
class Faostat:
"""Provides access to a forestry production and trade databases from http://www.fao.org/faostat/en/#data/FO The download method gets data from a bulk file specified in the url attribute of this class. The forestry method returns a data frame containing round wood and fuel wood harvest vo... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Faostat:
"""Provides access to a forestry production and trade databases from http://www.fao.org/faostat/en/#data/FO The download method gets data from a bulk file specified in the url attribute of this class. The forestry method returns a data frame containing round wood and fuel wood harvest volumes."""
... | the_stack_v2_python_sparse | cbmcfs3_runner/pump/faostat.py | xapple/cbmcfs3_runner | train | 2 |
c5351bcad4189e4716b77b7f26018b8507107f17 | [
"self.covariance_type = covariance_type\nself.N = N\nself.K = size\nself.mu = np.empty((self.N, self.K), dtype=DTYPE)\nif self.covariance_type == 'spherical':\n self.Sigma = np.empty((self.N, 1), dtype=DTYPE)\nelif self.covariance_type == 'diagonal':\n self.Sigma = np.empty((self.N, self.K), dtype=DTYPE)",
... | <|body_start_0|>
self.covariance_type = covariance_type
self.N = N
self.K = size
self.mu = np.empty((self.N, self.K), dtype=DTYPE)
if self.covariance_type == 'spherical':
self.Sigma = np.empty((self.N, 1), dtype=DTYPE)
elif self.covariance_type == 'diagonal':
... | GaussianDistribution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GaussianDistribution:
def __init__(self, N, size=100, covariance_type='spherical'):
"""Holds N size-dimensional Guassians with specified covariance structure N = number of distributions (e.g. number of words) size = dimension of each Gaussian"""
<|body_0|>
def init_params(se... | stack_v2_sparse_classes_75kplus_train_008868 | 7,225 | no_license | [
{
"docstring": "Holds N size-dimensional Guassians with specified covariance structure N = number of distributions (e.g. number of words) size = dimension of each Gaussian",
"name": "__init__",
"signature": "def __init__(self, N, size=100, covariance_type='spherical')"
},
{
"docstring": "Initial... | 2 | stack_v2_sparse_classes_30k_train_010854 | Implement the Python class `GaussianDistribution` described below.
Class description:
Implement the GaussianDistribution class.
Method signatures and docstrings:
- def __init__(self, N, size=100, covariance_type='spherical'): Holds N size-dimensional Guassians with specified covariance structure N = number of distrib... | Implement the Python class `GaussianDistribution` described below.
Class description:
Implement the GaussianDistribution class.
Method signatures and docstrings:
- def __init__(self, N, size=100, covariance_type='spherical'): Holds N size-dimensional Guassians with specified covariance structure N = number of distrib... | d494b3041069d377d6a7a9c296a14334f2fa5acc | <|skeleton|>
class GaussianDistribution:
def __init__(self, N, size=100, covariance_type='spherical'):
"""Holds N size-dimensional Guassians with specified covariance structure N = number of distributions (e.g. number of words) size = dimension of each Gaussian"""
<|body_0|>
def init_params(se... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GaussianDistribution:
def __init__(self, N, size=100, covariance_type='spherical'):
"""Holds N size-dimensional Guassians with specified covariance structure N = number of distributions (e.g. number of words) size = dimension of each Gaussian"""
self.covariance_type = covariance_type
s... | the_stack_v2_python_sparse | python/seomoz_word2gauss/word2gauss-master/word2gauss/embeddings_py.py | LiuFang816/SALSTM_py_data | train | 10 | |
b4b37cdd9fb0f8797a8a94956cc9291abbd9d55a | [
"result = -1\nfor index in range(len(nums)):\n if target == nums[index]:\n return index\nreturn result",
"result = -1\nleft = 0\nright = len(nums) - 1\nwhile left <= right:\n midi = int((left + right) / 2)\n mid = nums[midi]\n if mid == target:\n return midi\n if mid < target:\n ... | <|body_start_0|>
result = -1
for index in range(len(nums)):
if target == nums[index]:
return index
return result
<|end_body_0|>
<|body_start_1|>
result = -1
left = 0
right = len(nums) - 1
while left <= right:
midi = int((le... | 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 search1(self, nums, target):
""":type nums: List[int] :type target: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
re... | stack_v2_sparse_classes_75kplus_train_008869 | 1,676 | 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": "search1",
"signature": "def search1(self, nums, target)"
}
] | 2 | stack_v2_sparse_classes_30k_val_001904 | 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 search1(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 search1(self, nums, target): :type nums: List[int] :type target: int :rtype: int
<|skel... | f27169285db00d3751c3035f2f4dabad6135c8cc | <|skeleton|>
class Solution:
def search(self, nums, target):
""":type nums: List[int] :type target: int :rtype: int"""
<|body_0|>
def search1(self, nums, target):
""":type nums: List[int] :type target: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def search(self, nums, target):
""":type nums: List[int] :type target: int :rtype: int"""
result = -1
for index in range(len(nums)):
if target == nums[index]:
return index
return result
def search1(self, nums, target):
""":type... | the_stack_v2_python_sparse | leet_code/easy/704_binary-search.py | baofree/solve-problems-every-day | train | 0 | |
23e171751f9bacd2415d34e79523715af1a58217 | [
"self.marker = marker\nself.left = left\nself.right = right",
"found = isinstance(self.marker, str)\nif found:\n return self.marker\nelse:\n return self.marker.update(pbar)",
"percent = pbar.percentage()\ncwidth = width - len(self.left) - len(self.right)\nmarked_width = int(percent * cwidth / 100)\nm = se... | <|body_start_0|>
self.marker = marker
self.left = left
self.right = right
<|end_body_0|>
<|body_start_1|>
found = isinstance(self.marker, str)
if found:
return self.marker
else:
return self.marker.update(pbar)
<|end_body_1|>
<|body_start_2|>
... | The bar of progress. It will strech to fill the line. marker - string or updatable object to use as a marker left - string or updatable object to use as a left border right - string or updatable object to use as a right border fill - character to use for the empty part of the progress bar fill_left - whether to fill fr... | Bar | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Bar:
"""The bar of progress. It will strech to fill the line. marker - string or updatable object to use as a marker left - string or updatable object to use as a left border right - string or updatable object to use as a right border fill - character to use for the empty part of the progress bar... | stack_v2_sparse_classes_75kplus_train_008870 | 16,702 | no_license | [
{
"docstring": "Initialization function for Bar class @param marker(string or updatable object) to use as a marker @param left(string or updatable object) to use as a left border @param right(string or updatable object) use as a right border",
"name": "__init__",
"signature": "def __init__(self, marker=... | 3 | stack_v2_sparse_classes_30k_train_051442 | Implement the Python class `Bar` described below.
Class description:
The bar of progress. It will strech to fill the line. marker - string or updatable object to use as a marker left - string or updatable object to use as a left border right - string or updatable object to use as a right border fill - character to use... | Implement the Python class `Bar` described below.
Class description:
The bar of progress. It will strech to fill the line. marker - string or updatable object to use as a marker left - string or updatable object to use as a left border right - string or updatable object to use as a right border fill - character to use... | 738e8e491e10bbbc3c21afe01221ed4661ce8a87 | <|skeleton|>
class Bar:
"""The bar of progress. It will strech to fill the line. marker - string or updatable object to use as a marker left - string or updatable object to use as a left border right - string or updatable object to use as a right border fill - character to use for the empty part of the progress bar... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Bar:
"""The bar of progress. It will strech to fill the line. marker - string or updatable object to use as a marker left - string or updatable object to use as a left border right - string or updatable object to use as a right border fill - character to use for the empty part of the progress bar fill_left - ... | the_stack_v2_python_sparse | scripts/python3/utils/progressbar.py | msecher/scripts_python_3_opentelemac_r14499 | train | 0 |
d30fd82cb99a6f21c2d12a440237abb2003c0aa0 | [
"prime_numbers = [9999901, 9999907, 9999929, 9999931, 9999937, 9999943, 9999971, 9999973, 9999991, 10004444557, 999999999989, 999999999847, 99999999947, 99999999977, 999999883]\nfor this_number in prime_numbers:\n print(this_number)\n self.assertTrue(is_prime(this_number + 0))\n self.assertFalse(is_prime(t... | <|body_start_0|>
prime_numbers = [9999901, 9999907, 9999929, 9999931, 9999937, 9999943, 9999971, 9999973, 9999991, 10004444557, 999999999989, 999999999847, 99999999947, 99999999977, 999999883]
for this_number in prime_numbers:
print(this_number)
self.assertTrue(is_prime(this_numb... | Tests of major functions in evoprimes.py | TestEvoPrimes | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestEvoPrimes:
"""Tests of major functions in evoprimes.py"""
def test_rabin_miller(self):
"""rabin-miller is not my code. Powerful juju."""
<|body_0|>
def test_get_next_primes(self):
"""I have to use the functions to test other functions, so there is a limit to ... | stack_v2_sparse_classes_75kplus_train_008871 | 2,167 | no_license | [
{
"docstring": "rabin-miller is not my code. Powerful juju.",
"name": "test_rabin_miller",
"signature": "def test_rabin_miller(self)"
},
{
"docstring": "I have to use the functions to test other functions, so there is a limit to what can be discovered.",
"name": "test_get_next_primes",
"... | 2 | stack_v2_sparse_classes_30k_train_038725 | Implement the Python class `TestEvoPrimes` described below.
Class description:
Tests of major functions in evoprimes.py
Method signatures and docstrings:
- def test_rabin_miller(self): rabin-miller is not my code. Powerful juju.
- def test_get_next_primes(self): I have to use the functions to test other functions, so... | Implement the Python class `TestEvoPrimes` described below.
Class description:
Tests of major functions in evoprimes.py
Method signatures and docstrings:
- def test_rabin_miller(self): rabin-miller is not my code. Powerful juju.
- def test_get_next_primes(self): I have to use the functions to test other functions, so... | 8425cfc9756eab4c8d090c14a11bfe91b0a17271 | <|skeleton|>
class TestEvoPrimes:
"""Tests of major functions in evoprimes.py"""
def test_rabin_miller(self):
"""rabin-miller is not my code. Powerful juju."""
<|body_0|>
def test_get_next_primes(self):
"""I have to use the functions to test other functions, so there is a limit to ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestEvoPrimes:
"""Tests of major functions in evoprimes.py"""
def test_rabin_miller(self):
"""rabin-miller is not my code. Powerful juju."""
prime_numbers = [9999901, 9999907, 9999929, 9999931, 9999937, 9999943, 9999971, 9999973, 9999991, 10004444557, 999999999989, 999999999847, 999999999... | the_stack_v2_python_sparse | test_evoprimes.py | lew128/evocrypt | train | 0 |
019313ed732f60f1e94979a2e3f5881f9f15c9f4 | [
"self.parser = NmeaParser()\nself.ids = ids\nself.is_running = False\nself.uart_pin = pin\nself.port = port\nself.processor = AirmarProcessor(broadcaster=broadcaster)",
"self.uart_pin.setup()\nself.port.close()\nself.port.open()\nself.port.write('{}'.format(self.parser.power(resume=1)).encode(self.port.encoding))... | <|body_start_0|>
self.parser = NmeaParser()
self.ids = ids
self.is_running = False
self.uart_pin = pin
self.port = port
self.processor = AirmarProcessor(broadcaster=broadcaster)
<|end_body_0|>
<|body_start_1|>
self.uart_pin.setup()
self.port.close()
... | Defines an Airmar receiver that sends data to a processor. | AirmarReceiver | [
"Python-2.0",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AirmarReceiver:
"""Defines an Airmar receiver that sends data to a processor."""
def __init__(self, broadcaster, ids, pin, port):
"""Initializes a new airmar receiver. Keyword arguments: pin -- The UART pin object Returns: A new Airmar Receiver"""
<|body_0|>
def start(se... | stack_v2_sparse_classes_75kplus_train_008872 | 2,109 | permissive | [
{
"docstring": "Initializes a new airmar receiver. Keyword arguments: pin -- The UART pin object Returns: A new Airmar Receiver",
"name": "__init__",
"signature": "def __init__(self, broadcaster, ids, pin, port)"
},
{
"docstring": "Sets up uart pin and open port to start listening. Enables sente... | 4 | stack_v2_sparse_classes_30k_train_022404 | Implement the Python class `AirmarReceiver` described below.
Class description:
Defines an Airmar receiver that sends data to a processor.
Method signatures and docstrings:
- def __init__(self, broadcaster, ids, pin, port): Initializes a new airmar receiver. Keyword arguments: pin -- The UART pin object Returns: A ne... | Implement the Python class `AirmarReceiver` described below.
Class description:
Defines an Airmar receiver that sends data to a processor.
Method signatures and docstrings:
- def __init__(self, broadcaster, ids, pin, port): Initializes a new airmar receiver. Keyword arguments: pin -- The UART pin object Returns: A ne... | a9252e9415d3fef62e4baf813306bdc07fb69781 | <|skeleton|>
class AirmarReceiver:
"""Defines an Airmar receiver that sends data to a processor."""
def __init__(self, broadcaster, ids, pin, port):
"""Initializes a new airmar receiver. Keyword arguments: pin -- The UART pin object Returns: A new Airmar Receiver"""
<|body_0|>
def start(se... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AirmarReceiver:
"""Defines an Airmar receiver that sends data to a processor."""
def __init__(self, broadcaster, ids, pin, port):
"""Initializes a new airmar receiver. Keyword arguments: pin -- The UART pin object Returns: A new Airmar Receiver"""
self.parser = NmeaParser()
self.i... | the_stack_v2_python_sparse | src/airmar/airmar_receiver.py | vt-sailbot/sailbot-19 | train | 1 |
c9e6dba3fa9910750935282c4ff6e24ec823d7d5 | [
"self.a = 20\nself.b = 0.2\nself.c = 2 * np.pi\nself.min = np.array([0.0 for i in range(0, self.n)])\nself.value = 0.0\nself.domain = np.array([[-32.768, 32.768] for i in range(0, self.n)])\nself.n = 2\nself.smooth = True\nself.info = [True, False, False]\nself.latex_name = \"Ackley's Function\"\nself.latex_type = ... | <|body_start_0|>
self.a = 20
self.b = 0.2
self.c = 2 * np.pi
self.min = np.array([0.0 for i in range(0, self.n)])
self.value = 0.0
self.domain = np.array([[-32.768, 32.768] for i in range(0, self.n)])
self.n = 2
self.smooth = True
self.info = [True... | Ackley's Function. | Ackley | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Ackley:
"""Ackley's Function."""
def __init__(self):
"""Constructor."""
<|body_0|>
def cost(self, x):
"""Cost function."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.a = 20
self.b = 0.2
self.c = 2 * np.pi
self.min ... | stack_v2_sparse_classes_75kplus_train_008873 | 1,564 | no_license | [
{
"docstring": "Constructor.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Cost function.",
"name": "cost",
"signature": "def cost(self, x)"
}
] | 2 | null | Implement the Python class `Ackley` described below.
Class description:
Ackley's Function.
Method signatures and docstrings:
- def __init__(self): Constructor.
- def cost(self, x): Cost function. | Implement the Python class `Ackley` described below.
Class description:
Ackley's Function.
Method signatures and docstrings:
- def __init__(self): Constructor.
- def cost(self, x): Cost function.
<|skeleton|>
class Ackley:
"""Ackley's Function."""
def __init__(self):
"""Constructor."""
<|bod... | f2a74df3ab01ac35ea8d80569da909ffa1e86af3 | <|skeleton|>
class Ackley:
"""Ackley's Function."""
def __init__(self):
"""Constructor."""
<|body_0|>
def cost(self, x):
"""Cost function."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Ackley:
"""Ackley's Function."""
def __init__(self):
"""Constructor."""
self.a = 20
self.b = 0.2
self.c = 2 * np.pi
self.min = np.array([0.0 for i in range(0, self.n)])
self.value = 0.0
self.domain = np.array([[-32.768, 32.768] for i in range(0, sel... | the_stack_v2_python_sparse | ctf/functionsnd/ackley.py | cntaylor/ctf | train | 1 |
6932b54e6f076c25a26099e948fd818f0ac8d8d5 | [
"self._inputs = inputs\nif self._inputs < 2:\n raise Exception(('spam', 'eggs'))\nself._dimensions = self.initDimensions(inputs)\nComponent.__init__(self, canvas, location, self._dimensions[0], self._dimensions[1], direction, width)\nself._inputList = []",
"widthx = inputs / sqrt(inputs * 2) * WIDTH\nheight = ... | <|body_start_0|>
self._inputs = inputs
if self._inputs < 2:
raise Exception(('spam', 'eggs'))
self._dimensions = self.initDimensions(inputs)
Component.__init__(self, canvas, location, self._dimensions[0], self._dimensions[1], direction, width)
self._inputList = []
<|e... | A standard class for components with multiple inputs on one side and a single output on the other. It is assumed that any such object will have at least 2 inputs and has initial dimensions based on the number of inputs. | MultiInSingleOut | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MultiInSingleOut:
"""A standard class for components with multiple inputs on one side and a single output on the other. It is assumed that any such object will have at least 2 inputs and has initial dimensions based on the number of inputs."""
def __init__(self, canvas, location, direction=E... | stack_v2_sparse_classes_75kplus_train_008874 | 8,062 | no_license | [
{
"docstring": "Initializes a Component instance with a certain number of inputs and dimensions which are dependent on the number of inputs.",
"name": "__init__",
"signature": "def __init__(self, canvas, location, direction=E, width=1, inputs=2, size=1)"
},
{
"docstring": "Initialize the dimensi... | 4 | stack_v2_sparse_classes_30k_train_003780 | Implement the Python class `MultiInSingleOut` described below.
Class description:
A standard class for components with multiple inputs on one side and a single output on the other. It is assumed that any such object will have at least 2 inputs and has initial dimensions based on the number of inputs.
Method signature... | Implement the Python class `MultiInSingleOut` described below.
Class description:
A standard class for components with multiple inputs on one side and a single output on the other. It is assumed that any such object will have at least 2 inputs and has initial dimensions based on the number of inputs.
Method signature... | 5b046f6ccacd397df7b319a9f96235dba4b653d7 | <|skeleton|>
class MultiInSingleOut:
"""A standard class for components with multiple inputs on one side and a single output on the other. It is assumed that any such object will have at least 2 inputs and has initial dimensions based on the number of inputs."""
def __init__(self, canvas, location, direction=E... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MultiInSingleOut:
"""A standard class for components with multiple inputs on one side and a single output on the other. It is assumed that any such object will have at least 2 inputs and has initial dimensions based on the number of inputs."""
def __init__(self, canvas, location, direction=E, width=1, in... | the_stack_v2_python_sparse | AntiochComponent.py | piannaf/Antioch | train | 0 |
d0f9f1019b6036c90a1d10b02252b81ab022a419 | [
"config_key_dic = cache.get('system_configKey') if getattr(settings, 'REDIS_ENABLE', False) else ''\nif not config_key_dic:\n queryset = self.filter_queryset(self.get_queryset())\n config_key_dic = {ele.get('configKey'): ele.get('configValue') for ele in queryset.values('configValue', 'configKey')}\n if ge... | <|body_start_0|>
config_key_dic = cache.get('system_configKey') if getattr(settings, 'REDIS_ENABLE', False) else ''
if not config_key_dic:
queryset = self.filter_queryset(self.get_queryset())
config_key_dic = {ele.get('configKey'): ele.get('configValue') for ele in queryset.value... | 参数设置 模型的CRUD视图 | ConfigSettingsModelViewSet | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ConfigSettingsModelViewSet:
"""参数设置 模型的CRUD视图"""
def get_config_key(self, request: Request, *args, **kwargs):
"""根据 参数键名 查询参数数据信息 :param request: :param args: :param kwargs: :return:"""
<|body_0|>
def clearCache(self, request: Request, *args, **kwargs):
"""清理键值缓存... | stack_v2_sparse_classes_75kplus_train_008875 | 16,018 | permissive | [
{
"docstring": "根据 参数键名 查询参数数据信息 :param request: :param args: :param kwargs: :return:",
"name": "get_config_key",
"signature": "def get_config_key(self, request: Request, *args, **kwargs)"
},
{
"docstring": "清理键值缓存 :param request: :param args: :param kwargs: :return:",
"name": "clearCache",
... | 2 | stack_v2_sparse_classes_30k_train_021691 | Implement the Python class `ConfigSettingsModelViewSet` described below.
Class description:
参数设置 模型的CRUD视图
Method signatures and docstrings:
- def get_config_key(self, request: Request, *args, **kwargs): 根据 参数键名 查询参数数据信息 :param request: :param args: :param kwargs: :return:
- def clearCache(self, request: Request, *ar... | Implement the Python class `ConfigSettingsModelViewSet` described below.
Class description:
参数设置 模型的CRUD视图
Method signatures and docstrings:
- def get_config_key(self, request: Request, *args, **kwargs): 根据 参数键名 查询参数数据信息 :param request: :param args: :param kwargs: :return:
- def clearCache(self, request: Request, *ar... | 32b598f304bc41eebd4f8173236038120cdfaf87 | <|skeleton|>
class ConfigSettingsModelViewSet:
"""参数设置 模型的CRUD视图"""
def get_config_key(self, request: Request, *args, **kwargs):
"""根据 参数键名 查询参数数据信息 :param request: :param args: :param kwargs: :return:"""
<|body_0|>
def clearCache(self, request: Request, *args, **kwargs):
"""清理键值缓存... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ConfigSettingsModelViewSet:
"""参数设置 模型的CRUD视图"""
def get_config_key(self, request: Request, *args, **kwargs):
"""根据 参数键名 查询参数数据信息 :param request: :param args: :param kwargs: :return:"""
config_key_dic = cache.get('system_configKey') if getattr(settings, 'REDIS_ENABLE', False) else ''
... | the_stack_v2_python_sparse | apps/vadmin/system/views.py | kuangzhanzhizi/ansible-ui-backend | train | 0 |
282ade2e50c7c481faeff487ca2012751830b1c2 | [
"nome = 'E-mail'\nmodoenvio = mixer.blend(ModoEnvio, nome=nome)\nmodo_result = ModoEnvio.objects.last()\nassert modo_result.nome == nome",
"nome = 'Push'\nmodoenvio = mixer.blend(ModoEnvio, nome=nome)\nmodo_result = ModoEnvio.objects.last()\nassert str(modo_result) == nome"
] | <|body_start_0|>
nome = 'E-mail'
modoenvio = mixer.blend(ModoEnvio, nome=nome)
modo_result = ModoEnvio.objects.last()
assert modo_result.nome == nome
<|end_body_0|>
<|body_start_1|>
nome = 'Push'
modoenvio = mixer.blend(ModoEnvio, nome=nome)
modo_result = ModoEnv... | Classe para teste do modelo Modo Envio | TestModoEnvioModel | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestModoEnvioModel:
"""Classe para teste do modelo Modo Envio"""
def test_modoenvio_create(self):
"""Função para testar a criação de uma instância de ModoEnvio"""
<|body_0|>
def test_str_return(self):
"""Função para teste do retorno __str__ de uma instância de Mo... | stack_v2_sparse_classes_75kplus_train_008876 | 3,332 | permissive | [
{
"docstring": "Função para testar a criação de uma instância de ModoEnvio",
"name": "test_modoenvio_create",
"signature": "def test_modoenvio_create(self)"
},
{
"docstring": "Função para teste do retorno __str__ de uma instância de ModoEnvio",
"name": "test_str_return",
"signature": "de... | 2 | stack_v2_sparse_classes_30k_train_008409 | Implement the Python class `TestModoEnvioModel` described below.
Class description:
Classe para teste do modelo Modo Envio
Method signatures and docstrings:
- def test_modoenvio_create(self): Função para testar a criação de uma instância de ModoEnvio
- def test_str_return(self): Função para teste do retorno __str__ d... | Implement the Python class `TestModoEnvioModel` described below.
Class description:
Classe para teste do modelo Modo Envio
Method signatures and docstrings:
- def test_modoenvio_create(self): Função para testar a criação de uma instância de ModoEnvio
- def test_str_return(self): Função para teste do retorno __str__ d... | f0511728ffe0e2dd9d20059d2a187b8b72d3d88c | <|skeleton|>
class TestModoEnvioModel:
"""Classe para teste do modelo Modo Envio"""
def test_modoenvio_create(self):
"""Função para testar a criação de uma instância de ModoEnvio"""
<|body_0|>
def test_str_return(self):
"""Função para teste do retorno __str__ de uma instância de Mo... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestModoEnvioModel:
"""Classe para teste do modelo Modo Envio"""
def test_modoenvio_create(self):
"""Função para testar a criação de uma instância de ModoEnvio"""
nome = 'E-mail'
modoenvio = mixer.blend(ModoEnvio, nome=nome)
modo_result = ModoEnvio.objects.last()
a... | the_stack_v2_python_sparse | luiza_api/tests.py | danembaum/com_api | train | 0 |
435a3385c0320825231df20600b603743aaed547 | [
"patch_dir = os.path.dirname(seriesfile)\nif not os.path.exists(seriesfile):\n return []\ntry:\n s = open(seriesfile)\nexcept Exception as err:\n raise GbpError('Cannot open series file: %s' % err)\nqueue = klass._read_series(s, patch_dir)\ns.close()\nreturn queue",
"queue = PatchSeries()\nfor line in se... | <|body_start_0|>
patch_dir = os.path.dirname(seriesfile)
if not os.path.exists(seriesfile):
return []
try:
s = open(seriesfile)
except Exception as err:
raise GbpError('Cannot open series file: %s' % err)
queue = klass._read_series(s, patch_dir... | A series of L{Patch}es as read from a quilt series file). | PatchSeries | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PatchSeries:
"""A series of L{Patch}es as read from a quilt series file)."""
def read_series_file(klass, seriesfile):
"""Read a series file into L{Patch} objects"""
<|body_0|>
def _read_series(klass, series, patch_dir):
"""Read patch series >>> PatchSeries._read_... | stack_v2_sparse_classes_75kplus_train_008877 | 8,474 | no_license | [
{
"docstring": "Read a series file into L{Patch} objects",
"name": "read_series_file",
"signature": "def read_series_file(klass, seriesfile)"
},
{
"docstring": "Read patch series >>> PatchSeries._read_series(['a/b', 'a -p1', 'a/b -p2'], '.') # doctest:+NORMALIZE_WHITESPACE [<gbp.patch_series.Pat... | 5 | stack_v2_sparse_classes_30k_train_050046 | Implement the Python class `PatchSeries` described below.
Class description:
A series of L{Patch}es as read from a quilt series file).
Method signatures and docstrings:
- def read_series_file(klass, seriesfile): Read a series file into L{Patch} objects
- def _read_series(klass, series, patch_dir): Read patch series >... | Implement the Python class `PatchSeries` described below.
Class description:
A series of L{Patch}es as read from a quilt series file).
Method signatures and docstrings:
- def read_series_file(klass, seriesfile): Read a series file into L{Patch} objects
- def _read_series(klass, series, patch_dir): Read patch series >... | 0dca507f38faf606ed8b6dd0f8815bea9b422f58 | <|skeleton|>
class PatchSeries:
"""A series of L{Patch}es as read from a quilt series file)."""
def read_series_file(klass, seriesfile):
"""Read a series file into L{Patch} objects"""
<|body_0|>
def _read_series(klass, series, patch_dir):
"""Read patch series >>> PatchSeries._read_... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PatchSeries:
"""A series of L{Patch}es as read from a quilt series file)."""
def read_series_file(klass, seriesfile):
"""Read a series file into L{Patch} objects"""
patch_dir = os.path.dirname(seriesfile)
if not os.path.exists(seriesfile):
return []
try:
... | the_stack_v2_python_sparse | gbp/patch_series.py | marquiz/git-buildpackage-rpm | train | 10 |
7cb3b0d427c34330ba865ba1b4c21a10e602ee9e | [
"self.width = width\nself.height = height\nself.food = food\nself.food_index = 0\nself.movement = {'U': [-1, 0], 'L': [0, -1], 'R': [0, 1], 'D': [1, 0]}\nself.snake = deque([(0, 0)])\nself.snake_set = {(0, 0): 1}",
"newhead = (self.snake[0][0] + self.movement[direction][0], self.snake[0][1] + self.movement[direct... | <|body_start_0|>
self.width = width
self.height = height
self.food = food
self.food_index = 0
self.movement = {'U': [-1, 0], 'L': [0, -1], 'R': [0, 1], 'D': [1, 0]}
self.snake = deque([(0, 0)])
self.snake_set = {(0, 0): 1}
<|end_body_0|>
<|body_start_1|>
... | SnakeGame | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SnakeGame:
def __init__(self, width: int, height: int, food: List[List[int]]):
"""Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], t... | stack_v2_sparse_classes_75kplus_train_008878 | 2,378 | no_license | [
{
"docstring": "Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [1,0].",
"name": "__init__",
"signature": "def __init__(self, widt... | 2 | stack_v2_sparse_classes_30k_train_035809 | Implement the Python class `SnakeGame` described below.
Class description:
Implement the SnakeGame class.
Method signatures and docstrings:
- def __init__(self, width: int, height: int, food: List[List[int]]): Initialize your data structure here. @param width - screen width @param height - screen height @param food -... | Implement the Python class `SnakeGame` described below.
Class description:
Implement the SnakeGame class.
Method signatures and docstrings:
- def __init__(self, width: int, height: int, food: List[List[int]]): Initialize your data structure here. @param width - screen width @param height - screen height @param food -... | 37efffbd41d4b3ea1e5ee1145f438c945a2ebf78 | <|skeleton|>
class SnakeGame:
def __init__(self, width: int, height: int, food: List[List[int]]):
"""Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], t... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SnakeGame:
def __init__(self, width: int, height: int, food: List[List[int]]):
"""Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is a... | the_stack_v2_python_sparse | 353Design Snake Game.py | maying0120/leetcode | train | 0 | |
f163413944d747da568e3daa022813b03070f873 | [
"response = list()\ndata = request.DATA\njson_validate(SPECS.get('vlan_post')).validate(data)\nuser = request.user\nfor vlan in data['vlans']:\n task_obj = tasks.create_vlan.apply_async(args=[vlan, user.id], queue='napi.network')\n task = {'task_id': task_obj.id}\n response.append(task)\nreturn Response(re... | <|body_start_0|>
response = list()
data = request.DATA
json_validate(SPECS.get('vlan_post')).validate(data)
user = request.user
for vlan in data['vlans']:
task_obj = tasks.create_vlan.apply_async(args=[vlan, user.id], queue='napi.network')
task = {'task_id... | VlanAsyncView | [
"Apache-2.0",
"BSD-3-Clause",
"MIT",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VlanAsyncView:
def post(self, request, *args, **kwargs):
"""Creates list of vlans."""
<|body_0|>
def put(self, request, *args, **kwargs):
"""Updates list of vlans."""
<|body_1|>
def delete(self, request, *args, **kwargs):
"""Deletes list of vlans... | stack_v2_sparse_classes_75kplus_train_008879 | 6,313 | permissive | [
{
"docstring": "Creates list of vlans.",
"name": "post",
"signature": "def post(self, request, *args, **kwargs)"
},
{
"docstring": "Updates list of vlans.",
"name": "put",
"signature": "def put(self, request, *args, **kwargs)"
},
{
"docstring": "Deletes list of vlans.",
"name... | 3 | stack_v2_sparse_classes_30k_train_049268 | Implement the Python class `VlanAsyncView` described below.
Class description:
Implement the VlanAsyncView class.
Method signatures and docstrings:
- def post(self, request, *args, **kwargs): Creates list of vlans.
- def put(self, request, *args, **kwargs): Updates list of vlans.
- def delete(self, request, *args, **... | Implement the Python class `VlanAsyncView` described below.
Class description:
Implement the VlanAsyncView class.
Method signatures and docstrings:
- def post(self, request, *args, **kwargs): Creates list of vlans.
- def put(self, request, *args, **kwargs): Updates list of vlans.
- def delete(self, request, *args, **... | eb27e1d977a1c4bb1fee8fb51b8d8050c64696d9 | <|skeleton|>
class VlanAsyncView:
def post(self, request, *args, **kwargs):
"""Creates list of vlans."""
<|body_0|>
def put(self, request, *args, **kwargs):
"""Updates list of vlans."""
<|body_1|>
def delete(self, request, *args, **kwargs):
"""Deletes list of vlans... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class VlanAsyncView:
def post(self, request, *args, **kwargs):
"""Creates list of vlans."""
response = list()
data = request.DATA
json_validate(SPECS.get('vlan_post')).validate(data)
user = request.user
for vlan in data['vlans']:
task_obj = tasks.create_vl... | the_stack_v2_python_sparse | networkapi/api_vlan/views/v3.py | globocom/GloboNetworkAPI | train | 86 | |
4d83a6f8adafae6e3426f1b374a9beb4e6b63102 | [
"uf = UnionFindArray(n)\nfor edge in edges:\n uf.union(edge[0], edge[1])\nreturn uf.part",
"def dfs(cur: int) -> None:\n if visited[cur]:\n return\n visited[cur] = True\n group.append(cur)\n for next in adjList[cur]:\n dfs(next)\nadjList = [[] for _ in range(n)]\nfor u, v in edges:\n ... | <|body_start_0|>
uf = UnionFindArray(n)
for edge in edges:
uf.union(edge[0], edge[1])
return uf.part
<|end_body_0|>
<|body_start_1|>
def dfs(cur: int) -> None:
if visited[cur]:
return
visited[cur] = True
group.append(cur)
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def countComponents2(self, n: int, edges: List[List[int]]) -> int:
"""并查集求无向图连通分量"""
<|body_0|>
def countComponents(self, n: int, edges: List[List[int]]) -> List[List[int]]:
"""dfs求无向图连通分量 注意:这样求出来的group的相邻元素是直接相连的,与并查集求连通分量不同"""
<|body_1|>
<|end_s... | stack_v2_sparse_classes_75kplus_train_008880 | 2,546 | no_license | [
{
"docstring": "并查集求无向图连通分量",
"name": "countComponents2",
"signature": "def countComponents2(self, n: int, edges: List[List[int]]) -> int"
},
{
"docstring": "dfs求无向图连通分量 注意:这样求出来的group的相邻元素是直接相连的,与并查集求连通分量不同",
"name": "countComponents",
"signature": "def countComponents(self, n: int, edg... | 2 | stack_v2_sparse_classes_30k_train_024491 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def countComponents2(self, n: int, edges: List[List[int]]) -> int: 并查集求无向图连通分量
- def countComponents(self, n: int, edges: List[List[int]]) -> List[List[int]]: dfs求无向图连通分量 注意:这样求出... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def countComponents2(self, n: int, edges: List[List[int]]) -> int: 并查集求无向图连通分量
- def countComponents(self, n: int, edges: List[List[int]]) -> List[List[int]]: dfs求无向图连通分量 注意:这样求出... | 7e79e26bb8f641868561b186e34c1127ed63c9e0 | <|skeleton|>
class Solution:
def countComponents2(self, n: int, edges: List[List[int]]) -> int:
"""并查集求无向图连通分量"""
<|body_0|>
def countComponents(self, n: int, edges: List[List[int]]) -> List[List[int]]:
"""dfs求无向图连通分量 注意:这样求出来的group的相邻元素是直接相连的,与并查集求连通分量不同"""
<|body_1|>
<|end_s... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def countComponents2(self, n: int, edges: List[List[int]]) -> int:
"""并查集求无向图连通分量"""
uf = UnionFindArray(n)
for edge in edges:
uf.union(edge[0], edge[1])
return uf.part
def countComponents(self, n: int, edges: List[List[int]]) -> List[List[int]]:
... | the_stack_v2_python_sparse | 14_并查集/323. 无向图中连通分量的数目.py | 981377660LMT/algorithm-study | train | 225 | |
a82b3fd3633871bbf42b20c08932340796eb9d56 | [
"me = self.get_user_profile(request)\nlabel = Label.objects.filter(pk=label_id, is_deleted=False).first()\nif label is None:\n return self.error(errorcode.MSG_NO_DATA, errorcode.NO_DATA)\nqs = label.children.filter(is_deleted=False)\ndata = self.paginate_data(request, qs, StatLabelSerializer, {'me': me})\nreturn... | <|body_start_0|>
me = self.get_user_profile(request)
label = Label.objects.filter(pk=label_id, is_deleted=False).first()
if label is None:
return self.error(errorcode.MSG_NO_DATA, errorcode.NO_DATA)
qs = label.children.filter(is_deleted=False)
data = self.paginate_dat... | ChildLabelView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ChildLabelView:
def get(self, request, label_id):
"""获取子标签,可分页"""
<|body_0|>
def post(self, request, label_id):
"""添加子标签"""
<|body_1|>
def delete(self, request, label_id):
"""删除子标签"""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_75kplus_train_008881 | 7,600 | no_license | [
{
"docstring": "获取子标签,可分页",
"name": "get",
"signature": "def get(self, request, label_id)"
},
{
"docstring": "添加子标签",
"name": "post",
"signature": "def post(self, request, label_id)"
},
{
"docstring": "删除子标签",
"name": "delete",
"signature": "def delete(self, request, labe... | 3 | stack_v2_sparse_classes_30k_test_001543 | Implement the Python class `ChildLabelView` described below.
Class description:
Implement the ChildLabelView class.
Method signatures and docstrings:
- def get(self, request, label_id): 获取子标签,可分页
- def post(self, request, label_id): 添加子标签
- def delete(self, request, label_id): 删除子标签 | Implement the Python class `ChildLabelView` described below.
Class description:
Implement the ChildLabelView class.
Method signatures and docstrings:
- def get(self, request, label_id): 获取子标签,可分页
- def post(self, request, label_id): 添加子标签
- def delete(self, request, label_id): 删除子标签
<|skeleton|>
class ChildLabelView... | 6a68fb207f43e5ed65299cc08535b35d5e934ead | <|skeleton|>
class ChildLabelView:
def get(self, request, label_id):
"""获取子标签,可分页"""
<|body_0|>
def post(self, request, label_id):
"""添加子标签"""
<|body_1|>
def delete(self, request, label_id):
"""删除子标签"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ChildLabelView:
def get(self, request, label_id):
"""获取子标签,可分页"""
me = self.get_user_profile(request)
label = Label.objects.filter(pk=label_id, is_deleted=False).first()
if label is None:
return self.error(errorcode.MSG_NO_DATA, errorcode.NO_DATA)
qs = label... | the_stack_v2_python_sparse | apps/labels_v2/views.py | Slowhalfframe/fanyijiang-API | train | 0 | |
2ac82f410f949c0ae112cac6632330dc7e0f625c | [
"def quickSort(x, y):\n left, right = (x, y)\n pivot = nums[right]\n if left < right:\n while left < right:\n while left < right and nums[left] <= pivot:\n left += 1\n while left < right and nums[right] >= pivot:\n right -= 1\n nums[left... | <|body_start_0|>
def quickSort(x, y):
left, right = (x, y)
pivot = nums[right]
if left < right:
while left < right:
while left < right and nums[left] <= pivot:
left += 1
while left < right and num... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def sortArray1(self, nums: List[int]) -> List[int]:
"""执行用时 :300 ms, 在所有 Python3 提交中击败了59.20%的用户 内存消耗 :20 MB, 在所有 Python3 提交中击败了5.71%的用户 思路:排序 时间复杂度:O(nlogn) 空间复杂度:O(1) :param nums: :return:"""
<|body_0|>
def sortArray2(self, nums: List[int]) -> List[int]:
... | stack_v2_sparse_classes_75kplus_train_008882 | 4,018 | no_license | [
{
"docstring": "执行用时 :300 ms, 在所有 Python3 提交中击败了59.20%的用户 内存消耗 :20 MB, 在所有 Python3 提交中击败了5.71%的用户 思路:排序 时间复杂度:O(nlogn) 空间复杂度:O(1) :param nums: :return:",
"name": "sortArray1",
"signature": "def sortArray1(self, nums: List[int]) -> List[int]"
},
{
"docstring": "执行用时 :480 ms, 在所有 Python3 提交中击败了24.... | 5 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def sortArray1(self, nums: List[int]) -> List[int]: 执行用时 :300 ms, 在所有 Python3 提交中击败了59.20%的用户 内存消耗 :20 MB, 在所有 Python3 提交中击败了5.71%的用户 思路:排序 时间复杂度:O(nlogn) 空间复杂度:O(1) :param nums:... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def sortArray1(self, nums: List[int]) -> List[int]: 执行用时 :300 ms, 在所有 Python3 提交中击败了59.20%的用户 内存消耗 :20 MB, 在所有 Python3 提交中击败了5.71%的用户 思路:排序 时间复杂度:O(nlogn) 空间复杂度:O(1) :param nums:... | e43ee86c5a8cdb808da09b4b6138e10275abadb5 | <|skeleton|>
class Solution:
def sortArray1(self, nums: List[int]) -> List[int]:
"""执行用时 :300 ms, 在所有 Python3 提交中击败了59.20%的用户 内存消耗 :20 MB, 在所有 Python3 提交中击败了5.71%的用户 思路:排序 时间复杂度:O(nlogn) 空间复杂度:O(1) :param nums: :return:"""
<|body_0|>
def sortArray2(self, nums: List[int]) -> List[int]:
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def sortArray1(self, nums: List[int]) -> List[int]:
"""执行用时 :300 ms, 在所有 Python3 提交中击败了59.20%的用户 内存消耗 :20 MB, 在所有 Python3 提交中击败了5.71%的用户 思路:排序 时间复杂度:O(nlogn) 空间复杂度:O(1) :param nums: :return:"""
def quickSort(x, y):
left, right = (x, y)
pivot = nums[right]
... | the_stack_v2_python_sparse | LeetCode/排序算法(sort)/912. Sort an Array.py | yiming1012/MyLeetCode | train | 2 | |
8e95d308ef5d686aa068a1050d4965350314c80b | [
"json_dict = json.loads(request.body.decode())\nreceiver = json_dict.get('receiver')\nprovince_id = json_dict.get('province_id')\ncity_id = json_dict.get('city_id')\ndistrict_id = json_dict.get('district_id')\nplace = json_dict.get('place')\nmobile = json_dict.get('mobile')\ntel = json_dict.get('tel')\nemail = json... | <|body_start_0|>
json_dict = json.loads(request.body.decode())
receiver = json_dict.get('receiver')
province_id = json_dict.get('province_id')
city_id = json_dict.get('city_id')
district_id = json_dict.get('district_id')
place = json_dict.get('place')
mobile = jso... | 修改和删除地址 | UpdateDestroyAddressView | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UpdateDestroyAddressView:
"""修改和删除地址"""
def put(self, request, address_id):
"""修改地址"""
<|body_0|>
def delete(self, request, address_id):
"""删除地址"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
json_dict = json.loads(request.body.decode())
... | stack_v2_sparse_classes_75kplus_train_008883 | 29,582 | permissive | [
{
"docstring": "修改地址",
"name": "put",
"signature": "def put(self, request, address_id)"
},
{
"docstring": "删除地址",
"name": "delete",
"signature": "def delete(self, request, address_id)"
}
] | 2 | stack_v2_sparse_classes_30k_train_015170 | Implement the Python class `UpdateDestroyAddressView` described below.
Class description:
修改和删除地址
Method signatures and docstrings:
- def put(self, request, address_id): 修改地址
- def delete(self, request, address_id): 删除地址 | Implement the Python class `UpdateDestroyAddressView` described below.
Class description:
修改和删除地址
Method signatures and docstrings:
- def put(self, request, address_id): 修改地址
- def delete(self, request, address_id): 删除地址
<|skeleton|>
class UpdateDestroyAddressView:
"""修改和删除地址"""
def put(self, request, addre... | 5b3ca1fba8205c2c0a2b91d951f812f1c30e12ae | <|skeleton|>
class UpdateDestroyAddressView:
"""修改和删除地址"""
def put(self, request, address_id):
"""修改地址"""
<|body_0|>
def delete(self, request, address_id):
"""删除地址"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class UpdateDestroyAddressView:
"""修改和删除地址"""
def put(self, request, address_id):
"""修改地址"""
json_dict = json.loads(request.body.decode())
receiver = json_dict.get('receiver')
province_id = json_dict.get('province_id')
city_id = json_dict.get('city_id')
district_... | the_stack_v2_python_sparse | meiduo1/apps/user/views.py | woobrain/nginx-uwsgi-web | train | 0 |
855de8ec3533b96d98f76e00337af444f56b7182 | [
"obj = models.UserInfo.objects.filter(username=self.cleaned_data['username'])\nif obj:\n return self.cleaned_data['username']\nelse:\n raise ValidationError(message='用户不存在', code='xxxx')",
"obj = models.UserInfo.objects.filter(username=self.cleaned_data.get('username'), password=self.cleaned_data.get('passw... | <|body_start_0|>
obj = models.UserInfo.objects.filter(username=self.cleaned_data['username'])
if obj:
return self.cleaned_data['username']
else:
raise ValidationError(message='用户不存在', code='xxxx')
<|end_body_0|>
<|body_start_1|>
obj = models.UserInfo.objects.filt... | LoginForm | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LoginForm:
def clean_username(self):
"""验证用户存不存在 :return:"""
<|body_0|>
def clean(self):
"""验证用户名和密码存不存在 :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
obj = models.UserInfo.objects.filter(username=self.cleaned_data['username'])
if... | stack_v2_sparse_classes_75kplus_train_008884 | 3,060 | no_license | [
{
"docstring": "验证用户存不存在 :return:",
"name": "clean_username",
"signature": "def clean_username(self)"
},
{
"docstring": "验证用户名和密码存不存在 :return:",
"name": "clean",
"signature": "def clean(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_006187 | Implement the Python class `LoginForm` described below.
Class description:
Implement the LoginForm class.
Method signatures and docstrings:
- def clean_username(self): 验证用户存不存在 :return:
- def clean(self): 验证用户名和密码存不存在 :return: | Implement the Python class `LoginForm` described below.
Class description:
Implement the LoginForm class.
Method signatures and docstrings:
- def clean_username(self): 验证用户存不存在 :return:
- def clean(self): 验证用户名和密码存不存在 :return:
<|skeleton|>
class LoginForm:
def clean_username(self):
"""验证用户存不存在 :return:"... | 27019a08657ce30517c7e8d4684ece62bf3e154b | <|skeleton|>
class LoginForm:
def clean_username(self):
"""验证用户存不存在 :return:"""
<|body_0|>
def clean(self):
"""验证用户名和密码存不存在 :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LoginForm:
def clean_username(self):
"""验证用户存不存在 :return:"""
obj = models.UserInfo.objects.filter(username=self.cleaned_data['username'])
if obj:
return self.cleaned_data['username']
else:
raise ValidationError(message='用户不存在', code='xxxx')
def clea... | the_stack_v2_python_sparse | django实现类博客和BBS系统/bin/EdmureBlog/web/forms.py | shisanjun/django | train | 0 | |
7020c10ae6df9a131d61ab910d907159c820a7ff | [
"if Ices.objects.filter(type=value.lower()):\n raise serializers.ValidationError('There already exist such type')\nreturn value",
"ret = super().to_representation(instance)\nret['type'] = ret['type'].lower()\nreturn ret"
] | <|body_start_0|>
if Ices.objects.filter(type=value.lower()):
raise serializers.ValidationError('There already exist such type')
return value
<|end_body_0|>
<|body_start_1|>
ret = super().to_representation(instance)
ret['type'] = ret['type'].lower()
return ret
<|end_b... | AddIcesSerializers | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AddIcesSerializers:
def validate_type(self, value):
"""Check the duplicate"""
<|body_0|>
def to_representation(self, instance):
"""Convert `type` to lowercase."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if Ices.objects.filter(type=value.lower()... | stack_v2_sparse_classes_75kplus_train_008885 | 4,598 | permissive | [
{
"docstring": "Check the duplicate",
"name": "validate_type",
"signature": "def validate_type(self, value)"
},
{
"docstring": "Convert `type` to lowercase.",
"name": "to_representation",
"signature": "def to_representation(self, instance)"
}
] | 2 | stack_v2_sparse_classes_30k_train_000112 | Implement the Python class `AddIcesSerializers` described below.
Class description:
Implement the AddIcesSerializers class.
Method signatures and docstrings:
- def validate_type(self, value): Check the duplicate
- def to_representation(self, instance): Convert `type` to lowercase. | Implement the Python class `AddIcesSerializers` described below.
Class description:
Implement the AddIcesSerializers class.
Method signatures and docstrings:
- def validate_type(self, value): Check the duplicate
- def to_representation(self, instance): Convert `type` to lowercase.
<|skeleton|>
class AddIcesSerialize... | 6a935bb77db3996dcf14b71deed8d7ca5c8f0fa3 | <|skeleton|>
class AddIcesSerializers:
def validate_type(self, value):
"""Check the duplicate"""
<|body_0|>
def to_representation(self, instance):
"""Convert `type` to lowercase."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AddIcesSerializers:
def validate_type(self, value):
"""Check the duplicate"""
if Ices.objects.filter(type=value.lower()):
raise serializers.ValidationError('There already exist such type')
return value
def to_representation(self, instance):
"""Convert `type` to... | the_stack_v2_python_sparse | drf_api/serializers.py | destro6984/LynxWasp | train | 0 | |
395e36665d523d4ccbb30d24c912b8e71cba6822 | [
"wiz = self.browse(cr, uid, ids, context=context)[0]\ndata = {}\ndata['parameters'] = {'partner_id': context.get('active_id'), 'date_start': wiz.date_start, 'date_end': wiz.date_end}\nreturn {'type': 'ir.actions.report.xml', 'report_name': 'statement_general', 'datas': data}",
"wiz = self.browse(cr, uid, ids, con... | <|body_start_0|>
wiz = self.browse(cr, uid, ids, context=context)[0]
data = {}
data['parameters'] = {'partner_id': context.get('active_id'), 'date_start': wiz.date_start, 'date_end': wiz.date_end}
return {'type': 'ir.actions.report.xml', 'report_name': 'statement_general', 'datas': data}... | statement_general_report | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class statement_general_report:
def launch(self, cr, uid, ids, context=None):
"""Launch the report, and pass each value in the form as parameters"""
<|body_0|>
def launch_detail(self, cr, uid, ids, context=None):
"""Launch the report, and pass each value in the form as par... | stack_v2_sparse_classes_75kplus_train_008886 | 2,762 | no_license | [
{
"docstring": "Launch the report, and pass each value in the form as parameters",
"name": "launch",
"signature": "def launch(self, cr, uid, ids, context=None)"
},
{
"docstring": "Launch the report, and pass each value in the form as parameters",
"name": "launch_detail",
"signature": "de... | 2 | stack_v2_sparse_classes_30k_train_053910 | Implement the Python class `statement_general_report` described below.
Class description:
Implement the statement_general_report class.
Method signatures and docstrings:
- def launch(self, cr, uid, ids, context=None): Launch the report, and pass each value in the form as parameters
- def launch_detail(self, cr, uid, ... | Implement the Python class `statement_general_report` described below.
Class description:
Implement the statement_general_report class.
Method signatures and docstrings:
- def launch(self, cr, uid, ids, context=None): Launch the report, and pass each value in the form as parameters
- def launch_detail(self, cr, uid, ... | a5e9f95c59be058aead30e1c6de867ed36354e6a | <|skeleton|>
class statement_general_report:
def launch(self, cr, uid, ids, context=None):
"""Launch the report, and pass each value in the form as parameters"""
<|body_0|>
def launch_detail(self, cr, uid, ids, context=None):
"""Launch the report, and pass each value in the form as par... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class statement_general_report:
def launch(self, cr, uid, ids, context=None):
"""Launch the report, and pass each value in the form as parameters"""
wiz = self.browse(cr, uid, ids, context=context)[0]
data = {}
data['parameters'] = {'partner_id': context.get('active_id'), 'date_start... | the_stack_v2_python_sparse | prooaddons/customer_statement/report/report.py | wissemsh/prooaddons | train | 0 | |
05d2c17af44e57457f91573ec24689ef18f3efed | [
"self.representation = []\nself.fitness = 0.0\nself.max_depth = max_depth\nself.terminal_set = terminal_set\nself.function_set = function_set",
"if crtDepth == self.max_depth:\n terminal = random.choice(self.terminal_set)\n self.representation.append(terminal)\nelse:\n function = random.choice(self.funct... | <|body_start_0|>
self.representation = []
self.fitness = 0.0
self.max_depth = max_depth
self.terminal_set = terminal_set
self.function_set = function_set
<|end_body_0|>
<|body_start_1|>
if crtDepth == self.max_depth:
terminal = random.choice(self.terminal_set... | clasa pentru reprezentarea unui cromozom | Chromosome | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Chromosome:
"""clasa pentru reprezentarea unui cromozom"""
def __init__(self, max_depth, terminal_set, function_set):
""":param max_depth: adancimea maxima a arborelui (reprezentarea unui cromozom - forma prefixata) :param terminal_set: multime ce contine terminalii posibili pentru n... | stack_v2_sparse_classes_75kplus_train_008887 | 11,168 | no_license | [
{
"docstring": ":param max_depth: adancimea maxima a arborelui (reprezentarea unui cromozom - forma prefixata) :param terminal_set: multime ce contine terminalii posibili pentru nodurile arborelui :param function_set: multime ce contine operatiile binare posibile pentru nodurile arborelui (+, -, *)",
"name"... | 3 | null | Implement the Python class `Chromosome` described below.
Class description:
clasa pentru reprezentarea unui cromozom
Method signatures and docstrings:
- def __init__(self, max_depth, terminal_set, function_set): :param max_depth: adancimea maxima a arborelui (reprezentarea unui cromozom - forma prefixata) :param term... | Implement the Python class `Chromosome` described below.
Class description:
clasa pentru reprezentarea unui cromozom
Method signatures and docstrings:
- def __init__(self, max_depth, terminal_set, function_set): :param max_depth: adancimea maxima a arborelui (reprezentarea unui cromozom - forma prefixata) :param term... | 47d71b894d6fb81907256bb0f439f048e65a089a | <|skeleton|>
class Chromosome:
"""clasa pentru reprezentarea unui cromozom"""
def __init__(self, max_depth, terminal_set, function_set):
""":param max_depth: adancimea maxima a arborelui (reprezentarea unui cromozom - forma prefixata) :param terminal_set: multime ce contine terminalii posibili pentru n... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Chromosome:
"""clasa pentru reprezentarea unui cromozom"""
def __init__(self, max_depth, terminal_set, function_set):
""":param max_depth: adancimea maxima a arborelui (reprezentarea unui cromozom - forma prefixata) :param terminal_set: multime ce contine terminalii posibili pentru nodurile arbor... | the_stack_v2_python_sparse | Semester4/Artificial Intelligence/Gp2/gp.py | bogdansimion31/University | train | 0 |
6a2ad0d98ebecdfbca2b2d035754751a8acc8aac | [
"if team_id is None:\n teams = Team.query.all()\n team_list = [t.as_json() for t in teams]\n return (jsonify(orgs=team_list), 200)\nteam = Team.query.filter_by(id=team_id).first()\nif not team:\n return (jsonify(error='no teams found under that team id'), 400)\nreturn (jsonify(team.as_json()), 200)",
... | <|body_start_0|>
if team_id is None:
teams = Team.query.all()
team_list = [t.as_json() for t in teams]
return (jsonify(orgs=team_list), 200)
team = Team.query.filter_by(id=team_id).first()
if not team:
return (jsonify(error='no teams found under th... | Endpoint for Teams: Get teams. Post creates teams. | Teams | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Teams:
"""Endpoint for Teams: Get teams. Post creates teams."""
def get(self, team_id=None):
"""get teams --- tags: - teams responses: 200: schema: id: basic_out"""
<|body_0|>
def post(self):
"""creates a org given a name for the organization. bic_id optional ---... | stack_v2_sparse_classes_75kplus_train_008888 | 2,730 | no_license | [
{
"docstring": "get teams --- tags: - teams responses: 200: schema: id: basic_out",
"name": "get",
"signature": "def get(self, team_id=None)"
},
{
"docstring": "creates a org given a name for the organization. bic_id optional --- tags: - teams parameters: - in: body name: body schema: id: teams_... | 3 | null | Implement the Python class `Teams` described below.
Class description:
Endpoint for Teams: Get teams. Post creates teams.
Method signatures and docstrings:
- def get(self, team_id=None): get teams --- tags: - teams responses: 200: schema: id: basic_out
- def post(self): creates a org given a name for the organization... | Implement the Python class `Teams` described below.
Class description:
Endpoint for Teams: Get teams. Post creates teams.
Method signatures and docstrings:
- def get(self, team_id=None): get teams --- tags: - teams responses: 200: schema: id: basic_out
- def post(self): creates a org given a name for the organization... | 8881a5ee38a02be4b3a56024418bafd12372dda2 | <|skeleton|>
class Teams:
"""Endpoint for Teams: Get teams. Post creates teams."""
def get(self, team_id=None):
"""get teams --- tags: - teams responses: 200: schema: id: basic_out"""
<|body_0|>
def post(self):
"""creates a org given a name for the organization. bic_id optional ---... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Teams:
"""Endpoint for Teams: Get teams. Post creates teams."""
def get(self, team_id=None):
"""get teams --- tags: - teams responses: 200: schema: id: basic_out"""
if team_id is None:
teams = Team.query.all()
team_list = [t.as_json() for t in teams]
re... | the_stack_v2_python_sparse | webapp/api/teams.py | ijoosong/cassidy_backend | train | 0 |
9855499889ee580e8507339ba292f6acc16092bb | [
"if not root:\n return []\ndq = collections.deque([(root, [root.val])])\nret = []\nwhile dq:\n node, lst = dq.popleft()\n if not node.left and (not node.right):\n if node.val == targetSum:\n ret.append(lst)\n if node.left:\n tmp_value, node.left.val = (node.left.val, node.left.v... | <|body_start_0|>
if not root:
return []
dq = collections.deque([(root, [root.val])])
ret = []
while dq:
node, lst = dq.popleft()
if not node.left and (not node.right):
if node.val == targetSum:
ret.append(lst)
... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def pathSum2(self, root: TreeNode, targetSum: int) -> List[List[int]]:
"""Updated at 2021/4/8 Runtime: 41 ms, faster than 94.87% Memory Usage: 15.3 MB, less than 93.46% The number of nodes in the tree is in the range [0, 5000]. -1000 <= Node.val <= 1000 -1000 <= targetSum <= 10... | stack_v2_sparse_classes_75kplus_train_008889 | 2,935 | permissive | [
{
"docstring": "Updated at 2021/4/8 Runtime: 41 ms, faster than 94.87% Memory Usage: 15.3 MB, less than 93.46% The number of nodes in the tree is in the range [0, 5000]. -1000 <= Node.val <= 1000 -1000 <= targetSum <= 1000",
"name": "pathSum2",
"signature": "def pathSum2(self, root: TreeNode, targetSum:... | 2 | stack_v2_sparse_classes_30k_train_031127 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def pathSum2(self, root: TreeNode, targetSum: int) -> List[List[int]]: Updated at 2021/4/8 Runtime: 41 ms, faster than 94.87% Memory Usage: 15.3 MB, less than 93.46% The number o... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def pathSum2(self, root: TreeNode, targetSum: int) -> List[List[int]]: Updated at 2021/4/8 Runtime: 41 ms, faster than 94.87% Memory Usage: 15.3 MB, less than 93.46% The number o... | 4dd1e54d8d08f7e6590bc76abd08ecaacaf775e5 | <|skeleton|>
class Solution:
def pathSum2(self, root: TreeNode, targetSum: int) -> List[List[int]]:
"""Updated at 2021/4/8 Runtime: 41 ms, faster than 94.87% Memory Usage: 15.3 MB, less than 93.46% The number of nodes in the tree is in the range [0, 5000]. -1000 <= Node.val <= 1000 -1000 <= targetSum <= 10... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def pathSum2(self, root: TreeNode, targetSum: int) -> List[List[int]]:
"""Updated at 2021/4/8 Runtime: 41 ms, faster than 94.87% Memory Usage: 15.3 MB, less than 93.46% The number of nodes in the tree is in the range [0, 5000]. -1000 <= Node.val <= 1000 -1000 <= targetSum <= 1000"""
... | the_stack_v2_python_sparse | src/113-PathSumII.py | Jiezhi/myleetcode | train | 1 | |
b3e8013baf549f19f2ce9183fb7124fdb56518bc | [
"nums.sort(reverse=True)\nself.nums = nums[0:k]\nself.k = k",
"if len(self.nums) == self.k and val <= self.nums[-1]:\n return self.nums[-1]\nleft, right = (0, len(self.nums))\nwhile left < right:\n mid = (left + right) // 2\n if val > self.nums[mid]:\n right = mid\n else:\n left = mid + ... | <|body_start_0|>
nums.sort(reverse=True)
self.nums = nums[0:k]
self.k = k
<|end_body_0|>
<|body_start_1|>
if len(self.nums) == self.k and val <= self.nums[-1]:
return self.nums[-1]
left, right = (0, len(self.nums))
while left < right:
mid = (left ... | KthLargest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KthLargest:
def __init__(self, k, nums):
""":type k: int :type nums: List[int]"""
<|body_0|>
def add(self, val):
""":type val: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
nums.sort(reverse=True)
self.nums = nums[0:k]
... | stack_v2_sparse_classes_75kplus_train_008890 | 1,019 | no_license | [
{
"docstring": ":type k: int :type nums: List[int]",
"name": "__init__",
"signature": "def __init__(self, k, nums)"
},
{
"docstring": ":type val: int :rtype: int",
"name": "add",
"signature": "def add(self, val)"
}
] | 2 | stack_v2_sparse_classes_30k_train_026933 | Implement the Python class `KthLargest` described below.
Class description:
Implement the KthLargest class.
Method signatures and docstrings:
- def __init__(self, k, nums): :type k: int :type nums: List[int]
- def add(self, val): :type val: int :rtype: int | Implement the Python class `KthLargest` described below.
Class description:
Implement the KthLargest class.
Method signatures and docstrings:
- def __init__(self, k, nums): :type k: int :type nums: List[int]
- def add(self, val): :type val: int :rtype: int
<|skeleton|>
class KthLargest:
def __init__(self, k, nu... | e4d3ddb3529486f99b3ba128141837e67588a177 | <|skeleton|>
class KthLargest:
def __init__(self, k, nums):
""":type k: int :type nums: List[int]"""
<|body_0|>
def add(self, val):
""":type val: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class KthLargest:
def __init__(self, k, nums):
""":type k: int :type nums: List[int]"""
nums.sort(reverse=True)
self.nums = nums[0:k]
self.k = k
def add(self, val):
""":type val: int :rtype: int"""
if len(self.nums) == self.k and val <= self.nums[-1]:
... | the_stack_v2_python_sparse | Python/703-Kth_largest_element_in_a_stream_first_1_modify.py | zhangwei1989/algorithm | train | 0 | |
70fca5eea5a5bc74e7556970c89b284e1dc6341a | [
"client = queries.QuizClientMissMatch.getInstance()\nclient.setUp(1, 2)\nself.assertEqual(client, False)",
"client = queries.QuizClientMissMatch.getInstance()\nclient.setUp(1, 1)\nself.assertEqual(client, False)"
] | <|body_start_0|>
client = queries.QuizClientMissMatch.getInstance()
client.setUp(1, 2)
self.assertEqual(client, False)
<|end_body_0|>
<|body_start_1|>
client = queries.QuizClientMissMatch.getInstance()
client.setUp(1, 1)
self.assertEqual(client, False)
<|end_body_1|>
| QuizClientMissMatchTest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class QuizClientMissMatchTest:
def session_vaild_missmatch(self):
"""Check if there's a missmatch"""
<|body_0|>
def session_vaild_match(self):
"""Check if there's a match"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
client = queries.QuizClientMissMatch... | stack_v2_sparse_classes_75kplus_train_008891 | 15,976 | no_license | [
{
"docstring": "Check if there's a missmatch",
"name": "session_vaild_missmatch",
"signature": "def session_vaild_missmatch(self)"
},
{
"docstring": "Check if there's a match",
"name": "session_vaild_match",
"signature": "def session_vaild_match(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_047095 | Implement the Python class `QuizClientMissMatchTest` described below.
Class description:
Implement the QuizClientMissMatchTest class.
Method signatures and docstrings:
- def session_vaild_missmatch(self): Check if there's a missmatch
- def session_vaild_match(self): Check if there's a match | Implement the Python class `QuizClientMissMatchTest` described below.
Class description:
Implement the QuizClientMissMatchTest class.
Method signatures and docstrings:
- def session_vaild_missmatch(self): Check if there's a missmatch
- def session_vaild_match(self): Check if there's a match
<|skeleton|>
class QuizCl... | 58081fd46749e9ca5dea1597f479025c872bccfe | <|skeleton|>
class QuizClientMissMatchTest:
def session_vaild_missmatch(self):
"""Check if there's a missmatch"""
<|body_0|>
def session_vaild_match(self):
"""Check if there's a match"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class QuizClientMissMatchTest:
def session_vaild_missmatch(self):
"""Check if there's a missmatch"""
client = queries.QuizClientMissMatch.getInstance()
client.setUp(1, 2)
self.assertEqual(client, False)
def session_vaild_match(self):
"""Check if there's a match"""
... | the_stack_v2_python_sparse | triviaQuiz/tests.py | Bradenm1/Django-quiz | train | 0 | |
4d0bb778abfb823b9fb90dde998c595b7e427ba5 | [
"self.sample = TestSample.objects.create(name='Testing')\nself.product = TestProduct.objects.create(name='My Product')\nself.bob = User.objects.get(pk=1)\nself.jim = User.objects.get(pk=2)\nself.jane = User.objects.get(pk=3)",
"self.assertTrue(RatingData.objects.add(self.sample, self.bob, 1))\nself.assertTrue(Rat... | <|body_start_0|>
self.sample = TestSample.objects.create(name='Testing')
self.product = TestProduct.objects.create(name='My Product')
self.bob = User.objects.get(pk=1)
self.jim = User.objects.get(pk=2)
self.jane = User.objects.get(pk=3)
<|end_body_0|>
<|body_start_1|>
se... | The main tests for django-critic. | CriticTestCase | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CriticTestCase:
"""The main tests for django-critic."""
def setUp(self):
"""Set up some initial data."""
<|body_0|>
def test_add_rating(self):
"""This test will ensure adding a rating works."""
<|body_1|>
def test_change_rating(self):
"""This... | stack_v2_sparse_classes_75kplus_train_008892 | 3,997 | no_license | [
{
"docstring": "Set up some initial data.",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "This test will ensure adding a rating works.",
"name": "test_add_rating",
"signature": "def test_add_rating(self)"
},
{
"docstring": "This test will ensure changing a ra... | 6 | stack_v2_sparse_classes_30k_train_014772 | Implement the Python class `CriticTestCase` described below.
Class description:
The main tests for django-critic.
Method signatures and docstrings:
- def setUp(self): Set up some initial data.
- def test_add_rating(self): This test will ensure adding a rating works.
- def test_change_rating(self): This test will ensu... | Implement the Python class `CriticTestCase` described below.
Class description:
The main tests for django-critic.
Method signatures and docstrings:
- def setUp(self): Set up some initial data.
- def test_add_rating(self): This test will ensure adding a rating works.
- def test_change_rating(self): This test will ensu... | 5486128b5b3b7ddb9ec81d43e3bb601a23b4025a | <|skeleton|>
class CriticTestCase:
"""The main tests for django-critic."""
def setUp(self):
"""Set up some initial data."""
<|body_0|>
def test_add_rating(self):
"""This test will ensure adding a rating works."""
<|body_1|>
def test_change_rating(self):
"""This... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CriticTestCase:
"""The main tests for django-critic."""
def setUp(self):
"""Set up some initial data."""
self.sample = TestSample.objects.create(name='Testing')
self.product = TestProduct.objects.create(name='My Product')
self.bob = User.objects.get(pk=1)
self.jim ... | the_stack_v2_python_sparse | sampleproject/lib/python2.7/site-packages/django_critic-0.2.4-py2.7.egg/critic/tests.py | mikanyman/.virtualenvs-legacy | train | 0 |
fc6f3d3e273a3a8e83b797f47ce4f6f7a506c5af | [
"data = self.request.get('data', {})\nuser = self.request.app['models']['user']\ncompany = self.request.app['models']['company']\nself_id = data['self_id']\nu = await user.get_user(self_id)\ncontacts = await user.get_users(u['contacts'])\ncompanys = await company.get_companys_by_user(self_id)\ndata.update({'contact... | <|body_start_0|>
data = self.request.get('data', {})
user = self.request.app['models']['user']
company = self.request.app['models']['company']
self_id = data['self_id']
u = await user.get_user(self_id)
contacts = await user.get_users(u['contacts'])
companys = awai... | Contacts | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Contacts:
async def get(self):
"""Контакты, с которыми есть чат или добавлены в контакты"""
<|body_0|>
async def put(self):
"""Добавить пользователя в контакты"""
<|body_1|>
async def delete(self):
"""Удалить пользователя из списка контактов"""
... | stack_v2_sparse_classes_75kplus_train_008893 | 19,248 | no_license | [
{
"docstring": "Контакты, с которыми есть чат или добавлены в контакты",
"name": "get",
"signature": "async def get(self)"
},
{
"docstring": "Добавить пользователя в контакты",
"name": "put",
"signature": "async def put(self)"
},
{
"docstring": "Удалить пользователя из списка кон... | 3 | stack_v2_sparse_classes_30k_train_011168 | Implement the Python class `Contacts` described below.
Class description:
Implement the Contacts class.
Method signatures and docstrings:
- async def get(self): Контакты, с которыми есть чат или добавлены в контакты
- async def put(self): Добавить пользователя в контакты
- async def delete(self): Удалить пользователя... | Implement the Python class `Contacts` described below.
Class description:
Implement the Contacts class.
Method signatures and docstrings:
- async def get(self): Контакты, с которыми есть чат или добавлены в контакты
- async def put(self): Добавить пользователя в контакты
- async def delete(self): Удалить пользователя... | c8726ad77079b981453c11d5c7fc39bc838eec67 | <|skeleton|>
class Contacts:
async def get(self):
"""Контакты, с которыми есть чат или добавлены в контакты"""
<|body_0|>
async def put(self):
"""Добавить пользователя в контакты"""
<|body_1|>
async def delete(self):
"""Удалить пользователя из списка контактов"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Contacts:
async def get(self):
"""Контакты, с которыми есть чат или добавлены в контакты"""
data = self.request.get('data', {})
user = self.request.app['models']['user']
company = self.request.app['models']['company']
self_id = data['self_id']
u = await user.get... | the_stack_v2_python_sparse | chat/views.py | ArtemZaitsev1994/chat | train | 0 | |
b95b07a6a7f342f8e5be17d0c8cebdfdeee59ba3 | [
"self.lonpole = lonpole\nlatpoler = latpole * dtor\nself.coslatpole = math.cos(latpoler)\nself.sinlatpole = math.sin(latpoler)\nif nPoleGridLon is None:\n self.polerotate = polerotate\nelse:\n self.polerotate = lonpole - nPoleGridLon + 180.0\nself.lonMin = lonMin\nself.lonMax = lonMin + 360.0",
"lonpole = s... | <|body_start_0|>
self.lonpole = lonpole
latpoler = latpole * dtor
self.coslatpole = math.cos(latpoler)
self.sinlatpole = math.sin(latpoler)
if nPoleGridLon is None:
self.polerotate = polerotate
else:
self.polerotate = lonpole - nPoleGridLon + 180.0... | Rotated grid class. For more info, see doc strings for '__init__' and 'transform' methods. | Rotgrid | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Rotgrid:
"""Rotated grid class. For more info, see doc strings for '__init__' and 'transform' methods."""
def __init__(self, lonpole, latpole, polerotate=0, nPoleGridLon=None, lonMin=-180.0):
"""Set up rotated grid for transformations. Inputs: lonpole, latpole: longitude (degrees) an... | stack_v2_sparse_classes_75kplus_train_008894 | 6,762 | no_license | [
{
"docstring": "Set up rotated grid for transformations. Inputs: lonpole, latpole: longitude (degrees) and latitude (degrees) of the pole of the rotated grid, as seen in the non-rotated grid polerotate: optional input -- by default, the calculation assumes that the rotated grid is singly rotated, i.e. that the ... | 2 | stack_v2_sparse_classes_30k_train_051071 | Implement the Python class `Rotgrid` described below.
Class description:
Rotated grid class. For more info, see doc strings for '__init__' and 'transform' methods.
Method signatures and docstrings:
- def __init__(self, lonpole, latpole, polerotate=0, nPoleGridLon=None, lonMin=-180.0): Set up rotated grid for transfor... | Implement the Python class `Rotgrid` described below.
Class description:
Rotated grid class. For more info, see doc strings for '__init__' and 'transform' methods.
Method signatures and docstrings:
- def __init__(self, lonpole, latpole, polerotate=0, nPoleGridLon=None, lonMin=-180.0): Set up rotated grid for transfor... | 790ad1aa7e7a8c6593a21ee53b2c946b2f7a356b | <|skeleton|>
class Rotgrid:
"""Rotated grid class. For more info, see doc strings for '__init__' and 'transform' methods."""
def __init__(self, lonpole, latpole, polerotate=0, nPoleGridLon=None, lonMin=-180.0):
"""Set up rotated grid for transformations. Inputs: lonpole, latpole: longitude (degrees) an... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Rotgrid:
"""Rotated grid class. For more info, see doc strings for '__init__' and 'transform' methods."""
def __init__(self, lonpole, latpole, polerotate=0, nPoleGridLon=None, lonMin=-180.0):
"""Set up rotated grid for transformations. Inputs: lonpole, latpole: longitude (degrees) and latitude (d... | the_stack_v2_python_sparse | utils/u_rotgrid.py | cornkle/proj_CEH | train | 2 |
1bf0320d40cd541a5258e1e34a6ac5af17dd792c | [
"if isinstance(node, list):\n for item in node:\n self.visit(item)\nelif isinstance(node, AST):\n method = 'visit_' + node.__class__.__name__\n visitor = getattr(self, method, self.generic_visit)\n visitor(node)",
"for field in getattr(node, '_fields'):\n value = getattr(node, field, None)\n... | <|body_start_0|>
if isinstance(node, list):
for item in node:
self.visit(item)
elif isinstance(node, AST):
method = 'visit_' + node.__class__.__name__
visitor = getattr(self, method, self.generic_visit)
visitor(node)
<|end_body_0|>
<|body_... | Class for visiting nodes of the parse tree. This is modeled after a similar class in the standard library ast.NodeVisitor. For each node, the visit(node) method calls a method visit_NodeName(node) which should be implemented in subclasses. The generic_visit() method is called for all nodes where there is no matching vi... | NodeVisitor | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NodeVisitor:
"""Class for visiting nodes of the parse tree. This is modeled after a similar class in the standard library ast.NodeVisitor. For each node, the visit(node) method calls a method visit_NodeName(node) which should be implemented in subclasses. The generic_visit() method is called for ... | stack_v2_sparse_classes_75kplus_train_008895 | 7,611 | no_license | [
{
"docstring": "Execute a method of the form visit_NodeName(node) where NodeName is the name of the class of a particular node.",
"name": "visit",
"signature": "def visit(self, node)"
},
{
"docstring": "Method executed if no applicable visit_ method can be found. This examines the node to see if... | 3 | stack_v2_sparse_classes_30k_train_041903 | Implement the Python class `NodeVisitor` described below.
Class description:
Class for visiting nodes of the parse tree. This is modeled after a similar class in the standard library ast.NodeVisitor. For each node, the visit(node) method calls a method visit_NodeName(node) which should be implemented in subclasses. Th... | Implement the Python class `NodeVisitor` described below.
Class description:
Class for visiting nodes of the parse tree. This is modeled after a similar class in the standard library ast.NodeVisitor. For each node, the visit(node) method calls a method visit_NodeName(node) which should be implemented in subclasses. Th... | cab2b2563b81036cf39a530fb3d7d5e756478beb | <|skeleton|>
class NodeVisitor:
"""Class for visiting nodes of the parse tree. This is modeled after a similar class in the standard library ast.NodeVisitor. For each node, the visit(node) method calls a method visit_NodeName(node) which should be implemented in subclasses. The generic_visit() method is called for ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class NodeVisitor:
"""Class for visiting nodes of the parse tree. This is modeled after a similar class in the standard library ast.NodeVisitor. For each node, the visit(node) method calls a method visit_NodeName(node) which should be implemented in subclasses. The generic_visit() method is called for all nodes whe... | the_stack_v2_python_sparse | compilers/goner/full/ast.py | CamDavidsonPilon/compilers | train | 5 |
44bb44f03d94633f0914ae23ef306191a9e938f5 | [
"questions = QuestionModel().find_all()\nfrom api.modules.questionnaire.schema import QuestionSchema\nreturn ApiResponse.success(QuestionSchema(many=True).dump(questions), 200)",
"param_dict = self.create_question_parser.parse_args()\nquestion = QuestionModel(**{'question': param_dict['question']})\noption_icons ... | <|body_start_0|>
questions = QuestionModel().find_all()
from api.modules.questionnaire.schema import QuestionSchema
return ApiResponse.success(QuestionSchema(many=True).dump(questions), 200)
<|end_body_0|>
<|body_start_1|>
param_dict = self.create_question_parser.parse_args()
qu... | Question | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Question:
def get(self):
"""Get all questionnaire"""
<|body_0|>
def post(self):
"""add new questionnaire and options"""
<|body_1|>
def delete(self, question_id: int):
"""new questionnaire and options"""
<|body_2|>
<|end_skeleton|>
<|bod... | stack_v2_sparse_classes_75kplus_train_008896 | 3,395 | no_license | [
{
"docstring": "Get all questionnaire",
"name": "get",
"signature": "def get(self)"
},
{
"docstring": "add new questionnaire and options",
"name": "post",
"signature": "def post(self)"
},
{
"docstring": "new questionnaire and options",
"name": "delete",
"signature": "def ... | 3 | stack_v2_sparse_classes_30k_train_040862 | Implement the Python class `Question` described below.
Class description:
Implement the Question class.
Method signatures and docstrings:
- def get(self): Get all questionnaire
- def post(self): add new questionnaire and options
- def delete(self, question_id: int): new questionnaire and options | Implement the Python class `Question` described below.
Class description:
Implement the Question class.
Method signatures and docstrings:
- def get(self): Get all questionnaire
- def post(self): add new questionnaire and options
- def delete(self, question_id: int): new questionnaire and options
<|skeleton|>
class Q... | 8e61e2e9564410d3eec4cf2862e2dbc4c5058efc | <|skeleton|>
class Question:
def get(self):
"""Get all questionnaire"""
<|body_0|>
def post(self):
"""add new questionnaire and options"""
<|body_1|>
def delete(self, question_id: int):
"""new questionnaire and options"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Question:
def get(self):
"""Get all questionnaire"""
questions = QuestionModel().find_all()
from api.modules.questionnaire.schema import QuestionSchema
return ApiResponse.success(QuestionSchema(many=True).dump(questions), 200)
def post(self):
"""add new questionnai... | the_stack_v2_python_sparse | api/modules/questionnaire/resource.py | abhit9l/nasih | train | 0 | |
e639a6ed7e4b136990b840ad7310959ad01469c0 | [
"self.params = kwargs\nself.zone = zone\nself.project = project\nself._api = googleapiclient.discovery.build('compute', 'v1')",
"res = self._api.instances().get(instance=node_name, project=self.project, zone=self.zone).execute()\ntry:\n return res['networkInterfaces'][0]['accessConfigs'][0]['natIP']\nexcept (I... | <|body_start_0|>
self.params = kwargs
self.zone = zone
self.project = project
self._api = googleapiclient.discovery.build('compute', 'v1')
<|end_body_0|>
<|body_start_1|>
res = self._api.instances().get(instance=node_name, project=self.project, zone=self.zone).execute()
... | Google provider class. | GoogleProvider | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GoogleProvider:
"""Google provider class."""
def __init__(self, project, zone, **kwargs):
"""Google provider constructor."""
<|body_0|>
def get_ext_ip_addr(self, node_name):
"""Get the external IP of this node (or None if no IP)."""
<|body_1|>
def se... | stack_v2_sparse_classes_75kplus_train_008897 | 1,599 | permissive | [
{
"docstring": "Google provider constructor.",
"name": "__init__",
"signature": "def __init__(self, project, zone, **kwargs)"
},
{
"docstring": "Get the external IP of this node (or None if no IP).",
"name": "get_ext_ip_addr",
"signature": "def get_ext_ip_addr(self, node_name)"
},
{
... | 3 | stack_v2_sparse_classes_30k_train_018399 | Implement the Python class `GoogleProvider` described below.
Class description:
Google provider class.
Method signatures and docstrings:
- def __init__(self, project, zone, **kwargs): Google provider constructor.
- def get_ext_ip_addr(self, node_name): Get the external IP of this node (or None if no IP).
- def setup_... | Implement the Python class `GoogleProvider` described below.
Class description:
Google provider class.
Method signatures and docstrings:
- def __init__(self, project, zone, **kwargs): Google provider constructor.
- def get_ext_ip_addr(self, node_name): Get the external IP of this node (or None if no IP).
- def setup_... | 4d2f965765bc0d54236898d62bbd9d01a4b850e8 | <|skeleton|>
class GoogleProvider:
"""Google provider class."""
def __init__(self, project, zone, **kwargs):
"""Google provider constructor."""
<|body_0|>
def get_ext_ip_addr(self, node_name):
"""Get the external IP of this node (or None if no IP)."""
<|body_1|>
def se... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GoogleProvider:
"""Google provider class."""
def __init__(self, project, zone, **kwargs):
"""Google provider constructor."""
self.params = kwargs
self.zone = zone
self.project = project
self._api = googleapiclient.discovery.build('compute', 'v1')
def get_ext_i... | the_stack_v2_python_sparse | beeflow/common/cloud/google.py | lanl/BEE | train | 18 |
85e574e76cdd1477e0e3e605c1e5dc1b1b322940 | [
"pa, pb = (headA, headB)\nwhile pa != pb:\n pa = pa.next if pa else headB\n pb = pb.next if pb else headA\nreturn pa",
"bag = set()\nwhile headA:\n bag.add(headA)\n headA = headA.next\nwhile headB:\n if headB in bag:\n return headB\n headB = headB.next\nreturn None"
] | <|body_start_0|>
pa, pb = (headA, headB)
while pa != pb:
pa = pa.next if pa else headB
pb = pb.next if pb else headA
return pa
<|end_body_0|>
<|body_start_1|>
bag = set()
while headA:
bag.add(headA)
headA = headA.next
while... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def getIntersectionNode(self, headA, headB):
""":type head1, head1: ListNode :rtype: ListNode"""
<|body_0|>
def getIntersectionNode_v0(self, headA, headB):
""":type head1, head1: ListNode :rtype: ListNode"""
<|body_1|>
<|end_skeleton|>
<|body_star... | stack_v2_sparse_classes_75kplus_train_008898 | 3,643 | no_license | [
{
"docstring": ":type head1, head1: ListNode :rtype: ListNode",
"name": "getIntersectionNode",
"signature": "def getIntersectionNode(self, headA, headB)"
},
{
"docstring": ":type head1, head1: ListNode :rtype: ListNode",
"name": "getIntersectionNode_v0",
"signature": "def getIntersection... | 2 | stack_v2_sparse_classes_30k_train_042715 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def getIntersectionNode(self, headA, headB): :type head1, head1: ListNode :rtype: ListNode
- def getIntersectionNode_v0(self, headA, headB): :type head1, head1: ListNode :rtype: ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def getIntersectionNode(self, headA, headB): :type head1, head1: ListNode :rtype: ListNode
- def getIntersectionNode_v0(self, headA, headB): :type head1, head1: ListNode :rtype: ... | b5e09f24e8e96454dc99e20281e853fb9fcc85ed | <|skeleton|>
class Solution:
def getIntersectionNode(self, headA, headB):
""":type head1, head1: ListNode :rtype: ListNode"""
<|body_0|>
def getIntersectionNode_v0(self, headA, headB):
""":type head1, head1: ListNode :rtype: ListNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def getIntersectionNode(self, headA, headB):
""":type head1, head1: ListNode :rtype: ListNode"""
pa, pb = (headA, headB)
while pa != pb:
pa = pa.next if pa else headB
pb = pb.next if pb else headA
return pa
def getIntersectionNode_v0(self,... | the_stack_v2_python_sparse | python/160_Intersection_of_Two_Linked_Lists.py | Moby5/myleetcode | train | 2 | |
c7c437b1511891234b13fdac94e66fff749f895a | [
"response = self.client.get('/')\nself.assertEqual(response.status_code, 200)\nself.assertTemplateUsed(response, 'home/index.html')",
"response = self.client.get(reverse('about'))\nself.assertEqual(response.status_code, 200)\nself.assertTemplateUsed(response, 'home/about.html')",
"response = self.client.get(rev... | <|body_start_0|>
response = self.client.get('/')
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, 'home/index.html')
<|end_body_0|>
<|body_start_1|>
response = self.client.get(reverse('about'))
self.assertEqual(response.status_code, 200)
self... | TestHomeViews | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestHomeViews:
def test_get_home(self):
"""test index view"""
<|body_0|>
def test_get_about(self):
"""test about view"""
<|body_1|>
def test_get_meet_the_coaches(self):
"""test meet the coaches view"""
<|body_2|>
def test_get_search(... | stack_v2_sparse_classes_75kplus_train_008899 | 1,625 | no_license | [
{
"docstring": "test index view",
"name": "test_get_home",
"signature": "def test_get_home(self)"
},
{
"docstring": "test about view",
"name": "test_get_about",
"signature": "def test_get_about(self)"
},
{
"docstring": "test meet the coaches view",
"name": "test_get_meet_the_... | 5 | stack_v2_sparse_classes_30k_train_014658 | Implement the Python class `TestHomeViews` described below.
Class description:
Implement the TestHomeViews class.
Method signatures and docstrings:
- def test_get_home(self): test index view
- def test_get_about(self): test about view
- def test_get_meet_the_coaches(self): test meet the coaches view
- def test_get_se... | Implement the Python class `TestHomeViews` described below.
Class description:
Implement the TestHomeViews class.
Method signatures and docstrings:
- def test_get_home(self): test index view
- def test_get_about(self): test about view
- def test_get_meet_the_coaches(self): test meet the coaches view
- def test_get_se... | 9d1e983aaacaa316ce42c981d4e3e195259c4059 | <|skeleton|>
class TestHomeViews:
def test_get_home(self):
"""test index view"""
<|body_0|>
def test_get_about(self):
"""test about view"""
<|body_1|>
def test_get_meet_the_coaches(self):
"""test meet the coaches view"""
<|body_2|>
def test_get_search(... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestHomeViews:
def test_get_home(self):
"""test index view"""
response = self.client.get('/')
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, 'home/index.html')
def test_get_about(self):
"""test about view"""
response = self.cl... | the_stack_v2_python_sparse | home/tests.py | Lucyjpjones/lj-fscr | train | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.