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
0258983c9b059ccec072195ce6e1f212887933f0
[ "if context is None:\n context = {}\nsuper(building_fill_insurance, self).view_init(cr, uid, fields_list, context=context)\nif len(context.get('active_ids', [])) > 1:\n raise osv.except_osv(_('Error!'), _('You cannot perform this operation on more than one building.'))\nif context.get('active_id', False):\n ...
<|body_start_0|> if context is None: context = {} super(building_fill_insurance, self).view_init(cr, uid, fields_list, context=context) if len(context.get('active_ids', [])) > 1: raise osv.except_osv(_('Error!'), _('You cannot perform this operation on more than one build...
building_fill_insurance
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class building_fill_insurance: def view_init(self, cr, uid, fields_list, context=None): """Creates view dynamically and adding fields at runtime. @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param context: A standard dictionary @...
stack_v2_sparse_classes_36k_train_025600
4,027
no_license
[ { "docstring": "Creates view dynamically and adding fields at runtime. @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param context: A standard dictionary @return: New arch of view with new columns.", "name": "view_init", "signature": "def v...
2
stack_v2_sparse_classes_30k_train_013752
Implement the Python class `building_fill_insurance` described below. Class description: Implement the building_fill_insurance class. Method signatures and docstrings: - def view_init(self, cr, uid, fields_list, context=None): Creates view dynamically and adding fields at runtime. @param self: The object pointer. @pa...
Implement the Python class `building_fill_insurance` described below. Class description: Implement the building_fill_insurance class. Method signatures and docstrings: - def view_init(self, cr, uid, fields_list, context=None): Creates view dynamically and adding fields at runtime. @param self: The object pointer. @pa...
0b997095c260d58b026440967fea3a202bef7efb
<|skeleton|> class building_fill_insurance: def view_init(self, cr, uid, fields_list, context=None): """Creates view dynamically and adding fields at runtime. @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param context: A standard dictionary @...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class building_fill_insurance: def view_init(self, cr, uid, fields_list, context=None): """Creates view dynamically and adding fields at runtime. @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param context: A standard dictionary @return: New ar...
the_stack_v2_python_sparse
v_7/GDS/shamil_v3/building_management_6.1/wizard/building_fill_insurance.py
musabahmed/baba
train
0
f0f80f3716b3efd0a35fd3914efbf09ed4d9e0d2
[ "from h5py import File as h5\nself.preexisting_slice = preexisting_slice\nself.incoming_slice = incoming_slice\nself.received_slices = []\nself.bins = np.squeeze(np.array(eval(bins)))\nself.frames_per_block = frames_per_block\nself.outputs = outputs\npdist = np.zeros(self.bins.size - 1, dtype=[('lower bound', 'f4')...
<|body_start_0|> from h5py import File as h5 self.preexisting_slice = preexisting_slice self.incoming_slice = incoming_slice self.received_slices = [] self.bins = np.squeeze(np.array(eval(bins))) self.frames_per_block = frames_per_block self.outputs = outputs ...
Coroutine class; accumulates Blocks of data and performs analysis once complete dataset is present; may then be sent to a Block_Acceptor
Hist_Block_Accumulator
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Hist_Block_Accumulator: """Coroutine class; accumulates Blocks of data and performs analysis once complete dataset is present; may then be sent to a Block_Acceptor""" def __init__(self, preexisting_slice, incoming_slice, bins, frames_per_block, outputs, attrs={}, **kwargs): """Initia...
stack_v2_sparse_classes_36k_train_025601
28,607
permissive
[ { "docstring": "Initializes accumulator **Arguments:** :*preexisting_slice*: Slice containing frame indices whose results were included in *outputs* before this invocation of program :*incoming_slice*: Slice containting frame indices whose results are to be added to *outputs* during this invocation of program :...
3
stack_v2_sparse_classes_30k_train_005375
Implement the Python class `Hist_Block_Accumulator` described below. Class description: Coroutine class; accumulates Blocks of data and performs analysis once complete dataset is present; may then be sent to a Block_Acceptor Method signatures and docstrings: - def __init__(self, preexisting_slice, incoming_slice, bin...
Implement the Python class `Hist_Block_Accumulator` described below. Class description: Coroutine class; accumulates Blocks of data and performs analysis once complete dataset is present; may then be sent to a Block_Acceptor Method signatures and docstrings: - def __init__(self, preexisting_slice, incoming_slice, bin...
9e86e996ed7958a348012c053fa957d94729be8a
<|skeleton|> class Hist_Block_Accumulator: """Coroutine class; accumulates Blocks of data and performs analysis once complete dataset is present; may then be sent to a Block_Acceptor""" def __init__(self, preexisting_slice, incoming_slice, bins, frames_per_block, outputs, attrs={}, **kwargs): """Initia...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Hist_Block_Accumulator: """Coroutine class; accumulates Blocks of data and performs analysis once complete dataset is present; may then be sent to a Block_Acceptor""" def __init__(self, preexisting_slice, incoming_slice, bins, frames_per_block, outputs, attrs={}, **kwargs): """Initializes accumul...
the_stack_v2_python_sparse
secondary/pdist.py
KarlTDebiec/MDclt
train
0
94115ff2095dcfa76bde980484cb447ce6beb69b
[ "pass\nres = []\ntry:\n all = models.Position.objects.all()\n for postion in all:\n res.append({'name': postion.name, 'salary': postion.salary, 'experience': postion.experience, 'education': postion.education, 'keyword': postion.keyword, 'company': postion.company, 'add_time': postion.add_time.strftime...
<|body_start_0|> pass res = [] try: all = models.Position.objects.all() for postion in all: res.append({'name': postion.name, 'salary': postion.salary, 'experience': postion.experience, 'education': postion.education, 'keyword': postion.keyword, 'company':...
Position
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Position: def get(self, request): """获取简历列表""" <|body_0|> def post(self, request): """新增职位""" <|body_1|> <|end_skeleton|> <|body_start_0|> pass res = [] try: all = models.Position.objects.all() for postion in ...
stack_v2_sparse_classes_36k_train_025602
1,855
no_license
[ { "docstring": "获取简历列表", "name": "get", "signature": "def get(self, request)" }, { "docstring": "新增职位", "name": "post", "signature": "def post(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_019822
Implement the Python class `Position` described below. Class description: Implement the Position class. Method signatures and docstrings: - def get(self, request): 获取简历列表 - def post(self, request): 新增职位
Implement the Python class `Position` described below. Class description: Implement the Position class. Method signatures and docstrings: - def get(self, request): 获取简历列表 - def post(self, request): 新增职位 <|skeleton|> class Position: def get(self, request): """获取简历列表""" <|body_0|> def post(se...
d7acdadc07e5c33e4d46168fa4b435fc24b36aa1
<|skeleton|> class Position: def get(self, request): """获取简历列表""" <|body_0|> def post(self, request): """新增职位""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Position: def get(self, request): """获取简历列表""" pass res = [] try: all = models.Position.objects.all() for postion in all: res.append({'name': postion.name, 'salary': postion.salary, 'experience': postion.experience, 'education': postion.e...
the_stack_v2_python_sparse
djangoProject/rcw/Position/position.py
Asenli/Recruitment
train
0
a341395cfa7e686427a468eb93a365b762be5257
[ "args = self.comments_filter.parse_args()\nitems_per_page = 20\npage_number = args['page']\nif page_number < 1:\n return abort(HTTPStatus.BAD_REQUEST, message=\"'page' must be > 0\")\nitems_query = Thesis.query.join(Thesis.comment_backref).filter(ThesisComment.thesis_id == thesis_id).order_by(Thesis.created_at.a...
<|body_start_0|> args = self.comments_filter.parse_args() items_per_page = 20 page_number = args['page'] if page_number < 1: return abort(HTTPStatus.BAD_REQUEST, message="'page' must be > 0") items_query = Thesis.query.join(Thesis.comment_backref).filter(ThesisComment...
ThesisComments
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ThesisComments: def get(self, thesis_id): """Get comments of the thesis * User can view comments of thesis * View with pagination""" <|body_0|> def post(self, thesis_id): """Create a new thesis comment * User with permission to **"create theses"** can create a new co...
stack_v2_sparse_classes_36k_train_025603
3,272
permissive
[ { "docstring": "Get comments of the thesis * User can view comments of thesis * View with pagination", "name": "get", "signature": "def get(self, thesis_id)" }, { "docstring": "Create a new thesis comment * User with permission to **\"create theses\"** can create a new comment * **Comment is a t...
2
null
Implement the Python class `ThesisComments` described below. Class description: Implement the ThesisComments class. Method signatures and docstrings: - def get(self, thesis_id): Get comments of the thesis * User can view comments of thesis * View with pagination - def post(self, thesis_id): Create a new thesis commen...
Implement the Python class `ThesisComments` described below. Class description: Implement the ThesisComments class. Method signatures and docstrings: - def get(self, thesis_id): Get comments of the thesis * User can view comments of thesis * View with pagination - def post(self, thesis_id): Create a new thesis commen...
dce87ffe395ae4bd08b47f28e07594e1889da819
<|skeleton|> class ThesisComments: def get(self, thesis_id): """Get comments of the thesis * User can view comments of thesis * View with pagination""" <|body_0|> def post(self, thesis_id): """Create a new thesis comment * User with permission to **"create theses"** can create a new co...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ThesisComments: def get(self, thesis_id): """Get comments of the thesis * User can view comments of thesis * View with pagination""" args = self.comments_filter.parse_args() items_per_page = 20 page_number = args['page'] if page_number < 1: return abort(HTTP...
the_stack_v2_python_sparse
src/backend/app/api/public/theses/thesis/thesis_comments.py
aimanow/sft
train
0
092d7f1d4fbcb6c5d20129cfa6bed7e8e4c36b25
[ "if n == 0:\n return []\n\ndef generate(l, r):\n res = []\n for i in range(l, r + 1):\n for ll in generate(l, i - 1):\n for rr in generate(i + 1, r):\n root = TreeNode(i)\n root.left = ll\n root.right = rr\n res += (root,)\n r...
<|body_start_0|> if n == 0: return [] def generate(l, r): res = [] for i in range(l, r + 1): for ll in generate(l, i - 1): for rr in generate(i + 1, r): root = TreeNode(i) root.left =...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def generateTrees(self, n): """:type n: int :rtype: List[TreeNode]""" <|body_0|> def generateTrees2(self, n): """:type n: int :rtype: List[TreeNode]""" <|body_1|> <|end_skeleton|> <|body_start_0|> if n == 0: return [] ...
stack_v2_sparse_classes_36k_train_025604
1,507
no_license
[ { "docstring": ":type n: int :rtype: List[TreeNode]", "name": "generateTrees", "signature": "def generateTrees(self, n)" }, { "docstring": ":type n: int :rtype: List[TreeNode]", "name": "generateTrees2", "signature": "def generateTrees2(self, n)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def generateTrees(self, n): :type n: int :rtype: List[TreeNode] - def generateTrees2(self, n): :type n: int :rtype: List[TreeNode]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def generateTrees(self, n): :type n: int :rtype: List[TreeNode] - def generateTrees2(self, n): :type n: int :rtype: List[TreeNode] <|skeleton|> class Solution: def generate...
4105e18050b15fc0409c75353ad31be17187dd34
<|skeleton|> class Solution: def generateTrees(self, n): """:type n: int :rtype: List[TreeNode]""" <|body_0|> def generateTrees2(self, n): """:type n: int :rtype: List[TreeNode]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def generateTrees(self, n): """:type n: int :rtype: List[TreeNode]""" if n == 0: return [] def generate(l, r): res = [] for i in range(l, r + 1): for ll in generate(l, i - 1): for rr in generate(i + 1, r...
the_stack_v2_python_sparse
generateTrees.py
NeilWangziyu/Leetcode_py
train
2
743ec0f5efa603002d9e45b1993bd523adf56d43
[ "super(CustomResNet152, self).__init__()\nself.dim = dim\nresnet = torchvision.models.resnet152(pretrained=True)\nmodules = list(resnet.children())[:-2]\nself.resnet = nn.Sequential(*modules)\nself.conv = nn.Conv2d(2048, self.dim, kernel_size=(1, 1), stride=(1, 1), bias=False)\nif train_resnet:\n for i, child in...
<|body_start_0|> super(CustomResNet152, self).__init__() self.dim = dim resnet = torchvision.models.resnet152(pretrained=True) modules = list(resnet.children())[:-2] self.resnet = nn.Sequential(*modules) self.conv = nn.Conv2d(2048, self.dim, kernel_size=(1, 1), stride=(1,...
Image encoder that computes both its image embedding and its convolutional feature map
CustomResNet152
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CustomResNet152: """Image encoder that computes both its image embedding and its convolutional feature map""" def __init__(self, dim=1024, train_resnet=False): """Initializes image encoder based on ResNet :param dim: length of the UniVSE space embeddings :param train_resnet: sets bac...
stack_v2_sparse_classes_36k_train_025605
20,277
no_license
[ { "docstring": "Initializes image encoder based on ResNet :param dim: length of the UniVSE space embeddings :param train_resnet: sets backbone's weights as trainable if true", "name": "__init__", "signature": "def __init__(self, dim=1024, train_resnet=False)" }, { "docstring": "Forward pass of t...
2
stack_v2_sparse_classes_30k_train_021538
Implement the Python class `CustomResNet152` described below. Class description: Image encoder that computes both its image embedding and its convolutional feature map Method signatures and docstrings: - def __init__(self, dim=1024, train_resnet=False): Initializes image encoder based on ResNet :param dim: length of ...
Implement the Python class `CustomResNet152` described below. Class description: Image encoder that computes both its image embedding and its convolutional feature map Method signatures and docstrings: - def __init__(self, dim=1024, train_resnet=False): Initializes image encoder based on ResNet :param dim: length of ...
bc4fe571775e982975d6ecac82253e94de9dcd2b
<|skeleton|> class CustomResNet152: """Image encoder that computes both its image embedding and its convolutional feature map""" def __init__(self, dim=1024, train_resnet=False): """Initializes image encoder based on ResNet :param dim: length of the UniVSE space embeddings :param train_resnet: sets bac...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CustomResNet152: """Image encoder that computes both its image embedding and its convolutional feature map""" def __init__(self, dim=1024, train_resnet=False): """Initializes image encoder based on ResNet :param dim: length of the UniVSE space embeddings :param train_resnet: sets backbone's weigh...
the_stack_v2_python_sparse
models/univse/model.py
strategist922/UniVSE
train
0
af9816297dd3a3ca58c1e068123a39d3cc83fda7
[ "self.turns = turns\nself.length = length\nself.radius = diameter / 2.0\nself.current = current\nself.use_biot_savart = use_biot_savart", "phi = np.linspace(0, 2 * np.pi * self.turns, 10000)\nsPhi = np.sin(phi)\ncPhi = np.cos(phi)\nlx = self.radius * sPhi\nly = self.radius * cPhi\nlz = self.length / 2 * (phi / (n...
<|body_start_0|> self.turns = turns self.length = length self.radius = diameter / 2.0 self.current = current self.use_biot_savart = use_biot_savart <|end_body_0|> <|body_start_1|> phi = np.linspace(0, 2 * np.pi * self.turns, 10000) sPhi = np.sin(phi) cPhi...
A coil parametrized by number of turns, length, diameter and current. You can calculate the magnetic field cause by the coil at any point in space.
Coil
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Coil: """A coil parametrized by number of turns, length, diameter and current. You can calculate the magnetic field cause by the coil at any point in space.""" def __init__(self, turns, length, diameter, current, use_biot_savart=False): """Generates a coil objsect. Parameters: * turn...
stack_v2_sparse_classes_36k_train_025606
2,858
permissive
[ { "docstring": "Generates a coil objsect. Parameters: * turns: int * length: float * diameter: float * current: float", "name": "__init__", "signature": "def __init__(self, turns, length, diameter, current, use_biot_savart=False)" }, { "docstring": "The magnetic field of the coil Assume Biot-Sav...
3
stack_v2_sparse_classes_30k_train_018469
Implement the Python class `Coil` described below. Class description: A coil parametrized by number of turns, length, diameter and current. You can calculate the magnetic field cause by the coil at any point in space. Method signatures and docstrings: - def __init__(self, turns, length, diameter, current, use_biot_sa...
Implement the Python class `Coil` described below. Class description: A coil parametrized by number of turns, length, diameter and current. You can calculate the magnetic field cause by the coil at any point in space. Method signatures and docstrings: - def __init__(self, turns, length, diameter, current, use_biot_sa...
40fe7f0892a5f4600d863658f748906bff050b67
<|skeleton|> class Coil: """A coil parametrized by number of turns, length, diameter and current. You can calculate the magnetic field cause by the coil at any point in space.""" def __init__(self, turns, length, diameter, current, use_biot_savart=False): """Generates a coil objsect. Parameters: * turn...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Coil: """A coil parametrized by number of turns, length, diameter and current. You can calculate the magnetic field cause by the coil at any point in space.""" def __init__(self, turns, length, diameter, current, use_biot_savart=False): """Generates a coil objsect. Parameters: * turns: int * leng...
the_stack_v2_python_sparse
FreeInductionDecay/simulation/coil.py
renereimann/FID_Simulation
train
0
ecc393ae1bed5f81482a5b70b2ab9ba42f2d07f0
[ "x1 = u[0]\nx2 = u[1]\ndfdu = np.array([[0, 1], [-2 * self.params.mu * x1 * x2 - 1, self.params.mu * (1 - x1 ** 2)]])\nreturn dfdu", "me = self.dtype_u(2)\nme[:] = spsolve(sp.eye(2) - factor * dfdu, rhs)\nreturn me" ]
<|body_start_0|> x1 = u[0] x2 = u[1] dfdu = np.array([[0, 1], [-2 * self.params.mu * x1 * x2 - 1, self.params.mu * (1 - x1 ** 2)]]) return dfdu <|end_body_0|> <|body_start_1|> me = self.dtype_u(2) me[:] = spsolve(sp.eye(2) - factor * dfdu, rhs) return me <|end_bo...
vanderpol_jac
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class vanderpol_jac: def eval_jacobian(self, u): """Evaluation of the Jacobian of the right-hand side Args: u: space values Returns: Jacobian matrix""" <|body_0|> def solve_system_jacobian(self, dfdu, rhs, factor, u0, t): """Simple linear solver for (I-dtA)u = rhs Args: df...
stack_v2_sparse_classes_36k_train_025607
1,228
permissive
[ { "docstring": "Evaluation of the Jacobian of the right-hand side Args: u: space values Returns: Jacobian matrix", "name": "eval_jacobian", "signature": "def eval_jacobian(self, u)" }, { "docstring": "Simple linear solver for (I-dtA)u = rhs Args: dfdu: the Jacobian of the RHS of the ODE rhs: rig...
2
stack_v2_sparse_classes_30k_train_012194
Implement the Python class `vanderpol_jac` described below. Class description: Implement the vanderpol_jac class. Method signatures and docstrings: - def eval_jacobian(self, u): Evaluation of the Jacobian of the right-hand side Args: u: space values Returns: Jacobian matrix - def solve_system_jacobian(self, dfdu, rhs...
Implement the Python class `vanderpol_jac` described below. Class description: Implement the vanderpol_jac class. Method signatures and docstrings: - def eval_jacobian(self, u): Evaluation of the Jacobian of the right-hand side Args: u: space values Returns: Jacobian matrix - def solve_system_jacobian(self, dfdu, rhs...
1a51834bedffd4472e344bed28f4d766614b1537
<|skeleton|> class vanderpol_jac: def eval_jacobian(self, u): """Evaluation of the Jacobian of the right-hand side Args: u: space values Returns: Jacobian matrix""" <|body_0|> def solve_system_jacobian(self, dfdu, rhs, factor, u0, t): """Simple linear solver for (I-dtA)u = rhs Args: df...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class vanderpol_jac: def eval_jacobian(self, u): """Evaluation of the Jacobian of the right-hand side Args: u: space values Returns: Jacobian matrix""" x1 = u[0] x2 = u[1] dfdu = np.array([[0, 1], [-2 * self.params.mu * x1 * x2 - 1, self.params.mu * (1 - x1 ** 2)]]) return df...
the_stack_v2_python_sparse
pySDC/projects/parallelSDC/Van_der_Pol_implicit_Jac.py
Parallel-in-Time/pySDC
train
30
19288c71780eeb1c96984cfd00fca7a05bbf909d
[ "self.name = None\nself.explanation = None\nself.detect = self.remove = self.avoid = None\nself.numdice = self.diesize = None\nself.extrainfo = None", "type = random.randint(1, 100)\nif type <= 11:\n return ExplosiveTrap(level)\nelif type <= 30:\n return MissileTrap(level)\nelif type <= 45:\n return GasT...
<|body_start_0|> self.name = None self.explanation = None self.detect = self.remove = self.avoid = None self.numdice = self.diesize = None self.extrainfo = None <|end_body_0|> <|body_start_1|> type = random.randint(1, 100) if type <= 11: return Explos...
Abstract class used to define common code for all potential Traps.
Trap
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Trap: """Abstract class used to define common code for all potential Traps.""" def __init__(self): """Initialize all common values to None.""" <|body_0|> def newtrap(level): """Class method: generate and return a new Trap of random type.""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_025608
14,223
no_license
[ { "docstring": "Initialize all common values to None.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Class method: generate and return a new Trap of random type.", "name": "newtrap", "signature": "def newtrap(level)" }, { "docstring": "Return a descrip...
3
stack_v2_sparse_classes_30k_test_000516
Implement the Python class `Trap` described below. Class description: Abstract class used to define common code for all potential Traps. Method signatures and docstrings: - def __init__(self): Initialize all common values to None. - def newtrap(level): Class method: generate and return a new Trap of random type. - de...
Implement the Python class `Trap` described below. Class description: Abstract class used to define common code for all potential Traps. Method signatures and docstrings: - def __init__(self): Initialize all common values to None. - def newtrap(level): Class method: generate and return a new Trap of random type. - de...
32583de92c11c7008db6095ebc25b4e5edf8e0f9
<|skeleton|> class Trap: """Abstract class used to define common code for all potential Traps.""" def __init__(self): """Initialize all common values to None.""" <|body_0|> def newtrap(level): """Class method: generate and return a new Trap of random type.""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Trap: """Abstract class used to define common code for all potential Traps.""" def __init__(self): """Initialize all common values to None.""" self.name = None self.explanation = None self.detect = self.remove = self.avoid = None self.numdice = self.diesize = None ...
the_stack_v2_python_sparse
elvenfire/labyrinth/traps.py
elven-fire/elvenfire
train
0
b856f7747b21d720bd74a737b9d136c9062871ca
[ "assert fanouts, 'fanouts must be specified'\nconfig = dict(fanouts=fanouts)\nconfig.update(kwargs)\nsuper().__init__(config=config)\nself.fanouts = fanouts\nself.fanouts_list = get_fanouts_list(fanouts)", "fans = {}\nif 'ids' in inputs:\n fans['ids'] = torch.split(inputs['ids'], self.fanouts_list, dim=-1)\nif...
<|body_start_0|> assert fanouts, 'fanouts must be specified' config = dict(fanouts=fanouts) config.update(kwargs) super().__init__(config=config) self.fanouts = fanouts self.fanouts_list = get_fanouts_list(fanouts) <|end_body_0|> <|body_start_1|> fans = {} ...
\\brief transform to convert bipartites \\details a bipartite is a dict: \\code{.py} dict( src=tensor, dst=tensor, src_feature=tensor, dst_feature=tensor, edge_weight=tensor, ) \\endcode \\par examples \\code{.py} >>> from galileo.pytorch import BipartiteTransform >>> bt = BipartiteTransform([2,3]) >>> res = bt.transfo...
BipartiteTransform
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference", "Apache-2.0", "BSD-2-Clause", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BipartiteTransform: """\\brief transform to convert bipartites \\details a bipartite is a dict: \\code{.py} dict( src=tensor, dst=tensor, src_feature=tensor, dst_feature=tensor, edge_weight=tensor, ) \\endcode \\par examples \\code{.py} >>> from galileo.pytorch import BipartiteTransform >>> bt = ...
stack_v2_sparse_classes_36k_train_025609
4,264
permissive
[ { "docstring": "\\\\param fanouts number of multi hop", "name": "__init__", "signature": "def __init__(self, fanouts: list, **kwargs)" }, { "docstring": "\\\\param inputs dict(ids=tensor,feature=tensor,edge_weight=tensor) \\\\return list of bipartite\\\\n items in bipartites are arranged in the ...
2
null
Implement the Python class `BipartiteTransform` described below. Class description: \\brief transform to convert bipartites \\details a bipartite is a dict: \\code{.py} dict( src=tensor, dst=tensor, src_feature=tensor, dst_feature=tensor, edge_weight=tensor, ) \\endcode \\par examples \\code{.py} >>> from galileo.pyto...
Implement the Python class `BipartiteTransform` described below. Class description: \\brief transform to convert bipartites \\details a bipartite is a dict: \\code{.py} dict( src=tensor, dst=tensor, src_feature=tensor, dst_feature=tensor, edge_weight=tensor, ) \\endcode \\par examples \\code{.py} >>> from galileo.pyto...
48099ec3f0331196c6812208ceb080ba618a588b
<|skeleton|> class BipartiteTransform: """\\brief transform to convert bipartites \\details a bipartite is a dict: \\code{.py} dict( src=tensor, dst=tensor, src_feature=tensor, dst_feature=tensor, edge_weight=tensor, ) \\endcode \\par examples \\code{.py} >>> from galileo.pytorch import BipartiteTransform >>> bt = ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BipartiteTransform: """\\brief transform to convert bipartites \\details a bipartite is a dict: \\code{.py} dict( src=tensor, dst=tensor, src_feature=tensor, dst_feature=tensor, edge_weight=tensor, ) \\endcode \\par examples \\code{.py} >>> from galileo.pytorch import BipartiteTransform >>> bt = BipartiteTran...
the_stack_v2_python_sparse
galileo/framework/pytorch/python/transforms/bipartite.py
2012fang1/galileo
train
0
80d4c817b15a509f9577ee94fdc236477bf53318
[ "if title is not None:\n try:\n manager = plt.get_current_fig_manager()\n manager.window.title(title)\n except:\n pass", "plt.show._needmain = False\nif p.filename is not None:\n fullname = p.filename + p.filename_suffix + str(topo.sim.time()) + '.' + p.file_format\n plt.savefig(n...
<|body_start_0|> if title is not None: try: manager = plt.get_current_fig_manager() manager.window.title(title) except: pass <|end_body_0|> <|body_start_1|> plt.show._needmain = False if p.filename is not None: ...
Parameterized command for plotting using Matplotlib/Pylab.
PylabPlotCommand
[ "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause", "LicenseRef-scancode-free-unknown" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PylabPlotCommand: """Parameterized command for plotting using Matplotlib/Pylab.""" def _set_windowtitle(self, title): """Helper function to set the title (if not None) of this PyLab plot window.""" <|body_0|> def _generate_figure(self, p): """Helper function to d...
stack_v2_sparse_classes_36k_train_025610
26,497
permissive
[ { "docstring": "Helper function to set the title (if not None) of this PyLab plot window.", "name": "_set_windowtitle", "signature": "def _set_windowtitle(self, title)" }, { "docstring": "Helper function to display a figure on screen or save to a file. p should be a ParamOverrides instance conta...
2
stack_v2_sparse_classes_30k_train_021154
Implement the Python class `PylabPlotCommand` described below. Class description: Parameterized command for plotting using Matplotlib/Pylab. Method signatures and docstrings: - def _set_windowtitle(self, title): Helper function to set the title (if not None) of this PyLab plot window. - def _generate_figure(self, p):...
Implement the Python class `PylabPlotCommand` described below. Class description: Parameterized command for plotting using Matplotlib/Pylab. Method signatures and docstrings: - def _set_windowtitle(self, title): Helper function to set the title (if not None) of this PyLab plot window. - def _generate_figure(self, p):...
1e097e2df9938a6ce9f48cefbf25672cbbf9a4db
<|skeleton|> class PylabPlotCommand: """Parameterized command for plotting using Matplotlib/Pylab.""" def _set_windowtitle(self, title): """Helper function to set the title (if not None) of this PyLab plot window.""" <|body_0|> def _generate_figure(self, p): """Helper function to d...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PylabPlotCommand: """Parameterized command for plotting using Matplotlib/Pylab.""" def _set_windowtitle(self, title): """Helper function to set the title (if not None) of this PyLab plot window.""" if title is not None: try: manager = plt.get_current_fig_manage...
the_stack_v2_python_sparse
topo/command/pylabplot.py
ioam/topographica
train
43
e66098fb2b562982364cec65e504aacad82e3ffe
[ "test_node = java_group.JavaGroup(self.TEST_GRP_1)\nself.assertEqual(test_node.name, self.TEST_GRP_1)\nself.assertEqual(test_node.classes, {})", "test_node = java_group.JavaGroup(self.TEST_GRP_1)\nmock_class_node = create_mock_java_class()\ntest_node.add_class(mock_class_node)\nself.assertEqual(test_node.classes,...
<|body_start_0|> test_node = java_group.JavaGroup(self.TEST_GRP_1) self.assertEqual(test_node.name, self.TEST_GRP_1) self.assertEqual(test_node.classes, {}) <|end_body_0|> <|body_start_1|> test_node = java_group.JavaGroup(self.TEST_GRP_1) mock_class_node = create_mock_java_class...
Unit tests for dependency_analysis.class_dependency.JavaGroup.
TestJavaPackage
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestJavaPackage: """Unit tests for dependency_analysis.class_dependency.JavaGroup.""" def test_initialization(self): """Tests that JavaGroup is initialized correctly.""" <|body_0|> def test_add_class(self): """Tests adding a single class to this group.""" ...
stack_v2_sparse_classes_36k_train_025611
4,390
permissive
[ { "docstring": "Tests that JavaGroup is initialized correctly.", "name": "test_initialization", "signature": "def test_initialization(self)" }, { "docstring": "Tests adding a single class to this group.", "name": "test_add_class", "signature": "def test_add_class(self)" }, { "doc...
6
stack_v2_sparse_classes_30k_val_001143
Implement the Python class `TestJavaPackage` described below. Class description: Unit tests for dependency_analysis.class_dependency.JavaGroup. Method signatures and docstrings: - def test_initialization(self): Tests that JavaGroup is initialized correctly. - def test_add_class(self): Tests adding a single class to t...
Implement the Python class `TestJavaPackage` described below. Class description: Unit tests for dependency_analysis.class_dependency.JavaGroup. Method signatures and docstrings: - def test_initialization(self): Tests that JavaGroup is initialized correctly. - def test_add_class(self): Tests adding a single class to t...
a401d6cf4f7bf0e2d2e964c512ebb923c3d8832c
<|skeleton|> class TestJavaPackage: """Unit tests for dependency_analysis.class_dependency.JavaGroup.""" def test_initialization(self): """Tests that JavaGroup is initialized correctly.""" <|body_0|> def test_add_class(self): """Tests adding a single class to this group.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestJavaPackage: """Unit tests for dependency_analysis.class_dependency.JavaGroup.""" def test_initialization(self): """Tests that JavaGroup is initialized correctly.""" test_node = java_group.JavaGroup(self.TEST_GRP_1) self.assertEqual(test_node.name, self.TEST_GRP_1) sel...
the_stack_v2_python_sparse
tools/android/dependency_analysis/java_group_unittest.py
chromium/chromium
train
17,408
b60a6a5ee1df3d8df5d337fc02020953eb5bed6a
[ "super().__init__()\nlayers = []\ndilation = 1\nfirst_causal = CausalCNNLayer(in_channels, out_channels=hidden_out_channels, kernel_size=kernel_size, dilation=dilation, layer='first', up_or_down_sample=True)\nlayers += [first_causal]\nfor i in range(n_layers - 2):\n dilation *= 2\n layers += [CausalCNNLayer(i...
<|body_start_0|> super().__init__() layers = [] dilation = 1 first_causal = CausalCNNLayer(in_channels, out_channels=hidden_out_channels, kernel_size=kernel_size, dilation=dilation, layer='first', up_or_down_sample=True) layers += [first_causal] for i in range(n_layers - ...
Encoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Encoder: def __init__(self, n_layers, hidden_out_channels, kernel_size, last_out_channels, rep_length, in_channels=1): """The encoder architecture as proposed in Fig. 2 of the paper. :param n_layers: number of causal convolutional layers :param hidden_out_channels: output/input channels ...
stack_v2_sparse_classes_36k_train_025612
8,666
no_license
[ { "docstring": "The encoder architecture as proposed in Fig. 2 of the paper. :param n_layers: number of causal convolutional layers :param hidden_out_channels: output/input channels of the hidden causal layers :param kernel_size: kernel size of each convolution :param last_out_channels: output channels size of ...
2
stack_v2_sparse_classes_30k_train_020746
Implement the Python class `Encoder` described below. Class description: Implement the Encoder class. Method signatures and docstrings: - def __init__(self, n_layers, hidden_out_channels, kernel_size, last_out_channels, rep_length, in_channels=1): The encoder architecture as proposed in Fig. 2 of the paper. :param n_...
Implement the Python class `Encoder` described below. Class description: Implement the Encoder class. Method signatures and docstrings: - def __init__(self, n_layers, hidden_out_channels, kernel_size, last_out_channels, rep_length, in_channels=1): The encoder architecture as proposed in Fig. 2 of the paper. :param n_...
84b9ac79439657c04033cadb51c6145ad7e2f4b3
<|skeleton|> class Encoder: def __init__(self, n_layers, hidden_out_channels, kernel_size, last_out_channels, rep_length, in_channels=1): """The encoder architecture as proposed in Fig. 2 of the paper. :param n_layers: number of causal convolutional layers :param hidden_out_channels: output/input channels ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Encoder: def __init__(self, n_layers, hidden_out_channels, kernel_size, last_out_channels, rep_length, in_channels=1): """The encoder architecture as proposed in Fig. 2 of the paper. :param n_layers: number of causal convolutional layers :param hidden_out_channels: output/input channels of the hidden ...
the_stack_v2_python_sparse
src/encoder.py
lhvu2/reproducibility_NeurIPS19
train
0
78a01a7de1097deaa87c2b54306a0366133ebe55
[ "self.variables = tf.trainable_variables()\nself.input_pl = tf.placeholder(tf.float32, [None, observation_space], name='Input_PL')\nnet = tf.layers.dense(self.input_pl, 100, activation=tf.nn.tanh, kernel_initializer=tf.random_normal_initializer(stddev=0.1))\nnet = tf.layers.dense(net, 100, activation=tf.nn.tanh, ke...
<|body_start_0|> self.variables = tf.trainable_variables() self.input_pl = tf.placeholder(tf.float32, [None, observation_space], name='Input_PL') net = tf.layers.dense(self.input_pl, 100, activation=tf.nn.tanh, kernel_initializer=tf.random_normal_initializer(stddev=0.1)) net = tf.layers....
Network
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Network: def inference_value(self, observation_space): """Creates a neural-network value function approximator Args: observation_space: observation space of the environment Returns: Nothing, the network is usable only after calling this method""" <|body_0|> def inference_pol...
stack_v2_sparse_classes_36k_train_025613
2,684
no_license
[ { "docstring": "Creates a neural-network value function approximator Args: observation_space: observation space of the environment Returns: Nothing, the network is usable only after calling this method", "name": "inference_value", "signature": "def inference_value(self, observation_space)" }, { ...
3
stack_v2_sparse_classes_30k_train_008827
Implement the Python class `Network` described below. Class description: Implement the Network class. Method signatures and docstrings: - def inference_value(self, observation_space): Creates a neural-network value function approximator Args: observation_space: observation space of the environment Returns: Nothing, t...
Implement the Python class `Network` described below. Class description: Implement the Network class. Method signatures and docstrings: - def inference_value(self, observation_space): Creates a neural-network value function approximator Args: observation_space: observation space of the environment Returns: Nothing, t...
372469a84226f339b3a1b13bdd76c7b15db54093
<|skeleton|> class Network: def inference_value(self, observation_space): """Creates a neural-network value function approximator Args: observation_space: observation space of the environment Returns: Nothing, the network is usable only after calling this method""" <|body_0|> def inference_pol...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Network: def inference_value(self, observation_space): """Creates a neural-network value function approximator Args: observation_space: observation space of the environment Returns: Nothing, the network is usable only after calling this method""" self.variables = tf.trainable_variables() ...
the_stack_v2_python_sparse
PPO/scripts/neural_net.py
jonrosner/ReinforcementLearning
train
3
7ec2ba9610b0c5e517be0370da7b8c28c46077a6
[ "self.max_batch_size = max_batch_size\nself.max_seq_length = max_seq_length\nself.device = device\nself.distribution_cls = Categorical if distribution_cls is None else distribution_cls", "number_batches = (num_samples + self.max_batch_size - 1) // self.max_batch_size\nremaining_samples = num_samples\nactions = to...
<|body_start_0|> self.max_batch_size = max_batch_size self.max_seq_length = max_seq_length self.device = device self.distribution_cls = Categorical if distribution_cls is None else distribution_cls <|end_body_0|> <|body_start_1|> number_batches = (num_samples + self.max_batch_si...
Sampler for a SmilesRNN models. Does not return SMILES strings directly, but instead the actions (i.e. which SMILES character to select). Those values are more general and are for instance necessary for other RL algorithms. The class will sample the RNN model multiple times if the number of desired samples is larger th...
ActionSampler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ActionSampler: """Sampler for a SmilesRNN models. Does not return SMILES strings directly, but instead the actions (i.e. which SMILES character to select). Those values are more general and are for instance necessary for other RL algorithms. The class will sample the RNN model multiple times if t...
stack_v2_sparse_classes_36k_train_025614
3,326
permissive
[ { "docstring": "Args: max_batch_size: maximal batch size for the RNN model max_seq_length: max length for a sampled SMILES string device: cuda | cpu distribution_cls: distribution type to sample from. If None, will be a multinomial distribution. Useful for testing purposes.", "name": "__init__", "signat...
3
stack_v2_sparse_classes_30k_test_001114
Implement the Python class `ActionSampler` described below. Class description: Sampler for a SmilesRNN models. Does not return SMILES strings directly, but instead the actions (i.e. which SMILES character to select). Those values are more general and are for instance necessary for other RL algorithms. The class will s...
Implement the Python class `ActionSampler` described below. Class description: Sampler for a SmilesRNN models. Does not return SMILES strings directly, but instead the actions (i.e. which SMILES character to select). Those values are more general and are for instance necessary for other RL algorithms. The class will s...
44d24c53f3acf9266eb2fb06dbff909836549291
<|skeleton|> class ActionSampler: """Sampler for a SmilesRNN models. Does not return SMILES strings directly, but instead the actions (i.e. which SMILES character to select). Those values are more general and are for instance necessary for other RL algorithms. The class will sample the RNN model multiple times if t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ActionSampler: """Sampler for a SmilesRNN models. Does not return SMILES strings directly, but instead the actions (i.e. which SMILES character to select). Those values are more general and are for instance necessary for other RL algorithms. The class will sample the RNN model multiple times if the number of ...
the_stack_v2_python_sparse
smiles_lstm_hc/action_sampler.py
BenevolentAI/guacamol_baselines
train
108
c12e21e4857541b39113fe70d8605e3fe6c26398
[ "self.ssm = ssm\nself.shoulder_anchor = shoulder_anchor\nself.kin_chain = kin_chain\nif 0:\n goal_cache_block = kwargs.pop('goal_cache_block')\n self.cached_data = pickle.load(open('/storage/assist_params/tentacle_cache_%d.pkl' % goal_cache_block))\nelse:\n self.cached_data = pickle.load(open('/storage/ass...
<|body_start_0|> self.ssm = ssm self.shoulder_anchor = shoulder_anchor self.kin_chain = kin_chain if 0: goal_cache_block = kwargs.pop('goal_cache_block') self.cached_data = pickle.load(open('/storage/assist_params/tentacle_cache_%d.pkl' % goal_cache_block)) ...
Determine the goal state of a redundant system by look-up-table, i.e. redundancy is collapsed by arbitrary mapping between redudnant target space and configuration space TODO: since multiprocessing is not required for this class, it needs to do a better job of hiding the multiprocessing.
PlanarMultiLinkJointGoalCached
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PlanarMultiLinkJointGoalCached: """Determine the goal state of a redundant system by look-up-table, i.e. redundancy is collapsed by arbitrary mapping between redudnant target space and configuration space TODO: since multiprocessing is not required for this class, it needs to do a better job of h...
stack_v2_sparse_classes_36k_train_025615
13,329
permissive
[ { "docstring": "Constructor for PlanarMultiLinkJointGoalCached Parameters ---------- ssm : state_space_models.StateSpace instance shoulder_anchor : np.ndarray of shape (3,) Position of the manipulator anchor kin_chain : robot_arms.KinematicChain instance Object representing the kinematic chain linkages (D-H par...
2
null
Implement the Python class `PlanarMultiLinkJointGoalCached` described below. Class description: Determine the goal state of a redundant system by look-up-table, i.e. redundancy is collapsed by arbitrary mapping between redudnant target space and configuration space TODO: since multiprocessing is not required for this ...
Implement the Python class `PlanarMultiLinkJointGoalCached` described below. Class description: Determine the goal state of a redundant system by look-up-table, i.e. redundancy is collapsed by arbitrary mapping between redudnant target space and configuration space TODO: since multiprocessing is not required for this ...
a0e296aa663b49e767c9ebb274defb54b301eb12
<|skeleton|> class PlanarMultiLinkJointGoalCached: """Determine the goal state of a redundant system by look-up-table, i.e. redundancy is collapsed by arbitrary mapping between redudnant target space and configuration space TODO: since multiprocessing is not required for this class, it needs to do a better job of h...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PlanarMultiLinkJointGoalCached: """Determine the goal state of a redundant system by look-up-table, i.e. redundancy is collapsed by arbitrary mapping between redudnant target space and configuration space TODO: since multiprocessing is not required for this class, it needs to do a better job of hiding the mul...
the_stack_v2_python_sparse
riglib/bmi/goal_calculators.py
carmenalab/brain-python-interface
train
9
2481c6e91a9ed020ba39e63a3921e3875236f751
[ "count = 0\nfor i in range(1, len(nums)):\n if nums[i] < nums[i - 1]:\n count += 1\n if i + 1 < len(nums) and i - 2 >= 0:\n if nums[i + 1] < nums[i - 1] and nums[i - 2] > nums[i]:\n return False\n if count > 1:\n return False\nreturn True", "cnt = 0\nfor i in r...
<|body_start_0|> count = 0 for i in range(1, len(nums)): if nums[i] < nums[i - 1]: count += 1 if i + 1 < len(nums) and i - 2 >= 0: if nums[i + 1] < nums[i - 1] and nums[i - 2] > nums[i]: return False if c...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def checkPossibility(self, nums): """:type nums: List[int] :rtype: bool""" <|body_0|> def checkPossibility(self, nums): """:type nums: List[int] :rtype: bool""" <|body_1|> def checkPossibility(self, nums): """:type nums: List[int] :rtyp...
stack_v2_sparse_classes_36k_train_025616
1,452
no_license
[ { "docstring": ":type nums: List[int] :rtype: bool", "name": "checkPossibility", "signature": "def checkPossibility(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: bool", "name": "checkPossibility", "signature": "def checkPossibility(self, nums)" }, { "docstring": "...
3
stack_v2_sparse_classes_30k_train_002312
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def checkPossibility(self, nums): :type nums: List[int] :rtype: bool - def checkPossibility(self, nums): :type nums: List[int] :rtype: bool - def checkPossibility(self, nums): :t...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def checkPossibility(self, nums): :type nums: List[int] :rtype: bool - def checkPossibility(self, nums): :type nums: List[int] :rtype: bool - def checkPossibility(self, nums): :t...
a509b383a42f54313970168d9faa11f088f18708
<|skeleton|> class Solution: def checkPossibility(self, nums): """:type nums: List[int] :rtype: bool""" <|body_0|> def checkPossibility(self, nums): """:type nums: List[int] :rtype: bool""" <|body_1|> def checkPossibility(self, nums): """:type nums: List[int] :rtyp...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def checkPossibility(self, nums): """:type nums: List[int] :rtype: bool""" count = 0 for i in range(1, len(nums)): if nums[i] < nums[i - 1]: count += 1 if i + 1 < len(nums) and i - 2 >= 0: if nums[i + 1] < nums[i...
the_stack_v2_python_sparse
0665_Non-decreasing_Array.py
bingli8802/leetcode
train
0
77e016971c8c69db2c7ba79b403544d6b42e4be2
[ "if not all([start_line.is_init, end_line.is_init]):\n return (-1, datetime.timedelta(0))\nif start_line.type != cls.__DIALOGUE or end_line.type != cls.__DIALOGUE:\n return (-1, datetime.timedelta(0))\nlines_duration = datetime.datetime.combine(datetime.datetime.today(), end_line.start_time) - datetime.dateti...
<|body_start_0|> if not all([start_line.is_init, end_line.is_init]): return (-1, datetime.timedelta(0)) if start_line.type != cls.__DIALOGUE or end_line.type != cls.__DIALOGUE: return (-1, datetime.timedelta(0)) lines_duration = datetime.datetime.combine(datetime.datetime...
AssScriptLineTool
[ "Python-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AssScriptLineTool: def check_continuous(cls, start_line: AssScriptLine, end_line: AssScriptLine, style_mode: bool) -> Tuple[int, datetime.timedelta]: """判断该行两行是否是连轴(即前轴结束时间等于后轴开始时间) :param start_line: 前轴 :param end_line: 后轴 :param style_mode: 是否启用样式判断 True: 两行样式不同不进行比较, 直接返回0 False: 两行样式...
stack_v2_sparse_classes_36k_train_025617
27,833
permissive
[ { "docstring": "判断该行两行是否是连轴(即前轴结束时间等于后轴开始时间) :param start_line: 前轴 :param end_line: 后轴 :param style_mode: 是否启用样式判断 True: 两行样式不同不进行比较, 直接返回0 False: 两行样式不同也会进行比较 :return: [判断结果, 轴间时间差] 1: 连轴 0: 非连轴 -1: 错误", "name": "check_continuous", "signature": "def check_continuous(cls, start_line: AssScriptLine, end_...
3
stack_v2_sparse_classes_30k_train_006676
Implement the Python class `AssScriptLineTool` described below. Class description: Implement the AssScriptLineTool class. Method signatures and docstrings: - def check_continuous(cls, start_line: AssScriptLine, end_line: AssScriptLine, style_mode: bool) -> Tuple[int, datetime.timedelta]: 判断该行两行是否是连轴(即前轴结束时间等于后轴开始时间) ...
Implement the Python class `AssScriptLineTool` described below. Class description: Implement the AssScriptLineTool class. Method signatures and docstrings: - def check_continuous(cls, start_line: AssScriptLine, end_line: AssScriptLine, style_mode: bool) -> Tuple[int, datetime.timedelta]: 判断该行两行是否是连轴(即前轴结束时间等于后轴开始时间) ...
53a6683fccb0618e306abe9e103cec78445f3796
<|skeleton|> class AssScriptLineTool: def check_continuous(cls, start_line: AssScriptLine, end_line: AssScriptLine, style_mode: bool) -> Tuple[int, datetime.timedelta]: """判断该行两行是否是连轴(即前轴结束时间等于后轴开始时间) :param start_line: 前轴 :param end_line: 后轴 :param style_mode: 是否启用样式判断 True: 两行样式不同不进行比较, 直接返回0 False: 两行样式...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AssScriptLineTool: def check_continuous(cls, start_line: AssScriptLine, end_line: AssScriptLine, style_mode: bool) -> Tuple[int, datetime.timedelta]: """判断该行两行是否是连轴(即前轴结束时间等于后轴开始时间) :param start_line: 前轴 :param end_line: 后轴 :param style_mode: 是否启用样式判断 True: 两行样式不同不进行比较, 直接返回0 False: 两行样式不同也会进行比较 :retu...
the_stack_v2_python_sparse
omega_miya/plugins/zhoushen_hime/utils.py
yekang-wu/omega-miya
train
0
275740dfb7a544d777b30ce37861a05a5218ae9c
[ "from pyraf import iraf\nfrom iraf import stsdas, analysis, dither\niraf.unlearn('blot')", "from pyraf import iraf\nfrom iraf import stsdas, analysis, dither\niraf.blot(data=in_data, outdata=out_data, scale=drizzle_params['PSCALE'], coeffs=coeffs, outnx=out_nx, outny=out_ny, interpol=mult_drizzle_par['blot_interp...
<|body_start_0|> from pyraf import iraf from iraf import stsdas, analysis, dither iraf.unlearn('blot') <|end_body_0|> <|body_start_1|> from pyraf import iraf from iraf import stsdas, analysis, dither iraf.blot(data=in_data, outdata=out_data, scale=drizzle_params['PSCALE'...
Class to wrap the blot command
Blot
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Blot: """Class to wrap the blot command""" def __init__(self): """Initializes the class""" <|body_0|> def run(self, in_data, out_data, coeffs, out_nx, out_ny, drizzle_params, mult_drizzle_par): """Do the actual blot Currently only the iraf version of blot is invo...
stack_v2_sparse_classes_36k_train_025618
23,324
permissive
[ { "docstring": "Initializes the class", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Do the actual blot Currently only the iraf version of blot is invoked.", "name": "run", "signature": "def run(self, in_data, out_data, coeffs, out_nx, out_ny, drizzle_params, ...
2
stack_v2_sparse_classes_30k_train_017560
Implement the Python class `Blot` described below. Class description: Class to wrap the blot command Method signatures and docstrings: - def __init__(self): Initializes the class - def run(self, in_data, out_data, coeffs, out_nx, out_ny, drizzle_params, mult_drizzle_par): Do the actual blot Currently only the iraf ve...
Implement the Python class `Blot` described below. Class description: Class to wrap the blot command Method signatures and docstrings: - def __init__(self): Initializes the class - def run(self, in_data, out_data, coeffs, out_nx, out_ny, drizzle_params, mult_drizzle_par): Do the actual blot Currently only the iraf ve...
043c173fd5497c18c2b1bfe8bcff65180bca3996
<|skeleton|> class Blot: """Class to wrap the blot command""" def __init__(self): """Initializes the class""" <|body_0|> def run(self, in_data, out_data, coeffs, out_nx, out_ny, drizzle_params, mult_drizzle_par): """Do the actual blot Currently only the iraf version of blot is invo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Blot: """Class to wrap the blot command""" def __init__(self): """Initializes the class""" from pyraf import iraf from iraf import stsdas, analysis, dither iraf.unlearn('blot') def run(self, in_data, out_data, coeffs, out_nx, out_ny, drizzle_params, mult_drizzle_par):...
the_stack_v2_python_sparse
stsdas/pkg/analysis/slitless/axe/axesrc/dither.py
spacetelescope/stsdas_stripped
train
1
2d6016ad74e95bab6ce19e84b71737774b33e54b
[ "self._tracks = config.track_store\nself._albums = config.album_store\nself._artists = config.artist_store\nself._genres = config.genre_store\nself._search = config.search\nself._id_cache = config.id_cache", "self._tracks.reload()\nself._albums.reload()\nself._artists.reload()\nself._genres.reload()\nself._search...
<|body_start_0|> self._tracks = config.track_store self._albums = config.album_store self._artists = config.artist_store self._genres = config.genre_store self._search = config.search self._id_cache = config.id_cache <|end_body_0|> <|body_start_1|> self._tracks.r...
Methods for querying in-memory stores of audio metadata.
AvalonMetadataService
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AvalonMetadataService: """Methods for querying in-memory stores of audio metadata.""" def __init__(self, config): """Set each of the in-memory stores to be used.""" <|body_0|> def reload(self): """Reload in-memory stores from the database. :return: This object :r...
stack_v2_sparse_classes_36k_train_025619
7,085
permissive
[ { "docstring": "Set each of the in-memory stores to be used.", "name": "__init__", "signature": "def __init__(self, config)" }, { "docstring": "Reload in-memory stores from the database. :return: This object :rtype: AvalonApiEndpoints", "name": "reload", "signature": "def reload(self)" ...
6
stack_v2_sparse_classes_30k_train_004693
Implement the Python class `AvalonMetadataService` described below. Class description: Methods for querying in-memory stores of audio metadata. Method signatures and docstrings: - def __init__(self, config): Set each of the in-memory stores to be used. - def reload(self): Reload in-memory stores from the database. :r...
Implement the Python class `AvalonMetadataService` described below. Class description: Methods for querying in-memory stores of audio metadata. Method signatures and docstrings: - def __init__(self, config): Set each of the in-memory stores to be used. - def reload(self): Reload in-memory stores from the database. :r...
2291f8457ca86f2e963d518abbdce04af02d9054
<|skeleton|> class AvalonMetadataService: """Methods for querying in-memory stores of audio metadata.""" def __init__(self, config): """Set each of the in-memory stores to be used.""" <|body_0|> def reload(self): """Reload in-memory stores from the database. :return: This object :r...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AvalonMetadataService: """Methods for querying in-memory stores of audio metadata.""" def __init__(self, config): """Set each of the in-memory stores to be used.""" self._tracks = config.track_store self._albums = config.album_store self._artists = config.artist_store ...
the_stack_v2_python_sparse
avalon/web/services.py
56quarters/avalonms
train
0
a6c1f1f2f26cce07df3a254f09746128ddd37c65
[ "self.q = deque([(0, 0)])\nself.food = food[::-1]\nself.w = width\nself.h = height", "r, c = self.q[-1]\nif direction == 'U':\n nr, nc = (r - 1, c)\nelif direction == 'L':\n nr, nc = (r, c - 1)\nelif direction == 'R':\n nr, nc = (r, c + 1)\nelse:\n nr, nc = (r + 1, c)\nif self.food and [nr, nc] == sel...
<|body_start_0|> self.q = deque([(0, 0)]) self.food = food[::-1] self.w = width self.h = height <|end_body_0|> <|body_start_1|> r, c = self.q[-1] if direction == 'U': nr, nc = (r - 1, c) elif direction == 'L': nr, nc = (r, c - 1) e...
SnakeGame
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SnakeGame: def __init__(self, width, height, food): """Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [1,0]. :typ...
stack_v2_sparse_classes_36k_train_025620
1,600
no_license
[ { "docstring": "Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [1,0]. :type width: int :type height: int :type food: List[List[int]]", ...
2
null
Implement the Python class `SnakeGame` described below. Class description: Implement the SnakeGame class. Method signatures and docstrings: - def __init__(self, width, height, food): Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E...
Implement the Python class `SnakeGame` described below. Class description: Implement the SnakeGame class. Method signatures and docstrings: - def __init__(self, width, height, food): Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E...
3129438b032d3aeb87c6ac5c4733df0ebc1272ba
<|skeleton|> class SnakeGame: def __init__(self, width, height, food): """Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [1,0]. :typ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SnakeGame: def __init__(self, width, height, food): """Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [1,0]. :type width: int :...
the_stack_v2_python_sparse
solu/353. Design Snake Game.py
coolmich/py-leetcode
train
3
0d95949e900a2914e7da4d36065d6def2de59020
[ "cache_len = 100000\nself.random_prob_cache = np.random.random(size=(cache_len,))\nself.random_prob_ptr = cache_len - 1", "value = self.random_prob_cache[self.random_prob_ptr]\nself.random_prob_ptr -= 1\nif self.random_prob_ptr == -1:\n self.reset_random_prob()\nreturn value", "token = self.token_list[self.t...
<|body_start_0|> cache_len = 100000 self.random_prob_cache = np.random.random(size=(cache_len,)) self.random_prob_ptr = cache_len - 1 <|end_body_0|> <|body_start_1|> value = self.random_prob_cache[self.random_prob_ptr] self.random_prob_ptr -= 1 if self.random_prob_ptr ==...
A base class that generate multiple random numbers at the same time.
EfficientRandomGen
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EfficientRandomGen: """A base class that generate multiple random numbers at the same time.""" def reset_random_prob(self): """Generate many random numbers at the same time and cache them.""" <|body_0|> def get_random_prob(self): """Get a random number.""" ...
stack_v2_sparse_classes_36k_train_025621
14,026
no_license
[ { "docstring": "Generate many random numbers at the same time and cache them.", "name": "reset_random_prob", "signature": "def reset_random_prob(self)" }, { "docstring": "Get a random number.", "name": "get_random_prob", "signature": "def get_random_prob(self)" }, { "docstring": ...
3
stack_v2_sparse_classes_30k_train_013937
Implement the Python class `EfficientRandomGen` described below. Class description: A base class that generate multiple random numbers at the same time. Method signatures and docstrings: - def reset_random_prob(self): Generate many random numbers at the same time and cache them. - def get_random_prob(self): Get a ran...
Implement the Python class `EfficientRandomGen` described below. Class description: A base class that generate multiple random numbers at the same time. Method signatures and docstrings: - def reset_random_prob(self): Generate many random numbers at the same time and cache them. - def get_random_prob(self): Get a ran...
778156466bc06ab1e4ecd1661d8ad8b98023afca
<|skeleton|> class EfficientRandomGen: """A base class that generate multiple random numbers at the same time.""" def reset_random_prob(self): """Generate many random numbers at the same time and cache them.""" <|body_0|> def get_random_prob(self): """Get a random number.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EfficientRandomGen: """A base class that generate multiple random numbers at the same time.""" def reset_random_prob(self): """Generate many random numbers at the same time and cache them.""" cache_len = 100000 self.random_prob_cache = np.random.random(size=(cache_len,)) s...
the_stack_v2_python_sparse
data/gen_uda_dataset.py
mainliufeng/models
train
0
0b7fde72254b169d482aa8028c5740f58cf7cefc
[ "n = len(nums)\npreSum = [0] * (n + 1)\nfor i in range(1, n + 1):\n preSum[i] = preSum[i - 1] + nums[i - 1]\nres = 1\nrmq = RMQ(nums)\nfor i in range(n):\n for j in range(i, n):\n res = max(res, nums[rmq.minRange(i, j)] * (preSum[j + 1] - preSum[i]))\nreturn res", "n = len(nums)\npreSum = [0] * (n + ...
<|body_start_0|> n = len(nums) preSum = [0] * (n + 1) for i in range(1, n + 1): preSum[i] = preSum[i - 1] + nums[i - 1] res = 1 rmq = RMQ(nums) for i in range(n): for j in range(i, n): res = max(res, nums[rmq.minRange(i, j)] * (preS...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxSumMinProductTLE(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def maxSumMinProduct(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> n = len(nums) preSum = [...
stack_v2_sparse_classes_36k_train_025622
3,107
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "maxSumMinProductTLE", "signature": "def maxSumMinProductTLE(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "maxSumMinProduct", "signature": "def maxSumMinProduct(self, nums)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSumMinProductTLE(self, nums): :type nums: List[int] :rtype: int - def maxSumMinProduct(self, nums): :type nums: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSumMinProductTLE(self, nums): :type nums: List[int] :rtype: int - def maxSumMinProduct(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution: de...
810575368ecffa97677bdb51744d1f716140bbb1
<|skeleton|> class Solution: def maxSumMinProductTLE(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def maxSumMinProduct(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxSumMinProductTLE(self, nums): """:type nums: List[int] :rtype: int""" n = len(nums) preSum = [0] * (n + 1) for i in range(1, n + 1): preSum[i] = preSum[i - 1] + nums[i - 1] res = 1 rmq = RMQ(nums) for i in range(n): ...
the_stack_v2_python_sparse
M/MaximumSubarrayMin-Product.py
bssrdf/pyleet
train
2
4f814e2b99f75ea2db6556de9f7993f4e938cc3b
[ "self.cpus = []\nself.stats = []\nsuper().__init__('/proc/cpuinfo')\nself.read()", "for cpu_lines in self.content.split('\\n\\n'):\n if not cpu_lines:\n continue\n self.cpus.append(CpuDetails(cpu_lines))", "print(' '.join(first_cpu.details['model name'][1:]) + ':')\nprint('\\t' + first_cpu.details[...
<|body_start_0|> self.cpus = [] self.stats = [] super().__init__('/proc/cpuinfo') self.read() <|end_body_0|> <|body_start_1|> for cpu_lines in self.content.split('\n\n'): if not cpu_lines: continue self.cpus.append(CpuDetails(cpu_lines)) <...
Object represents the /proc/cpuinfo file.
ProcCpuInfo
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProcCpuInfo: """Object represents the /proc/cpuinfo file.""" def __init__(self): """Read file by calling base class constructor then parse the contents.""" <|body_0|> def read(self): """Parses contents of /proc/cpuinfo""" <|body_1|> def dump_coalesce...
stack_v2_sparse_classes_36k_train_025623
5,579
permissive
[ { "docstring": "Read file by calling base class constructor then parse the contents.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Parses contents of /proc/cpuinfo", "name": "read", "signature": "def read(self)" }, { "docstring": "Print a selected sub...
4
stack_v2_sparse_classes_30k_train_008328
Implement the Python class `ProcCpuInfo` described below. Class description: Object represents the /proc/cpuinfo file. Method signatures and docstrings: - def __init__(self): Read file by calling base class constructor then parse the contents. - def read(self): Parses contents of /proc/cpuinfo - def dump_coalesced(se...
Implement the Python class `ProcCpuInfo` described below. Class description: Object represents the /proc/cpuinfo file. Method signatures and docstrings: - def __init__(self): Read file by calling base class constructor then parse the contents. - def read(self): Parses contents of /proc/cpuinfo - def dump_coalesced(se...
5fc781852dcdf55c3a807e97692224a28c0913f6
<|skeleton|> class ProcCpuInfo: """Object represents the /proc/cpuinfo file.""" def __init__(self): """Read file by calling base class constructor then parse the contents.""" <|body_0|> def read(self): """Parses contents of /proc/cpuinfo""" <|body_1|> def dump_coalesce...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProcCpuInfo: """Object represents the /proc/cpuinfo file.""" def __init__(self): """Read file by calling base class constructor then parse the contents.""" self.cpus = [] self.stats = [] super().__init__('/proc/cpuinfo') self.read() def read(self): """...
the_stack_v2_python_sparse
proc_scraper/proc_cpuinfo.py
EwanC/pyProc
train
0
5cf53a8bdb3640698c1f305be5e6512b420fe8dd
[ "self.nb = None\nself.pages = {}\nif local:\n self.local = local\n self.local.view = self\nelse:\n self.local = FigureSettingController(parent, self, setting)\nGeneralDialog.__init__(self, parent, title='Figure Setting', style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER, controller=controller, local=self.lo...
<|body_start_0|> self.nb = None self.pages = {} if local: self.local = local self.local.view = self else: self.local = FigureSettingController(parent, self, setting) GeneralDialog.__init__(self, parent, title='Figure Setting', style=wx.DEFAULT_...
Modify figure setting.
FigureSettingDialog
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FigureSettingDialog: """Modify figure setting.""" def __init__(self, parent, controller=None, setting=None, local=None, btn_flags=wx.OK | wx.CANCEL, **kwargs): """Figure setting dialog. :param parent: :param controller: :param setting: :param btn_flags: :param kwargs: :return:""" ...
stack_v2_sparse_classes_36k_train_025624
8,601
no_license
[ { "docstring": "Figure setting dialog. :param parent: :param controller: :param setting: :param btn_flags: :param kwargs: :return:", "name": "__init__", "signature": "def __init__(self, parent, controller=None, setting=None, local=None, btn_flags=wx.OK | wx.CANCEL, **kwargs)" }, { "docstring": "...
2
stack_v2_sparse_classes_30k_train_002728
Implement the Python class `FigureSettingDialog` described below. Class description: Modify figure setting. Method signatures and docstrings: - def __init__(self, parent, controller=None, setting=None, local=None, btn_flags=wx.OK | wx.CANCEL, **kwargs): Figure setting dialog. :param parent: :param controller: :param ...
Implement the Python class `FigureSettingDialog` described below. Class description: Modify figure setting. Method signatures and docstrings: - def __init__(self, parent, controller=None, setting=None, local=None, btn_flags=wx.OK | wx.CANCEL, **kwargs): Figure setting dialog. :param parent: :param controller: :param ...
e78511f30935b006385b571472487bb081aa36d8
<|skeleton|> class FigureSettingDialog: """Modify figure setting.""" def __init__(self, parent, controller=None, setting=None, local=None, btn_flags=wx.OK | wx.CANCEL, **kwargs): """Figure setting dialog. :param parent: :param controller: :param setting: :param btn_flags: :param kwargs: :return:""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FigureSettingDialog: """Modify figure setting.""" def __init__(self, parent, controller=None, setting=None, local=None, btn_flags=wx.OK | wx.CANCEL, **kwargs): """Figure setting dialog. :param parent: :param controller: :param setting: :param btn_flags: :param kwargs: :return:""" self.nb ...
the_stack_v2_python_sparse
boaui/chart/dlg.py
JoenyBui/boa-gui
train
0
35eb14f18f7d14b130427e4c9492aa8f7a77a4b4
[ "super().__init__(self._jv, nf=1, nx=1, maxderiv=None, zlevel=None)\nself.v = v\nreturn", "nd, nvar = dfun.ndnvar(deriv, var, self.nx)\nif out is None:\n base_shape = X.shape[1:]\n out = np.ndarray((nd, self.nf) + base_shape, dtype=X.dtype)\nx = X[0]\nkfact = 1.0\nfor k in range(nd):\n dk = scipy.special...
<|body_start_0|> super().__init__(self._jv, nf=1, nx=1, maxderiv=None, zlevel=None) self.v = v return <|end_body_0|> <|body_start_1|> nd, nvar = dfun.ndnvar(deriv, var, self.nx) if out is None: base_shape = X.shape[1:] out = np.ndarray((nd, self.nf) + bas...
Bessel functions of the first kind.
BesselJ
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BesselJ: """Bessel functions of the first kind.""" def __init__(self, v): """Bessel function of the first kind, :math:`J_{\\nu}(x)`. Parameters ---------- v : float The real order parameter.""" <|body_0|> def _jv(self, X, deriv=0, out=None, var=None): """Bessel f...
stack_v2_sparse_classes_36k_train_025625
39,055
permissive
[ { "docstring": "Bessel function of the first kind, :math:`J_{\\\\nu}(x)`. Parameters ---------- v : float The real order parameter.", "name": "__init__", "signature": "def __init__(self, v)" }, { "docstring": "Bessel function of the first kind, Jv. Derivative array eval function.", "name": "...
2
stack_v2_sparse_classes_30k_train_014944
Implement the Python class `BesselJ` described below. Class description: Bessel functions of the first kind. Method signatures and docstrings: - def __init__(self, v): Bessel function of the first kind, :math:`J_{\\nu}(x)`. Parameters ---------- v : float The real order parameter. - def _jv(self, X, deriv=0, out=None...
Implement the Python class `BesselJ` described below. Class description: Bessel functions of the first kind. Method signatures and docstrings: - def __init__(self, v): Bessel function of the first kind, :math:`J_{\\nu}(x)`. Parameters ---------- v : float The real order parameter. - def _jv(self, X, deriv=0, out=None...
c6341a58331deef3728cc43c627c556139deb673
<|skeleton|> class BesselJ: """Bessel functions of the first kind.""" def __init__(self, v): """Bessel function of the first kind, :math:`J_{\\nu}(x)`. Parameters ---------- v : float The real order parameter.""" <|body_0|> def _jv(self, X, deriv=0, out=None, var=None): """Bessel f...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BesselJ: """Bessel functions of the first kind.""" def __init__(self, v): """Bessel function of the first kind, :math:`J_{\\nu}(x)`. Parameters ---------- v : float The real order parameter.""" super().__init__(self._jv, nf=1, nx=1, maxderiv=None, zlevel=None) self.v = v r...
the_stack_v2_python_sparse
nitrogen/special.py
bchangala/nitrogen
train
11
46136400afd7e1ac5c4038c1809eb220f148fc9a
[ "self.surface = surface\nself.clock = pygame.time.Clock()\nself.lives = 3\nself.current_level = 1\nself.is_alive = True\nself.is_paused = False\nself.level = 1", "if self.lives > 0:\n self.is_alive = True\n self.draw()", "background = pygame.image.load(os.path.join('sky.jpg'))\ncontroller = Controller()\n...
<|body_start_0|> self.surface = surface self.clock = pygame.time.Clock() self.lives = 3 self.current_level = 1 self.is_alive = True self.is_paused = False self.level = 1 <|end_body_0|> <|body_start_1|> if self.lives > 0: self.is_alive = True ...
Game Loop
GameLoop
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GameLoop: """Game Loop""" def __init__(self, surface): """Constructor""" <|body_0|> def new_game(self): """Resets the Game""" <|body_1|> def draw(self): """Contains main game loop""" <|body_2|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_025626
2,269
no_license
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, surface)" }, { "docstring": "Resets the Game", "name": "new_game", "signature": "def new_game(self)" }, { "docstring": "Contains main game loop", "name": "draw", "signature": "def draw(self...
3
stack_v2_sparse_classes_30k_train_013109
Implement the Python class `GameLoop` described below. Class description: Game Loop Method signatures and docstrings: - def __init__(self, surface): Constructor - def new_game(self): Resets the Game - def draw(self): Contains main game loop
Implement the Python class `GameLoop` described below. Class description: Game Loop Method signatures and docstrings: - def __init__(self, surface): Constructor - def new_game(self): Resets the Game - def draw(self): Contains main game loop <|skeleton|> class GameLoop: """Game Loop""" def __init__(self, sur...
9918cd301178e3f5d5b6e37be60b9709ad203a09
<|skeleton|> class GameLoop: """Game Loop""" def __init__(self, surface): """Constructor""" <|body_0|> def new_game(self): """Resets the Game""" <|body_1|> def draw(self): """Contains main game loop""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GameLoop: """Game Loop""" def __init__(self, surface): """Constructor""" self.surface = surface self.clock = pygame.time.Clock() self.lives = 3 self.current_level = 1 self.is_alive = True self.is_paused = False self.level = 1 def new_ga...
the_stack_v2_python_sparse
GameLoop.py
eastcoastcoder/PygameSideScroller
train
1
37119a1e4fcf78928ffd6a3406988d2262d5a4ab
[ "create_database()\nadd_customer(1738, 'Bartholomew', 'Simpson', '742 Evergreen Terrace', 12065554682, 'Bartman99@aol.com', True, 101.5)\ntest_customer = Customer.get(Customer.customer_id == 1738)\nself.assertEqual(1738, test_customer.customer_id)\nself.assertEqual('Bartholomew', test_customer.first_name)\nself.ass...
<|body_start_0|> create_database() add_customer(1738, 'Bartholomew', 'Simpson', '742 Evergreen Terrace', 12065554682, 'Bartman99@aol.com', True, 101.5) test_customer = Customer.get(Customer.customer_id == 1738) self.assertEqual(1738, test_customer.customer_id) self.assertEqual('B...
CustomerTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CustomerTest: def test_add_customer(self): """Verify that the attributes have been appropriately assigned""" <|body_0|> def test_search_customer(self): """Verify that customers can be searched for correctly""" <|body_1|> def test_delete_customer(self): ...
stack_v2_sparse_classes_36k_train_025627
3,689
no_license
[ { "docstring": "Verify that the attributes have been appropriately assigned", "name": "test_add_customer", "signature": "def test_add_customer(self)" }, { "docstring": "Verify that customers can be searched for correctly", "name": "test_search_customer", "signature": "def test_search_cus...
5
null
Implement the Python class `CustomerTest` described below. Class description: Implement the CustomerTest class. Method signatures and docstrings: - def test_add_customer(self): Verify that the attributes have been appropriately assigned - def test_search_customer(self): Verify that customers can be searched for corre...
Implement the Python class `CustomerTest` described below. Class description: Implement the CustomerTest class. Method signatures and docstrings: - def test_add_customer(self): Verify that the attributes have been appropriately assigned - def test_search_customer(self): Verify that customers can be searched for corre...
5dac60f39e3909ff05b26721d602ed20f14d6be3
<|skeleton|> class CustomerTest: def test_add_customer(self): """Verify that the attributes have been appropriately assigned""" <|body_0|> def test_search_customer(self): """Verify that customers can be searched for correctly""" <|body_1|> def test_delete_customer(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CustomerTest: def test_add_customer(self): """Verify that the attributes have been appropriately assigned""" create_database() add_customer(1738, 'Bartholomew', 'Simpson', '742 Evergreen Terrace', 12065554682, 'Bartman99@aol.com', True, 101.5) test_customer = Customer.get(Custo...
the_stack_v2_python_sparse
students/kevin_t/Lesson4/test_basic_operations.py
JavaRod/SP_Python220B_2019
train
1
5509880c30c2e03ca6eb42ad32018c39fb5939ed
[ "self.api: MicroBotApiClient = client\nself.data: dict[str, Any] = {}\nself.ble_device = ble_device\nsuper().__init__(hass, _LOGGER, ble_device.address, bluetooth.BluetoothScanningMode.ACTIVE)", "if (adv := parse_advertisement_data(service_info.device, service_info.advertisement)):\n self.data = adv.data\n ...
<|body_start_0|> self.api: MicroBotApiClient = client self.data: dict[str, Any] = {} self.ble_device = ble_device super().__init__(hass, _LOGGER, ble_device.address, bluetooth.BluetoothScanningMode.ACTIVE) <|end_body_0|> <|body_start_1|> if (adv := parse_advertisement_data(servi...
Class to manage fetching data from the MicroBot.
MicroBotDataUpdateCoordinator
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MicroBotDataUpdateCoordinator: """Class to manage fetching data from the MicroBot.""" def __init__(self, hass: HomeAssistant, client: MicroBotApiClient, ble_device: BLEDevice) -> None: """Initialize.""" <|body_0|> def _async_handle_bluetooth_event(self, service_info: blu...
stack_v2_sparse_classes_36k_train_025628
1,824
permissive
[ { "docstring": "Initialize.", "name": "__init__", "signature": "def __init__(self, hass: HomeAssistant, client: MicroBotApiClient, ble_device: BLEDevice) -> None" }, { "docstring": "Handle a Bluetooth event.", "name": "_async_handle_bluetooth_event", "signature": "def _async_handle_bluet...
2
stack_v2_sparse_classes_30k_train_021291
Implement the Python class `MicroBotDataUpdateCoordinator` described below. Class description: Class to manage fetching data from the MicroBot. Method signatures and docstrings: - def __init__(self, hass: HomeAssistant, client: MicroBotApiClient, ble_device: BLEDevice) -> None: Initialize. - def _async_handle_bluetoo...
Implement the Python class `MicroBotDataUpdateCoordinator` described below. Class description: Class to manage fetching data from the MicroBot. Method signatures and docstrings: - def __init__(self, hass: HomeAssistant, client: MicroBotApiClient, ble_device: BLEDevice) -> None: Initialize. - def _async_handle_bluetoo...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class MicroBotDataUpdateCoordinator: """Class to manage fetching data from the MicroBot.""" def __init__(self, hass: HomeAssistant, client: MicroBotApiClient, ble_device: BLEDevice) -> None: """Initialize.""" <|body_0|> def _async_handle_bluetooth_event(self, service_info: blu...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MicroBotDataUpdateCoordinator: """Class to manage fetching data from the MicroBot.""" def __init__(self, hass: HomeAssistant, client: MicroBotApiClient, ble_device: BLEDevice) -> None: """Initialize.""" self.api: MicroBotApiClient = client self.data: dict[str, Any] = {} se...
the_stack_v2_python_sparse
homeassistant/components/keymitt_ble/coordinator.py
home-assistant/core
train
35,501
7ec1f539b037030ff9f2e0873c40613a11543f6e
[ "args = product_parser.parse_args()\ninvalid_data = validate_product_data(args)\nif invalid_data:\n return invalid_data\nproduct_name = args['product_name']\nproduct_category = args['product_category']\nProduct.add_product(cursor, product_name, product_category, user_id)\nreturn ({'message': 'Product added succe...
<|body_start_0|> args = product_parser.parse_args() invalid_data = validate_product_data(args) if invalid_data: return invalid_data product_name = args['product_name'] product_category = args['product_category'] Product.add_product(cursor, product_name, produc...
Displays a list of all products and lets you POST to add new products.
ProductList
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProductList: """Displays a list of all products and lets you POST to add new products.""" def post(user_id, self): """Creates a new Product.""" <|body_0|> def get(user_id, self): """List all Products""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_025629
4,088
permissive
[ { "docstring": "Creates a new Product.", "name": "post", "signature": "def post(user_id, self)" }, { "docstring": "List all Products", "name": "get", "signature": "def get(user_id, self)" } ]
2
stack_v2_sparse_classes_30k_train_012510
Implement the Python class `ProductList` described below. Class description: Displays a list of all products and lets you POST to add new products. Method signatures and docstrings: - def post(user_id, self): Creates a new Product. - def get(user_id, self): List all Products
Implement the Python class `ProductList` described below. Class description: Displays a list of all products and lets you POST to add new products. Method signatures and docstrings: - def post(user_id, self): Creates a new Product. - def get(user_id, self): List all Products <|skeleton|> class ProductList: """Di...
f806b8aa989393b4d2b1967c5be99ee3c4b5b9b6
<|skeleton|> class ProductList: """Displays a list of all products and lets you POST to add new products.""" def post(user_id, self): """Creates a new Product.""" <|body_0|> def get(user_id, self): """List all Products""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProductList: """Displays a list of all products and lets you POST to add new products.""" def post(user_id, self): """Creates a new Product.""" args = product_parser.parse_args() invalid_data = validate_product_data(args) if invalid_data: return invalid_data ...
the_stack_v2_python_sparse
app/api/v2/views/products_views.py
koitoror/StoreManager
train
1
cf5a9c2ae802eab03e95c07333c1929a45337ad9
[ "super().__init__()\nself.sub_blocks = nn.ModuleList()\nfor i in range(sub_blocks):\n self.sub_blocks.append(SubBlock(kernels=kernels, gate_channels=gate_channels, residual_channels=residual_channels))\nself.skip_convs = nn.Conv1d(in_channels=residual_channels, out_channels=skip_channels, kernel_size=1)\nself.di...
<|body_start_0|> super().__init__() self.sub_blocks = nn.ModuleList() for i in range(sub_blocks): self.sub_blocks.append(SubBlock(kernels=kernels, gate_channels=gate_channels, residual_channels=residual_channels)) self.skip_convs = nn.Conv1d(in_channels=residual_channels, out...
Блок, состоящий из нескольких маленьких блоков и последующим уменьшением размерности. Имеет два выхода: - Основной с уменьшенной в два раза размерностью; - Скип для суммирования последнего значения слоя с остальными скипами и расчета общего выходного значения.
Block
[ "Unlicense" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Block: """Блок, состоящий из нескольких маленьких блоков и последующим уменьшением размерности. Имеет два выхода: - Основной с уменьшенной в два раза размерностью; - Скип для суммирования последнего значения слоя с остальными скипами и расчета общего выходного значения.""" def __init__(self,...
stack_v2_sparse_classes_36k_train_025630
13,064
permissive
[ { "docstring": ":param sub_blocks: Количество маленьких блоков в блоке. :param kernels: Размер сверток в signal и gate сверточных слоях. :param gate_channels: Количество каналов в signal и gate сверточных слоях маленьких блоков. :param residual_channels: Количество каналов на входе и по обходному пути маленьких...
2
null
Implement the Python class `Block` described below. Class description: Блок, состоящий из нескольких маленьких блоков и последующим уменьшением размерности. Имеет два выхода: - Основной с уменьшенной в два раза размерностью; - Скип для суммирования последнего значения слоя с остальными скипами и расчета общего выходно...
Implement the Python class `Block` described below. Class description: Блок, состоящий из нескольких маленьких блоков и последующим уменьшением размерности. Имеет два выхода: - Основной с уменьшенной в два раза размерностью; - Скип для суммирования последнего значения слоя с остальными скипами и расчета общего выходно...
3a67544fd4c1bce39d67523799b76c9adfd03969
<|skeleton|> class Block: """Блок, состоящий из нескольких маленьких блоков и последующим уменьшением размерности. Имеет два выхода: - Основной с уменьшенной в два раза размерностью; - Скип для суммирования последнего значения слоя с остальными скипами и расчета общего выходного значения.""" def __init__(self,...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Block: """Блок, состоящий из нескольких маленьких блоков и последующим уменьшением размерности. Имеет два выхода: - Основной с уменьшенной в два раза размерностью; - Скип для суммирования последнего значения слоя с остальными скипами и расчета общего выходного значения.""" def __init__(self, sub_blocks: ...
the_stack_v2_python_sparse
poptimizer/dl/models/wave_net.py
tjlee/poptimizer
train
0
bc7b2384045e28fe1f1254b8c95c8a36dcc45273
[ "try:\n params, is_json = (request.json, True)\nexcept ValueError:\n params, is_json = (None, False)\nif not params:\n params, is_json = (request.params, False)\nreturn (params, is_json)", "if name == ParameterType.TOKEN_NAME:\n token_name = ADMIN_TOKEN_NAME if request_api_type() == API_ADMIN else CAB...
<|body_start_0|> try: params, is_json = (request.json, True) except ValueError: params, is_json = (None, False) if not params: params, is_json = (request.params, False) return (params, is_json) <|end_body_0|> <|body_start_1|> if name == Parame...
Actual class which responsible for validation. Actually check_params decorator just puts everything in it and relies on it during the processing.
ParameterValidator
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ParameterValidator: """Actual class which responsible for validation. Actually check_params decorator just puts everything in it and relies on it during the processing.""" def request_params(): """Detects where do we have incoming arguments and returns them. :return tuple of paramete...
stack_v2_sparse_classes_36k_train_025631
8,864
permissive
[ { "docstring": "Detects where do we have incoming arguments and returns them. :return tuple of parameters (dict-like structure) and sign were they JSONed or not. This is required if we have different rules for processing form-data and simple JSON.", "name": "request_params", "signature": "def request_pa...
5
stack_v2_sparse_classes_30k_train_008354
Implement the Python class `ParameterValidator` described below. Class description: Actual class which responsible for validation. Actually check_params decorator just puts everything in it and relies on it during the processing. Method signatures and docstrings: - def request_params(): Detects where do we have incom...
Implement the Python class `ParameterValidator` described below. Class description: Actual class which responsible for validation. Actually check_params decorator just puts everything in it and relies on it during the processing. Method signatures and docstrings: - def request_params(): Detects where do we have incom...
bc0cfe3067bf1cbf26789f7443a36e7cdd2ac869
<|skeleton|> class ParameterValidator: """Actual class which responsible for validation. Actually check_params decorator just puts everything in it and relies on it during the processing.""" def request_params(): """Detects where do we have incoming arguments and returns them. :return tuple of paramete...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ParameterValidator: """Actual class which responsible for validation. Actually check_params decorator just puts everything in it and relies on it during the processing.""" def request_params(): """Detects where do we have incoming arguments and returns them. :return tuple of parameters (dict-like...
the_stack_v2_python_sparse
backend/api/check_params.py
omarabdalhamid/boss
train
0
fb3cf46adde7104d72d81c615a020da853bcfc97
[ "self.url = url\nself.realm = realm\nself.extra = extra or dict()\nself.make = make\nself.context_factory = context_factory\nservice.MultiService.__init__(self)\nself.setupService()", "is_secure, host, port, resource, path, params = parse_ws_url(self.url)\n\ndef create():\n cfg = ComponentConfig(self.realm, se...
<|body_start_0|> self.url = url self.realm = realm self.extra = extra or dict() self.make = make self.context_factory = context_factory service.MultiService.__init__(self) self.setupService() <|end_body_0|> <|body_start_1|> is_secure, host, port, resource...
A WAMP application as a twisted service. The application object provides a simple way of creating, debugging and running WAMP application components inside a traditional twisted application This manages application lifecycle of the wamp connection using startService and stopService Using services also allows to create ...
Service
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Service: """A WAMP application as a twisted service. The application object provides a simple way of creating, debugging and running WAMP application components inside a traditional twisted application This manages application lifecycle of the wamp connection using startService and stopService Us...
stack_v2_sparse_classes_36k_train_025632
32,181
permissive
[ { "docstring": ":param url: The WebSocket URL of the WAMP router to connect to (e.g. `ws://somehost.com:8090/somepath`) :type url: unicode :param realm: The WAMP realm to join the application session to. :type realm: unicode :param make: A factory that produces instances of :class:`autobahn.asyncio.wamp.Applica...
2
stack_v2_sparse_classes_30k_train_018017
Implement the Python class `Service` described below. Class description: A WAMP application as a twisted service. The application object provides a simple way of creating, debugging and running WAMP application components inside a traditional twisted application This manages application lifecycle of the wamp connectio...
Implement the Python class `Service` described below. Class description: A WAMP application as a twisted service. The application object provides a simple way of creating, debugging and running WAMP application components inside a traditional twisted application This manages application lifecycle of the wamp connectio...
5cee0a8c4180a3108538b4e4ce945a18726595a6
<|skeleton|> class Service: """A WAMP application as a twisted service. The application object provides a simple way of creating, debugging and running WAMP application components inside a traditional twisted application This manages application lifecycle of the wamp connection using startService and stopService Us...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Service: """A WAMP application as a twisted service. The application object provides a simple way of creating, debugging and running WAMP application components inside a traditional twisted application This manages application lifecycle of the wamp connection using startService and stopService Using services ...
the_stack_v2_python_sparse
venv/Lib/site-packages/autobahn/twisted/wamp.py
zoelesv/Smathchat
train
9
e48ac31f3bf396712a9ee8b36c5064b423a5e5c0
[ "if tolerance_in_millis > MAX_NORMAL_REQUEST_TOLERANCE_IN_MILLIS:\n warnings.warn('Provided tolerance value {} exceeds the maximum allowed value {}. Maximum value will be used instead'.format(tolerance_in_millis, MAX_NORMAL_REQUEST_TOLERANCE_IN_MILLIS))\n tolerance_in_millis = MAX_NORMAL_REQUEST_TOLERANCE_IN_...
<|body_start_0|> if tolerance_in_millis > MAX_NORMAL_REQUEST_TOLERANCE_IN_MILLIS: warnings.warn('Provided tolerance value {} exceeds the maximum allowed value {}. Maximum value will be used instead'.format(tolerance_in_millis, MAX_NORMAL_REQUEST_TOLERANCE_IN_MILLIS)) tolerance_in_millis ...
Verifier that performs request timestamp verification. This is a concrete implementation of :py:class:`AbstractVerifier` class, handling the request timestamp verification of the input request. The verification follows the mechanism explained here : https://developer.amazon.com/docs/custom-skills/host-a-custom-skill-as...
TimestampVerifier
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TimestampVerifier: """Verifier that performs request timestamp verification. This is a concrete implementation of :py:class:`AbstractVerifier` class, handling the request timestamp verification of the input request. The verification follows the mechanism explained here : https://developer.amazon....
stack_v2_sparse_classes_36k_train_025633
22,604
permissive
[ { "docstring": "Verifier that performs request timestamp verification. This is a concrete implementation of :py:class:`AbstractVerifier` class, handling the request timestamp verification of the input request. The verification follows the mechanism explained here: https://developer.amazon.com/docs/custom-skills...
2
stack_v2_sparse_classes_30k_train_002436
Implement the Python class `TimestampVerifier` described below. Class description: Verifier that performs request timestamp verification. This is a concrete implementation of :py:class:`AbstractVerifier` class, handling the request timestamp verification of the input request. The verification follows the mechanism exp...
Implement the Python class `TimestampVerifier` described below. Class description: Verifier that performs request timestamp verification. This is a concrete implementation of :py:class:`AbstractVerifier` class, handling the request timestamp verification of the input request. The verification follows the mechanism exp...
7e13ca69b240985584dff6ec633a27598a154ca1
<|skeleton|> class TimestampVerifier: """Verifier that performs request timestamp verification. This is a concrete implementation of :py:class:`AbstractVerifier` class, handling the request timestamp verification of the input request. The verification follows the mechanism explained here : https://developer.amazon....
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TimestampVerifier: """Verifier that performs request timestamp verification. This is a concrete implementation of :py:class:`AbstractVerifier` class, handling the request timestamp verification of the input request. The verification follows the mechanism explained here : https://developer.amazon.com/docs/cust...
the_stack_v2_python_sparse
ask-sdk-webservice-support/ask_sdk_webservice_support/verifier.py
alexa/alexa-skills-kit-sdk-for-python
train
560
5506e67886bb29824549239834bd756d862ac8d9
[ "countS = collections.Counter(s)\nsingle = [ch for ch, i in countS.items() if i == 1]\nprint(single)\nif not single:\n return -1\nfor i in range(len(s)):\n if s[i] in single:\n return i", "for ch in s:\n if s.count(ch) == 1:\n return s.index(ch)\nreturn -1" ]
<|body_start_0|> countS = collections.Counter(s) single = [ch for ch, i in countS.items() if i == 1] print(single) if not single: return -1 for i in range(len(s)): if s[i] in single: return i <|end_body_0|> <|body_start_1|> for ch ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def firstUniqChar(self, s): """:type s: str :rtype: int""" <|body_0|> def firstUniqChar2(self, s): """:type s: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> countS = collections.Counter(s) single = [ch for ch, i i...
stack_v2_sparse_classes_36k_train_025634
645
no_license
[ { "docstring": ":type s: str :rtype: int", "name": "firstUniqChar", "signature": "def firstUniqChar(self, s)" }, { "docstring": ":type s: str :rtype: int", "name": "firstUniqChar2", "signature": "def firstUniqChar2(self, s)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def firstUniqChar(self, s): :type s: str :rtype: int - def firstUniqChar2(self, s): :type s: str :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def firstUniqChar(self, s): :type s: str :rtype: int - def firstUniqChar2(self, s): :type s: str :rtype: int <|skeleton|> class Solution: def firstUniqChar(self, s): ...
a13e7faaf55cd68249267e46a91e93c97e3190c2
<|skeleton|> class Solution: def firstUniqChar(self, s): """:type s: str :rtype: int""" <|body_0|> def firstUniqChar2(self, s): """:type s: str :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def firstUniqChar(self, s): """:type s: str :rtype: int""" countS = collections.Counter(s) single = [ch for ch, i in countS.items() if i == 1] print(single) if not single: return -1 for i in range(len(s)): if s[i] in single: ...
the_stack_v2_python_sparse
LeetCode/String/387.py
xiaojkql/Algorithm-Data-Structure
train
1
0d21d88901fb3236f329c7fd586e1173054e22a8
[ "super(GANLoss, self).__init__()\nself.register_buffer('real_label', torch.tensor(target_real_label))\nself.register_buffer('fake_label', torch.tensor(target_fake_label))\nself.gan_mode = gan_mode\nif gan_mode == 'lsgan':\n self.loss = nn.MSELoss()\nelif gan_mode == 'vanilla':\n self.loss = nn.BCEWithLogitsLo...
<|body_start_0|> super(GANLoss, self).__init__() self.register_buffer('real_label', torch.tensor(target_real_label)) self.register_buffer('fake_label', torch.tensor(target_fake_label)) self.gan_mode = gan_mode if gan_mode == 'lsgan': self.loss = nn.MSELoss() e...
Define different GAN objectives. The GANLoss class abstracts away the need to create the target label tensor that has the same size as the input.
GANLoss
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GANLoss: """Define different GAN objectives. The GANLoss class abstracts away the need to create the target label tensor that has the same size as the input.""" def __init__(self, gan_mode, target_real_label=1.0, target_fake_label=0.0): """Initialize the GANLoss class. Parameters: ga...
stack_v2_sparse_classes_36k_train_025635
22,730
no_license
[ { "docstring": "Initialize the GANLoss class. Parameters: gan_mode (str) - - the type of GAN objective. It currently supports vanilla, lsgan, and wgangp. target_real_label (bool) - - label for a real image target_fake_label (bool) - - label of a fake image Note: Do not use sigmoid as the last layer of Discrimin...
3
stack_v2_sparse_classes_30k_train_020391
Implement the Python class `GANLoss` described below. Class description: Define different GAN objectives. The GANLoss class abstracts away the need to create the target label tensor that has the same size as the input. Method signatures and docstrings: - def __init__(self, gan_mode, target_real_label=1.0, target_fake...
Implement the Python class `GANLoss` described below. Class description: Define different GAN objectives. The GANLoss class abstracts away the need to create the target label tensor that has the same size as the input. Method signatures and docstrings: - def __init__(self, gan_mode, target_real_label=1.0, target_fake...
7e55a422588c1d1e00f35a3d3a3ff896cce59e18
<|skeleton|> class GANLoss: """Define different GAN objectives. The GANLoss class abstracts away the need to create the target label tensor that has the same size as the input.""" def __init__(self, gan_mode, target_real_label=1.0, target_fake_label=0.0): """Initialize the GANLoss class. Parameters: ga...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GANLoss: """Define different GAN objectives. The GANLoss class abstracts away the need to create the target label tensor that has the same size as the input.""" def __init__(self, gan_mode, target_real_label=1.0, target_fake_label=0.0): """Initialize the GANLoss class. Parameters: gan_mode (str) ...
the_stack_v2_python_sparse
generated/test_junyanz_BicycleGAN.py
jansel/pytorch-jit-paritybench
train
35
a2791858ef9dcbbeafa4164908e82fdc7143d774
[ "self.num_points = num_points\nself.x_values = [0]\nself.y_values = [0]", "while len(self.x_values) < self.num_points:\n x_step = get_step()\n y_step = get_step()\n y_direction = choice([1, -1])\n y_distance = choice([0, 1, 2, 3, 4])\n y_step = y_direction * y_distance\n if x_step == 0 and y_ste...
<|body_start_0|> self.num_points = num_points self.x_values = [0] self.y_values = [0] <|end_body_0|> <|body_start_1|> while len(self.x_values) < self.num_points: x_step = get_step() y_step = get_step() y_direction = choice([1, -1]) y_dista...
一个生成随机漫步数的类
RandomWalk
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RandomWalk: """一个生成随机漫步数的类""" def __init__(self, num_points=5000): """初始化随机漫步的属性""" <|body_0|> def fill_walk(self): """计算随机漫步包含的所有点""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.num_points = num_points self.x_values = [0] ...
stack_v2_sparse_classes_36k_train_025636
1,320
no_license
[ { "docstring": "初始化随机漫步的属性", "name": "__init__", "signature": "def __init__(self, num_points=5000)" }, { "docstring": "计算随机漫步包含的所有点", "name": "fill_walk", "signature": "def fill_walk(self)" } ]
2
stack_v2_sparse_classes_30k_test_000997
Implement the Python class `RandomWalk` described below. Class description: 一个生成随机漫步数的类 Method signatures and docstrings: - def __init__(self, num_points=5000): 初始化随机漫步的属性 - def fill_walk(self): 计算随机漫步包含的所有点
Implement the Python class `RandomWalk` described below. Class description: 一个生成随机漫步数的类 Method signatures and docstrings: - def __init__(self, num_points=5000): 初始化随机漫步的属性 - def fill_walk(self): 计算随机漫步包含的所有点 <|skeleton|> class RandomWalk: """一个生成随机漫步数的类""" def __init__(self, num_points=5000): """初始化...
3eb10d5f571ec79d1de3085bdc90b504abedcc63
<|skeleton|> class RandomWalk: """一个生成随机漫步数的类""" def __init__(self, num_points=5000): """初始化随机漫步的属性""" <|body_0|> def fill_walk(self): """计算随机漫步包含的所有点""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RandomWalk: """一个生成随机漫步数的类""" def __init__(self, num_points=5000): """初始化随机漫步的属性""" self.num_points = num_points self.x_values = [0] self.y_values = [0] def fill_walk(self): """计算随机漫步包含的所有点""" while len(self.x_values) < self.num_points: x_s...
the_stack_v2_python_sparse
project/data_analysis/random/random_walk.py
hjacks/Python-Learning
train
0
181e254549a4346a3fc907bbc5cd16627bf4660a
[ "self.required_queries, self._enc, self._dec, self.key_len = (required_queries, encrypt, decrypt, key_len)\nself.key = ''\nself.ciphertexts = []", "self.answered_queries = 0\nself.key = random_string(self.key_len)\nself.ciphertexts = []\nself.win = False", "self.answered_queries += 1\nc = self._enc(self.key, m)...
<|body_start_0|> self.required_queries, self._enc, self._dec, self.key_len = (required_queries, encrypt, decrypt, key_len) self.key = '' self.ciphertexts = [] <|end_body_0|> <|body_start_1|> self.answered_queries = 0 self.key = random_string(self.key_len) self.ciphertext...
This game tests the integrity of a ciphertext. It is to be used to test to see if the decryption algorithm only decrypts authentic messages that have been sent by the sender. The Adversary has access to an encryption oracle (enc) and a decryption oracle (dec) that it uses to see if it won.
GameINTCTXT
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GameINTCTXT: """This game tests the integrity of a ciphertext. It is to be used to test to see if the decryption algorithm only decrypts authentic messages that have been sent by the sender. The Adversary has access to an encryption oracle (enc) and a decryption oracle (dec) that it uses to see i...
stack_v2_sparse_classes_36k_train_025637
2,233
no_license
[ { "docstring": ":param encrypt: Encryption function that takes inputs, a key k of key_len length and a message. :param decrypt: Decryption function to match encryption function. :param key_len: Length of key used by encrypt and decrypt.", "name": "__init__", "signature": "def __init__(self, required_que...
4
stack_v2_sparse_classes_30k_train_004210
Implement the Python class `GameINTCTXT` described below. Class description: This game tests the integrity of a ciphertext. It is to be used to test to see if the decryption algorithm only decrypts authentic messages that have been sent by the sender. The Adversary has access to an encryption oracle (enc) and a decryp...
Implement the Python class `GameINTCTXT` described below. Class description: This game tests the integrity of a ciphertext. It is to be used to test to see if the decryption algorithm only decrypts authentic messages that have been sent by the sender. The Adversary has access to an encryption oracle (enc) and a decryp...
9014f5a9bf7021bef9f5cc4aa5b16424ca83dee9
<|skeleton|> class GameINTCTXT: """This game tests the integrity of a ciphertext. It is to be used to test to see if the decryption algorithm only decrypts authentic messages that have been sent by the sender. The Adversary has access to an encryption oracle (enc) and a decryption oracle (dec) that it uses to see i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GameINTCTXT: """This game tests the integrity of a ciphertext. It is to be used to test to see if the decryption algorithm only decrypts authentic messages that have been sent by the sender. The Adversary has access to an encryption oracle (enc) and a decryption oracle (dec) that it uses to see if it won.""" ...
the_stack_v2_python_sparse
src/playcrypt/games/game_int_ctxt.py
UCSDCSE107/playcrypt
train
2
511062e06b9989773830a2374c789d7ff53d0478
[ "ret: list[list[str | bytes]] = []\nfor f in flows:\n ret.append([extract(c, f) for c in cuts])\nreturn ret", "append = False\nif path.startswith('+'):\n append = True\n epath = os.path.expanduser(path[1:])\n path = mitmproxy.types.Path(epath)\ntry:\n if len(cuts) == 1 and len(flows) == 1:\n ...
<|body_start_0|> ret: list[list[str | bytes]] = [] for f in flows: ret.append([extract(c, f) for c in cuts]) return ret <|end_body_0|> <|body_start_1|> append = False if path.startswith('+'): append = True epath = os.path.expanduser(path[1:]) ...
Cut
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Cut: def cut(self, flows: Sequence[flow.Flow], cuts: mitmproxy.types.CutSpec) -> mitmproxy.types.Data: """Cut data from a set of flows. Cut specifications are attribute paths from the base of the flow object, with a few conveniences - "port" and "host" retrieve parts of an address tuple,...
stack_v2_sparse_classes_36k_train_025638
5,777
permissive
[ { "docstring": "Cut data from a set of flows. Cut specifications are attribute paths from the base of the flow object, with a few conveniences - \"port\" and \"host\" retrieve parts of an address tuple, \".header[key]\" retrieves a header value. Return values converted to strings or bytes: SSL certificates are ...
3
null
Implement the Python class `Cut` described below. Class description: Implement the Cut class. Method signatures and docstrings: - def cut(self, flows: Sequence[flow.Flow], cuts: mitmproxy.types.CutSpec) -> mitmproxy.types.Data: Cut data from a set of flows. Cut specifications are attribute paths from the base of the ...
Implement the Python class `Cut` described below. Class description: Implement the Cut class. Method signatures and docstrings: - def cut(self, flows: Sequence[flow.Flow], cuts: mitmproxy.types.CutSpec) -> mitmproxy.types.Data: Cut data from a set of flows. Cut specifications are attribute paths from the base of the ...
33a81a0eadc0196e5352ac9aa5189ac4deea3d64
<|skeleton|> class Cut: def cut(self, flows: Sequence[flow.Flow], cuts: mitmproxy.types.CutSpec) -> mitmproxy.types.Data: """Cut data from a set of flows. Cut specifications are attribute paths from the base of the flow object, with a few conveniences - "port" and "host" retrieve parts of an address tuple,...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Cut: def cut(self, flows: Sequence[flow.Flow], cuts: mitmproxy.types.CutSpec) -> mitmproxy.types.Data: """Cut data from a set of flows. Cut specifications are attribute paths from the base of the flow object, with a few conveniences - "port" and "host" retrieve parts of an address tuple, ".header[key]...
the_stack_v2_python_sparse
mitmproxy/addons/cut.py
mhils/mitmproxy
train
2
ce59f9e44547322cec6f4250b5685d3b9656e9ce
[ "super(InputEnsemble, self).store(ens)\nself.temperature.store(ens.temp)\nself.pressure.store(ens.pext)\nself.stress.store(ens.stressext)\nself.eens.store(ens.eens)\nself.bias.store(ens.bcomp)\nself.bias_weights.store(ens.bweights)\nself.hamiltonian_weights.store(ens.hweights)\nself.time.store(ens.time)", "super(...
<|body_start_0|> super(InputEnsemble, self).store(ens) self.temperature.store(ens.temp) self.pressure.store(ens.pext) self.stress.store(ens.stressext) self.eens.store(ens.eens) self.bias.store(ens.bcomp) self.bias_weights.store(ens.bweights) self.hamiltoni...
Ensemble input class. Handles generating the appropriate ensemble class from the xml input file, and generating the xml checkpoint tags and data from an instance of the object. Attributes: mode: An optional string giving the mode of ensemble to be simulated. Defaults to 'unknown'. Fields: temperature: An optional float...
InputEnsemble
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InputEnsemble: """Ensemble input class. Handles generating the appropriate ensemble class from the xml input file, and generating the xml checkpoint tags and data from an instance of the object. Attributes: mode: An optional string giving the mode of ensemble to be simulated. Defaults to 'unknown...
stack_v2_sparse_classes_36k_train_025639
4,582
no_license
[ { "docstring": "Takes an ensemble instance and stores a minimal representation of it. Args: ens: An ensemble object.", "name": "store", "signature": "def store(self, ens)" }, { "docstring": "Creates an ensemble object. Returns: An ensemble object of the appropriate mode and with the appropriate ...
2
null
Implement the Python class `InputEnsemble` described below. Class description: Ensemble input class. Handles generating the appropriate ensemble class from the xml input file, and generating the xml checkpoint tags and data from an instance of the object. Attributes: mode: An optional string giving the mode of ensembl...
Implement the Python class `InputEnsemble` described below. Class description: Ensemble input class. Handles generating the appropriate ensemble class from the xml input file, and generating the xml checkpoint tags and data from an instance of the object. Attributes: mode: An optional string giving the mode of ensembl...
57f255266d4668bafef0881d1e7cbf8a27270ddd
<|skeleton|> class InputEnsemble: """Ensemble input class. Handles generating the appropriate ensemble class from the xml input file, and generating the xml checkpoint tags and data from an instance of the object. Attributes: mode: An optional string giving the mode of ensemble to be simulated. Defaults to 'unknown...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InputEnsemble: """Ensemble input class. Handles generating the appropriate ensemble class from the xml input file, and generating the xml checkpoint tags and data from an instance of the object. Attributes: mode: An optional string giving the mode of ensemble to be simulated. Defaults to 'unknown'. Fields: te...
the_stack_v2_python_sparse
ipi/inputs/ensembles.py
i-pi/i-pi
train
170
b38e295eb475155030ffe767babec1574ca5628a
[ "list_url = BASE_URL + '/snapshot/list'\npayload = {'token': test_token}\noutput = requests.post(list_url, json=payload)\ntest_snapshot_id = output.json()['snapshots'][0]['id']\npayload = {'token': test_token, 'id': test_snapshot_id}\noutput = requests.delete(url, json=payload)\nexpected_output = 'The snapshot has ...
<|body_start_0|> list_url = BASE_URL + '/snapshot/list' payload = {'token': test_token} output = requests.post(list_url, json=payload) test_snapshot_id = output.json()['snapshots'][0]['id'] payload = {'token': test_token, 'id': test_snapshot_id} output = requests.delete(u...
TestDeleteSnapshot
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestDeleteSnapshot: def test_delete_working(self): """this test will pass the snapshot/load method""" <|body_0|> def test_delete_missing_parameter(self): """this test will fail because of missing parameters""" <|body_1|> def test_delete_not_existing_snap...
stack_v2_sparse_classes_36k_train_025640
1,900
permissive
[ { "docstring": "this test will pass the snapshot/load method", "name": "test_delete_working", "signature": "def test_delete_working(self)" }, { "docstring": "this test will fail because of missing parameters", "name": "test_delete_missing_parameter", "signature": "def test_delete_missing...
4
null
Implement the Python class `TestDeleteSnapshot` described below. Class description: Implement the TestDeleteSnapshot class. Method signatures and docstrings: - def test_delete_working(self): this test will pass the snapshot/load method - def test_delete_missing_parameter(self): this test will fail because of missing ...
Implement the Python class `TestDeleteSnapshot` described below. Class description: Implement the TestDeleteSnapshot class. Method signatures and docstrings: - def test_delete_working(self): this test will pass the snapshot/load method - def test_delete_missing_parameter(self): this test will fail because of missing ...
ba1e287dbc63e34bf9feb80b65b02c1db93ce91c
<|skeleton|> class TestDeleteSnapshot: def test_delete_working(self): """this test will pass the snapshot/load method""" <|body_0|> def test_delete_missing_parameter(self): """this test will fail because of missing parameters""" <|body_1|> def test_delete_not_existing_snap...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestDeleteSnapshot: def test_delete_working(self): """this test will pass the snapshot/load method""" list_url = BASE_URL + '/snapshot/list' payload = {'token': test_token} output = requests.post(list_url, json=payload) test_snapshot_id = output.json()['snapshots'][0]['...
the_stack_v2_python_sparse
pytest_suit/routes/snapshot/test_zdeleteSnapshot.py
HotMaps/Hotmaps-toolbox-service
train
4
fe851e8badd441176ab25aecc4257dc9083d6f81
[ "headers = {'Content-Type': 'application/json', 'Authorization': 'Bearer {}'.format(sendgrid_api_key)}\ndata = {'personalizations': [{'to': [{'email': 'recipient@example.com'}]}], 'from': {'email': 'sendeexampexample@example.com'}, 'subject': 'HelloWorld!', 'content': [{'type': 'text/plain', 'value': 'Howdy!'}]}\nr...
<|body_start_0|> headers = {'Content-Type': 'application/json', 'Authorization': 'Bearer {}'.format(sendgrid_api_key)} data = {'personalizations': [{'to': [{'email': 'recipient@example.com'}]}], 'from': {'email': 'sendeexampexample@example.com'}, 'subject': 'HelloWorld!', 'content': [{'type': 'text/plai...
Helper Class. Contains methods used by Sendgrid Resource classes
SendgridHelper
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SendgridHelper: """Helper Class. Contains methods used by Sendgrid Resource classes""" def send_test_request(sendgrid_api_key: str) -> requests.Response: """Send POST request to the Sendgrid test endpoint containing the the supplied API key :param sendgrid_api_key: Key whose validity...
stack_v2_sparse_classes_36k_train_025641
6,487
permissive
[ { "docstring": "Send POST request to the Sendgrid test endpoint containing the the supplied API key :param sendgrid_api_key: Key whose validity is to be tested :return: The HTTP response received from Sendgrid", "name": "send_test_request", "signature": "def send_test_request(sendgrid_api_key: str) -> r...
2
stack_v2_sparse_classes_30k_train_007079
Implement the Python class `SendgridHelper` described below. Class description: Helper Class. Contains methods used by Sendgrid Resource classes Method signatures and docstrings: - def send_test_request(sendgrid_api_key: str) -> requests.Response: Send POST request to the Sendgrid test endpoint containing the the sup...
Implement the Python class `SendgridHelper` described below. Class description: Helper Class. Contains methods used by Sendgrid Resource classes Method signatures and docstrings: - def send_test_request(sendgrid_api_key: str) -> requests.Response: Send POST request to the Sendgrid test endpoint containing the the sup...
5d123691d1f25d0b85e20e4e8293266bf23c9f8a
<|skeleton|> class SendgridHelper: """Helper Class. Contains methods used by Sendgrid Resource classes""" def send_test_request(sendgrid_api_key: str) -> requests.Response: """Send POST request to the Sendgrid test endpoint containing the the supplied API key :param sendgrid_api_key: Key whose validity...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SendgridHelper: """Helper Class. Contains methods used by Sendgrid Resource classes""" def send_test_request(sendgrid_api_key: str) -> requests.Response: """Send POST request to the Sendgrid test endpoint containing the the supplied API key :param sendgrid_api_key: Key whose validity is to be tes...
the_stack_v2_python_sparse
Analytics/resources/sendgrid_management.py
thanosbnt/SharingCitiesDashboard
train
0
97a1a0e68ec3b3f2029ead4eafaeaecc280acde9
[ "ParticleFilter.__init__(self, number_of_particles, limits, process_noise, measurement_noise)\nself.maximum_number_of_particles = max_number_particles\nself.sum_likelihoods_threshold = sum_likelihoods_threshold", "new_particles = []\nsum_likelihoods = 0\nnumber_of_new_particles = 0\nwhile sum_likelihoods < self.s...
<|body_start_0|> ParticleFilter.__init__(self, number_of_particles, limits, process_noise, measurement_noise) self.maximum_number_of_particles = max_number_particles self.sum_likelihoods_threshold = sum_likelihoods_threshold <|end_body_0|> <|body_start_1|> new_particles = [] sum...
Notes: * State is (x, y, heading), where x and y are in meters and heading in radians * State space assumed limited size in each dimension, world is cyclic (hence leaving at x_max means entering at x_min)
AdaptiveParticleFilterSl
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdaptiveParticleFilterSl: """Notes: * State is (x, y, heading), where x and y are in meters and heading in radians * State space assumed limited size in each dimension, world is cyclic (hence leaving at x_max means entering at x_min)""" def __init__(self, number_of_particles, limits, process...
stack_v2_sparse_classes_36k_train_025642
3,982
no_license
[ { "docstring": "Initialize the adaptive particle filter using sum of likelihoods sampling proposed explained in [1,2]. [1] Straka, Ondrej, and Miroslav Simandl. \"A survey of sample size adaptation techniques for particle filters.\" IFAC Proceedings Volumes 42.10 (2009): 1358-1363. [2] Koller, Daphne, and Raya ...
2
stack_v2_sparse_classes_30k_train_018090
Implement the Python class `AdaptiveParticleFilterSl` described below. Class description: Notes: * State is (x, y, heading), where x and y are in meters and heading in radians * State space assumed limited size in each dimension, world is cyclic (hence leaving at x_max means entering at x_min) Method signatures and d...
Implement the Python class `AdaptiveParticleFilterSl` described below. Class description: Notes: * State is (x, y, heading), where x and y are in meters and heading in radians * State space assumed limited size in each dimension, world is cyclic (hence leaving at x_max means entering at x_min) Method signatures and d...
4e5197c38a9d241d9ea06c06ab9fc893ffb8c70b
<|skeleton|> class AdaptiveParticleFilterSl: """Notes: * State is (x, y, heading), where x and y are in meters and heading in radians * State space assumed limited size in each dimension, world is cyclic (hence leaving at x_max means entering at x_min)""" def __init__(self, number_of_particles, limits, process...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AdaptiveParticleFilterSl: """Notes: * State is (x, y, heading), where x and y are in meters and heading in radians * State space assumed limited size in each dimension, world is cyclic (hence leaving at x_max means entering at x_min)""" def __init__(self, number_of_particles, limits, process_noise, measu...
the_stack_v2_python_sparse
core/particle_filters/adaptive_particle_filter_sl.py
eternalamit5/Learning-Nuggets
train
0
f424e80554bee1e0d789ebdf3c796eb198698c7e
[ "if not user_data:\n user_data = {'owner': f'{ANONYMOUS_SESSION} session', 'name': f'{ANONYMOUS_SESSION}', 'token': f'{ANONYMOUS_SESSION}'}\nself.ctx = ProjectCloneContext().load({**user_data, **request_data}, unknown=EXCLUDE)\nself.git_url = self.ctx['url_with_auth']\nself.branch = self.ctx['branch']", "url =...
<|body_start_0|> if not user_data: user_data = {'owner': f'{ANONYMOUS_SESSION} session', 'name': f'{ANONYMOUS_SESSION}', 'token': f'{ANONYMOUS_SESSION}'} self.ctx = ProjectCloneContext().load({**user_data, **request_data}, unknown=EXCLUDE) self.git_url = self.ctx['url_with_auth'] ...
Parent controller for all controllers with remote support.
RemoteProject
[ "Apache-2.0", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RemoteProject: """Parent controller for all controllers with remote support.""" def __init__(self, user_data, request_data): """Construct remote controller.""" <|body_0|> def remote_url(self): """Construct project metadata remote path.""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_025643
2,664
permissive
[ { "docstring": "Construct remote controller.", "name": "__init__", "signature": "def __init__(self, user_data, request_data)" }, { "docstring": "Construct project metadata remote path.", "name": "remote_url", "signature": "def remote_url(self)" }, { "docstring": "Retrieve project...
3
null
Implement the Python class `RemoteProject` described below. Class description: Parent controller for all controllers with remote support. Method signatures and docstrings: - def __init__(self, user_data, request_data): Construct remote controller. - def remote_url(self): Construct project metadata remote path. - def ...
Implement the Python class `RemoteProject` described below. Class description: Parent controller for all controllers with remote support. Method signatures and docstrings: - def __init__(self, user_data, request_data): Construct remote controller. - def remote_url(self): Construct project metadata remote path. - def ...
e0ff587f507d049eeeb873e8488ba8bb10ac1a15
<|skeleton|> class RemoteProject: """Parent controller for all controllers with remote support.""" def __init__(self, user_data, request_data): """Construct remote controller.""" <|body_0|> def remote_url(self): """Construct project metadata remote path.""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RemoteProject: """Parent controller for all controllers with remote support.""" def __init__(self, user_data, request_data): """Construct remote controller.""" if not user_data: user_data = {'owner': f'{ANONYMOUS_SESSION} session', 'name': f'{ANONYMOUS_SESSION}', 'token': f'{A...
the_stack_v2_python_sparse
renku/ui/service/controllers/utils/remote_project.py
SwissDataScienceCenter/renku-python
train
30
bec1708975a581c9b0a899f17034f4d5d908db00
[ "self.embedding_size = embedding_size\nself.utterance_max = utterance_max\nself.num_actions = num_actions\nsuper().__init__()\nself.h1 = nn.Embedding(num_actions, embedding_size)\nself.d2e = nn.Embedding(vocab_size, embedding_size)\nself.rnn = nn.GRUCell(embedding_size, embedding_size)\nself.e2d = nn.Linear(embeddi...
<|body_start_0|> self.embedding_size = embedding_size self.utterance_max = utterance_max self.num_actions = num_actions super().__init__() self.h1 = nn.Embedding(num_actions, embedding_size) self.d2e = nn.Embedding(vocab_size, embedding_size) self.rnn = nn.GRUCell...
takes in a discrete action (1-in-k), converts to utterance
Speaker
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Speaker: """takes in a discrete action (1-in-k), converts to utterance""" def __init__(self, embedding_size, utterance_max, vocab_size, num_actions): """Note that vocab_size includes terminator character 0""" <|body_0|> def forward(self, actions, global_idxes): "...
stack_v2_sparse_classes_36k_train_025644
16,840
permissive
[ { "docstring": "Note that vocab_size includes terminator character 0", "name": "__init__", "signature": "def __init__(self, embedding_size, utterance_max, vocab_size, num_actions)" }, { "docstring": "This agent will receive the image of the world x might have been sieved. global_idxes too. but g...
2
stack_v2_sparse_classes_30k_train_004397
Implement the Python class `Speaker` described below. Class description: takes in a discrete action (1-in-k), converts to utterance Method signatures and docstrings: - def __init__(self, embedding_size, utterance_max, vocab_size, num_actions): Note that vocab_size includes terminator character 0 - def forward(self, a...
Implement the Python class `Speaker` described below. Class description: takes in a discrete action (1-in-k), converts to utterance Method signatures and docstrings: - def __init__(self, embedding_size, utterance_max, vocab_size, num_actions): Note that vocab_size includes terminator character 0 - def forward(self, a...
0286849d42d56a382820d4118b72cf6585e23160
<|skeleton|> class Speaker: """takes in a discrete action (1-in-k), converts to utterance""" def __init__(self, embedding_size, utterance_max, vocab_size, num_actions): """Note that vocab_size includes terminator character 0""" <|body_0|> def forward(self, actions, global_idxes): "...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Speaker: """takes in a discrete action (1-in-k), converts to utterance""" def __init__(self, embedding_size, utterance_max, vocab_size, num_actions): """Note that vocab_size includes terminator character 0""" self.embedding_size = embedding_size self.utterance_max = utterance_max ...
the_stack_v2_python_sparse
mll/run_mll.py
Sandy4321/compositional-inductive-bias
train
0
18d0197d5e7f99f59394ce50735a3f99f7c55b26
[ "dp = [[0 for _ in range(n)] for _ in range(m)]\nfor i in range(m):\n dp[i][0] = 1\nfor j in range(n):\n dp[0][j] = 1\nfor i in range(1, m):\n for j in range(1, n):\n dp[i][j] = dp[i - 1][j] + dp[i][j - 1]\nprint(dp)\nreturn dp[-1][-1]", "dp = [1] * n\nfor i in range(1, m):\n for j in range(1, ...
<|body_start_0|> dp = [[0 for _ in range(n)] for _ in range(m)] for i in range(m): dp[i][0] = 1 for j in range(n): dp[0][j] = 1 for i in range(1, m): for j in range(1, n): dp[i][j] = dp[i - 1][j] + dp[i][j - 1] print(dp) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def uniquePaths(self, m: int, n: int) -> int: """动态规划, 空间复杂度O(M * N) 时间复杂度O(M * N) dp[i][j] = dp[i - 1][j] + dp[i][j - 1] :param m: :param n: :return:""" <|body_0|> def uniquePaths1(self, m: int, n: int) -> int: """根据观察,当前坐标的值只与左边和上面的值相关,和其他无关 :param m: :pa...
stack_v2_sparse_classes_36k_train_025645
1,665
no_license
[ { "docstring": "动态规划, 空间复杂度O(M * N) 时间复杂度O(M * N) dp[i][j] = dp[i - 1][j] + dp[i][j - 1] :param m: :param n: :return:", "name": "uniquePaths", "signature": "def uniquePaths(self, m: int, n: int) -> int" }, { "docstring": "根据观察,当前坐标的值只与左边和上面的值相关,和其他无关 :param m: :param n: :return:", "name": "u...
2
stack_v2_sparse_classes_30k_train_007052
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def uniquePaths(self, m: int, n: int) -> int: 动态规划, 空间复杂度O(M * N) 时间复杂度O(M * N) dp[i][j] = dp[i - 1][j] + dp[i][j - 1] :param m: :param n: :return: - def uniquePaths1(self, m: in...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def uniquePaths(self, m: int, n: int) -> int: 动态规划, 空间复杂度O(M * N) 时间复杂度O(M * N) dp[i][j] = dp[i - 1][j] + dp[i][j - 1] :param m: :param n: :return: - def uniquePaths1(self, m: in...
9acba92695c06406f12f997a720bfe1deb9464a8
<|skeleton|> class Solution: def uniquePaths(self, m: int, n: int) -> int: """动态规划, 空间复杂度O(M * N) 时间复杂度O(M * N) dp[i][j] = dp[i - 1][j] + dp[i][j - 1] :param m: :param n: :return:""" <|body_0|> def uniquePaths1(self, m: int, n: int) -> int: """根据观察,当前坐标的值只与左边和上面的值相关,和其他无关 :param m: :pa...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def uniquePaths(self, m: int, n: int) -> int: """动态规划, 空间复杂度O(M * N) 时间复杂度O(M * N) dp[i][j] = dp[i - 1][j] + dp[i][j - 1] :param m: :param n: :return:""" dp = [[0 for _ in range(n)] for _ in range(m)] for i in range(m): dp[i][0] = 1 for j in range(n): ...
the_stack_v2_python_sparse
datastructure/dp_exercise/UniquePaths.py
yinhuax/leet_code
train
0
95db108faa8810da1b4e78c4be66ecd787466d71
[ "config = Config()\ndirectory = config.agent_cache_directory(PATTOO_API_AGENT_NAME)\nself._batch_id = int(time.time() * 1000)\nself._data = files.read_json_files(directory, die=False, age=age, count=batch_size)\nself.files = len(self._data)", "_cache = {}\nresult = []\nfor filepath, json_data in sorted(self._data...
<|body_start_0|> config = Config() directory = config.agent_cache_directory(PATTOO_API_AGENT_NAME) self._batch_id = int(time.time() * 1000) self._data = files.read_json_files(directory, die=False, age=age, count=batch_size) self.files = len(self._data) <|end_body_0|> <|body_star...
Process ingest cache data.
Cache
[ "GPL-3.0-only" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Cache: """Process ingest cache data.""" def __init__(self, batch_size=500, age=0): """Initialize the class. Args: batch_size: Number of files to read age: Minimum age of files to be read per batch Returns: None""" <|body_0|> def records(self): """Create PattooDBr...
stack_v2_sparse_classes_36k_train_025646
8,665
permissive
[ { "docstring": "Initialize the class. Args: batch_size: Number of files to read age: Minimum age of files to be read per batch Returns: None", "name": "__init__", "signature": "def __init__(self, batch_size=500, age=0)" }, { "docstring": "Create PattooDBrecord objects from cache directory. Args:...
4
null
Implement the Python class `Cache` described below. Class description: Process ingest cache data. Method signatures and docstrings: - def __init__(self, batch_size=500, age=0): Initialize the class. Args: batch_size: Number of files to read age: Minimum age of files to be read per batch Returns: None - def records(se...
Implement the Python class `Cache` described below. Class description: Process ingest cache data. Method signatures and docstrings: - def __init__(self, batch_size=500, age=0): Initialize the class. Args: batch_size: Number of files to read age: Minimum age of files to be read per batch Returns: None - def records(se...
57bd3e82e49d51e3426b13ad53ed8326a735ce29
<|skeleton|> class Cache: """Process ingest cache data.""" def __init__(self, batch_size=500, age=0): """Initialize the class. Args: batch_size: Number of files to read age: Minimum age of files to be read per batch Returns: None""" <|body_0|> def records(self): """Create PattooDBr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Cache: """Process ingest cache data.""" def __init__(self, batch_size=500, age=0): """Initialize the class. Args: batch_size: Number of files to read age: Minimum age of files to be read per batch Returns: None""" config = Config() directory = config.agent_cache_directory(PATTOO_A...
the_stack_v2_python_sparse
pattoo/ingest/files.py
palisadoes/pattoo
train
0
7a5a7bd6c640be015635d1ebcce9f243eb59337d
[ "super(LCALayer, self).__init__()\nrequire_grad = False\nself.leak = leak\nself.competition = competition\nself.self_excitation = self_excitation\nself.noise = noise\nself.time_step_size = time_step_size\nself.non_decision_time = non_decision_time\nself._sqrt_step_size = torch.sqrt(torch.tensor(0.001, requires_grad...
<|body_start_0|> super(LCALayer, self).__init__() require_grad = False self.leak = leak self.competition = competition self.self_excitation = self_excitation self.noise = noise self.time_step_size = time_step_size self.non_decision_time = non_decision_time...
LCALayer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LCALayer: def __init__(self, threshold: Union[float, None]=1.0, leak: float=0.1, competition: float=0.1, self_excitation: float=0.0, non_decision_time: float=0.0, activation_function: Callable=torch.relu, noise: Union[float, torch.Tensor, None]=1.0, time_step_size: float=0.01): """Args: ...
stack_v2_sparse_classes_36k_train_025647
12,763
permissive
[ { "docstring": "Args: threshold: The threshold that accumulators must reach to stop integration. If None, accumulators will never stop integrating even when the pass the threshold. leak: The decay rate, which reflects leakage of the activation. competition: The weight to apply for inhibitory influence from othe...
2
stack_v2_sparse_classes_30k_train_004642
Implement the Python class `LCALayer` described below. Class description: Implement the LCALayer class. Method signatures and docstrings: - def __init__(self, threshold: Union[float, None]=1.0, leak: float=0.1, competition: float=0.1, self_excitation: float=0.0, non_decision_time: float=0.0, activation_function: Call...
Implement the Python class `LCALayer` described below. Class description: Implement the LCALayer class. Method signatures and docstrings: - def __init__(self, threshold: Union[float, None]=1.0, leak: float=0.1, competition: float=0.1, self_excitation: float=0.0, non_decision_time: float=0.0, activation_function: Call...
424971b04d55a2cddbae4c05a0aae2d7b3502c20
<|skeleton|> class LCALayer: def __init__(self, threshold: Union[float, None]=1.0, leak: float=0.1, competition: float=0.1, self_excitation: float=0.0, non_decision_time: float=0.0, activation_function: Callable=torch.relu, noise: Union[float, torch.Tensor, None]=1.0, time_step_size: float=0.01): """Args: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LCALayer: def __init__(self, threshold: Union[float, None]=1.0, leak: float=0.1, competition: float=0.1, self_excitation: float=0.0, non_decision_time: float=0.0, activation_function: Callable=torch.relu, noise: Union[float, torch.Tensor, None]=1.0, time_step_size: float=0.01): """Args: threshold: The...
the_stack_v2_python_sparse
Scripts/Debug/stability_flexibility/pytorch_lca.py
PrincetonUniversity/PsyNeuLink
train
79
92942f69195622cb3268a1ee33d3d1bb9e93bbeb
[ "super().__init__()\nnout_new = nout - nin\nself.eesp = VGGBlock(nin, nout_new, stride=2, down_method='avg')\nself.avg = nn.AvgPool2d(kernel_size=3, padding=1, stride=2)\nif reinf:\n self.inp_reinf = nn.Sequential(CBR(config_inp_reinf, config_inp_reinf, 3, 1), CB(config_inp_reinf, nout, 1, 1))\nself.act = nn.PRe...
<|body_start_0|> super().__init__() nout_new = nout - nin self.eesp = VGGBlock(nin, nout_new, stride=2, down_method='avg') self.avg = nn.AvgPool2d(kernel_size=3, padding=1, stride=2) if reinf: self.inp_reinf = nn.Sequential(CBR(config_inp_reinf, config_inp_reinf, 3, 1...
Down-sampling fucntion that has three parallel branches: (1) avg pooling, (2) EESP block with stride of 2 and (3) efficient long-range connection with the input. The output feature maps of branches from (1) and (2) are concatenated and then additively fused with (3) to produce the final output.
DownSampler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DownSampler: """Down-sampling fucntion that has three parallel branches: (1) avg pooling, (2) EESP block with stride of 2 and (3) efficient long-range connection with the input. The output feature maps of branches from (1) and (2) are concatenated and then additively fused with (3) to produce the...
stack_v2_sparse_classes_36k_train_025648
8,682
permissive
[ { "docstring": ":param nin: number of input channels :param nout: number of output channels :param k: # of parallel branches :param r_lim: A maximum value of receptive field allowed for EESP block :param reinf: Use long range shortcut connection with the input or not.", "name": "__init__", "signature": ...
2
stack_v2_sparse_classes_30k_train_006162
Implement the Python class `DownSampler` described below. Class description: Down-sampling fucntion that has three parallel branches: (1) avg pooling, (2) EESP block with stride of 2 and (3) efficient long-range connection with the input. The output feature maps of branches from (1) and (2) are concatenated and then a...
Implement the Python class `DownSampler` described below. Class description: Down-sampling fucntion that has three parallel branches: (1) avg pooling, (2) EESP block with stride of 2 and (3) efficient long-range connection with the input. The output feature maps of branches from (1) and (2) are concatenated and then a...
d00a290cb1c86cb079acef69f914805737cb3696
<|skeleton|> class DownSampler: """Down-sampling fucntion that has three parallel branches: (1) avg pooling, (2) EESP block with stride of 2 and (3) efficient long-range connection with the input. The output feature maps of branches from (1) and (2) are concatenated and then additively fused with (3) to produce the...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DownSampler: """Down-sampling fucntion that has three parallel branches: (1) avg pooling, (2) EESP block with stride of 2 and (3) efficient long-range connection with the input. The output feature maps of branches from (1) and (2) are concatenated and then additively fused with (3) to produce the final output...
the_stack_v2_python_sparse
affspec/models/vgg.py
BeibinLi/affspec
train
0
fcf437862b7f1393ea00a41c133cae5ac445f875
[ "far = 0\ncur = 0\nl = 0\nfor h in hours:\n if h > 8:\n cur += 1\n else:\n cur -= 1\n if cur > 0:\n l += 1\n else:\n cur = 0\n l = 0\n far = max(far, l)\nreturn far", "totals = [0]\nfor i in hours:\n if i > 8:\n a = 1\n else:\n a = -1\n tota...
<|body_start_0|> far = 0 cur = 0 l = 0 for h in hours: if h > 8: cur += 1 else: cur -= 1 if cur > 0: l += 1 else: cur = 0 l = 0 far = max(far, l) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestWPI(self, hours): """:type hours: List[int] :rtype: int""" <|body_0|> def longestWPI(self, hours): """:type hours: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> far = 0 cur = 0 l = 0 ...
stack_v2_sparse_classes_36k_train_025649
1,066
no_license
[ { "docstring": ":type hours: List[int] :rtype: int", "name": "longestWPI", "signature": "def longestWPI(self, hours)" }, { "docstring": ":type hours: List[int] :rtype: int", "name": "longestWPI", "signature": "def longestWPI(self, hours)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestWPI(self, hours): :type hours: List[int] :rtype: int - def longestWPI(self, hours): :type hours: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestWPI(self, hours): :type hours: List[int] :rtype: int - def longestWPI(self, hours): :type hours: List[int] :rtype: int <|skeleton|> class Solution: def longestWP...
d8ed762d1005975f0de4f07760c9671195621c88
<|skeleton|> class Solution: def longestWPI(self, hours): """:type hours: List[int] :rtype: int""" <|body_0|> def longestWPI(self, hours): """:type hours: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def longestWPI(self, hours): """:type hours: List[int] :rtype: int""" far = 0 cur = 0 l = 0 for h in hours: if h > 8: cur += 1 else: cur -= 1 if cur > 0: l += 1 els...
the_stack_v2_python_sparse
longest-well-performing-interval/solution.py
uxlsl/leetcode_practice
train
0
6c3b0896585a2b834791b7db54084116cb9587fc
[ "self.ide = identity_element\nself.lide = lazy_ide\nself.func = segfunc\nn = len(ls)\nself.num = 2 ** (n - 1).bit_length()\nself.tree = [self.ide] * (2 * self.num)\nself.lazy = [self.lide] * (2 * self.num)\nfor i, l in enumerate(ls):\n self.tree[i + self.num - 1] = l\nfor i in range(self.num - 2, -1, -1):\n s...
<|body_start_0|> self.ide = identity_element self.lide = lazy_ide self.func = segfunc n = len(ls) self.num = 2 ** (n - 1).bit_length() self.tree = [self.ide] * (2 * self.num) self.lazy = [self.lide] * (2 * self.num) for i, l in enumerate(ls): s...
SegmentTreeForRMQandRUQ
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SegmentTreeForRMQandRUQ: def __init__(self, ls: list, segfunc=min, identity_element=2 ** 63, lazy_ide=None): """セグ木 一次元のリストlsを受け取り初期化する。O(len(ls)) 区間のルールはsegfuncによって定義される identity elementは単位元。e.g., 最小値を求めたい→inf, 和→0, 積→1, gcd→0 [単位元](https://ja.wikipedia.org/wiki/%E5%8D%98%E4%BD%8D%E5%85...
stack_v2_sparse_classes_36k_train_025650
23,273
no_license
[ { "docstring": "セグ木 一次元のリストlsを受け取り初期化する。O(len(ls)) 区間のルールはsegfuncによって定義される identity elementは単位元。e.g., 最小値を求めたい→inf, 和→0, 積→1, gcd→0 [単位元](https://ja.wikipedia.org/wiki/%E5%8D%98%E4%BD%8D%E5%85%83)", "name": "__init__", "signature": "def __init__(self, ls: list, segfunc=min, identity_element=2 ** 63, laz...
4
null
Implement the Python class `SegmentTreeForRMQandRUQ` described below. Class description: Implement the SegmentTreeForRMQandRUQ class. Method signatures and docstrings: - def __init__(self, ls: list, segfunc=min, identity_element=2 ** 63, lazy_ide=None): セグ木 一次元のリストlsを受け取り初期化する。O(len(ls)) 区間のルールはsegfuncによって定義される ident...
Implement the Python class `SegmentTreeForRMQandRUQ` described below. Class description: Implement the SegmentTreeForRMQandRUQ class. Method signatures and docstrings: - def __init__(self, ls: list, segfunc=min, identity_element=2 ** 63, lazy_ide=None): セグ木 一次元のリストlsを受け取り初期化する。O(len(ls)) 区間のルールはsegfuncによって定義される ident...
74915a40ac157f89fe400e3f98e9bf3c10012cd7
<|skeleton|> class SegmentTreeForRMQandRUQ: def __init__(self, ls: list, segfunc=min, identity_element=2 ** 63, lazy_ide=None): """セグ木 一次元のリストlsを受け取り初期化する。O(len(ls)) 区間のルールはsegfuncによって定義される identity elementは単位元。e.g., 最小値を求めたい→inf, 和→0, 積→1, gcd→0 [単位元](https://ja.wikipedia.org/wiki/%E5%8D%98%E4%BD%8D%E5%85...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SegmentTreeForRMQandRUQ: def __init__(self, ls: list, segfunc=min, identity_element=2 ** 63, lazy_ide=None): """セグ木 一次元のリストlsを受け取り初期化する。O(len(ls)) 区間のルールはsegfuncによって定義される identity elementは単位元。e.g., 最小値を求めたい→inf, 和→0, 積→1, gcd→0 [単位元](https://ja.wikipedia.org/wiki/%E5%8D%98%E4%BD%8D%E5%85%83)""" ...
the_stack_v2_python_sparse
algorithm/SegmentTree.py
masakiaota/kyoupuro
train
1
19d551af3bfd772b663c03f924486fe33ec262bb
[ "samples = [sample]\nfilter_task = filter_gene_results.s(samples, cls.tool_result_name, top_n)\npersist_signature = persist_task.s(sample['analysis_result'], cls.result_name)\ntask_chain = chain(filter_task, persist_signature)\nresult = task_chain.delay()\nreturn result", "analysis_result_uuid = sample_group.anal...
<|body_start_0|> samples = [sample] filter_task = filter_gene_results.s(samples, cls.tool_result_name, top_n) persist_signature = persist_task.s(sample['analysis_result'], cls.result_name) task_chain = chain(filter_task, persist_signature) result = task_chain.delay() retu...
Tasks for generating virulence results.
GenericGeneWrangler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GenericGeneWrangler: """Tasks for generating virulence results.""" def help_run_generic_sample(cls, sample, top_n, persist_task): """Gather single sample and process.""" <|body_0|> def help_run_generic_gene_group(cls, sample_group, samples, top_n, persist_task): ...
stack_v2_sparse_classes_36k_train_025651
1,502
permissive
[ { "docstring": "Gather single sample and process.", "name": "help_run_generic_sample", "signature": "def help_run_generic_sample(cls, sample, top_n, persist_task)" }, { "docstring": "Gather and process samples.", "name": "help_run_generic_gene_group", "signature": "def help_run_generic_g...
2
stack_v2_sparse_classes_30k_train_001465
Implement the Python class `GenericGeneWrangler` described below. Class description: Tasks for generating virulence results. Method signatures and docstrings: - def help_run_generic_sample(cls, sample, top_n, persist_task): Gather single sample and process. - def help_run_generic_gene_group(cls, sample_group, samples...
Implement the Python class `GenericGeneWrangler` described below. Class description: Tasks for generating virulence results. Method signatures and docstrings: - def help_run_generic_sample(cls, sample, top_n, persist_task): Gather single sample and process. - def help_run_generic_gene_group(cls, sample_group, samples...
609cd57c626c857c8efde8237a1f22f4d1e6065d
<|skeleton|> class GenericGeneWrangler: """Tasks for generating virulence results.""" def help_run_generic_sample(cls, sample, top_n, persist_task): """Gather single sample and process.""" <|body_0|> def help_run_generic_gene_group(cls, sample_group, samples, top_n, persist_task): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GenericGeneWrangler: """Tasks for generating virulence results.""" def help_run_generic_sample(cls, sample, top_n, persist_task): """Gather single sample and process.""" samples = [sample] filter_task = filter_gene_results.s(samples, cls.tool_result_name, top_n) persist_si...
the_stack_v2_python_sparse
app/display_modules/generic_gene_set/wrangler.py
MetaGenScope/metagenscope-server
train
0
392ff58f88c21793686ad0f92b2f2ec8b8acc3cf
[ "if not self.name and self.path:\n self.name = filter_repo_name(Path(self.path).name)\nself.slug = normalize_to_ascii(self.name)", "if not is_ascii(href):\n raise UnicodeError(f'`{href}` is not a valid Git remote')\nurl_regexes = _REPOSITORY_URLS\ngitlab_url = os.environ.get('GITLAB_BASE_URL', None)\nif git...
<|body_start_0|> if not self.name and self.path: self.name = filter_repo_name(Path(self.path).name) self.slug = normalize_to_ascii(self.name) <|end_body_0|> <|body_start_1|> if not is_ascii(href): raise UnicodeError(f'`{href}` is not a valid Git remote') url_rege...
Parser for common Git URLs.
GitURL
[ "Apache-2.0", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GitURL: """Parser for common Git URLs.""" def __attrs_post_init__(self): """Derive basic information.""" <|body_0|> def parse(cls, href) -> 'GitURL': """Derive URI components.""" <|body_1|> def instance_url(self): """Get the url of the git in...
stack_v2_sparse_classes_36k_train_025652
5,059
permissive
[ { "docstring": "Derive basic information.", "name": "__attrs_post_init__", "signature": "def __attrs_post_init__(self)" }, { "docstring": "Derive URI components.", "name": "parse", "signature": "def parse(cls, href) -> 'GitURL'" }, { "docstring": "Get the url of the git instance....
4
null
Implement the Python class `GitURL` described below. Class description: Parser for common Git URLs. Method signatures and docstrings: - def __attrs_post_init__(self): Derive basic information. - def parse(cls, href) -> 'GitURL': Derive URI components. - def instance_url(self): Get the url of the git instance. - def i...
Implement the Python class `GitURL` described below. Class description: Parser for common Git URLs. Method signatures and docstrings: - def __attrs_post_init__(self): Derive basic information. - def parse(cls, href) -> 'GitURL': Derive URI components. - def instance_url(self): Get the url of the git instance. - def i...
e0ff587f507d049eeeb873e8488ba8bb10ac1a15
<|skeleton|> class GitURL: """Parser for common Git URLs.""" def __attrs_post_init__(self): """Derive basic information.""" <|body_0|> def parse(cls, href) -> 'GitURL': """Derive URI components.""" <|body_1|> def instance_url(self): """Get the url of the git in...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GitURL: """Parser for common Git URLs.""" def __attrs_post_init__(self): """Derive basic information.""" if not self.name and self.path: self.name = filter_repo_name(Path(self.path).name) self.slug = normalize_to_ascii(self.name) def parse(cls, href) -> 'GitURL': ...
the_stack_v2_python_sparse
renku/domain_model/git.py
SwissDataScienceCenter/renku-python
train
30
793dc852a1128d3a11be4b305f63a7e7d303057b
[ "self.summary_file = []\nself.path_params = []\nif release in ['DR17', 'MPL-11']:\n files = ['GZD_auto', 'gzUKIDSS', 'gz']\n version_DR17 = {'GZD_auto': 'v1_0_1', 'gzUKIDSS': 'v1_0_1', 'gz': 'v2_0_1'}\n for file in files:\n params = {'file': file, 'ver': version_DR17[file]}\n self.path_params...
<|body_start_0|> self.summary_file = [] self.path_params = [] if release in ['DR17', 'MPL-11']: files = ['GZD_auto', 'gzUKIDSS', 'gz'] version_DR17 = {'GZD_auto': 'v1_0_1', 'gzUKIDSS': 'v1_0_1', 'gz': 'v2_0_1'} for file in files: params = {'fil...
Provides access to the MaNGA Galaxy Zoo Morphology VAC. VAC name: MaNGA Morphologies from Galaxy Zoo URL: https://www.sdss.org/dr17/data_access/value-added-catalogs/?vac_id=manga-morphologies-from-galaxy-zoo Description Returns Galaxy Zoo morphology for MaNGA galaxies. The Galaxy Zoo (GZ) data for SDSS galaxies has bee...
GZVAC
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GZVAC: """Provides access to the MaNGA Galaxy Zoo Morphology VAC. VAC name: MaNGA Morphologies from Galaxy Zoo URL: https://www.sdss.org/dr17/data_access/value-added-catalogs/?vac_id=manga-morphologies-from-galaxy-zoo Description Returns Galaxy Zoo morphology for MaNGA galaxies. The Galaxy Zoo (G...
stack_v2_sparse_classes_36k_train_025653
5,257
permissive
[ { "docstring": "Sets the path to the GalaxyZoo summary file. Sets the paths to the GalaxyZoom summary file(s). For DR15 this is a single summary file, while for DR17, this has been split into three files, so ``self.summary_file`` and ``self.path_params`` return lists for DR17.", "name": "set_summary_file", ...
2
stack_v2_sparse_classes_30k_train_003244
Implement the Python class `GZVAC` described below. Class description: Provides access to the MaNGA Galaxy Zoo Morphology VAC. VAC name: MaNGA Morphologies from Galaxy Zoo URL: https://www.sdss.org/dr17/data_access/value-added-catalogs/?vac_id=manga-morphologies-from-galaxy-zoo Description Returns Galaxy Zoo morpholog...
Implement the Python class `GZVAC` described below. Class description: Provides access to the MaNGA Galaxy Zoo Morphology VAC. VAC name: MaNGA Morphologies from Galaxy Zoo URL: https://www.sdss.org/dr17/data_access/value-added-catalogs/?vac_id=manga-morphologies-from-galaxy-zoo Description Returns Galaxy Zoo morpholog...
db4c536a65fb2f16fee05a4f34996a7fd35f0527
<|skeleton|> class GZVAC: """Provides access to the MaNGA Galaxy Zoo Morphology VAC. VAC name: MaNGA Morphologies from Galaxy Zoo URL: https://www.sdss.org/dr17/data_access/value-added-catalogs/?vac_id=manga-morphologies-from-galaxy-zoo Description Returns Galaxy Zoo morphology for MaNGA galaxies. The Galaxy Zoo (G...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GZVAC: """Provides access to the MaNGA Galaxy Zoo Morphology VAC. VAC name: MaNGA Morphologies from Galaxy Zoo URL: https://www.sdss.org/dr17/data_access/value-added-catalogs/?vac_id=manga-morphologies-from-galaxy-zoo Description Returns Galaxy Zoo morphology for MaNGA galaxies. The Galaxy Zoo (GZ) data for S...
the_stack_v2_python_sparse
python/marvin/contrib/vacs/galaxyzoo.py
sdss/marvin
train
56
779ae7d01395d19afa0dbde3c54428f5919fe12e
[ "power = None\nrqt_url = self.server_conf['base_url']\nrqt_url += '/rpc/getpowerstat.asp'\ncookies = {'SessionCookie': session}\nself.log.debug('[%s]: Getting power at %s', self.name, rqt_url)\nresponse = requests.get(rqt_url, cookies=cookies, verify=False)\nif response.status_code == 200:\n json_str = self.clea...
<|body_start_0|> power = None rqt_url = self.server_conf['base_url'] rqt_url += '/rpc/getpowerstat.asp' cookies = {'SessionCookie': session} self.log.debug('[%s]: Getting power at %s', self.name, rqt_url) response = requests.get(rqt_url, cookies=cookies, verify=False) ...
Collect power consumption via DELL INTEL GUI/API.
INTELGUICollector
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class INTELGUICollector: """Collect power consumption via DELL INTEL GUI/API.""" def get_intel_power(self, session): """Get Power value form INTEL.""" <|body_0|> def clean_json(self, str_json, var_name): """Clean returned pseudo JSON by Intel Web Console.""" <|...
stack_v2_sparse_classes_36k_train_025654
5,677
no_license
[ { "docstring": "Get Power value form INTEL.", "name": "get_intel_power", "signature": "def get_intel_power(self, session)" }, { "docstring": "Clean returned pseudo JSON by Intel Web Console.", "name": "clean_json", "signature": "def clean_json(self, str_json, var_name)" }, { "doc...
5
stack_v2_sparse_classes_30k_val_000853
Implement the Python class `INTELGUICollector` described below. Class description: Collect power consumption via DELL INTEL GUI/API. Method signatures and docstrings: - def get_intel_power(self, session): Get Power value form INTEL. - def clean_json(self, str_json, var_name): Clean returned pseudo JSON by Intel Web C...
Implement the Python class `INTELGUICollector` described below. Class description: Collect power consumption via DELL INTEL GUI/API. Method signatures and docstrings: - def get_intel_power(self, session): Get Power value form INTEL. - def clean_json(self, str_json, var_name): Clean returned pseudo JSON by Intel Web C...
a872f095f256b0dd63d292301426f0a807c04abb
<|skeleton|> class INTELGUICollector: """Collect power consumption via DELL INTEL GUI/API.""" def get_intel_power(self, session): """Get Power value form INTEL.""" <|body_0|> def clean_json(self, str_json, var_name): """Clean returned pseudo JSON by Intel Web Console.""" <|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class INTELGUICollector: """Collect power consumption via DELL INTEL GUI/API.""" def get_intel_power(self, session): """Get Power value form INTEL.""" power = None rqt_url = self.server_conf['base_url'] rqt_url += '/rpc/getpowerstat.asp' cookies = {'SessionCookie': sessi...
the_stack_v2_python_sparse
server-collector/collectors/power/intel_gui_collector.py
bherard/energyrecorder
train
2
073bcb2e6b33b8e0dff49321fe20eb755b27092c
[ "self.active_directories = active_directories\nself.all = all\nself.clusters = clusters\nself.file = file\nself.groups = groups\nself.partitions = partitions\nself.principal_sources = principal_sources\nself.protection_jobs = protection_jobs\nself.protection_policies = protection_policies\nself.protection_sources =...
<|body_start_0|> self.active_directories = active_directories self.all = all self.clusters = clusters self.file = file self.groups = groups self.partitions = partitions self.principal_sources = principal_sources self.protection_jobs = protection_jobs ...
Implementation of the 'ImportConfigurations' model. ImportConfigurations struct used for ImportConfig endpoint. This is the form of the request. Attributes: active_directories (list of string): Selective import of active directories. all (list of string): List of which entities to import all. clusters (list of long|int...
ImportConfigurations
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImportConfigurations: """Implementation of the 'ImportConfigurations' model. ImportConfigurations struct used for ImportConfig endpoint. This is the form of the request. Attributes: active_directories (list of string): Selective import of active directories. all (list of string): List of which en...
stack_v2_sparse_classes_36k_train_025655
5,519
permissive
[ { "docstring": "Constructor for the ImportConfigurations class", "name": "__init__", "signature": "def __init__(self, active_directories=None, all=None, clusters=None, file=None, groups=None, partitions=None, principal_sources=None, protection_jobs=None, protection_policies=None, protection_sources=None...
2
null
Implement the Python class `ImportConfigurations` described below. Class description: Implementation of the 'ImportConfigurations' model. ImportConfigurations struct used for ImportConfig endpoint. This is the form of the request. Attributes: active_directories (list of string): Selective import of active directories....
Implement the Python class `ImportConfigurations` described below. Class description: Implementation of the 'ImportConfigurations' model. ImportConfigurations struct used for ImportConfig endpoint. This is the form of the request. Attributes: active_directories (list of string): Selective import of active directories....
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class ImportConfigurations: """Implementation of the 'ImportConfigurations' model. ImportConfigurations struct used for ImportConfig endpoint. This is the form of the request. Attributes: active_directories (list of string): Selective import of active directories. all (list of string): List of which en...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ImportConfigurations: """Implementation of the 'ImportConfigurations' model. ImportConfigurations struct used for ImportConfig endpoint. This is the form of the request. Attributes: active_directories (list of string): Selective import of active directories. all (list of string): List of which entities to imp...
the_stack_v2_python_sparse
cohesity_management_sdk/models/import_configurations.py
cohesity/management-sdk-python
train
24
88bd740155449e770a6ef7688cb0a67d0f33730a
[ "self.expand_filters = {x.lower(): (x not in use_expand_hidden, x) for x in use_expand}\nself.use_expand = use_expand\nself.use_expand_hidden = use_expand_hidden\nself.known_flags = {}", "ue_dict = {}\nusel = []\nef = self.expand_filters\nkf = self.known_flags\nfor flag in use:\n data = kf.get(flag)\n if da...
<|body_start_0|> self.expand_filters = {x.lower(): (x not in use_expand_hidden, x) for x in use_expand} self.use_expand = use_expand self.use_expand_hidden = use_expand_hidden self.known_flags = {} <|end_body_0|> <|body_start_1|> ue_dict = {} usel = [] ef = self....
use_expand_filter
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class use_expand_filter: def __init__(self, use_expand, use_expand_hidden): """:type use_expand: iterable of strings :param use_expand: names of use-expanded variables. :type use_expand_hidden: set of strings :param use_expand_hidden: names of use-expanded vars that should not be added to the ...
stack_v2_sparse_classes_36k_train_025656
21,000
permissive
[ { "docstring": ":type use_expand: iterable of strings :param use_expand: names of use-expanded variables. :type use_expand_hidden: set of strings :param use_expand_hidden: names of use-expanded vars that should not be added to the dict.", "name": "__init__", "signature": "def __init__(self, use_expand, ...
2
stack_v2_sparse_classes_30k_train_016731
Implement the Python class `use_expand_filter` described below. Class description: Implement the use_expand_filter class. Method signatures and docstrings: - def __init__(self, use_expand, use_expand_hidden): :type use_expand: iterable of strings :param use_expand: names of use-expanded variables. :type use_expand_hi...
Implement the Python class `use_expand_filter` described below. Class description: Implement the use_expand_filter class. Method signatures and docstrings: - def __init__(self, use_expand, use_expand_hidden): :type use_expand: iterable of strings :param use_expand: names of use-expanded variables. :type use_expand_hi...
ad4c3d51a2aff49ed898382c58baa852f47e17b9
<|skeleton|> class use_expand_filter: def __init__(self, use_expand, use_expand_hidden): """:type use_expand: iterable of strings :param use_expand: names of use-expanded variables. :type use_expand_hidden: set of strings :param use_expand_hidden: names of use-expanded vars that should not be added to the ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class use_expand_filter: def __init__(self, use_expand, use_expand_hidden): """:type use_expand: iterable of strings :param use_expand: names of use-expanded variables. :type use_expand_hidden: set of strings :param use_expand_hidden: names of use-expanded vars that should not be added to the dict.""" ...
the_stack_v2_python_sparse
src/pkgcore/ebuild/formatter.py
pkgcore/pkgcore
train
107
19eba7f6d685ad9ced4caed6f71b2d671bfccada
[ "resp = self.client.get(reverse('music_collection:delete_collection'))\nself.assertRedirects(resp, reverse('accounts:login') + '?next=' + reverse('music_collection:delete_collection'))\nself.login('user')\ntrack = MusicTrack(title='to be deleted', user=self.user)\ntrack.save()\nresp = self.client.post(reverse('musi...
<|body_start_0|> resp = self.client.get(reverse('music_collection:delete_collection')) self.assertRedirects(resp, reverse('accounts:login') + '?next=' + reverse('music_collection:delete_collection')) self.login('user') track = MusicTrack(title='to be deleted', user=self.user) tra...
Test behaviour related to account POST method
TestAccountMethod
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestAccountMethod: """Test behaviour related to account POST method""" def test_user_track_deletion(self): """Verify that track deletion works correctly""" <|body_0|> def test_user_account_deletion(self): """Verify that account deletion behaves as expected""" ...
stack_v2_sparse_classes_36k_train_025657
3,810
no_license
[ { "docstring": "Verify that track deletion works correctly", "name": "test_user_track_deletion", "signature": "def test_user_track_deletion(self)" }, { "docstring": "Verify that account deletion behaves as expected", "name": "test_user_account_deletion", "signature": "def test_user_accou...
2
stack_v2_sparse_classes_30k_train_017636
Implement the Python class `TestAccountMethod` described below. Class description: Test behaviour related to account POST method Method signatures and docstrings: - def test_user_track_deletion(self): Verify that track deletion works correctly - def test_user_account_deletion(self): Verify that account deletion behav...
Implement the Python class `TestAccountMethod` described below. Class description: Test behaviour related to account POST method Method signatures and docstrings: - def test_user_track_deletion(self): Verify that track deletion works correctly - def test_user_account_deletion(self): Verify that account deletion behav...
e2d6a0336c7934cae71f833cb34a1f5f21db2d02
<|skeleton|> class TestAccountMethod: """Test behaviour related to account POST method""" def test_user_track_deletion(self): """Verify that track deletion works correctly""" <|body_0|> def test_user_account_deletion(self): """Verify that account deletion behaves as expected""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestAccountMethod: """Test behaviour related to account POST method""" def test_user_track_deletion(self): """Verify that track deletion works correctly""" resp = self.client.get(reverse('music_collection:delete_collection')) self.assertRedirects(resp, reverse('accounts:login') + ...
the_stack_v2_python_sparse
accounts/tests_views.py
gbip/djRDO
train
3
6d2ae52ab67cbbead0a4a8d76e3caf238532b57c
[ "filters = dict(request.args)\npage = int(filters.pop('page', 1))\nlimit = int(filters.pop('limit', 2))\npaginated_users = UserModel.query.paginate(page, limit, error_out=False)\nresponse = create_pagination(items=paginated_users, schema=user_short_list_schema, page=page, limit=limit, query_params=filters, base_url...
<|body_start_0|> filters = dict(request.args) page = int(filters.pop('page', 1)) limit = int(filters.pop('limit', 2)) paginated_users = UserModel.query.paginate(page, limit, error_out=False) response = create_pagination(items=paginated_users, schema=user_short_list_schema, page=p...
Resource for retrieving exists and adding new users
UserList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserList: """Resource for retrieving exists and adding new users""" def get(cls) -> Tuple[Dict, int]: """Method for retrieving list of all Users Returns ------- Tuple[Dict, int] Response message and status code""" <|body_0|> def post(cls): """Method for creating ...
stack_v2_sparse_classes_36k_train_025658
5,979
no_license
[ { "docstring": "Method for retrieving list of all Users Returns ------- Tuple[Dict, int] Response message and status code", "name": "get", "signature": "def get(cls) -> Tuple[Dict, int]" }, { "docstring": "Method for creating new User Returns ------- Tuple[Dict, int] Response message and status ...
2
stack_v2_sparse_classes_30k_train_019863
Implement the Python class `UserList` described below. Class description: Resource for retrieving exists and adding new users Method signatures and docstrings: - def get(cls) -> Tuple[Dict, int]: Method for retrieving list of all Users Returns ------- Tuple[Dict, int] Response message and status code - def post(cls):...
Implement the Python class `UserList` described below. Class description: Resource for retrieving exists and adding new users Method signatures and docstrings: - def get(cls) -> Tuple[Dict, int]: Method for retrieving list of all Users Returns ------- Tuple[Dict, int] Response message and status code - def post(cls):...
51e4d69f88c120cfc587fd007f21528a7bd661a0
<|skeleton|> class UserList: """Resource for retrieving exists and adding new users""" def get(cls) -> Tuple[Dict, int]: """Method for retrieving list of all Users Returns ------- Tuple[Dict, int] Response message and status code""" <|body_0|> def post(cls): """Method for creating ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserList: """Resource for retrieving exists and adding new users""" def get(cls) -> Tuple[Dict, int]: """Method for retrieving list of all Users Returns ------- Tuple[Dict, int] Response message and status code""" filters = dict(request.args) page = int(filters.pop('page', 1)) ...
the_stack_v2_python_sparse
flask_app/resources/user.py
Kyrylo-Kotelevets/Flask_Events
train
0
6bdc62e4e294afedd8066db2a224373c030a7c6f
[ "super(ProtocolMapperTestBase, self).setUp()\nself.Reinitialize(path_method='my_method', content_type='application/x-google-protobuf')\nself.request_message = Request1()\nself.request_message.integer_field = 1\nself.request_message.string_field = u'something'\nself.request_message.enum_field = Enum1.VAL1\nself.resp...
<|body_start_0|> super(ProtocolMapperTestBase, self).setUp() self.Reinitialize(path_method='my_method', content_type='application/x-google-protobuf') self.request_message = Request1() self.request_message.integer_field = 1 self.request_message.string_field = u'something' ...
Base class for basic protocol mapper tests.
ProtocolMapperTestBase
[ "Apache-2.0", "BSD-3-Clause", "LGPL-2.0-or-later", "GPL-1.0-or-later", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProtocolMapperTestBase: """Base class for basic protocol mapper tests.""" def setUp(self): """Reinitialize test specifically for protocol buffer mapper.""" <|body_0|> def testBuildRequest(self): """Test request building.""" <|body_1|> def testBuildRe...
stack_v2_sparse_classes_36k_train_025659
46,517
permissive
[ { "docstring": "Reinitialize test specifically for protocol buffer mapper.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test request building.", "name": "testBuildRequest", "signature": "def testBuildRequest(self)" }, { "docstring": "Test response building...
4
stack_v2_sparse_classes_30k_train_011538
Implement the Python class `ProtocolMapperTestBase` described below. Class description: Base class for basic protocol mapper tests. Method signatures and docstrings: - def setUp(self): Reinitialize test specifically for protocol buffer mapper. - def testBuildRequest(self): Test request building. - def testBuildRespon...
Implement the Python class `ProtocolMapperTestBase` described below. Class description: Base class for basic protocol mapper tests. Method signatures and docstrings: - def setUp(self): Reinitialize test specifically for protocol buffer mapper. - def testBuildRequest(self): Test request building. - def testBuildRespon...
72a05af97787001756bae2511b7985e61498c965
<|skeleton|> class ProtocolMapperTestBase: """Base class for basic protocol mapper tests.""" def setUp(self): """Reinitialize test specifically for protocol buffer mapper.""" <|body_0|> def testBuildRequest(self): """Test request building.""" <|body_1|> def testBuildRe...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProtocolMapperTestBase: """Base class for basic protocol mapper tests.""" def setUp(self): """Reinitialize test specifically for protocol buffer mapper.""" super(ProtocolMapperTestBase, self).setUp() self.Reinitialize(path_method='my_method', content_type='application/x-google-pro...
the_stack_v2_python_sparse
third_party/catapult/third_party/gsutil/third_party/protorpc/protorpc/webapp/service_handlers_test.py
metux/chromium-suckless
train
5
fd0fe70f34dc2fbb534ad9a2f078e5f2b8a7922e
[ "n = len(matrix)\ndp = [[0] * n for _ in range(n)]\nfor j in range(n):\n dp[n - 1][j] = matrix[n - 1][j]\nfor i in range(n - 2, -1, -1):\n for j in range(n):\n if j == 0:\n dp[i][j] = matrix[i][j] + min(dp[i + 1][j], dp[i + 1][j + 1])\n elif j == n - 1:\n dp[i][j] = matrix[...
<|body_start_0|> n = len(matrix) dp = [[0] * n for _ in range(n)] for j in range(n): dp[n - 1][j] = matrix[n - 1][j] for i in range(n - 2, -1, -1): for j in range(n): if j == 0: dp[i][j] = matrix[i][j] + min(dp[i + 1][j], dp[i +...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minFallingPathSum(self, matrix): """:type matrix: List[List[int]] :rtype: int""" <|body_0|> def minFallingPathSumOnSpace(self, matrix): """:type matrix: List[List[int]] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> n = le...
stack_v2_sparse_classes_36k_train_025660
2,649
no_license
[ { "docstring": ":type matrix: List[List[int]] :rtype: int", "name": "minFallingPathSum", "signature": "def minFallingPathSum(self, matrix)" }, { "docstring": ":type matrix: List[List[int]] :rtype: int", "name": "minFallingPathSumOnSpace", "signature": "def minFallingPathSumOnSpace(self, ...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minFallingPathSum(self, matrix): :type matrix: List[List[int]] :rtype: int - def minFallingPathSumOnSpace(self, matrix): :type matrix: List[List[int]] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minFallingPathSum(self, matrix): :type matrix: List[List[int]] :rtype: int - def minFallingPathSumOnSpace(self, matrix): :type matrix: List[List[int]] :rtype: int <|skeleton...
810575368ecffa97677bdb51744d1f716140bbb1
<|skeleton|> class Solution: def minFallingPathSum(self, matrix): """:type matrix: List[List[int]] :rtype: int""" <|body_0|> def minFallingPathSumOnSpace(self, matrix): """:type matrix: List[List[int]] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def minFallingPathSum(self, matrix): """:type matrix: List[List[int]] :rtype: int""" n = len(matrix) dp = [[0] * n for _ in range(n)] for j in range(n): dp[n - 1][j] = matrix[n - 1][j] for i in range(n - 2, -1, -1): for j in range(n): ...
the_stack_v2_python_sparse
M/MinimumFallingPathSum.py
bssrdf/pyleet
train
2
b95670ff22b9de6cf668d3774cb43df9d095cd82
[ "self._privkey = privkey\nself._account = account\nself._messages = messages\nself._sign_mode = sign_mode\nself._fee = fee\nself._memo = memo\nself._chain_id = chain_id\nself._pubkey = privkey_to_pubkey(self._privkey)", "for m in serialized_messages:\n slot = self._tx.body.messages.add()\n slot.Pack(m, type...
<|body_start_0|> self._privkey = privkey self._account = account self._messages = messages self._sign_mode = sign_mode self._fee = fee self._memo = memo self._chain_id = chain_id self._pubkey = privkey_to_pubkey(self._privkey) <|end_body_0|> <|body_start_...
A bluzelle transaction.
Transaction
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Transaction: """A bluzelle transaction.""" def __init__(self, *, privkey: bytes, account: Any, messages: List[Message], sign_mode: SignMode, fee: Fee, memo: str=None, chain_id: str='') -> None: """Args: privkey: the input private key to sign the raw transaction. account: required to ...
stack_v2_sparse_classes_36k_train_025661
6,951
permissive
[ { "docstring": "Args: privkey: the input private key to sign the raw transaction. account: required to create the signer data. messages: input bluzelle messages to be included in the transaction. sign_mode: for creating the raw transaction, a :term:`SignModeHandler` with the same supported mode should be used t...
6
stack_v2_sparse_classes_30k_train_010254
Implement the Python class `Transaction` described below. Class description: A bluzelle transaction. Method signatures and docstrings: - def __init__(self, *, privkey: bytes, account: Any, messages: List[Message], sign_mode: SignMode, fee: Fee, memo: str=None, chain_id: str='') -> None: Args: privkey: the input priva...
Implement the Python class `Transaction` described below. Class description: A bluzelle transaction. Method signatures and docstrings: - def __init__(self, *, privkey: bytes, account: Any, messages: List[Message], sign_mode: SignMode, fee: Fee, memo: str=None, chain_id: str='') -> None: Args: privkey: the input priva...
c38a07458a36305457680196e8c47372008db5ab
<|skeleton|> class Transaction: """A bluzelle transaction.""" def __init__(self, *, privkey: bytes, account: Any, messages: List[Message], sign_mode: SignMode, fee: Fee, memo: str=None, chain_id: str='') -> None: """Args: privkey: the input private key to sign the raw transaction. account: required to ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Transaction: """A bluzelle transaction.""" def __init__(self, *, privkey: bytes, account: Any, messages: List[Message], sign_mode: SignMode, fee: Fee, memo: str=None, chain_id: str='') -> None: """Args: privkey: the input private key to sign the raw transaction. account: required to create the si...
the_stack_v2_python_sparse
bluzelle/cosmos/_transaction.py
hhio618/bluzelle-py
train
3
b6d751bee3e871bce59453d32b8c4bb19b1aa645
[ "self.parser = reqparse.RequestParser()\nself.parser.add_argument('token')\nsuper(Contract, self).__init__()", "args = self.parser.parse_args()\ntoken = args['token']\ndata = me.getAllContracts()\nprint('Contract', data)\nl = [o.__dict__ for o in data]\nreturn {'result_code': 'success', 'data': l}" ]
<|body_start_0|> self.parser = reqparse.RequestParser() self.parser.add_argument('token') super(Contract, self).__init__() <|end_body_0|> <|body_start_1|> args = self.parser.parse_args() token = args['token'] data = me.getAllContracts() print('Contract', data) ...
合约
Contract
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Contract: """合约""" def __init__(self): """初始化""" <|body_0|> def get(self): """查询""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.parser = reqparse.RequestParser() self.parser.add_argument('token') super(Contract, self).__ini...
stack_v2_sparse_classes_36k_train_025662
24,002
permissive
[ { "docstring": "初始化", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "查询", "name": "get", "signature": "def get(self)" } ]
2
stack_v2_sparse_classes_30k_val_001088
Implement the Python class `Contract` described below. Class description: 合约 Method signatures and docstrings: - def __init__(self): 初始化 - def get(self): 查询
Implement the Python class `Contract` described below. Class description: 合约 Method signatures and docstrings: - def __init__(self): 初始化 - def get(self): 查询 <|skeleton|> class Contract: """合约""" def __init__(self): """初始化""" <|body_0|> def get(self): """查询""" <|body_1|> ...
c316649161086da2543d39bf0455d0f793cdd08f
<|skeleton|> class Contract: """合约""" def __init__(self): """初始化""" <|body_0|> def get(self): """查询""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Contract: """合约""" def __init__(self): """初始化""" self.parser = reqparse.RequestParser() self.parser.add_argument('token') super(Contract, self).__init__() def get(self): """查询""" args = self.parser.parse_args() token = args['token'] dat...
the_stack_v2_python_sparse
WebTrader/webServer.py
webclinic017/riskBacktestingPlatform
train
0
60eecbc9886dc6e7e022d5c87830e49e1975c31f
[ "self.flavor = flavor\nself.nucleon = nucleon\nself.ip = input_dict", "self.mp = self.ip['mproton']\nself.mn = self.ip['mneutron']\nif self.nucleon == 'p':\n if self.flavor == 'u':\n return 3 / 4 * self.mp * self.ip['f2up']\n if self.flavor == 'd':\n return 3 / 4 * self.mp * self.ip['f2dp']\n ...
<|body_start_0|> self.flavor = flavor self.nucleon = nucleon self.ip = input_dict <|end_body_0|> <|body_start_1|> self.mp = self.ip['mproton'] self.mn = self.ip['mneutron'] if self.nucleon == 'p': if self.flavor == 'u': return 3 / 4 * self.mp ...
FTwist2
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FTwist2: def __init__(self, flavor, nucleon, input_dict): """The twist-two nuclear form factors Return the twist-two nuclear form factors Arguments --------- flavor = 'u', 'd', 's', 'g' -- the "quark" flavor (up, down, strange, or gluon contribution) nucleon = 'p', 'n' -- the nucleon (pr...
stack_v2_sparse_classes_36k_train_025663
18,337
permissive
[ { "docstring": "The twist-two nuclear form factors Return the twist-two nuclear form factors Arguments --------- flavor = 'u', 'd', 's', 'g' -- the \"quark\" flavor (up, down, strange, or gluon contribution) nucleon = 'p', 'n' -- the nucleon (proton or neutron) input_dict (optional) -- a dictionary of hadronic ...
2
stack_v2_sparse_classes_30k_train_016070
Implement the Python class `FTwist2` described below. Class description: Implement the FTwist2 class. Method signatures and docstrings: - def __init__(self, flavor, nucleon, input_dict): The twist-two nuclear form factors Return the twist-two nuclear form factors Arguments --------- flavor = 'u', 'd', 's', 'g' -- the...
Implement the Python class `FTwist2` described below. Class description: Implement the FTwist2 class. Method signatures and docstrings: - def __init__(self, flavor, nucleon, input_dict): The twist-two nuclear form factors Return the twist-two nuclear form factors Arguments --------- flavor = 'u', 'd', 's', 'g' -- the...
4a714e4701f817fdc96e10e461eef7c4756ef71d
<|skeleton|> class FTwist2: def __init__(self, flavor, nucleon, input_dict): """The twist-two nuclear form factors Return the twist-two nuclear form factors Arguments --------- flavor = 'u', 'd', 's', 'g' -- the "quark" flavor (up, down, strange, or gluon contribution) nucleon = 'p', 'n' -- the nucleon (pr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FTwist2: def __init__(self, flavor, nucleon, input_dict): """The twist-two nuclear form factors Return the twist-two nuclear form factors Arguments --------- flavor = 'u', 'd', 's', 'g' -- the "quark" flavor (up, down, strange, or gluon contribution) nucleon = 'p', 'n' -- the nucleon (proton or neutro...
the_stack_v2_python_sparse
directdm/num/single_nucleon_form_factors.py
DirectDM/directdm-py
train
6
4f82f91ab1f488430fc02cbf2ce83bb80035d80b
[ "if isinstance(key, int):\n return PriorityLevel(key)\nif key not in PriorityLevel._member_map_:\n extend_enum(PriorityLevel, key, default)\nreturn PriorityLevel[key]", "if not (isinstance(value, int) and 0 <= value <= 7):\n raise ValueError('%r is not a valid %s' % (value, cls.__name__))\nextend_enum(cl...
<|body_start_0|> if isinstance(key, int): return PriorityLevel(key) if key not in PriorityLevel._member_map_: extend_enum(PriorityLevel, key, default) return PriorityLevel[key] <|end_body_0|> <|body_start_1|> if not (isinstance(value, int) and 0 <= value <= 7): ...
[PriorityLevel] Priority levels defined in IEEE 802.1p.
PriorityLevel
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PriorityLevel: """[PriorityLevel] Priority levels defined in IEEE 802.1p.""" def get(key, default=-1): """Backport support for original codes.""" <|body_0|> def _missing_(cls, value): """Lookup function used when value is not found.""" <|body_1|> <|end_s...
stack_v2_sparse_classes_36k_train_025664
1,411
permissive
[ { "docstring": "Backport support for original codes.", "name": "get", "signature": "def get(key, default=-1)" }, { "docstring": "Lookup function used when value is not found.", "name": "_missing_", "signature": "def _missing_(cls, value)" } ]
2
stack_v2_sparse_classes_30k_train_018909
Implement the Python class `PriorityLevel` described below. Class description: [PriorityLevel] Priority levels defined in IEEE 802.1p. Method signatures and docstrings: - def get(key, default=-1): Backport support for original codes. - def _missing_(cls, value): Lookup function used when value is not found.
Implement the Python class `PriorityLevel` described below. Class description: [PriorityLevel] Priority levels defined in IEEE 802.1p. Method signatures and docstrings: - def get(key, default=-1): Backport support for original codes. - def _missing_(cls, value): Lookup function used when value is not found. <|skelet...
90cd07d67df28d5c5ab0585bc60f467a78d9db33
<|skeleton|> class PriorityLevel: """[PriorityLevel] Priority levels defined in IEEE 802.1p.""" def get(key, default=-1): """Backport support for original codes.""" <|body_0|> def _missing_(cls, value): """Lookup function used when value is not found.""" <|body_1|> <|end_s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PriorityLevel: """[PriorityLevel] Priority levels defined in IEEE 802.1p.""" def get(key, default=-1): """Backport support for original codes.""" if isinstance(key, int): return PriorityLevel(key) if key not in PriorityLevel._member_map_: extend_enum(Priori...
the_stack_v2_python_sparse
pcapkit/const/vlan/priority_level.py
stjordanis/PyPCAPKit
train
0
117a79bd4bcfeaacc71ad35b57d565728415de0c
[ "cache_policy = 'apt-cache policy '\ntry:\n c = cache_policy + str(package['package name'])\n proc = subprocess.Popen(c, shell=True, stdout=subprocess.PIPE)\n shell_output = proc.stdout.read()\nexcept subprocess.CalledProcessError as e:\n shell_output = e.output\nreturn shell_output", "try:\n subpr...
<|body_start_0|> cache_policy = 'apt-cache policy ' try: c = cache_policy + str(package['package name']) proc = subprocess.Popen(c, shell=True, stdout=subprocess.PIPE) shell_output = proc.stdout.read() except subprocess.CalledProcessError as e: she...
BashConnector
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BashConnector: def apt_cache(cls, package: {}) -> str: """Script uses apt-cache policy (ubuntu program) to gather information for a package (installed or not and version). Assumes that it is installed since any version after 14 has it by default. :param package: json object representing ...
stack_v2_sparse_classes_36k_train_025665
2,408
permissive
[ { "docstring": "Script uses apt-cache policy (ubuntu program) to gather information for a package (installed or not and version). Assumes that it is installed since any version after 14 has it by default. :param package: json object representing package :return: The output of executed apt-cache policy program."...
4
stack_v2_sparse_classes_30k_train_004582
Implement the Python class `BashConnector` described below. Class description: Implement the BashConnector class. Method signatures and docstrings: - def apt_cache(cls, package: {}) -> str: Script uses apt-cache policy (ubuntu program) to gather information for a package (installed or not and version). Assumes that i...
Implement the Python class `BashConnector` described below. Class description: Implement the BashConnector class. Method signatures and docstrings: - def apt_cache(cls, package: {}) -> str: Script uses apt-cache policy (ubuntu program) to gather information for a package (installed or not and version). Assumes that i...
f4e3c2e47aa53f6592a573f840a83e5d2c519f8d
<|skeleton|> class BashConnector: def apt_cache(cls, package: {}) -> str: """Script uses apt-cache policy (ubuntu program) to gather information for a package (installed or not and version). Assumes that it is installed since any version after 14 has it by default. :param package: json object representing ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BashConnector: def apt_cache(cls, package: {}) -> str: """Script uses apt-cache policy (ubuntu program) to gather information for a package (installed or not and version). Assumes that it is installed since any version after 14 has it by default. :param package: json object representing package :retur...
the_stack_v2_python_sparse
src/bash_connector.py
guve4e/package-installer-ubuntu
train
1
da94067534fe0d909b4cddfb4a5d47467b9dd595
[ "global COMPANY_CONN\ncursor = None\ntry:\n cursor = COMPANY_CONN.cursor(buffered=True, dictionary=True)\n sql = 'insert into lie_brand(brand_name, brand_desc, site_url)values(%(brand_name)s, %(brand_desc)s, %(site_url)s)'\n cursor.execute(sql, lieBrand)\n COMPANY_CONN.commit()\nexcept Exception as e:\n...
<|body_start_0|> global COMPANY_CONN cursor = None try: cursor = COMPANY_CONN.cursor(buffered=True, dictionary=True) sql = 'insert into lie_brand(brand_name, brand_desc, site_url)values(%(brand_name)s, %(brand_desc)s, %(site_url)s)' cursor.execute(sql, lieBran...
LieBrand
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LieBrand: def addLieBrand(cls, lieBrand): """method: addBrand params: lieBrand-type: LieBrand""" <|body_0|> def get_brand_id_by_brand_name(cls, brand_name): """method: get_brand_id_by_brand_name params: brand_name-type: str return: brand_id return-type: int""" ...
stack_v2_sparse_classes_36k_train_025666
13,174
no_license
[ { "docstring": "method: addBrand params: lieBrand-type: LieBrand", "name": "addLieBrand", "signature": "def addLieBrand(cls, lieBrand)" }, { "docstring": "method: get_brand_id_by_brand_name params: brand_name-type: str return: brand_id return-type: int", "name": "get_brand_id_by_brand_name",...
2
stack_v2_sparse_classes_30k_train_014579
Implement the Python class `LieBrand` described below. Class description: Implement the LieBrand class. Method signatures and docstrings: - def addLieBrand(cls, lieBrand): method: addBrand params: lieBrand-type: LieBrand - def get_brand_id_by_brand_name(cls, brand_name): method: get_brand_id_by_brand_name params: bra...
Implement the Python class `LieBrand` described below. Class description: Implement the LieBrand class. Method signatures and docstrings: - def addLieBrand(cls, lieBrand): method: addBrand params: lieBrand-type: LieBrand - def get_brand_id_by_brand_name(cls, brand_name): method: get_brand_id_by_brand_name params: bra...
1e49a6e13ea4b11427f47999c13a609be9ae3ecf
<|skeleton|> class LieBrand: def addLieBrand(cls, lieBrand): """method: addBrand params: lieBrand-type: LieBrand""" <|body_0|> def get_brand_id_by_brand_name(cls, brand_name): """method: get_brand_id_by_brand_name params: brand_name-type: str return: brand_id return-type: int""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LieBrand: def addLieBrand(cls, lieBrand): """method: addBrand params: lieBrand-type: LieBrand""" global COMPANY_CONN cursor = None try: cursor = COMPANY_CONN.cursor(buffered=True, dictionary=True) sql = 'insert into lie_brand(brand_name, brand_desc, site...
the_stack_v2_python_sparse
rsonline/server/db/company/mysql_client.py
yunhao-qing/PythonScrapy
train
0
0aa14ca1d2a0bf318dd438e9cc9202e99008e204
[ "new_user = get_user_model().objects.create_user(email, nickname, password)\nnew_user.is_active = False\nnew_user.save()\nregistration_profile = self.create_profile(new_user)\nregistration_profile.send_activation_email(site)\nreturn new_user", "salt = hashlib.sha1(str(random.random())).hexdigest()[:5]\nemail = us...
<|body_start_0|> new_user = get_user_model().objects.create_user(email, nickname, password) new_user.is_active = False new_user.save() registration_profile = self.create_profile(new_user) registration_profile.send_activation_email(site) return new_user <|end_body_0|> <|b...
继承自RegistrationManager, 自定义用户字段
CustomRegistrationManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CustomRegistrationManager: """继承自RegistrationManager, 自定义用户字段""" def create_inactive_user(self, email, nickname, password, site, send_email=True): """新建一个未激活的用户""" <|body_0|> def create_profile(self, user): """通过用户的电子邮件地址创建一个唯一的和用户绑定的激活码""" <|body_1|> <|...
stack_v2_sparse_classes_36k_train_025667
6,648
no_license
[ { "docstring": "新建一个未激活的用户", "name": "create_inactive_user", "signature": "def create_inactive_user(self, email, nickname, password, site, send_email=True)" }, { "docstring": "通过用户的电子邮件地址创建一个唯一的和用户绑定的激活码", "name": "create_profile", "signature": "def create_profile(self, user)" } ]
2
null
Implement the Python class `CustomRegistrationManager` described below. Class description: 继承自RegistrationManager, 自定义用户字段 Method signatures and docstrings: - def create_inactive_user(self, email, nickname, password, site, send_email=True): 新建一个未激活的用户 - def create_profile(self, user): 通过用户的电子邮件地址创建一个唯一的和用户绑定的激活码
Implement the Python class `CustomRegistrationManager` described below. Class description: 继承自RegistrationManager, 自定义用户字段 Method signatures and docstrings: - def create_inactive_user(self, email, nickname, password, site, send_email=True): 新建一个未激活的用户 - def create_profile(self, user): 通过用户的电子邮件地址创建一个唯一的和用户绑定的激活码 <|s...
d52681a84bc75615dcfd7a373e579833e1ebece8
<|skeleton|> class CustomRegistrationManager: """继承自RegistrationManager, 自定义用户字段""" def create_inactive_user(self, email, nickname, password, site, send_email=True): """新建一个未激活的用户""" <|body_0|> def create_profile(self, user): """通过用户的电子邮件地址创建一个唯一的和用户绑定的激活码""" <|body_1|> <|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CustomRegistrationManager: """继承自RegistrationManager, 自定义用户字段""" def create_inactive_user(self, email, nickname, password, site, send_email=True): """新建一个未激活的用户""" new_user = get_user_model().objects.create_user(email, nickname, password) new_user.is_active = False new_use...
the_stack_v2_python_sparse
citi/apps/account/models.py
doraemonext/citi
train
0
51fd6a76068091ba345bcdc0c9ec1feb8a73a787
[ "if len(matrix) == 0:\n return False\nif len(matrix[0]) == 0:\n return False\nrow = self.vertical_search(matrix, target)\nreturn self.horizontal_search(matrix[row], target)", "low, high = (0, len(matrix) - 1)\nwhile low <= high:\n mid = (low + high) // 2\n if matrix[mid][0] <= target <= matrix[mid][-1...
<|body_start_0|> if len(matrix) == 0: return False if len(matrix[0]) == 0: return False row = self.vertical_search(matrix, target) return self.horizontal_search(matrix[row], target) <|end_body_0|> <|body_start_1|> low, high = (0, len(matrix) - 1) ...
Runtime: 36 ms, faster than 96.37% of Python3 online submissions for Search a 2D Matrix. Memory Usage: 14 MB, less than 33.84% of Python3 online submissions for Search a 2D Matrix.
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """Runtime: 36 ms, faster than 96.37% of Python3 online submissions for Search a 2D Matrix. Memory Usage: 14 MB, less than 33.84% of Python3 online submissions for Search a 2D Matrix.""" def searchMatrix(self, matrix, target): """Simple approach Args: matrix: 2D matrix to l...
stack_v2_sparse_classes_36k_train_025668
3,400
no_license
[ { "docstring": "Simple approach Args: matrix: 2D matrix to look a target from target: an integer value to look for Returns: bool: True if target exists in the matrix, otherwise False", "name": "searchMatrix", "signature": "def searchMatrix(self, matrix, target)" }, { "docstring": "This determine...
3
null
Implement the Python class `Solution` described below. Class description: Runtime: 36 ms, faster than 96.37% of Python3 online submissions for Search a 2D Matrix. Memory Usage: 14 MB, less than 33.84% of Python3 online submissions for Search a 2D Matrix. Method signatures and docstrings: - def searchMatrix(self, matr...
Implement the Python class `Solution` described below. Class description: Runtime: 36 ms, faster than 96.37% of Python3 online submissions for Search a 2D Matrix. Memory Usage: 14 MB, less than 33.84% of Python3 online submissions for Search a 2D Matrix. Method signatures and docstrings: - def searchMatrix(self, matr...
01fe893ba2e37c9bda79e3081c556698f0b6d2f0
<|skeleton|> class Solution: """Runtime: 36 ms, faster than 96.37% of Python3 online submissions for Search a 2D Matrix. Memory Usage: 14 MB, less than 33.84% of Python3 online submissions for Search a 2D Matrix.""" def searchMatrix(self, matrix, target): """Simple approach Args: matrix: 2D matrix to l...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: """Runtime: 36 ms, faster than 96.37% of Python3 online submissions for Search a 2D Matrix. Memory Usage: 14 MB, less than 33.84% of Python3 online submissions for Search a 2D Matrix.""" def searchMatrix(self, matrix, target): """Simple approach Args: matrix: 2D matrix to look a target ...
the_stack_v2_python_sparse
LeetCode/74_search_a_2d_matrix.py
KKosukeee/CodingQuestions
train
1
e5589c30c1bf51aa2e5dbf9d91f5635bcc666dfa
[ "super().__init__(option, shortcut, replacer)\nself._section = replace_section\nself._label = replace_label", "if not self.replacer:\n raise ValueError('LinkChoice requires a replacer')\nkwargs = {}\nif self._section:\n kwargs['section'] = self.replacer._new.section\nelse:\n kwargs['section'] = self.repl...
<|body_start_0|> super().__init__(option, shortcut, replacer) self._section = replace_section self._label = replace_label <|end_body_0|> <|body_start_1|> if not self.replacer: raise ValueError('LinkChoice requires a replacer') kwargs = {} if self._section: ...
A choice returning a mix of the link new and current link.
LinkChoice
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LinkChoice: """A choice returning a mix of the link new and current link.""" def __init__(self, option: str, shortcut: str, replacer: Optional['pywikibot.bot.InteractiveReplace'], replace_section: bool, replace_label: bool) -> None: """Initializer.""" <|body_0|> def hand...
stack_v2_sparse_classes_36k_train_025669
20,559
permissive
[ { "docstring": "Initializer.", "name": "__init__", "signature": "def __init__(self, option: str, shortcut: str, replacer: Optional['pywikibot.bot.InteractiveReplace'], replace_section: bool, replace_label: bool) -> None" }, { "docstring": "Handle by either applying the new section or label.", ...
2
stack_v2_sparse_classes_30k_train_009614
Implement the Python class `LinkChoice` described below. Class description: A choice returning a mix of the link new and current link. Method signatures and docstrings: - def __init__(self, option: str, shortcut: str, replacer: Optional['pywikibot.bot.InteractiveReplace'], replace_section: bool, replace_label: bool) ...
Implement the Python class `LinkChoice` described below. Class description: A choice returning a mix of the link new and current link. Method signatures and docstrings: - def __init__(self, option: str, shortcut: str, replacer: Optional['pywikibot.bot.InteractiveReplace'], replace_section: bool, replace_label: bool) ...
5c01e6bfcd328bc6eae643e661f1a0ae57612808
<|skeleton|> class LinkChoice: """A choice returning a mix of the link new and current link.""" def __init__(self, option: str, shortcut: str, replacer: Optional['pywikibot.bot.InteractiveReplace'], replace_section: bool, replace_label: bool) -> None: """Initializer.""" <|body_0|> def hand...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LinkChoice: """A choice returning a mix of the link new and current link.""" def __init__(self, option: str, shortcut: str, replacer: Optional['pywikibot.bot.InteractiveReplace'], replace_section: bool, replace_label: bool) -> None: """Initializer.""" super().__init__(option, shortcut, re...
the_stack_v2_python_sparse
pywikibot/bot_choice.py
wikimedia/pywikibot
train
432
31a647c915319ffba6bc73ac60ce50e7fd899993
[ "def unpreorder(root):\n if not root:\n return\n unpreorder(root.right)\n root.val += self.preNUm\n self.preNUm = root.val\n unpreorder(root.left)\nunpreorder(root)\nreturn root", "if not root:\n return root\nstack = []\ncheck_node = root\nwhile check_node != None or stack != []:\n whi...
<|body_start_0|> def unpreorder(root): if not root: return unpreorder(root.right) root.val += self.preNUm self.preNUm = root.val unpreorder(root.left) unpreorder(root) return root <|end_body_0|> <|body_start_1|> ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def convertBST1(self, root): """:type root: TreeNode :rtype: TreeNode 以右->根->左的顺序遍历二叉树,将遍历顺序的前一个结点的累加值记录起来,和当前结点相加,得到当前结点的累加值。""" <|body_0|> def convertBST2(self, root): """NOT :param root: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_025670
1,395
no_license
[ { "docstring": ":type root: TreeNode :rtype: TreeNode 以右->根->左的顺序遍历二叉树,将遍历顺序的前一个结点的累加值记录起来,和当前结点相加,得到当前结点的累加值。", "name": "convertBST1", "signature": "def convertBST1(self, root)" }, { "docstring": "NOT :param root: :return:", "name": "convertBST2", "signature": "def convertBST2(self, roo...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def convertBST1(self, root): :type root: TreeNode :rtype: TreeNode 以右->根->左的顺序遍历二叉树,将遍历顺序的前一个结点的累加值记录起来,和当前结点相加,得到当前结点的累加值。 - def convertBST2(self, root): NOT :param root: :retur...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def convertBST1(self, root): :type root: TreeNode :rtype: TreeNode 以右->根->左的顺序遍历二叉树,将遍历顺序的前一个结点的累加值记录起来,和当前结点相加,得到当前结点的累加值。 - def convertBST2(self, root): NOT :param root: :retur...
4105e18050b15fc0409c75353ad31be17187dd34
<|skeleton|> class Solution: def convertBST1(self, root): """:type root: TreeNode :rtype: TreeNode 以右->根->左的顺序遍历二叉树,将遍历顺序的前一个结点的累加值记录起来,和当前结点相加,得到当前结点的累加值。""" <|body_0|> def convertBST2(self, root): """NOT :param root: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def convertBST1(self, root): """:type root: TreeNode :rtype: TreeNode 以右->根->左的顺序遍历二叉树,将遍历顺序的前一个结点的累加值记录起来,和当前结点相加,得到当前结点的累加值。""" def unpreorder(root): if not root: return unpreorder(root.right) root.val += self.preNUm s...
the_stack_v2_python_sparse
convertBST.py
NeilWangziyu/Leetcode_py
train
2
337d251bede5507040fc47825a050dc47343107c
[ "self.parent = None\nself.value = value\nself.left = left\nself.right = right\nif left:\n self.left.parent = self\nif right:\n self.right.parent = self", "vals = [self.value]\nif self.left:\n vals = vals + self.left.nodeValues()\nif self.right:\n vals = vals + self.right.nodeValues()\nreturn vals" ]
<|body_start_0|> self.parent = None self.value = value self.left = left self.right = right if left: self.left.parent = self if right: self.right.parent = self <|end_body_0|> <|body_start_1|> vals = [self.value] if self.left: ...
Node class for a binary tree.
Node
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Node: """Node class for a binary tree.""" def __init__(self, value, left=None, right=None): """Initialize the node.""" <|body_0|> def nodeValues(self): """Get all the values in the tree.""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.paren...
stack_v2_sparse_classes_36k_train_025671
1,543
no_license
[ { "docstring": "Initialize the node.", "name": "__init__", "signature": "def __init__(self, value, left=None, right=None)" }, { "docstring": "Get all the values in the tree.", "name": "nodeValues", "signature": "def nodeValues(self)" } ]
2
stack_v2_sparse_classes_30k_train_017021
Implement the Python class `Node` described below. Class description: Node class for a binary tree. Method signatures and docstrings: - def __init__(self, value, left=None, right=None): Initialize the node. - def nodeValues(self): Get all the values in the tree.
Implement the Python class `Node` described below. Class description: Node class for a binary tree. Method signatures and docstrings: - def __init__(self, value, left=None, right=None): Initialize the node. - def nodeValues(self): Get all the values in the tree. <|skeleton|> class Node: """Node class for a binar...
97eae3ee806756f4d646d600f434b1e68164ad34
<|skeleton|> class Node: """Node class for a binary tree.""" def __init__(self, value, left=None, right=None): """Initialize the node.""" <|body_0|> def nodeValues(self): """Get all the values in the tree.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Node: """Node class for a binary tree.""" def __init__(self, value, left=None, right=None): """Initialize the node.""" self.parent = None self.value = value self.left = left self.right = right if left: self.left.parent = self if right: ...
the_stack_v2_python_sparse
Python/2019_05_20_Problem_125_Sum_Node_Pair_to_k.py
BaoCaiH/Daily_Coding_Problem
train
0
a6c04a168a49dfff790389c9f8ec0395dbc5554d
[ "candidates.sort()\nl = len(candidates)\nsub_sum = {}\nfor i in range(1, target + 1):\n v_combine = set()\n for j in range(l):\n if candidates[j] > i:\n break\n elif candidates[j] == i:\n s = set()\n s.add(candidates[j])\n v_combine.add(s)\n els...
<|body_start_0|> candidates.sort() l = len(candidates) sub_sum = {} for i in range(1, target + 1): v_combine = set() for j in range(l): if candidates[j] > i: break elif candidates[j] == i: s =...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def combinationSum(self, candidates, target: int): """使用动态规划 1 从小到大遍历target 1 遍历数组,直到>target, 2 每到一个数i,找到target-i对应的解集 :param candidates: :param target: :return:""" <|body_0|> def combinationSum1(self, candidates, target: int): """使用dfs+回溯 dfs逻辑:输入为target、"...
stack_v2_sparse_classes_36k_train_025672
2,421
no_license
[ { "docstring": "使用动态规划 1 从小到大遍历target 1 遍历数组,直到>target, 2 每到一个数i,找到target-i对应的解集 :param candidates: :param target: :return:", "name": "combinationSum", "signature": "def combinationSum(self, candidates, target: int)" }, { "docstring": "使用dfs+回溯 dfs逻辑:输入为target、", "name": "combinationSum1", ...
2
stack_v2_sparse_classes_30k_train_001512
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def combinationSum(self, candidates, target: int): 使用动态规划 1 从小到大遍历target 1 遍历数组,直到>target, 2 每到一个数i,找到target-i对应的解集 :param candidates: :param target: :return: - def combinationSu...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def combinationSum(self, candidates, target: int): 使用动态规划 1 从小到大遍历target 1 遍历数组,直到>target, 2 每到一个数i,找到target-i对应的解集 :param candidates: :param target: :return: - def combinationSu...
4a27fdd976268bf4daf8eee447efd754f1e0bb02
<|skeleton|> class Solution: def combinationSum(self, candidates, target: int): """使用动态规划 1 从小到大遍历target 1 遍历数组,直到>target, 2 每到一个数i,找到target-i对应的解集 :param candidates: :param target: :return:""" <|body_0|> def combinationSum1(self, candidates, target: int): """使用dfs+回溯 dfs逻辑:输入为target、"...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def combinationSum(self, candidates, target: int): """使用动态规划 1 从小到大遍历target 1 遍历数组,直到>target, 2 每到一个数i,找到target-i对应的解集 :param candidates: :param target: :return:""" candidates.sort() l = len(candidates) sub_sum = {} for i in range(1, target + 1): v...
the_stack_v2_python_sparse
combination-sum.py
Angel888/suanfa
train
0
b109a65af3708dd7e63cff75920566269d1b8d97
[ "super(CollectNAgent, self).__init__(minRoundValue)\nself.minRoundValue = minRoundValue\nself.name = 'CollectNAgent'", "if gameState.round().roundTreasureValues[self.player_id] >= self.minRoundValue:\n return TURN_BACK\nelse:\n return GO_FORWARD" ]
<|body_start_0|> super(CollectNAgent, self).__init__(minRoundValue) self.minRoundValue = minRoundValue self.name = 'CollectNAgent' <|end_body_0|> <|body_start_1|> if gameState.round().roundTreasureValues[self.player_id] >= self.minRoundValue: return TURN_BACK else: ...
classdocs
CollectNAgent
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CollectNAgent: """classdocs""" def __init__(self, minRoundValue): """Constructor""" <|body_0|> def decide(self, gameState): """Returns true if the agent goes forward, returns false if the agent turns back""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_025673
743
no_license
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, minRoundValue)" }, { "docstring": "Returns true if the agent goes forward, returns false if the agent turns back", "name": "decide", "signature": "def decide(self, gameState)" } ]
2
stack_v2_sparse_classes_30k_train_009850
Implement the Python class `CollectNAgent` described below. Class description: classdocs Method signatures and docstrings: - def __init__(self, minRoundValue): Constructor - def decide(self, gameState): Returns true if the agent goes forward, returns false if the agent turns back
Implement the Python class `CollectNAgent` described below. Class description: classdocs Method signatures and docstrings: - def __init__(self, minRoundValue): Constructor - def decide(self, gameState): Returns true if the agent goes forward, returns false if the agent turns back <|skeleton|> class CollectNAgent: ...
2c7ac2952dc2203ee3687581eb45396229e8df87
<|skeleton|> class CollectNAgent: """classdocs""" def __init__(self, minRoundValue): """Constructor""" <|body_0|> def decide(self, gameState): """Returns true if the agent goes forward, returns false if the agent turns back""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CollectNAgent: """classdocs""" def __init__(self, minRoundValue): """Constructor""" super(CollectNAgent, self).__init__(minRoundValue) self.minRoundValue = minRoundValue self.name = 'CollectNAgent' def decide(self, gameState): """Returns true if the agent goes...
the_stack_v2_python_sparse
incanGold/agent/CollectNAgent.py
GrandAdmiralGergar/IncanGold
train
0
e3127fae9ed3aaecfe2c2ea1d139c54ce3299f10
[ "url = await super()._api_url()\ncomponent = self._parameter('component')\nbranch = self._parameter('branch')\nreturn URL(f'{url}/api/project_analyses/search?project={component}&branch={branch}')", "url = await super()._landing_url(responses)\ncomponent = self._parameter('component')\nbranch = self._parameter('br...
<|body_start_0|> url = await super()._api_url() component = self._parameter('component') branch = self._parameter('branch') return URL(f'{url}/api/project_analyses/search?project={component}&branch={branch}') <|end_body_0|> <|body_start_1|> url = await super()._landing_url(respo...
Base class for collectors that use the SonarQube project analyses endpoint.
SonarQubeProjectAnalysesBase
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SonarQubeProjectAnalysesBase: """Base class for collectors that use the SonarQube project analyses endpoint.""" async def _api_url(self) -> URL: """Extend to add the project analyses path and parameters.""" <|body_0|> async def _landing_url(self, responses: SourceRespons...
stack_v2_sparse_classes_36k_train_025674
5,057
permissive
[ { "docstring": "Extend to add the project analyses path and parameters.", "name": "_api_url", "signature": "async def _api_url(self) -> URL" }, { "docstring": "Extend to add the project activity path and parameters.", "name": "_landing_url", "signature": "async def _landing_url(self, res...
2
null
Implement the Python class `SonarQubeProjectAnalysesBase` described below. Class description: Base class for collectors that use the SonarQube project analyses endpoint. Method signatures and docstrings: - async def _api_url(self) -> URL: Extend to add the project analyses path and parameters. - async def _landing_ur...
Implement the Python class `SonarQubeProjectAnalysesBase` described below. Class description: Base class for collectors that use the SonarQube project analyses endpoint. Method signatures and docstrings: - async def _api_url(self) -> URL: Extend to add the project analyses path and parameters. - async def _landing_ur...
5d9952bf0bd47895824fa78428d3e4f4d6b5d9b3
<|skeleton|> class SonarQubeProjectAnalysesBase: """Base class for collectors that use the SonarQube project analyses endpoint.""" async def _api_url(self) -> URL: """Extend to add the project analyses path and parameters.""" <|body_0|> async def _landing_url(self, responses: SourceRespons...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SonarQubeProjectAnalysesBase: """Base class for collectors that use the SonarQube project analyses endpoint.""" async def _api_url(self) -> URL: """Extend to add the project analyses path and parameters.""" url = await super()._api_url() component = self._parameter('component') ...
the_stack_v2_python_sparse
components/collector/src/source_collectors/sonarqube/base.py
ICTU/quality-time
train
43
dba4b6386680fd1a6827e97d1680475c6be4da78
[ "self.aurora_params = aurora_params\nself.custom_tag_vec = custom_tag_vec\nself.instance_type = instance_type\nself.key_pair_name = key_pair_name\nself.network_security_groups = network_security_groups\nself.proxy_vm_subnet = proxy_vm_subnet\nself.proxy_vm_vpc = proxy_vm_vpc\nself.rds_params = rds_params\nself.regi...
<|body_start_0|> self.aurora_params = aurora_params self.custom_tag_vec = custom_tag_vec self.instance_type = instance_type self.key_pair_name = key_pair_name self.network_security_groups = network_security_groups self.proxy_vm_subnet = proxy_vm_subnet self.proxy_...
Implementation of the 'DeployVMsToAWSParams' model. Contains AWS specific information needed to identify various resources when converting and deploying a VM to AWS. Attributes: aurora_params (DeployDBInstancesToRDSParams): This field will be populated for Aurora restores. Proto containing the parameters required for r...
DeployVMsToAWSParams
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeployVMsToAWSParams: """Implementation of the 'DeployVMsToAWSParams' model. Contains AWS specific information needed to identify various resources when converting and deploying a VM to AWS. Attributes: aurora_params (DeployDBInstancesToRDSParams): This field will be populated for Aurora restores...
stack_v2_sparse_classes_36k_train_025675
6,685
permissive
[ { "docstring": "Constructor for the DeployVMsToAWSParams class", "name": "__init__", "signature": "def __init__(self, aurora_params=None, custom_tag_vec=None, instance_type=None, key_pair_name=None, network_security_groups=None, proxy_vm_subnet=None, proxy_vm_vpc=None, rds_params=None, region=None, subn...
2
stack_v2_sparse_classes_30k_train_000002
Implement the Python class `DeployVMsToAWSParams` described below. Class description: Implementation of the 'DeployVMsToAWSParams' model. Contains AWS specific information needed to identify various resources when converting and deploying a VM to AWS. Attributes: aurora_params (DeployDBInstancesToRDSParams): This fiel...
Implement the Python class `DeployVMsToAWSParams` described below. Class description: Implementation of the 'DeployVMsToAWSParams' model. Contains AWS specific information needed to identify various resources when converting and deploying a VM to AWS. Attributes: aurora_params (DeployDBInstancesToRDSParams): This fiel...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class DeployVMsToAWSParams: """Implementation of the 'DeployVMsToAWSParams' model. Contains AWS specific information needed to identify various resources when converting and deploying a VM to AWS. Attributes: aurora_params (DeployDBInstancesToRDSParams): This field will be populated for Aurora restores...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DeployVMsToAWSParams: """Implementation of the 'DeployVMsToAWSParams' model. Contains AWS specific information needed to identify various resources when converting and deploying a VM to AWS. Attributes: aurora_params (DeployDBInstancesToRDSParams): This field will be populated for Aurora restores. Proto conta...
the_stack_v2_python_sparse
cohesity_management_sdk/models/deploy_vms_to_aws_params.py
cohesity/management-sdk-python
train
24
8ee7b1947e3933d394e8244375cea3e346504307
[ "print('***DEBUG PARAMS PARAMS: |%s|' % param)\nparam = param[0]\nif param.get('getFields'):\n return [{'name': {'type': 'string'}}]\nsearch_args = []\np_name = param.get('p_name')\nif p_name:\n search_args.extend([('name', 'ilike', p_name)])\nids = self.search(cr, uid, search_args)\nresult = []\nfor partner ...
<|body_start_0|> print('***DEBUG PARAMS PARAMS: |%s|' % param) param = param[0] if param.get('getFields'): return [{'name': {'type': 'string'}}] search_args = [] p_name = param.get('p_name') if p_name: search_args.extend([('name', 'ilike', p_name)]...
res_partner
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class res_partner: def report_custom_data_params(self, cr, uid, *param): """Custom data method for 'params' report. 'param' is a tuple where the first element is a dict with any report parameters (keyed by the parameter name) and other environmental info. In this example the report has a singl...
stack_v2_sparse_classes_36k_train_025676
2,925
no_license
[ { "docstring": "Custom data method for 'params' report. 'param' is a tuple where the first element is a dict with any report parameters (keyed by the parameter name) and other environmental info. In this example the report has a single defined parameter 'p_name' which is a string. The code below uses 'ilike' to...
2
stack_v2_sparse_classes_30k_train_021566
Implement the Python class `res_partner` described below. Class description: Implement the res_partner class. Method signatures and docstrings: - def report_custom_data_params(self, cr, uid, *param): Custom data method for 'params' report. 'param' is a tuple where the first element is a dict with any report parameter...
Implement the Python class `res_partner` described below. Class description: Implement the res_partner class. Method signatures and docstrings: - def report_custom_data_params(self, cr, uid, *param): Custom data method for 'params' report. 'param' is a tuple where the first element is a dict with any report parameter...
7f36c019ed5405bfdff809c43ae74fb369cd1fd6
<|skeleton|> class res_partner: def report_custom_data_params(self, cr, uid, *param): """Custom data method for 'params' report. 'param' is a tuple where the first element is a dict with any report parameters (keyed by the parameter name) and other environmental info. In this example the report has a singl...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class res_partner: def report_custom_data_params(self, cr, uid, *param): """Custom data method for 'params' report. 'param' is a tuple where the first element is a dict with any report parameters (keyed by the parameter name) and other environmental info. In this example the report has a single defined para...
the_stack_v2_python_sparse
dme_pentaho_example/models/res_partner.py
turbodavid/dme
train
0
d823f6c27a4692da6243b17732c3ae4ceb1d6125
[ "if not root:\n return True\nqueue = deque([(root.left, root.right)])\nwhile queue:\n node1, node2 = queue.popleft()\n if not node1 and (not node2):\n continue\n if not node1 or not node2:\n return False\n if node1.val != node2.val:\n return False\n queue.popleft((node1.left, ...
<|body_start_0|> if not root: return True queue = deque([(root.left, root.right)]) while queue: node1, node2 = queue.popleft() if not node1 and (not node2): continue if not node1 or not node2: return False ...
BinaryTree
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BinaryTree: def is_symmetric(self, root: 'TreeNode') -> bool: """Approach: Iterative Time Complexity: O(N) Space Complexity: O(1) :param root: :return:""" <|body_0|> def depth_first_search(self, node1: 'TreeNode', node2: 'TreeNode') -> bool: """Depth First Search fun...
stack_v2_sparse_classes_36k_train_025677
1,789
no_license
[ { "docstring": "Approach: Iterative Time Complexity: O(N) Space Complexity: O(1) :param root: :return:", "name": "is_symmetric", "signature": "def is_symmetric(self, root: 'TreeNode') -> bool" }, { "docstring": "Depth First Search function. :param node1: :param node2: :return:", "name": "dep...
3
stack_v2_sparse_classes_30k_train_013862
Implement the Python class `BinaryTree` described below. Class description: Implement the BinaryTree class. Method signatures and docstrings: - def is_symmetric(self, root: 'TreeNode') -> bool: Approach: Iterative Time Complexity: O(N) Space Complexity: O(1) :param root: :return: - def depth_first_search(self, node1:...
Implement the Python class `BinaryTree` described below. Class description: Implement the BinaryTree class. Method signatures and docstrings: - def is_symmetric(self, root: 'TreeNode') -> bool: Approach: Iterative Time Complexity: O(N) Space Complexity: O(1) :param root: :return: - def depth_first_search(self, node1:...
65cc78b5afa0db064f9fe8f06597e3e120f7363d
<|skeleton|> class BinaryTree: def is_symmetric(self, root: 'TreeNode') -> bool: """Approach: Iterative Time Complexity: O(N) Space Complexity: O(1) :param root: :return:""" <|body_0|> def depth_first_search(self, node1: 'TreeNode', node2: 'TreeNode') -> bool: """Depth First Search fun...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BinaryTree: def is_symmetric(self, root: 'TreeNode') -> bool: """Approach: Iterative Time Complexity: O(N) Space Complexity: O(1) :param root: :return:""" if not root: return True queue = deque([(root.left, root.right)]) while queue: node1, node2 = queue...
the_stack_v2_python_sparse
revisited/trees/symmetric_tree.py
Shiv2157k/leet_code
train
1
7dd716d0ff7099f1188f3fcf9610367c7c3ac02a
[ "self.Wz = np.random.normal(size=(i + h, h))\nself.Wr = np.random.normal(size=(i + h, h))\nself.Wh = np.random.normal(size=(i + h, h))\nself.Wy = np.random.normal(size=(h, o))\nself.bz = np.zeros((1, h))\nself.br = np.zeros((1, h))\nself.bh = np.zeros((1, h))\nself.by = np.zeros((1, o))", "U = np.hstack((h_prev, ...
<|body_start_0|> self.Wz = np.random.normal(size=(i + h, h)) self.Wr = np.random.normal(size=(i + h, h)) self.Wh = np.random.normal(size=(i + h, h)) self.Wy = np.random.normal(size=(h, o)) self.bz = np.zeros((1, h)) self.br = np.zeros((1, h)) self.bh = np.zeros((1...
GRU cell class
GRUCell
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GRUCell: """GRU cell class""" def __init__(self, i, h, o): """Constructor""" <|body_0|> def forward(self, h_prev, x_t): """Method that performs forward propagation for one time step""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.Wz = np.ra...
stack_v2_sparse_classes_36k_train_025678
1,172
no_license
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, i, h, o)" }, { "docstring": "Method that performs forward propagation for one time step", "name": "forward", "signature": "def forward(self, h_prev, x_t)" } ]
2
stack_v2_sparse_classes_30k_train_005623
Implement the Python class `GRUCell` described below. Class description: GRU cell class Method signatures and docstrings: - def __init__(self, i, h, o): Constructor - def forward(self, h_prev, x_t): Method that performs forward propagation for one time step
Implement the Python class `GRUCell` described below. Class description: GRU cell class Method signatures and docstrings: - def __init__(self, i, h, o): Constructor - def forward(self, h_prev, x_t): Method that performs forward propagation for one time step <|skeleton|> class GRUCell: """GRU cell class""" d...
131be8fcf61aafb5a4ddc0b3853ba625560eb786
<|skeleton|> class GRUCell: """GRU cell class""" def __init__(self, i, h, o): """Constructor""" <|body_0|> def forward(self, h_prev, x_t): """Method that performs forward propagation for one time step""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GRUCell: """GRU cell class""" def __init__(self, i, h, o): """Constructor""" self.Wz = np.random.normal(size=(i + h, h)) self.Wr = np.random.normal(size=(i + h, h)) self.Wh = np.random.normal(size=(i + h, h)) self.Wy = np.random.normal(size=(h, o)) self.bz ...
the_stack_v2_python_sparse
supervised_learning/0x0D-RNNs/2-gru_cell.py
zahraaassaad/holbertonschool-machine_learning
train
1
5e9a09c25e1dad121013fa8bef9931501f9475ea
[ "arr = []\n\ndef traverse(node):\n if node:\n arr.append(str(node.val))\n for c in node.children:\n traverse(c)\n arr.append('#')\ntraverse(root)\nreturn ' '.join(arr)", "if not data:\n return\ntoken = collections.deque(data.split())\n\ndef helper(token):\n root = Node(int...
<|body_start_0|> arr = [] def traverse(node): if node: arr.append(str(node.val)) for c in node.children: traverse(c) arr.append('#') traverse(root) return ' '.join(arr) <|end_body_0|> <|body_start_1|> ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: Node :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: Node""" <|body_1|> <|end_skeleton|> <|body_start_0|...
stack_v2_sparse_classes_36k_train_025679
2,283
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: Node :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: Node", "name": "deserialize", "signature": "def deserialize(self, ...
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: Node :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype: Nod...
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: Node :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype: Nod...
aac41ddd2ec5f6e5c0f46659696ed5b67769bde2
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: Node :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: Node""" <|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: Node :rtype: str""" arr = [] def traverse(node): if node: arr.append(str(node.val)) for c in node.children: traverse(c) a...
the_stack_v2_python_sparse
serialize_deserialize.py
aroraakshit/coding_prep
train
8
bec1119c569c6da9e6c901a6e438eddff70b3dfe
[ "self.mol = mol\nself.ff = ff\nself.top = topology.BaseTopology(mol, ff)", "ligand_masses = [a.GetMass() for a in self.mol.GetAtoms()]\nligand_coords = get_romol_conf(self.mol)\nhost_bps, host_masses = openmm_deserializer.deserialize_system(host_system, cutoff=1.2)\nnum_host_atoms = host_coords.shape[0]\nhgt = to...
<|body_start_0|> self.mol = mol self.ff = ff self.top = topology.BaseTopology(mol, ff) <|end_body_0|> <|body_start_1|> ligand_masses = [a.GetMass() for a in self.mol.GetAtoms()] ligand_coords = get_romol_conf(self.mol) host_bps, host_masses = openmm_deserializer.deserial...
AbsoluteFreeEnergy
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AbsoluteFreeEnergy: def __init__(self, mol, ff): """Compute the absolute free energy of a molecule via 4D decoupling. Parameters ---------- mol: rdkit mol Ligand to be decoupled ff: ff.Forcefield Ligand forcefield""" <|body_0|> def prepare_host_edge(self, ff_params, host_sys...
stack_v2_sparse_classes_36k_train_025680
8,594
permissive
[ { "docstring": "Compute the absolute free energy of a molecule via 4D decoupling. Parameters ---------- mol: rdkit mol Ligand to be decoupled ff: ff.Forcefield Ligand forcefield", "name": "__init__", "signature": "def __init__(self, mol, ff)" }, { "docstring": "Prepares the host-edge system Para...
2
stack_v2_sparse_classes_30k_train_011913
Implement the Python class `AbsoluteFreeEnergy` described below. Class description: Implement the AbsoluteFreeEnergy class. Method signatures and docstrings: - def __init__(self, mol, ff): Compute the absolute free energy of a molecule via 4D decoupling. Parameters ---------- mol: rdkit mol Ligand to be decoupled ff:...
Implement the Python class `AbsoluteFreeEnergy` described below. Class description: Implement the AbsoluteFreeEnergy class. Method signatures and docstrings: - def __init__(self, mol, ff): Compute the absolute free energy of a molecule via 4D decoupling. Parameters ---------- mol: rdkit mol Ligand to be decoupled ff:...
74efe28bfe4fe72a995a764bf3afe635b01bfc73
<|skeleton|> class AbsoluteFreeEnergy: def __init__(self, mol, ff): """Compute the absolute free energy of a molecule via 4D decoupling. Parameters ---------- mol: rdkit mol Ligand to be decoupled ff: ff.Forcefield Ligand forcefield""" <|body_0|> def prepare_host_edge(self, ff_params, host_sys...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AbsoluteFreeEnergy: def __init__(self, mol, ff): """Compute the absolute free energy of a molecule via 4D decoupling. Parameters ---------- mol: rdkit mol Ligand to be decoupled ff: ff.Forcefield Ligand forcefield""" self.mol = mol self.ff = ff self.top = topology.BaseTopology(...
the_stack_v2_python_sparse
fe/free_energy.py
jchodera/timemachine
train
0
62faaccf74199d4800fa9dd50b65ab42be2e855f
[ "self.num_parallel_calls = tf.convert_to_tensor(num_parallel_calls, tf.int32)\nif times.dtype is not float_type:\n times = tf.cast(times, float_type)\nself.times = times\nself.slice_size = index_feed.step\nself.Nt = tf.shape(self.times)[0]\nself.index_feed = index_feed\nself.time_feed = index_feed.feed.map(self....
<|body_start_0|> self.num_parallel_calls = tf.convert_to_tensor(num_parallel_calls, tf.int32) if times.dtype is not float_type: times = tf.cast(times, float_type) self.times = times self.slice_size = index_feed.step self.Nt = tf.shape(self.times)[0] self.index...
TimeFeed
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TimeFeed: def __init__(self, index_feed: IndexFeed, times, num_parallel_calls=10): """Create a time feed :param index_feed: IndexFeed Pulse of this feed :param times: float_type, Tensor, [Nt, 1] Times to slice :param num_parallel_calls:""" <|body_0|> def get_times_slice(self...
stack_v2_sparse_classes_36k_train_025681
18,860
permissive
[ { "docstring": "Create a time feed :param index_feed: IndexFeed Pulse of this feed :param times: float_type, Tensor, [Nt, 1] Times to slice :param num_parallel_calls:", "name": "__init__", "signature": "def __init__(self, index_feed: IndexFeed, times, num_parallel_calls=10)" }, { "docstring": "G...
2
stack_v2_sparse_classes_30k_train_009783
Implement the Python class `TimeFeed` described below. Class description: Implement the TimeFeed class. Method signatures and docstrings: - def __init__(self, index_feed: IndexFeed, times, num_parallel_calls=10): Create a time feed :param index_feed: IndexFeed Pulse of this feed :param times: float_type, Tensor, [Nt,...
Implement the Python class `TimeFeed` described below. Class description: Implement the TimeFeed class. Method signatures and docstrings: - def __init__(self, index_feed: IndexFeed, times, num_parallel_calls=10): Create a time feed :param index_feed: IndexFeed Pulse of this feed :param times: float_type, Tensor, [Nt,...
2997d60d8cf07f875e42c0b5f07944e9ab7e9d33
<|skeleton|> class TimeFeed: def __init__(self, index_feed: IndexFeed, times, num_parallel_calls=10): """Create a time feed :param index_feed: IndexFeed Pulse of this feed :param times: float_type, Tensor, [Nt, 1] Times to slice :param num_parallel_calls:""" <|body_0|> def get_times_slice(self...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TimeFeed: def __init__(self, index_feed: IndexFeed, times, num_parallel_calls=10): """Create a time feed :param index_feed: IndexFeed Pulse of this feed :param times: float_type, Tensor, [Nt, 1] Times to slice :param num_parallel_calls:""" self.num_parallel_calls = tf.convert_to_tensor(num_par...
the_stack_v2_python_sparse
bayes_filter/feeds.py
Joshuaalbert/bayes_filter
train
0
0938ab1f0e3157cf9a2201e635bde5cd2e150b3c
[ "if pos >= neg:\n return True\nelse:\n return False", "if pos >= 1:\n return True\nelse:\n return False", "if neg == 0:\n return True\nelse:\n return False", "self.iterable = iterable\nself.funcs = funcs\nself.judge = judge", "for itr in self.iterable:\n pos = 0\n neg = 0\n for fu...
<|body_start_0|> if pos >= neg: return True else: return False <|end_body_0|> <|body_start_1|> if pos >= 1: return True else: return False <|end_body_1|> <|body_start_2|> if neg == 0: return True else: ...
Класс фильтрации элементов последовательности, удовлетворяющих условиям указанных функций. Содержит функции judge_half, judge_any, judge_all, __init__, __iter__.
MultiFilter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiFilter: """Класс фильтрации элементов последовательности, удовлетворяющих условиям указанных функций. Содержит функции judge_half, judge_any, judge_all, __init__, __iter__.""" def judge_half(pos, neg): """Функция допускает элемент, если его допускает хотя бы половина фукнций. Ар...
stack_v2_sparse_classes_36k_train_025682
6,096
no_license
[ { "docstring": "Функция допускает элемент, если его допускает хотя бы половина фукнций. Аргументы: pos - счетчик количества функций, которые допускают элемент neg - счетчик количества функций, которые не допускают элемент", "name": "judge_half", "signature": "def judge_half(pos, neg)" }, { "docs...
5
stack_v2_sparse_classes_30k_train_016585
Implement the Python class `MultiFilter` described below. Class description: Класс фильтрации элементов последовательности, удовлетворяющих условиям указанных функций. Содержит функции judge_half, judge_any, judge_all, __init__, __iter__. Method signatures and docstrings: - def judge_half(pos, neg): Функция допускает...
Implement the Python class `MultiFilter` described below. Class description: Класс фильтрации элементов последовательности, удовлетворяющих условиям указанных функций. Содержит функции judge_half, judge_any, judge_all, __init__, __iter__. Method signatures and docstrings: - def judge_half(pos, neg): Функция допускает...
721292862254019dad95a28e2a0a2765d711d4fb
<|skeleton|> class MultiFilter: """Класс фильтрации элементов последовательности, удовлетворяющих условиям указанных функций. Содержит функции judge_half, judge_any, judge_all, __init__, __iter__.""" def judge_half(pos, neg): """Функция допускает элемент, если его допускает хотя бы половина фукнций. Ар...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MultiFilter: """Класс фильтрации элементов последовательности, удовлетворяющих условиям указанных функций. Содержит функции judge_half, judge_any, judge_all, __init__, __iter__.""" def judge_half(pos, neg): """Функция допускает элемент, если его допускает хотя бы половина фукнций. Аргументы: pos ...
the_stack_v2_python_sparse
Lesson_14_Multifilter.py
MORVf/Lessons_python_part2
train
0
4d081d89afadb1a371d35ef2e19eefe7529b3f9a
[ "super().__init__(individual_generator)\nif k < 1:\n raise ValueError(f'Number of crossover points must be greater than 0. {k} was given')\nself.k = k", "child_chromosomes = self._cross_chromosomes(parent_1.chromosome, parent_2.chromosome)\nchild_1 = self.individual_generator.generate(child_chromosomes[0])\nch...
<|body_start_0|> super().__init__(individual_generator) if k < 1: raise ValueError(f'Number of crossover points must be greater than 0. {k} was given') self.k = k <|end_body_0|> <|body_start_1|> child_chromosomes = self._cross_chromosomes(parent_1.chromosome, parent_2.chromo...
k-point crossover class
PointCrossover
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PointCrossover: """k-point crossover class""" def __init__(self, individual_generator, k): """Initialize the crossover :param individual_generator: Generator that will be used to generate children :param k: Number of crossover points""" <|body_0|> def cross(self, parent_...
stack_v2_sparse_classes_36k_train_025683
2,148
no_license
[ { "docstring": "Initialize the crossover :param individual_generator: Generator that will be used to generate children :param k: Number of crossover points", "name": "__init__", "signature": "def __init__(self, individual_generator, k)" }, { "docstring": "Return 2 children made by k-point crosso...
3
stack_v2_sparse_classes_30k_train_004086
Implement the Python class `PointCrossover` described below. Class description: k-point crossover class Method signatures and docstrings: - def __init__(self, individual_generator, k): Initialize the crossover :param individual_generator: Generator that will be used to generate children :param k: Number of crossover ...
Implement the Python class `PointCrossover` described below. Class description: k-point crossover class Method signatures and docstrings: - def __init__(self, individual_generator, k): Initialize the crossover :param individual_generator: Generator that will be used to generate children :param k: Number of crossover ...
30d87754ed22aa5aab7103d912c414f5a6150a34
<|skeleton|> class PointCrossover: """k-point crossover class""" def __init__(self, individual_generator, k): """Initialize the crossover :param individual_generator: Generator that will be used to generate children :param k: Number of crossover points""" <|body_0|> def cross(self, parent_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PointCrossover: """k-point crossover class""" def __init__(self, individual_generator, k): """Initialize the crossover :param individual_generator: Generator that will be used to generate children :param k: Number of crossover points""" super().__init__(individual_generator) if k ...
the_stack_v2_python_sparse
crossovers/point_crossover.py
Yabk/SF-Evolution
train
0
57ad9353804ab6249758f22eb525d8391aac71f8
[ "self.ActivePixelSensorObj = ActivePixelSensor(netlist, simulator)\nself.netlist = self.ActivePixelSensorObj.netlist\nself.which_simulator = self.ActivePixelSensorObj.which_simulator\npass", "self.assertIsInstance(self.netlist, string)\nself.assertIsInstance(self.which_simulator, string)\npass" ]
<|body_start_0|> self.ActivePixelSensorObj = ActivePixelSensor(netlist, simulator) self.netlist = self.ActivePixelSensorObj.netlist self.which_simulator = self.ActivePixelSensorObj.which_simulator pass <|end_body_0|> <|body_start_1|> self.assertIsInstance(self.netlist, string) ...
TestActivePixelSensorTypes
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestActivePixelSensorTypes: def setUp(self): """Setup function TestTypes for class ActivePixelSensor""" <|body_0|> def test_types(self): """Function to test data types for class ActivePixelSensor""" <|body_1|> <|end_skeleton|> <|body_start_0|> self....
stack_v2_sparse_classes_36k_train_025684
930
no_license
[ { "docstring": "Setup function TestTypes for class ActivePixelSensor", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Function to test data types for class ActivePixelSensor", "name": "test_types", "signature": "def test_types(self)" } ]
2
null
Implement the Python class `TestActivePixelSensorTypes` described below. Class description: Implement the TestActivePixelSensorTypes class. Method signatures and docstrings: - def setUp(self): Setup function TestTypes for class ActivePixelSensor - def test_types(self): Function to test data types for class ActivePixe...
Implement the Python class `TestActivePixelSensorTypes` described below. Class description: Implement the TestActivePixelSensorTypes class. Method signatures and docstrings: - def setUp(self): Setup function TestTypes for class ActivePixelSensor - def test_types(self): Function to test data types for class ActivePixe...
825a0eab64be709efe161b9a48eb54c4bc5c1bef
<|skeleton|> class TestActivePixelSensorTypes: def setUp(self): """Setup function TestTypes for class ActivePixelSensor""" <|body_0|> def test_types(self): """Function to test data types for class ActivePixelSensor""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestActivePixelSensorTypes: def setUp(self): """Setup function TestTypes for class ActivePixelSensor""" self.ActivePixelSensorObj = ActivePixelSensor(netlist, simulator) self.netlist = self.ActivePixelSensorObj.netlist self.which_simulator = self.ActivePixelSensorObj.which_simu...
the_stack_v2_python_sparse
WFS_devel/WFS_class_devel/test_ActivePixelSensor.py
wenh81/vlc_simulator
train
0
4b2af1b09f9eab5edf36653f2fcdbf4d46479c60
[ "date_format = get_date_format(range_type)\nhealth = cls.objects.filter(user=user).order_by('related_date')\nif range_type in (ChartTimeRange.YEAR, ChartTimeRange.MONTH):\n date = datetime.strptime(date_str, date_format)\n health = health.filter(related_date__year=date.strftime('%Y'))\n if range_type == Ch...
<|body_start_0|> date_format = get_date_format(range_type) health = cls.objects.filter(user=user).order_by('related_date') if range_type in (ChartTimeRange.YEAR, ChartTimeRange.MONTH): date = datetime.strptime(date_str, date_format) health = health.filter(related_date__ye...
Health
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Health: def get_health_by_date(cls, user, range_type, date_str): """Get queryset of health datas by range :param user: user object :param range_type: dates range type - week, month or year :param date_str: date string :return: queryset of health datas :rtype: queryset""" <|body_0...
stack_v2_sparse_classes_36k_train_025685
5,178
no_license
[ { "docstring": "Get queryset of health datas by range :param user: user object :param range_type: dates range type - week, month or year :param date_str: date string :return: queryset of health datas :rtype: queryset", "name": "get_health_by_date", "signature": "def get_health_by_date(cls, user, range_t...
3
stack_v2_sparse_classes_30k_train_001147
Implement the Python class `Health` described below. Class description: Implement the Health class. Method signatures and docstrings: - def get_health_by_date(cls, user, range_type, date_str): Get queryset of health datas by range :param user: user object :param range_type: dates range type - week, month or year :par...
Implement the Python class `Health` described below. Class description: Implement the Health class. Method signatures and docstrings: - def get_health_by_date(cls, user, range_type, date_str): Get queryset of health datas by range :param user: user object :param range_type: dates range type - week, month or year :par...
3e2cf3b28ebcb6f87aa8db4073813eed7b7e3b8b
<|skeleton|> class Health: def get_health_by_date(cls, user, range_type, date_str): """Get queryset of health datas by range :param user: user object :param range_type: dates range type - week, month or year :param date_str: date string :return: queryset of health datas :rtype: queryset""" <|body_0...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Health: def get_health_by_date(cls, user, range_type, date_str): """Get queryset of health datas by range :param user: user object :param range_type: dates range type - week, month or year :param date_str: date string :return: queryset of health datas :rtype: queryset""" date_format = get_date...
the_stack_v2_python_sparse
app/health/models.py
v0y/sport-tracker-with-acziwments
train
1
2ec8bf069ad3cb19ae038c139c25629bbc1c95d3
[ "self.count = 0\nself.helper(root, 0, sum)\nreturn self.count", "if not node:\n return\nif partial + node.val == target:\n self.count += 1\nself.helper(node.left, partial + node.val, target)\nself.helper(node.right, partial + node.val, target)\nself.helper(node.left, 0, target)\nself.helper(node.right, 0, t...
<|body_start_0|> self.count = 0 self.helper(root, 0, sum) return self.count <|end_body_0|> <|body_start_1|> if not node: return if partial + node.val == target: self.count += 1 self.helper(node.left, partial + node.val, target) self.helper...
Solution2
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution2: def pathSum(self, root, sum): """:type root: TreeNode :type sum: int :rtype: int""" <|body_0|> def helper(self, node, partial, target): """recursively iterate all nodes and check if previous sum plus current node can achieve the target. If so, increase the...
stack_v2_sparse_classes_36k_train_025686
3,257
no_license
[ { "docstring": ":type root: TreeNode :type sum: int :rtype: int", "name": "pathSum", "signature": "def pathSum(self, root, sum)" }, { "docstring": "recursively iterate all nodes and check if previous sum plus current node can achieve the target. If so, increase the count. Then we need to recursi...
2
null
Implement the Python class `Solution2` described below. Class description: Implement the Solution2 class. Method signatures and docstrings: - def pathSum(self, root, sum): :type root: TreeNode :type sum: int :rtype: int - def helper(self, node, partial, target): recursively iterate all nodes and check if previous sum...
Implement the Python class `Solution2` described below. Class description: Implement the Solution2 class. Method signatures and docstrings: - def pathSum(self, root, sum): :type root: TreeNode :type sum: int :rtype: int - def helper(self, node, partial, target): recursively iterate all nodes and check if previous sum...
635af6e22aa8eef8e7920a585d43a45a891a8157
<|skeleton|> class Solution2: def pathSum(self, root, sum): """:type root: TreeNode :type sum: int :rtype: int""" <|body_0|> def helper(self, node, partial, target): """recursively iterate all nodes and check if previous sum plus current node can achieve the target. If so, increase the...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution2: def pathSum(self, root, sum): """:type root: TreeNode :type sum: int :rtype: int""" self.count = 0 self.helper(root, 0, sum) return self.count def helper(self, node, partial, target): """recursively iterate all nodes and check if previous sum plus curren...
the_stack_v2_python_sparse
code437PathSumIII.py
cybelewang/leetcode-python
train
0
61986e13f0c5d64a20c28c8de5c6fadd24e62153
[ "recommend_type = kwargs.get('type')\nplaceholder = '{}_placeholder'.format(recommend_type)\nlimit = kwargs.get('limit')\nnow = local_now().strftime('%Y%m%d%H%M%S')\nwords = RecommendWord.objects.filter(is_display=True)\nplaceholder = words.filter(recommend_type=placeholder, start_date__lt=now, end_date__gt=now).va...
<|body_start_0|> recommend_type = kwargs.get('type') placeholder = '{}_placeholder'.format(recommend_type) limit = kwargs.get('limit') now = local_now().strftime('%Y%m%d%H%M%S') words = RecommendWord.objects.filter(is_display=True) placeholder = words.filter(recommend_typ...
RecommendService
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RecommendService: def get_recommend_words(self, **kwargs): """추천 검색어""" <|body_0|> def get_recommend_words_by_dynamodb(self, **kwargs): """추천 검색어 ( dynamoDB )""" <|body_1|> def get_recommend_products(self): """이달의 추천 신제품 목록""" <|body_2|> ...
stack_v2_sparse_classes_36k_train_025687
2,711
no_license
[ { "docstring": "추천 검색어", "name": "get_recommend_words", "signature": "def get_recommend_words(self, **kwargs)" }, { "docstring": "추천 검색어 ( dynamoDB )", "name": "get_recommend_words_by_dynamodb", "signature": "def get_recommend_words_by_dynamodb(self, **kwargs)" }, { "docstring": ...
3
null
Implement the Python class `RecommendService` described below. Class description: Implement the RecommendService class. Method signatures and docstrings: - def get_recommend_words(self, **kwargs): 추천 검색어 - def get_recommend_words_by_dynamodb(self, **kwargs): 추천 검색어 ( dynamoDB ) - def get_recommend_products(self): 이달의...
Implement the Python class `RecommendService` described below. Class description: Implement the RecommendService class. Method signatures and docstrings: - def get_recommend_words(self, **kwargs): 추천 검색어 - def get_recommend_words_by_dynamodb(self, **kwargs): 추천 검색어 ( dynamoDB ) - def get_recommend_products(self): 이달의...
0edc046f57a1c171c10be5dfa4b4e26f440847be
<|skeleton|> class RecommendService: def get_recommend_words(self, **kwargs): """추천 검색어""" <|body_0|> def get_recommend_words_by_dynamodb(self, **kwargs): """추천 검색어 ( dynamoDB )""" <|body_1|> def get_recommend_products(self): """이달의 추천 신제품 목록""" <|body_2|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RecommendService: def get_recommend_words(self, **kwargs): """추천 검색어""" recommend_type = kwargs.get('type') placeholder = '{}_placeholder'.format(recommend_type) limit = kwargs.get('limit') now = local_now().strftime('%Y%m%d%H%M%S') words = RecommendWord.objects...
the_stack_v2_python_sparse
services/recommends.py
jmp7786/coins
train
0
7ac1f61cc5da06e0a138292f693c05e36b60b3bc
[ "if p.val > q.val:\n p, q = (q, p)\nwhile root:\n if root.val < p.val:\n root = root.right\n elif root.val > q.val:\n root = root.left\n else:\n break\nreturn root", "if root.val < p.val and root.val < q.val:\n return self.lowestCommonAncestor_2(root.right, p, q)\nif root.val >...
<|body_start_0|> if p.val > q.val: p, q = (q, p) while root: if root.val < p.val: root = root.right elif root.val > q.val: root = root.left else: break return root <|end_body_0|> <|body_start_1|> ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def lowestCommonAncestor_1(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode': """时间复杂度 O(N): 其中 N 为二叉树节点数;每循环一轮排除一层,二叉搜索树的层数最小为 logN (满二叉树), 最大为 N (退化为链表)。 空间复杂度 O(1): 使用常数大小的额外空间。 :param root: :param p: :param q: :return:""" <|body_0|> def lowest...
stack_v2_sparse_classes_36k_train_025688
2,864
no_license
[ { "docstring": "时间复杂度 O(N): 其中 N 为二叉树节点数;每循环一轮排除一层,二叉搜索树的层数最小为 logN (满二叉树), 最大为 N (退化为链表)。 空间复杂度 O(1): 使用常数大小的额外空间。 :param root: :param p: :param q: :return:", "name": "lowestCommonAncestor_1", "signature": "def lowestCommonAncestor_1(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode'" ...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lowestCommonAncestor_1(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode': 时间复杂度 O(N): 其中 N 为二叉树节点数;每循环一轮排除一层,二叉搜索树的层数最小为 logN (满二叉树), 最大为 N (退化为链表)。 空间复杂度 O...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lowestCommonAncestor_1(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode': 时间复杂度 O(N): 其中 N 为二叉树节点数;每循环一轮排除一层,二叉搜索树的层数最小为 logN (满二叉树), 最大为 N (退化为链表)。 空间复杂度 O...
62419b49000e79962bcdc99cd98afd2fb82ea345
<|skeleton|> class Solution: def lowestCommonAncestor_1(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode': """时间复杂度 O(N): 其中 N 为二叉树节点数;每循环一轮排除一层,二叉搜索树的层数最小为 logN (满二叉树), 最大为 N (退化为链表)。 空间复杂度 O(1): 使用常数大小的额外空间。 :param root: :param p: :param q: :return:""" <|body_0|> def lowest...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def lowestCommonAncestor_1(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode': """时间复杂度 O(N): 其中 N 为二叉树节点数;每循环一轮排除一层,二叉搜索树的层数最小为 logN (满二叉树), 最大为 N (退化为链表)。 空间复杂度 O(1): 使用常数大小的额外空间。 :param root: :param p: :param q: :return:""" if p.val > q.val: p, q = (q,...
the_stack_v2_python_sparse
剑指 Offer(第 2 版)/lowestCommonAncestor_I.py
MaoningGuan/LeetCode
train
3
6b313cea77fe58bdf916cabd52fde3fd25a585e0
[ "new_instance = self.create(header=header, definition=definition)\nvalue, _ = DataElementValue.objects.from_dicom_parser(data_element)\nnew_instance._values.set(value)\nreturn new_instance", "definition, _ = DataElementDefinition.objects.from_dicom_parser(data_element)\ntry:\n return self.get(header=header, de...
<|body_start_0|> new_instance = self.create(header=header, definition=definition) value, _ = DataElementValue.objects.from_dicom_parser(data_element) new_instance._values.set(value) return new_instance <|end_body_0|> <|body_start_1|> definition, _ = DataElementDefinition.objects...
Custom :class:`~django.db.models.Manager` for the :class:`~django_dicom.models.data_element.DataElement` model.
DataElementManager
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataElementManager: """Custom :class:`~django.db.models.Manager` for the :class:`~django_dicom.models.data_element.DataElement` model.""" def create_from_dicom_parser(self, header, definition, data_element: DicomDataElement): """Creates a new instance under *header* using the provide...
stack_v2_sparse_classes_36k_train_025689
3,104
permissive
[ { "docstring": "Creates a new instance under *header* using the provided *definition* and *data_element*. Parameters ---------- header : :class:`~django_dicom.models.header.Header` The header instance with which the created data element should be associated. definition : :class:`~django_dicom.models.data_elemen...
2
null
Implement the Python class `DataElementManager` described below. Class description: Custom :class:`~django.db.models.Manager` for the :class:`~django_dicom.models.data_element.DataElement` model. Method signatures and docstrings: - def create_from_dicom_parser(self, header, definition, data_element: DicomDataElement)...
Implement the Python class `DataElementManager` described below. Class description: Custom :class:`~django.db.models.Manager` for the :class:`~django_dicom.models.data_element.DataElement` model. Method signatures and docstrings: - def create_from_dicom_parser(self, header, definition, data_element: DicomDataElement)...
cd49a08b1f0efbbb8e05b20ec03d0afc3789cf6f
<|skeleton|> class DataElementManager: """Custom :class:`~django.db.models.Manager` for the :class:`~django_dicom.models.data_element.DataElement` model.""" def create_from_dicom_parser(self, header, definition, data_element: DicomDataElement): """Creates a new instance under *header* using the provide...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DataElementManager: """Custom :class:`~django.db.models.Manager` for the :class:`~django_dicom.models.data_element.DataElement` model.""" def create_from_dicom_parser(self, header, definition, data_element: DicomDataElement): """Creates a new instance under *header* using the provided *definition...
the_stack_v2_python_sparse
django_dicom/models/managers/data_element.py
ZviBaratz/django_dicom
train
8
bdf1d1dd1115bdf04fd513be501d8103764d2717
[ "if destination.is_dirty():\n raise OSError(f'Repo `{destination.working_tree_dir}` is dirty')\nself.source = source\nself.destination = destination\nself.commits_in_order = GetCommitsInOrder(source, head_ref=head_ref)\nself.files_of_interest = files_of_interest\nif not self.commits_in_order:\n raise OSError(...
<|body_start_0|> if destination.is_dirty(): raise OSError(f'Repo `{destination.working_tree_dir}` is dirty') self.source = source self.destination = destination self.commits_in_order = GetCommitsInOrder(source, head_ref=head_ref) self.files_of_interest = files_of_inte...
A progressable thread for exporting a subset of a repo's commits.
SubtreeExporter
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SubtreeExporter: """A progressable thread for exporting a subset of a repo's commits.""" def __init__(self, source: git.Repo, destination: git.Repo, files_of_interest: Set[str], head_ref: str='HEAD'): """Constructor. Args: source: The source repository to export from. destination: Th...
stack_v2_sparse_classes_36k_train_025690
6,824
permissive
[ { "docstring": "Constructor. Args: source: The source repository to export from. destination: The destination repository to export to. files_of_interest: The relpaths of the files to export. head_ref: The commit to export up to.", "name": "__init__", "signature": "def __init__(self, source: git.Repo, de...
2
stack_v2_sparse_classes_30k_train_005282
Implement the Python class `SubtreeExporter` described below. Class description: A progressable thread for exporting a subset of a repo's commits. Method signatures and docstrings: - def __init__(self, source: git.Repo, destination: git.Repo, files_of_interest: Set[str], head_ref: str='HEAD'): Constructor. Args: sour...
Implement the Python class `SubtreeExporter` described below. Class description: A progressable thread for exporting a subset of a repo's commits. Method signatures and docstrings: - def __init__(self, source: git.Repo, destination: git.Repo, files_of_interest: Set[str], head_ref: str='HEAD'): Constructor. Args: sour...
913d67f4f454cedc61220a210113bbf0460bb4d5
<|skeleton|> class SubtreeExporter: """A progressable thread for exporting a subset of a repo's commits.""" def __init__(self, source: git.Repo, destination: git.Repo, files_of_interest: Set[str], head_ref: str='HEAD'): """Constructor. Args: source: The source repository to export from. destination: Th...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SubtreeExporter: """A progressable thread for exporting a subset of a repo's commits.""" def __init__(self, source: git.Repo, destination: git.Repo, files_of_interest: Set[str], head_ref: str='HEAD'): """Constructor. Args: source: The source repository to export from. destination: The destination...
the_stack_v2_python_sparse
tools/git/export_subtree.py
ChrisCummins/labm8
train
3
3341f212189aefb222f15433ae144571fa6b52c7
[ "if not root:\n return None\nhead, tail = self.get_linked_list(root)\nhead.left = tail\ntail.right = head\nreturn head", "if not node.left and (not node.right):\n return (node, node)\nlhead, ltail = self.get_linked_list(node.left) if node.left else (node, None)\nrhead, rtail = self.get_linked_list(node.righ...
<|body_start_0|> if not root: return None head, tail = self.get_linked_list(root) head.left = tail tail.right = head return head <|end_body_0|> <|body_start_1|> if not node.left and (not node.right): return (node, node) lhead, ltail = self...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def treeToDoublyList(self, root): """:type root: Node :rtype: Node""" <|body_0|> def get_linked_list(self, node): """Helper function to turn subtree starting at node into linked list. Returns (head, tail) of the linked list.""" <|body_1|> <|end_ske...
stack_v2_sparse_classes_36k_train_025691
2,611
no_license
[ { "docstring": ":type root: Node :rtype: Node", "name": "treeToDoublyList", "signature": "def treeToDoublyList(self, root)" }, { "docstring": "Helper function to turn subtree starting at node into linked list. Returns (head, tail) of the linked list.", "name": "get_linked_list", "signatu...
2
stack_v2_sparse_classes_30k_train_021385
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def treeToDoublyList(self, root): :type root: Node :rtype: Node - def get_linked_list(self, node): Helper function to turn subtree starting at node into linked list. Returns (hea...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def treeToDoublyList(self, root): :type root: Node :rtype: Node - def get_linked_list(self, node): Helper function to turn subtree starting at node into linked list. Returns (hea...
eb3fc22450b362703c3322d9e975d191eb324ffc
<|skeleton|> class Solution: def treeToDoublyList(self, root): """:type root: Node :rtype: Node""" <|body_0|> def get_linked_list(self, node): """Helper function to turn subtree starting at node into linked list. Returns (head, tail) of the linked list.""" <|body_1|> <|end_ske...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def treeToDoublyList(self, root): """:type root: Node :rtype: Node""" if not root: return None head, tail = self.get_linked_list(root) head.left = tail tail.right = head return head def get_linked_list(self, node): """Helper fu...
the_stack_v2_python_sparse
2-14/426-Convert-Binary-Search-Tree-to-Sorted-DLL.py
whalejasmine/leetcode_python_summary
train
0
1c64ed9b5b9863a52944e5abddea62a9e264b8ce
[ "self.negword = 'moins '\nself.pointword = 'virgule'\nself.exclude_title = ['et', 'virgule', 'moins']\nself.mid_numwords = [(1000, 'mille'), (100, 'cent'), (80, 'quatre-vingts'), (60, 'soixante'), (50, 'cinquante'), (40, 'quarante'), (30, 'trente')]\nself.low_numwords = ['vingt', 'dix-neuf', 'dix-huit', 'dix-sept',...
<|body_start_0|> self.negword = 'moins ' self.pointword = 'virgule' self.exclude_title = ['et', 'virgule', 'moins'] self.mid_numwords = [(1000, 'mille'), (100, 'cent'), (80, 'quatre-vingts'), (60, 'soixante'), (50, 'cinquante'), (40, 'quarante'), (30, 'trente')] self.low_numwords...
NumWord FR
NumWordFR
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumWordFR: """NumWord FR""" def _setup(self): """Setup""" <|body_0|> def _merge(self, curr, next): """Merge""" <|body_1|> def ordinal(self, value): """Convert to ordinal""" <|body_2|> def ordinal_number(self, value): """C...
stack_v2_sparse_classes_36k_train_025692
3,430
permissive
[ { "docstring": "Setup", "name": "_setup", "signature": "def _setup(self)" }, { "docstring": "Merge", "name": "_merge", "signature": "def _merge(self, curr, next)" }, { "docstring": "Convert to ordinal", "name": "ordinal", "signature": "def ordinal(self, value)" }, { ...
5
stack_v2_sparse_classes_30k_train_006757
Implement the Python class `NumWordFR` described below. Class description: NumWord FR Method signatures and docstrings: - def _setup(self): Setup - def _merge(self, curr, next): Merge - def ordinal(self, value): Convert to ordinal - def ordinal_number(self, value): Convert to ordinal number - def currency(self, val, ...
Implement the Python class `NumWordFR` described below. Class description: NumWord FR Method signatures and docstrings: - def _setup(self): Setup - def _merge(self, curr, next): Merge - def ordinal(self, value): Convert to ordinal - def ordinal_number(self, value): Convert to ordinal number - def currency(self, val, ...
bdf0d633663d289a6cb9ed10c1529afb086d410f
<|skeleton|> class NumWordFR: """NumWord FR""" def _setup(self): """Setup""" <|body_0|> def _merge(self, curr, next): """Merge""" <|body_1|> def ordinal(self, value): """Convert to ordinal""" <|body_2|> def ordinal_number(self, value): """C...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NumWordFR: """NumWord FR""" def _setup(self): """Setup""" self.negword = 'moins ' self.pointword = 'virgule' self.exclude_title = ['et', 'virgule', 'moins'] self.mid_numwords = [(1000, 'mille'), (100, 'cent'), (80, 'quatre-vingts'), (60, 'soixante'), (50, 'cinquant...
the_stack_v2_python_sparse
venv/lib/python3.7/site-packages/numword/numword_fr.py
Spam-Slayers/Newsify
train
0
e19a4c76ea0dd20b861f67b3f9a3cafe5dbe0d4e
[ "start = end = 0\nans = 0\nwhile start < len(A):\n end = start\n while end + 1 < len(A) and A[end] < A[end + 1]:\n end += 1\n if end + 1 < len(A) and A[end] > A[end + 1]:\n while end + 1 < N and A[end] > A[end + 1]:\n end += 1\n ans = max(ans, end - start + 1)\n start = m...
<|body_start_0|> start = end = 0 ans = 0 while start < len(A): end = start while end + 1 < len(A) and A[end] < A[end + 1]: end += 1 if end + 1 < len(A) and A[end] > A[end + 1]: while end + 1 < N and A[end] > A[end + 1]: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestMountain(self, A): """:type A: List[int] :rtype: int""" <|body_0|> def longestMountain_two_pass(self, A): """:type A: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> start = end = 0 ans = 0 ...
stack_v2_sparse_classes_36k_train_025693
1,838
no_license
[ { "docstring": ":type A: List[int] :rtype: int", "name": "longestMountain", "signature": "def longestMountain(self, A)" }, { "docstring": ":type A: List[int] :rtype: int", "name": "longestMountain_two_pass", "signature": "def longestMountain_two_pass(self, A)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestMountain(self, A): :type A: List[int] :rtype: int - def longestMountain_two_pass(self, A): :type A: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestMountain(self, A): :type A: List[int] :rtype: int - def longestMountain_two_pass(self, A): :type A: List[int] :rtype: int <|skeleton|> class Solution: def longes...
0e99f9a5226507706b3ee66fd04bae813755ef40
<|skeleton|> class Solution: def longestMountain(self, A): """:type A: List[int] :rtype: int""" <|body_0|> def longestMountain_two_pass(self, A): """:type A: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def longestMountain(self, A): """:type A: List[int] :rtype: int""" start = end = 0 ans = 0 while start < len(A): end = start while end + 1 < len(A) and A[end] < A[end + 1]: end += 1 if end + 1 < len(A) and A[end] > A...
the_stack_v2_python_sparse
medium/twopointer/test_845_Longest_Mountain_in_Array.py
wuxu1019/leetcode_sophia
train
1
483be93f8565deca77f31e4507bc0f156594ca94
[ "Parametre.__init__(self, 'email', 'email')\nself.tronquer = True\nself.schema = '<etat>'\nself.aide_courte = \"active / désactive l'envoi d'e-mails\"\nself.aide_longue = \"Cette commande permet d'activer ou désactiver l'envoi d'e-mails à ce compte en cas de réception d'un UmdMail. Si cette option est active, un e-...
<|body_start_0|> Parametre.__init__(self, 'email', 'email') self.tronquer = True self.schema = '<etat>' self.aide_courte = "active / désactive l'envoi d'e-mails" self.aide_longue = "Cette commande permet d'activer ou désactiver l'envoi d'e-mails à ce compte en cas de réception d'...
Commande 'options email'.
PrmEmail
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PrmEmail: """Commande 'options email'.""" def __init__(self): """Constructeur du paramètre.""" <|body_0|> def interpreter(self, personnage, dic_masques): """Interprétation du paramètre.""" <|body_1|> <|end_skeleton|> <|body_start_0|> Parametre._...
stack_v2_sparse_classes_36k_train_025694
3,177
permissive
[ { "docstring": "Constructeur du paramètre.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Interprétation du paramètre.", "name": "interpreter", "signature": "def interpreter(self, personnage, dic_masques)" } ]
2
stack_v2_sparse_classes_30k_train_004221
Implement the Python class `PrmEmail` described below. Class description: Commande 'options email'. Method signatures and docstrings: - def __init__(self): Constructeur du paramètre. - def interpreter(self, personnage, dic_masques): Interprétation du paramètre.
Implement the Python class `PrmEmail` described below. Class description: Commande 'options email'. Method signatures and docstrings: - def __init__(self): Constructeur du paramètre. - def interpreter(self, personnage, dic_masques): Interprétation du paramètre. <|skeleton|> class PrmEmail: """Commande 'options e...
7e93bff08cdf891352efba587e89c40f3b4a2301
<|skeleton|> class PrmEmail: """Commande 'options email'.""" def __init__(self): """Constructeur du paramètre.""" <|body_0|> def interpreter(self, personnage, dic_masques): """Interprétation du paramètre.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PrmEmail: """Commande 'options email'.""" def __init__(self): """Constructeur du paramètre.""" Parametre.__init__(self, 'email', 'email') self.tronquer = True self.schema = '<etat>' self.aide_courte = "active / désactive l'envoi d'e-mails" self.aide_longue ...
the_stack_v2_python_sparse
src/primaires/joueur/commandes/options/email.py
vincent-lg/tsunami
train
5
60e3f8764853e5156982855ae193d1cdba1ed48f
[ "super(Instance, self).__init__(resource_id=instance_id, resource_type=resource.ResourceType.INSTANCE, name=kwargs.get('name'), display_name=kwargs.get('name'), parent=parent, locations=kwargs.get('locations'))\nif parent and parent.type != 'project':\n raise TypeError('Unexpected parent type: got {}, want proje...
<|body_start_0|> super(Instance, self).__init__(resource_id=instance_id, resource_type=resource.ResourceType.INSTANCE, name=kwargs.get('name'), display_name=kwargs.get('name'), parent=parent, locations=kwargs.get('locations')) if parent and parent.type != 'project': raise TypeError('Unexpect...
Represents Instance resource.
Instance
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Instance: """Represents Instance resource.""" def __init__(self, instance_id, parent=None, **kwargs): """Instance resource. Args: instance_id (str): id of the instance. parent (Resource): Parent resource of this instance. Should be a project. **kwargs (dict): The object's attributes....
stack_v2_sparse_classes_36k_train_025695
10,814
permissive
[ { "docstring": "Instance resource. Args: instance_id (str): id of the instance. parent (Resource): Parent resource of this instance. Should be a project. **kwargs (dict): The object's attributes. Raises: TypeError: If unexpected parent type.", "name": "__init__", "signature": "def __init__(self, instanc...
6
stack_v2_sparse_classes_30k_train_001282
Implement the Python class `Instance` described below. Class description: Represents Instance resource. Method signatures and docstrings: - def __init__(self, instance_id, parent=None, **kwargs): Instance resource. Args: instance_id (str): id of the instance. parent (Resource): Parent resource of this instance. Shoul...
Implement the Python class `Instance` described below. Class description: Represents Instance resource. Method signatures and docstrings: - def __init__(self, instance_id, parent=None, **kwargs): Instance resource. Args: instance_id (str): id of the instance. parent (Resource): Parent resource of this instance. Shoul...
d4421afa50a17ed47cbebe942044ebab3720e0f5
<|skeleton|> class Instance: """Represents Instance resource.""" def __init__(self, instance_id, parent=None, **kwargs): """Instance resource. Args: instance_id (str): id of the instance. parent (Resource): Parent resource of this instance. Should be a project. **kwargs (dict): The object's attributes....
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Instance: """Represents Instance resource.""" def __init__(self, instance_id, parent=None, **kwargs): """Instance resource. Args: instance_id (str): id of the instance. parent (Resource): Parent resource of this instance. Should be a project. **kwargs (dict): The object's attributes. Raises: Type...
the_stack_v2_python_sparse
google/cloud/forseti/common/gcp_type/instance.py
kevensen/forseti-security
train
1
7bc1783af65e3191d92d49d03a6a53ff5acd504c
[ "super().__init__()\nself.pre_ln_attn = nn.LayerNorm(n_hidden)\nself.pre_ln_ffn = nn.LayerNorm(n_hidden)\nself.attention = AttentionLayer(n_hidden, n_heads)\nself.ffn = FFNLayer(n_hidden)", "residual = x\nattn = self.attention(self.pre_ln_attn(x))\nffn = self.ffn(self.pre_ln_ffn(x))\nreturn attn + ffn + residual"...
<|body_start_0|> super().__init__() self.pre_ln_attn = nn.LayerNorm(n_hidden) self.pre_ln_ffn = nn.LayerNorm(n_hidden) self.attention = AttentionLayer(n_hidden, n_heads) self.ffn = FFNLayer(n_hidden) <|end_body_0|> <|body_start_1|> residual = x attn = self.attent...
## Transformer Layer
TransformerLayer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TransformerLayer: """## Transformer Layer""" def __init__(self, n_hidden: int=6144, n_heads: int=64): """:param n_hidden: is the embedding size :param n_heads: is the number of heads *Out implementation doesn't include dropout*.""" <|body_0|> def forward(self, x: torch.T...
stack_v2_sparse_classes_36k_train_025696
13,522
no_license
[ { "docstring": ":param n_hidden: is the embedding size :param n_heads: is the number of heads *Out implementation doesn't include dropout*.", "name": "__init__", "signature": "def __init__(self, n_hidden: int=6144, n_heads: int=64)" }, { "docstring": ":param x: are the embeddings of shape `[batc...
3
stack_v2_sparse_classes_30k_train_004031
Implement the Python class `TransformerLayer` described below. Class description: ## Transformer Layer Method signatures and docstrings: - def __init__(self, n_hidden: int=6144, n_heads: int=64): :param n_hidden: is the embedding size :param n_heads: is the number of heads *Out implementation doesn't include dropout*...
Implement the Python class `TransformerLayer` described below. Class description: ## Transformer Layer Method signatures and docstrings: - def __init__(self, n_hidden: int=6144, n_heads: int=64): :param n_hidden: is the embedding size :param n_heads: is the number of heads *Out implementation doesn't include dropout*...
7e55a422588c1d1e00f35a3d3a3ff896cce59e18
<|skeleton|> class TransformerLayer: """## Transformer Layer""" def __init__(self, n_hidden: int=6144, n_heads: int=64): """:param n_hidden: is the embedding size :param n_heads: is the number of heads *Out implementation doesn't include dropout*.""" <|body_0|> def forward(self, x: torch.T...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TransformerLayer: """## Transformer Layer""" def __init__(self, n_hidden: int=6144, n_heads: int=64): """:param n_hidden: is the embedding size :param n_heads: is the number of heads *Out implementation doesn't include dropout*.""" super().__init__() self.pre_ln_attn = nn.LayerNor...
the_stack_v2_python_sparse
generated/test_labmlai_neox.py
jansel/pytorch-jit-paritybench
train
35
904a70e65d34af2744309ad0fb649a5f7c54ce73
[ "if not root:\n return None\nrootNode = TreeNode(root.val)\nif len(root.children) > 0:\n firstChild = root.children[0]\n rootNode.left = self.encode(firstChild)\ncurr = rootNode.left\nfor i in range(1, len(root.children)):\n curr.right = self.encode(root.children[i])\n curr = curr.right\nreturn rootN...
<|body_start_0|> if not root: return None rootNode = TreeNode(root.val) if len(root.children) > 0: firstChild = root.children[0] rootNode.left = self.encode(firstChild) curr = rootNode.left for i in range(1, len(root.children)): cur...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def encode(self, root): """Encodes an n-ary tree to a binary tree. :type root: Node :rtype: TreeNode""" <|body_0|> def decode(self, data): """Decodes your binary tree to an n-ary tree. :type data: TreeNode :rtype: Node""" <|body_1|> <|end_skeleton|> ...
stack_v2_sparse_classes_36k_train_025697
3,222
no_license
[ { "docstring": "Encodes an n-ary tree to a binary tree. :type root: Node :rtype: TreeNode", "name": "encode", "signature": "def encode(self, root)" }, { "docstring": "Decodes your binary tree to an n-ary tree. :type data: TreeNode :rtype: Node", "name": "decode", "signature": "def decode...
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def encode(self, root): Encodes an n-ary tree to a binary tree. :type root: Node :rtype: TreeNode - def decode(self, data): Decodes your binary tree to an n-ary tree. :type data: TreeN...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def encode(self, root): Encodes an n-ary tree to a binary tree. :type root: Node :rtype: TreeNode - def decode(self, data): Decodes your binary tree to an n-ary tree. :type data: TreeN...
44765a7d89423b7ec2c159f70b1a6f6e446523c2
<|skeleton|> class Codec: def encode(self, root): """Encodes an n-ary tree to a binary tree. :type root: Node :rtype: TreeNode""" <|body_0|> def decode(self, data): """Decodes your binary tree to an n-ary tree. :type data: TreeNode :rtype: Node""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def encode(self, root): """Encodes an n-ary tree to a binary tree. :type root: Node :rtype: TreeNode""" if not root: return None rootNode = TreeNode(root.val) if len(root.children) > 0: firstChild = root.children[0] rootNode.left = sel...
the_stack_v2_python_sparse
python/_0001_0500/0431_encode-n-ary-tree-to-binary-tree.py
Wang-Yann/LeetCodeMe
train
0
0996e31f12ab51a6a7af4eaf175549f278da21b8
[ "result = do(self, platform)\nlogging.info('GET charge result: %s' % result)\nself.write(result)", "result = do(self, platform)\nlogging.info('POST charge result: %s' % result)\nself.write(result)" ]
<|body_start_0|> result = do(self, platform) logging.info('GET charge result: %s' % result) self.write(result) <|end_body_0|> <|body_start_1|> result = do(self, platform) logging.info('POST charge result: %s' % result) self.write(result) <|end_body_1|>
Notification
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Notification: def get(self, platform): """1.易接SDK支付: alliance.xtzj.luckyfuturetech.com/notification/EZ?app=1234567890ABCDEF&cbi=CBI123456&ct=1376578903&fee=100&pt=1376577801&ssid=123456&st=1&tcd=137657AVDEDFS&uid=1234&ver=1&sign=xxxxxxxxxxx""" <|body_0|> def post(self, platf...
stack_v2_sparse_classes_36k_train_025698
1,263
no_license
[ { "docstring": "1.易接SDK支付: alliance.xtzj.luckyfuturetech.com/notification/EZ?app=1234567890ABCDEF&cbi=CBI123456&ct=1376578903&fee=100&pt=1376577801&ssid=123456&st=1&tcd=137657AVDEDFS&uid=1234&ver=1&sign=xxxxxxxxxxx", "name": "get", "signature": "def get(self, platform)" }, { "docstring": "1.XY S...
2
stack_v2_sparse_classes_30k_train_014654
Implement the Python class `Notification` described below. Class description: Implement the Notification class. Method signatures and docstrings: - def get(self, platform): 1.易接SDK支付: alliance.xtzj.luckyfuturetech.com/notification/EZ?app=1234567890ABCDEF&cbi=CBI123456&ct=1376578903&fee=100&pt=1376577801&ssid=123456&s...
Implement the Python class `Notification` described below. Class description: Implement the Notification class. Method signatures and docstrings: - def get(self, platform): 1.易接SDK支付: alliance.xtzj.luckyfuturetech.com/notification/EZ?app=1234567890ABCDEF&cbi=CBI123456&ct=1376578903&fee=100&pt=1376577801&ssid=123456&s...
4f430d5631b1118ad251bdaf8384bc0dbdaf07b9
<|skeleton|> class Notification: def get(self, platform): """1.易接SDK支付: alliance.xtzj.luckyfuturetech.com/notification/EZ?app=1234567890ABCDEF&cbi=CBI123456&ct=1376578903&fee=100&pt=1376577801&ssid=123456&st=1&tcd=137657AVDEDFS&uid=1234&ver=1&sign=xxxxxxxxxxx""" <|body_0|> def post(self, platf...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Notification: def get(self, platform): """1.易接SDK支付: alliance.xtzj.luckyfuturetech.com/notification/EZ?app=1234567890ABCDEF&cbi=CBI123456&ct=1376578903&fee=100&pt=1376577801&ssid=123456&st=1&tcd=137657AVDEDFS&uid=1234&ver=1&sign=xxxxxxxxxxx""" result = do(self, platform) logging.info('...
the_stack_v2_python_sparse
server/apps/handlers/charge.py
wade333777/cocos-js-tips
train
0
f6defbd42a86546d088088fc7ebc7498d386340b
[ "results = []\nall_meals = Meal.list_all_meals()\ntry:\n menu = Menu.find_by_id(menu_id)\n if not menu:\n raise MealError.NotFound('Menu does not exist yet! Create one?')\n if all_meals:\n for meal in all_meals:\n obj = Response.define_meal(meal)\n results.append(obj)\n ...
<|body_start_0|> results = [] all_meals = Meal.list_all_meals() try: menu = Menu.find_by_id(menu_id) if not menu: raise MealError.NotFound('Menu does not exist yet! Create one?') if all_meals: for meal in all_meals: ...
Contains GET and POST methods
MealsView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MealsView: """Contains GET and POST methods""" def get(self, menu_id): """Endpoint for fetching all meals.""" <|body_0|> def post(self, menu_id, user_id): """Endpoint for adding a new meal.""" <|body_1|> def delete(self, menu_id, user_id): ""...
stack_v2_sparse_classes_36k_train_025699
6,144
no_license
[ { "docstring": "Endpoint for fetching all meals.", "name": "get", "signature": "def get(self, menu_id)" }, { "docstring": "Endpoint for adding a new meal.", "name": "post", "signature": "def post(self, menu_id, user_id)" }, { "docstring": "Endpoint for deleting all meals.", "...
3
stack_v2_sparse_classes_30k_train_018177
Implement the Python class `MealsView` described below. Class description: Contains GET and POST methods Method signatures and docstrings: - def get(self, menu_id): Endpoint for fetching all meals. - def post(self, menu_id, user_id): Endpoint for adding a new meal. - def delete(self, menu_id, user_id): Endpoint for d...
Implement the Python class `MealsView` described below. Class description: Contains GET and POST methods Method signatures and docstrings: - def get(self, menu_id): Endpoint for fetching all meals. - def post(self, menu_id, user_id): Endpoint for adding a new meal. - def delete(self, menu_id, user_id): Endpoint for d...
b98a0fbaa7b881e7f39152cc4f7846cfac3e8029
<|skeleton|> class MealsView: """Contains GET and POST methods""" def get(self, menu_id): """Endpoint for fetching all meals.""" <|body_0|> def post(self, menu_id, user_id): """Endpoint for adding a new meal.""" <|body_1|> def delete(self, menu_id, user_id): ""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MealsView: """Contains GET and POST methods""" def get(self, menu_id): """Endpoint for fetching all meals.""" results = [] all_meals = Meal.list_all_meals() try: menu = Menu.find_by_id(menu_id) if not menu: raise MealError.NotFound('...
the_stack_v2_python_sparse
app/api/v2/views/meal.py
mashafrancis/fast-food-fast-api
train
0