blob_id stringlengths 40 40 | bodies listlengths 2 6 | bodies_text stringlengths 196 6.73k | class_docstring stringlengths 0 700 | class_name stringlengths 1 86 | detected_licenses listlengths 0 45 | format_version stringclasses 1
value | full_text stringlengths 438 7.52k | id stringlengths 40 40 | length_bytes int64 506 50k | license_type stringclasses 2
values | methods listlengths 2 6 | n_methods int64 2 6 | original_id stringlengths 38 40 ⌀ | prompt stringlengths 153 4.25k | prompted_full_text stringlengths 645 10.7k | revision_id stringlengths 40 40 | skeleton stringlengths 162 4.34k | snapshot_name stringclasses 1
value | snapshot_source_dir stringclasses 1
value | solution stringlengths 302 7.33k | source stringclasses 1
value | source_path stringlengths 4 177 | source_repo stringlengths 6 110 | split stringclasses 1
value | star_events_count int64 0 209k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
6cf68cfbc2f74a8bdd49542dd531165782f132d1 | [
"self.created_time = created_time\nself.parent_volume = parent_volume\nself.serial_number = serial_number\nself.size_bytes = size_bytes\nself.used_bytes = used_bytes",
"if dictionary is None:\n return None\ncreated_time = dictionary.get('createdTime')\nparent_volume = dictionary.get('parentVolume')\nserial_num... | <|body_start_0|>
self.created_time = created_time
self.parent_volume = parent_volume
self.serial_number = serial_number
self.size_bytes = size_bytes
self.used_bytes = used_bytes
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
create... | Implementation of the 'PureVolume' model. Specifies a Pure Volume in a Pure Storage Array. Attributes: created_time (string): Specifies the created time (e.g., "2015-07-21T17:59:41Z") of the volume. parent_volume (string): Specifies the name of the source volume, if this volume was copied or cloned from it. serial_numb... | PureVolume | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PureVolume:
"""Implementation of the 'PureVolume' model. Specifies a Pure Volume in a Pure Storage Array. Attributes: created_time (string): Specifies the created time (e.g., "2015-07-21T17:59:41Z") of the volume. parent_volume (string): Specifies the name of the source volume, if this volume was... | stack_v2_sparse_classes_36k_train_005200 | 2,554 | permissive | [
{
"docstring": "Constructor for the PureVolume class",
"name": "__init__",
"signature": "def __init__(self, created_time=None, parent_volume=None, serial_number=None, size_bytes=None, used_bytes=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictionary (dicti... | 2 | null | Implement the Python class `PureVolume` described below.
Class description:
Implementation of the 'PureVolume' model. Specifies a Pure Volume in a Pure Storage Array. Attributes: created_time (string): Specifies the created time (e.g., "2015-07-21T17:59:41Z") of the volume. parent_volume (string): Specifies the name o... | Implement the Python class `PureVolume` described below.
Class description:
Implementation of the 'PureVolume' model. Specifies a Pure Volume in a Pure Storage Array. Attributes: created_time (string): Specifies the created time (e.g., "2015-07-21T17:59:41Z") of the volume. parent_volume (string): Specifies the name o... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class PureVolume:
"""Implementation of the 'PureVolume' model. Specifies a Pure Volume in a Pure Storage Array. Attributes: created_time (string): Specifies the created time (e.g., "2015-07-21T17:59:41Z") of the volume. parent_volume (string): Specifies the name of the source volume, if this volume was... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PureVolume:
"""Implementation of the 'PureVolume' model. Specifies a Pure Volume in a Pure Storage Array. Attributes: created_time (string): Specifies the created time (e.g., "2015-07-21T17:59:41Z") of the volume. parent_volume (string): Specifies the name of the source volume, if this volume was copied or cl... | the_stack_v2_python_sparse | cohesity_management_sdk/models/pure_volume.py | cohesity/management-sdk-python | train | 24 |
43f7916f4fd743149cfa3db50c29dbe62e424e82 | [
"self.V = V\nself.E = 0\nself.adj = [Bag() for _ in range(V)]",
"self.adj[v].add(w)\nself.adj[w].add(v)\nself.E += 1",
"s = '%d vertices, %d edges\\n' % (self.V, self.E)\nfor v in range(self.V):\n s += '%d: ' % v\n for w in self.adj(v):\n s += '%d ' % w\n s += '\\n'\nreturn s"
] | <|body_start_0|>
self.V = V
self.E = 0
self.adj = [Bag() for _ in range(V)]
<|end_body_0|>
<|body_start_1|>
self.adj[v].add(w)
self.adj[w].add(v)
self.E += 1
<|end_body_1|>
<|body_start_2|>
s = '%d vertices, %d edges\n' % (self.V, self.E)
for v in range(... | Graph | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Graph:
def __init__(self, V):
"""Args: V: int"""
<|body_0|>
def add_edge(self, v, w):
"""Args: v: int w: int"""
<|body_1|>
def __str__(self):
"""图的邻接表的字符串表示, Graph的实例方法 Return: str"""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_36k_train_005201 | 891 | no_license | [
{
"docstring": "Args: V: int",
"name": "__init__",
"signature": "def __init__(self, V)"
},
{
"docstring": "Args: v: int w: int",
"name": "add_edge",
"signature": "def add_edge(self, v, w)"
},
{
"docstring": "图的邻接表的字符串表示, Graph的实例方法 Return: str",
"name": "__str__",
"signat... | 3 | stack_v2_sparse_classes_30k_train_012322 | Implement the Python class `Graph` described below.
Class description:
Implement the Graph class.
Method signatures and docstrings:
- def __init__(self, V): Args: V: int
- def add_edge(self, v, w): Args: v: int w: int
- def __str__(self): 图的邻接表的字符串表示, Graph的实例方法 Return: str | Implement the Python class `Graph` described below.
Class description:
Implement the Graph class.
Method signatures and docstrings:
- def __init__(self, V): Args: V: int
- def add_edge(self, v, w): Args: v: int w: int
- def __str__(self): 图的邻接表的字符串表示, Graph的实例方法 Return: str
<|skeleton|>
class Graph:
def __init_... | c4e5cce32826ae8ead955277b85f6b3377286d51 | <|skeleton|>
class Graph:
def __init__(self, V):
"""Args: V: int"""
<|body_0|>
def add_edge(self, v, w):
"""Args: v: int w: int"""
<|body_1|>
def __str__(self):
"""图的邻接表的字符串表示, Graph的实例方法 Return: str"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Graph:
def __init__(self, V):
"""Args: V: int"""
self.V = V
self.E = 0
self.adj = [Bag() for _ in range(V)]
def add_edge(self, v, w):
"""Args: v: int w: int"""
self.adj[v].add(w)
self.adj[w].add(v)
self.E += 1
def __str__(self):
... | the_stack_v2_python_sparse | code/chapter4/Graph.py | AiZhanghan/Algorithms-Fourth-Edition | train | 0 | |
438af57cdc2a92318f78f7d747f4864af2953505 | [
"self._ksp = ksp\nself._norm0 = 1.0\nself._norm = 1.0",
"if counter == 0 and norm != 0.0:\n self._norm0 = norm\nself._norm = norm\nksp = self._ksp\nksp.iter_count += 1\nif ksp.options['iprint'] == 2:\n ksp.print_norm(ksp.print_name, ksp.system, ksp.iter_count, norm, self._norm0, indent=1, solver='LN')"
] | <|body_start_0|>
self._ksp = ksp
self._norm0 = 1.0
self._norm = 1.0
<|end_body_0|>
<|body_start_1|>
if counter == 0 and norm != 0.0:
self._norm0 = norm
self._norm = norm
ksp = self._ksp
ksp.iter_count += 1
if ksp.options['iprint'] == 2:
... | Prints output from PETSc's KSP solvers | Monitor | [
"LicenseRef-scancode-other-permissive"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Monitor:
"""Prints output from PETSc's KSP solvers"""
def __init__(self, ksp):
"""Stores pointer to the ksp solver"""
<|body_0|>
def __call__(self, ksp, counter, norm):
"""Store norm if first iteration, and print norm"""
<|body_1|>
<|end_skeleton|>
<|bo... | stack_v2_sparse_classes_36k_train_005202 | 13,096 | permissive | [
{
"docstring": "Stores pointer to the ksp solver",
"name": "__init__",
"signature": "def __init__(self, ksp)"
},
{
"docstring": "Store norm if first iteration, and print norm",
"name": "__call__",
"signature": "def __call__(self, ksp, counter, norm)"
}
] | 2 | stack_v2_sparse_classes_30k_train_011328 | Implement the Python class `Monitor` described below.
Class description:
Prints output from PETSc's KSP solvers
Method signatures and docstrings:
- def __init__(self, ksp): Stores pointer to the ksp solver
- def __call__(self, ksp, counter, norm): Store norm if first iteration, and print norm | Implement the Python class `Monitor` described below.
Class description:
Prints output from PETSc's KSP solvers
Method signatures and docstrings:
- def __init__(self, ksp): Stores pointer to the ksp solver
- def __call__(self, ksp, counter, norm): Store norm if first iteration, and print norm
<|skeleton|>
class Moni... | bc7a05e04c7901f477fe553c59e478a837116d92 | <|skeleton|>
class Monitor:
"""Prints output from PETSc's KSP solvers"""
def __init__(self, ksp):
"""Stores pointer to the ksp solver"""
<|body_0|>
def __call__(self, ksp, counter, norm):
"""Store norm if first iteration, and print norm"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Monitor:
"""Prints output from PETSc's KSP solvers"""
def __init__(self, ksp):
"""Stores pointer to the ksp solver"""
self._ksp = ksp
self._norm0 = 1.0
self._norm = 1.0
def __call__(self, ksp, counter, norm):
"""Store norm if first iteration, and print norm"""... | the_stack_v2_python_sparse | bin/Python27/Lib/site-packages/openmdao/solvers/petsc_ksp.py | metamorph-inc/meta-core | train | 25 |
ad8494616fa79f617b37aa9cb59fbcd103124889 | [
"def function(x, n):\n \"\"\" Square root function f(x) = x^2 - n \"\"\"\n return x ** 2 - n\n\ndef newton_raphson(x1, fx1, f1):\n \"\"\" newton raphson formula -> x2 = x1 - fx1 / f1 \n here f1 is derivative of fx1\n \"\"\"\n return x1 - f1 / fx1\nif x == 0 or x == 1:\n ret... | <|body_start_0|>
def function(x, n):
""" Square root function f(x) = x^2 - n """
return x ** 2 - n
def newton_raphson(x1, fx1, f1):
""" newton raphson formula -> x2 = x1 - fx1 / f1
here f1 is derivative of fx1
"""
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def mySqrt(self, x):
""":type x: int :rtype: int"""
<|body_0|>
def mySqrt2(self, x):
"""Alternative method using newton integer division method"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
def function(x, n):
""" Square root... | stack_v2_sparse_classes_36k_train_005203 | 1,218 | no_license | [
{
"docstring": ":type x: int :rtype: int",
"name": "mySqrt",
"signature": "def mySqrt(self, x)"
},
{
"docstring": "Alternative method using newton integer division method",
"name": "mySqrt2",
"signature": "def mySqrt2(self, x)"
}
] | 2 | stack_v2_sparse_classes_30k_train_008915 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def mySqrt(self, x): :type x: int :rtype: int
- def mySqrt2(self, x): Alternative method using newton integer division method | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def mySqrt(self, x): :type x: int :rtype: int
- def mySqrt2(self, x): Alternative method using newton integer division method
<|skeleton|>
class Solution:
def mySqrt(self, ... | b7e92f9a7c4d6652d4901b189f51063ce5520653 | <|skeleton|>
class Solution:
def mySqrt(self, x):
""":type x: int :rtype: int"""
<|body_0|>
def mySqrt2(self, x):
"""Alternative method using newton integer division method"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def mySqrt(self, x):
""":type x: int :rtype: int"""
def function(x, n):
""" Square root function f(x) = x^2 - n """
return x ** 2 - n
def newton_raphson(x1, fx1, f1):
""" newton raphson formula -> x2 = x1 - fx1 / f1
... | the_stack_v2_python_sparse | leetcode/easy/sqrt.py | abkunal/Data-Structures-and-Algorithms | train | 2 | |
35c3722cb0d1262b713d2555ed0e656cca812f80 | [
"super(MyView, self).__init__(parent)\nself.pixmap = None\nself.item = None\nself.rect_items = []\nself.scene = QGraphicsScene()\nself.setScene(self.scene)\nself.pen = QPen(QColor(255, 0, 0))\nself.pen.setWidth(3)\nself.brush = QBrush()",
"file_name = QFileDialog.getOpenFileName(self, 'Open file', './')\nn = np.f... | <|body_start_0|>
super(MyView, self).__init__(parent)
self.pixmap = None
self.item = None
self.rect_items = []
self.scene = QGraphicsScene()
self.setScene(self.scene)
self.pen = QPen(QColor(255, 0, 0))
self.pen.setWidth(3)
self.brush = QBrush()
<|e... | MyView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MyView:
def __init__(self, parent=None):
"""コンストラクタ(インスタンスが生成される時に呼び出される)"""
<|body_0|>
def setImage(self):
"""画像を取得して表示"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
super(MyView, self).__init__(parent)
self.pixmap = None
self.ite... | stack_v2_sparse_classes_36k_train_005204 | 4,924 | no_license | [
{
"docstring": "コンストラクタ(インスタンスが生成される時に呼び出される)",
"name": "__init__",
"signature": "def __init__(self, parent=None)"
},
{
"docstring": "画像を取得して表示",
"name": "setImage",
"signature": "def setImage(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_007535 | Implement the Python class `MyView` described below.
Class description:
Implement the MyView class.
Method signatures and docstrings:
- def __init__(self, parent=None): コンストラクタ(インスタンスが生成される時に呼び出される)
- def setImage(self): 画像を取得して表示 | Implement the Python class `MyView` described below.
Class description:
Implement the MyView class.
Method signatures and docstrings:
- def __init__(self, parent=None): コンストラクタ(インスタンスが生成される時に呼び出される)
- def setImage(self): 画像を取得して表示
<|skeleton|>
class MyView:
def __init__(self, parent=None):
"""コンストラクタ(イン... | fc76c7f29e7d1459058bde5736d6ee75561a25b6 | <|skeleton|>
class MyView:
def __init__(self, parent=None):
"""コンストラクタ(インスタンスが生成される時に呼び出される)"""
<|body_0|>
def setImage(self):
"""画像を取得して表示"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MyView:
def __init__(self, parent=None):
"""コンストラクタ(インスタンスが生成される時に呼び出される)"""
super(MyView, self).__init__(parent)
self.pixmap = None
self.item = None
self.rect_items = []
self.scene = QGraphicsScene()
self.setScene(self.scene)
self.pen = QPen(QCo... | the_stack_v2_python_sparse | 05_1024_cv/it_day5/test2.py | 278Mt/taniguchi | train | 0 | |
84059e77611c3279dd00145891df7a9045b3a054 | [
"f = self.dtype_f(self.init)\nv = u.flatten()\nf.comp1[:] = (self.A.dot(v) - 1.0 / self.eps ** 2 * v ** (self.nu + 1)).reshape(self.nvars)\nf.comp2[:] = (1.0 / self.eps ** 2 * v).reshape(self.nvars)\nreturn f",
"u = self.dtype_u(u0).flatten()\nz = self.dtype_u(self.init, val=0.0).flatten()\nnu = self.nu\neps2 = s... | <|body_start_0|>
f = self.dtype_f(self.init)
v = u.flatten()
f.comp1[:] = (self.A.dot(v) - 1.0 / self.eps ** 2 * v ** (self.nu + 1)).reshape(self.nvars)
f.comp2[:] = (1.0 / self.eps ** 2 * v).reshape(self.nvars)
return f
<|end_body_0|>
<|body_start_1|>
u = self.dtype_u(u... | Example implementing the Allen-Cahn equation in 2D with finite differences, AC splitting | allencahn_multiimplicit_v2 | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class allencahn_multiimplicit_v2:
"""Example implementing the Allen-Cahn equation in 2D with finite differences, AC splitting"""
def eval_f(self, u, t):
"""Routine to evaluate the right-hand side of the problem. Parameters ---------- u : dtype_u Current values of the numerical solution. t ... | stack_v2_sparse_classes_36k_train_005205 | 19,427 | permissive | [
{
"docstring": "Routine to evaluate the right-hand side of the problem. Parameters ---------- u : dtype_u Current values of the numerical solution. t : float Current time of the numerical solution is computed. Returns ------- f : dtype_f The right-hand side of the problem.",
"name": "eval_f",
"signature... | 3 | null | Implement the Python class `allencahn_multiimplicit_v2` described below.
Class description:
Example implementing the Allen-Cahn equation in 2D with finite differences, AC splitting
Method signatures and docstrings:
- def eval_f(self, u, t): Routine to evaluate the right-hand side of the problem. Parameters ----------... | Implement the Python class `allencahn_multiimplicit_v2` described below.
Class description:
Example implementing the Allen-Cahn equation in 2D with finite differences, AC splitting
Method signatures and docstrings:
- def eval_f(self, u, t): Routine to evaluate the right-hand side of the problem. Parameters ----------... | 1a51834bedffd4472e344bed28f4d766614b1537 | <|skeleton|>
class allencahn_multiimplicit_v2:
"""Example implementing the Allen-Cahn equation in 2D with finite differences, AC splitting"""
def eval_f(self, u, t):
"""Routine to evaluate the right-hand side of the problem. Parameters ---------- u : dtype_u Current values of the numerical solution. t ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class allencahn_multiimplicit_v2:
"""Example implementing the Allen-Cahn equation in 2D with finite differences, AC splitting"""
def eval_f(self, u, t):
"""Routine to evaluate the right-hand side of the problem. Parameters ---------- u : dtype_u Current values of the numerical solution. t : float Curre... | the_stack_v2_python_sparse | pySDC/implementations/problem_classes/AllenCahn_2D_FD.py | Parallel-in-Time/pySDC | train | 30 |
063e8a7d4a93dda1d9e1bd8322c73a7f2654cd9a | [
"self.header = {'Cache-Control': 'no-cache ', 'content-type': 'application/json'}\nself.data = '{}'\nself.api_url = f'{airflow_base_url}/api/experimental'\nself.dag_url = f'{self.api_url}/dags'",
"request_url = f'{self.dag_url}/{job_id}/paused/{str(not unpause)}'\nresponse = requests.get(request_url, headers=self... | <|body_start_0|>
self.header = {'Cache-Control': 'no-cache ', 'content-type': 'application/json'}
self.data = '{}'
self.api_url = f'{airflow_base_url}/api/experimental'
self.dag_url = f'{self.api_url}/dags'
<|end_body_0|>
<|body_start_1|>
request_url = f'{self.dag_url}/{job_id}/... | This class handles REST requests to the Airflow instance. | AirflowRestConnection | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AirflowRestConnection:
"""This class handles REST requests to the Airflow instance."""
def __init__(self, airflow_base_url: str) -> None:
"""Initialise Airflow REST connection service"""
<|body_0|>
def unpause_dag(self, job_id: str, unpause: bool=True) -> bool:
"... | stack_v2_sparse_classes_36k_train_005206 | 3,084 | permissive | [
{
"docstring": "Initialise Airflow REST connection service",
"name": "__init__",
"signature": "def __init__(self, airflow_base_url: str) -> None"
},
{
"docstring": "Pause/unpause dag",
"name": "unpause_dag",
"signature": "def unpause_dag(self, job_id: str, unpause: bool=True) -> bool"
... | 5 | stack_v2_sparse_classes_30k_train_017931 | Implement the Python class `AirflowRestConnection` described below.
Class description:
This class handles REST requests to the Airflow instance.
Method signatures and docstrings:
- def __init__(self, airflow_base_url: str) -> None: Initialise Airflow REST connection service
- def unpause_dag(self, job_id: str, unpaus... | Implement the Python class `AirflowRestConnection` described below.
Class description:
This class handles REST requests to the Airflow instance.
Method signatures and docstrings:
- def __init__(self, airflow_base_url: str) -> None: Initialise Airflow REST connection service
- def unpause_dag(self, job_id: str, unpaus... | 4890f05a2394dfd27b324f07c5f25222702941ad | <|skeleton|>
class AirflowRestConnection:
"""This class handles REST requests to the Airflow instance."""
def __init__(self, airflow_base_url: str) -> None:
"""Initialise Airflow REST connection service"""
<|body_0|>
def unpause_dag(self, job_id: str, unpause: bool=True) -> bool:
"... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AirflowRestConnection:
"""This class handles REST requests to the Airflow instance."""
def __init__(self, airflow_base_url: str) -> None:
"""Initialise Airflow REST connection service"""
self.header = {'Cache-Control': 'no-cache ', 'content-type': 'application/json'}
self.data = '... | the_stack_v2_python_sparse | services/jobs/jobs/dependencies/airflow_conn.py | bgoesswe/openeo-openshift-driver | train | 0 |
400d77524b00c0a9275ca1e13dde331d67c20c0d | [
"self.transition_matrix = transition_matrix\nself.hidden_state_objects = hidden_state_objects\nself.stationary_distribution = TransitionMatrix.get_stationary_distribution(transition_matrix)\nself.initial_distribution = self.stationary_distribution",
"validate_args(observations, distances)\nnhidden = len(self.hidd... | <|body_start_0|>
self.transition_matrix = transition_matrix
self.hidden_state_objects = hidden_state_objects
self.stationary_distribution = TransitionMatrix.get_stationary_distribution(transition_matrix)
self.initial_distribution = self.stationary_distribution
<|end_body_0|>
<|body_star... | MissingHMM | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MissingHMM:
def __init__(self, transition_matrix, hidden_state_objects):
"""@param transition_matrix: a numpy array that is a transition matrix among hidden states @param hidden_state_objects: a conformant list of hidden state objects"""
<|body_0|>
def scaled_forward_durbin(... | stack_v2_sparse_classes_36k_train_005207 | 8,288 | no_license | [
{
"docstring": "@param transition_matrix: a numpy array that is a transition matrix among hidden states @param hidden_state_objects: a conformant list of hidden state objects",
"name": "__init__",
"signature": "def __init__(self, transition_matrix, hidden_state_objects)"
},
{
"docstring": "For m... | 4 | stack_v2_sparse_classes_30k_train_006702 | Implement the Python class `MissingHMM` described below.
Class description:
Implement the MissingHMM class.
Method signatures and docstrings:
- def __init__(self, transition_matrix, hidden_state_objects): @param transition_matrix: a numpy array that is a transition matrix among hidden states @param hidden_state_objec... | Implement the Python class `MissingHMM` described below.
Class description:
Implement the MissingHMM class.
Method signatures and docstrings:
- def __init__(self, transition_matrix, hidden_state_objects): @param transition_matrix: a numpy array that is a transition matrix among hidden states @param hidden_state_objec... | 91c6f8331f18c914eb3dfc51bc166915998c5081 | <|skeleton|>
class MissingHMM:
def __init__(self, transition_matrix, hidden_state_objects):
"""@param transition_matrix: a numpy array that is a transition matrix among hidden states @param hidden_state_objects: a conformant list of hidden state objects"""
<|body_0|>
def scaled_forward_durbin(... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MissingHMM:
def __init__(self, transition_matrix, hidden_state_objects):
"""@param transition_matrix: a numpy array that is a transition matrix among hidden states @param hidden_state_objects: a conformant list of hidden state objects"""
self.transition_matrix = transition_matrix
self.... | the_stack_v2_python_sparse | MissingHMM.py | argriffing/xgcode | train | 1 | |
81b2985430f173470811b62ea153a449abc08b26 | [
"if not head:\n return None\nnode = head\nvals = []\nwhile node:\n vals.append(node.val)\n node = node.next\nvals = sorted(vals)\nnode = head\nfor val in vals:\n node.val = val\n node = node.next\nreturn head",
"if not head:\n return None\nfast, slow = (head.next, head)\nwhile fast and fast.next... | <|body_start_0|>
if not head:
return None
node = head
vals = []
while node:
vals.append(node.val)
node = node.next
vals = sorted(vals)
node = head
for val in vals:
node.val = val
node = node.next
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def sortList0(self, head):
"""思路1: 把链表所有节点的数值保存进一个列表,排序后, 在按照排序好的值依次给链表的节点赋值 :type head: ListNode :rtype: ListNode 时间复杂度: O(n) 空间复杂度: O(n) 不满足题目要求"""
<|body_0|>
def sortList(self, head):
"""为了满足题目的要求,需要使用归并排序 1. 自顶向下的归并排序 :param head: :return:"""
<|... | stack_v2_sparse_classes_36k_train_005208 | 3,401 | no_license | [
{
"docstring": "思路1: 把链表所有节点的数值保存进一个列表,排序后, 在按照排序好的值依次给链表的节点赋值 :type head: ListNode :rtype: ListNode 时间复杂度: O(n) 空间复杂度: O(n) 不满足题目要求",
"name": "sortList0",
"signature": "def sortList0(self, head)"
},
{
"docstring": "为了满足题目的要求,需要使用归并排序 1. 自顶向下的归并排序 :param head: :return:",
"name": "sortList",
... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def sortList0(self, head): 思路1: 把链表所有节点的数值保存进一个列表,排序后, 在按照排序好的值依次给链表的节点赋值 :type head: ListNode :rtype: ListNode 时间复杂度: O(n) 空间复杂度: O(n) 不满足题目要求
- def sortList(self, head): 为了满足题目... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def sortList0(self, head): 思路1: 把链表所有节点的数值保存进一个列表,排序后, 在按照排序好的值依次给链表的节点赋值 :type head: ListNode :rtype: ListNode 时间复杂度: O(n) 空间复杂度: O(n) 不满足题目要求
- def sortList(self, head): 为了满足题目... | 95dddb78bccd169d9d219a473627361fe739ab5e | <|skeleton|>
class Solution:
def sortList0(self, head):
"""思路1: 把链表所有节点的数值保存进一个列表,排序后, 在按照排序好的值依次给链表的节点赋值 :type head: ListNode :rtype: ListNode 时间复杂度: O(n) 空间复杂度: O(n) 不满足题目要求"""
<|body_0|>
def sortList(self, head):
"""为了满足题目的要求,需要使用归并排序 1. 自顶向下的归并排序 :param head: :return:"""
<|... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def sortList0(self, head):
"""思路1: 把链表所有节点的数值保存进一个列表,排序后, 在按照排序好的值依次给链表的节点赋值 :type head: ListNode :rtype: ListNode 时间复杂度: O(n) 空间复杂度: O(n) 不满足题目要求"""
if not head:
return None
node = head
vals = []
while node:
vals.append(node.val)
... | the_stack_v2_python_sparse | LinkListOperation/sortList.py | Philex5/codingPractice | train | 0 | |
562025bf99f1de4ce6bd11069551e4f50bc3c893 | [
"self._gv = gv\nself._dlg = SelectluDialog()\nself._dlg.setWindowFlags(self._dlg.windowFlags() & ~Qt.WindowContextHelpButtonHint)\nself._dlg.move(self._gv.selectLuPos)\nself._luse = ''",
"self._gv.db.populateAllLanduses(self._dlg.listBox, includeWATR=False)\nself._dlg.listBox.currentTextChanged.connect(self.selec... | <|body_start_0|>
self._gv = gv
self._dlg = SelectluDialog()
self._dlg.setWindowFlags(self._dlg.windowFlags() & ~Qt.WindowContextHelpButtonHint)
self._dlg.move(self._gv.selectLuPos)
self._luse = ''
<|end_body_0|>
<|body_start_1|>
self._gv.db.populateAllLanduses(self._dlg.... | Dialog to select a landuse from a list in listBox. | Selectlu | [
"GPL-2.0-or-later",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Selectlu:
"""Dialog to select a landuse from a list in listBox."""
def __init__(self, gv):
"""Initialise class variables."""
<|body_0|>
def run(self):
"""Run the dialog and return selected landuse."""
<|body_1|>
def select(self, selection):
"... | stack_v2_sparse_classes_36k_train_005209 | 2,589 | permissive | [
{
"docstring": "Initialise class variables.",
"name": "__init__",
"signature": "def __init__(self, gv)"
},
{
"docstring": "Run the dialog and return selected landuse.",
"name": "run",
"signature": "def run(self)"
},
{
"docstring": "A selection has the form 'LUSE (Description)' or... | 3 | null | Implement the Python class `Selectlu` described below.
Class description:
Dialog to select a landuse from a list in listBox.
Method signatures and docstrings:
- def __init__(self, gv): Initialise class variables.
- def run(self): Run the dialog and return selected landuse.
- def select(self, selection): A selection h... | Implement the Python class `Selectlu` described below.
Class description:
Dialog to select a landuse from a list in listBox.
Method signatures and docstrings:
- def __init__(self, gv): Initialise class variables.
- def run(self): Run the dialog and return selected landuse.
- def select(self, selection): A selection h... | ddb3de70708687ca3167ec4b72ac432426175f45 | <|skeleton|>
class Selectlu:
"""Dialog to select a landuse from a list in listBox."""
def __init__(self, gv):
"""Initialise class variables."""
<|body_0|>
def run(self):
"""Run the dialog and return selected landuse."""
<|body_1|>
def select(self, selection):
"... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Selectlu:
"""Dialog to select a landuse from a list in listBox."""
def __init__(self, gv):
"""Initialise class variables."""
self._gv = gv
self._dlg = SelectluDialog()
self._dlg.setWindowFlags(self._dlg.windowFlags() & ~Qt.WindowContextHelpButtonHint)
self._dlg.mov... | the_stack_v2_python_sparse | qswatplus/selectlu.py | celray/swatplus-automatic-workflow | train | 11 |
72e3e4744acf3429ce4e65036fde1a3264b86115 | [
"ss = []\nmax_len = 0\nlens = len(s)\nfor i, c in enumerate(s):\n if c not in ss:\n ss.append(c)\n else:\n if len(ss) > max_len:\n max_len = len(ss)\n ss = ss[ss.index(c) + 1:]\n ss.append(c)\nelse:\n if len(ss) > max_len:\n max_len = len(ss)\nreturn max_len",
... | <|body_start_0|>
ss = []
max_len = 0
lens = len(s)
for i, c in enumerate(s):
if c not in ss:
ss.append(c)
else:
if len(ss) > max_len:
max_len = len(ss)
ss = ss[ss.index(c) + 1:]
ss... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def lengthOfLongestSubstring(self, s: str) -> int:
"""这个解法, 现在看起来有点有点奇怪, 因为后面用了 ss=ss[ss.index(c)+1:] 这样奇怪的语句, 不过相比滑动窗口, 会更高效一点吧, 直接跳到了重复字符之后 执行用时 :68 ms, 在所有 Python3 提交中击败了98.22% 的用户 内存消耗 :14 MB, 在所有 Python3 提交中击败了5.01%的用户"""
<|body_0|>
def lengthOfLongestSubstrin... | stack_v2_sparse_classes_36k_train_005210 | 2,933 | no_license | [
{
"docstring": "这个解法, 现在看起来有点有点奇怪, 因为后面用了 ss=ss[ss.index(c)+1:] 这样奇怪的语句, 不过相比滑动窗口, 会更高效一点吧, 直接跳到了重复字符之后 执行用时 :68 ms, 在所有 Python3 提交中击败了98.22% 的用户 内存消耗 :14 MB, 在所有 Python3 提交中击败了5.01%的用户",
"name": "lengthOfLongestSubstring",
"signature": "def lengthOfLongestSubstring(self, s: str) -> int"
},
{
"d... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lengthOfLongestSubstring(self, s: str) -> int: 这个解法, 现在看起来有点有点奇怪, 因为后面用了 ss=ss[ss.index(c)+1:] 这样奇怪的语句, 不过相比滑动窗口, 会更高效一点吧, 直接跳到了重复字符之后 执行用时 :68 ms, 在所有 Python3 提交中击败了98.22% 的... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lengthOfLongestSubstring(self, s: str) -> int: 这个解法, 现在看起来有点有点奇怪, 因为后面用了 ss=ss[ss.index(c)+1:] 这样奇怪的语句, 不过相比滑动窗口, 会更高效一点吧, 直接跳到了重复字符之后 执行用时 :68 ms, 在所有 Python3 提交中击败了98.22% 的... | 99a3abf1774933af73a8405f9b59e5e64906bca4 | <|skeleton|>
class Solution:
def lengthOfLongestSubstring(self, s: str) -> int:
"""这个解法, 现在看起来有点有点奇怪, 因为后面用了 ss=ss[ss.index(c)+1:] 这样奇怪的语句, 不过相比滑动窗口, 会更高效一点吧, 直接跳到了重复字符之后 执行用时 :68 ms, 在所有 Python3 提交中击败了98.22% 的用户 内存消耗 :14 MB, 在所有 Python3 提交中击败了5.01%的用户"""
<|body_0|>
def lengthOfLongestSubstrin... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def lengthOfLongestSubstring(self, s: str) -> int:
"""这个解法, 现在看起来有点有点奇怪, 因为后面用了 ss=ss[ss.index(c)+1:] 这样奇怪的语句, 不过相比滑动窗口, 会更高效一点吧, 直接跳到了重复字符之后 执行用时 :68 ms, 在所有 Python3 提交中击败了98.22% 的用户 内存消耗 :14 MB, 在所有 Python3 提交中击败了5.01%的用户"""
ss = []
max_len = 0
lens = len(s)
... | the_stack_v2_python_sparse | leetcode/3.longest_substring_without_repeating_characters.py | iamkissg/leetcode | train | 0 | |
857deaee3796ba81a50f8ffdd02840668211c9cc | [
"port = 8773\nconfig = [('MobileNetV2BlockSpace', {'block_mask': [0]})]\nSANAS(configs=config, server_addr=('', port), init_temperature=0.7, reduce_rate=0.8, init_tokens=None, search_steps=1, save_checkpoint='./nas_checkpoint1', load_checkpoint=None, is_server=True)",
"port = 8774\nconfig = [('MobileNetV2BlockSpa... | <|body_start_0|>
port = 8773
config = [('MobileNetV2BlockSpace', {'block_mask': [0]})]
SANAS(configs=config, server_addr=('', port), init_temperature=0.7, reduce_rate=0.8, init_tokens=None, search_steps=1, save_checkpoint='./nas_checkpoint1', load_checkpoint=None, is_server=True)
<|end_body_0|>
... | Test SANAS | TestSANAS | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestSANAS:
"""Test SANAS"""
def test_SANAS1(self):
"""classpaddleslim.nas.SANAS(configs, server_addr=("", 8881), init_temperature=None, reduce_rate=0.85, init_tokens=None, search_steps=300, save_checkpoint='./nas_checkpoint', load_checkpoint=None, is_server=True) :return:"""
... | stack_v2_sparse_classes_36k_train_005211 | 2,475 | no_license | [
{
"docstring": "classpaddleslim.nas.SANAS(configs, server_addr=(\"\", 8881), init_temperature=None, reduce_rate=0.85, init_tokens=None, search_steps=300, save_checkpoint='./nas_checkpoint', load_checkpoint=None, is_server=True) :return:",
"name": "test_SANAS1",
"signature": "def test_SANAS1(self)"
},
... | 2 | null | Implement the Python class `TestSANAS` described below.
Class description:
Test SANAS
Method signatures and docstrings:
- def test_SANAS1(self): classpaddleslim.nas.SANAS(configs, server_addr=("", 8881), init_temperature=None, reduce_rate=0.85, init_tokens=None, search_steps=300, save_checkpoint='./nas_checkpoint', l... | Implement the Python class `TestSANAS` described below.
Class description:
Test SANAS
Method signatures and docstrings:
- def test_SANAS1(self): classpaddleslim.nas.SANAS(configs, server_addr=("", 8881), init_temperature=None, reduce_rate=0.85, init_tokens=None, search_steps=300, save_checkpoint='./nas_checkpoint', l... | bd3790ce72a2a26611b5eda3901651b5a809348f | <|skeleton|>
class TestSANAS:
"""Test SANAS"""
def test_SANAS1(self):
"""classpaddleslim.nas.SANAS(configs, server_addr=("", 8881), init_temperature=None, reduce_rate=0.85, init_tokens=None, search_steps=300, save_checkpoint='./nas_checkpoint', load_checkpoint=None, is_server=True) :return:"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestSANAS:
"""Test SANAS"""
def test_SANAS1(self):
"""classpaddleslim.nas.SANAS(configs, server_addr=("", 8881), init_temperature=None, reduce_rate=0.85, init_tokens=None, search_steps=300, save_checkpoint='./nas_checkpoint', load_checkpoint=None, is_server=True) :return:"""
port = 8773
... | the_stack_v2_python_sparse | models/PaddleSlim/CI/Slim_CI_all_case/p1_api_case_static/test_api_sa_nas.py | PaddlePaddle/PaddleTest | train | 42 |
fbfb8c278a934f9d88df1410d6083587a7db0cf7 | [
"if self.allow_blank:\n yield (u'__None', self.blank_text, self.data is None)\nfor value, label in self.choices:\n yield (value, label, self.coerce(value) in self.data)",
"if value is None:\n self.data = []\nelse:\n try:\n self.data = [self.coerce(value) for value in value]\n except (ValueEr... | <|body_start_0|>
if self.allow_blank:
yield (u'__None', self.blank_text, self.data is None)
for value, label in self.choices:
yield (value, label, self.coerce(value) in self.data)
<|end_body_0|>
<|body_start_1|>
if value is None:
self.data = []
else:
... | Extends select2 field to make it work with postgresql arrays and using choices. It is far from perfect and it should be tweaked it a bit more. | MultipleSelect2Field | [
"CC-BY-4.0",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MultipleSelect2Field:
"""Extends select2 field to make it work with postgresql arrays and using choices. It is far from perfect and it should be tweaked it a bit more."""
def iter_choices(self):
"""Iterate over choices especially to check if one of the values is selected."""
... | stack_v2_sparse_classes_36k_train_005212 | 4,420 | permissive | [
{
"docstring": "Iterate over choices especially to check if one of the values is selected.",
"name": "iter_choices",
"signature": "def iter_choices(self)"
},
{
"docstring": "This is called when you create the form with existing data.",
"name": "process_data",
"signature": "def process_da... | 4 | null | Implement the Python class `MultipleSelect2Field` described below.
Class description:
Extends select2 field to make it work with postgresql arrays and using choices. It is far from perfect and it should be tweaked it a bit more.
Method signatures and docstrings:
- def iter_choices(self): Iterate over choices especial... | Implement the Python class `MultipleSelect2Field` described below.
Class description:
Extends select2 field to make it work with postgresql arrays and using choices. It is far from perfect and it should be tweaked it a bit more.
Method signatures and docstrings:
- def iter_choices(self): Iterate over choices especial... | 9ae56d48836ae40d2b96955734c2d9f055917d30 | <|skeleton|>
class MultipleSelect2Field:
"""Extends select2 field to make it work with postgresql arrays and using choices. It is far from perfect and it should be tweaked it a bit more."""
def iter_choices(self):
"""Iterate over choices especially to check if one of the values is selected."""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MultipleSelect2Field:
"""Extends select2 field to make it work with postgresql arrays and using choices. It is far from perfect and it should be tweaked it a bit more."""
def iter_choices(self):
"""Iterate over choices especially to check if one of the values is selected."""
if self.allow... | the_stack_v2_python_sparse | api/app/admin/timeslot.py | bcgov/queue-management | train | 46 |
7088e12b4702c4c6dd4a037361fb5e4a34c44240 | [
"actual_num = len(response.context['messages'])\nif actual_num != expect_num:\n self.fail('Message count was %d, expected %d' % (actual_num, expect_num))",
"messages = response.context['messages']\nmatches = [m for m in messages if text == m.message]\nif len(matches):\n msg = matches[0]\n if level is not... | <|body_start_0|>
actual_num = len(response.context['messages'])
if actual_num != expect_num:
self.fail('Message count was %d, expected %d' % (actual_num, expect_num))
<|end_body_0|>
<|body_start_1|>
messages = response.context['messages']
matches = [m for m in messages if te... | TestCase | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestCase:
def assertMessageCount(self, response, expect_num):
"""Asserts that exactly the given number of messages have been sent."""
<|body_0|>
def assertHasMessage(self, response, text, level=None):
"""Asserts that there a message with the given text."""
<|... | stack_v2_sparse_classes_36k_train_005213 | 1,028 | permissive | [
{
"docstring": "Asserts that exactly the given number of messages have been sent.",
"name": "assertMessageCount",
"signature": "def assertMessageCount(self, response, expect_num)"
},
{
"docstring": "Asserts that there a message with the given text.",
"name": "assertHasMessage",
"signatur... | 2 | stack_v2_sparse_classes_30k_test_000214 | Implement the Python class `TestCase` described below.
Class description:
Implement the TestCase class.
Method signatures and docstrings:
- def assertMessageCount(self, response, expect_num): Asserts that exactly the given number of messages have been sent.
- def assertHasMessage(self, response, text, level=None): As... | Implement the Python class `TestCase` described below.
Class description:
Implement the TestCase class.
Method signatures and docstrings:
- def assertMessageCount(self, response, expect_num): Asserts that exactly the given number of messages have been sent.
- def assertHasMessage(self, response, text, level=None): As... | 30190c7e8ff2164c1127e26e733e0b65a9cd1f57 | <|skeleton|>
class TestCase:
def assertMessageCount(self, response, expect_num):
"""Asserts that exactly the given number of messages have been sent."""
<|body_0|>
def assertHasMessage(self, response, text, level=None):
"""Asserts that there a message with the given text."""
<|... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestCase:
def assertMessageCount(self, response, expect_num):
"""Asserts that exactly the given number of messages have been sent."""
actual_num = len(response.context['messages'])
if actual_num != expect_num:
self.fail('Message count was %d, expected %d' % (actual_num, exp... | the_stack_v2_python_sparse | trinitee/lib/unittest.py | chaosk/trinitee | train | 4 | |
f238f4a3fcd750f96942d1be86c714ffb26f44e2 | [
"self.prefix_sum = []\nprefix_sum, i = (0, 0)\nfor weight in w:\n prefix_sum += weight\n self.prefix_sum.append((i, prefix_sum))\n i += 1\nself.total_sum = prefix_sum",
"target = self.total_sum * random.random()\nfor i, prefix_sum in self.prefix_sum:\n if target < prefix_sum:\n return i\nreturn... | <|body_start_0|>
self.prefix_sum = []
prefix_sum, i = (0, 0)
for weight in w:
prefix_sum += weight
self.prefix_sum.append((i, prefix_sum))
i += 1
self.total_sum = prefix_sum
<|end_body_0|>
<|body_start_1|>
target = self.total_sum * random.rand... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def __init__(self, w):
""":type w: List[int]"""
<|body_0|>
def pickIndex(self):
""":rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.prefix_sum = []
prefix_sum, i = (0, 0)
for weight in w:
prefix_... | stack_v2_sparse_classes_36k_train_005214 | 1,051 | no_license | [
{
"docstring": ":type w: List[int]",
"name": "__init__",
"signature": "def __init__(self, w)"
},
{
"docstring": ":rtype: int",
"name": "pickIndex",
"signature": "def pickIndex(self)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def __init__(self, w): :type w: List[int]
- def pickIndex(self): :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def __init__(self, w): :type w: List[int]
- def pickIndex(self): :rtype: int
<|skeleton|>
class Solution:
def __init__(self, w):
""":type w: List[int]"""
<|... | 546cbce06fcd4bc34e16d42b5d5eb68fb25e16a9 | <|skeleton|>
class Solution:
def __init__(self, w):
""":type w: List[int]"""
<|body_0|>
def pickIndex(self):
""":rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def __init__(self, w):
""":type w: List[int]"""
self.prefix_sum = []
prefix_sum, i = (0, 0)
for weight in w:
prefix_sum += weight
self.prefix_sum.append((i, prefix_sum))
i += 1
self.total_sum = prefix_sum
def pickIndex(... | the_stack_v2_python_sparse | leetcode/solution_528.py | eselyavka/python | train | 0 | |
5d28e4c93036f7d520948a3c6e642e89b0e2dc2d | [
"pull_request_template = PullRequestTemplate.objects.get(owner=owner, repo=repo)\nserializer = PullRequestTemplateSerializer(pull_request_template)\nreturn Response(serializer.data)",
"pr_template = PullRequestTemplate.objects.filter(owner=owner, repo=repo)\nif pr_template:\n serializer = PullRequestTemplateSe... | <|body_start_0|>
pull_request_template = PullRequestTemplate.objects.get(owner=owner, repo=repo)
serializer = PullRequestTemplateSerializer(pull_request_template)
return Response(serializer.data)
<|end_body_0|>
<|body_start_1|>
pr_template = PullRequestTemplate.objects.filter(owner=owne... | PullRequestTemplateView | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PullRequestTemplateView:
def get(self, request, owner, repo, token_auth):
"""Return if a repository have a pull request template or not"""
<|body_0|>
def post(self, request, owner, repo, token_auth):
"""Post pull request template object"""
<|body_1|>
def... | stack_v2_sparse_classes_36k_train_005215 | 4,065 | permissive | [
{
"docstring": "Return if a repository have a pull request template or not",
"name": "get",
"signature": "def get(self, request, owner, repo, token_auth)"
},
{
"docstring": "Post pull request template object",
"name": "post",
"signature": "def post(self, request, owner, repo, token_auth)... | 3 | stack_v2_sparse_classes_30k_train_017465 | Implement the Python class `PullRequestTemplateView` described below.
Class description:
Implement the PullRequestTemplateView class.
Method signatures and docstrings:
- def get(self, request, owner, repo, token_auth): Return if a repository have a pull request template or not
- def post(self, request, owner, repo, t... | Implement the Python class `PullRequestTemplateView` described below.
Class description:
Implement the PullRequestTemplateView class.
Method signatures and docstrings:
- def get(self, request, owner, repo, token_auth): Return if a repository have a pull request template or not
- def post(self, request, owner, repo, t... | 3f031eac9559a10fdcf70a88ee4c548cf93e4ac2 | <|skeleton|>
class PullRequestTemplateView:
def get(self, request, owner, repo, token_auth):
"""Return if a repository have a pull request template or not"""
<|body_0|>
def post(self, request, owner, repo, token_auth):
"""Post pull request template object"""
<|body_1|>
def... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PullRequestTemplateView:
def get(self, request, owner, repo, token_auth):
"""Return if a repository have a pull request template or not"""
pull_request_template = PullRequestTemplate.objects.get(owner=owner, repo=repo)
serializer = PullRequestTemplateSerializer(pull_request_template)
... | the_stack_v2_python_sparse | hubcare/metrics/community_metrics/pull_request_template/views.py | fga-eps-mds/2019.1-hubcare-api | train | 7 | |
84f059d500170167ac27f458fc760ef41f9ee5c0 | [
"self.ignore_3D = ignore_3D\nself.calc: Optional[Callable] = None\nself.descriptors: Optional[List] = None",
"if 'mol' in kwargs:\n datapoint = kwargs.get('mol')\n raise DeprecationWarning('Mol is being phased out as a parameter, please pass \"datapoint\" instead.')\nif self.calc is None:\n try:\n ... | <|body_start_0|>
self.ignore_3D = ignore_3D
self.calc: Optional[Callable] = None
self.descriptors: Optional[List] = None
<|end_body_0|>
<|body_start_1|>
if 'mol' in kwargs:
datapoint = kwargs.get('mol')
raise DeprecationWarning('Mol is being phased out as a param... | Mordred descriptors. This class computes a list of chemical descriptors using Mordred. Please see the details about all descriptors from [1]_, [2]_. Attributes ---------- descriptors: List[str] List of Mordred descriptor names used in this class. References ---------- .. [1] Moriwaki, Hirotomo, et al. "Mordred: a molec... | MordredDescriptors | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MordredDescriptors:
"""Mordred descriptors. This class computes a list of chemical descriptors using Mordred. Please see the details about all descriptors from [1]_, [2]_. Attributes ---------- descriptors: List[str] List of Mordred descriptor names used in this class. References ---------- .. [1... | stack_v2_sparse_classes_36k_train_005216 | 2,835 | permissive | [
{
"docstring": "Parameters ---------- ignore_3D: bool, optional (default True) Whether to use 3D information or not.",
"name": "__init__",
"signature": "def __init__(self, ignore_3D: bool=True)"
},
{
"docstring": "Calculate Mordred descriptors. Parameters ---------- datapoint: rdkit.Chem.rdchem.... | 2 | stack_v2_sparse_classes_30k_train_020703 | Implement the Python class `MordredDescriptors` described below.
Class description:
Mordred descriptors. This class computes a list of chemical descriptors using Mordred. Please see the details about all descriptors from [1]_, [2]_. Attributes ---------- descriptors: List[str] List of Mordred descriptor names used in ... | Implement the Python class `MordredDescriptors` described below.
Class description:
Mordred descriptors. This class computes a list of chemical descriptors using Mordred. Please see the details about all descriptors from [1]_, [2]_. Attributes ---------- descriptors: List[str] List of Mordred descriptor names used in ... | ee6e67ebcf7bf04259cf13aff6388e2b791fea3d | <|skeleton|>
class MordredDescriptors:
"""Mordred descriptors. This class computes a list of chemical descriptors using Mordred. Please see the details about all descriptors from [1]_, [2]_. Attributes ---------- descriptors: List[str] List of Mordred descriptor names used in this class. References ---------- .. [1... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MordredDescriptors:
"""Mordred descriptors. This class computes a list of chemical descriptors using Mordred. Please see the details about all descriptors from [1]_, [2]_. Attributes ---------- descriptors: List[str] List of Mordred descriptor names used in this class. References ---------- .. [1] Moriwaki, H... | the_stack_v2_python_sparse | deepchem/feat/molecule_featurizers/mordred_descriptors.py | deepchem/deepchem | train | 4,876 |
ac7aad9c932a78cfb7b2fc409e661f20564106c7 | [
"squares = [i ** 2 for i in range(1, int(n ** 0.5) + 1)]\ndp = [float('inf') for _ in range(n + 1)]\ndp[0] = 0\nfor i in range(1, n + 1):\n for square in squares:\n if square > i:\n break\n dp[i] = min(dp[i], dp[i - square] + 1)\nreturn dp[n]",
"from collections import deque\nqueue, de... | <|body_start_0|>
squares = [i ** 2 for i in range(1, int(n ** 0.5) + 1)]
dp = [float('inf') for _ in range(n + 1)]
dp[0] = 0
for i in range(1, n + 1):
for square in squares:
if square > i:
break
dp[i] = min(dp[i], dp[i - squ... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def numSquares(self, n: int) -> int:
"""dp"""
<|body_0|>
def numSquares_1(self, n: int) -> int:
"""BFS"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
squares = [i ** 2 for i in range(1, int(n ** 0.5) + 1)]
dp = [float('inf') for _... | stack_v2_sparse_classes_36k_train_005217 | 1,233 | no_license | [
{
"docstring": "dp",
"name": "numSquares",
"signature": "def numSquares(self, n: int) -> int"
},
{
"docstring": "BFS",
"name": "numSquares_1",
"signature": "def numSquares_1(self, n: int) -> int"
}
] | 2 | stack_v2_sparse_classes_30k_train_014780 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numSquares(self, n: int) -> int: dp
- def numSquares_1(self, n: int) -> int: BFS | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numSquares(self, n: int) -> int: dp
- def numSquares_1(self, n: int) -> int: BFS
<|skeleton|>
class Solution:
def numSquares(self, n: int) -> int:
"""dp"""
... | 3508e1ce089131b19603c3206aab4cf43023bb19 | <|skeleton|>
class Solution:
def numSquares(self, n: int) -> int:
"""dp"""
<|body_0|>
def numSquares_1(self, n: int) -> int:
"""BFS"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def numSquares(self, n: int) -> int:
"""dp"""
squares = [i ** 2 for i in range(1, int(n ** 0.5) + 1)]
dp = [float('inf') for _ in range(n + 1)]
dp[0] = 0
for i in range(1, n + 1):
for square in squares:
if square > i:
... | the_stack_v2_python_sparse | algorithm/leetcode/bfs/11-完全平方数.py | lxconfig/UbuntuCode_bak | train | 0 | |
936d56e95df0eab69456189fd3c8ecc9f181c1d3 | [
"for subkey in profile_list_key.GetSubkeys():\n profile_image_path = self._GetValueFromKey(subkey, 'ProfileImagePath')\n yield UserProfile(subkey.name, profile_image_path)",
"profile_list_key = registry.GetKeyByPath(self._PROFILE_LIST_KEY_PATH)\nif profile_list_key:\n yield from self._CollectUserProfiles... | <|body_start_0|>
for subkey in profile_list_key.GetSubkeys():
profile_image_path = self._GetValueFromKey(subkey, 'ProfileImagePath')
yield UserProfile(subkey.name, profile_image_path)
<|end_body_0|>
<|body_start_1|>
profile_list_key = registry.GetKeyByPath(self._PROFILE_LIST_KEY... | Windows user profiles collector. | UserProfilesCollector | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserProfilesCollector:
"""Windows user profiles collector."""
def _CollectUserProfiles(self, profile_list_key):
"""Collects user profiles. Args: profile_list_key (dfwinreg.WinRegistryKey): profile list Windows Registry. Yields: UserProfile: an user profile."""
<|body_0|>
... | stack_v2_sparse_classes_36k_train_005218 | 1,644 | permissive | [
{
"docstring": "Collects user profiles. Args: profile_list_key (dfwinreg.WinRegistryKey): profile list Windows Registry. Yields: UserProfile: an user profile.",
"name": "_CollectUserProfiles",
"signature": "def _CollectUserProfiles(self, profile_list_key)"
},
{
"docstring": "Collects user profil... | 2 | stack_v2_sparse_classes_30k_train_020264 | Implement the Python class `UserProfilesCollector` described below.
Class description:
Windows user profiles collector.
Method signatures and docstrings:
- def _CollectUserProfiles(self, profile_list_key): Collects user profiles. Args: profile_list_key (dfwinreg.WinRegistryKey): profile list Windows Registry. Yields:... | Implement the Python class `UserProfilesCollector` described below.
Class description:
Windows user profiles collector.
Method signatures and docstrings:
- def _CollectUserProfiles(self, profile_list_key): Collects user profiles. Args: profile_list_key (dfwinreg.WinRegistryKey): profile list Windows Registry. Yields:... | d149aff1b8ff97e1cc8d7416fc583b964bad4ccd | <|skeleton|>
class UserProfilesCollector:
"""Windows user profiles collector."""
def _CollectUserProfiles(self, profile_list_key):
"""Collects user profiles. Args: profile_list_key (dfwinreg.WinRegistryKey): profile list Windows Registry. Yields: UserProfile: an user profile."""
<|body_0|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UserProfilesCollector:
"""Windows user profiles collector."""
def _CollectUserProfiles(self, profile_list_key):
"""Collects user profiles. Args: profile_list_key (dfwinreg.WinRegistryKey): profile list Windows Registry. Yields: UserProfile: an user profile."""
for subkey in profile_list_k... | the_stack_v2_python_sparse | winregrc/profiles.py | libyal/winreg-kb | train | 129 |
c022703d7b19785d29e2a54637e475befb10906e | [
"super(SMPLXLayer, self).__init__(*args, **kwargs)\nself.keypoint_src = keypoint_src\nself.keypoint_dst = keypoint_dst\nself.keypoint_approximate = keypoint_approximate\nif joints_regressor is not None:\n joints_regressor = torch.tensor(np.load(joints_regressor), dtype=torch.float)\n self.register_buffer('joi... | <|body_start_0|>
super(SMPLXLayer, self).__init__(*args, **kwargs)
self.keypoint_src = keypoint_src
self.keypoint_dst = keypoint_dst
self.keypoint_approximate = keypoint_approximate
if joints_regressor is not None:
joints_regressor = torch.tensor(np.load(joints_regres... | Extension of the official SMPL-X implementation. | SMPLXLayer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SMPLXLayer:
"""Extension of the official SMPL-X implementation."""
def __init__(self, *args, keypoint_src: str='smplx', keypoint_dst: str='human_data', keypoint_approximate: bool=False, joints_regressor: str=None, extra_joints_regressor: str=None, **kwargs):
"""Args: *args: extra arg... | stack_v2_sparse_classes_36k_train_005219 | 27,367 | permissive | [
{
"docstring": "Args: *args: extra arguments for SMPLX initialization. keypoint_src: source convention of keypoints. This convention is used for keypoints obtained from joint regressors. Keypoints then undergo conversion into keypoint_dst convention. keypoint_dst: destination convention of keypoints. This conve... | 2 | stack_v2_sparse_classes_30k_train_014338 | Implement the Python class `SMPLXLayer` described below.
Class description:
Extension of the official SMPL-X implementation.
Method signatures and docstrings:
- def __init__(self, *args, keypoint_src: str='smplx', keypoint_dst: str='human_data', keypoint_approximate: bool=False, joints_regressor: str=None, extra_join... | Implement the Python class `SMPLXLayer` described below.
Class description:
Extension of the official SMPL-X implementation.
Method signatures and docstrings:
- def __init__(self, *args, keypoint_src: str='smplx', keypoint_dst: str='human_data', keypoint_approximate: bool=False, joints_regressor: str=None, extra_join... | 9431addec32f7fbeffa1786927a854c0ab79d9ea | <|skeleton|>
class SMPLXLayer:
"""Extension of the official SMPL-X implementation."""
def __init__(self, *args, keypoint_src: str='smplx', keypoint_dst: str='human_data', keypoint_approximate: bool=False, joints_regressor: str=None, extra_joints_regressor: str=None, **kwargs):
"""Args: *args: extra arg... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SMPLXLayer:
"""Extension of the official SMPL-X implementation."""
def __init__(self, *args, keypoint_src: str='smplx', keypoint_dst: str='human_data', keypoint_approximate: bool=False, joints_regressor: str=None, extra_joints_regressor: str=None, **kwargs):
"""Args: *args: extra arguments for SM... | the_stack_v2_python_sparse | mmhuman3d/models/body_models/smplx.py | open-mmlab/mmhuman3d | train | 966 |
8ef19b4e017591febff6a92fa907b75b0377db43 | [
"l = len(nums)\nif l <= 1:\n return 0\na = str(max(nums))\nk = len(a)\n\ndef radixSort(A, k):\n for k in range(k):\n s = [[] for i in range(10)]\n for i in A:\n s[i // 10 ** k % 10].append(i)\n A = [a for b in s for a in b]\n print(A)\n return A\nnums = radixSort(nums, k)... | <|body_start_0|>
l = len(nums)
if l <= 1:
return 0
a = str(max(nums))
k = len(a)
def radixSort(A, k):
for k in range(k):
s = [[] for i in range(10)]
for i in A:
s[i // 10 ** k % 10].append(i)
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maximumGap(self, nums):
""":type nums: List[int] :rtype: int 66ms"""
<|body_0|>
def maximumGap_1(self, nums):
""":type nums: List[int] :rtype: int 49ms"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
l = len(nums)
if l <= 1:
... | stack_v2_sparse_classes_36k_train_005220 | 1,855 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: int 66ms",
"name": "maximumGap",
"signature": "def maximumGap(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: int 49ms",
"name": "maximumGap_1",
"signature": "def maximumGap_1(self, nums)"
}
] | 2 | stack_v2_sparse_classes_30k_train_001709 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maximumGap(self, nums): :type nums: List[int] :rtype: int 66ms
- def maximumGap_1(self, nums): :type nums: List[int] :rtype: int 49ms | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maximumGap(self, nums): :type nums: List[int] :rtype: int 66ms
- def maximumGap_1(self, nums): :type nums: List[int] :rtype: int 49ms
<|skeleton|>
class Solution:
def m... | 679a2b246b8b6bb7fc55ed1c8096d3047d6d4461 | <|skeleton|>
class Solution:
def maximumGap(self, nums):
""":type nums: List[int] :rtype: int 66ms"""
<|body_0|>
def maximumGap_1(self, nums):
""":type nums: List[int] :rtype: int 49ms"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def maximumGap(self, nums):
""":type nums: List[int] :rtype: int 66ms"""
l = len(nums)
if l <= 1:
return 0
a = str(max(nums))
k = len(a)
def radixSort(A, k):
for k in range(k):
s = [[] for i in range(10)]
... | the_stack_v2_python_sparse | MaximumGap_HARD_164.py | 953250587/leetcode-python | train | 2 | |
04c9db5252c3ebd00174b92e2603904182e33a68 | [
"if user_id == 'me':\n user = auth.get_current_user()\n if not user:\n return self.error('not authenticated', 401)\nelse:\n raise NotImplementedError\nuser.options = list(ItemOption.query.filter(ItemOption.item_id == user.id))\nreturn self.respond_with_schema(user_schema, user)",
"if user_id == 'm... | <|body_start_0|>
if user_id == 'me':
user = auth.get_current_user()
if not user:
return self.error('not authenticated', 401)
else:
raise NotImplementedError
user.options = list(ItemOption.query.filter(ItemOption.item_id == user.id))
ret... | UserDetailsResource | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserDetailsResource:
def get(self, user_id: str):
"""Return information on a user."""
<|body_0|>
def put(self, user_id: str):
"""Return information on a user."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if user_id == 'me':
user = aut... | stack_v2_sparse_classes_36k_train_005221 | 1,582 | permissive | [
{
"docstring": "Return information on a user.",
"name": "get",
"signature": "def get(self, user_id: str)"
},
{
"docstring": "Return information on a user.",
"name": "put",
"signature": "def put(self, user_id: str)"
}
] | 2 | stack_v2_sparse_classes_30k_train_019900 | Implement the Python class `UserDetailsResource` described below.
Class description:
Implement the UserDetailsResource class.
Method signatures and docstrings:
- def get(self, user_id: str): Return information on a user.
- def put(self, user_id: str): Return information on a user. | Implement the Python class `UserDetailsResource` described below.
Class description:
Implement the UserDetailsResource class.
Method signatures and docstrings:
- def get(self, user_id: str): Return information on a user.
- def put(self, user_id: str): Return information on a user.
<|skeleton|>
class UserDetailsResou... | 6d4a490c19ebe406b551641a022ca08f26c21fcb | <|skeleton|>
class UserDetailsResource:
def get(self, user_id: str):
"""Return information on a user."""
<|body_0|>
def put(self, user_id: str):
"""Return information on a user."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UserDetailsResource:
def get(self, user_id: str):
"""Return information on a user."""
if user_id == 'me':
user = auth.get_current_user()
if not user:
return self.error('not authenticated', 401)
else:
raise NotImplementedError
... | the_stack_v2_python_sparse | zeus/api/resources/user_details.py | getsentry/zeus | train | 222 | |
a5df3d3006bec9748c25155da5dff653994aab2a | [
"self.ctrl_c = '\\x03'\nself.log_width = 100\nself.change_line = '\\n\\n'\nself.setVerbosity(verbosity)",
"if level == 'high':\n self.print_to_stdout = True\n self.show_login = True\nelif level == 'medium':\n self.print_to_stdout = False\n self.show_login = True\nelif level == 'low':\n self.print_t... | <|body_start_0|>
self.ctrl_c = '\x03'
self.log_width = 100
self.change_line = '\n\n'
self.setVerbosity(verbosity)
<|end_body_0|>
<|body_start_1|>
if level == 'high':
self.print_to_stdout = True
self.show_login = True
elif level == 'medium':
... | Class Name: GlobalUI_settings Purpose: Stores and configures global user interface settings. Public Attributes: ctrl_c - string constant for the CTRL+C character log_width - width of the displayed log; default is 100 characters. change_line - change line character string of the displayed log print_to_stdout - whether t... | GlobalUI_settings | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GlobalUI_settings:
"""Class Name: GlobalUI_settings Purpose: Stores and configures global user interface settings. Public Attributes: ctrl_c - string constant for the CTRL+C character log_width - width of the displayed log; default is 100 characters. change_line - change line character string of ... | stack_v2_sparse_classes_36k_train_005222 | 4,224 | no_license | [
{
"docstring": "Constructor for GlobalUI_settings Input: verbosity - the initial verbosity level; default is 'medium'.",
"name": "__init__",
"signature": "def __init__(self, verbosity='medium')"
},
{
"docstring": "Function Name: setVerbosity Purpose: Configures the login and display output verbo... | 2 | stack_v2_sparse_classes_30k_train_011556 | Implement the Python class `GlobalUI_settings` described below.
Class description:
Class Name: GlobalUI_settings Purpose: Stores and configures global user interface settings. Public Attributes: ctrl_c - string constant for the CTRL+C character log_width - width of the displayed log; default is 100 characters. change_... | Implement the Python class `GlobalUI_settings` described below.
Class description:
Class Name: GlobalUI_settings Purpose: Stores and configures global user interface settings. Public Attributes: ctrl_c - string constant for the CTRL+C character log_width - width of the displayed log; default is 100 characters. change_... | da41950478db2c7f7dc7dfbe8bd3b5ef19682431 | <|skeleton|>
class GlobalUI_settings:
"""Class Name: GlobalUI_settings Purpose: Stores and configures global user interface settings. Public Attributes: ctrl_c - string constant for the CTRL+C character log_width - width of the displayed log; default is 100 characters. change_line - change line character string of ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GlobalUI_settings:
"""Class Name: GlobalUI_settings Purpose: Stores and configures global user interface settings. Public Attributes: ctrl_c - string constant for the CTRL+C character log_width - width of the displayed log; default is 100 characters. change_line - change line character string of the displayed... | the_stack_v2_python_sparse | lib/settings.py | vhulagov/Python_Flask | train | 0 |
bd0f1abfcf830758fb58ba5e12d93d44f79d7085 | [
"super(MultiHeadedAttention, self).__init__()\nassert d_model % h == 0\nself.d_k = d_model // h\nself.h = h\nself.linears = clones(nn.Linear(d_model, d_model), 4)\nself.attn = None\nself.dropout = nn.Dropout(p=dropout)",
"if mask is not None:\n mask = mask.unsqueeze(1)\nnbatches = query.size(0)\nquery, key, va... | <|body_start_0|>
super(MultiHeadedAttention, self).__init__()
assert d_model % h == 0
self.d_k = d_model // h
self.h = h
self.linears = clones(nn.Linear(d_model, d_model), 4)
self.attn = None
self.dropout = nn.Dropout(p=dropout)
<|end_body_0|>
<|body_start_1|>
... | Multi-headed attention block. | MultiHeadedAttention | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MultiHeadedAttention:
"""Multi-headed attention block."""
def __init__(self, h, d_model, dropout=0.1):
""":param h: number of attention heads :param d_model: input/output dimensionality :param dropout: dropout probability"""
<|body_0|>
def forward(self, query, key, value... | stack_v2_sparse_classes_36k_train_005223 | 21,238 | no_license | [
{
"docstring": ":param h: number of attention heads :param d_model: input/output dimensionality :param dropout: dropout probability",
"name": "__init__",
"signature": "def __init__(self, h, d_model, dropout=0.1)"
},
{
"docstring": "Forward pass through the multi-head attention block. :param quer... | 2 | stack_v2_sparse_classes_30k_train_003113 | Implement the Python class `MultiHeadedAttention` described below.
Class description:
Multi-headed attention block.
Method signatures and docstrings:
- def __init__(self, h, d_model, dropout=0.1): :param h: number of attention heads :param d_model: input/output dimensionality :param dropout: dropout probability
- def... | Implement the Python class `MultiHeadedAttention` described below.
Class description:
Multi-headed attention block.
Method signatures and docstrings:
- def __init__(self, h, d_model, dropout=0.1): :param h: number of attention heads :param d_model: input/output dimensionality :param dropout: dropout probability
- def... | 7e55a422588c1d1e00f35a3d3a3ff896cce59e18 | <|skeleton|>
class MultiHeadedAttention:
"""Multi-headed attention block."""
def __init__(self, h, d_model, dropout=0.1):
""":param h: number of attention heads :param d_model: input/output dimensionality :param dropout: dropout probability"""
<|body_0|>
def forward(self, query, key, value... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MultiHeadedAttention:
"""Multi-headed attention block."""
def __init__(self, h, d_model, dropout=0.1):
""":param h: number of attention heads :param d_model: input/output dimensionality :param dropout: dropout probability"""
super(MultiHeadedAttention, self).__init__()
assert d_mo... | the_stack_v2_python_sparse | generated/test_allegro_allRank.py | jansel/pytorch-jit-paritybench | train | 35 |
1bebf5d0ceac2ebb9379f272ee52d5b9dac018d6 | [
"key = LibraryLocatorV2.from_string(lib_key_str)\napi.require_permission_for_library_key(key, request.user, permissions.CAN_EDIT_THIS_CONTENT_LIBRARY_TEAM)\nserializer = ContentLibraryPermissionLevelSerializer(data=request.data)\nserializer.is_valid(raise_exception=True)\ngroup = get_object_or_404(Group, name=group... | <|body_start_0|>
key = LibraryLocatorV2.from_string(lib_key_str)
api.require_permission_for_library_key(key, request.user, permissions.CAN_EDIT_THIS_CONTENT_LIBRARY_TEAM)
serializer = ContentLibraryPermissionLevelSerializer(data=request.data)
serializer.is_valid(raise_exception=True)
... | View to add/remove/edit a group's permissions for a content library. | LibraryTeamGroupView | [
"AGPL-3.0-only",
"AGPL-3.0-or-later",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LibraryTeamGroupView:
"""View to add/remove/edit a group's permissions for a content library."""
def put(self, request, lib_key_str, group_name):
"""Add a group to this content library, with permissions specified in the request body."""
<|body_0|>
def delete(self, reques... | stack_v2_sparse_classes_36k_train_005224 | 42,120 | permissive | [
{
"docstring": "Add a group to this content library, with permissions specified in the request body.",
"name": "put",
"signature": "def put(self, request, lib_key_str, group_name)"
},
{
"docstring": "Remove the specified user's permission to access or edit this content library.",
"name": "de... | 2 | null | Implement the Python class `LibraryTeamGroupView` described below.
Class description:
View to add/remove/edit a group's permissions for a content library.
Method signatures and docstrings:
- def put(self, request, lib_key_str, group_name): Add a group to this content library, with permissions specified in the request... | Implement the Python class `LibraryTeamGroupView` described below.
Class description:
View to add/remove/edit a group's permissions for a content library.
Method signatures and docstrings:
- def put(self, request, lib_key_str, group_name): Add a group to this content library, with permissions specified in the request... | 5809eaca7079a15ee56b0b7fcfea425337046c97 | <|skeleton|>
class LibraryTeamGroupView:
"""View to add/remove/edit a group's permissions for a content library."""
def put(self, request, lib_key_str, group_name):
"""Add a group to this content library, with permissions specified in the request body."""
<|body_0|>
def delete(self, reques... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LibraryTeamGroupView:
"""View to add/remove/edit a group's permissions for a content library."""
def put(self, request, lib_key_str, group_name):
"""Add a group to this content library, with permissions specified in the request body."""
key = LibraryLocatorV2.from_string(lib_key_str)
... | the_stack_v2_python_sparse | Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/openedx/core/djangoapps/content_libraries/views.py | luque/better-ways-of-thinking-about-software | train | 3 |
502aea8ca860ccb74abdd03a2ba89e71fedc8fb2 | [
"self.loci = loci\nPmf.__init__(self)\nfor hypo in hypos:\n self.Set(hypo, 1)\n self.Normalize()",
"for hypo in self.Values():\n like = self.Likelihood(data, hypo)\n self.Mult(hypo, like)\nself.Normalize()",
"mix = self.loci[hypo]\nlike = mix[data]\nreturn like"
] | <|body_start_0|>
self.loci = loci
Pmf.__init__(self)
for hypo in hypos:
self.Set(hypo, 1)
self.Normalize()
<|end_body_0|>
<|body_start_1|>
for hypo in self.Values():
like = self.Likelihood(data, hypo)
self.Mult(hypo, like)
self.Nor... | A map from string bowl ID to probablity. | _update | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _update:
"""A map from string bowl ID to probablity."""
def __init__(self, hypos, loci):
"""Initialize self. hypos: sequence of string bowl IDs"""
<|body_0|>
def Update(self, data):
"""Updates the PMF with new data. data: string cookie type"""
<|body_1|>
... | stack_v2_sparse_classes_36k_train_005225 | 2,961 | permissive | [
{
"docstring": "Initialize self. hypos: sequence of string bowl IDs",
"name": "__init__",
"signature": "def __init__(self, hypos, loci)"
},
{
"docstring": "Updates the PMF with new data. data: string cookie type",
"name": "Update",
"signature": "def Update(self, data)"
},
{
"docs... | 3 | null | Implement the Python class `_update` described below.
Class description:
A map from string bowl ID to probablity.
Method signatures and docstrings:
- def __init__(self, hypos, loci): Initialize self. hypos: sequence of string bowl IDs
- def Update(self, data): Updates the PMF with new data. data: string cookie type
-... | Implement the Python class `_update` described below.
Class description:
A map from string bowl ID to probablity.
Method signatures and docstrings:
- def __init__(self, hypos, loci): Initialize self. hypos: sequence of string bowl IDs
- def Update(self, data): Updates the PMF with new data. data: string cookie type
-... | cc362b6ff2616142272bff4f1c7d66551aaa7739 | <|skeleton|>
class _update:
"""A map from string bowl ID to probablity."""
def __init__(self, hypos, loci):
"""Initialize self. hypos: sequence of string bowl IDs"""
<|body_0|>
def Update(self, data):
"""Updates the PMF with new data. data: string cookie type"""
<|body_1|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class _update:
"""A map from string bowl ID to probablity."""
def __init__(self, hypos, loci):
"""Initialize self. hypos: sequence of string bowl IDs"""
self.loci = loci
Pmf.__init__(self)
for hypo in hypos:
self.Set(hypo, 1)
self.Normalize()
def Upd... | the_stack_v2_python_sparse | seqcluster/libs/bayes.py | lpantano/seqcluster | train | 34 |
e197262be632e8cb57ca282ed8ba2ae7b7513286 | [
"form = super().create_form(obj=obj)\nnew_uuid = str(uuid.uuid4())\nform.uuid.data = new_uuid\nreturn form",
"if is_created:\n model.password = generate_password_hash(form.password.data).decode('utf8')\nelif form.password.data:\n model.password = generate_password_hash(form.password.data).decode('utf8')\nif... | <|body_start_0|>
form = super().create_form(obj=obj)
new_uuid = str(uuid.uuid4())
form.uuid.data = new_uuid
return form
<|end_body_0|>
<|body_start_1|>
if is_created:
model.password = generate_password_hash(form.password.data).decode('utf8')
elif form.passwor... | Flask-admin custom view Overrides ModelView for User model repr | UserModelView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserModelView:
"""Flask-admin custom view Overrides ModelView for User model repr"""
def create_form(self, obj=None):
"""Method overrides creating form for User model Adding custom uuid to uuid data in the entered field"""
<|body_0|>
def on_model_change(self, form, model... | stack_v2_sparse_classes_36k_train_005226 | 2,692 | no_license | [
{
"docstring": "Method overrides creating form for User model Adding custom uuid to uuid data in the entered field",
"name": "create_form",
"signature": "def create_form(self, obj=None)"
},
{
"docstring": "Method overrides updating form for User model Takes and set custom password and uuid Nothi... | 2 | stack_v2_sparse_classes_30k_train_007618 | Implement the Python class `UserModelView` described below.
Class description:
Flask-admin custom view Overrides ModelView for User model repr
Method signatures and docstrings:
- def create_form(self, obj=None): Method overrides creating form for User model Adding custom uuid to uuid data in the entered field
- def o... | Implement the Python class `UserModelView` described below.
Class description:
Flask-admin custom view Overrides ModelView for User model repr
Method signatures and docstrings:
- def create_form(self, obj=None): Method overrides creating form for User model Adding custom uuid to uuid data in the entered field
- def o... | a09780621357957e5575aba36391bef161b5137d | <|skeleton|>
class UserModelView:
"""Flask-admin custom view Overrides ModelView for User model repr"""
def create_form(self, obj=None):
"""Method overrides creating form for User model Adding custom uuid to uuid data in the entered field"""
<|body_0|>
def on_model_change(self, form, model... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UserModelView:
"""Flask-admin custom view Overrides ModelView for User model repr"""
def create_form(self, obj=None):
"""Method overrides creating form for User model Adding custom uuid to uuid data in the entered field"""
form = super().create_form(obj=obj)
new_uuid = str(uuid.uu... | the_stack_v2_python_sparse | src/database/admin_view.py | meg4ik/epam_final_project | train | 0 |
59a6aad641515f42b8350b73d9551abc80647b6d | [
"def dfs(root, value):\n if root:\n value = dfs(root.left, value)\n value.append(root.val)\n value = dfs(root.right, value)\n return value\nvalue = dfs(root, [])\nhead = TreeNode(0)\ncopy_head = head\nfor i in value:\n root = TreeNode(i)\n head.right = root\n head = head.right\nr... | <|body_start_0|>
def dfs(root, value):
if root:
value = dfs(root.left, value)
value.append(root.val)
value = dfs(root.right, value)
return value
value = dfs(root, [])
head = TreeNode(0)
copy_head = head
for i... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def increasingBST(self, root):
""":type root: TreeNode :rtype: TreeNode 100 ms"""
<|body_0|>
def increasingBST_1(self, root, tail=None):
"""112ms 增加一个参数 :param root: :param tail: :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
def... | stack_v2_sparse_classes_36k_train_005227 | 1,827 | no_license | [
{
"docstring": ":type root: TreeNode :rtype: TreeNode 100 ms",
"name": "increasingBST",
"signature": "def increasingBST(self, root)"
},
{
"docstring": "112ms 增加一个参数 :param root: :param tail: :return:",
"name": "increasingBST_1",
"signature": "def increasingBST_1(self, root, tail=None)"
... | 2 | stack_v2_sparse_classes_30k_test_000185 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def increasingBST(self, root): :type root: TreeNode :rtype: TreeNode 100 ms
- def increasingBST_1(self, root, tail=None): 112ms 增加一个参数 :param root: :param tail: :return: | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def increasingBST(self, root): :type root: TreeNode :rtype: TreeNode 100 ms
- def increasingBST_1(self, root, tail=None): 112ms 增加一个参数 :param root: :param tail: :return:
<|skele... | 679a2b246b8b6bb7fc55ed1c8096d3047d6d4461 | <|skeleton|>
class Solution:
def increasingBST(self, root):
""":type root: TreeNode :rtype: TreeNode 100 ms"""
<|body_0|>
def increasingBST_1(self, root, tail=None):
"""112ms 增加一个参数 :param root: :param tail: :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def increasingBST(self, root):
""":type root: TreeNode :rtype: TreeNode 100 ms"""
def dfs(root, value):
if root:
value = dfs(root.left, value)
value.append(root.val)
value = dfs(root.right, value)
return value
... | the_stack_v2_python_sparse | IncreasingOrderSearchTree_897.py | 953250587/leetcode-python | train | 2 | |
e64d0d4e9e87e5d2df9a2fa7566610d35c0ea8a9 | [
"password = attrs[source]\nif len(password) < PASSWORD_MIN_LENGTH:\n raise serializers.ValidationError(code['E_INVALID_PASSWORD'])\nreturn attrs",
"password_confirmation = attrs[source]\npassword = attrs['password']\nif password_confirmation != password:\n raise serializers.ValidationError(code['E_PASSWORD_... | <|body_start_0|>
password = attrs[source]
if len(password) < PASSWORD_MIN_LENGTH:
raise serializers.ValidationError(code['E_INVALID_PASSWORD'])
return attrs
<|end_body_0|>
<|body_start_1|>
password_confirmation = attrs[source]
password = attrs['password']
if ... | ResetPasswordKeySerializer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ResetPasswordKeySerializer:
def validate_password(attrs, source):
"""Check valid password"""
<|body_0|>
def validate_password_confirmation(attrs, source):
"""Password2 check"""
<|body_1|>
def restore_object(self, attrs, instance):
"""Change passw... | stack_v2_sparse_classes_36k_train_005228 | 4,776 | no_license | [
{
"docstring": "Check valid password",
"name": "validate_password",
"signature": "def validate_password(attrs, source)"
},
{
"docstring": "Password2 check",
"name": "validate_password_confirmation",
"signature": "def validate_password_confirmation(attrs, source)"
},
{
"docstring"... | 4 | null | Implement the Python class `ResetPasswordKeySerializer` described below.
Class description:
Implement the ResetPasswordKeySerializer class.
Method signatures and docstrings:
- def validate_password(attrs, source): Check valid password
- def validate_password_confirmation(attrs, source): Password2 check
- def restore_... | Implement the Python class `ResetPasswordKeySerializer` described below.
Class description:
Implement the ResetPasswordKeySerializer class.
Method signatures and docstrings:
- def validate_password(attrs, source): Check valid password
- def validate_password_confirmation(attrs, source): Password2 check
- def restore_... | 28d5f3fd0b4deb6909aeda97f17f2994eaffd48a | <|skeleton|>
class ResetPasswordKeySerializer:
def validate_password(attrs, source):
"""Check valid password"""
<|body_0|>
def validate_password_confirmation(attrs, source):
"""Password2 check"""
<|body_1|>
def restore_object(self, attrs, instance):
"""Change passw... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ResetPasswordKeySerializer:
def validate_password(attrs, source):
"""Check valid password"""
password = attrs[source]
if len(password) < PASSWORD_MIN_LENGTH:
raise serializers.ValidationError(code['E_INVALID_PASSWORD'])
return attrs
def validate_password_confir... | the_stack_v2_python_sparse | api/authMana/serializers.py | minhdo6487/api-proto | train | 0 | |
89568d32b55f43cc72679794eb9165af6a6ff145 | [
"with self.OutputCapturer() as output:\n try:\n ups.main(['--help'])\n except exceptions.SystemExit as e:\n self.assertEquals(e.args[0], 0)\nstdout = output.GetStdout()\nself.assertTrue(stdout.startswith('Usage: '))",
"with self.OutputCapturer():\n try:\n ups.main([])\n except exc... | <|body_start_0|>
with self.OutputCapturer() as output:
try:
ups.main(['--help'])
except exceptions.SystemExit as e:
self.assertEquals(e.args[0], 0)
stdout = output.GetStdout()
self.assertTrue(stdout.startswith('Usage: '))
<|end_body_0|>
<|... | Test argument handling at the main method level. | MainTest | [
"LGPL-2.0-or-later",
"GPL-1.0-or-later",
"MIT",
"Apache-2.0",
"BSD-3-Clause",
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MainTest:
"""Test argument handling at the main method level."""
def testHelp(self):
"""Test that --help is functioning"""
<|body_0|>
def testMissingCSV(self):
"""Test that running without a csv file argument exits with an error."""
<|body_1|>
def te... | stack_v2_sparse_classes_36k_train_005229 | 15,158 | permissive | [
{
"docstring": "Test that --help is functioning",
"name": "testHelp",
"signature": "def testHelp(self)"
},
{
"docstring": "Test that running without a csv file argument exits with an error.",
"name": "testMissingCSV",
"signature": "def testMissingCSV(self)"
},
{
"docstring": "Ver... | 6 | null | Implement the Python class `MainTest` described below.
Class description:
Test argument handling at the main method level.
Method signatures and docstrings:
- def testHelp(self): Test that --help is functioning
- def testMissingCSV(self): Test that running without a csv file argument exits with an error.
- def testPr... | Implement the Python class `MainTest` described below.
Class description:
Test argument handling at the main method level.
Method signatures and docstrings:
- def testHelp(self): Test that --help is functioning
- def testMissingCSV(self): Test that running without a csv file argument exits with an error.
- def testPr... | e71f21b9b4b9b839f5093301974a45545dad2691 | <|skeleton|>
class MainTest:
"""Test argument handling at the main method level."""
def testHelp(self):
"""Test that --help is functioning"""
<|body_0|>
def testMissingCSV(self):
"""Test that running without a csv file argument exits with an error."""
<|body_1|>
def te... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MainTest:
"""Test argument handling at the main method level."""
def testHelp(self):
"""Test that --help is functioning"""
with self.OutputCapturer() as output:
try:
ups.main(['--help'])
except exceptions.SystemExit as e:
self.assert... | the_stack_v2_python_sparse | third_party/chromite/scripts/upload_package_status_unittest.py | zenoalbisser/chromium | train | 0 |
949ff2e5f05636420f35c8a6af33a435937b1420 | [
"url_name = return_url_name(request.path)\nif not has_permission(request.user.role_id, url_name, request.method):\n return JsonResponse({'error': 'No permission'}, status=403)\nif request.is_ajax:\n update_data = queries.get_model_train_data_by_id(id)\n if not update_data:\n return HttpResponse('404... | <|body_start_0|>
url_name = return_url_name(request.path)
if not has_permission(request.user.role_id, url_name, request.method):
return JsonResponse({'error': 'No permission'}, status=403)
if request.is_ajax:
update_data = queries.get_model_train_data_by_id(id)
... | ModelTrainDataDetail | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ModelTrainDataDetail:
def post(self, request, id):
"""Update ModelTrainData record :param request: :param id: id to update :return: Success message update, otherwise error"""
<|body_0|>
def delete(self, request, id):
"""Delete Model train data record :param request: ... | stack_v2_sparse_classes_36k_train_005230 | 9,663 | no_license | [
{
"docstring": "Update ModelTrainData record :param request: :param id: id to update :return: Success message update, otherwise error",
"name": "post",
"signature": "def post(self, request, id)"
},
{
"docstring": "Delete Model train data record :param request: :param id: id to delete :return: No... | 2 | stack_v2_sparse_classes_30k_train_016771 | Implement the Python class `ModelTrainDataDetail` described below.
Class description:
Implement the ModelTrainDataDetail class.
Method signatures and docstrings:
- def post(self, request, id): Update ModelTrainData record :param request: :param id: id to update :return: Success message update, otherwise error
- def d... | Implement the Python class `ModelTrainDataDetail` described below.
Class description:
Implement the ModelTrainDataDetail class.
Method signatures and docstrings:
- def post(self, request, id): Update ModelTrainData record :param request: :param id: id to update :return: Success message update, otherwise error
- def d... | 2dedee10bded628a0eaecacc4554b421cc6f0ddd | <|skeleton|>
class ModelTrainDataDetail:
def post(self, request, id):
"""Update ModelTrainData record :param request: :param id: id to update :return: Success message update, otherwise error"""
<|body_0|>
def delete(self, request, id):
"""Delete Model train data record :param request: ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ModelTrainDataDetail:
def post(self, request, id):
"""Update ModelTrainData record :param request: :param id: id to update :return: Success message update, otherwise error"""
url_name = return_url_name(request.path)
if not has_permission(request.user.role_id, url_name, request.method):... | the_stack_v2_python_sparse | data_model_manager_app/views/model_train_data_manager_view.py | SonThanhNguyen13/django_data_manager | train | 0 | |
ca68f8d026cd743949c19a3efad8a44e0f8a1f44 | [
"super().__init__(name=name, **kwargs)\nif background_weight < 0 or background_weight > 1:\n raise ValueError(f'The background weight for Dice Score must be within [0, 1], got {background_weight}.')\nself.binary = binary\nself.background_weight = background_weight\nself.smooth_nr = smooth_nr\nself.smooth_dr = sm... | <|body_start_0|>
super().__init__(name=name, **kwargs)
if background_weight < 0 or background_weight > 1:
raise ValueError(f'The background weight for Dice Score must be within [0, 1], got {background_weight}.')
self.binary = binary
self.background_weight = background_weight
... | Define dice score. The formulation is: 0. w_fg + w_bg = 1 1. let y_prod = y_true * y_pred and y_sum = y_true + y_pred 2. num = 2 * (w_fg * y_true * y_pred + w_bg * (1−y_true) * (1−y_pred)) = 2 * ((w_fg+w_bg) * y_prod - w_bg * y_sum + w_bg) = 2 * (y_prod - w_bg * y_sum + w_bg) 3. denom = (w_fg * (y_true + y_pred) + w_bg... | DiceScore | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DiceScore:
"""Define dice score. The formulation is: 0. w_fg + w_bg = 1 1. let y_prod = y_true * y_pred and y_sum = y_true + y_pred 2. num = 2 * (w_fg * y_true * y_pred + w_bg * (1−y_true) * (1−y_pred)) = 2 * ((w_fg+w_bg) * y_prod - w_bg * y_sum + w_bg) = 2 * (y_prod - w_bg * y_sum + w_bg) 3. den... | stack_v2_sparse_classes_36k_train_005231 | 12,718 | permissive | [
{
"docstring": "Init. :param binary: if True, project y_true, y_pred to 0 or 1. :param background_weight: weight for background, where y == 0. :param smooth_nr: small constant added to numerator in case of zero covariance. :param smooth_dr: small constant added to denominator in case of zero variance. :param na... | 3 | null | Implement the Python class `DiceScore` described below.
Class description:
Define dice score. The formulation is: 0. w_fg + w_bg = 1 1. let y_prod = y_true * y_pred and y_sum = y_true + y_pred 2. num = 2 * (w_fg * y_true * y_pred + w_bg * (1−y_true) * (1−y_pred)) = 2 * ((w_fg+w_bg) * y_prod - w_bg * y_sum + w_bg) = 2 ... | Implement the Python class `DiceScore` described below.
Class description:
Define dice score. The formulation is: 0. w_fg + w_bg = 1 1. let y_prod = y_true * y_pred and y_sum = y_true + y_pred 2. num = 2 * (w_fg * y_true * y_pred + w_bg * (1−y_true) * (1−y_pred)) = 2 * ((w_fg+w_bg) * y_prod - w_bg * y_sum + w_bg) = 2 ... | 650a2f1a88ad3c6932be305d6a98a36e26feedc6 | <|skeleton|>
class DiceScore:
"""Define dice score. The formulation is: 0. w_fg + w_bg = 1 1. let y_prod = y_true * y_pred and y_sum = y_true + y_pred 2. num = 2 * (w_fg * y_true * y_pred + w_bg * (1−y_true) * (1−y_pred)) = 2 * ((w_fg+w_bg) * y_prod - w_bg * y_sum + w_bg) = 2 * (y_prod - w_bg * y_sum + w_bg) 3. den... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DiceScore:
"""Define dice score. The formulation is: 0. w_fg + w_bg = 1 1. let y_prod = y_true * y_pred and y_sum = y_true + y_pred 2. num = 2 * (w_fg * y_true * y_pred + w_bg * (1−y_true) * (1−y_pred)) = 2 * ((w_fg+w_bg) * y_prod - w_bg * y_sum + w_bg) = 2 * (y_prod - w_bg * y_sum + w_bg) 3. denom = (w_fg * ... | the_stack_v2_python_sparse | deepreg/loss/label.py | DeepRegNet/DeepReg | train | 509 |
7f12d762e48a081bf652c5fd91c6c953343ed41a | [
"if endWord not in wordList:\n return []\nres = []\ndict = {}\nfor word in wordList:\n if word not in dict.keys():\n dict[word] = 0\nn = len(beginWord)\nminLayer = float('Inf')\nqueue = [(beginWord, 1, [beginWord])]\nwhile queue:\n beginWord = queue[0][0]\n layer = queue[0][1]\n list = queue[0... | <|body_start_0|>
if endWord not in wordList:
return []
res = []
dict = {}
for word in wordList:
if word not in dict.keys():
dict[word] = 0
n = len(beginWord)
minLayer = float('Inf')
queue = [(beginWord, 1, [beginWord])]
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findLadders(self, beginWord, endWord, wordList):
""":type beginWord: str :type endWord: str :type wordList: List[str] :rtype: List[List[str]]"""
<|body_0|>
def ladderLength(self, beginWord, endWord, wordList):
""":type beginWord: str :type endWord: str ... | stack_v2_sparse_classes_36k_train_005232 | 2,989 | no_license | [
{
"docstring": ":type beginWord: str :type endWord: str :type wordList: List[str] :rtype: List[List[str]]",
"name": "findLadders",
"signature": "def findLadders(self, beginWord, endWord, wordList)"
},
{
"docstring": ":type beginWord: str :type endWord: str :type wordList: List[str] :rtype: int",... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findLadders(self, beginWord, endWord, wordList): :type beginWord: str :type endWord: str :type wordList: List[str] :rtype: List[List[str]]
- def ladderLength(self, beginWord,... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findLadders(self, beginWord, endWord, wordList): :type beginWord: str :type endWord: str :type wordList: List[str] :rtype: List[List[str]]
- def ladderLength(self, beginWord,... | 0584b86642dff667f5bf6b7acfbbce86a41a55b6 | <|skeleton|>
class Solution:
def findLadders(self, beginWord, endWord, wordList):
""":type beginWord: str :type endWord: str :type wordList: List[str] :rtype: List[List[str]]"""
<|body_0|>
def ladderLength(self, beginWord, endWord, wordList):
""":type beginWord: str :type endWord: str ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def findLadders(self, beginWord, endWord, wordList):
""":type beginWord: str :type endWord: str :type wordList: List[str] :rtype: List[List[str]]"""
if endWord not in wordList:
return []
res = []
dict = {}
for word in wordList:
if word ... | the_stack_v2_python_sparse | python_solution/121_130/WordLadder.py | CescWang1991/LeetCode-Python | train | 1 | |
9cdd6124162806fe7bad4fe84331f279604903d2 | [
"if which_challenge not in ('singlecoil', 'multicoil'):\n raise ValueError(f'Challenge should either be \"singlecoil\" or \"multicoil\"')\nself.mask_func = mask_func\nself.resolution = resolution\nself.which_challenge = which_challenge\nself.use_seed = use_seed",
"kspace = T.to_tensor(kspace)\nif self.mask_fun... | <|body_start_0|>
if which_challenge not in ('singlecoil', 'multicoil'):
raise ValueError(f'Challenge should either be "singlecoil" or "multicoil"')
self.mask_func = mask_func
self.resolution = resolution
self.which_challenge = which_challenge
self.use_seed = use_seed
... | Data Transformer for training U-Net models. | DataTransform | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DataTransform:
"""Data Transformer for training U-Net models."""
def __init__(self, resolution, which_challenge, mask_func=None, use_seed=True):
"""Args: mask_func (common.subsample.MaskFunc): A function that can create a mask of appropriate shape. resolution (int): Resolution of the... | stack_v2_sparse_classes_36k_train_005233 | 17,413 | no_license | [
{
"docstring": "Args: mask_func (common.subsample.MaskFunc): A function that can create a mask of appropriate shape. resolution (int): Resolution of the image. which_challenge (str): Either \"singlecoil\" or \"multicoil\" denoting the dataset. use_seed (bool): If true, this class computes a pseudo random number... | 2 | stack_v2_sparse_classes_30k_train_021231 | Implement the Python class `DataTransform` described below.
Class description:
Data Transformer for training U-Net models.
Method signatures and docstrings:
- def __init__(self, resolution, which_challenge, mask_func=None, use_seed=True): Args: mask_func (common.subsample.MaskFunc): A function that can create a mask ... | Implement the Python class `DataTransform` described below.
Class description:
Data Transformer for training U-Net models.
Method signatures and docstrings:
- def __init__(self, resolution, which_challenge, mask_func=None, use_seed=True): Args: mask_func (common.subsample.MaskFunc): A function that can create a mask ... | 219652c8a08c4f2f682acd9f95a4e1b3fd36b70b | <|skeleton|>
class DataTransform:
"""Data Transformer for training U-Net models."""
def __init__(self, resolution, which_challenge, mask_func=None, use_seed=True):
"""Args: mask_func (common.subsample.MaskFunc): A function that can create a mask of appropriate shape. resolution (int): Resolution of the... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DataTransform:
"""Data Transformer for training U-Net models."""
def __init__(self, resolution, which_challenge, mask_func=None, use_seed=True):
"""Args: mask_func (common.subsample.MaskFunc): A function that can create a mask of appropriate shape. resolution (int): Resolution of the image. which... | the_stack_v2_python_sparse | dc_rsn_fastmri/train.py | Bala93/Holistic-MRI-Reconstruction | train | 1 |
b429ee539123e79bbbf54940a4fe9da8af128628 | [
"request = pecan.request\ncontext = request.environ['context']\nrecord = self.central_api.get_record(context, zone_id, recordset_id, record_id)\nreturn self._view.show(context, request, record)",
"request = pecan.request\ncontext = request.environ['context']\nmarker, limit, sort_key, sort_dir = self._get_paging_p... | <|body_start_0|>
request = pecan.request
context = request.environ['context']
record = self.central_api.get_record(context, zone_id, recordset_id, record_id)
return self._view.show(context, request, record)
<|end_body_0|>
<|body_start_1|>
request = pecan.request
context ... | RecordsController | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RecordsController:
def get_one(self, zone_id, recordset_id, record_id):
"""Get Record"""
<|body_0|>
def get_all(self, zone_id, recordset_id, **params):
"""List Records"""
<|body_1|>
def post_all(self, zone_id, recordset_id):
"""Create Record"""
... | stack_v2_sparse_classes_36k_train_005234 | 5,837 | permissive | [
{
"docstring": "Get Record",
"name": "get_one",
"signature": "def get_one(self, zone_id, recordset_id, record_id)"
},
{
"docstring": "List Records",
"name": "get_all",
"signature": "def get_all(self, zone_id, recordset_id, **params)"
},
{
"docstring": "Create Record",
"name":... | 5 | stack_v2_sparse_classes_30k_train_001216 | Implement the Python class `RecordsController` described below.
Class description:
Implement the RecordsController class.
Method signatures and docstrings:
- def get_one(self, zone_id, recordset_id, record_id): Get Record
- def get_all(self, zone_id, recordset_id, **params): List Records
- def post_all(self, zone_id,... | Implement the Python class `RecordsController` described below.
Class description:
Implement the RecordsController class.
Method signatures and docstrings:
- def get_one(self, zone_id, recordset_id, record_id): Get Record
- def get_all(self, zone_id, recordset_id, **params): List Records
- def post_all(self, zone_id,... | 331ee1958271990ae383203e7f7970f8f41ca003 | <|skeleton|>
class RecordsController:
def get_one(self, zone_id, recordset_id, record_id):
"""Get Record"""
<|body_0|>
def get_all(self, zone_id, recordset_id, **params):
"""List Records"""
<|body_1|>
def post_all(self, zone_id, recordset_id):
"""Create Record"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RecordsController:
def get_one(self, zone_id, recordset_id, record_id):
"""Get Record"""
request = pecan.request
context = request.environ['context']
record = self.central_api.get_record(context, zone_id, recordset_id, record_id)
return self._view.show(context, request,... | the_stack_v2_python_sparse | designate/api/v2/controllers/records.py | NeCTAR-RC/designate | train | 1 | |
92a5a4279dd22e9e956455fc2234c43d8d5afd83 | [
"lengthList = len(lists)\nif lengthList == 0:\n return None\nif lengthList == 1:\n return lists[0]\nif lengthList == 2:\n return self.mergeTwoLists(lists[0], lists[1])\nmid = lengthList / 2\nl1 = self.mergeKLists(lists[:mid])\nl2 = self.mergeKLists(lists[mid:])\nreturn self.mergeTwoLists(l1, l2)\nreturn li... | <|body_start_0|>
lengthList = len(lists)
if lengthList == 0:
return None
if lengthList == 1:
return lists[0]
if lengthList == 2:
return self.mergeTwoLists(lists[0], lists[1])
mid = lengthList / 2
l1 = self.mergeKLists(lists[:mid])
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def mergeKLists(self, lists):
""":type lists: List[ListNode] :rtype: ListNode"""
<|body_0|>
def mergeTwoLists(l1, l2):
""":type l1: ListNode :type l2: ListNode :rtype: ListNode"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
lengthList = l... | stack_v2_sparse_classes_36k_train_005235 | 1,326 | no_license | [
{
"docstring": ":type lists: List[ListNode] :rtype: ListNode",
"name": "mergeKLists",
"signature": "def mergeKLists(self, lists)"
},
{
"docstring": ":type l1: ListNode :type l2: ListNode :rtype: ListNode",
"name": "mergeTwoLists",
"signature": "def mergeTwoLists(l1, l2)"
}
] | 2 | stack_v2_sparse_classes_30k_train_004625 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def mergeKLists(self, lists): :type lists: List[ListNode] :rtype: ListNode
- def mergeTwoLists(l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def mergeKLists(self, lists): :type lists: List[ListNode] :rtype: ListNode
- def mergeTwoLists(l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode
<|skeleton|>
class... | de6db120a1e709809d26e3e317c66612e681fb70 | <|skeleton|>
class Solution:
def mergeKLists(self, lists):
""":type lists: List[ListNode] :rtype: ListNode"""
<|body_0|>
def mergeTwoLists(l1, l2):
""":type l1: ListNode :type l2: ListNode :rtype: ListNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def mergeKLists(self, lists):
""":type lists: List[ListNode] :rtype: ListNode"""
lengthList = len(lists)
if lengthList == 0:
return None
if lengthList == 1:
return lists[0]
if lengthList == 2:
return self.mergeTwoLists(lists... | the_stack_v2_python_sparse | src/leetcode/python/23-merge-k-sorted-lists.PY | renaissance-codes/leetcode | train | 0 | |
8e2da36d495a27d8af5b87156ad02433e3de00c4 | [
"nums = list(map(int, s))\nn = len(nums)\ndp = [[0] * (n + 1) for _ in range(k + 1)]\ndp[0][0] = 1\nfor c in range(1, k + 1):\n dpSum = [0] * (n + 1)\n for i in range(1, n + 1):\n dpSum[i] = dpSum[i - 1] + (dp[c - 1][i - 1] if IS_PRIME[nums[i - 1]] else 0)\n dpSum[i] %= MOD\n for i in range(1... | <|body_start_0|>
nums = list(map(int, s))
n = len(nums)
dp = [[0] * (n + 1) for _ in range(k + 1)]
dp[0][0] = 1
for c in range(1, k + 1):
dpSum = [0] * (n + 1)
for i in range(1, n + 1):
dpSum[i] = dpSum[i - 1] + (dp[c - 1][i - 1] if IS_PRIM... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def beautifulPartitions(self, s: str, k: int, minLength: int) -> int:
"""dp[count][index]表示前index个字符分成count个子串的方案数 维护一维前缀和数组"""
<|body_0|>
def beautifulPartitions2(self, s: str, k: int, minLength: int) -> int:
"""维护二维前缀和数组"""
<|body_1|>
<|end_skele... | stack_v2_sparse_classes_36k_train_005236 | 3,061 | no_license | [
{
"docstring": "dp[count][index]表示前index个字符分成count个子串的方案数 维护一维前缀和数组",
"name": "beautifulPartitions",
"signature": "def beautifulPartitions(self, s: str, k: int, minLength: int) -> int"
},
{
"docstring": "维护二维前缀和数组",
"name": "beautifulPartitions2",
"signature": "def beautifulPartitions2(s... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def beautifulPartitions(self, s: str, k: int, minLength: int) -> int: dp[count][index]表示前index个字符分成count个子串的方案数 维护一维前缀和数组
- def beautifulPartitions2(self, s: str, k: int, minLeng... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def beautifulPartitions(self, s: str, k: int, minLength: int) -> int: dp[count][index]表示前index个字符分成count个子串的方案数 维护一维前缀和数组
- def beautifulPartitions2(self, s: str, k: int, minLeng... | 7e79e26bb8f641868561b186e34c1127ed63c9e0 | <|skeleton|>
class Solution:
def beautifulPartitions(self, s: str, k: int, minLength: int) -> int:
"""dp[count][index]表示前index个字符分成count个子串的方案数 维护一维前缀和数组"""
<|body_0|>
def beautifulPartitions2(self, s: str, k: int, minLength: int) -> int:
"""维护二维前缀和数组"""
<|body_1|>
<|end_skele... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def beautifulPartitions(self, s: str, k: int, minLength: int) -> int:
"""dp[count][index]表示前index个字符分成count个子串的方案数 维护一维前缀和数组"""
nums = list(map(int, s))
n = len(nums)
dp = [[0] * (n + 1) for _ in range(k + 1)]
dp[0][0] = 1
for c in range(1, k + 1):
... | the_stack_v2_python_sparse | 11_动态规划/dp优化/前缀和优化/6244. 完美分割的方案数-index+remain的前缀和优化.py | 981377660LMT/algorithm-study | train | 225 | |
96f8b3d983d538c9eba40dc815dbc6d1b799f9da | [
"super().__init__()\nself.mode = mode\nself.align_corners = align_corners",
"shapes = [tuple(pred.shape)[2:] for pred in preds]\nsqueeze_result = False\nif target.ndim == preds[0].ndim - 1:\n target = target.unsqueeze(dim=1)\n squeeze_result = True\nnew_targets = [F.interpolate(target, size=shape, mode=self... | <|body_start_0|>
super().__init__()
self.mode = mode
self.align_corners = align_corners
<|end_body_0|>
<|body_start_1|>
shapes = [tuple(pred.shape)[2:] for pred in preds]
squeeze_result = False
if target.ndim == preds[0].ndim - 1:
target = target.unsqueeze(di... | InterpolateToShapes | [
"BSD-3-Clause",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InterpolateToShapes:
def __init__(self, mode: str='nearest', align_corners: bool=None):
"""Downsample target tensor to size of prediction feature maps Args: mode: algorithm used for upsampling: nearest, linear, bilinear, bicubic, trilinear, area. Defaults to "nearest". align_corners: Ali... | stack_v2_sparse_classes_36k_train_005237 | 5,873 | permissive | [
{
"docstring": "Downsample target tensor to size of prediction feature maps Args: mode: algorithm used for upsampling: nearest, linear, bilinear, bicubic, trilinear, area. Defaults to \"nearest\". align_corners: Align corners points for interpolation. (see pytorch for more info) Defaults to None. See Also: :fun... | 2 | null | Implement the Python class `InterpolateToShapes` described below.
Class description:
Implement the InterpolateToShapes class.
Method signatures and docstrings:
- def __init__(self, mode: str='nearest', align_corners: bool=None): Downsample target tensor to size of prediction feature maps Args: mode: algorithm used fo... | Implement the Python class `InterpolateToShapes` described below.
Class description:
Implement the InterpolateToShapes class.
Method signatures and docstrings:
- def __init__(self, mode: str='nearest', align_corners: bool=None): Downsample target tensor to size of prediction feature maps Args: mode: algorithm used fo... | 4f41faa7536dcef8fca7b647dcdca25360e5b58a | <|skeleton|>
class InterpolateToShapes:
def __init__(self, mode: str='nearest', align_corners: bool=None):
"""Downsample target tensor to size of prediction feature maps Args: mode: algorithm used for upsampling: nearest, linear, bilinear, bicubic, trilinear, area. Defaults to "nearest". align_corners: Ali... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class InterpolateToShapes:
def __init__(self, mode: str='nearest', align_corners: bool=None):
"""Downsample target tensor to size of prediction feature maps Args: mode: algorithm used for upsampling: nearest, linear, bilinear, bicubic, trilinear, area. Defaults to "nearest". align_corners: Align corners poi... | the_stack_v2_python_sparse | nndet/arch/layers/interpolation.py | dboun/nnDetection | train | 1 | |
2704c06c675e5399e382153e58b1c61b38180c88 | [
"self.sleeptime = sleep_param\nself.looplimit = looplimit\nself.temperatureTask = TempSensorEmulatorTask.TempSensorEmulator()",
"i = 0\nif self.sleeptime < 0 or self.looplimit < 0:\n logging.error('looplimit or sleeptime is less than 0')\n return False\nif self.enableTempEmulatorAdapter == True:\n while ... | <|body_start_0|>
self.sleeptime = sleep_param
self.looplimit = looplimit
self.temperatureTask = TempSensorEmulatorTask.TempSensorEmulator()
<|end_body_0|>
<|body_start_1|>
i = 0
if self.sleeptime < 0 or self.looplimit < 0:
logging.error('looplimit or sleeptime is les... | This class is responsible for running the temperature generation emulator Has inputs like the sleeptimer and looplimit so we can control the running of iterations | TempEmulatorAdapter | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TempEmulatorAdapter:
"""This class is responsible for running the temperature generation emulator Has inputs like the sleeptimer and looplimit so we can control the running of iterations"""
def __init__(self, sleep_param=sleepDefault, looplimit=loopDefault):
"""Constructor which sets... | stack_v2_sparse_classes_36k_train_005238 | 1,894 | no_license | [
{
"docstring": "Constructor which sets the sleep timer for the thread, and a looplimit if needed.",
"name": "__init__",
"signature": "def __init__(self, sleep_param=sleepDefault, looplimit=loopDefault)"
},
{
"docstring": "This method runs the emulation if enableTempEmulatorAdapter is set to True... | 2 | stack_v2_sparse_classes_30k_train_019403 | Implement the Python class `TempEmulatorAdapter` described below.
Class description:
This class is responsible for running the temperature generation emulator Has inputs like the sleeptimer and looplimit so we can control the running of iterations
Method signatures and docstrings:
- def __init__(self, sleep_param=sle... | Implement the Python class `TempEmulatorAdapter` described below.
Class description:
This class is responsible for running the temperature generation emulator Has inputs like the sleeptimer and looplimit so we can control the running of iterations
Method signatures and docstrings:
- def __init__(self, sleep_param=sle... | dfd5fd8c757cae8b1306ae3e4eb2cfc9bf124fee | <|skeleton|>
class TempEmulatorAdapter:
"""This class is responsible for running the temperature generation emulator Has inputs like the sleeptimer and looplimit so we can control the running of iterations"""
def __init__(self, sleep_param=sleepDefault, looplimit=loopDefault):
"""Constructor which sets... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TempEmulatorAdapter:
"""This class is responsible for running the temperature generation emulator Has inputs like the sleeptimer and looplimit so we can control the running of iterations"""
def __init__(self, sleep_param=sleepDefault, looplimit=loopDefault):
"""Constructor which sets the sleep ti... | the_stack_v2_python_sparse | apps/labs/module02/TempEmulatorAdapter.py | mnk400/iot-device | train | 0 |
669d3301c1296ec8dc15a77d44accb8540fc9ab6 | [
"arg_fields = {'token': String(required=True)}\nargs = parser.parse(arg_fields)\nvalidated_user = UserDAO().verify_token(args['token'])\nlogging.info('Successfully validated token {0} for user {1}.'.format(args['token'], validated_user))\nreturn jsonify(UserMarshal().dump(validated_user).data)",
"arg_fields = {'e... | <|body_start_0|>
arg_fields = {'token': String(required=True)}
args = parser.parse(arg_fields)
validated_user = UserDAO().verify_token(args['token'])
logging.info('Successfully validated token {0} for user {1}.'.format(args['token'], validated_user))
return jsonify(UserMarshal().... | Handles anything related to the verification token. | VerificationToken | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VerificationToken:
"""Handles anything related to the verification token."""
def post(self):
"""Validate a user by providing the correct token."""
<|body_0|>
def put(self):
"""Regenerate the verification token."""
<|body_1|>
<|end_skeleton|>
<|body_star... | stack_v2_sparse_classes_36k_train_005239 | 1,487 | no_license | [
{
"docstring": "Validate a user by providing the correct token.",
"name": "post",
"signature": "def post(self)"
},
{
"docstring": "Regenerate the verification token.",
"name": "put",
"signature": "def put(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_019323 | Implement the Python class `VerificationToken` described below.
Class description:
Handles anything related to the verification token.
Method signatures and docstrings:
- def post(self): Validate a user by providing the correct token.
- def put(self): Regenerate the verification token. | Implement the Python class `VerificationToken` described below.
Class description:
Handles anything related to the verification token.
Method signatures and docstrings:
- def post(self): Validate a user by providing the correct token.
- def put(self): Regenerate the verification token.
<|skeleton|>
class Verificatio... | dcd65ade96b7239b799fe436e61dea29cb568f2e | <|skeleton|>
class VerificationToken:
"""Handles anything related to the verification token."""
def post(self):
"""Validate a user by providing the correct token."""
<|body_0|>
def put(self):
"""Regenerate the verification token."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class VerificationToken:
"""Handles anything related to the verification token."""
def post(self):
"""Validate a user by providing the correct token."""
arg_fields = {'token': String(required=True)}
args = parser.parse(arg_fields)
validated_user = UserDAO().verify_token(args['to... | the_stack_v2_python_sparse | backend/skael/skael/api/user_verify_token.py | webcat12345/skael-public | train | 2 |
1c3ca6b81fe71d475d65a203b8b1de5b1ec5459b | [
"data = request.get_json()\nseat = 1\nif data:\n seat = data.get('seat')\ncurrent_user = get_jwt_identity()\ntry:\n flight = get_flight(flight_id)\n if not flight:\n return generate_response('Selected flight not available', 400)\n if seat == 1 and flight.booked_economy < flight.airplane.economy_s... | <|body_start_0|>
data = request.get_json()
seat = 1
if data:
seat = data.get('seat')
current_user = get_jwt_identity()
try:
flight = get_flight(flight_id)
if not flight:
return generate_response('Selected flight not available', ... | Class to manipulate the airport details | BookingManipulation | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BookingManipulation:
"""Class to manipulate the airport details"""
def post(self, flight_id):
"""POST method to add a new flight booking"""
<|body_0|>
def get(self, flight_id):
"""Return a list of all reservations in a given day"""
<|body_1|>
<|end_skele... | stack_v2_sparse_classes_36k_train_005240 | 2,955 | permissive | [
{
"docstring": "POST method to add a new flight booking",
"name": "post",
"signature": "def post(self, flight_id)"
},
{
"docstring": "Return a list of all reservations in a given day",
"name": "get",
"signature": "def get(self, flight_id)"
}
] | 2 | stack_v2_sparse_classes_30k_test_000609 | Implement the Python class `BookingManipulation` described below.
Class description:
Class to manipulate the airport details
Method signatures and docstrings:
- def post(self, flight_id): POST method to add a new flight booking
- def get(self, flight_id): Return a list of all reservations in a given day | Implement the Python class `BookingManipulation` described below.
Class description:
Class to manipulate the airport details
Method signatures and docstrings:
- def post(self, flight_id): POST method to add a new flight booking
- def get(self, flight_id): Return a list of all reservations in a given day
<|skeleton|>... | 77b157098d618582737979382197e5302d347017 | <|skeleton|>
class BookingManipulation:
"""Class to manipulate the airport details"""
def post(self, flight_id):
"""POST method to add a new flight booking"""
<|body_0|>
def get(self, flight_id):
"""Return a list of all reservations in a given day"""
<|body_1|>
<|end_skele... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BookingManipulation:
"""Class to manipulate the airport details"""
def post(self, flight_id):
"""POST method to add a new flight booking"""
data = request.get_json()
seat = 1
if data:
seat = data.get('seat')
current_user = get_jwt_identity()
try... | the_stack_v2_python_sparse | app/bookings/views.py | muthash/flight-booking-flask | train | 6 |
7fa3f6d170c0040f47142e78e960165c2fe7e9d6 | [
"n = len(nums)\nans = n + 1\nleft, right, win_sum = (0, 0, 0)\nwhile right < n:\n win_sum += nums[right]\n right += 1\n while win_sum >= s:\n ans = min(ans, right - left)\n win_sum -= nums[left]\n left += 1\nreturn ans if ans != n + 1 else 0",
"n = len(nums)\npreSum = [0] * (n + 1)\n... | <|body_start_0|>
n = len(nums)
ans = n + 1
left, right, win_sum = (0, 0, 0)
while right < n:
win_sum += nums[right]
right += 1
while win_sum >= s:
ans = min(ans, right - left)
win_sum -= nums[left]
left +... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def minSubArrayLen(self, s, nums):
""":type s: int :type nums: List[int] :rtype: int"""
<|body_0|>
def minSubArrayLenNlogN(self, s, nums):
""":type s: int :type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
n ... | stack_v2_sparse_classes_36k_train_005241 | 1,746 | no_license | [
{
"docstring": ":type s: int :type nums: List[int] :rtype: int",
"name": "minSubArrayLen",
"signature": "def minSubArrayLen(self, s, nums)"
},
{
"docstring": ":type s: int :type nums: List[int] :rtype: int",
"name": "minSubArrayLenNlogN",
"signature": "def minSubArrayLenNlogN(self, s, nu... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minSubArrayLen(self, s, nums): :type s: int :type nums: List[int] :rtype: int
- def minSubArrayLenNlogN(self, s, nums): :type s: int :type nums: List[int] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minSubArrayLen(self, s, nums): :type s: int :type nums: List[int] :rtype: int
- def minSubArrayLenNlogN(self, s, nums): :type s: int :type nums: List[int] :rtype: int
<|skel... | 810575368ecffa97677bdb51744d1f716140bbb1 | <|skeleton|>
class Solution:
def minSubArrayLen(self, s, nums):
""":type s: int :type nums: List[int] :rtype: int"""
<|body_0|>
def minSubArrayLenNlogN(self, s, nums):
""":type s: int :type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def minSubArrayLen(self, s, nums):
""":type s: int :type nums: List[int] :rtype: int"""
n = len(nums)
ans = n + 1
left, right, win_sum = (0, 0, 0)
while right < n:
win_sum += nums[right]
right += 1
while win_sum >= s:
... | the_stack_v2_python_sparse | M/MinimumSizeSubarraySum.py | bssrdf/pyleet | train | 2 | |
8115f3f0770fd2782fe0a9ed88ad93287f5fef99 | [
"super().__init__()\nself._auth_token_stamper = auth_token_stamper\nself._storage_engine = storage_engine",
"try:\n auth_token = self._auth_token_stamper.verify_auth_token_general(session.auth_token_ext) if session.auth_token_ext else None\nexcept (InvalidAuthTokenError, ExpiredAuthTokenError):\n auth_token... | <|body_start_0|>
super().__init__()
self._auth_token_stamper = auth_token_stamper
self._storage_engine = storage_engine
<|end_body_0|>
<|body_start_1|>
try:
auth_token = self._auth_token_stamper.verify_auth_token_general(session.auth_token_ext) if session.auth_token_ext else... | A query which does not mutate anything, and does not assume a logged-in user. | AppGuestReadonlyUseCase | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AppGuestReadonlyUseCase:
"""A query which does not mutate anything, and does not assume a logged-in user."""
def __init__(self, auth_token_stamper: AuthTokenStamper, storage_engine: DomainStorageEngine) -> None:
"""Constructor."""
<|body_0|>
async def _build_context(self... | stack_v2_sparse_classes_36k_train_005242 | 12,535 | permissive | [
{
"docstring": "Constructor.",
"name": "__init__",
"signature": "def __init__(self, auth_token_stamper: AuthTokenStamper, storage_engine: DomainStorageEngine) -> None"
},
{
"docstring": "Construct the context for the use case.",
"name": "_build_context",
"signature": "async def _build_co... | 2 | null | Implement the Python class `AppGuestReadonlyUseCase` described below.
Class description:
A query which does not mutate anything, and does not assume a logged-in user.
Method signatures and docstrings:
- def __init__(self, auth_token_stamper: AuthTokenStamper, storage_engine: DomainStorageEngine) -> None: Constructor.... | Implement the Python class `AppGuestReadonlyUseCase` described below.
Class description:
A query which does not mutate anything, and does not assume a logged-in user.
Method signatures and docstrings:
- def __init__(self, auth_token_stamper: AuthTokenStamper, storage_engine: DomainStorageEngine) -> None: Constructor.... | 911ecd560142a9b4e57498f2b090f9469a0718a1 | <|skeleton|>
class AppGuestReadonlyUseCase:
"""A query which does not mutate anything, and does not assume a logged-in user."""
def __init__(self, auth_token_stamper: AuthTokenStamper, storage_engine: DomainStorageEngine) -> None:
"""Constructor."""
<|body_0|>
async def _build_context(self... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AppGuestReadonlyUseCase:
"""A query which does not mutate anything, and does not assume a logged-in user."""
def __init__(self, auth_token_stamper: AuthTokenStamper, storage_engine: DomainStorageEngine) -> None:
"""Constructor."""
super().__init__()
self._auth_token_stamper = auth... | the_stack_v2_python_sparse | src/core/jupiter/core/use_cases/infra/use_cases.py | horia141/jupiter | train | 16 |
e113f9a749a04e5804511235165abd68c0e58f2a | [
"left = right = max_length = 0\nfor i in range(len(string)):\n if string[i] == '(':\n left += 1\n else:\n right += 1\n if left == right:\n max_length = max(max_length, right * 2)\n elif right > left:\n left = right = 0\nleft = right = 0\nfor i in range(len(string) - 1, -1, -1... | <|body_start_0|>
left = right = max_length = 0
for i in range(len(string)):
if string[i] == '(':
left += 1
else:
right += 1
if left == right:
max_length = max(max_length, right * 2)
elif right > left:
... | Parentheses | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Parentheses:
def find_longest_valid_parentheses(self, string: str) -> int:
"""Approach: Using 2 pointers with no extra space Time Complexity: O(n) Space Complexity: O(1) :param string: :return:"""
<|body_0|>
def find_longest_valid_parentheses_(self, string: str) -> int:
... | stack_v2_sparse_classes_36k_train_005243 | 3,465 | no_license | [
{
"docstring": "Approach: Using 2 pointers with no extra space Time Complexity: O(n) Space Complexity: O(1) :param string: :return:",
"name": "find_longest_valid_parentheses",
"signature": "def find_longest_valid_parentheses(self, string: str) -> int"
},
{
"docstring": "Approach: Using Stack Tim... | 3 | stack_v2_sparse_classes_30k_train_000328 | Implement the Python class `Parentheses` described below.
Class description:
Implement the Parentheses class.
Method signatures and docstrings:
- def find_longest_valid_parentheses(self, string: str) -> int: Approach: Using 2 pointers with no extra space Time Complexity: O(n) Space Complexity: O(1) :param string: :re... | Implement the Python class `Parentheses` described below.
Class description:
Implement the Parentheses class.
Method signatures and docstrings:
- def find_longest_valid_parentheses(self, string: str) -> int: Approach: Using 2 pointers with no extra space Time Complexity: O(n) Space Complexity: O(1) :param string: :re... | 65cc78b5afa0db064f9fe8f06597e3e120f7363d | <|skeleton|>
class Parentheses:
def find_longest_valid_parentheses(self, string: str) -> int:
"""Approach: Using 2 pointers with no extra space Time Complexity: O(n) Space Complexity: O(1) :param string: :return:"""
<|body_0|>
def find_longest_valid_parentheses_(self, string: str) -> int:
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Parentheses:
def find_longest_valid_parentheses(self, string: str) -> int:
"""Approach: Using 2 pointers with no extra space Time Complexity: O(n) Space Complexity: O(1) :param string: :return:"""
left = right = max_length = 0
for i in range(len(string)):
if string[i] == '(... | the_stack_v2_python_sparse | math_and_srings/longest_valid_parantheses.py | Shiv2157k/leet_code | train | 1 | |
29cc16fb0d99d057a0938bdae89ef34b38679c34 | [
"self.file = file\nself.bills = {'5': [], '10': [], '20': [], '50': [], '100': []}\nif len(self.file) != 0:\n with open(self.file, 'r') as f:\n text = f.read().splitlines()\n for line in text:\n if line.split(' ')[1] == '5':\n self.bills['5'].append(line.split(' ')[0])\n ... | <|body_start_0|>
self.file = file
self.bills = {'5': [], '10': [], '20': [], '50': [], '100': []}
if len(self.file) != 0:
with open(self.file, 'r') as f:
text = f.read().splitlines()
for line in text:
if line.split(' ')[1] == '5':
... | WatchList | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WatchList:
def __init__(self, file=''):
"""This method takes in a filename and initializes a dictionary by the name of bills which contains serial numbers of all the denominations contained as keys.It also checks if the lists in the keys of bills are sorted and uses regex module to check... | stack_v2_sparse_classes_36k_train_005244 | 4,514 | no_license | [
{
"docstring": "This method takes in a filename and initializes a dictionary by the name of bills which contains serial numbers of all the denominations contained as keys.It also checks if the lists in the keys of bills are sorted and uses regex module to check for valid serial numbers.",
"name": "__init__"... | 6 | stack_v2_sparse_classes_30k_val_000463 | Implement the Python class `WatchList` described below.
Class description:
Implement the WatchList class.
Method signatures and docstrings:
- def __init__(self, file=''): This method takes in a filename and initializes a dictionary by the name of bills which contains serial numbers of all the denominations contained ... | Implement the Python class `WatchList` described below.
Class description:
Implement the WatchList class.
Method signatures and docstrings:
- def __init__(self, file=''): This method takes in a filename and initializes a dictionary by the name of bills which contains serial numbers of all the denominations contained ... | e773e87668af057c8adb1e012aa5d81f42c70f2a | <|skeleton|>
class WatchList:
def __init__(self, file=''):
"""This method takes in a filename and initializes a dictionary by the name of bills which contains serial numbers of all the denominations contained as keys.It also checks if the lists in the keys of bills are sorted and uses regex module to check... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class WatchList:
def __init__(self, file=''):
"""This method takes in a filename and initializes a dictionary by the name of bills which contains serial numbers of all the denominations contained as keys.It also checks if the lists in the keys of bills are sorted and uses regex module to check for valid ser... | the_stack_v2_python_sparse | HW/HW1/hw1.py | SiddhantBhardwaj2018/ISTA-350 | train | 0 | |
efe07249cb12578db74937b05e27f5beaada33a8 | [
"self._mutation_rate = mutation_rate\nself._mutation_rand = random.Random()\nself._switch_rand = random.Random()\nself._pos_rand = random.Random()",
"mutated_org = organism.copy()\ngene_choices = mutated_org.genome.alphabet.letters\nmutation_chance = self._mutation_rand.random()\nif mutation_chance <= self._mutat... | <|body_start_0|>
self._mutation_rate = mutation_rate
self._mutation_rand = random.Random()
self._switch_rand = random.Random()
self._pos_rand = random.Random()
<|end_body_0|>
<|body_start_1|>
mutated_org = organism.copy()
gene_choices = mutated_org.genome.alphabet.letter... | Perform a conversion mutation, but only at a single point in the genome. This does not randomize the genome as much as ConversionMutation, since only one change is allowed per genome at the specified mutation rate. | SinglePositionMutation | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SinglePositionMutation:
"""Perform a conversion mutation, but only at a single point in the genome. This does not randomize the genome as much as ConversionMutation, since only one change is allowed per genome at the specified mutation rate."""
def __init__(self, mutation_rate=0.001):
... | stack_v2_sparse_classes_36k_train_005245 | 3,166 | permissive | [
{
"docstring": "Initialize a mutator. Arguments: o mutation_rate - The chance of a mutation happening once in the genome.",
"name": "__init__",
"signature": "def __init__(self, mutation_rate=0.001)"
},
{
"docstring": "Mutate the organisms genome.",
"name": "mutate",
"signature": "def mut... | 2 | stack_v2_sparse_classes_30k_train_020711 | Implement the Python class `SinglePositionMutation` described below.
Class description:
Perform a conversion mutation, but only at a single point in the genome. This does not randomize the genome as much as ConversionMutation, since only one change is allowed per genome at the specified mutation rate.
Method signatur... | Implement the Python class `SinglePositionMutation` described below.
Class description:
Perform a conversion mutation, but only at a single point in the genome. This does not randomize the genome as much as ConversionMutation, since only one change is allowed per genome at the specified mutation rate.
Method signatur... | 1d9a8e84a8572809ee3260ede44290e14de3bdd1 | <|skeleton|>
class SinglePositionMutation:
"""Perform a conversion mutation, but only at a single point in the genome. This does not randomize the genome as much as ConversionMutation, since only one change is allowed per genome at the specified mutation rate."""
def __init__(self, mutation_rate=0.001):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SinglePositionMutation:
"""Perform a conversion mutation, but only at a single point in the genome. This does not randomize the genome as much as ConversionMutation, since only one change is allowed per genome at the specified mutation rate."""
def __init__(self, mutation_rate=0.001):
"""Initiali... | the_stack_v2_python_sparse | bin/last_wrapper/Bio/GA/Mutation/Simple.py | LyonsLab/coge | train | 41 |
fa05c2777fdeb923d1d7313f4961efc8086c499d | [
"self.unit = unit\nself.origin = origin\nself.start = start\nself.end = end\nself._climate_state = None\nself._depature = None",
"a = array_check(a, 3)\nt = array_check(t, 1)\naxis = int_check(axis)\ndf = pd.DataFrame(np.fromfunction(lambda x: x, shape=t.shape, dtype=np.int), index=t)\ndf.index = pd.to_datetime(d... | <|body_start_0|>
self.unit = unit
self.origin = origin
self.start = start
self.end = end
self._climate_state = None
self._depature = None
<|end_body_0|>
<|body_start_1|>
a = array_check(a, 3)
t = array_check(t, 1)
axis = int_check(axis)
df... | Calculate climate state. | ClimateState | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ClimateState:
"""Calculate climate state."""
def __init__(self, *, unit: Optional[str]='h', origin: Optional[str]='1800-01-01', start: Optional[str]=None, end: Optional[str]=None) -> None:
""":param unit: optional, str time sequence unit, default is hour. :param origin: optional, str... | stack_v2_sparse_classes_36k_train_005246 | 7,225 | no_license | [
{
"docstring": ":param unit: optional, str time sequence unit, default is hour. :param origin: optional, str time sequence origin :param start: optional, str time range start, default None mean that from the data start time :param end: optional, str time range end, default None mean that to the data end time",
... | 4 | stack_v2_sparse_classes_30k_train_012155 | Implement the Python class `ClimateState` described below.
Class description:
Calculate climate state.
Method signatures and docstrings:
- def __init__(self, *, unit: Optional[str]='h', origin: Optional[str]='1800-01-01', start: Optional[str]=None, end: Optional[str]=None) -> None: :param unit: optional, str time seq... | Implement the Python class `ClimateState` described below.
Class description:
Calculate climate state.
Method signatures and docstrings:
- def __init__(self, *, unit: Optional[str]='h', origin: Optional[str]='1800-01-01', start: Optional[str]=None, end: Optional[str]=None) -> None: :param unit: optional, str time seq... | 1c8d5fbf3676dc81e9f143e93ee2564359519b11 | <|skeleton|>
class ClimateState:
"""Calculate climate state."""
def __init__(self, *, unit: Optional[str]='h', origin: Optional[str]='1800-01-01', start: Optional[str]=None, end: Optional[str]=None) -> None:
""":param unit: optional, str time sequence unit, default is hour. :param origin: optional, str... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ClimateState:
"""Calculate climate state."""
def __init__(self, *, unit: Optional[str]='h', origin: Optional[str]='1800-01-01', start: Optional[str]=None, end: Optional[str]=None) -> None:
""":param unit: optional, str time sequence unit, default is hour. :param origin: optional, str time sequenc... | the_stack_v2_python_sparse | statistics/average.py | qliu0/PythonInAirSeaScience | train | 0 |
11d226e25ba32a603eb54d13f6d6f50cd7eec202 | [
"if not root:\n return ''\nqueue = deque()\nqueue.append(root)\nres = str(root.val) + '_'\nwhile len(queue) > 0:\n node = queue.popleft()\n if node.left:\n queue.append(node.left)\n res += str(node.left.val) + '_'\n else:\n res += '#_'\n if node.right:\n queue.append(node.... | <|body_start_0|>
if not root:
return ''
queue = deque()
queue.append(root)
res = str(root.val) + '_'
while len(queue) > 0:
node = queue.popleft()
if node.left:
queue.append(node.left)
res += str(node.left.val) + ... | 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 前序遍历进行序列化https://leetcode-cn.com/problems/serialize-and-deserialize-binary-tree/solution/er-cha-shu-de-xu-lie-hua-yu-fan-xu-lie-hua-by-leet/ :desc 对树的序列号和反序列化"""
<|body_0|>
... | stack_v2_sparse_classes_36k_train_005247 | 2,880 | no_license | [
{
"docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str 前序遍历进行序列化https://leetcode-cn.com/problems/serialize-and-deserialize-binary-tree/solution/er-cha-shu-de-xu-lie-hua-yu-fan-xu-lie-hua-by-leet/ :desc 对树的序列号和反序列化",
"name": "serialize",
"signature": "def serialize(self, root... | 2 | stack_v2_sparse_classes_30k_train_019341 | 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 前序遍历进行序列化https://leetcode-cn.com/problems/serialize-and-deserialize-binary-tree/solution/... | 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 前序遍历进行序列化https://leetcode-cn.com/problems/serialize-and-deserialize-binary-tree/solution/... | 08b3d9cab3c1806c37d36587372b1e8fb1683f64 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str 前序遍历进行序列化https://leetcode-cn.com/problems/serialize-and-deserialize-binary-tree/solution/er-cha-shu-de-xu-lie-hua-yu-fan-xu-lie-hua-by-leet/ :desc 对树的序列号和反序列化"""
<|body_0|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str 前序遍历进行序列化https://leetcode-cn.com/problems/serialize-and-deserialize-binary-tree/solution/er-cha-shu-de-xu-lie-hua-yu-fan-xu-lie-hua-by-leet/ :desc 对树的序列号和反序列化"""
if not root:
re... | the_stack_v2_python_sparse | tree/297.Serialize-and-Deserialize-Binary-Tree.py | HonniLin/leetcode | train | 0 | |
5d66e42d67f3316af113a6b0ccd935fc65cfee40 | [
"channel = plexus.info\nchannel.log(flo.meta.copyright)\nreturn",
"channel = plexus.info\nchannel.log(flo.meta.acknowledgments)\nreturn",
"channel = plexus.info\nchannel.log(flo.meta.license)\nreturn"
] | <|body_start_0|>
channel = plexus.info
channel.log(flo.meta.copyright)
return
<|end_body_0|>
<|body_start_1|>
channel = plexus.info
channel.log(flo.meta.acknowledgments)
return
<|end_body_1|>
<|body_start_2|>
channel = plexus.info
channel.log(flo.meta.li... | Display human readable information about the app | About | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class About:
"""Display human readable information about the app"""
def copyright(self, plexus, **kwds):
"""Print the copyright note of the flo package"""
<|body_0|>
def credits(self, plexus, **kwds):
"""Print the flo package acknowledgments"""
<|body_1|>
... | stack_v2_sparse_classes_36k_train_005248 | 1,191 | no_license | [
{
"docstring": "Print the copyright note of the flo package",
"name": "copyright",
"signature": "def copyright(self, plexus, **kwds)"
},
{
"docstring": "Print the flo package acknowledgments",
"name": "credits",
"signature": "def credits(self, plexus, **kwds)"
},
{
"docstring": "... | 3 | stack_v2_sparse_classes_30k_train_014988 | Implement the Python class `About` described below.
Class description:
Display human readable information about the app
Method signatures and docstrings:
- def copyright(self, plexus, **kwds): Print the copyright note of the flo package
- def credits(self, plexus, **kwds): Print the flo package acknowledgments
- def ... | Implement the Python class `About` described below.
Class description:
Display human readable information about the app
Method signatures and docstrings:
- def copyright(self, plexus, **kwds): Print the copyright note of the flo package
- def credits(self, plexus, **kwds): Print the flo package acknowledgments
- def ... | 7b61a7a4cf12d4448b99f1b841866fe31a27bb61 | <|skeleton|>
class About:
"""Display human readable information about the app"""
def copyright(self, plexus, **kwds):
"""Print the copyright note of the flo package"""
<|body_0|>
def credits(self, plexus, **kwds):
"""Print the flo package acknowledgments"""
<|body_1|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class About:
"""Display human readable information about the app"""
def copyright(self, plexus, **kwds):
"""Print the copyright note of the flo package"""
channel = plexus.info
channel.log(flo.meta.copyright)
return
def credits(self, plexus, **kwds):
"""Print the fl... | the_stack_v2_python_sparse | flo/cli/About.py | pyre/flo | train | 5 |
a8f271199e7fcc4144c26d9aa4a616c2fb8803fe | [
"super(ValidateCommitForm, self).__init__(*args, **kwargs)\nself.repository = repository\nself.request = request",
"super(ValidateCommitForm, self).clean()\nvalidation_info = self.cleaned_data.get('validation_info')\nif validation_info:\n errors = []\n parent_id = self.cleaned_data.get('parent_id')\n com... | <|body_start_0|>
super(ValidateCommitForm, self).__init__(*args, **kwargs)
self.repository = repository
self.request = request
<|end_body_0|>
<|body_start_1|>
super(ValidateCommitForm, self).clean()
validation_info = self.cleaned_data.get('validation_info')
if validation... | A form for validating of DiffCommits. | ValidateCommitForm | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ValidateCommitForm:
"""A form for validating of DiffCommits."""
def __init__(self, repository, request=None, *args, **kwargs):
"""Initialize the form. Args: repository (reviewboard.scmtools.models.Repository): The repository against which the diff is being validated. request (django.... | stack_v2_sparse_classes_36k_train_005249 | 16,962 | permissive | [
{
"docstring": "Initialize the form. Args: repository (reviewboard.scmtools.models.Repository): The repository against which the diff is being validated. request (django.http.HttpRequest, optional): The HTTP request from the client. *args (tuple): Additional positional arguments to pass to the base class initia... | 3 | stack_v2_sparse_classes_30k_train_002343 | Implement the Python class `ValidateCommitForm` described below.
Class description:
A form for validating of DiffCommits.
Method signatures and docstrings:
- def __init__(self, repository, request=None, *args, **kwargs): Initialize the form. Args: repository (reviewboard.scmtools.models.Repository): The repository ag... | Implement the Python class `ValidateCommitForm` described below.
Class description:
A form for validating of DiffCommits.
Method signatures and docstrings:
- def __init__(self, repository, request=None, *args, **kwargs): Initialize the form. Args: repository (reviewboard.scmtools.models.Repository): The repository ag... | c3a991f1e9d7682239a1ab0e8661cee6da01d537 | <|skeleton|>
class ValidateCommitForm:
"""A form for validating of DiffCommits."""
def __init__(self, repository, request=None, *args, **kwargs):
"""Initialize the form. Args: repository (reviewboard.scmtools.models.Repository): The repository against which the diff is being validated. request (django.... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ValidateCommitForm:
"""A form for validating of DiffCommits."""
def __init__(self, repository, request=None, *args, **kwargs):
"""Initialize the form. Args: repository (reviewboard.scmtools.models.Repository): The repository against which the diff is being validated. request (django.http.HttpRequ... | the_stack_v2_python_sparse | reviewboard/diffviewer/forms.py | reviewboard/reviewboard | train | 1,141 |
b56d79702ad307eb8183611199f086f4ccb0d689 | [
"if root.val > p.val and root.val > q.val:\n return self.lowestCommonAncestor(root.left, p, q)\nelif root.val < p.val and root.val < q.val:\n return self.lowestCommonAncestor(root.right, p, q)\nelse:\n return root",
"self.result = None\n\ndef helper(node):\n if not node:\n return (False, False)... | <|body_start_0|>
if root.val > p.val and root.val > q.val:
return self.lowestCommonAncestor(root.left, p, q)
elif root.val < p.val and root.val < q.val:
return self.lowestCommonAncestor(root.right, p, q)
else:
return root
<|end_body_0|>
<|body_start_1|>
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def lowestCommonAncestor(self, root, p, q):
""":type root: TreeNode :type p: TreeNode :type q: TreeNode :rtype: TreeNode"""
<|body_0|>
def lowestCommonAncestor_(self, root, p, q):
""":type root: TreeNode :type p: TreeNode :type q: TreeNode :rtype: TreeNode"... | stack_v2_sparse_classes_36k_train_005250 | 1,507 | no_license | [
{
"docstring": ":type root: TreeNode :type p: TreeNode :type q: TreeNode :rtype: TreeNode",
"name": "lowestCommonAncestor",
"signature": "def lowestCommonAncestor(self, root, p, q)"
},
{
"docstring": ":type root: TreeNode :type p: TreeNode :type q: TreeNode :rtype: TreeNode",
"name": "lowest... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lowestCommonAncestor(self, root, p, q): :type root: TreeNode :type p: TreeNode :type q: TreeNode :rtype: TreeNode
- def lowestCommonAncestor_(self, root, p, q): :type root: T... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lowestCommonAncestor(self, root, p, q): :type root: TreeNode :type p: TreeNode :type q: TreeNode :rtype: TreeNode
- def lowestCommonAncestor_(self, root, p, q): :type root: T... | ef052efcbcceb38e44fdd7cbcb6a7e6bd7ff8aa2 | <|skeleton|>
class Solution:
def lowestCommonAncestor(self, root, p, q):
""":type root: TreeNode :type p: TreeNode :type q: TreeNode :rtype: TreeNode"""
<|body_0|>
def lowestCommonAncestor_(self, root, p, q):
""":type root: TreeNode :type p: TreeNode :type q: TreeNode :rtype: TreeNode"... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def lowestCommonAncestor(self, root, p, q):
""":type root: TreeNode :type p: TreeNode :type q: TreeNode :rtype: TreeNode"""
if root.val > p.val and root.val > q.val:
return self.lowestCommonAncestor(root.left, p, q)
elif root.val < p.val and root.val < q.val:
... | the_stack_v2_python_sparse | binary_search/lowest_common_ancestor_of_a_binary_search_tree.py | moyuanhuang/leetcode | train | 2 | |
b94cffacd568fe0039e561c0d3490e9816f6c236 | [
"try:\n from config_parser import config_parser\n self.conf_file = current_file_path + '/../../conf/appviewx.conf'\n self.conf_data = config_parser(self.conf_file)\n self.hostname = socket.gethostbyname(socket.gethostname())\n self.path = self.conf_data['ENVIRONMENT']['path'][self.conf_data['ENVIRONM... | <|body_start_0|>
try:
from config_parser import config_parser
self.conf_file = current_file_path + '/../../conf/appviewx.conf'
self.conf_data = config_parser(self.conf_file)
self.hostname = socket.gethostbyname(socket.gethostname())
self.path = self.co... | Class to initialize Log4jLogLevel. | Log4jLogLevel | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Log4jLogLevel:
"""Class to initialize Log4jLogLevel."""
def __init__(self):
"""Init function for Log4jLogLevel."""
<|body_0|>
def web_log4j(self):
"""."""
<|body_1|>
def edit_log4j(self, component, source):
"""."""
<|body_2|>
def... | stack_v2_sparse_classes_36k_train_005251 | 3,794 | no_license | [
{
"docstring": "Init function for Log4jLogLevel.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": ".",
"name": "web_log4j",
"signature": "def web_log4j(self)"
},
{
"docstring": ".",
"name": "edit_log4j",
"signature": "def edit_log4j(self, componen... | 4 | stack_v2_sparse_classes_30k_train_019888 | Implement the Python class `Log4jLogLevel` described below.
Class description:
Class to initialize Log4jLogLevel.
Method signatures and docstrings:
- def __init__(self): Init function for Log4jLogLevel.
- def web_log4j(self): .
- def edit_log4j(self, component, source): .
- def initialize(self, component): . | Implement the Python class `Log4jLogLevel` described below.
Class description:
Class to initialize Log4jLogLevel.
Method signatures and docstrings:
- def __init__(self): Init function for Log4jLogLevel.
- def web_log4j(self): .
- def edit_log4j(self, component, source): .
- def initialize(self, component): .
<|skele... | e513224364dce05ea4d17ac25ecfa981238b1311 | <|skeleton|>
class Log4jLogLevel:
"""Class to initialize Log4jLogLevel."""
def __init__(self):
"""Init function for Log4jLogLevel."""
<|body_0|>
def web_log4j(self):
"""."""
<|body_1|>
def edit_log4j(self, component, source):
"""."""
<|body_2|>
def... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Log4jLogLevel:
"""Class to initialize Log4jLogLevel."""
def __init__(self):
"""Init function for Log4jLogLevel."""
try:
from config_parser import config_parser
self.conf_file = current_file_path + '/../../conf/appviewx.conf'
self.conf_data = config_pars... | the_stack_v2_python_sparse | scripts_avx/scripts/scripts/Commons/log4j_log_level.py | Poonammahunta/Integration | train | 0 |
921cea17aae7e2dff30fb06c42780b659a1333a1 | [
"if path:\n return path.replace('\\\\', '/')\nreturn path",
"if ord(line[0]) == 65279:\n line = line[1:]\ncols = line.split(sep)\nresults = []\nfor col in cols:\n col = col.replace('\"', ' ').strip()\n results.append(col)\nreturn results",
"if name is None:\n return ''\nif ord(name[0]) == 65279:\... | <|body_start_0|>
if path:
return path.replace('\\', '/')
return path
<|end_body_0|>
<|body_start_1|>
if ord(line[0]) == 65279:
line = line[1:]
cols = line.split(sep)
results = []
for col in cols:
col = col.replace('"', ' ').strip()
... | With the use of other data-conversion packages, the opportunities for data-normalization have expanded considerably. It's time to combine them so as to use / maintain each, in a common location. | Norm | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Norm:
"""With the use of other data-conversion packages, the opportunities for data-normalization have expanded considerably. It's time to combine them so as to use / maintain each, in a common location."""
def NormPath(path):
"""Convert a path to evaluatable path-name."""
<|... | stack_v2_sparse_classes_36k_train_005252 | 1,816 | permissive | [
{
"docstring": "Convert a path to evaluatable path-name.",
"name": "NormPath",
"signature": "def NormPath(path)"
},
{
"docstring": "Normalize & split the first line / header line from a data-file.",
"name": "NormLine",
"signature": "def NormLine(line, sep=',')"
},
{
"docstring": ... | 4 | stack_v2_sparse_classes_30k_train_015257 | Implement the Python class `Norm` described below.
Class description:
With the use of other data-conversion packages, the opportunities for data-normalization have expanded considerably. It's time to combine them so as to use / maintain each, in a common location.
Method signatures and docstrings:
- def NormPath(path... | Implement the Python class `Norm` described below.
Class description:
With the use of other data-conversion packages, the opportunities for data-normalization have expanded considerably. It's time to combine them so as to use / maintain each, in a common location.
Method signatures and docstrings:
- def NormPath(path... | 286ff96fa09196f0ac48bae1e87c4b9db66e2efe | <|skeleton|>
class Norm:
"""With the use of other data-conversion packages, the opportunities for data-normalization have expanded considerably. It's time to combine them so as to use / maintain each, in a common location."""
def NormPath(path):
"""Convert a path to evaluatable path-name."""
<|... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Norm:
"""With the use of other data-conversion packages, the opportunities for data-normalization have expanded considerably. It's time to combine them so as to use / maintain each, in a common location."""
def NormPath(path):
"""Convert a path to evaluatable path-name."""
if path:
... | the_stack_v2_python_sparse | SqltDAO/CodeGen01/Normalizers.py | soft9000/PyDAO | train | 13 |
9927888e9df972509a201241abfe195fb7e16430 | [
"assert len(sizes) == 2, 'SSD requires sizes to be (size_min, size_max)'\nanchors = []\nfor i in range(alloc_size[0]):\n for j in range(alloc_size[1]):\n cy = (i + offsets[0]) * step\n cx = (j + offsets[1]) * step\n r = ratios[0]\n anchors.append([cx, cy, sizes[0] / 2, sizes[0] / 2])\... | <|body_start_0|>
assert len(sizes) == 2, 'SSD requires sizes to be (size_min, size_max)'
anchors = []
for i in range(alloc_size[0]):
for j in range(alloc_size[1]):
cy = (i + offsets[0]) * step
cx = (j + offsets[1]) * step
r = ratios[0]
... | Bounding box anchor generator for Single-shot Object Detection, corresponding to anchors structure used in ssd_mobilenet_v1_coco from TF Object Detection API This class inherits SSDAnchorGenerator and uses the same input parameters. Main differences: - First branch is not added with another anchor with size extracted f... | LiteAnchorGenerator | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LiteAnchorGenerator:
"""Bounding box anchor generator for Single-shot Object Detection, corresponding to anchors structure used in ssd_mobilenet_v1_coco from TF Object Detection API This class inherits SSDAnchorGenerator and uses the same input parameters. Main differences: - First branch is not ... | stack_v2_sparse_classes_36k_train_005253 | 5,184 | permissive | [
{
"docstring": "Generate anchors for once. Anchors are stored with (center_x, center_y, w, h) format.",
"name": "_generate_anchors",
"signature": "def _generate_anchors(self, sizes, ratios, step, alloc_size, offsets)"
},
{
"docstring": "Number of anchors at each pixel.",
"name": "num_depth",... | 2 | stack_v2_sparse_classes_30k_train_019564 | Implement the Python class `LiteAnchorGenerator` described below.
Class description:
Bounding box anchor generator for Single-shot Object Detection, corresponding to anchors structure used in ssd_mobilenet_v1_coco from TF Object Detection API This class inherits SSDAnchorGenerator and uses the same input parameters. M... | Implement the Python class `LiteAnchorGenerator` described below.
Class description:
Bounding box anchor generator for Single-shot Object Detection, corresponding to anchors structure used in ssd_mobilenet_v1_coco from TF Object Detection API This class inherits SSDAnchorGenerator and uses the same input parameters. M... | 567775619f3b97d47e7c360748912a4fd883ff52 | <|skeleton|>
class LiteAnchorGenerator:
"""Bounding box anchor generator for Single-shot Object Detection, corresponding to anchors structure used in ssd_mobilenet_v1_coco from TF Object Detection API This class inherits SSDAnchorGenerator and uses the same input parameters. Main differences: - First branch is not ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LiteAnchorGenerator:
"""Bounding box anchor generator for Single-shot Object Detection, corresponding to anchors structure used in ssd_mobilenet_v1_coco from TF Object Detection API This class inherits SSDAnchorGenerator and uses the same input parameters. Main differences: - First branch is not added with an... | the_stack_v2_python_sparse | gluoncv/model_zoo/ssd/anchor.py | dmlc/gluon-cv | train | 6,064 |
ff9c3d4b3041c5ed5521247eab64f6487a54579f | [
"result = {'result': 'NG'}\ncount, content = CtrlModel().get(page, size, model_id, condition)\nif content:\n result['result'] = 'OK'\n result['content'] = content\n if count:\n result['count'] = count\nreturn result",
"result = {'result': 'NG'}\ndata_json = request.get_json(force=True)\nobj = Ctrl... | <|body_start_0|>
result = {'result': 'NG'}
count, content = CtrlModel().get(page, size, model_id, condition)
if content:
result['result'] = 'OK'
result['content'] = content
if count:
result['count'] = count
return result
<|end_body_0|>
... | ApiModel | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ApiModel:
def get(self, page=None, size=None, model_id=None, condition=None):
"""获取模块 :param model_id: :return:"""
<|body_0|>
def post(self):
"""新增或修改模块 :return:"""
<|body_1|>
def delete(self, model_id):
"""删除模块 :return:"""
<|body_2|>
<|... | stack_v2_sparse_classes_36k_train_005254 | 7,260 | no_license | [
{
"docstring": "获取模块 :param model_id: :return:",
"name": "get",
"signature": "def get(self, page=None, size=None, model_id=None, condition=None)"
},
{
"docstring": "新增或修改模块 :return:",
"name": "post",
"signature": "def post(self)"
},
{
"docstring": "删除模块 :return:",
"name": "de... | 3 | null | Implement the Python class `ApiModel` described below.
Class description:
Implement the ApiModel class.
Method signatures and docstrings:
- def get(self, page=None, size=None, model_id=None, condition=None): 获取模块 :param model_id: :return:
- def post(self): 新增或修改模块 :return:
- def delete(self, model_id): 删除模块 :return: | Implement the Python class `ApiModel` described below.
Class description:
Implement the ApiModel class.
Method signatures and docstrings:
- def get(self, page=None, size=None, model_id=None, condition=None): 获取模块 :param model_id: :return:
- def post(self): 新增或修改模块 :return:
- def delete(self, model_id): 删除模块 :return:
... | 64b31e7bdfcb8a4c95f0a8a607f0bcff576cec11 | <|skeleton|>
class ApiModel:
def get(self, page=None, size=None, model_id=None, condition=None):
"""获取模块 :param model_id: :return:"""
<|body_0|>
def post(self):
"""新增或修改模块 :return:"""
<|body_1|>
def delete(self, model_id):
"""删除模块 :return:"""
<|body_2|>
<|... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ApiModel:
def get(self, page=None, size=None, model_id=None, condition=None):
"""获取模块 :param model_id: :return:"""
result = {'result': 'NG'}
count, content = CtrlModel().get(page, size, model_id, condition)
if content:
result['result'] = 'OK'
result['con... | the_stack_v2_python_sparse | Source/collaboration_2/app/api_1_0/api_model.py | lsn1183/web_project | train | 0 | |
00ddd8a8d1d729f57df38d3c969c2201728c2657 | [
"self._url = f'amqp://{host}:{port}'\nself._debug = debug\nself._conn = kombu.Connection(hostname=host, port=port, userid='guest', password='guest', virtual_host='/')",
"self._conn.connect()\nqueue = kombu.Queue(routing_key, kombu.Exchange(exchange, type='topic'), routing_key=routing_key)\nqueue.maybe_bind(self._... | <|body_start_0|>
self._url = f'amqp://{host}:{port}'
self._debug = debug
self._conn = kombu.Connection(hostname=host, port=port, userid='guest', password='guest', virtual_host='/')
<|end_body_0|>
<|body_start_1|>
self._conn.connect()
queue = kombu.Queue(routing_key, kombu.Exchan... | The Producer class writes messages to the message queue to be consumed. | Producer | [
"Apache-2.0",
"LicenseRef-scancode-generic-cla",
"LicenseRef-scancode-free-unknown",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Producer:
"""The Producer class writes messages to the message queue to be consumed."""
def __init__(self, host: str=HOST, port: int=PORT, debug: bool=False):
"""Sets up connection to broker to write to. :param host: hostname for the queue server :param port: port for the queue serve... | stack_v2_sparse_classes_36k_train_005255 | 6,869 | permissive | [
{
"docstring": "Sets up connection to broker to write to. :param host: hostname for the queue server :param port: port for the queue server :param debug: print debugging messages",
"name": "__init__",
"signature": "def __init__(self, host: str=HOST, port: int=PORT, debug: bool=False)"
},
{
"docs... | 2 | null | Implement the Python class `Producer` described below.
Class description:
The Producer class writes messages to the message queue to be consumed.
Method signatures and docstrings:
- def __init__(self, host: str=HOST, port: int=PORT, debug: bool=False): Sets up connection to broker to write to. :param host: hostname f... | Implement the Python class `Producer` described below.
Class description:
The Producer class writes messages to the message queue to be consumed.
Method signatures and docstrings:
- def __init__(self, host: str=HOST, port: int=PORT, debug: bool=False): Sets up connection to broker to write to. :param host: hostname f... | 85102bb41aa0d558a3fa088e4fd6f51613599ad0 | <|skeleton|>
class Producer:
"""The Producer class writes messages to the message queue to be consumed."""
def __init__(self, host: str=HOST, port: int=PORT, debug: bool=False):
"""Sets up connection to broker to write to. :param host: hostname for the queue server :param port: port for the queue serve... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Producer:
"""The Producer class writes messages to the message queue to be consumed."""
def __init__(self, host: str=HOST, port: int=PORT, debug: bool=False):
"""Sets up connection to broker to write to. :param host: hostname for the queue server :param port: port for the queue server :param debu... | the_stack_v2_python_sparse | base/modules/utils/root/sb_utils/amqp_tools.py | g2-inc/openc2-oif-orchestrator | train | 1 |
7812eb8c0f6546df0c3d1dbe24514bfa1077fe0c | [
"\"\"\" Init inherited thread \"\"\"\nThread.__init__(self)\n' Use gui interface to start the feed '\nscreenWidth, screenHeight = pyautogui.size()\npyautogui.moveTo(screenWidth / 2, screenHeight / 2)\npyautogui.moveTo(160, 750)\npyautogui.click()\ntime.sleep(2)\npyautogui.click(400, 50)\npyautogui.keyDown('ctrl')\n... | <|body_start_0|>
""" Init inherited thread """
Thread.__init__(self)
' Use gui interface to start the feed '
screenWidth, screenHeight = pyautogui.size()
pyautogui.moveTo(screenWidth / 2, screenHeight / 2)
pyautogui.moveTo(160, 750)
pyautogui.click()
time.... | Access television feed and enable stills capture | feed | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class feed:
"""Access television feed and enable stills capture"""
def __init__(self):
"""Initalise the thread"""
<|body_0|>
def take_still(self):
"""Grab a still image from the threaded feed"""
<|body_1|>
def run(self):
"""Feed threaded"""
... | stack_v2_sparse_classes_36k_train_005256 | 1,906 | no_license | [
{
"docstring": "Initalise the thread",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Grab a still image from the threaded feed",
"name": "take_still",
"signature": "def take_still(self)"
},
{
"docstring": "Feed threaded",
"name": "run",
"signatu... | 3 | stack_v2_sparse_classes_30k_train_019512 | Implement the Python class `feed` described below.
Class description:
Access television feed and enable stills capture
Method signatures and docstrings:
- def __init__(self): Initalise the thread
- def take_still(self): Grab a still image from the threaded feed
- def run(self): Feed threaded | Implement the Python class `feed` described below.
Class description:
Access television feed and enable stills capture
Method signatures and docstrings:
- def __init__(self): Initalise the thread
- def take_still(self): Grab a still image from the threaded feed
- def run(self): Feed threaded
<|skeleton|>
class feed:... | 86b06394b7567179a496d2a0eee76922e2c3c1f6 | <|skeleton|>
class feed:
"""Access television feed and enable stills capture"""
def __init__(self):
"""Initalise the thread"""
<|body_0|>
def take_still(self):
"""Grab a still image from the threaded feed"""
<|body_1|>
def run(self):
"""Feed threaded"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class feed:
"""Access television feed and enable stills capture"""
def __init__(self):
"""Initalise the thread"""
""" Init inherited thread """
Thread.__init__(self)
' Use gui interface to start the feed '
screenWidth, screenHeight = pyautogui.size()
pyautogui.mo... | the_stack_v2_python_sparse | feed.py | ashleyjr/Countdown | train | 0 |
ec829cd3f50a9decbeeb4dd3b0d20ec8cfd03995 | [
"self.ad_attributes = ad_attributes\nself.ad_object_flags = ad_object_flags\nself.destination_guid = destination_guid\nself.error_message = error_message\nself.mismatch_attr_count = mismatch_attr_count\nself.source_guid = source_guid",
"if dictionary is None:\n return None\nad_attributes = None\nif dictionary.... | <|body_start_0|>
self.ad_attributes = ad_attributes
self.ad_object_flags = ad_object_flags
self.destination_guid = destination_guid
self.error_message = error_message
self.mismatch_attr_count = mismatch_attr_count
self.source_guid = source_guid
<|end_body_0|>
<|body_star... | Implementation of the 'ComparedADObject' model. Represents the details about an AD object and its properties. The attributes of the AD Object contain the information about whether they are equal on both Snapshot AD and Production AD as well as value of attribute on both Production and Snapshot AD. Attributes: ad_attrib... | ComparedADObject | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ComparedADObject:
"""Implementation of the 'ComparedADObject' model. Represents the details about an AD object and its properties. The attributes of the AD Object contain the information about whether they are equal on both Snapshot AD and Production AD as well as value of attribute on both Produ... | stack_v2_sparse_classes_36k_train_005257 | 4,718 | permissive | [
{
"docstring": "Constructor for the ComparedADObject class",
"name": "__init__",
"signature": "def __init__(self, ad_attributes=None, ad_object_flags=None, destination_guid=None, error_message=None, mismatch_attr_count=None, source_guid=None)"
},
{
"docstring": "Creates an instance of this model... | 2 | null | Implement the Python class `ComparedADObject` described below.
Class description:
Implementation of the 'ComparedADObject' model. Represents the details about an AD object and its properties. The attributes of the AD Object contain the information about whether they are equal on both Snapshot AD and Production AD as w... | Implement the Python class `ComparedADObject` described below.
Class description:
Implementation of the 'ComparedADObject' model. Represents the details about an AD object and its properties. The attributes of the AD Object contain the information about whether they are equal on both Snapshot AD and Production AD as w... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class ComparedADObject:
"""Implementation of the 'ComparedADObject' model. Represents the details about an AD object and its properties. The attributes of the AD Object contain the information about whether they are equal on both Snapshot AD and Production AD as well as value of attribute on both Produ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ComparedADObject:
"""Implementation of the 'ComparedADObject' model. Represents the details about an AD object and its properties. The attributes of the AD Object contain the information about whether they are equal on both Snapshot AD and Production AD as well as value of attribute on both Production and Sna... | the_stack_v2_python_sparse | cohesity_management_sdk/models/compared_ad_object.py | cohesity/management-sdk-python | train | 24 |
32782efa9947842511be3bc886cf221e7372ca55 | [
"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... | 更新和删除地址 | UpdateDeleteAddressView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UpdateDeleteAddressView:
"""更新和删除地址"""
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_36k_train_005258 | 26,474 | no_license | [
{
"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_010032 | Implement the Python class `UpdateDeleteAddressView` described below.
Class description:
更新和删除地址
Method signatures and docstrings:
- def put(self, request, address_id): 更新地址
- def delete(self, request, address_id): 删除地址 | Implement the Python class `UpdateDeleteAddressView` described below.
Class description:
更新和删除地址
Method signatures and docstrings:
- def put(self, request, address_id): 更新地址
- def delete(self, request, address_id): 删除地址
<|skeleton|>
class UpdateDeleteAddressView:
"""更新和删除地址"""
def put(self, request, address... | e3976cbb9e96a1558f4e00abed1c61d887f915b1 | <|skeleton|>
class UpdateDeleteAddressView:
"""更新和删除地址"""
def put(self, request, address_id):
"""更新地址"""
<|body_0|>
def delete(self, request, address_id):
"""删除地址"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UpdateDeleteAddressView:
"""更新和删除地址"""
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_i... | the_stack_v2_python_sparse | meiduo_mall/meiduo_mall/apps/users/views.py | yi0506/meiduo | train | 0 |
b56156379b43fe1b74e6676f88816ba81dbce9cb | [
"self.condset = condset\nself.label = label\nself.condsupCount, self.rulesupCount = self.calculate_supCount(data_list)\nself.confidence = self.calculate_confidence()\nself.support = self.calculate_support(data_list)",
"condsupCount = 0\nrulesupCount = 0\nfor data in data_list:\n covered = True\n for index i... | <|body_start_0|>
self.condset = condset
self.label = label
self.condsupCount, self.rulesupCount = self.calculate_supCount(data_list)
self.confidence = self.calculate_confidence()
self.support = self.calculate_support(data_list)
<|end_body_0|>
<|body_start_1|>
condsupCoun... | Build the class RuleItem, including condset, class label y, condsupCount, rulesupCount, support and confidence. Input: condset which include a set of items, label and the data_list. Output: a ruleitem with the value of condsupCount, rulesupCount, support and confidence. | RuleItem | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RuleItem:
"""Build the class RuleItem, including condset, class label y, condsupCount, rulesupCount, support and confidence. Input: condset which include a set of items, label and the data_list. Output: a ruleitem with the value of condsupCount, rulesupCount, support and confidence."""
def _... | stack_v2_sparse_classes_36k_train_005259 | 2,557 | no_license | [
{
"docstring": "According to the paper, each frequent k-ruleitems consists of the following: condset: a dictiondary that has key-value pair {\"item name: value, item name: value...}, where the item name are name of the column attributes. condsupCount: the support count of condset rulesupCount: the support count... | 4 | stack_v2_sparse_classes_30k_test_000886 | Implement the Python class `RuleItem` described below.
Class description:
Build the class RuleItem, including condset, class label y, condsupCount, rulesupCount, support and confidence. Input: condset which include a set of items, label and the data_list. Output: a ruleitem with the value of condsupCount, rulesupCount... | Implement the Python class `RuleItem` described below.
Class description:
Build the class RuleItem, including condset, class label y, condsupCount, rulesupCount, support and confidence. Input: condset which include a set of items, label and the data_list. Output: a ruleitem with the value of condsupCount, rulesupCount... | afe6e0df81c302ef57e2608ea371025366a64a5f | <|skeleton|>
class RuleItem:
"""Build the class RuleItem, including condset, class label y, condsupCount, rulesupCount, support and confidence. Input: condset which include a set of items, label and the data_list. Output: a ruleitem with the value of condsupCount, rulesupCount, support and confidence."""
def _... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RuleItem:
"""Build the class RuleItem, including condset, class label y, condsupCount, rulesupCount, support and confidence. Input: condset which include a set of items, label and the data_list. Output: a ruleitem with the value of condsupCount, rulesupCount, support and confidence."""
def __init__(self,... | the_stack_v2_python_sparse | code/ruleitem.py | C190194/Data-Mining-Project-1 | train | 0 |
ff3e3a3373254bb8a5c29f881391c3bae2aab43f | [
"artify_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\nartify_socket.connect((host, port))\nreturn artify_socket",
"artify_socket = SocketConnection.open_socket()\nartify_socket.sendall(message.encode())\nartify_socket.close()"
] | <|body_start_0|>
artify_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
artify_socket.connect((host, port))
return artify_socket
<|end_body_0|>
<|body_start_1|>
artify_socket = SocketConnection.open_socket()
artify_socket.sendall(message.encode())
artify_socke... | SocketConnection | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SocketConnection:
def open_socket(host=Constants.LOCALHOST, port=Constants.PORT_CORE):
"""Args: host (string): host IP port (int): host port func open socket by host and port and returned socket client. Returns artify_socket (socket): connected client socked."""
<|body_0|>
d... | stack_v2_sparse_classes_36k_train_005260 | 1,066 | no_license | [
{
"docstring": "Args: host (string): host IP port (int): host port func open socket by host and port and returned socket client. Returns artify_socket (socket): connected client socked.",
"name": "open_socket",
"signature": "def open_socket(host=Constants.LOCALHOST, port=Constants.PORT_CORE)"
},
{
... | 2 | stack_v2_sparse_classes_30k_train_003101 | Implement the Python class `SocketConnection` described below.
Class description:
Implement the SocketConnection class.
Method signatures and docstrings:
- def open_socket(host=Constants.LOCALHOST, port=Constants.PORT_CORE): Args: host (string): host IP port (int): host port func open socket by host and port and retu... | Implement the Python class `SocketConnection` described below.
Class description:
Implement the SocketConnection class.
Method signatures and docstrings:
- def open_socket(host=Constants.LOCALHOST, port=Constants.PORT_CORE): Args: host (string): host IP port (int): host port func open socket by host and port and retu... | 8ea1de1bfbef03da2b253565cbd74d5b02834b5f | <|skeleton|>
class SocketConnection:
def open_socket(host=Constants.LOCALHOST, port=Constants.PORT_CORE):
"""Args: host (string): host IP port (int): host port func open socket by host and port and returned socket client. Returns artify_socket (socket): connected client socked."""
<|body_0|>
d... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SocketConnection:
def open_socket(host=Constants.LOCALHOST, port=Constants.PORT_CORE):
"""Args: host (string): host IP port (int): host port func open socket by host and port and returned socket client. Returns artify_socket (socket): connected client socked."""
artify_socket = socket.socket(s... | the_stack_v2_python_sparse | utils/socket_connect.py | Reennon/ArtifyAPI | train | 2 | |
4d7dfbd2850a6f95d8e71eeee582e935f8dea9ef | [
"group = Group.objects.get(name='teacher')\nusers = group.user_set.all()\nchoices = [(user.id, _('%s' % (user.username,))) for user in users]\nreturn choices",
"if self.value():\n return queryset.filter(goods__teacher__id=self.value())\nreturn queryset"
] | <|body_start_0|>
group = Group.objects.get(name='teacher')
users = group.user_set.all()
choices = [(user.id, _('%s' % (user.username,))) for user in users]
return choices
<|end_body_0|>
<|body_start_1|>
if self.value():
return queryset.filter(goods__teacher__id=self.... | OrderGoodsListFilter | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OrderGoodsListFilter:
def lookups(self, request, model_admin):
"""Returns a list of tuples. The first element in each tuple is the coded value for the option that will appear in the URL query. The second element is the human-readable name for the option that will appear in the right side... | stack_v2_sparse_classes_36k_train_005261 | 8,580 | no_license | [
{
"docstring": "Returns a list of tuples. The first element in each tuple is the coded value for the option that will appear in the URL query. The second element is the human-readable name for the option that will appear in the right sidebar.",
"name": "lookups",
"signature": "def lookups(self, request,... | 2 | null | Implement the Python class `OrderGoodsListFilter` described below.
Class description:
Implement the OrderGoodsListFilter class.
Method signatures and docstrings:
- def lookups(self, request, model_admin): Returns a list of tuples. The first element in each tuple is the coded value for the option that will appear in t... | Implement the Python class `OrderGoodsListFilter` described below.
Class description:
Implement the OrderGoodsListFilter class.
Method signatures and docstrings:
- def lookups(self, request, model_admin): Returns a list of tuples. The first element in each tuple is the coded value for the option that will appear in t... | 25a568c5203d05a00bce139d084da6d7622b9956 | <|skeleton|>
class OrderGoodsListFilter:
def lookups(self, request, model_admin):
"""Returns a list of tuples. The first element in each tuple is the coded value for the option that will appear in the URL query. The second element is the human-readable name for the option that will appear in the right side... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class OrderGoodsListFilter:
def lookups(self, request, model_admin):
"""Returns a list of tuples. The first element in each tuple is the coded value for the option that will appear in the URL query. The second element is the human-readable name for the option that will appear in the right sidebar."""
... | the_stack_v2_python_sparse | apps/trade/admin.py | 846468230/store | train | 0 | |
1ac51ac4f162da7dfd0b795aff5b83b7cf69f7d1 | [
"clients_params = np.array(params)\nfor i, v in enumerate(clients_params):\n norm = LA.norm(v)\n clients_params[i] = np.multiply(v, min(1, self._clip / norm))\n clients_params[i] += np.random.normal(loc=0.0, scale=0.025, size=v.shape)\nreturn np.mean(clients_params, axis=0)",
"serialized_params = np.arra... | <|body_start_0|>
clients_params = np.array(params)
for i, v in enumerate(clients_params):
norm = LA.norm(v)
clients_params[i] = np.multiply(v, min(1, self._clip / norm))
clients_params[i] += np.random.normal(loc=0.0, scale=0.025, size=v.shape)
return np.mean(c... | WeakDPAggregator | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WeakDPAggregator:
def _aggregate(self, *params):
"""Aggregation of arrays"""
<|body_0|>
def _aggregate(self, *params):
"""Aggregation of (nested) lists of arrays"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
clients_params = np.array(params)
... | stack_v2_sparse_classes_36k_train_005262 | 2,865 | permissive | [
{
"docstring": "Aggregation of arrays",
"name": "_aggregate",
"signature": "def _aggregate(self, *params)"
},
{
"docstring": "Aggregation of (nested) lists of arrays",
"name": "_aggregate",
"signature": "def _aggregate(self, *params)"
}
] | 2 | stack_v2_sparse_classes_30k_train_000586 | Implement the Python class `WeakDPAggregator` described below.
Class description:
Implement the WeakDPAggregator class.
Method signatures and docstrings:
- def _aggregate(self, *params): Aggregation of arrays
- def _aggregate(self, *params): Aggregation of (nested) lists of arrays | Implement the Python class `WeakDPAggregator` described below.
Class description:
Implement the WeakDPAggregator class.
Method signatures and docstrings:
- def _aggregate(self, *params): Aggregation of arrays
- def _aggregate(self, *params): Aggregation of (nested) lists of arrays
<|skeleton|>
class WeakDPAggregator... | 72f9e3b2ac2d282cbf3705ceb17223529102c8d8 | <|skeleton|>
class WeakDPAggregator:
def _aggregate(self, *params):
"""Aggregation of arrays"""
<|body_0|>
def _aggregate(self, *params):
"""Aggregation of (nested) lists of arrays"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class WeakDPAggregator:
def _aggregate(self, *params):
"""Aggregation of arrays"""
clients_params = np.array(params)
for i, v in enumerate(clients_params):
norm = LA.norm(v)
clients_params[i] = np.multiply(v, min(1, self._clip / norm))
clients_params[i] +=... | the_stack_v2_python_sparse | shfl/federated_aggregator/norm_clip_aggregators.py | yourLeilei/Sherpa.ai-Federated-Learning-Framework | train | 0 | |
7c70857c388850d1f8ea1f2659c2e7eb4a4829e4 | [
"bleached_message = bleach.clean(message, tags=self.VALID_TAGS, attributes=self.VALID_ATTRS, protocols=self.VALID_SCHEMES, strip=True)\nsoup = BeautifulSoup(bleached_message, 'lxml')\nfor tag in soup.findAll():\n if tag.name not in self.VALID_TAGS:\n tag.hidden = True\n for attr, value in dict(tag.attr... | <|body_start_0|>
bleached_message = bleach.clean(message, tags=self.VALID_TAGS, attributes=self.VALID_ATTRS, protocols=self.VALID_SCHEMES, strip=True)
soup = BeautifulSoup(bleached_message, 'lxml')
for tag in soup.findAll():
if tag.name not in self.VALID_TAGS:
tag.hid... | Mixin that sanitizes user-submitted HTML | SanitizeHTMLMixin | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SanitizeHTMLMixin:
"""Mixin that sanitizes user-submitted HTML"""
def _cleanse_tags(self, message):
"""Using BeautifulSoup and bleach, remove or modify bad tags & attrs"""
<|body_0|>
def sanitize_html(self, message):
"""Sanitize user-submitted HTML"""
<|b... | stack_v2_sparse_classes_36k_train_005263 | 10,882 | permissive | [
{
"docstring": "Using BeautifulSoup and bleach, remove or modify bad tags & attrs",
"name": "_cleanse_tags",
"signature": "def _cleanse_tags(self, message)"
},
{
"docstring": "Sanitize user-submitted HTML",
"name": "sanitize_html",
"signature": "def sanitize_html(self, message)"
}
] | 2 | null | Implement the Python class `SanitizeHTMLMixin` described below.
Class description:
Mixin that sanitizes user-submitted HTML
Method signatures and docstrings:
- def _cleanse_tags(self, message): Using BeautifulSoup and bleach, remove or modify bad tags & attrs
- def sanitize_html(self, message): Sanitize user-submitte... | Implement the Python class `SanitizeHTMLMixin` described below.
Class description:
Mixin that sanitizes user-submitted HTML
Method signatures and docstrings:
- def _cleanse_tags(self, message): Using BeautifulSoup and bleach, remove or modify bad tags & attrs
- def sanitize_html(self, message): Sanitize user-submitte... | a56c0f89df82694bf5db32a04d8b092974791972 | <|skeleton|>
class SanitizeHTMLMixin:
"""Mixin that sanitizes user-submitted HTML"""
def _cleanse_tags(self, message):
"""Using BeautifulSoup and bleach, remove or modify bad tags & attrs"""
<|body_0|>
def sanitize_html(self, message):
"""Sanitize user-submitted HTML"""
<|b... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SanitizeHTMLMixin:
"""Mixin that sanitizes user-submitted HTML"""
def _cleanse_tags(self, message):
"""Using BeautifulSoup and bleach, remove or modify bad tags & attrs"""
bleached_message = bleach.clean(message, tags=self.VALID_TAGS, attributes=self.VALID_ATTRS, protocols=self.VALID_SCHE... | the_stack_v2_python_sparse | open_connect/connect_core/utils/mixins.py | ofa/connect | train | 66 |
b0f13c559f17bda32fd124b89528b62bcf36d99e | [
"if not root:\n return ''\nresult = ''\nbfs_queue = deque([root])\nwhile bfs_queue:\n p = bfs_queue.popleft()\n if p:\n result += str(p.val) + ','\n bfs_queue.append(p.left)\n bfs_queue.append(p.right)\n else:\n result += 'None' + ','\nprint(result[:-1])\nreturn result[:-1]",... | <|body_start_0|>
if not root:
return ''
result = ''
bfs_queue = deque([root])
while bfs_queue:
p = bfs_queue.popleft()
if p:
result += str(p.val) + ','
bfs_queue.append(p.left)
bfs_queue.append(p.right)
... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|>
<|body_... | stack_v2_sparse_classes_36k_train_005264 | 1,942 | no_license | [
{
"docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str",
"name": "serialize",
"signature": "def serialize(self, root)"
},
{
"docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode",
"name": "deserialize",
"signature": "def deserializ... | 2 | null | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:... | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:... | 7818b55f22afb178dfd250f26019653faadfee87 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
if not root:
return ''
result = ''
bfs_queue = deque([root])
while bfs_queue:
p = bfs_queue.popleft()
if p:
re... | the_stack_v2_python_sparse | LeetcodePython3/q0297.py | YujiaY/leetCodePractice | train | 0 | |
ee4e995382a917b0dc4c4e5936c6dcc6011607e8 | [
"query = Session.query(Movie).filter(Movie.title == item.title)\nresult = query.first()\nreturn result",
"query = Session.query(Movie.title)\nresult = query.all()\ntitle_list = [title for title, in result]\none_item = process.extractOne(title, title_list)\nif one_item:\n result_title, ratio = one_item\nelse:\n... | <|body_start_0|>
query = Session.query(Movie).filter(Movie.title == item.title)
result = query.first()
return result
<|end_body_0|>
<|body_start_1|>
query = Session.query(Movie.title)
result = query.all()
title_list = [title for title, in result]
one_item = proce... | Movie | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Movie:
def get_movie_if_exist(item):
"""Get movie if exists else return None. Judged by title"""
<|body_0|>
def get_by_title(title):
"""fuzzy search movie item from database"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
query = Session.query(Movie... | stack_v2_sparse_classes_36k_train_005265 | 1,242 | permissive | [
{
"docstring": "Get movie if exists else return None. Judged by title",
"name": "get_movie_if_exist",
"signature": "def get_movie_if_exist(item)"
},
{
"docstring": "fuzzy search movie item from database",
"name": "get_by_title",
"signature": "def get_by_title(title)"
}
] | 2 | stack_v2_sparse_classes_30k_train_002914 | Implement the Python class `Movie` described below.
Class description:
Implement the Movie class.
Method signatures and docstrings:
- def get_movie_if_exist(item): Get movie if exists else return None. Judged by title
- def get_by_title(title): fuzzy search movie item from database | Implement the Python class `Movie` described below.
Class description:
Implement the Movie class.
Method signatures and docstrings:
- def get_movie_if_exist(item): Get movie if exists else return None. Judged by title
- def get_by_title(title): fuzzy search movie item from database
<|skeleton|>
class Movie:
def... | 67c7b963914565589f64dd1bcf18839a4160ea34 | <|skeleton|>
class Movie:
def get_movie_if_exist(item):
"""Get movie if exists else return None. Judged by title"""
<|body_0|>
def get_by_title(title):
"""fuzzy search movie item from database"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Movie:
def get_movie_if_exist(item):
"""Get movie if exists else return None. Judged by title"""
query = Session.query(Movie).filter(Movie.title == item.title)
result = query.first()
return result
def get_by_title(title):
"""fuzzy search movie item from database"""... | the_stack_v2_python_sparse | scrapyproject/models/movie.py | gas1121/JapanCinemaStatusSpider | train | 2 | |
abb52a4a61bbfdebb958e6b1fefc40fe8b1e5d09 | [
"self.datastore_entity_vec = datastore_entity_vec\nself.network_config = network_config\nself.parent_source = parent_source\nself.rename_object_params = rename_object_params\nself.resource_pool_entity = resource_pool_entity\nself.target_datastore_folder = target_datastore_folder\nself.target_vm_folder = target_vm_f... | <|body_start_0|>
self.datastore_entity_vec = datastore_entity_vec
self.network_config = network_config
self.parent_source = parent_source
self.rename_object_params = rename_object_params
self.resource_pool_entity = resource_pool_entity
self.target_datastore_folder = targe... | Implementation of the 'VmwareStandbyResource' model. TODO: type description here. Attributes: datastore_entity_vec (list of EntityProto): Datastore entities where the standby VM should be created. network_config (RestoredObjectNetworkConfigProto): Network configuration for the standby VM. parent_source (EntityProto): T... | VmwareStandbyResource | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VmwareStandbyResource:
"""Implementation of the 'VmwareStandbyResource' model. TODO: type description here. Attributes: datastore_entity_vec (list of EntityProto): Datastore entities where the standby VM should be created. network_config (RestoredObjectNetworkConfigProto): Network configuration f... | stack_v2_sparse_classes_36k_train_005266 | 4,811 | permissive | [
{
"docstring": "Constructor for the VmwareStandbyResource class",
"name": "__init__",
"signature": "def __init__(self, datastore_entity_vec=None, network_config=None, parent_source=None, rename_object_params=None, resource_pool_entity=None, target_datastore_folder=None, target_vm_folder=None)"
},
{
... | 2 | stack_v2_sparse_classes_30k_train_012758 | Implement the Python class `VmwareStandbyResource` described below.
Class description:
Implementation of the 'VmwareStandbyResource' model. TODO: type description here. Attributes: datastore_entity_vec (list of EntityProto): Datastore entities where the standby VM should be created. network_config (RestoredObjectNetwo... | Implement the Python class `VmwareStandbyResource` described below.
Class description:
Implementation of the 'VmwareStandbyResource' model. TODO: type description here. Attributes: datastore_entity_vec (list of EntityProto): Datastore entities where the standby VM should be created. network_config (RestoredObjectNetwo... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class VmwareStandbyResource:
"""Implementation of the 'VmwareStandbyResource' model. TODO: type description here. Attributes: datastore_entity_vec (list of EntityProto): Datastore entities where the standby VM should be created. network_config (RestoredObjectNetworkConfigProto): Network configuration f... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class VmwareStandbyResource:
"""Implementation of the 'VmwareStandbyResource' model. TODO: type description here. Attributes: datastore_entity_vec (list of EntityProto): Datastore entities where the standby VM should be created. network_config (RestoredObjectNetworkConfigProto): Network configuration for the standb... | the_stack_v2_python_sparse | cohesity_management_sdk/models/vmware_standby_resource.py | cohesity/management-sdk-python | train | 24 |
a9e638f02adfcb4d4fdb6c80574711e2977cc42c | [
"self.logger = logger\nself.subprocess = subprocess\nself.cwd = cwd\nself.CommandResult = CommandResult",
"command = command.split(' ')\nprocess = self.subprocess.Popen(command, cwd=self.cwd, env=env, stdout=self.subprocess.PIPE, stderr=self.subprocess.PIPE)\nstdout, stderr = process.communicate()\nexit_code = pr... | <|body_start_0|>
self.logger = logger
self.subprocess = subprocess
self.cwd = cwd
self.CommandResult = CommandResult
<|end_body_0|>
<|body_start_1|>
command = command.split(' ')
process = self.subprocess.Popen(command, cwd=self.cwd, env=env, stdout=self.subprocess.PIPE, ... | CommandRunner | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CommandRunner:
def __init__(self, logger, subprocess, CommandResult, cwd='.'):
"""On the "cwd", this is the directory we start at. For example, if we have a script in "/script/hello.sh" we could set the cwd to "/script" and the command could just be "./hello.sh" Args: logger(logging.Logg... | stack_v2_sparse_classes_36k_train_005267 | 1,519 | permissive | [
{
"docstring": "On the \"cwd\", this is the directory we start at. For example, if we have a script in \"/script/hello.sh\" we could set the cwd to \"/script\" and the command could just be \"./hello.sh\" Args: logger(logging.Logger) subprocess(subprocess) cwd(string) The \"current working directory\". CommandR... | 2 | stack_v2_sparse_classes_30k_train_019246 | Implement the Python class `CommandRunner` described below.
Class description:
Implement the CommandRunner class.
Method signatures and docstrings:
- def __init__(self, logger, subprocess, CommandResult, cwd='.'): On the "cwd", this is the directory we start at. For example, if we have a script in "/script/hello.sh" ... | Implement the Python class `CommandRunner` described below.
Class description:
Implement the CommandRunner class.
Method signatures and docstrings:
- def __init__(self, logger, subprocess, CommandResult, cwd='.'): On the "cwd", this is the directory we start at. For example, if we have a script in "/script/hello.sh" ... | ea59703082402ad3b6454482f0487418295fbd19 | <|skeleton|>
class CommandRunner:
def __init__(self, logger, subprocess, CommandResult, cwd='.'):
"""On the "cwd", this is the directory we start at. For example, if we have a script in "/script/hello.sh" we could set the cwd to "/script" and the command could just be "./hello.sh" Args: logger(logging.Logg... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CommandRunner:
def __init__(self, logger, subprocess, CommandResult, cwd='.'):
"""On the "cwd", this is the directory we start at. For example, if we have a script in "/script/hello.sh" we could set the cwd to "/script" and the command could just be "./hello.sh" Args: logger(logging.Logger) subprocess... | the_stack_v2_python_sparse | shelf/hook/background/command_runner.py | bfilipov/shelf | train | 0 | |
7a9c378d91253808bbe5354da282174d2e198ab4 | [
"if len(s) == 0:\n return ' '\ns_dict = {}\nfor i, c in enumerate(s):\n if s_dict.get(c):\n s_dict[c][1] = s_dict[c][1] + 1\n else:\n s_dict.setdefault(c, [i, 1])\nnum_1_c = []\nfor key in s_dict:\n if s_dict[key][1] == 1:\n num_1_c.append([key, s_dict[key][0]])\nreturn sorted(num_1... | <|body_start_0|>
if len(s) == 0:
return ' '
s_dict = {}
for i, c in enumerate(s):
if s_dict.get(c):
s_dict[c][1] = s_dict[c][1] + 1
else:
s_dict.setdefault(c, [i, 1])
num_1_c = []
for key in s_dict:
i... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def firstUniqChar(self, s):
"""在字符串 s 中找出第一个只出现一次的字符。如果没有,返回一个单空格。 s 只包含小写字母。 :type s: str :rtype: str"""
<|body_0|>
def firstUniqChar2(self, s):
""":type s: str :rtype: str"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if len(s) == 0:
... | stack_v2_sparse_classes_36k_train_005268 | 1,136 | no_license | [
{
"docstring": "在字符串 s 中找出第一个只出现一次的字符。如果没有,返回一个单空格。 s 只包含小写字母。 :type s: str :rtype: str",
"name": "firstUniqChar",
"signature": "def firstUniqChar(self, s)"
},
{
"docstring": ":type s: str :rtype: str",
"name": "firstUniqChar2",
"signature": "def firstUniqChar2(self, s)"
}
] | 2 | stack_v2_sparse_classes_30k_train_015434 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def firstUniqChar(self, s): 在字符串 s 中找出第一个只出现一次的字符。如果没有,返回一个单空格。 s 只包含小写字母。 :type s: str :rtype: str
- def firstUniqChar2(self, s): :type s: str :rtype: str | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def firstUniqChar(self, s): 在字符串 s 中找出第一个只出现一次的字符。如果没有,返回一个单空格。 s 只包含小写字母。 :type s: str :rtype: str
- def firstUniqChar2(self, s): :type s: str :rtype: str
<|skeleton|>
class So... | 97cc61fefe0bedf5161687aab92fb09b0df990e2 | <|skeleton|>
class Solution:
def firstUniqChar(self, s):
"""在字符串 s 中找出第一个只出现一次的字符。如果没有,返回一个单空格。 s 只包含小写字母。 :type s: str :rtype: str"""
<|body_0|>
def firstUniqChar2(self, s):
""":type s: str :rtype: str"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def firstUniqChar(self, s):
"""在字符串 s 中找出第一个只出现一次的字符。如果没有,返回一个单空格。 s 只包含小写字母。 :type s: str :rtype: str"""
if len(s) == 0:
return ' '
s_dict = {}
for i, c in enumerate(s):
if s_dict.get(c):
s_dict[c][1] = s_dict[c][1] + 1
... | the_stack_v2_python_sparse | code/other/first_appear_char.py | JiaXingBinggan/For_work | train | 0 | |
04e09c95b452b28a4575e817943c51407109db12 | [
"def _get_next_moves(move_id):\n if move_id:\n next_moves = _get_next_moves(fields.first(move_id.move_dest_ids))\n if next_moves:\n return move_id | next_moves\n else:\n return move_id\n return False\nself._check_change_permitted()\nres = super(ChangeProductionQty, s... | <|body_start_0|>
def _get_next_moves(move_id):
if move_id:
next_moves = _get_next_moves(fields.first(move_id.move_dest_ids))
if next_moves:
return move_id | next_moves
else:
return move_id
return Fals... | ChangeProductionQty | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ChangeProductionQty:
def change_prod_qty(self):
"""When the production quantity is changed, also change the quantity of related moves"""
<|body_0|>
def _check_change_permitted(self):
"""Check increase or decrease percentage is not more than 10%"""
<|body_1|>
... | stack_v2_sparse_classes_36k_train_005269 | 1,817 | no_license | [
{
"docstring": "When the production quantity is changed, also change the quantity of related moves",
"name": "change_prod_qty",
"signature": "def change_prod_qty(self)"
},
{
"docstring": "Check increase or decrease percentage is not more than 10%",
"name": "_check_change_permitted",
"sig... | 2 | stack_v2_sparse_classes_30k_train_018131 | Implement the Python class `ChangeProductionQty` described below.
Class description:
Implement the ChangeProductionQty class.
Method signatures and docstrings:
- def change_prod_qty(self): When the production quantity is changed, also change the quantity of related moves
- def _check_change_permitted(self): Check inc... | Implement the Python class `ChangeProductionQty` described below.
Class description:
Implement the ChangeProductionQty class.
Method signatures and docstrings:
- def change_prod_qty(self): When the production quantity is changed, also change the quantity of related moves
- def _check_change_permitted(self): Check inc... | c04e2b9730db07848c153d8245d2df65ec4e2c8f | <|skeleton|>
class ChangeProductionQty:
def change_prod_qty(self):
"""When the production quantity is changed, also change the quantity of related moves"""
<|body_0|>
def _check_change_permitted(self):
"""Check increase or decrease percentage is not more than 10%"""
<|body_1|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ChangeProductionQty:
def change_prod_qty(self):
"""When the production quantity is changed, also change the quantity of related moves"""
def _get_next_moves(move_id):
if move_id:
next_moves = _get_next_moves(fields.first(move_id.move_dest_ids))
if ne... | the_stack_v2_python_sparse | altinkaya_mrp/wizard/change_production_qty.py | aaltinisik/customaddons | train | 15 | |
662b8a407c6d6b1050f1a85a54564417cc339699 | [
"cfac = np.sqrt(2) / 2\nself.pnt = cfac * np.array([[0.5, 0.5, 0.0], [-0.5, -0.5, 0.0], [0.5, -0.5, 0.0], [-0.5, 0.5, 0.0], [0.5, 0.0, 0.5], [-0.5, 0.0, -0.5], [-0.5, 0.0, 0.5], [0.5, 0.0, -0.5], [0.0, 0.5, 0.5], [0.0, -0.5, -0.5], [0.0, 0.5, -0.5], [0.0, -0.5, 0.5], [1.0, 0.0, 0.0], [-1.0, 0.0, 0.0], [0.0, 1.0, 0.... | <|body_start_0|>
cfac = np.sqrt(2) / 2
self.pnt = cfac * np.array([[0.5, 0.5, 0.0], [-0.5, -0.5, 0.0], [0.5, -0.5, 0.0], [-0.5, 0.5, 0.0], [0.5, 0.0, 0.5], [-0.5, 0.0, -0.5], [-0.5, 0.0, 0.5], [0.5, 0.0, -0.5], [0.0, 0.5, 0.5], [0.0, -0.5, -0.5], [0.0, 0.5, -0.5], [0.0, -0.5, 0.5], [1.0, 0.0, 0.0], [-1.... | Defines points that fall within the unit cell of a fcc lattice | NanoFcc | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NanoFcc:
"""Defines points that fall within the unit cell of a fcc lattice"""
def __init__(self, radius):
"""The constructor particles are assumed to have diameter 1. All units are relative to this one :param radius: radius of unit cell"""
<|body_0|>
def check_point(self... | stack_v2_sparse_classes_36k_train_005270 | 4,924 | no_license | [
{
"docstring": "The constructor particles are assumed to have diameter 1. All units are relative to this one :param radius: radius of unit cell",
"name": "__init__",
"signature": "def __init__(self, radius)"
},
{
"docstring": "Checks whether a point is within the unit cell :param pnt: given poin... | 2 | stack_v2_sparse_classes_30k_train_021333 | Implement the Python class `NanoFcc` described below.
Class description:
Defines points that fall within the unit cell of a fcc lattice
Method signatures and docstrings:
- def __init__(self, radius): The constructor particles are assumed to have diameter 1. All units are relative to this one :param radius: radius of ... | Implement the Python class `NanoFcc` described below.
Class description:
Defines points that fall within the unit cell of a fcc lattice
Method signatures and docstrings:
- def __init__(self, radius): The constructor particles are assumed to have diameter 1. All units are relative to this one :param radius: radius of ... | 351fde195f54d9af205e8abad217751121b25e6c | <|skeleton|>
class NanoFcc:
"""Defines points that fall within the unit cell of a fcc lattice"""
def __init__(self, radius):
"""The constructor particles are assumed to have diameter 1. All units are relative to this one :param radius: radius of unit cell"""
<|body_0|>
def check_point(self... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NanoFcc:
"""Defines points that fall within the unit cell of a fcc lattice"""
def __init__(self, radius):
"""The constructor particles are assumed to have diameter 1. All units are relative to this one :param radius: radius of unit cell"""
cfac = np.sqrt(2) / 2
self.pnt = cfac * n... | the_stack_v2_python_sparse | build/particles/nanoparticle_core.py | nathanhorst/MD | train | 0 |
42914637a58c9b2509dc8d1e541b0a1aee3af026 | [
"self.mhdr = MACHeader(JOIN_ACCEPT, LORAWAN_R1)\nself.appkey = appkey\nself.appnonce = appnonce\nself.netid = netid\nself.devaddr = devaddr\nself.dlsettings = dlsettings\nself.rxdelay = rxdelay\nself.cflist = cflist\nself.mic = None",
"header = self.mhdr.encode()\nmsg = intPackBytes(self.appnonce, 3, endian='litt... | <|body_start_0|>
self.mhdr = MACHeader(JOIN_ACCEPT, LORAWAN_R1)
self.appkey = appkey
self.appnonce = appnonce
self.netid = netid
self.devaddr = devaddr
self.dlsettings = dlsettings
self.rxdelay = rxdelay
self.cflist = cflist
self.mic = None
<|end_b... | A LoRa Join Accept message. The join accept message contains an application nonce of 3 octets (appnonce), 3 octet a network identifier (netid), a 4 octet device address (devaddr), a 1 octet delay between tx and rx (rxdelay) and an optional list of channel frequencies (cflist). Attributes: mhdr (MACHeader): MAC header a... | JoinAcceptMessage | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class JoinAcceptMessage:
"""A LoRa Join Accept message. The join accept message contains an application nonce of 3 octets (appnonce), 3 octet a network identifier (netid), a 4 octet device address (devaddr), a 1 octet delay between tx and rx (rxdelay) and an optional list of channel frequencies (cflist... | stack_v2_sparse_classes_36k_train_005271 | 26,915 | permissive | [
{
"docstring": "JoinAcceptMessage initialisation method.",
"name": "__init__",
"signature": "def __init__(self, appkey, appnonce, netid, devaddr, dlsettings, rxdelay, cflist=[])"
},
{
"docstring": "Create a binary representation of JoinAcceptMessage object. Returns: Packed JoinAccept message.",
... | 2 | stack_v2_sparse_classes_30k_train_020901 | Implement the Python class `JoinAcceptMessage` described below.
Class description:
A LoRa Join Accept message. The join accept message contains an application nonce of 3 octets (appnonce), 3 octet a network identifier (netid), a 4 octet device address (devaddr), a 1 octet delay between tx and rx (rxdelay) and an optio... | Implement the Python class `JoinAcceptMessage` described below.
Class description:
A LoRa Join Accept message. The join accept message contains an application nonce of 3 octets (appnonce), 3 octet a network identifier (netid), a 4 octet device address (devaddr), a 1 octet delay between tx and rx (rxdelay) and an optio... | add5a1129296dca6db55b7980c0c1091f1ca80aa | <|skeleton|>
class JoinAcceptMessage:
"""A LoRa Join Accept message. The join accept message contains an application nonce of 3 octets (appnonce), 3 octet a network identifier (netid), a 4 octet device address (devaddr), a 1 octet delay between tx and rx (rxdelay) and an optional list of channel frequencies (cflist... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class JoinAcceptMessage:
"""A LoRa Join Accept message. The join accept message contains an application nonce of 3 octets (appnonce), 3 octet a network identifier (netid), a 4 octet device address (devaddr), a 1 octet delay between tx and rx (rxdelay) and an optional list of channel frequencies (cflist). Attributes... | the_stack_v2_python_sparse | floranet/lora/mac.py | chengzhongkai/floranet | train | 0 |
534f87f72a5e7f27a9d9f89e635dd515e651247e | [
"queryset = super(GroupReportListView, self).get_queryset().extra(select={'reply_count': \"SELECT COUNT(*) from connectmessages_message m JOIN connectmessages_thread t ON m.thread_id = t.id JOIN accounts_user u ON m.sender_id = u.id WHERE t.group_id = groups_group.id AND m.id != t.first_message_id AND u.is_banned ... | <|body_start_0|>
queryset = super(GroupReportListView, self).get_queryset().extra(select={'reply_count': "SELECT COUNT(*) from connectmessages_message m JOIN connectmessages_thread t ON m.thread_id = t.id JOIN accounts_user u ON m.sender_id = u.id WHERE t.group_id = groups_group.id AND m.id != t.first_message_... | View for reporting on groups. | GroupReportListView | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GroupReportListView:
"""View for reporting on groups."""
def get_queryset(self):
"""Update the queryset with some annotations."""
<|body_0|>
def get_context_data(self, **kwargs):
"""Pass in extra context to the view"""
<|body_1|>
def render_to_respon... | stack_v2_sparse_classes_36k_train_005272 | 10,353 | permissive | [
{
"docstring": "Update the queryset with some annotations.",
"name": "get_queryset",
"signature": "def get_queryset(self)"
},
{
"docstring": "Pass in extra context to the view",
"name": "get_context_data",
"signature": "def get_context_data(self, **kwargs)"
},
{
"docstring": "If ... | 3 | stack_v2_sparse_classes_30k_train_013560 | Implement the Python class `GroupReportListView` described below.
Class description:
View for reporting on groups.
Method signatures and docstrings:
- def get_queryset(self): Update the queryset with some annotations.
- def get_context_data(self, **kwargs): Pass in extra context to the view
- def render_to_response(s... | Implement the Python class `GroupReportListView` described below.
Class description:
View for reporting on groups.
Method signatures and docstrings:
- def get_queryset(self): Update the queryset with some annotations.
- def get_context_data(self, **kwargs): Pass in extra context to the view
- def render_to_response(s... | a56c0f89df82694bf5db32a04d8b092974791972 | <|skeleton|>
class GroupReportListView:
"""View for reporting on groups."""
def get_queryset(self):
"""Update the queryset with some annotations."""
<|body_0|>
def get_context_data(self, **kwargs):
"""Pass in extra context to the view"""
<|body_1|>
def render_to_respon... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GroupReportListView:
"""View for reporting on groups."""
def get_queryset(self):
"""Update the queryset with some annotations."""
queryset = super(GroupReportListView, self).get_queryset().extra(select={'reply_count': "SELECT COUNT(*) from connectmessages_message m JOIN connectmessages_th... | the_stack_v2_python_sparse | open_connect/reporting/views.py | ofa/connect | train | 66 |
928817a860114ede9a62f2d3d7a698a7c957ed14 | [
"if os.path.exists('testReadFasta.fas'):\n os.remove('testReadFasta.fas')\nsequenceToWrite = [['ACGT', 'ACGTAATTA']]\nexpectedSequence = ['ACGT', 'ACGTAATTA']\nio().writeFastaFile(sequenceToWrite, 'testReadFasta.fas')\nreadSequence = io().readFastaFile('testReadFasta.fas', multipleSequenceAlignment=False)\nself.... | <|body_start_0|>
if os.path.exists('testReadFasta.fas'):
os.remove('testReadFasta.fas')
sequenceToWrite = [['ACGT', 'ACGTAATTA']]
expectedSequence = ['ACGT', 'ACGTAATTA']
io().writeFastaFile(sequenceToWrite, 'testReadFasta.fas')
readSequence = io().readFastaFile('test... | Test class to check the correctness of the methods in IOHelper. | IOHelperTestClass | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IOHelperTestClass:
"""Test class to check the correctness of the methods in IOHelper."""
def test_readFastaFile(self):
"""Test method to test the correct reading of a fasta file."""
<|body_0|>
def test_writeFastaFile(self):
"""Test method to test the correct writ... | stack_v2_sparse_classes_36k_train_005273 | 3,044 | no_license | [
{
"docstring": "Test method to test the correct reading of a fasta file.",
"name": "test_readFastaFile",
"signature": "def test_readFastaFile(self)"
},
{
"docstring": "Test method to test the correct writing of a fasta file.",
"name": "test_writeFastaFile",
"signature": "def test_writeFa... | 2 | null | Implement the Python class `IOHelperTestClass` described below.
Class description:
Test class to check the correctness of the methods in IOHelper.
Method signatures and docstrings:
- def test_readFastaFile(self): Test method to test the correct reading of a fasta file.
- def test_writeFastaFile(self): Test method to ... | Implement the Python class `IOHelperTestClass` described below.
Class description:
Test class to check the correctness of the methods in IOHelper.
Method signatures and docstrings:
- def test_readFastaFile(self): Test method to test the correct reading of a fasta file.
- def test_writeFastaFile(self): Test method to ... | 20d8df6172906337f81583dabb841d66b8f31857 | <|skeleton|>
class IOHelperTestClass:
"""Test class to check the correctness of the methods in IOHelper."""
def test_readFastaFile(self):
"""Test method to test the correct reading of a fasta file."""
<|body_0|>
def test_writeFastaFile(self):
"""Test method to test the correct writ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class IOHelperTestClass:
"""Test class to check the correctness of the methods in IOHelper."""
def test_readFastaFile(self):
"""Test method to test the correct reading of a fasta file."""
if os.path.exists('testReadFasta.fas'):
os.remove('testReadFasta.fas')
sequenceToWrite ... | the_stack_v2_python_sparse | new_algs/Sequence+algorithms/Needleman-Wunsch+algorithm/IOHelperTest.py | coolsnake/JupyterNotebook | train | 0 |
bfad6bfbc02b9bcd2423361806c38537356f56d4 | [
"def merge_sort(nums, nums_copy, start, end):\n if start >= end:\n return\n start1 = start\n end1 = (start + end) // 2\n start2 = end1 + 1\n end2 = end\n merge_sort(nums, nums_copy, start1, end1)\n merge_sort(nums, nums_copy, start2, end2)\n k = start\n while start1 <= end1 and sta... | <|body_start_0|>
def merge_sort(nums, nums_copy, start, end):
if start >= end:
return
start1 = start
end1 = (start + end) // 2
start2 = end1 + 1
end2 = end
merge_sort(nums, nums_copy, start1, end1)
merge_sort(num... | 执行结果:通过 执行用时:48 ms, 在所有 Python3 提交中击败了15.36%的用户 内存消耗:15 MB, 在所有 Python3 提交中击败了8.49%的用户 自己写的归并排序,有点慢!!! 归并排序的缺点,需要使用O(N)的额外数组空间 | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
"""执行结果:通过 执行用时:48 ms, 在所有 Python3 提交中击败了15.36%的用户 内存消耗:15 MB, 在所有 Python3 提交中击败了8.49%的用户 自己写的归并排序,有点慢!!! 归并排序的缺点,需要使用O(N)的额外数组空间"""
def sortColors(self, nums):
"""Do not return anything, modify nums in-place instead."""
<|body_0|>
def sortColors2(self, nums):
... | stack_v2_sparse_classes_36k_train_005274 | 3,257 | no_license | [
{
"docstring": "Do not return anything, modify nums in-place instead.",
"name": "sortColors",
"signature": "def sortColors(self, nums)"
},
{
"docstring": "Do not return anything, modify nums in-place instead.",
"name": "sortColors2",
"signature": "def sortColors2(self, nums)"
}
] | 2 | stack_v2_sparse_classes_30k_train_001675 | Implement the Python class `Solution` described below.
Class description:
执行结果:通过 执行用时:48 ms, 在所有 Python3 提交中击败了15.36%的用户 内存消耗:15 MB, 在所有 Python3 提交中击败了8.49%的用户 自己写的归并排序,有点慢!!! 归并排序的缺点,需要使用O(N)的额外数组空间
Method signatures and docstrings:
- def sortColors(self, nums): Do not return anything, modify nums in-place instead.... | Implement the Python class `Solution` described below.
Class description:
执行结果:通过 执行用时:48 ms, 在所有 Python3 提交中击败了15.36%的用户 内存消耗:15 MB, 在所有 Python3 提交中击败了8.49%的用户 自己写的归并排序,有点慢!!! 归并排序的缺点,需要使用O(N)的额外数组空间
Method signatures and docstrings:
- def sortColors(self, nums): Do not return anything, modify nums in-place instead.... | af4b922484879365921fa4252edf57fe19e53e6a | <|skeleton|>
class Solution:
"""执行结果:通过 执行用时:48 ms, 在所有 Python3 提交中击败了15.36%的用户 内存消耗:15 MB, 在所有 Python3 提交中击败了8.49%的用户 自己写的归并排序,有点慢!!! 归并排序的缺点,需要使用O(N)的额外数组空间"""
def sortColors(self, nums):
"""Do not return anything, modify nums in-place instead."""
<|body_0|>
def sortColors2(self, nums):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
"""执行结果:通过 执行用时:48 ms, 在所有 Python3 提交中击败了15.36%的用户 内存消耗:15 MB, 在所有 Python3 提交中击败了8.49%的用户 自己写的归并排序,有点慢!!! 归并排序的缺点,需要使用O(N)的额外数组空间"""
def sortColors(self, nums):
"""Do not return anything, modify nums in-place instead."""
def merge_sort(nums, nums_copy, start, end):
i... | the_stack_v2_python_sparse | LeetCode/leetcode#075.py | wsldwo/Python | train | 0 |
602976e04f5fcac41e12b7b8288f3cd7c084bb5c | [
"if val in time_dict:\n time_dict[val] += 1\nelse:\n time_dict[val] = 1",
"if root.left:\n self.search_helper(root.left, time_dict)\nself.count_times(time_dict, root.val)\nif root.right:\n self.search_helper(root.right, time_dict)",
"time_dict = {}\nif not root:\n return []\nself.search_helper(ro... | <|body_start_0|>
if val in time_dict:
time_dict[val] += 1
else:
time_dict[val] = 1
<|end_body_0|>
<|body_start_1|>
if root.left:
self.search_helper(root.left, time_dict)
self.count_times(time_dict, root.val)
if root.right:
self.sea... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def count_times(self, time_dict: Dict[int, int], val: TreeNode) -> None:
"""记录出现次数 Args: time_dict: 次数字典 val: 数字 Returns: 记录次数"""
<|body_0|>
def search_helper(self, root: TreeNode, time_dict: Dict[int, int]) -> None:
"""搜索帮助类 Args: root: 根节点 time_dict: 记录次数... | stack_v2_sparse_classes_36k_train_005275 | 4,191 | permissive | [
{
"docstring": "记录出现次数 Args: time_dict: 次数字典 val: 数字 Returns: 记录次数",
"name": "count_times",
"signature": "def count_times(self, time_dict: Dict[int, int], val: TreeNode) -> None"
},
{
"docstring": "搜索帮助类 Args: root: 根节点 time_dict: 记录次数map Returns: void",
"name": "search_helper",
"signatu... | 5 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def count_times(self, time_dict: Dict[int, int], val: TreeNode) -> None: 记录出现次数 Args: time_dict: 次数字典 val: 数字 Returns: 记录次数
- def search_helper(self, root: TreeNode, time_dict: D... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def count_times(self, time_dict: Dict[int, int], val: TreeNode) -> None: 记录出现次数 Args: time_dict: 次数字典 val: 数字 Returns: 记录次数
- def search_helper(self, root: TreeNode, time_dict: D... | 50f35eef6a0ad63173efed10df3c835b1dceaa3f | <|skeleton|>
class Solution:
def count_times(self, time_dict: Dict[int, int], val: TreeNode) -> None:
"""记录出现次数 Args: time_dict: 次数字典 val: 数字 Returns: 记录次数"""
<|body_0|>
def search_helper(self, root: TreeNode, time_dict: Dict[int, int]) -> None:
"""搜索帮助类 Args: root: 根节点 time_dict: 记录次数... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def count_times(self, time_dict: Dict[int, int], val: TreeNode) -> None:
"""记录出现次数 Args: time_dict: 次数字典 val: 数字 Returns: 记录次数"""
if val in time_dict:
time_dict[val] += 1
else:
time_dict[val] = 1
def search_helper(self, root: TreeNode, time_dict: ... | the_stack_v2_python_sparse | src/leetcodepython/tree/find_mode_binary_search_tree_501.py | zhangyu345293721/leetcode | train | 101 | |
6e9c7eae847df960966145cbbbddab6412d57bfb | [
"self.preparers = preparers\nself.request = request\nself.schema = schema\nself.mode = mode",
"if value is colander.null:\n value = None\nfor preparer in self.preparers:\n value = preparer(request=self.request, schema=self.schema, value=value, mode=self.mode)\nreturn value"
] | <|body_start_0|>
self.preparers = preparers
self.request = request
self.schema = schema
self.mode = mode
<|end_body_0|>
<|body_start_1|>
if value is colander.null:
value = None
for preparer in self.preparers:
value = preparer(request=self.request,... | This wrapper is used internally to prepare data using multiple preparers | PreparersWrapper | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PreparersWrapper:
"""This wrapper is used internally to prepare data using multiple preparers"""
def __init__(self, preparers: typing.List[typing.Callable], request, schema, mode=None):
""":param preparers: list of validator callables that accept following parameters: - ``request`` -... | stack_v2_sparse_classes_36k_train_005276 | 20,357 | permissive | [
{
"docstring": ":param preparers: list of validator callables that accept following parameters: - ``request`` - request object - ``schema`` - dataclass schema - ``value`` - value to be validated - ``mode`` - one of the following: ``'default'``, ``'edit'``, ``'edit-process'`` :param request: request object that ... | 2 | stack_v2_sparse_classes_30k_train_020769 | Implement the Python class `PreparersWrapper` described below.
Class description:
This wrapper is used internally to prepare data using multiple preparers
Method signatures and docstrings:
- def __init__(self, preparers: typing.List[typing.Callable], request, schema, mode=None): :param preparers: list of validator ca... | Implement the Python class `PreparersWrapper` described below.
Class description:
This wrapper is used internally to prepare data using multiple preparers
Method signatures and docstrings:
- def __init__(self, preparers: typing.List[typing.Callable], request, schema, mode=None): :param preparers: list of validator ca... | 52f854d310fe196ec7fbce8bc0bebe8837f9bf9c | <|skeleton|>
class PreparersWrapper:
"""This wrapper is used internally to prepare data using multiple preparers"""
def __init__(self, preparers: typing.List[typing.Callable], request, schema, mode=None):
""":param preparers: list of validator callables that accept following parameters: - ``request`` -... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PreparersWrapper:
"""This wrapper is used internally to prepare data using multiple preparers"""
def __init__(self, preparers: typing.List[typing.Callable], request, schema, mode=None):
""":param preparers: list of validator callables that accept following parameters: - ``request`` - request obje... | the_stack_v2_python_sparse | inverter/dc2colander.py | morpframework/inverter | train | 1 |
5d6140fb5fe74bccb0c6bb45abe46be604b0c16e | [
"if filter_name is None or filter_name == '':\n self.include = []\n self.exclude = []\nelif filter_name == 'uncategorized':\n exclude = []\n for f in self.filters:\n exclude += self.filters[f].get('include', [])\n self.exclude = exclude\n self.include = []\nelse:\n self.include = self.fi... | <|body_start_0|>
if filter_name is None or filter_name == '':
self.include = []
self.exclude = []
elif filter_name == 'uncategorized':
exclude = []
for f in self.filters:
exclude += self.filters[f].get('include', [])
self.exclud... | Class to assist in filtering jobs which are in error, based on their last log message. | JSAProcErrorFilter | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class JSAProcErrorFilter:
"""Class to assist in filtering jobs which are in error, based on their last log message."""
def __init__(self, filter_name, extrafilter=None, state_prev=None):
"""Create error filter object. Parameters: filter_name: the name of the filter. Must be one of the valu... | stack_v2_sparse_classes_36k_train_005277 | 4,160 | no_license | [
{
"docstring": "Create error filter object. Parameters: filter_name: the name of the filter. Must be one of the values of the JSAProcErrorFilter.filter_names list.",
"name": "__init__",
"signature": "def __init__(self, filter_name, extrafilter=None, state_prev=None)"
},
{
"docstring": "Apply fil... | 2 | stack_v2_sparse_classes_30k_train_017378 | Implement the Python class `JSAProcErrorFilter` described below.
Class description:
Class to assist in filtering jobs which are in error, based on their last log message.
Method signatures and docstrings:
- def __init__(self, filter_name, extrafilter=None, state_prev=None): Create error filter object. Parameters: fil... | Implement the Python class `JSAProcErrorFilter` described below.
Class description:
Class to assist in filtering jobs which are in error, based on their last log message.
Method signatures and docstrings:
- def __init__(self, filter_name, extrafilter=None, state_prev=None): Create error filter object. Parameters: fil... | 8b8ef99700108dec85c6a14613181eef2d8d311e | <|skeleton|>
class JSAProcErrorFilter:
"""Class to assist in filtering jobs which are in error, based on their last log message."""
def __init__(self, filter_name, extrafilter=None, state_prev=None):
"""Create error filter object. Parameters: filter_name: the name of the filter. Must be one of the valu... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class JSAProcErrorFilter:
"""Class to assist in filtering jobs which are in error, based on their last log message."""
def __init__(self, filter_name, extrafilter=None, state_prev=None):
"""Create error filter object. Parameters: filter_name: the name of the filter. Must be one of the values of the JSA... | the_stack_v2_python_sparse | lib/jsa_proc/action/error_filter.py | eaobservatory/jsa_proc | train | 0 |
eb4ed989f04dcdce30a03f0b2cce08868ac1a1de | [
"super(Inception5b, self).__init__()\nself.branch1 = ConvBNLayer(num_channels=num_channels, num_filters=ch1x1, filter_size=1, stride=1, padding=0)\nself.branch2 = paddle.nn.Sequential(ConvBNLayer(num_channels=num_channels, num_filters=ch3x3reduced, filter_size=1, stride=1, padding=0), ConvBNLayer(num_channels=ch3x3... | <|body_start_0|>
super(Inception5b, self).__init__()
self.branch1 = ConvBNLayer(num_channels=num_channels, num_filters=ch1x1, filter_size=1, stride=1, padding=0)
self.branch2 = paddle.nn.Sequential(ConvBNLayer(num_channels=num_channels, num_filters=ch3x3reduced, filter_size=1, stride=1, padding=... | Inception5b | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Inception5b:
def __init__(self, num_channels, ch1x1, ch3x3reduced, ch3x3, doublech3x3reduced, doublech3x3_1, doublech3x3_2, pool_proj):
"""@Brief `Inception5b` @Parameters num_channels : channel numbers of input tensor ch1x1 : output channel numbers of 1x1 conv ch3x3reduced : channel num... | stack_v2_sparse_classes_36k_train_005278 | 23,805 | permissive | [
{
"docstring": "@Brief `Inception5b` @Parameters num_channels : channel numbers of input tensor ch1x1 : output channel numbers of 1x1 conv ch3x3reduced : channel numbers of 1x1 conv before 3x3 conv ch3x3 : output channel numbers of 3x3 conv doublech3x3reduced : channel numbers of 1x1 conv before the double 3x3 ... | 2 | null | Implement the Python class `Inception5b` described below.
Class description:
Implement the Inception5b class.
Method signatures and docstrings:
- def __init__(self, num_channels, ch1x1, ch3x3reduced, ch3x3, doublech3x3reduced, doublech3x3_1, doublech3x3_2, pool_proj): @Brief `Inception5b` @Parameters num_channels : c... | Implement the Python class `Inception5b` described below.
Class description:
Implement the Inception5b class.
Method signatures and docstrings:
- def __init__(self, num_channels, ch1x1, ch3x3reduced, ch3x3, doublech3x3reduced, doublech3x3_1, doublech3x3_2, pool_proj): @Brief `Inception5b` @Parameters num_channels : c... | 78ff3c3ab3906012a0f4a612251347632aa493a7 | <|skeleton|>
class Inception5b:
def __init__(self, num_channels, ch1x1, ch3x3reduced, ch3x3, doublech3x3reduced, doublech3x3_1, doublech3x3_2, pool_proj):
"""@Brief `Inception5b` @Parameters num_channels : channel numbers of input tensor ch1x1 : output channel numbers of 1x1 conv ch3x3reduced : channel num... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Inception5b:
def __init__(self, num_channels, ch1x1, ch3x3reduced, ch3x3, doublech3x3reduced, doublech3x3_1, doublech3x3_2, pool_proj):
"""@Brief `Inception5b` @Parameters num_channels : channel numbers of input tensor ch1x1 : output channel numbers of 1x1 conv ch3x3reduced : channel numbers of 1x1 co... | the_stack_v2_python_sparse | ECO/paddle2.0/model/ECO.py | thinkall/Contrib | train | 1 | |
53876b10f480090c654039d6966eed9867e3ff91 | [
"if num == 0:\n return alphabet[0]\narr = []\narr_append = arr.append\n_divmod = divmod\nbase = len(alphabet)\nwhile num:\n num, rem = _divmod(num, base)\n arr_append(alphabet[rem])\narr.reverse()\nreturn ''.join(arr)",
"base = len(alphabet)\nstrlen = len(string)\nnum = 0\nidx = 0\nfor char in string:\n ... | <|body_start_0|>
if num == 0:
return alphabet[0]
arr = []
arr_append = arr.append
_divmod = divmod
base = len(alphabet)
while num:
num, rem = _divmod(num, base)
arr_append(alphabet[rem])
arr.reverse()
return ''.join(arr)... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def idToShortURL(self, num: int, alphabet: str=BASE62) -> str:
"""Encode a positive number into Base X and return the string. Arguments: - `num`: The number to encode - `alphabet`: The alphabet to use for encoding"""
<|body_0|>
def shortURLToId(self, string: str, a... | stack_v2_sparse_classes_36k_train_005279 | 5,356 | no_license | [
{
"docstring": "Encode a positive number into Base X and return the string. Arguments: - `num`: The number to encode - `alphabet`: The alphabet to use for encoding",
"name": "idToShortURL",
"signature": "def idToShortURL(self, num: int, alphabet: str=BASE62) -> str"
},
{
"docstring": "Decode a B... | 2 | stack_v2_sparse_classes_30k_val_000701 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def idToShortURL(self, num: int, alphabet: str=BASE62) -> str: Encode a positive number into Base X and return the string. Arguments: - `num`: The number to encode - `alphabet`: ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def idToShortURL(self, num: int, alphabet: str=BASE62) -> str: Encode a positive number into Base X and return the string. Arguments: - `num`: The number to encode - `alphabet`: ... | f2621cd76822a922c49b60f32931f26cce1c571d | <|skeleton|>
class Solution:
def idToShortURL(self, num: int, alphabet: str=BASE62) -> str:
"""Encode a positive number into Base X and return the string. Arguments: - `num`: The number to encode - `alphabet`: The alphabet to use for encoding"""
<|body_0|>
def shortURLToId(self, string: str, a... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def idToShortURL(self, num: int, alphabet: str=BASE62) -> str:
"""Encode a positive number into Base X and return the string. Arguments: - `num`: The number to encode - `alphabet`: The alphabet to use for encoding"""
if num == 0:
return alphabet[0]
arr = []
... | the_stack_v2_python_sparse | String/023_geeksforgeeks_Design_a_tiny_URL_or_URL_Shortener/Solution.py | Keshav1506/competitive_programming | train | 0 | |
e2cb58ec1dc8e1432bfe105ed9aedef9548af49c | [
"if action_list is None:\n self.action_list = ['R', 'P', 'S']\nelse:\n self.action_list = action_list\nif payoff_matrix is None:\n self.payoff_matrix = {('R', 'P'): (0, 1), ('P', 'S'): (0, 1), ('S', 'R'): (0, 1)}\nfor action1 in self.action_list:\n for action2 in self.action_list:\n if (action1, ... | <|body_start_0|>
if action_list is None:
self.action_list = ['R', 'P', 'S']
else:
self.action_list = action_list
if payoff_matrix is None:
self.payoff_matrix = {('R', 'P'): (0, 1), ('P', 'S'): (0, 1), ('S', 'R'): (0, 1)}
for action1 in self.action_list... | The class that describes the rules of the game. Defaults to Rock Paper Scissors, but can be used to describe any game where: - Players simultaneously and independently choose an action to play. - Both players have the same fixed, constant set of actions. - Payoffs are resolved based on both actions. - Each round of the... | Game | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Game:
"""The class that describes the rules of the game. Defaults to Rock Paper Scissors, but can be used to describe any game where: - Players simultaneously and independently choose an action to play. - Both players have the same fixed, constant set of actions. - Payoffs are resolved based on b... | stack_v2_sparse_classes_36k_train_005280 | 2,366 | no_license | [
{
"docstring": "Create a new game model; defaults to Rock Paper Scissors. Args: action_list: The list of actions each player may take. payoff_matrix: Dictionary with the form {(action1, action2): (payoff1, payoff2), ....} If a pair of actions don't exist: If the inverse exists, use that (assume payoff is symmet... | 2 | stack_v2_sparse_classes_30k_train_013517 | Implement the Python class `Game` described below.
Class description:
The class that describes the rules of the game. Defaults to Rock Paper Scissors, but can be used to describe any game where: - Players simultaneously and independently choose an action to play. - Both players have the same fixed, constant set of act... | Implement the Python class `Game` described below.
Class description:
The class that describes the rules of the game. Defaults to Rock Paper Scissors, but can be used to describe any game where: - Players simultaneously and independently choose an action to play. - Both players have the same fixed, constant set of act... | aad981ebbc9400c795740ff5c3b1b920ec886be6 | <|skeleton|>
class Game:
"""The class that describes the rules of the game. Defaults to Rock Paper Scissors, but can be used to describe any game where: - Players simultaneously and independently choose an action to play. - Both players have the same fixed, constant set of actions. - Payoffs are resolved based on b... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Game:
"""The class that describes the rules of the game. Defaults to Rock Paper Scissors, but can be used to describe any game where: - Players simultaneously and independently choose an action to play. - Both players have the same fixed, constant set of actions. - Payoffs are resolved based on both actions. ... | the_stack_v2_python_sparse | David Masad/RPS/Game.py | Aarijit/css605_2012 | train | 0 |
9d4bd4b35ae337fcd5d5702401e971b04ad2a85a | [
"self.numbers = []\nself.setA = set()\nself.setB = set()\nfor number in nums:\n if number in self.setA:\n if number not in self.setB:\n self.setB.add(number)\n self.numbers.remove(number)\n else:\n self.setA.add(number)\n self.numbers.append(number)",
"if len(self.... | <|body_start_0|>
self.numbers = []
self.setA = set()
self.setB = set()
for number in nums:
if number in self.setA:
if number not in self.setB:
self.setB.add(number)
self.numbers.remove(number)
else:
... | FirstUnique | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FirstUnique:
def __init__(self, nums):
""":type nums: List[int]"""
<|body_0|>
def showFirstUnique(self):
""":rtype: int"""
<|body_1|>
def add(self, value):
""":type value: int :rtype: None"""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>... | stack_v2_sparse_classes_36k_train_005281 | 1,149 | no_license | [
{
"docstring": ":type nums: List[int]",
"name": "__init__",
"signature": "def __init__(self, nums)"
},
{
"docstring": ":rtype: int",
"name": "showFirstUnique",
"signature": "def showFirstUnique(self)"
},
{
"docstring": ":type value: int :rtype: None",
"name": "add",
"sign... | 3 | null | Implement the Python class `FirstUnique` described below.
Class description:
Implement the FirstUnique class.
Method signatures and docstrings:
- def __init__(self, nums): :type nums: List[int]
- def showFirstUnique(self): :rtype: int
- def add(self, value): :type value: int :rtype: None | Implement the Python class `FirstUnique` described below.
Class description:
Implement the FirstUnique class.
Method signatures and docstrings:
- def __init__(self, nums): :type nums: List[int]
- def showFirstUnique(self): :rtype: int
- def add(self, value): :type value: int :rtype: None
<|skeleton|>
class FirstUniq... | 93a1b082e10ade0dd464deb80b5df6c81552f534 | <|skeleton|>
class FirstUnique:
def __init__(self, nums):
""":type nums: List[int]"""
<|body_0|>
def showFirstUnique(self):
""":rtype: int"""
<|body_1|>
def add(self, value):
""":type value: int :rtype: None"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FirstUnique:
def __init__(self, nums):
""":type nums: List[int]"""
self.numbers = []
self.setA = set()
self.setB = set()
for number in nums:
if number in self.setA:
if number not in self.setB:
self.setB.add(number)
... | the_stack_v2_python_sparse | leetcode/First Unique Number/Solotion.py | adamqddnh/algorithm-questions | train | 0 | |
497d916034abea9b8d117e2e643b6321cc640002 | [
"profile.addListsToCraftTypeRepository('skeinforge_tools.craft_plugins.tower.html', self)\nself.fileNameInput = settings.FileNameInput().getFromFileName(interpret.getGNUTranslatorGcodeFileTypeTuples(), 'Open File for Tower', self, '')\nself.openWikiManualHelpPage = settings.HelpPage().getOpenFromAbsolute('http://ww... | <|body_start_0|>
profile.addListsToCraftTypeRepository('skeinforge_tools.craft_plugins.tower.html', self)
self.fileNameInput = settings.FileNameInput().getFromFileName(interpret.getGNUTranslatorGcodeFileTypeTuples(), 'Open File for Tower', self, '')
self.openWikiManualHelpPage = settings.HelpPag... | A class to handle the tower settings. | TowerRepository | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TowerRepository:
"""A class to handle the tower settings."""
def __init__(self):
"""Set the default settings, execute title & settings fileName."""
<|body_0|>
def execute(self):
"""Tower button has been clicked."""
<|body_1|>
<|end_skeleton|>
<|body_sta... | stack_v2_sparse_classes_36k_train_005282 | 17,088 | no_license | [
{
"docstring": "Set the default settings, execute title & settings fileName.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Tower button has been clicked.",
"name": "execute",
"signature": "def execute(self)"
}
] | 2 | null | Implement the Python class `TowerRepository` described below.
Class description:
A class to handle the tower settings.
Method signatures and docstrings:
- def __init__(self): Set the default settings, execute title & settings fileName.
- def execute(self): Tower button has been clicked. | Implement the Python class `TowerRepository` described below.
Class description:
A class to handle the tower settings.
Method signatures and docstrings:
- def __init__(self): Set the default settings, execute title & settings fileName.
- def execute(self): Tower button has been clicked.
<|skeleton|>
class TowerRepos... | fd69d8e856780c826386dc973ceabcc03623f3e8 | <|skeleton|>
class TowerRepository:
"""A class to handle the tower settings."""
def __init__(self):
"""Set the default settings, execute title & settings fileName."""
<|body_0|>
def execute(self):
"""Tower button has been clicked."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TowerRepository:
"""A class to handle the tower settings."""
def __init__(self):
"""Set the default settings, execute title & settings fileName."""
profile.addListsToCraftTypeRepository('skeinforge_tools.craft_plugins.tower.html', self)
self.fileNameInput = settings.FileNameInput(... | the_stack_v2_python_sparse | skeinforge_tools/craft_plugins/tower.py | bmander/skeinforge | train | 34 |
507d6e943fae3f94482a600603543b449d49051b | [
"self._date_one = kwargs.pop('date_one', DEFAULT_DATE_ONE)\nself._date_two = kwargs.pop('date_two', DEFAULT_DATE_TWO)\nself.db = DBCommunication()\nsuper().__init__(**kwargs)",
"fetched_data = self.db.get_data_for_specific_dates(self._date_one, self._date_two)\nweather_data = {}\nrow_data = {}\ncounter = 0\nfor i... | <|body_start_0|>
self._date_one = kwargs.pop('date_one', DEFAULT_DATE_ONE)
self._date_two = kwargs.pop('date_two', DEFAULT_DATE_TWO)
self.db = DBCommunication()
super().__init__(**kwargs)
<|end_body_0|>
<|body_start_1|>
fetched_data = self.db.get_data_for_specific_dates(self._da... | This class defines a strategy for the agent. | Strategy | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Strategy:
"""This class defines a strategy for the agent."""
def __init__(self, **kwargs: Any) -> None:
"""Initialize the strategy of the agent. :param kwargs: keyword arguments"""
<|body_0|>
def collect_from_data_source(self) -> Dict[str, str]:
"""Build the data... | stack_v2_sparse_classes_36k_train_005283 | 2,746 | permissive | [
{
"docstring": "Initialize the strategy of the agent. :param kwargs: keyword arguments",
"name": "__init__",
"signature": "def __init__(self, **kwargs: Any) -> None"
},
{
"docstring": "Build the data payload. :return: a tuple of the data and the rows",
"name": "collect_from_data_source",
... | 2 | stack_v2_sparse_classes_30k_train_013379 | Implement the Python class `Strategy` described below.
Class description:
This class defines a strategy for the agent.
Method signatures and docstrings:
- def __init__(self, **kwargs: Any) -> None: Initialize the strategy of the agent. :param kwargs: keyword arguments
- def collect_from_data_source(self) -> Dict[str,... | Implement the Python class `Strategy` described below.
Class description:
This class defines a strategy for the agent.
Method signatures and docstrings:
- def __init__(self, **kwargs: Any) -> None: Initialize the strategy of the agent. :param kwargs: keyword arguments
- def collect_from_data_source(self) -> Dict[str,... | bec49adaeba661d8d0f03ac9935dc89f39d95a0d | <|skeleton|>
class Strategy:
"""This class defines a strategy for the agent."""
def __init__(self, **kwargs: Any) -> None:
"""Initialize the strategy of the agent. :param kwargs: keyword arguments"""
<|body_0|>
def collect_from_data_source(self) -> Dict[str, str]:
"""Build the data... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Strategy:
"""This class defines a strategy for the agent."""
def __init__(self, **kwargs: Any) -> None:
"""Initialize the strategy of the agent. :param kwargs: keyword arguments"""
self._date_one = kwargs.pop('date_one', DEFAULT_DATE_ONE)
self._date_two = kwargs.pop('date_two', DE... | the_stack_v2_python_sparse | packages/fetchai/skills/weather_station/strategy.py | fetchai/agents-aea | train | 192 |
5716b5f02e9f550df441f371313598e695e5933e | [
"if request.user.is_authenticated:\n buses = UserBusNumber.objects.filter(bus_number_user=request.user)\n buses = list(buses)\n buses_list = [{'bus_number': bus.bus_number, 'start_point': bus.start_point, 'end_point': bus.end_point} for bus in buses]\n json_file = {'user_bus_list': buses_list, 'res': 1}... | <|body_start_0|>
if request.user.is_authenticated:
buses = UserBusNumber.objects.filter(bus_number_user=request.user)
buses = list(buses)
buses_list = [{'bus_number': bus.bus_number, 'start_point': bus.start_point, 'end_point': bus.end_point} for bus in buses]
jso... | store the favorite bus numbers of user | FavoriteBusNumberView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FavoriteBusNumberView:
"""store the favorite bus numbers of user"""
def get(self, request):
"""return the user's favortie bus list"""
<|body_0|>
def post(self, request):
"""add new bus information"""
<|body_1|>
def delete(self, request):
"""r... | stack_v2_sparse_classes_36k_train_005284 | 28,206 | no_license | [
{
"docstring": "return the user's favortie bus list",
"name": "get",
"signature": "def get(self, request)"
},
{
"docstring": "add new bus information",
"name": "post",
"signature": "def post(self, request)"
},
{
"docstring": "remove the bus number from the favorite list",
"na... | 3 | stack_v2_sparse_classes_30k_train_006969 | Implement the Python class `FavoriteBusNumberView` described below.
Class description:
store the favorite bus numbers of user
Method signatures and docstrings:
- def get(self, request): return the user's favortie bus list
- def post(self, request): add new bus information
- def delete(self, request): remove the bus n... | Implement the Python class `FavoriteBusNumberView` described below.
Class description:
store the favorite bus numbers of user
Method signatures and docstrings:
- def get(self, request): return the user's favortie bus list
- def post(self, request): add new bus information
- def delete(self, request): remove the bus n... | 5efeebedd4695ef9d904beb707a1538ba049b187 | <|skeleton|>
class FavoriteBusNumberView:
"""store the favorite bus numbers of user"""
def get(self, request):
"""return the user's favortie bus list"""
<|body_0|>
def post(self, request):
"""add new bus information"""
<|body_1|>
def delete(self, request):
"""r... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FavoriteBusNumberView:
"""store the favorite bus numbers of user"""
def get(self, request):
"""return the user's favortie bus list"""
if request.user.is_authenticated:
buses = UserBusNumber.objects.filter(bus_number_user=request.user)
buses = list(buses)
... | the_stack_v2_python_sparse | dbbus/apps/user/views.py | mofiebiger/DublinBus | train | 1 |
78e10f6bc4b8a3840324f633a5fc7870948f0730 | [
"from sage.matrix.constructor import identity_matrix\nm = identity_matrix(self.base_ring(), self.degree())\nm.set_immutable()\nreturn m",
"from sage.matrix.constructor import identity_matrix\nm = identity_matrix(self.base_ring(), self.degree())\nm.set_immutable()\nreturn m",
"if self._special and x.determinant(... | <|body_start_0|>
from sage.matrix.constructor import identity_matrix
m = identity_matrix(self.base_ring(), self.degree())
m.set_immutable()
return m
<|end_body_0|>
<|body_start_1|>
from sage.matrix.constructor import identity_matrix
m = identity_matrix(self.base_ring(), ... | OrthogonalMatrixGroup_generic | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OrthogonalMatrixGroup_generic:
def invariant_bilinear_form(self):
"""Return the symmetric bilinear form preserved by the orthogonal group. OUTPUT: A matrix. EXAMPLES:: sage: GO(2,3,+1).invariant_bilinear_form() [0 1] [1 0] sage: GO(2,3,-1).invariant_bilinear_form() [2 1] [1 1]"""
... | stack_v2_sparse_classes_36k_train_005285 | 13,931 | no_license | [
{
"docstring": "Return the symmetric bilinear form preserved by the orthogonal group. OUTPUT: A matrix. EXAMPLES:: sage: GO(2,3,+1).invariant_bilinear_form() [0 1] [1 0] sage: GO(2,3,-1).invariant_bilinear_form() [2 1] [1 1]",
"name": "invariant_bilinear_form",
"signature": "def invariant_bilinear_form(... | 3 | stack_v2_sparse_classes_30k_train_020670 | Implement the Python class `OrthogonalMatrixGroup_generic` described below.
Class description:
Implement the OrthogonalMatrixGroup_generic class.
Method signatures and docstrings:
- def invariant_bilinear_form(self): Return the symmetric bilinear form preserved by the orthogonal group. OUTPUT: A matrix. EXAMPLES:: sa... | Implement the Python class `OrthogonalMatrixGroup_generic` described below.
Class description:
Implement the OrthogonalMatrixGroup_generic class.
Method signatures and docstrings:
- def invariant_bilinear_form(self): Return the symmetric bilinear form preserved by the orthogonal group. OUTPUT: A matrix. EXAMPLES:: sa... | 0d9eacbf74e2acffefde93e39f8bcbec745cdaba | <|skeleton|>
class OrthogonalMatrixGroup_generic:
def invariant_bilinear_form(self):
"""Return the symmetric bilinear form preserved by the orthogonal group. OUTPUT: A matrix. EXAMPLES:: sage: GO(2,3,+1).invariant_bilinear_form() [0 1] [1 0] sage: GO(2,3,-1).invariant_bilinear_form() [2 1] [1 1]"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class OrthogonalMatrixGroup_generic:
def invariant_bilinear_form(self):
"""Return the symmetric bilinear form preserved by the orthogonal group. OUTPUT: A matrix. EXAMPLES:: sage: GO(2,3,+1).invariant_bilinear_form() [0 1] [1 0] sage: GO(2,3,-1).invariant_bilinear_form() [2 1] [1 1]"""
from sage.mat... | the_stack_v2_python_sparse | sage/src/sage/groups/matrix_gps/orthogonal.py | bopopescu/geosci | train | 0 | |
20b554cca70f0aef733c2ca504c28fcb2d2d4894 | [
"for g in self.badMafs:\n makeTempDir()\n mafFile = testFile(g)\n self.assertRaises(mafval.DuplicateColumnError, mafval.validateMaf, mafFile, options)\n removeTempDir()",
"customOpts = GenericObject()\ncustomOpts.lookForDuplicateColumns = False\ncustomOpts.testChromNames = True\nfor g in self.badMafs:... | <|body_start_0|>
for g in self.badMafs:
makeTempDir()
mafFile = testFile(g)
self.assertRaises(mafval.DuplicateColumnError, mafval.validateMaf, mafFile, options)
removeTempDir()
<|end_body_0|>
<|body_start_1|>
customOpts = GenericObject()
customOpt... | DuplicateColumnChecks | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DuplicateColumnChecks:
def testDuplicateColumns(self):
"""mafValidator should fail when a column is duplicated"""
<|body_0|>
def testNotTestingDuplicateColumns(self):
"""mafValidator should ignore when a column is duplicated if option is switched off"""
<|bod... | stack_v2_sparse_classes_36k_train_005286 | 41,963 | permissive | [
{
"docstring": "mafValidator should fail when a column is duplicated",
"name": "testDuplicateColumns",
"signature": "def testDuplicateColumns(self)"
},
{
"docstring": "mafValidator should ignore when a column is duplicated if option is switched off",
"name": "testNotTestingDuplicateColumns",... | 2 | stack_v2_sparse_classes_30k_test_000148 | Implement the Python class `DuplicateColumnChecks` described below.
Class description:
Implement the DuplicateColumnChecks class.
Method signatures and docstrings:
- def testDuplicateColumns(self): mafValidator should fail when a column is duplicated
- def testNotTestingDuplicateColumns(self): mafValidator should ign... | Implement the Python class `DuplicateColumnChecks` described below.
Class description:
Implement the DuplicateColumnChecks class.
Method signatures and docstrings:
- def testDuplicateColumns(self): mafValidator should fail when a column is duplicated
- def testNotTestingDuplicateColumns(self): mafValidator should ign... | 601832a780f328d48893474f0f4934dcbf9df73c | <|skeleton|>
class DuplicateColumnChecks:
def testDuplicateColumns(self):
"""mafValidator should fail when a column is duplicated"""
<|body_0|>
def testNotTestingDuplicateColumns(self):
"""mafValidator should ignore when a column is duplicated if option is switched off"""
<|bod... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DuplicateColumnChecks:
def testDuplicateColumns(self):
"""mafValidator should fail when a column is duplicated"""
for g in self.badMafs:
makeTempDir()
mafFile = testFile(g)
self.assertRaises(mafval.DuplicateColumnError, mafval.validateMaf, mafFile, options)
... | the_stack_v2_python_sparse | mafValidator/src/test.mafValidator.py | sorrywm/mafTools | train | 0 | |
ffc8f365273058868570affc96af29fa73fcc697 | [
"session = cls._sessionClass(host)\nif makeCurrent:\n cls._instance = session\n SessionManager._instance = cls._instance\nreturn session",
"session = cls._instance\nif session and requireManager and (not session.currentManager()):\n return None\nreturn session",
"manager = None\nsession = cls.currentSe... | <|body_start_0|>
session = cls._sessionClass(host)
if makeCurrent:
cls._instance = session
SessionManager._instance = cls._instance
return session
<|end_body_0|>
<|body_start_1|>
session = cls._instance
if session and requireManager and (not session.curre... | A @ref Host facing convenience class to simplify a Hosts interactions with a @ref Manager. It is intended to be used as a singleton manager of the associated state, and @ref Manager instances within any single interaction session. It takes care of the following upon initialization: @li Connecting a Host's logging into ... | SessionManager | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SessionManager:
"""A @ref Host facing convenience class to simplify a Hosts interactions with a @ref Manager. It is intended to be used as a singleton manager of the associated state, and @ref Manager instances within any single interaction session. It takes care of the following upon initializat... | stack_v2_sparse_classes_36k_train_005287 | 2,382 | permissive | [
{
"docstring": "Constructs a new SessionManager, and stores it as a singleton. Any further calls to @ref currentSession() will then return this instance. Multiple calls to startSession() will each create a new instance, and store that as the 'current' session from the point of view of @ref currentSession(). @re... | 3 | stack_v2_sparse_classes_30k_val_000011 | Implement the Python class `SessionManager` described below.
Class description:
A @ref Host facing convenience class to simplify a Hosts interactions with a @ref Manager. It is intended to be used as a singleton manager of the associated state, and @ref Manager instances within any single interaction session. It takes... | Implement the Python class `SessionManager` described below.
Class description:
A @ref Host facing convenience class to simplify a Hosts interactions with a @ref Manager. It is intended to be used as a singleton manager of the associated state, and @ref Manager instances within any single interaction session. It takes... | a0d5ba788e3dc5c1536ebe9740bcf4393e3f5e1d | <|skeleton|>
class SessionManager:
"""A @ref Host facing convenience class to simplify a Hosts interactions with a @ref Manager. It is intended to be used as a singleton manager of the associated state, and @ref Manager instances within any single interaction session. It takes care of the following upon initializat... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SessionManager:
"""A @ref Host facing convenience class to simplify a Hosts interactions with a @ref Manager. It is intended to be used as a singleton manager of the associated state, and @ref Manager instances within any single interaction session. It takes care of the following upon initialization: @li Conn... | the_stack_v2_python_sparse | source/FnAssetAPI/SessionManager.py | IngenuityEngine/ftrack-connect-foundry | train | 1 |
1269bdcff47b9ff61d0d648c27707adce93a5d49 | [
"webapp_user = args['webapp_user']\nship_infos = webapp_user.ship_infos\ndata = {'ship_infos': ship_infos}\nreturn data",
"webapp_user = args['webapp_user']\nresult = webapp_user.select_default_ship(args['ship_id'])\nif result:\n return {'result': result}\nelse:\n return 500"
] | <|body_start_0|>
webapp_user = args['webapp_user']
ship_infos = webapp_user.ship_infos
data = {'ship_infos': ship_infos}
return data
<|end_body_0|>
<|body_start_1|>
webapp_user = args['webapp_user']
result = webapp_user.select_default_ship(args['ship_id'])
if res... | 商品 | AShipInfos | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AShipInfos:
"""商品"""
def get(args):
"""获取收货地址列表 @param 无 @return 'ship_infos': ship_infos(列表)"""
<|body_0|>
def post(args):
"""选择默认收货地址 @param ship_id @return {'result': True}"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
webapp_user = args['w... | stack_v2_sparse_classes_36k_train_005288 | 777 | no_license | [
{
"docstring": "获取收货地址列表 @param 无 @return 'ship_infos': ship_infos(列表)",
"name": "get",
"signature": "def get(args)"
},
{
"docstring": "选择默认收货地址 @param ship_id @return {'result': True}",
"name": "post",
"signature": "def post(args)"
}
] | 2 | null | Implement the Python class `AShipInfos` described below.
Class description:
商品
Method signatures and docstrings:
- def get(args): 获取收货地址列表 @param 无 @return 'ship_infos': ship_infos(列表)
- def post(args): 选择默认收货地址 @param ship_id @return {'result': True} | Implement the Python class `AShipInfos` described below.
Class description:
商品
Method signatures and docstrings:
- def get(args): 获取收货地址列表 @param 无 @return 'ship_infos': ship_infos(列表)
- def post(args): 选择默认收货地址 @param ship_id @return {'result': True}
<|skeleton|>
class AShipInfos:
"""商品"""
def get(args):
... | 15621db1a64ffe199619924b75a5b5c5e6416bed | <|skeleton|>
class AShipInfos:
"""商品"""
def get(args):
"""获取收货地址列表 @param 无 @return 'ship_infos': ship_infos(列表)"""
<|body_0|>
def post(args):
"""选择默认收货地址 @param ship_id @return {'result': True}"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AShipInfos:
"""商品"""
def get(args):
"""获取收货地址列表 @param 无 @return 'ship_infos': ship_infos(列表)"""
webapp_user = args['webapp_user']
ship_infos = webapp_user.ship_infos
data = {'ship_infos': ship_infos}
return data
def post(args):
"""选择默认收货地址 @param ship... | the_stack_v2_python_sparse | api/mall/a_ship_infos.py | nuaays/apiserver | train | 0 |
f9fbb6daf384254d9b6ea34657362af4cf8abfdb | [
"if hasattr(self, 'client'):\n context = {self.client_context_object_name: self.client}\nelse:\n client_slug = self.kwargs.get(self.client_slug_url_kwarg)\n if client_slug:\n client = get_object_or_404(Client, slug__iexact=client_slug)\n context = {self.client_context_object_name: client}\n ... | <|body_start_0|>
if hasattr(self, 'client'):
context = {self.client_context_object_name: self.client}
else:
client_slug = self.kwargs.get(self.client_slug_url_kwarg)
if client_slug:
client = get_object_or_404(Client, slug__iexact=client_slug)
... | OrderCreateClientMixin | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OrderCreateClientMixin:
def get_context_data(self, **kwargs):
"""Добавляет клиента и объект в контекст заказа"""
<|body_0|>
def get_initial(self):
"""Добавляет клиента и объект в заказ"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if hasattr(self,... | stack_v2_sparse_classes_36k_train_005289 | 4,913 | permissive | [
{
"docstring": "Добавляет клиента и объект в контекст заказа",
"name": "get_context_data",
"signature": "def get_context_data(self, **kwargs)"
},
{
"docstring": "Добавляет клиента и объект в заказ",
"name": "get_initial",
"signature": "def get_initial(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_019289 | Implement the Python class `OrderCreateClientMixin` described below.
Class description:
Implement the OrderCreateClientMixin class.
Method signatures and docstrings:
- def get_context_data(self, **kwargs): Добавляет клиента и объект в контекст заказа
- def get_initial(self): Добавляет клиента и объект в заказ | Implement the Python class `OrderCreateClientMixin` described below.
Class description:
Implement the OrderCreateClientMixin class.
Method signatures and docstrings:
- def get_context_data(self, **kwargs): Добавляет клиента и объект в контекст заказа
- def get_initial(self): Добавляет клиента и объект в заказ
<|skel... | 7246b4f524d138d48aadf4866e0b218bb924f69c | <|skeleton|>
class OrderCreateClientMixin:
def get_context_data(self, **kwargs):
"""Добавляет клиента и объект в контекст заказа"""
<|body_0|>
def get_initial(self):
"""Добавляет клиента и объект в заказ"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class OrderCreateClientMixin:
def get_context_data(self, **kwargs):
"""Добавляет клиента и объект в контекст заказа"""
if hasattr(self, 'client'):
context = {self.client_context_object_name: self.client}
else:
client_slug = self.kwargs.get(self.client_slug_url_kwarg)
... | the_stack_v2_python_sparse | locker/calc/utils.py | crowmurk/locker | train | 0 | |
6ec01f1b4cab96a151f84e7e20346b9800e73045 | [
"a = sorted(nums1 + nums2)\nmid = len(a) // 2\nmed = (a[mid] + a[~mid]) / 2.0\nreturn med",
"INT_MIN_VALUE = -sys.maxsize - 1\nINT_MAX_VALUE = sys.maxint\nlen1 = len(nums1)\nlen2 = len(nums2)\nif len1 > len2:\n return self.findMedianSortedArrays(nums2, nums1)\nlow = 0\nhigh = len1\nwhile low <= high:\n part... | <|body_start_0|>
a = sorted(nums1 + nums2)
mid = len(a) // 2
med = (a[mid] + a[~mid]) / 2.0
return med
<|end_body_0|>
<|body_start_1|>
INT_MIN_VALUE = -sys.maxsize - 1
INT_MAX_VALUE = sys.maxint
len1 = len(nums1)
len2 = len(nums2)
if len1 > len2:
... | P004_MedianOfTwoSortedArrays | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class P004_MedianOfTwoSortedArrays:
def findMedianSortedArrays_bf(self, nums1, nums2):
"""Brute force solution :type nums1: List[int] :type nums2: List[int] :rtype: float"""
<|body_0|>
def findMedianSortedArrays(self, nums1, nums2):
""":type nums1: List[int] :type nums2: L... | stack_v2_sparse_classes_36k_train_005290 | 3,479 | no_license | [
{
"docstring": "Brute force solution :type nums1: List[int] :type nums2: List[int] :rtype: float",
"name": "findMedianSortedArrays_bf",
"signature": "def findMedianSortedArrays_bf(self, nums1, nums2)"
},
{
"docstring": ":type nums1: List[int] :type nums2: List[int] :rtype: float",
"name": "f... | 2 | stack_v2_sparse_classes_30k_train_020595 | Implement the Python class `P004_MedianOfTwoSortedArrays` described below.
Class description:
Implement the P004_MedianOfTwoSortedArrays class.
Method signatures and docstrings:
- def findMedianSortedArrays_bf(self, nums1, nums2): Brute force solution :type nums1: List[int] :type nums2: List[int] :rtype: float
- def ... | Implement the Python class `P004_MedianOfTwoSortedArrays` described below.
Class description:
Implement the P004_MedianOfTwoSortedArrays class.
Method signatures and docstrings:
- def findMedianSortedArrays_bf(self, nums1, nums2): Brute force solution :type nums1: List[int] :type nums2: List[int] :rtype: float
- def ... | 727dec2e23e765925a5e7e003fc99aeaf25111e9 | <|skeleton|>
class P004_MedianOfTwoSortedArrays:
def findMedianSortedArrays_bf(self, nums1, nums2):
"""Brute force solution :type nums1: List[int] :type nums2: List[int] :rtype: float"""
<|body_0|>
def findMedianSortedArrays(self, nums1, nums2):
""":type nums1: List[int] :type nums2: L... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class P004_MedianOfTwoSortedArrays:
def findMedianSortedArrays_bf(self, nums1, nums2):
"""Brute force solution :type nums1: List[int] :type nums2: List[int] :rtype: float"""
a = sorted(nums1 + nums2)
mid = len(a) // 2
med = (a[mid] + a[~mid]) / 2.0
return med
def findMed... | the_stack_v2_python_sparse | funNLearn/src/main/java/dsAlgo/leetcode/P0xx/P004_MedianOfTwoSortedArrays.py | vishalpmittal/practice-fun | train | 0 | |
5716b5f02e9f550df441f371313598e695e5933e | [
"if request.user.is_authenticated:\n routes = UserRoute.objects.filter(route_user=request.user)\n routes = list(routes)\n routes_list = [{'route_start': route.route_start, 'route_end': route.route_end} for route in routes]\n json_file = {'user_routes_list': routes_list, 'res': 1}\n return JsonRespons... | <|body_start_0|>
if request.user.is_authenticated:
routes = UserRoute.objects.filter(route_user=request.user)
routes = list(routes)
routes_list = [{'route_start': route.route_start, 'route_end': route.route_end} for route in routes]
json_file = {'user_routes_list'... | store the favorite routes of user | FavoriteRouteView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FavoriteRouteView:
"""store the favorite routes of user"""
def get(self, request):
"""return the user's favortie route list"""
<|body_0|>
def post(self, request):
"""add new route information"""
<|body_1|>
def delete(self, request):
"""remove... | stack_v2_sparse_classes_36k_train_005291 | 28,206 | no_license | [
{
"docstring": "return the user's favortie route list",
"name": "get",
"signature": "def get(self, request)"
},
{
"docstring": "add new route information",
"name": "post",
"signature": "def post(self, request)"
},
{
"docstring": "remove the route from the favorite list",
"nam... | 3 | stack_v2_sparse_classes_30k_train_005962 | Implement the Python class `FavoriteRouteView` described below.
Class description:
store the favorite routes of user
Method signatures and docstrings:
- def get(self, request): return the user's favortie route list
- def post(self, request): add new route information
- def delete(self, request): remove the route from... | Implement the Python class `FavoriteRouteView` described below.
Class description:
store the favorite routes of user
Method signatures and docstrings:
- def get(self, request): return the user's favortie route list
- def post(self, request): add new route information
- def delete(self, request): remove the route from... | 5efeebedd4695ef9d904beb707a1538ba049b187 | <|skeleton|>
class FavoriteRouteView:
"""store the favorite routes of user"""
def get(self, request):
"""return the user's favortie route list"""
<|body_0|>
def post(self, request):
"""add new route information"""
<|body_1|>
def delete(self, request):
"""remove... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FavoriteRouteView:
"""store the favorite routes of user"""
def get(self, request):
"""return the user's favortie route list"""
if request.user.is_authenticated:
routes = UserRoute.objects.filter(route_user=request.user)
routes = list(routes)
routes_list... | the_stack_v2_python_sparse | dbbus/apps/user/views.py | mofiebiger/DublinBus | train | 1 |
941113470896a1e32203d151082431c80f53885c | [
"self.commission_dict = commission_dict\nself.df_columns = ['type', 'date', 'symbol', 'commission']\nself.commission_df = pd.DataFrame(columns=self.df_columns)",
"if self.commission_df.shape[0] == 0:\n return str(self.commission_df.info())\nreturn str(self.commission_df)",
"market = ABuEnv.g_market_target if... | <|body_start_0|>
self.commission_dict = commission_dict
self.df_columns = ['type', 'date', 'symbol', 'commission']
self.commission_df = pd.DataFrame(columns=self.df_columns)
<|end_body_0|>
<|body_start_1|>
if self.commission_df.shape[0] == 0:
return str(self.commission_df.in... | 交易手续费计算,记录,分析类,在AbuCapital中实例化 | AbuCommission | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AbuCommission:
"""交易手续费计算,记录,分析类,在AbuCapital中实例化"""
def __init__(self, commission_dict):
""":param commission_dict: 代表用户自定义手续费计算dict对象, key:buy_commission_func, 代表用户自定义买入计算费用方法 key:sell_commission_func,代表用户自定义卖出计算费用方法"""
<|body_0|>
def __str__(self):
"""打印对象显示:如果... | stack_v2_sparse_classes_36k_train_005292 | 9,854 | permissive | [
{
"docstring": ":param commission_dict: 代表用户自定义手续费计算dict对象, key:buy_commission_func, 代表用户自定义买入计算费用方法 key:sell_commission_func,代表用户自定义卖出计算费用方法",
"name": "__init__",
"signature": "def __init__(self, commission_dict)"
},
{
"docstring": "打印对象显示:如果有手续费记录,打印记录df,否则打印commission_df.info",
"name": "_... | 5 | stack_v2_sparse_classes_30k_train_019652 | Implement the Python class `AbuCommission` described below.
Class description:
交易手续费计算,记录,分析类,在AbuCapital中实例化
Method signatures and docstrings:
- def __init__(self, commission_dict): :param commission_dict: 代表用户自定义手续费计算dict对象, key:buy_commission_func, 代表用户自定义买入计算费用方法 key:sell_commission_func,代表用户自定义卖出计算费用方法
- def __s... | Implement the Python class `AbuCommission` described below.
Class description:
交易手续费计算,记录,分析类,在AbuCapital中实例化
Method signatures and docstrings:
- def __init__(self, commission_dict): :param commission_dict: 代表用户自定义手续费计算dict对象, key:buy_commission_func, 代表用户自定义买入计算费用方法 key:sell_commission_func,代表用户自定义卖出计算费用方法
- def __s... | 2e5ab17f2d20deb3c68c927f6208ea89db7c639d | <|skeleton|>
class AbuCommission:
"""交易手续费计算,记录,分析类,在AbuCapital中实例化"""
def __init__(self, commission_dict):
""":param commission_dict: 代表用户自定义手续费计算dict对象, key:buy_commission_func, 代表用户自定义买入计算费用方法 key:sell_commission_func,代表用户自定义卖出计算费用方法"""
<|body_0|>
def __str__(self):
"""打印对象显示:如果... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AbuCommission:
"""交易手续费计算,记录,分析类,在AbuCapital中实例化"""
def __init__(self, commission_dict):
""":param commission_dict: 代表用户自定义手续费计算dict对象, key:buy_commission_func, 代表用户自定义买入计算费用方法 key:sell_commission_func,代表用户自定义卖出计算费用方法"""
self.commission_dict = commission_dict
self.df_columns = ['t... | the_stack_v2_python_sparse | abupy/TradeBu/ABuCommission.py | luqin/firefly | train | 1 |
85eb3e54e049f9532e6d869841d2872c6b51ab98 | [
"sc.logger.info('创作页面初始状态检查测试开始')\nfun_name = 'test_origin'\nsc.logger.info('点击创作中心主按钮')\nc_btn = 'com.quvideo.xiaoying:id/img_creation'\nWebDriverWait(sc.driver, 10, 1).until(lambda el: el.find_element_by_id(c_btn)).click()\nsc.capture_screen(fun_name, self.img_path)",
"sc.logger.info('创作页面下拉刷新测试开始')\nfun_name =... | <|body_start_0|>
sc.logger.info('创作页面初始状态检查测试开始')
fun_name = 'test_origin'
sc.logger.info('点击创作中心主按钮')
c_btn = 'com.quvideo.xiaoying:id/img_creation'
WebDriverWait(sc.driver, 10, 1).until(lambda el: el.find_element_by_id(c_btn)).click()
sc.capture_screen(fun_name, self.im... | 创作页面的测试类,分步截图 | TestCreationUI | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestCreationUI:
"""创作页面的测试类,分步截图"""
def test_origin(self):
"""测试创作页面初始UI状态"""
<|body_0|>
def test_refresh(self):
"""测试下拉刷新"""
<|body_1|>
def test_swipe_vertical(self):
"""测试上下方向的滑动"""
<|body_2|>
def test_origin_home(self):
... | stack_v2_sparse_classes_36k_train_005293 | 2,772 | no_license | [
{
"docstring": "测试创作页面初始UI状态",
"name": "test_origin",
"signature": "def test_origin(self)"
},
{
"docstring": "测试下拉刷新",
"name": "test_refresh",
"signature": "def test_refresh(self)"
},
{
"docstring": "测试上下方向的滑动",
"name": "test_swipe_vertical",
"signature": "def test_swipe_... | 4 | stack_v2_sparse_classes_30k_train_019864 | Implement the Python class `TestCreationUI` described below.
Class description:
创作页面的测试类,分步截图
Method signatures and docstrings:
- def test_origin(self): 测试创作页面初始UI状态
- def test_refresh(self): 测试下拉刷新
- def test_swipe_vertical(self): 测试上下方向的滑动
- def test_origin_home(self): 测试创作页home tab的功能 | Implement the Python class `TestCreationUI` described below.
Class description:
创作页面的测试类,分步截图
Method signatures and docstrings:
- def test_origin(self): 测试创作页面初始UI状态
- def test_refresh(self): 测试下拉刷新
- def test_swipe_vertical(self): 测试上下方向的滑动
- def test_origin_home(self): 测试创作页home tab的功能
<|skeleton|>
class TestCreat... | 0003b68fc8e26a96ee1661c1eb1f26f96810e909 | <|skeleton|>
class TestCreationUI:
"""创作页面的测试类,分步截图"""
def test_origin(self):
"""测试创作页面初始UI状态"""
<|body_0|>
def test_refresh(self):
"""测试下拉刷新"""
<|body_1|>
def test_swipe_vertical(self):
"""测试上下方向的滑动"""
<|body_2|>
def test_origin_home(self):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestCreationUI:
"""创作页面的测试类,分步截图"""
def test_origin(self):
"""测试创作页面初始UI状态"""
sc.logger.info('创作页面初始状态检查测试开始')
fun_name = 'test_origin'
sc.logger.info('点击创作中心主按钮')
c_btn = 'com.quvideo.xiaoying:id/img_creation'
WebDriverWait(sc.driver, 10, 1).until(lambda e... | the_stack_v2_python_sparse | Android/VivaVideo/test_creations/test_ui.py | Lemonzhulixin/UItest | train | 5 |
58e20a7bc841922de93db80a3b22aeaa802e909d | [
"res = ''\nfactorial = [1] * (n + 1)\nfor i in range(1, n + 1):\n factorial[i] = factorial[i - 1] * i\nnums = [i for i in range(1, n + 1)]\nk -= 1\nfor i in range(1, n + 1):\n idx = k / factorial[n - i]\n res += str(nums[int(idx)])\n nums.pop(int(idx))\n k -= idx * factorial[n - i]\nreturn res",
"d... | <|body_start_0|>
res = ''
factorial = [1] * (n + 1)
for i in range(1, n + 1):
factorial[i] = factorial[i - 1] * i
nums = [i for i in range(1, n + 1)]
k -= 1
for i in range(1, n + 1):
idx = k / factorial[n - i]
res += str(nums[int(idx)])... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def getPermutation(self, n, k):
""":type n: int :type k: int :rtype: str"""
<|body_0|>
def getPermutation1(self, n, k):
""":type n: int :type k: int :rtype: str"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
res = ''
factorial = [... | stack_v2_sparse_classes_36k_train_005294 | 1,719 | no_license | [
{
"docstring": ":type n: int :type k: int :rtype: str",
"name": "getPermutation",
"signature": "def getPermutation(self, n, k)"
},
{
"docstring": ":type n: int :type k: int :rtype: str",
"name": "getPermutation1",
"signature": "def getPermutation1(self, n, k)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def getPermutation(self, n, k): :type n: int :type k: int :rtype: str
- def getPermutation1(self, n, k): :type n: int :type k: int :rtype: str | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def getPermutation(self, n, k): :type n: int :type k: int :rtype: str
- def getPermutation1(self, n, k): :type n: int :type k: int :rtype: str
<|skeleton|>
class Solution:
... | f1d780b7e8b91b4df704651514018143c6931f9d | <|skeleton|>
class Solution:
def getPermutation(self, n, k):
""":type n: int :type k: int :rtype: str"""
<|body_0|>
def getPermutation1(self, n, k):
""":type n: int :type k: int :rtype: str"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def getPermutation(self, n, k):
""":type n: int :type k: int :rtype: str"""
res = ''
factorial = [1] * (n + 1)
for i in range(1, n + 1):
factorial[i] = factorial[i - 1] * i
nums = [i for i in range(1, n + 1)]
k -= 1
for i in range(1... | the_stack_v2_python_sparse | ProgramForLeetCode/LeetCode/60_getPermutation.py | DQDH/Algorithm_Code | train | 0 | |
9e677a5bebc3c904b28b4003832aea8c75dbe374 | [
"for each in Document:\n if string == each.value:\n return each\nreturn None",
"if doc_type is Document.INVALID:\n error = exceptions.ConfigError('Document.INVALID has no hierarchy class.', data={'doc_type': doc_type})\n raise log.exception(error, 'Should never be looking for INVALID document type... | <|body_start_0|>
for each in Document:
if string == each.value:
return each
return None
<|end_body_0|>
<|body_start_1|>
if doc_type is Document.INVALID:
error = exceptions.ConfigError('Document.INVALID has no hierarchy class.', data={'doc_type': doc_type}... | Document | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Document:
def get(string: str) -> Optional['Document']:
"""Convert a string into a Document enum value. Returns None if no conversion is found. Isn't smart - no case insensitivity or anything. Only compares input against our enum /values/."""
<|body_0|>
def hierarchy(doc_typ... | stack_v2_sparse_classes_36k_train_005295 | 7,404 | no_license | [
{
"docstring": "Convert a string into a Document enum value. Returns None if no conversion is found. Isn't smart - no case insensitivity or anything. Only compares input against our enum /values/.",
"name": "get",
"signature": "def get(string: str) -> Optional['Document']"
},
{
"docstring": "Get... | 2 | null | Implement the Python class `Document` described below.
Class description:
Implement the Document class.
Method signatures and docstrings:
- def get(string: str) -> Optional['Document']: Convert a string into a Document enum value. Returns None if no conversion is found. Isn't smart - no case insensitivity or anything... | Implement the Python class `Document` described below.
Class description:
Implement the Document class.
Method signatures and docstrings:
- def get(string: str) -> Optional['Document']: Convert a string into a Document enum value. Returns None if no conversion is found. Isn't smart - no case insensitivity or anything... | 8c9fc1170ceac335985686571568eebf08b0db7a | <|skeleton|>
class Document:
def get(string: str) -> Optional['Document']:
"""Convert a string into a Document enum value. Returns None if no conversion is found. Isn't smart - no case insensitivity or anything. Only compares input against our enum /values/."""
<|body_0|>
def hierarchy(doc_typ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Document:
def get(string: str) -> Optional['Document']:
"""Convert a string into a Document enum value. Returns None if no conversion is found. Isn't smart - no case insensitivity or anything. Only compares input against our enum /values/."""
for each in Document:
if string == each... | the_stack_v2_python_sparse | data/config/hierarchy.py | cole-brown/veredi-code | train | 1 | |
87e5198b76d01c04aac8e3619379237bd04a5796 | [
"super().__init__(**kwargs)\nself.num_players = kwargs['num_players']\nself.action_num = kwargs['action_num']\nself.state_shape = kwargs['state_shape']\nself.use_raw = True\nself.rule_agents = list()",
"agent_list: List\nagent_list = get_agents(agents=agents, nr_players=self.num_players, action_num=self.action_nu... | <|body_start_0|>
super().__init__(**kwargs)
self.num_players = kwargs['num_players']
self.action_num = kwargs['action_num']
self.state_shape = kwargs['state_shape']
self.use_raw = True
self.rule_agents = list()
<|end_body_0|>
<|body_start_1|>
agent_list: List
... | Mocsar Rule Model version 1 | MocsarCfgModel | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MocsarCfgModel:
"""Mocsar Rule Model version 1"""
def __init__(self, **kwargs):
"""Load pretrained model"""
<|body_0|>
def create_agents(self, agents: Dict):
"""Initalize agents to play the game. :param agents: Dictionary of agent_name: number of agents pairs"""
... | stack_v2_sparse_classes_36k_train_005296 | 1,228 | permissive | [
{
"docstring": "Load pretrained model",
"name": "__init__",
"signature": "def __init__(self, **kwargs)"
},
{
"docstring": "Initalize agents to play the game. :param agents: Dictionary of agent_name: number of agents pairs",
"name": "create_agents",
"signature": "def create_agents(self, a... | 2 | stack_v2_sparse_classes_30k_train_016597 | Implement the Python class `MocsarCfgModel` described below.
Class description:
Mocsar Rule Model version 1
Method signatures and docstrings:
- def __init__(self, **kwargs): Load pretrained model
- def create_agents(self, agents: Dict): Initalize agents to play the game. :param agents: Dictionary of agent_name: numbe... | Implement the Python class `MocsarCfgModel` described below.
Class description:
Mocsar Rule Model version 1
Method signatures and docstrings:
- def __init__(self, **kwargs): Load pretrained model
- def create_agents(self, agents: Dict): Initalize agents to play the game. :param agents: Dictionary of agent_name: numbe... | e9bbd36b789e670f96622a3a2ba8327f0d897561 | <|skeleton|>
class MocsarCfgModel:
"""Mocsar Rule Model version 1"""
def __init__(self, **kwargs):
"""Load pretrained model"""
<|body_0|>
def create_agents(self, agents: Dict):
"""Initalize agents to play the game. :param agents: Dictionary of agent_name: number of agents pairs"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MocsarCfgModel:
"""Mocsar Rule Model version 1"""
def __init__(self, **kwargs):
"""Load pretrained model"""
super().__init__(**kwargs)
self.num_players = kwargs['num_players']
self.action_num = kwargs['action_num']
self.state_shape = kwargs['state_shape']
s... | the_stack_v2_python_sparse | rlcard3/models/mocsar_cfg_model.py | sorata2894/rlcard3 | train | 0 |
5b27f794883ed18b0c95360e6ea778cb50d750a2 | [
"postorder = []\n\ndef traverse(root):\n if root is None:\n postorder.append('#')\n return\n traverse(root.left)\n traverse(root.right)\n postorder.append(root.val)\ntraverse(root)\nreturn ','.join([str(val) for val in postorder])",
"if data == '':\n return None\npostorder = data.spli... | <|body_start_0|>
postorder = []
def traverse(root):
if root is None:
postorder.append('#')
return
traverse(root.left)
traverse(root.right)
postorder.append(root.val)
traverse(root)
return ','.join([str(val) ... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|>
<|body_... | stack_v2_sparse_classes_36k_train_005297 | 6,926 | 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_020983 | 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:... | 0821af55eca60084b503b5f751301048c55e4381 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
postorder = []
def traverse(root):
if root is None:
postorder.append('#')
return
traverse(root.left)
traverse... | the_stack_v2_python_sparse | Hard/LC297.py | shuowenwei/LeetCodePython | train | 2 | |
028d80b24867f09946d11df436e66ed39985cbb7 | [
"super(FocalLoss, self).__init__()\nif weight is not None:\n weight = torch.tensor(weight).float()\nself.weight = weight\nself.gamma = gamma",
"num_classes = logits.shape[1]\ngt = gt.long()\nif num_classes == 1:\n num_classes = 2\n gt_1_hot = torch.eye(num_classes)[gt.squeeze(1)]\n gt_1_hot = gt_1_hot... | <|body_start_0|>
super(FocalLoss, self).__init__()
if weight is not None:
weight = torch.tensor(weight).float()
self.weight = weight
self.gamma = gamma
<|end_body_0|>
<|body_start_1|>
num_classes = logits.shape[1]
gt = gt.long()
if num_classes == 1:
... | FocalLoss | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FocalLoss:
def __init__(self, weight=None, gamma=2.0):
"""computes focal loss :param alpha: focal loss cofficient :param gamma: focal loss cofficient"""
<|body_0|>
def forward(self, gt, logits):
"""computes focal loss :param gt: a tensor of shape [B, 1, H, W]. :param... | stack_v2_sparse_classes_36k_train_005298 | 12,362 | no_license | [
{
"docstring": "computes focal loss :param alpha: focal loss cofficient :param gamma: focal loss cofficient",
"name": "__init__",
"signature": "def __init__(self, weight=None, gamma=2.0)"
},
{
"docstring": "computes focal loss :param gt: a tensor of shape [B, 1, H, W]. :param logits: a tensor of... | 2 | stack_v2_sparse_classes_30k_train_007949 | Implement the Python class `FocalLoss` described below.
Class description:
Implement the FocalLoss class.
Method signatures and docstrings:
- def __init__(self, weight=None, gamma=2.0): computes focal loss :param alpha: focal loss cofficient :param gamma: focal loss cofficient
- def forward(self, gt, logits): compute... | Implement the Python class `FocalLoss` described below.
Class description:
Implement the FocalLoss class.
Method signatures and docstrings:
- def __init__(self, weight=None, gamma=2.0): computes focal loss :param alpha: focal loss cofficient :param gamma: focal loss cofficient
- def forward(self, gt, logits): compute... | 8e6f42e3a0cbc87c66b148fb61fcb44af287619e | <|skeleton|>
class FocalLoss:
def __init__(self, weight=None, gamma=2.0):
"""computes focal loss :param alpha: focal loss cofficient :param gamma: focal loss cofficient"""
<|body_0|>
def forward(self, gt, logits):
"""computes focal loss :param gt: a tensor of shape [B, 1, H, W]. :param... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FocalLoss:
def __init__(self, weight=None, gamma=2.0):
"""computes focal loss :param alpha: focal loss cofficient :param gamma: focal loss cofficient"""
super(FocalLoss, self).__init__()
if weight is not None:
weight = torch.tensor(weight).float()
self.weight = weig... | the_stack_v2_python_sparse | lib/loss/loss.py | yangsenwxy/colonoscopy_tissue_screen_and_segmentation | train | 0 | |
72ab859c207597c3d39c91a52bb33f152d60ac3b | [
"self.email = email\nself.password = password\nchrome_options = Options()\nself.bot = webdriver.Chrome(executable_path=os.path.join(os.getcwd(), 'chromedriver'), options=chrome_options)",
"bot = self.bot\nbot.get('https://twitter.com/login')\ntime.sleep(3)\nemail = bot.find_element_by_xpath('//*[@id =\"react-root... | <|body_start_0|>
self.email = email
self.password = password
chrome_options = Options()
self.bot = webdriver.Chrome(executable_path=os.path.join(os.getcwd(), 'chromedriver'), options=chrome_options)
<|end_body_0|>
<|body_start_1|>
bot = self.bot
bot.get('https://twitter.... | Twitterbot | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Twitterbot:
def __init__(self, email, password):
"""Constructor Arguments: email {string} -- registered twitter email password {string} -- password for the twitter account"""
<|body_0|>
def login(self):
"""Method for signing in the user with the provided email and pa... | stack_v2_sparse_classes_36k_train_005299 | 3,457 | no_license | [
{
"docstring": "Constructor Arguments: email {string} -- registered twitter email password {string} -- password for the twitter account",
"name": "__init__",
"signature": "def __init__(self, email, password)"
},
{
"docstring": "Method for signing in the user with the provided email and password.... | 3 | stack_v2_sparse_classes_30k_train_021563 | Implement the Python class `Twitterbot` described below.
Class description:
Implement the Twitterbot class.
Method signatures and docstrings:
- def __init__(self, email, password): Constructor Arguments: email {string} -- registered twitter email password {string} -- password for the twitter account
- def login(self)... | Implement the Python class `Twitterbot` described below.
Class description:
Implement the Twitterbot class.
Method signatures and docstrings:
- def __init__(self, email, password): Constructor Arguments: email {string} -- registered twitter email password {string} -- password for the twitter account
- def login(self)... | 4ebb168072ed4246aa1dde642e448b0a974a6603 | <|skeleton|>
class Twitterbot:
def __init__(self, email, password):
"""Constructor Arguments: email {string} -- registered twitter email password {string} -- password for the twitter account"""
<|body_0|>
def login(self):
"""Method for signing in the user with the provided email and pa... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Twitterbot:
def __init__(self, email, password):
"""Constructor Arguments: email {string} -- registered twitter email password {string} -- password for the twitter account"""
self.email = email
self.password = password
chrome_options = Options()
self.bot = webdriver.Chr... | the_stack_v2_python_sparse | twitterBot.py | FuckBrains/NewsPython | train | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.