blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
7.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
378
8.64k
id
stringlengths
44
44
length_bytes
int64
505
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.88k
prompted_full_text
stringlengths
565
12.5k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
5.05k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
snapshot_total_rows
int64
75.8k
75.8k
solution
stringlengths
242
8.3k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
fc841da4131ef82e9b0b1af08c1b7b9bb89ac715
[ "self.logger = logger\nself.is_trained = False\nself.supported_formats = ['pkl', 'onnx', 'pmml']\nself.name = 'FBSVM'\nself.centroids = None\nself.weights = None\nself.sigma = None", "NP = X_b.shape[0]\nNC = self.centroids.shape[0]\nXC2 = -2 * np.dot(X_b, self.centroids.T)\nXC2 += np.sum(np.multiply(X_b, X_b), ax...
<|body_start_0|> self.logger = logger self.is_trained = False self.supported_formats = ['pkl', 'onnx', 'pmml'] self.name = 'FBSVM' self.centroids = None self.weights = None self.sigma = None <|end_body_0|> <|body_start_1|> NP = X_b.shape[0] NC = s...
This class contains the Federated Budget SVM model.
FBSVM_model
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FBSVM_model: """This class contains the Federated Budget SVM model.""" def __init__(self, logger): """Create a :class:`FBSVM_model` instance. Parameters ---------- logger: :class:`mylogging.Logger` Logging object instance.""" <|body_0|> def predict(self, X_b): ""...
stack_v2_sparse_classes_75kplus_train_073000
17,863
permissive
[ { "docstring": "Create a :class:`FBSVM_model` instance. Parameters ---------- logger: :class:`mylogging.Logger` Logging object instance.", "name": "__init__", "signature": "def __init__(self, logger)" }, { "docstring": "Uses the model to predict new outputs given for an unlabeled dataset. Parame...
2
stack_v2_sparse_classes_30k_train_019168
Implement the Python class `FBSVM_model` described below. Class description: This class contains the Federated Budget SVM model. Method signatures and docstrings: - def __init__(self, logger): Create a :class:`FBSVM_model` instance. Parameters ---------- logger: :class:`mylogging.Logger` Logging object instance. - de...
Implement the Python class `FBSVM_model` described below. Class description: This class contains the Federated Budget SVM model. Method signatures and docstrings: - def __init__(self, logger): Create a :class:`FBSVM_model` instance. Parameters ---------- logger: :class:`mylogging.Logger` Logging object instance. - de...
ccc0a7674a04ae0d00bedc38893b33184c5f68c6
<|skeleton|> class FBSVM_model: """This class contains the Federated Budget SVM model.""" def __init__(self, logger): """Create a :class:`FBSVM_model` instance. Parameters ---------- logger: :class:`mylogging.Logger` Logging object instance.""" <|body_0|> def predict(self, X_b): ""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FBSVM_model: """This class contains the Federated Budget SVM model.""" def __init__(self, logger): """Create a :class:`FBSVM_model` instance. Parameters ---------- logger: :class:`mylogging.Logger` Logging object instance.""" self.logger = logger self.is_trained = False se...
the_stack_v2_python_sparse
MMLL/models/POM1/FBSVM/FBSVM.py
Musketeer-H2020/MMLL-Robust
train
0
cf06d4c271acece9e23a2de1b3090a1d352d3749
[ "Expr.__init__(self, template, line)\nself._var = var\nself._nodes = nodes", "try:\n fn = self._env.get(self._var)\n params = [node.eval() for node in self._nodes]\n return fn(*params)\nexcept KeyError:\n raise UnknownVariableError('.'.join(self._var), self._template._filename, self._line)" ]
<|body_start_0|> Expr.__init__(self, template, line) self._var = var self._nodes = nodes <|end_body_0|> <|body_start_1|> try: fn = self._env.get(self._var) params = [node.eval() for node in self._nodes] return fn(*params) except KeyError: ...
A function expression node.
FuncExpr
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FuncExpr: """A function expression node.""" def __init__(self, template, line, var, nodes): """Initialize the node.""" <|body_0|> def eval(self): """Evaluate the expression.""" <|body_1|> <|end_skeleton|> <|body_start_0|> Expr.__init__(self, tem...
stack_v2_sparse_classes_75kplus_train_073001
3,521
permissive
[ { "docstring": "Initialize the node.", "name": "__init__", "signature": "def __init__(self, template, line, var, nodes)" }, { "docstring": "Evaluate the expression.", "name": "eval", "signature": "def eval(self)" } ]
2
stack_v2_sparse_classes_30k_train_032725
Implement the Python class `FuncExpr` described below. Class description: A function expression node. Method signatures and docstrings: - def __init__(self, template, line, var, nodes): Initialize the node. - def eval(self): Evaluate the expression.
Implement the Python class `FuncExpr` described below. Class description: A function expression node. Method signatures and docstrings: - def __init__(self, template, line, var, nodes): Initialize the node. - def eval(self): Evaluate the expression. <|skeleton|> class FuncExpr: """A function expression node.""" ...
6aeee9b229d3f62aace98a51d9014781bbe6cb52
<|skeleton|> class FuncExpr: """A function expression node.""" def __init__(self, template, line, var, nodes): """Initialize the node.""" <|body_0|> def eval(self): """Evaluate the expression.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FuncExpr: """A function expression node.""" def __init__(self, template, line, var, nodes): """Initialize the node.""" Expr.__init__(self, template, line) self._var = var self._nodes = nodes def eval(self): """Evaluate the expression.""" try: ...
the_stack_v2_python_sparse
mrbaviirc/template/expr.py
brianvanderburg2/mrbaviirc
train
0
f0fdc703bec438b7888bd3eda6197aa328da1791
[ "models = registry.models.values()\nmodels = sorted(models, key=lambda x: x.label)\nserializer = ModelSerializer(models, many=True)\nreturn Response(serializer.data)", "model = registry.models.get(pk)\nif model is None:\n raise Http404\nserializer = ModelSerializer(model)\nreturn Response(serializer.data)" ]
<|body_start_0|> models = registry.models.values() models = sorted(models, key=lambda x: x.label) serializer = ModelSerializer(models, many=True) return Response(serializer.data) <|end_body_0|> <|body_start_1|> model = registry.models.get(pk) if model is None: ...
Viewset around model information.
ModelViewSet
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ModelViewSet: """Viewset around model information.""" def list(self, request): """Get a list of models.""" <|body_0|> def retrieve(self, request, pk=None): """Get a specific model.""" <|body_1|> <|end_skeleton|> <|body_start_0|> models = registr...
stack_v2_sparse_classes_75kplus_train_073002
9,625
permissive
[ { "docstring": "Get a list of models.", "name": "list", "signature": "def list(self, request)" }, { "docstring": "Get a specific model.", "name": "retrieve", "signature": "def retrieve(self, request, pk=None)" } ]
2
stack_v2_sparse_classes_30k_train_017392
Implement the Python class `ModelViewSet` described below. Class description: Viewset around model information. Method signatures and docstrings: - def list(self, request): Get a list of models. - def retrieve(self, request, pk=None): Get a specific model.
Implement the Python class `ModelViewSet` described below. Class description: Viewset around model information. Method signatures and docstrings: - def list(self, request): Get a list of models. - def retrieve(self, request, pk=None): Get a specific model. <|skeleton|> class ModelViewSet: """Viewset around model...
aaab76706c8268d3ff3e87c275baee9dd4714314
<|skeleton|> class ModelViewSet: """Viewset around model information.""" def list(self, request): """Get a list of models.""" <|body_0|> def retrieve(self, request, pk=None): """Get a specific model.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ModelViewSet: """Viewset around model information.""" def list(self, request): """Get a list of models.""" models = registry.models.values() models = sorted(models, key=lambda x: x.label) serializer = ModelSerializer(models, many=True) return Response(serializer.da...
the_stack_v2_python_sparse
web/api/views.py
rcbops/FleetDeploymentReporting
train
1
967cf641c7b65ffef15fda09d38156a680080f04
[ "json_dict = json.loads(request.body.decode())\nreceiver = json_dict.get('receiver')\nprovince_id = json_dict.get('province_id')\ncity_id = json_dict.get('city_id')\ndistrict_id = json_dict.get('district_id')\nplace = json_dict.get('place')\nmobile = json_dict.get('mobile')\ntel = json_dict.get('tel')\nemail = json...
<|body_start_0|> json_dict = json.loads(request.body.decode()) receiver = json_dict.get('receiver') province_id = json_dict.get('province_id') city_id = json_dict.get('city_id') district_id = json_dict.get('district_id') place = json_dict.get('place') mobile = jso...
修改和删除地址
UpdateDestroyAddressView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UpdateDestroyAddressView: """修改和删除地址""" def put(self, request, address_id): """修改地址""" <|body_0|> def delete(self, request, address_id): """删除地址""" <|body_1|> <|end_skeleton|> <|body_start_0|> json_dict = json.loads(request.body.decode()) ...
stack_v2_sparse_classes_75kplus_train_073003
28,395
permissive
[ { "docstring": "修改地址", "name": "put", "signature": "def put(self, request, address_id)" }, { "docstring": "删除地址", "name": "delete", "signature": "def delete(self, request, address_id)" } ]
2
stack_v2_sparse_classes_30k_train_016631
Implement the Python class `UpdateDestroyAddressView` described below. Class description: 修改和删除地址 Method signatures and docstrings: - def put(self, request, address_id): 修改地址 - def delete(self, request, address_id): 删除地址
Implement the Python class `UpdateDestroyAddressView` described below. Class description: 修改和删除地址 Method signatures and docstrings: - def put(self, request, address_id): 修改地址 - def delete(self, request, address_id): 删除地址 <|skeleton|> class UpdateDestroyAddressView: """修改和删除地址""" def put(self, request, addre...
42a7edf7ca3b43b59955505db854c73c6edf1f24
<|skeleton|> class UpdateDestroyAddressView: """修改和删除地址""" def put(self, request, address_id): """修改地址""" <|body_0|> def delete(self, request, address_id): """删除地址""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UpdateDestroyAddressView: """修改和删除地址""" def put(self, request, address_id): """修改地址""" json_dict = json.loads(request.body.decode()) receiver = json_dict.get('receiver') province_id = json_dict.get('province_id') city_id = json_dict.get('city_id') district_...
the_stack_v2_python_sparse
meiduo_mall/apps/users/views.py
Gh-Helina/Git_meiduo
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...
LazySegmentTree
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LazySegmentTree: def __init__(self, ls: list, segfunc, identity_element, lazy_ide=None): """セグ木 pypyじゃないとTLEなるかも 一次元のリスト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...
stack_v2_sparse_classes_75kplus_train_073004
23,273
no_license
[ { "docstring": "セグ木 pypyじゃないとTLEなるかも 一次元のリスト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, identity_element...
4
stack_v2_sparse_classes_30k_train_036349
Implement the Python class `LazySegmentTree` described below. Class description: Implement the LazySegmentTree class. Method signatures and docstrings: - def __init__(self, ls: list, segfunc, identity_element, lazy_ide=None): セグ木 pypyじゃないとTLEなるかも 一次元のリストlsを受け取り初期化する。O(len(ls)) 区間のルールはsegfuncによって定義される identity element...
Implement the Python class `LazySegmentTree` described below. Class description: Implement the LazySegmentTree class. Method signatures and docstrings: - def __init__(self, ls: list, segfunc, identity_element, lazy_ide=None): セグ木 pypyじゃないとTLEなるかも 一次元のリストlsを受け取り初期化する。O(len(ls)) 区間のルールはsegfuncによって定義される identity element...
74915a40ac157f89fe400e3f98e9bf3c10012cd7
<|skeleton|> class LazySegmentTree: def __init__(self, ls: list, segfunc, identity_element, lazy_ide=None): """セグ木 pypyじゃないとTLEなるかも 一次元のリスト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...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LazySegmentTree: def __init__(self, ls: list, segfunc, identity_element, lazy_ide=None): """セグ木 pypyじゃないとTLEなるかも 一次元のリスト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)""" s...
the_stack_v2_python_sparse
algorithm/SegmentTree.py
masakiaota/kyoupuro
train
1
6bdf606b34783c4669e1253402babf117e57acbf
[ "self.children = {}\nself.mean = 0.0\nassert nodetype in nodetype_enum, 'The given value %s is a not a valid node type.' % str(nodetype)\nself.type = nodetype\nself.visits = 0", "reward = 0.0\nif horizon == 0:\n return reward\nif self.type == chance_node:\n observation, r = agent.generate_percept_and_update...
<|body_start_0|> self.children = {} self.mean = 0.0 assert nodetype in nodetype_enum, 'The given value %s is a not a valid node type.' % str(nodetype) self.type = nodetype self.visits = 0 <|end_body_0|> <|body_start_1|> reward = 0.0 if horizon == 0: r...
A class to represent a node in the Monte Carlo search tree. The nodes in the search tree represent simulated actions and percepts between an agent following an upper confidence bounds (UCB) policy and a generative model of the environment represented by a context tree. The purpose of the tree is to determine the expect...
MonteCarloSearchNode
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MonteCarloSearchNode: """A class to represent a node in the Monte Carlo search tree. The nodes in the search tree represent simulated actions and percepts between an agent following an upper confidence bounds (UCB) policy and a generative model of the environment represented by a context tree. Th...
stack_v2_sparse_classes_75kplus_train_073005
6,844
no_license
[ { "docstring": "Create a new search node of the given type.", "name": "__init__", "signature": "def __init__(self, nodetype)" }, { "docstring": "Returns the accumulated reward from performing a single sample on this node. - `agent`: the agent doing the sampling - `horizon`: how many cycles into ...
3
stack_v2_sparse_classes_30k_train_007770
Implement the Python class `MonteCarloSearchNode` described below. Class description: A class to represent a node in the Monte Carlo search tree. The nodes in the search tree represent simulated actions and percepts between an agent following an upper confidence bounds (UCB) policy and a generative model of the enviro...
Implement the Python class `MonteCarloSearchNode` described below. Class description: A class to represent a node in the Monte Carlo search tree. The nodes in the search tree represent simulated actions and percepts between an agent following an upper confidence bounds (UCB) policy and a generative model of the enviro...
c0349c4b0c9a2fcb30d9f0698807eb3f5ca2841a
<|skeleton|> class MonteCarloSearchNode: """A class to represent a node in the Monte Carlo search tree. The nodes in the search tree represent simulated actions and percepts between an agent following an upper confidence bounds (UCB) policy and a generative model of the environment represented by a context tree. Th...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MonteCarloSearchNode: """A class to represent a node in the Monte Carlo search tree. The nodes in the search tree represent simulated actions and percepts between an agent following an upper confidence bounds (UCB) policy and a generative model of the environment represented by a context tree. The purpose of ...
the_stack_v2_python_sparse
monte_carlo_search_tree.py
openAIunfair/aixi
train
0
c8b1c1b2d2ab18f52a9460373d356f84e597c542
[ "if not email:\n raise ValueError('Users must have an email address')\nuser = self.model(username=username, email=self.normalize_email(email))\nuser.set_password(password)\nuser.save(using=self._db)\nreturn user", "user = self.create_user(username, email, password=password)\nuser.is_admin = True\nuser.is_staff...
<|body_start_0|> if not email: raise ValueError('Users must have an email address') user = self.model(username=username, email=self.normalize_email(email)) user.set_password(password) user.save(using=self._db) return user <|end_body_0|> <|body_start_1|> user ...
MyUserManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyUserManager: def create_user(self, username, email, password=None): """Creates and saves a User with the given email, date of birth and password.""" <|body_0|> def create_superuser(self, username, email, password): """Creates and saves a superuser with the given em...
stack_v2_sparse_classes_75kplus_train_073006
3,320
no_license
[ { "docstring": "Creates and saves a User with the given email, date of birth and password.", "name": "create_user", "signature": "def create_user(self, username, email, password=None)" }, { "docstring": "Creates and saves a superuser with the given email, date of birth and password.", "name"...
2
stack_v2_sparse_classes_30k_train_053948
Implement the Python class `MyUserManager` described below. Class description: Implement the MyUserManager class. Method signatures and docstrings: - def create_user(self, username, email, password=None): Creates and saves a User with the given email, date of birth and password. - def create_superuser(self, username,...
Implement the Python class `MyUserManager` described below. Class description: Implement the MyUserManager class. Method signatures and docstrings: - def create_user(self, username, email, password=None): Creates and saves a User with the given email, date of birth and password. - def create_superuser(self, username,...
8b33a29e60d84853f8c1e92d7a4ca88c6ee349b4
<|skeleton|> class MyUserManager: def create_user(self, username, email, password=None): """Creates and saves a User with the given email, date of birth and password.""" <|body_0|> def create_superuser(self, username, email, password): """Creates and saves a superuser with the given em...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MyUserManager: def create_user(self, username, email, password=None): """Creates and saves a User with the given email, date of birth and password.""" if not email: raise ValueError('Users must have an email address') user = self.model(username=username, email=self.normaliz...
the_stack_v2_python_sparse
accounts/models.py
falbellaihi1/BST
train
0
8aa59586c0a210e2b262a43c33dd71d90c7c9c06
[ "left, right, res = (0, num, False)\nwhile left <= right:\n mid = left + (right - left) / 2\n square = mid * mid\n square_one = (mid + 1) * (mid + 1)\n if square < num < square_one:\n break\n elif square == num:\n res = True\n break\n elif num < square:\n right = mid\n ...
<|body_start_0|> left, right, res = (0, num, False) while left <= right: mid = left + (right - left) / 2 square = mid * mid square_one = (mid + 1) * (mid + 1) if square < num < square_one: break elif square == num: ...
给定一个正整数 num,编写一个函数,如果 num 是一个完全平方数,则返回 True,否则返回 False。 说明:不要使用任何内置的库函数,如 sqrt。 示例 1: 输入:16 输出:True 示例 2: 输入:14 输出:False
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """给定一个正整数 num,编写一个函数,如果 num 是一个完全平方数,则返回 True,否则返回 False。 说明:不要使用任何内置的库函数,如 sqrt。 示例 1: 输入:16 输出:True 示例 2: 输入:14 输出:False""" def is_perfect_square(self, num): """:type num: int :rtype: bool 分析: 一个完全平方数一定是一个正整数的二次方,而非完全平方数一定是介于一个值的二次方与这个值加1的二次方之间 时间复杂度:O(logn) 空间复杂度:O(1)""...
stack_v2_sparse_classes_75kplus_train_073007
2,552
no_license
[ { "docstring": ":type num: int :rtype: bool 分析: 一个完全平方数一定是一个正整数的二次方,而非完全平方数一定是介于一个值的二次方与这个值加1的二次方之间 时间复杂度:O(logn) 空间复杂度:O(1)", "name": "is_perfect_square", "signature": "def is_perfect_square(self, num)" }, { "docstring": ":type num: int :rtype: bool 时间复杂度:这个不太容易算出来,我测试了几组数据,num -> while循环次数:16-...
3
stack_v2_sparse_classes_30k_train_017771
Implement the Python class `Solution` described below. Class description: 给定一个正整数 num,编写一个函数,如果 num 是一个完全平方数,则返回 True,否则返回 False。 说明:不要使用任何内置的库函数,如 sqrt。 示例 1: 输入:16 输出:True 示例 2: 输入:14 输出:False Method signatures and docstrings: - def is_perfect_square(self, num): :type num: int :rtype: bool 分析: 一个完全平方数一定是一个正整数的二次方,而...
Implement the Python class `Solution` described below. Class description: 给定一个正整数 num,编写一个函数,如果 num 是一个完全平方数,则返回 True,否则返回 False。 说明:不要使用任何内置的库函数,如 sqrt。 示例 1: 输入:16 输出:True 示例 2: 输入:14 输出:False Method signatures and docstrings: - def is_perfect_square(self, num): :type num: int :rtype: bool 分析: 一个完全平方数一定是一个正整数的二次方,而...
2c534185854c1a6f5ffdb2698f9db9989f30a25b
<|skeleton|> class Solution: """给定一个正整数 num,编写一个函数,如果 num 是一个完全平方数,则返回 True,否则返回 False。 说明:不要使用任何内置的库函数,如 sqrt。 示例 1: 输入:16 输出:True 示例 2: 输入:14 输出:False""" def is_perfect_square(self, num): """:type num: int :rtype: bool 分析: 一个完全平方数一定是一个正整数的二次方,而非完全平方数一定是介于一个值的二次方与这个值加1的二次方之间 时间复杂度:O(logn) 空间复杂度:O(1)""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: """给定一个正整数 num,编写一个函数,如果 num 是一个完全平方数,则返回 True,否则返回 False。 说明:不要使用任何内置的库函数,如 sqrt。 示例 1: 输入:16 输出:True 示例 2: 输入:14 输出:False""" def is_perfect_square(self, num): """:type num: int :rtype: bool 分析: 一个完全平方数一定是一个正整数的二次方,而非完全平方数一定是介于一个值的二次方与这个值加1的二次方之间 时间复杂度:O(logn) 空间复杂度:O(1)""" lef...
the_stack_v2_python_sparse
Week 03/id_668/leetcode_367_668.py
Carryours/algorithm004-03
train
2
624841fcec7a0f0ef6873c55ebdc221516c2a2ba
[ "if slot < 1 or slot > 2:\n raise ValueError('slot is outside of 1 and 2.')\nif slot == 1:\n self.ir_tx = self.ir_tx_1\nelif slot == 2:\n self.ir_tx = self.ir_tx_2\nGPIO.setwarnings(False)\nGPIO.setmode(GPIO.BCM)\nGPIO.setup(self.ir_tx, GPIO.OUT, initial=GPIO.LOW)\nself.is_initialized = True\nreturn", "i...
<|body_start_0|> if slot < 1 or slot > 2: raise ValueError('slot is outside of 1 and 2.') if slot == 1: self.ir_tx = self.ir_tx_1 elif slot == 2: self.ir_tx = self.ir_tx_2 GPIO.setwarnings(False) GPIO.setmode(GPIO.BCM) GPIO.setup(self.i...
IR Remote Controller Transmitter.
IRRemoteTx
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IRRemoteTx: """IR Remote Controller Transmitter.""" def __init__(self, slot): """Initiates the IR Transmitter. Parameters: slot (int): Modular sensor slot number (1 or 2)""" <|body_0|> def write(self, protocol, command): """Sends the IR remote controller signal u...
stack_v2_sparse_classes_75kplus_train_073008
3,242
permissive
[ { "docstring": "Initiates the IR Transmitter. Parameters: slot (int): Modular sensor slot number (1 or 2)", "name": "__init__", "signature": "def __init__(self, slot)" }, { "docstring": "Sends the IR remote controller signal using the selected protocol. Parameters: protocol (PROTOCOLS): Remote c...
5
stack_v2_sparse_classes_30k_train_012481
Implement the Python class `IRRemoteTx` described below. Class description: IR Remote Controller Transmitter. Method signatures and docstrings: - def __init__(self, slot): Initiates the IR Transmitter. Parameters: slot (int): Modular sensor slot number (1 or 2) - def write(self, protocol, command): Sends the IR remot...
Implement the Python class `IRRemoteTx` described below. Class description: IR Remote Controller Transmitter. Method signatures and docstrings: - def __init__(self, slot): Initiates the IR Transmitter. Parameters: slot (int): Modular sensor slot number (1 or 2) - def write(self, protocol, command): Sends the IR remot...
ad0dbb07591a6ce89b93435c74830c12f48382f2
<|skeleton|> class IRRemoteTx: """IR Remote Controller Transmitter.""" def __init__(self, slot): """Initiates the IR Transmitter. Parameters: slot (int): Modular sensor slot number (1 or 2)""" <|body_0|> def write(self, protocol, command): """Sends the IR remote controller signal u...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class IRRemoteTx: """IR Remote Controller Transmitter.""" def __init__(self, slot): """Initiates the IR Transmitter. Parameters: slot (int): Modular sensor slot number (1 or 2)""" if slot < 1 or slot > 2: raise ValueError('slot is outside of 1 and 2.') if slot == 1: ...
the_stack_v2_python_sparse
IRRemote/ModularHAT/Libraries/Python/Turta_IRRemote_Module.py
Turta-io/Modular
train
2
637eb1d71001c085f75843c667044e08e2a396e9
[ "self.key = key\nself.value = value\nself.left = self.right = None", "if key < self.key:\n if self.left:\n self.left.insert(key, value)\n else:\n self.left = Tree(key, value)\nelif key > self.key:\n if self.right:\n self.right.insert(key, value)\n else:\n self.right = Tree(...
<|body_start_0|> self.key = key self.value = value self.left = self.right = None <|end_body_0|> <|body_start_1|> if key < self.key: if self.left: self.left.insert(key, value) else: self.left = Tree(key, value) elif key > se...
Tree
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Tree: def __init__(self, key, value=None): """Create a new Tree object with empty L & R subtrees.""" <|body_0|> def insert(self, key, value=None): """Insert a new element into the tree in the correct position""" <|body_1|> def find(self, key): ""...
stack_v2_sparse_classes_75kplus_train_073009
1,923
no_license
[ { "docstring": "Create a new Tree object with empty L & R subtrees.", "name": "__init__", "signature": "def __init__(self, key, value=None)" }, { "docstring": "Insert a new element into the tree in the correct position", "name": "insert", "signature": "def insert(self, key, value=None)" ...
4
null
Implement the Python class `Tree` described below. Class description: Implement the Tree class. Method signatures and docstrings: - def __init__(self, key, value=None): Create a new Tree object with empty L & R subtrees. - def insert(self, key, value=None): Insert a new element into the tree in the correct position -...
Implement the Python class `Tree` described below. Class description: Implement the Tree class. Method signatures and docstrings: - def __init__(self, key, value=None): Create a new Tree object with empty L & R subtrees. - def insert(self, key, value=None): Insert a new element into the tree in the correct position -...
f51c1d2d9557c95e869cbce5bff7158f5aa90192
<|skeleton|> class Tree: def __init__(self, key, value=None): """Create a new Tree object with empty L & R subtrees.""" <|body_0|> def insert(self, key, value=None): """Insert a new element into the tree in the correct position""" <|body_1|> def find(self, key): ""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Tree: def __init__(self, key, value=None): """Create a new Tree object with empty L & R subtrees.""" self.key = key self.value = value self.left = self.right = None def insert(self, key, value=None): """Insert a new element into the tree in the correct position""" ...
the_stack_v2_python_sparse
Python 04: Advanced Python/Lesson 03: Delegation and Composition/tree.py
MTset/Python-Programming-Coursework
train
0
ce8649d1b91ac614597ad01cfa9db7983495ad0f
[ "node = self._getObjectNode('filtered_set')\nnode.setAttribute('expression', self.context.getExpression())\nreturn node", "_before = self.context.expr\nself.context.setExpression(node.getAttribute('expression'))\n_after = self.context.expr\nif _before != _after:\n self.context.clear()" ]
<|body_start_0|> node = self._getObjectNode('filtered_set') node.setAttribute('expression', self.context.getExpression()) return node <|end_body_0|> <|body_start_1|> _before = self.context.expr self.context.setExpression(node.getAttribute('expression')) _after = self.con...
Node im- and exporter for FilteredSet.
FilteredSetNodeAdapter
[ "ZPL-2.1" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FilteredSetNodeAdapter: """Node im- and exporter for FilteredSet.""" def _exportNode(self): """Export the object as a DOM node.""" <|body_0|> def _importNode(self, node): """Import the object from the DOM node.""" <|body_1|> <|end_skeleton|> <|body_star...
stack_v2_sparse_classes_75kplus_train_073010
6,397
permissive
[ { "docstring": "Export the object as a DOM node.", "name": "_exportNode", "signature": "def _exportNode(self)" }, { "docstring": "Import the object from the DOM node.", "name": "_importNode", "signature": "def _importNode(self, node)" } ]
2
stack_v2_sparse_classes_30k_train_035041
Implement the Python class `FilteredSetNodeAdapter` described below. Class description: Node im- and exporter for FilteredSet. Method signatures and docstrings: - def _exportNode(self): Export the object as a DOM node. - def _importNode(self, node): Import the object from the DOM node.
Implement the Python class `FilteredSetNodeAdapter` described below. Class description: Node im- and exporter for FilteredSet. Method signatures and docstrings: - def _exportNode(self): Export the object as a DOM node. - def _importNode(self, node): Import the object from the DOM node. <|skeleton|> class FilteredSet...
44891e10fc83abb6626dffec3334247e8de7a9a0
<|skeleton|> class FilteredSetNodeAdapter: """Node im- and exporter for FilteredSet.""" def _exportNode(self): """Export the object as a DOM node.""" <|body_0|> def _importNode(self, node): """Import the object from the DOM node.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FilteredSetNodeAdapter: """Node im- and exporter for FilteredSet.""" def _exportNode(self): """Export the object as a DOM node.""" node = self._getObjectNode('filtered_set') node.setAttribute('expression', self.context.getExpression()) return node def _importNode(self...
the_stack_v2_python_sparse
src/Products/GenericSetup/PluginIndexes/exportimport.py
zopefoundation/Products.GenericSetup
train
4
a3dc338407be2b44db5de8aac0e0fb2446db016d
[ "self.num_class = -1\nself.num_bin = num_bin\nself.num_feature = -1\nself.prior = None\nself.miu = None\nself.sigma = None\nself.distribution = None\nself.mode = mode\nself.epsilon = 1e-09\nif 256 % self.num_bin != 0:\n print('error bin number!')\n exit()\nelse:\n self.dis_width = 256 / self.num_bin", "s...
<|body_start_0|> self.num_class = -1 self.num_bin = num_bin self.num_feature = -1 self.prior = None self.miu = None self.sigma = None self.distribution = None self.mode = mode self.epsilon = 1e-09 if 256 % self.num_bin != 0: pri...
NaiveBayseClassifier
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NaiveBayseClassifier: def __init__(self, mode=1, num_bin=32): """Constructor of Naive Bayes classifier The function would check if the number of bins is valid If it's invalid, error will raise and exit the program Arg: mode - The mode integer num_bin - The number of bins""" <|bod...
stack_v2_sparse_classes_75kplus_train_073011
3,971
no_license
[ { "docstring": "Constructor of Naive Bayes classifier The function would check if the number of bins is valid If it's invalid, error will raise and exit the program Arg: mode - The mode integer num_bin - The number of bins", "name": "__init__", "signature": "def __init__(self, mode=1, num_bin=32)" }, ...
3
stack_v2_sparse_classes_30k_train_037923
Implement the Python class `NaiveBayseClassifier` described below. Class description: Implement the NaiveBayseClassifier class. Method signatures and docstrings: - def __init__(self, mode=1, num_bin=32): Constructor of Naive Bayes classifier The function would check if the number of bins is valid If it's invalid, err...
Implement the Python class `NaiveBayseClassifier` described below. Class description: Implement the NaiveBayseClassifier class. Method signatures and docstrings: - def __init__(self, mode=1, num_bin=32): Constructor of Naive Bayes classifier The function would check if the number of bins is valid If it's invalid, err...
a99878bd85e69aebf4582efa7231ac2c3514fe8e
<|skeleton|> class NaiveBayseClassifier: def __init__(self, mode=1, num_bin=32): """Constructor of Naive Bayes classifier The function would check if the number of bins is valid If it's invalid, error will raise and exit the program Arg: mode - The mode integer num_bin - The number of bins""" <|bod...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NaiveBayseClassifier: def __init__(self, mode=1, num_bin=32): """Constructor of Naive Bayes classifier The function would check if the number of bins is valid If it's invalid, error will raise and exit the program Arg: mode - The mode integer num_bin - The number of bins""" self.num_class = -1...
the_stack_v2_python_sparse
hw2/1/classifier.py
SunnerLi/ml
train
0
a11d2c019b897fb2844bc4cc5126b39c6c7047a8
[ "try:\n return np.sqrt(self.energy / self.component.mass)\nexcept FloatingPointError:\n return np.zeros(self.frequency.amount)", "try:\n return 20 * np.log10(self.velocity / (5 * 10 ** (-8)))\nexcept FloatingPointError:\n return np.zeros(self.frequency.amount)" ]
<|body_start_0|> try: return np.sqrt(self.energy / self.component.mass) except FloatingPointError: return np.zeros(self.frequency.amount) <|end_body_0|> <|body_start_1|> try: return 20 * np.log10(self.velocity / (5 * 10 ** (-8))) except FloatingPointE...
Abstract base class for all Structural subsystems.
SubsystemStructural
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SubsystemStructural: """Abstract base class for all Structural subsystems.""" def velocity(self): """Vibrational velocity :math:`v`. .. math:: v = \\sqrt{\\frac{E}{m}}""" <|body_0|> def velocity_level(self): """Velocity level. .. math:: L_v = 20 \\log_{10}{\\frac...
stack_v2_sparse_classes_75kplus_train_073012
876
no_license
[ { "docstring": "Vibrational velocity :math:`v`. .. math:: v = \\\\sqrt{\\\\frac{E}{m}}", "name": "velocity", "signature": "def velocity(self)" }, { "docstring": "Velocity level. .. math:: L_v = 20 \\\\log_{10}{\\\\frac{v}{v_0}}", "name": "velocity_level", "signature": "def velocity_level...
2
stack_v2_sparse_classes_30k_train_038356
Implement the Python class `SubsystemStructural` described below. Class description: Abstract base class for all Structural subsystems. Method signatures and docstrings: - def velocity(self): Vibrational velocity :math:`v`. .. math:: v = \\sqrt{\\frac{E}{m}} - def velocity_level(self): Velocity level. .. math:: L_v =...
Implement the Python class `SubsystemStructural` described below. Class description: Abstract base class for all Structural subsystems. Method signatures and docstrings: - def velocity(self): Vibrational velocity :math:`v`. .. math:: v = \\sqrt{\\frac{E}{m}} - def velocity_level(self): Velocity level. .. math:: L_v =...
e30b6dc59d8ab02cd41924f7b6c14d0d1e77e19e
<|skeleton|> class SubsystemStructural: """Abstract base class for all Structural subsystems.""" def velocity(self): """Vibrational velocity :math:`v`. .. math:: v = \\sqrt{\\frac{E}{m}}""" <|body_0|> def velocity_level(self): """Velocity level. .. math:: L_v = 20 \\log_{10}{\\frac...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SubsystemStructural: """Abstract base class for all Structural subsystems.""" def velocity(self): """Vibrational velocity :math:`v`. .. math:: v = \\sqrt{\\frac{E}{m}}""" try: return np.sqrt(self.energy / self.component.mass) except FloatingPointError: retu...
the_stack_v2_python_sparse
Sea/model/subsystems/SubsystemStructural.py
python-acoustics/Sea
train
7
d97fedd04e7a93ed0210030a216a8f0fb2c59e7f
[ "super(SelfAttention, self).__init__()\nself.W = tf.keras.layers.Dense(units)\nself.U = tf.keras.layers.Dense(units)\nself.V = tf.keras.layers.Dense(1)", "prev = self.W(tf.expand_dims(s_prev, 1))\nenc = self.U(hidden_states)\ne = self.V(tf.tanh(prev + enc))\nw = tf.nn.softmax(e, 1)\ncontext = w * hidden_states\nr...
<|body_start_0|> super(SelfAttention, self).__init__() self.W = tf.keras.layers.Dense(units) self.U = tf.keras.layers.Dense(units) self.V = tf.keras.layers.Dense(1) <|end_body_0|> <|body_start_1|> prev = self.W(tf.expand_dims(s_prev, 1)) enc = self.U(hidden_states) ...
Self Attention
SelfAttention
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SelfAttention: """Self Attention""" def __init__(self, units): """Self Attention""" <|body_0|> def call(self, s_prev, hidden_states): """Self Attention""" <|body_1|> <|end_skeleton|> <|body_start_0|> super(SelfAttention, self).__init__() ...
stack_v2_sparse_classes_75kplus_train_073013
702
no_license
[ { "docstring": "Self Attention", "name": "__init__", "signature": "def __init__(self, units)" }, { "docstring": "Self Attention", "name": "call", "signature": "def call(self, s_prev, hidden_states)" } ]
2
stack_v2_sparse_classes_30k_train_042421
Implement the Python class `SelfAttention` described below. Class description: Self Attention Method signatures and docstrings: - def __init__(self, units): Self Attention - def call(self, s_prev, hidden_states): Self Attention
Implement the Python class `SelfAttention` described below. Class description: Self Attention Method signatures and docstrings: - def __init__(self, units): Self Attention - def call(self, s_prev, hidden_states): Self Attention <|skeleton|> class SelfAttention: """Self Attention""" def __init__(self, units)...
8761eb876046ad3c0c3f85d98dbdca4007d93cd1
<|skeleton|> class SelfAttention: """Self Attention""" def __init__(self, units): """Self Attention""" <|body_0|> def call(self, s_prev, hidden_states): """Self Attention""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SelfAttention: """Self Attention""" def __init__(self, units): """Self Attention""" super(SelfAttention, self).__init__() self.W = tf.keras.layers.Dense(units) self.U = tf.keras.layers.Dense(units) self.V = tf.keras.layers.Dense(1) def call(self, s_prev, hidde...
the_stack_v2_python_sparse
supervised_learning/0x11-attention/1-self_attention.py
oran2527/holbertonschool-machine_learning
train
0
43aaa4b2145b3da7f091f25e95d895d1019ec755
[ "pygame.init()\nself.surface = pygame.display.set_mode((800, 600))\nself.running = True\nself.step_count = 0\nself.ship = Ship(pygame.Vector2(self.surface.get_size()) / 2)", "clock = pygame.time.Clock()\nwhile self.running:\n self.step()\n clock.tick(60)", "self.handle_events()\nself.handle_keyboard_event...
<|body_start_0|> pygame.init() self.surface = pygame.display.set_mode((800, 600)) self.running = True self.step_count = 0 self.ship = Ship(pygame.Vector2(self.surface.get_size()) / 2) <|end_body_0|> <|body_start_1|> clock = pygame.time.Clock() while self.running:...
MyGame
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyGame: def __init__(self): """Initalizes the Game""" <|body_0|> def run(self): """Runs the Game until it ends""" <|body_1|> def step(self): """Moves Game one step forward""" <|body_2|> def handle_events(self): """Handles eve...
stack_v2_sparse_classes_75kplus_train_073014
2,306
no_license
[ { "docstring": "Initalizes the Game", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Runs the Game until it ends", "name": "run", "signature": "def run(self)" }, { "docstring": "Moves Game one step forward", "name": "step", "signature": "def step...
6
stack_v2_sparse_classes_30k_train_022069
Implement the Python class `MyGame` described below. Class description: Implement the MyGame class. Method signatures and docstrings: - def __init__(self): Initalizes the Game - def run(self): Runs the Game until it ends - def step(self): Moves Game one step forward - def handle_events(self): Handles events - def han...
Implement the Python class `MyGame` described below. Class description: Implement the MyGame class. Method signatures and docstrings: - def __init__(self): Initalizes the Game - def run(self): Runs the Game until it ends - def step(self): Moves Game one step forward - def handle_events(self): Handles events - def han...
dd8fec6f71b18aaa4a78e26a4afefc8c70327093
<|skeleton|> class MyGame: def __init__(self): """Initalizes the Game""" <|body_0|> def run(self): """Runs the Game until it ends""" <|body_1|> def step(self): """Moves Game one step forward""" <|body_2|> def handle_events(self): """Handles eve...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MyGame: def __init__(self): """Initalizes the Game""" pygame.init() self.surface = pygame.display.set_mode((800, 600)) self.running = True self.step_count = 0 self.ship = Ship(pygame.Vector2(self.surface.get_size()) / 2) def run(self): """Runs the G...
the_stack_v2_python_sparse
MyGame_ship.py
bterwijn/python
train
0
8e32b9ebbca8c15b646710a0284c3753bee7761d
[ "threading.Thread.__init__(self, group=group, target=target, name=name, verbose=verbose)\nself.daemon = True\nself.target = target\nself.args = args\nself.kwargs = kwargs\nself.exception_queue = exception_queue\nself.result_queue = return_queue", "try:\n retval = self.target(*self.args, **self.kwargs)\n if ...
<|body_start_0|> threading.Thread.__init__(self, group=group, target=target, name=name, verbose=verbose) self.daemon = True self.target = target self.args = args self.kwargs = kwargs self.exception_queue = exception_queue self.result_queue = return_queue <|end_bod...
Daemon Thread wrapper to execute long-running processes
WorkerThread
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WorkerThread: """Daemon Thread wrapper to execute long-running processes""" def __init__(self, exception_queue, return_queue=None, group=None, target=None, name=None, args=(), kwargs={}, verbose=None): """Standard Thread API with the addition of Queues for passing Exceptions and retu...
stack_v2_sparse_classes_75kplus_train_073015
1,490
permissive
[ { "docstring": "Standard Thread API with the addition of Queues for passing Exceptions and return values.", "name": "__init__", "signature": "def __init__(self, exception_queue, return_queue=None, group=None, target=None, name=None, args=(), kwargs={}, verbose=None)" }, { "docstring": "Runs the ...
2
null
Implement the Python class `WorkerThread` described below. Class description: Daemon Thread wrapper to execute long-running processes Method signatures and docstrings: - def __init__(self, exception_queue, return_queue=None, group=None, target=None, name=None, args=(), kwargs={}, verbose=None): Standard Thread API wi...
Implement the Python class `WorkerThread` described below. Class description: Daemon Thread wrapper to execute long-running processes Method signatures and docstrings: - def __init__(self, exception_queue, return_queue=None, group=None, target=None, name=None, args=(), kwargs={}, verbose=None): Standard Thread API wi...
f7a0a642b4a778d9d0c131871f4bfb9822ecb3da
<|skeleton|> class WorkerThread: """Daemon Thread wrapper to execute long-running processes""" def __init__(self, exception_queue, return_queue=None, group=None, target=None, name=None, args=(), kwargs={}, verbose=None): """Standard Thread API with the addition of Queues for passing Exceptions and retu...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class WorkerThread: """Daemon Thread wrapper to execute long-running processes""" def __init__(self, exception_queue, return_queue=None, group=None, target=None, name=None, args=(), kwargs={}, verbose=None): """Standard Thread API with the addition of Queues for passing Exceptions and return values."""...
the_stack_v2_python_sparse
models/workerthread.py
endymecy/NDIToolbox
train
0
2fee95e03bf8acb9aaf31a09fbfd873f737f3553
[ "text = TextBlob(text)\nresult = text.sentiment\nreturn (result[0], result[1])", "txt = pd.Series(textSeries)\ntxt = txt.map(self.__mapfun)\ntxt = txt.apply(pd.Series)\ntxt.columns = ['polar', 'subj']\nreturn txt" ]
<|body_start_0|> text = TextBlob(text) result = text.sentiment return (result[0], result[1]) <|end_body_0|> <|body_start_1|> txt = pd.Series(textSeries) txt = txt.map(self.__mapfun) txt = txt.apply(pd.Series) txt.columns = ['polar', 'subj'] return txt <|e...
Textblob
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Textblob: def __mapfun(self, text): """text: string""" <|body_0|> def fit(self, textSeries): """Input: list/tuple/pandas.Series [sentence, sentence, ...] Output: dataframe with column name "polar", "subj" Explanation of output: (1) The polarity score is a float withi...
stack_v2_sparse_classes_75kplus_train_073016
2,696
no_license
[ { "docstring": "text: string", "name": "__mapfun", "signature": "def __mapfun(self, text)" }, { "docstring": "Input: list/tuple/pandas.Series [sentence, sentence, ...] Output: dataframe with column name \"polar\", \"subj\" Explanation of output: (1) The polarity score is a float within the range...
2
stack_v2_sparse_classes_30k_train_036842
Implement the Python class `Textblob` described below. Class description: Implement the Textblob class. Method signatures and docstrings: - def __mapfun(self, text): text: string - def fit(self, textSeries): Input: list/tuple/pandas.Series [sentence, sentence, ...] Output: dataframe with column name "polar", "subj" E...
Implement the Python class `Textblob` described below. Class description: Implement the Textblob class. Method signatures and docstrings: - def __mapfun(self, text): text: string - def fit(self, textSeries): Input: list/tuple/pandas.Series [sentence, sentence, ...] Output: dataframe with column name "polar", "subj" E...
1a3d46cee9bc8cae79e076d6336de5de9fb7427b
<|skeleton|> class Textblob: def __mapfun(self, text): """text: string""" <|body_0|> def fit(self, textSeries): """Input: list/tuple/pandas.Series [sentence, sentence, ...] Output: dataframe with column name "polar", "subj" Explanation of output: (1) The polarity score is a float withi...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Textblob: def __mapfun(self, text): """text: string""" text = TextBlob(text) result = text.sentiment return (result[0], result[1]) def fit(self, textSeries): """Input: list/tuple/pandas.Series [sentence, sentence, ...] Output: dataframe with column name "polar", "s...
the_stack_v2_python_sparse
scripts/_sentiment/auto_sentiment_app/brexit_sentiment.py
my2582/gep
train
0
def8241afc73f7e548820095bd53677ce7ebe87e
[ "self.converter = UnitConverter(base_system='SI', base_unit='meter')\nself.quantities = [{'system': 'SI', 'unit': 'furlong', 'value': 1, 'date_obj': '2020-07-22'}, {'system': 'SI', 'unit': 'yard', 'value': 1, 'date_obj': '2020-07-22'}]\nself.trash_quantities = [{'system': 'si', 'unit': 'trop', 'value': 100, 'date_o...
<|body_start_0|> self.converter = UnitConverter(base_system='SI', base_unit='meter') self.quantities = [{'system': 'SI', 'unit': 'furlong', 'value': 1, 'date_obj': '2020-07-22'}, {'system': 'SI', 'unit': 'yard', 'value': 1, 'date_obj': '2020-07-22'}] self.trash_quantities = [{'system': 'si', 'un...
Test UnitConverter API object
UnitConverterAPITest
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UnitConverterAPITest: """Test UnitConverter API object""" def setUp(self) -> None: """Setup environment""" <|body_0|> def test_convert_request(self): """Test conversion API""" <|body_1|> def test_convert_batch_request(self): """Test batch con...
stack_v2_sparse_classes_75kplus_train_073017
38,680
permissive
[ { "docstring": "Setup environment", "name": "setUp", "signature": "def setUp(self) -> None" }, { "docstring": "Test conversion API", "name": "test_convert_request", "signature": "def test_convert_request(self)" }, { "docstring": "Test batch conversion", "name": "test_convert_...
4
null
Implement the Python class `UnitConverterAPITest` described below. Class description: Test UnitConverter API object Method signatures and docstrings: - def setUp(self) -> None: Setup environment - def test_convert_request(self): Test conversion API - def test_convert_batch_request(self): Test batch conversion - def t...
Implement the Python class `UnitConverterAPITest` described below. Class description: Test UnitConverter API object Method signatures and docstrings: - def setUp(self) -> None: Setup environment - def test_convert_request(self): Test conversion API - def test_convert_batch_request(self): Test batch conversion - def t...
23cc075377d47ac631634cd71fd0e7d6b0a57bad
<|skeleton|> class UnitConverterAPITest: """Test UnitConverter API object""" def setUp(self) -> None: """Setup environment""" <|body_0|> def test_convert_request(self): """Test conversion API""" <|body_1|> def test_convert_batch_request(self): """Test batch con...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UnitConverterAPITest: """Test UnitConverter API object""" def setUp(self) -> None: """Setup environment""" self.converter = UnitConverter(base_system='SI', base_unit='meter') self.quantities = [{'system': 'SI', 'unit': 'furlong', 'value': 1, 'date_obj': '2020-07-22'}, {'system': '...
the_stack_v2_python_sparse
src/geocurrency/units/tests.py
fmeurou/geocurrency
train
5
b5692fb5126b65de5010d6a5108908db7877eb19
[ "self.resolve = resolve\nself.args = args\nself.kwargs = kwargs\nif factory is not None:\n self.set_default_value_mode(DefaultValue.CallObject, factory)\nelif args is not None or kwargs is not None:\n mode = DefaultValue.MemberMethod_Object\n self.set_default_value_mode(mode, 'default')\nelif optional is F...
<|body_start_0|> self.resolve = resolve self.args = args self.kwargs = kwargs if factory is not None: self.set_default_value_mode(DefaultValue.CallObject, factory) elif args is not None or kwargs is not None: mode = DefaultValue.MemberMethod_Object ...
An Instance which delays resolving the type definition. The first time the value is accessed or modified, the type will be resolved and the forward instance will behave identically to a normal instance.
ForwardInstance
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ForwardInstance: """An Instance which delays resolving the type definition. The first time the value is accessed or modified, the type will be resolved and the forward instance will behave identically to a normal instance.""" def __init__(self, resolve, args=None, kwargs=None, *, factory=Non...
stack_v2_sparse_classes_75kplus_train_073018
7,418
permissive
[ { "docstring": "Initialize a ForwardInstance. resolve : callable A callable which takes no arguments and returns the type or tuple of types to use for validating the values. args : tuple, optional If 'factory' is None, then 'resolve' will return a callable type and these arguments will be passed to the construc...
4
stack_v2_sparse_classes_30k_train_045982
Implement the Python class `ForwardInstance` described below. Class description: An Instance which delays resolving the type definition. The first time the value is accessed or modified, the type will be resolved and the forward instance will behave identically to a normal instance. Method signatures and docstrings: ...
Implement the Python class `ForwardInstance` described below. Class description: An Instance which delays resolving the type definition. The first time the value is accessed or modified, the type will be resolved and the forward instance will behave identically to a normal instance. Method signatures and docstrings: ...
761a52821d8c77b5718216256963682d11599c1e
<|skeleton|> class ForwardInstance: """An Instance which delays resolving the type definition. The first time the value is accessed or modified, the type will be resolved and the forward instance will behave identically to a normal instance.""" def __init__(self, resolve, args=None, kwargs=None, *, factory=Non...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ForwardInstance: """An Instance which delays resolving the type definition. The first time the value is accessed or modified, the type will be resolved and the forward instance will behave identically to a normal instance.""" def __init__(self, resolve, args=None, kwargs=None, *, factory=None, optional=N...
the_stack_v2_python_sparse
atom/instance.py
nucleic/atom
train
251
d2cc412e30fb8ab6432776ebfa83e70e630a5bec
[ "self.cv = cv\nself.age = 0\nself.particles = []", "self.age += dt\nfor p in self.particles:\n p.update(dt)\nfor i in range(len(self.particles) - 1, -1, -1):\n if not self.particles[i].alive():\n del self.particles[i]" ]
<|body_start_0|> self.cv = cv self.age = 0 self.particles = [] <|end_body_0|> <|body_start_1|> self.age += dt for p in self.particles: p.update(dt) for i in range(len(self.particles) - 1, -1, -1): if not self.particles[i].alive(): ...
Generic class for fireworks. The main "behavior" of a fireworks is specified via its update method. E.g., new particles can be emitted and added to the particle list. The Fireworks base class automatically updates all particles from the particle list in its update method. Attributes: cv (Tk.canvas): the canvas in which...
Fireworks
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Fireworks: """Generic class for fireworks. The main "behavior" of a fireworks is specified via its update method. E.g., new particles can be emitted and added to the particle list. The Fireworks base class automatically updates all particles from the particle list in its update method. Attributes...
stack_v2_sparse_classes_75kplus_train_073019
16,427
permissive
[ { "docstring": "Init Fireworks objects. Args: cv (Tk.canvas): the canvas in which the particle is drawn.", "name": "__init__", "signature": "def __init__(self, cv=None)" }, { "docstring": "Update the fireworks' particles and remove dead ones. Args: dt (float): the time that has passed after the ...
2
stack_v2_sparse_classes_30k_train_007780
Implement the Python class `Fireworks` described below. Class description: Generic class for fireworks. The main "behavior" of a fireworks is specified via its update method. E.g., new particles can be emitted and added to the particle list. The Fireworks base class automatically updates all particles from the particl...
Implement the Python class `Fireworks` described below. Class description: Generic class for fireworks. The main "behavior" of a fireworks is specified via its update method. E.g., new particles can be emitted and added to the particle list. The Fireworks base class automatically updates all particles from the particl...
c6b6d80e9d59f5d115ca8b8fc020fcd6cb030af8
<|skeleton|> class Fireworks: """Generic class for fireworks. The main "behavior" of a fireworks is specified via its update method. E.g., new particles can be emitted and added to the particle list. The Fireworks base class automatically updates all particles from the particle list in its update method. Attributes...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Fireworks: """Generic class for fireworks. The main "behavior" of a fireworks is specified via its update method. E.g., new particles can be emitted and added to the particle list. The Fireworks base class automatically updates all particles from the particle list in its update method. Attributes: cv (Tk.canv...
the_stack_v2_python_sparse
scripts/sheet9/9.2.py
LennartElbe/PythOnline
train
0
082d127377253de077469e704d5fff2dde4b68c6
[ "d = {i: i ** 2 for i in range(0, 10)}\nrecord = [n]\nwhile n != 1:\n new_n = 0\n while n != 0:\n new_n += d[n % 10]\n n //= 10\n if new_n in record:\n return False\n else:\n record.append(new_n)\n n = new_n\nreturn True", "def new_number(n):\n total = 0\n whil...
<|body_start_0|> d = {i: i ** 2 for i in range(0, 10)} record = [n] while n != 1: new_n = 0 while n != 0: new_n += d[n % 10] n //= 10 if new_n in record: return False else: record.appe...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isHappy(self, n): """:type n: int :rtype: bool""" <|body_0|> def isHappy2(self, n): """:type n: int :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> d = {i: i ** 2 for i in range(0, 10)} record = [n] while n...
stack_v2_sparse_classes_75kplus_train_073020
1,123
no_license
[ { "docstring": ":type n: int :rtype: bool", "name": "isHappy", "signature": "def isHappy(self, n)" }, { "docstring": ":type n: int :rtype: bool", "name": "isHappy2", "signature": "def isHappy2(self, n)" } ]
2
stack_v2_sparse_classes_30k_train_027124
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isHappy(self, n): :type n: int :rtype: bool - def isHappy2(self, n): :type n: int :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isHappy(self, n): :type n: int :rtype: bool - def isHappy2(self, n): :type n: int :rtype: bool <|skeleton|> class Solution: def isHappy(self, n): """:type n: in...
ac53dd9bf2c4c9d17c9dc5f7fdda32e386658fdd
<|skeleton|> class Solution: def isHappy(self, n): """:type n: int :rtype: bool""" <|body_0|> def isHappy2(self, n): """:type n: int :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def isHappy(self, n): """:type n: int :rtype: bool""" d = {i: i ** 2 for i in range(0, 10)} record = [n] while n != 1: new_n = 0 while n != 0: new_n += d[n % 10] n //= 10 if new_n in record: ...
the_stack_v2_python_sparse
random/happy_number.py
hwc1824/LeetCodeSolution
train
0
ad29a7a2706ac1cc9c52a7c09ebadcc8163ae510
[ "self.strategy = strategy\nif opponents is None:\n self.opponents = [axl.Random(p) for p in np.linspace(0, 1, number_of_opponents)]\nelse:\n self.opponents = opponents", "if isinstance(self.strategy, axl.Player):\n players = [self.strategy] + self.opponents\nelse:\n players = [self.strategy()] + self....
<|body_start_0|> self.strategy = strategy if opponents is None: self.opponents = [axl.Random(p) for p in np.linspace(0, 1, number_of_opponents)] else: self.opponents = opponents <|end_body_0|> <|body_start_1|> if isinstance(self.strategy, axl.Player): ...
TransitiveFingerprint
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TransitiveFingerprint: def __init__(self, strategy, opponents=None, number_of_opponents=50): """Parameters ---------- strategy : class or instance A class that must be descended from axelrod.Player or an instance of axelrod.Player. opponents : list of instances A list that contains a lis...
stack_v2_sparse_classes_75kplus_train_073021
20,808
permissive
[ { "docstring": "Parameters ---------- strategy : class or instance A class that must be descended from axelrod.Player or an instance of axelrod.Player. opponents : list of instances A list that contains a list of opponents Default: A spectrum of Random players number_of_opponents: int The number of Random oppon...
4
stack_v2_sparse_classes_30k_train_027082
Implement the Python class `TransitiveFingerprint` described below. Class description: Implement the TransitiveFingerprint class. Method signatures and docstrings: - def __init__(self, strategy, opponents=None, number_of_opponents=50): Parameters ---------- strategy : class or instance A class that must be descended ...
Implement the Python class `TransitiveFingerprint` described below. Class description: Implement the TransitiveFingerprint class. Method signatures and docstrings: - def __init__(self, strategy, opponents=None, number_of_opponents=50): Parameters ---------- strategy : class or instance A class that must be descended ...
fa748627cd4f0333bb2dbfcb1454372a78a9098a
<|skeleton|> class TransitiveFingerprint: def __init__(self, strategy, opponents=None, number_of_opponents=50): """Parameters ---------- strategy : class or instance A class that must be descended from axelrod.Player or an instance of axelrod.Player. opponents : list of instances A list that contains a lis...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TransitiveFingerprint: def __init__(self, strategy, opponents=None, number_of_opponents=50): """Parameters ---------- strategy : class or instance A class that must be descended from axelrod.Player or an instance of axelrod.Player. opponents : list of instances A list that contains a list of opponents...
the_stack_v2_python_sparse
axelrod/fingerprint.py
Axelrod-Python/Axelrod
train
673
774819ae7af583f56ac5f7ed21816ecefded6cba
[ "self.baseurl = 'https://www.billboard.com/charts/'\nself.URL = self.baseurl + URL\nself.soup = self.get_soup()\nself.chart = []\nself.chart_name = ''\nself.get_name_of_chart()\nself.get_chart()\nself.replace_symbols()", "response = requests.get(self.URL)\nsoup = BeautifulSoup(response.text, 'html.parser')\nretur...
<|body_start_0|> self.baseurl = 'https://www.billboard.com/charts/' self.URL = self.baseurl + URL self.soup = self.get_soup() self.chart = [] self.chart_name = '' self.get_name_of_chart() self.get_chart() self.replace_symbols() <|end_body_0|> <|body_start...
Class to store billboard charts.
BillboardIE
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BillboardIE: """Class to store billboard charts.""" def __init__(self, URL): """Initiate the basic stuff.""" <|body_0|> def get_soup(self): """Return the soup for the response.""" <|body_1|> def replace_symbols(self): """Replace symbols like ...
stack_v2_sparse_classes_75kplus_train_073022
5,227
permissive
[ { "docstring": "Initiate the basic stuff.", "name": "__init__", "signature": "def __init__(self, URL)" }, { "docstring": "Return the soup for the response.", "name": "get_soup", "signature": "def get_soup(self)" }, { "docstring": "Replace symbols like &amp with &", "name": "r...
5
stack_v2_sparse_classes_30k_train_018249
Implement the Python class `BillboardIE` described below. Class description: Class to store billboard charts. Method signatures and docstrings: - def __init__(self, URL): Initiate the basic stuff. - def get_soup(self): Return the soup for the response. - def replace_symbols(self): Replace symbols like &amp with & - d...
Implement the Python class `BillboardIE` described below. Class description: Class to store billboard charts. Method signatures and docstrings: - def __init__(self, URL): Initiate the basic stuff. - def get_soup(self): Return the soup for the response. - def replace_symbols(self): Replace symbols like &amp with & - d...
9050f0c5f9fef7b9c9b14a7f26a055684e260d4c
<|skeleton|> class BillboardIE: """Class to store billboard charts.""" def __init__(self, URL): """Initiate the basic stuff.""" <|body_0|> def get_soup(self): """Return the soup for the response.""" <|body_1|> def replace_symbols(self): """Replace symbols like ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BillboardIE: """Class to store billboard charts.""" def __init__(self, URL): """Initiate the basic stuff.""" self.baseurl = 'https://www.billboard.com/charts/' self.URL = self.baseurl + URL self.soup = self.get_soup() self.chart = [] self.chart_name = '' ...
the_stack_v2_python_sparse
playx/playlist/billboard.py
NISH1001/playx
train
229
a9ae5737be86447d65aa330a9d86e17a84683af3
[ "user = self.ss.get_user()\ngroups = list(self.gs.list(user))\nreturn groups", "v = Validator(group_schema)\nargs = v.validated(request.get_json())\nif args is None:\n return ApiResponse(status=4001, errors=v.errors)\nname = args.get(u'name')\ndescription = args.get(u'description', u'')\nuser = self.ss.get_use...
<|body_start_0|> user = self.ss.get_user() groups = list(self.gs.list(user)) return groups <|end_body_0|> <|body_start_1|> v = Validator(group_schema) args = v.validated(request.get_json()) if args is None: return ApiResponse(status=4001, errors=v.errors) ...
GroupsAPI
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GroupsAPI: def get(self): """Return groups by user. :return:""" <|body_0|> def post(self): """Create new group :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> user = self.ss.get_user() groups = list(self.gs.list(user)) retur...
stack_v2_sparse_classes_75kplus_train_073023
3,884
permissive
[ { "docstring": "Return groups by user. :return:", "name": "get", "signature": "def get(self)" }, { "docstring": "Create new group :return:", "name": "post", "signature": "def post(self)" } ]
2
stack_v2_sparse_classes_30k_train_021755
Implement the Python class `GroupsAPI` described below. Class description: Implement the GroupsAPI class. Method signatures and docstrings: - def get(self): Return groups by user. :return: - def post(self): Create new group :return:
Implement the Python class `GroupsAPI` described below. Class description: Implement the GroupsAPI class. Method signatures and docstrings: - def get(self): Return groups by user. :return: - def post(self): Create new group :return: <|skeleton|> class GroupsAPI: def get(self): """Return groups by user. ...
9a336d1e467d08c6b3875bd8b83dea0dc3b9236d
<|skeleton|> class GroupsAPI: def get(self): """Return groups by user. :return:""" <|body_0|> def post(self): """Create new group :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GroupsAPI: def get(self): """Return groups by user. :return:""" user = self.ss.get_user() groups = list(self.gs.list(user)) return groups def post(self): """Create new group :return:""" v = Validator(group_schema) args = v.validated(request.get_json...
the_stack_v2_python_sparse
we-web/api/resources/groups/groups.py
avatar29A/wordeater-web
train
0
fbb76fddb17bdf935ccb515f2bad2025f2391a9e
[ "self.comm = comm\nself.model = model\nself.auto_copy = auto_copy\nif auto_copy:\n self.copy_aero_mesh()\nreturn", "for body in self.model.bodies:\n aero_id = np.arange(1, body.get_num_struct_nodes() + 1)\n body.initialize_aero_nodes(body.struct_X, aero_id)\nreturn self" ]
<|body_start_0|> self.comm = comm self.model = model self.auto_copy = auto_copy if auto_copy: self.copy_aero_mesh() return <|end_body_0|> <|body_start_1|> for body in self.model.bodies: aero_id = np.arange(1, body.get_num_struct_nodes() + 1) ...
NullAerodynamicSolver
[ "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NullAerodynamicSolver: def __init__(self, comm, model, auto_copy=False): """This class provides the functionality that FUNtoFEM expects from an aerodynamic solver, except no aerodynamics is performed here. All solver interface routines we just do nothing and those methods come from the s...
stack_v2_sparse_classes_75kplus_train_073024
45,431
permissive
[ { "docstring": "This class provides the functionality that FUNtoFEM expects from an aerodynamic solver, except no aerodynamics is performed here. All solver interface routines we just do nothing and those methods come from the super class SolverInterface Parameters ---------- comm: MPI.comm MPI communicator mod...
2
stack_v2_sparse_classes_30k_val_001356
Implement the Python class `NullAerodynamicSolver` described below. Class description: Implement the NullAerodynamicSolver class. Method signatures and docstrings: - def __init__(self, comm, model, auto_copy=False): This class provides the functionality that FUNtoFEM expects from an aerodynamic solver, except no aero...
Implement the Python class `NullAerodynamicSolver` described below. Class description: Implement the NullAerodynamicSolver class. Method signatures and docstrings: - def __init__(self, comm, model, auto_copy=False): This class provides the functionality that FUNtoFEM expects from an aerodynamic solver, except no aero...
4c11b61397100f9d8b455f7d20cf3b507a15c1e9
<|skeleton|> class NullAerodynamicSolver: def __init__(self, comm, model, auto_copy=False): """This class provides the functionality that FUNtoFEM expects from an aerodynamic solver, except no aerodynamics is performed here. All solver interface routines we just do nothing and those methods come from the s...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NullAerodynamicSolver: def __init__(self, comm, model, auto_copy=False): """This class provides the functionality that FUNtoFEM expects from an aerodynamic solver, except no aerodynamics is performed here. All solver interface routines we just do nothing and those methods come from the super class Sol...
the_stack_v2_python_sparse
funtofem/interface/test_solver.py
gjkennedy/funtofem
train
0
c8ab4efd3f76e2b0359f75a4be966b6860ce7052
[ "if len(s) < len(p):\n return\nret = []\nwindow_length = len(p)\ntarget = list(p)\ntarget.sort()\nfor i in range(len(s) - len(p) + 1):\n buffer = list(s[i:window_length])\n buffer.sort()\n if buffer == target:\n ret.append(i)\nreturn ret", "length_s = len(s)\nlength_p = len(p)\nif length_p > le...
<|body_start_0|> if len(s) < len(p): return ret = [] window_length = len(p) target = list(p) target.sort() for i in range(len(s) - len(p) + 1): buffer = list(s[i:window_length]) buffer.sort() if buffer == target: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findAnagrams1(self, s, p): """:type s: str :type p: str :rtype: List[int]""" <|body_0|> def findAnagrams(self, s, p): """:type s: str :type p: str :rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|> if len(s) < len(p): ...
stack_v2_sparse_classes_75kplus_train_073025
1,402
no_license
[ { "docstring": ":type s: str :type p: str :rtype: List[int]", "name": "findAnagrams1", "signature": "def findAnagrams1(self, s, p)" }, { "docstring": ":type s: str :type p: str :rtype: List[int]", "name": "findAnagrams", "signature": "def findAnagrams(self, s, p)" } ]
2
stack_v2_sparse_classes_30k_train_045957
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findAnagrams1(self, s, p): :type s: str :type p: str :rtype: List[int] - def findAnagrams(self, s, p): :type s: str :type p: str :rtype: List[int]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findAnagrams1(self, s, p): :type s: str :type p: str :rtype: List[int] - def findAnagrams(self, s, p): :type s: str :type p: str :rtype: List[int] <|skeleton|> class Solutio...
70bdd75b6af2e1811c1beab22050c01d28d7373e
<|skeleton|> class Solution: def findAnagrams1(self, s, p): """:type s: str :type p: str :rtype: List[int]""" <|body_0|> def findAnagrams(self, s, p): """:type s: str :type p: str :rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def findAnagrams1(self, s, p): """:type s: str :type p: str :rtype: List[int]""" if len(s) < len(p): return ret = [] window_length = len(p) target = list(p) target.sort() for i in range(len(s) - len(p) + 1): buffer = lis...
the_stack_v2_python_sparse
python/leetcode/438_Find_All_Anagrams_in_a_String.py
bobcaoge/my-code
train
0
a388a3252656e046f945c827b53f38990382404e
[ "def encode_extra_types(obj):\n \"\"\"MessagePack hook to serialize extra types.\n\n The recipe took from the MessagePack for Python docs:\n https://github.com/msgpack/msgpack-python#packingunpacking-of-custom-data-type\n\n Supported types:\n - Django models (through `...
<|body_start_0|> def encode_extra_types(obj): """MessagePack hook to serialize extra types. The recipe took from the MessagePack for Python docs: https://github.com/msgpack/msgpack-python#packingunpacking-of-custom-data-type Supported typ...
Serialize/deserialize Python collection with Django models. Serialize/deserialize the data with the MessagePack like Redis Channels layer backend does. If `data` contains Django models, then it is serialized by the Django serialization utilities. For details see: Django serialization: https://docs.djangoproject.com/en/...
Serializer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Serializer: """Serialize/deserialize Python collection with Django models. Serialize/deserialize the data with the MessagePack like Redis Channels layer backend does. If `data` contains Django models, then it is serialized by the Django serialization utilities. For details see: Django serializati...
stack_v2_sparse_classes_75kplus_train_073026
3,850
permissive
[ { "docstring": "Serialize the `data`.", "name": "serialize", "signature": "def serialize(data)" }, { "docstring": "Deserialize the `data`.", "name": "deserialize", "signature": "def deserialize(data)" } ]
2
stack_v2_sparse_classes_30k_train_027509
Implement the Python class `Serializer` described below. Class description: Serialize/deserialize Python collection with Django models. Serialize/deserialize the data with the MessagePack like Redis Channels layer backend does. If `data` contains Django models, then it is serialized by the Django serialization utiliti...
Implement the Python class `Serializer` described below. Class description: Serialize/deserialize Python collection with Django models. Serialize/deserialize the data with the MessagePack like Redis Channels layer backend does. If `data` contains Django models, then it is serialized by the Django serialization utiliti...
09a2ffdde45a1553abd09b5b3e595402b6e6c9b1
<|skeleton|> class Serializer: """Serialize/deserialize Python collection with Django models. Serialize/deserialize the data with the MessagePack like Redis Channels layer backend does. If `data` contains Django models, then it is serialized by the Django serialization utilities. For details see: Django serializati...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Serializer: """Serialize/deserialize Python collection with Django models. Serialize/deserialize the data with the MessagePack like Redis Channels layer backend does. If `data` contains Django models, then it is serialized by the Django serialization utilities. For details see: Django serialization: https://d...
the_stack_v2_python_sparse
channels_graphql_ws/serializer.py
datadvance/DjangoChannelsGraphqlWs
train
295
a3fd91ef3ced8014301729403870f10640184137
[ "global _modelInstances\nif not model in _modelInstances['core']:\n _instantiateCoreModel(model)\nreturn _modelInstances['core'][model]", "global _modelInstances\nif not plugin in _modelInstances:\n _modelInstances[plugin] = {}\nif not model in _modelInstances[plugin]:\n _instantiatePluginModel(model, pl...
<|body_start_0|> global _modelInstances if not model in _modelInstances['core']: _instantiateCoreModel(model) return _modelInstances['core'][model] <|end_body_0|> <|body_start_1|> global _modelInstances if not plugin in _modelInstances: _modelInstances[pl...
Any class that wants to have convenient model importing semantics should extend/mixin this class.
ModelImporter
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ModelImporter: """Any class that wants to have convenient model importing semantics should extend/mixin this class.""" def model(self, model): """Call this to get the instance of the specified core model. It will be lazy-instantiated. :param model: The name of the model to get. This ...
stack_v2_sparse_classes_75kplus_train_073027
4,050
permissive
[ { "docstring": "Call this to get the instance of the specified core model. It will be lazy-instantiated. :param model: The name of the model to get. This is the module name, e.g. \"folder\". The class name must be the upper-camelcased version of that module name, e.g. \"Folder\". :type model: string :returns: T...
2
stack_v2_sparse_classes_30k_train_031056
Implement the Python class `ModelImporter` described below. Class description: Any class that wants to have convenient model importing semantics should extend/mixin this class. Method signatures and docstrings: - def model(self, model): Call this to get the instance of the specified core model. It will be lazy-instan...
Implement the Python class `ModelImporter` described below. Class description: Any class that wants to have convenient model importing semantics should extend/mixin this class. Method signatures and docstrings: - def model(self, model): Call this to get the instance of the specified core model. It will be lazy-instan...
7638feab8e36da59f3d211e5a62e625551841230
<|skeleton|> class ModelImporter: """Any class that wants to have convenient model importing semantics should extend/mixin this class.""" def model(self, model): """Call this to get the instance of the specified core model. It will be lazy-instantiated. :param model: The name of the model to get. This ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ModelImporter: """Any class that wants to have convenient model importing semantics should extend/mixin this class.""" def model(self, model): """Call this to get the instance of the specified core model. It will be lazy-instantiated. :param model: The name of the model to get. This is the module...
the_stack_v2_python_sparse
girder/utility/model_importer.py
ecohealthalliance/girder
train
0
f38e175a330a0268d8c662c990eb0a69c70571b0
[ "super().__init__()\nself.eps = torch.nn.Parameter(torch.as_tensor(seqm_parameters['scf_eps']), requires_grad=False)\nself.sp2 = seqm_parameters['sp2']\nself.scf_converger = seqm_parameters['scf_converger']\nif 'eig' in seqm_parameters:\n self.eig = seqm_parameters['eig']\nelse:\n self.eig = False\nif 'scf_ba...
<|body_start_0|> super().__init__() self.eps = torch.nn.Parameter(torch.as_tensor(seqm_parameters['scf_eps']), requires_grad=False) self.sp2 = seqm_parameters['sp2'] self.scf_converger = seqm_parameters['scf_converger'] if 'eig' in seqm_parameters: self.eig = seqm_par...
build the Hamiltonian
Hamiltonian
[ "MIT", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Hamiltonian: """build the Hamiltonian""" def __init__(self, seqm_parameters): """Constructor""" <|body_0|> def forward(self, const, molsize, nHeavy, nHydro, nocc, Z, maskd, mask, atom_molid, pair_molid, idxi, idxj, ni, nj, xij, rij, parameters, P0=None): """SCF l...
stack_v2_sparse_classes_75kplus_train_073028
17,243
permissive
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, seqm_parameters)" }, { "docstring": "SCF loop const : Constants instance molsize : maximal number of atoms in each molecule nHeavy : number of heavy atoms in each molecule, shape (nmol,) nmol: number of molecules ...
2
stack_v2_sparse_classes_30k_train_015386
Implement the Python class `Hamiltonian` described below. Class description: build the Hamiltonian Method signatures and docstrings: - def __init__(self, seqm_parameters): Constructor - def forward(self, const, molsize, nHeavy, nHydro, nocc, Z, maskd, mask, atom_molid, pair_molid, idxi, idxj, ni, nj, xij, rij, parame...
Implement the Python class `Hamiltonian` described below. Class description: build the Hamiltonian Method signatures and docstrings: - def __init__(self, seqm_parameters): Constructor - def forward(self, const, molsize, nHeavy, nHydro, nocc, Z, maskd, mask, atom_molid, pair_molid, idxi, idxj, ni, nj, xij, rij, parame...
dfda08400bb1328ce6cd45ac6b1dd3e7f9d7d4a6
<|skeleton|> class Hamiltonian: """build the Hamiltonian""" def __init__(self, seqm_parameters): """Constructor""" <|body_0|> def forward(self, const, molsize, nHeavy, nHydro, nocc, Z, maskd, mask, atom_molid, pair_molid, idxi, idxj, ni, nj, xij, rij, parameters, P0=None): """SCF l...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Hamiltonian: """build the Hamiltonian""" def __init__(self, seqm_parameters): """Constructor""" super().__init__() self.eps = torch.nn.Parameter(torch.as_tensor(seqm_parameters['scf_eps']), requires_grad=False) self.sp2 = seqm_parameters['sp2'] self.scf_converger =...
the_stack_v2_python_sparse
PYSEQM/seqm/basics.py
roehr-lab/SFast-Singlet-Fission-adiabatic-basis-screening
train
2
cad77d75194aecad1a6f49f435f64f955baf7351
[ "self.sock = sock\nself.db_lock = database_lock\nsuper().__init__()", "main_commands.print_help()\nwhile True:\n command = input('Введите команду: ')\n if not main_commands.run(command, self):\n print('Команда не распознана. help - вывести поддерживаемые команды.')", "if event == settings.get('even...
<|body_start_0|> self.sock = sock self.db_lock = database_lock super().__init__() <|end_body_0|> <|body_start_1|> main_commands.print_help() while True: command = input('Введите команду: ') if not main_commands.run(command, self): print('К...
Класс формировки и отправки сообщений на сервер и взаимодействия с пользователем.
ClientSender
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClientSender: """Класс формировки и отправки сообщений на сервер и взаимодействия с пользователем.""" def __init__(self, sock): """Инициализация. Args: sock: сокет для работы миксина""" <|body_0|> def run(self): """Функция взаимодействия с пользователем, запрашив...
stack_v2_sparse_classes_75kplus_train_073029
14,995
permissive
[ { "docstring": "Инициализация. Args: sock: сокет для работы миксина", "name": "__init__", "signature": "def __init__(self, sock)" }, { "docstring": "Функция взаимодействия с пользователем, запрашивает команды, отправляет сообщения.", "name": "run", "signature": "def run(self)" }, { ...
3
stack_v2_sparse_classes_30k_val_002785
Implement the Python class `ClientSender` described below. Class description: Класс формировки и отправки сообщений на сервер и взаимодействия с пользователем. Method signatures and docstrings: - def __init__(self, sock): Инициализация. Args: sock: сокет для работы миксина - def run(self): Функция взаимодействия с по...
Implement the Python class `ClientSender` described below. Class description: Класс формировки и отправки сообщений на сервер и взаимодействия с пользователем. Method signatures and docstrings: - def __init__(self, sock): Инициализация. Args: sock: сокет для работы миксина - def run(self): Функция взаимодействия с по...
d83fe60bc20535adb969d72f52aaca5cf4b00c6b
<|skeleton|> class ClientSender: """Класс формировки и отправки сообщений на сервер и взаимодействия с пользователем.""" def __init__(self, sock): """Инициализация. Args: sock: сокет для работы миксина""" <|body_0|> def run(self): """Функция взаимодействия с пользователем, запрашив...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ClientSender: """Класс формировки и отправки сообщений на сервер и взаимодействия с пользователем.""" def __init__(self, sock): """Инициализация. Args: sock: сокет для работы миксина""" self.sock = sock self.db_lock = database_lock super().__init__() def run(self): ...
the_stack_v2_python_sparse
talkative_client/talkative_client/core.py
mom1/messager
train
0
2bc532086adf661bb286f7ea080cf6021e120ad0
[ "if not self.versions:\n return ''\nif language is None:\n try:\n language = c.lang\n except AttributeError:\n pass\nversion = self.get_version(language)\nif version is not None:\n return version.text\nversion = self.get_version(fallback)\nif version is not None:\n return version.text\n...
<|body_start_0|> if not self.versions: return '' if language is None: try: language = c.lang except AttributeError: pass version = self.get_version(language) if version is not None: return version.text ...
I18nText
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class I18nText: def get_text(self, language=None, fallback='en'): """Get a text for a given language. If no language is specified, attempts to get it from context. Falls back to the given language or any other version. Returns empty string if no text is found.""" <|body_0|> def se...
stack_v2_sparse_classes_75kplus_train_073030
5,283
no_license
[ { "docstring": "Get a text for a given language. If no language is specified, attempts to get it from context. Falls back to the given language or any other version. Returns empty string if no text is found.", "name": "get_text", "signature": "def get_text(self, language=None, fallback='en')" }, { ...
3
stack_v2_sparse_classes_30k_train_011401
Implement the Python class `I18nText` described below. Class description: Implement the I18nText class. Method signatures and docstrings: - def get_text(self, language=None, fallback='en'): Get a text for a given language. If no language is specified, attempts to get it from context. Falls back to the given language ...
Implement the Python class `I18nText` described below. Class description: Implement the I18nText class. Method signatures and docstrings: - def get_text(self, language=None, fallback='en'): Get a text for a given language. If no language is specified, attempts to get it from context. Falls back to the given language ...
e1f55f155761d7b350893fc0badb70c9c51c4b2f
<|skeleton|> class I18nText: def get_text(self, language=None, fallback='en'): """Get a text for a given language. If no language is specified, attempts to get it from context. Falls back to the given language or any other version. Returns empty string if no text is found.""" <|body_0|> def se...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class I18nText: def get_text(self, language=None, fallback='en'): """Get a text for a given language. If no language is specified, attempts to get it from context. Falls back to the given language or any other version. Returns empty string if no text is found.""" if not self.versions: re...
the_stack_v2_python_sparse
src/ututi/model/i18n.py
Ututi/ututi
train
0
6fd1dbbaca8dc84007b0cecde498aff826d53f26
[ "m, _ = torch.max(input, dim=1, keepdim=True)\ny = input - m\ny = torch.exp(y)\ny_cumsum_t2h = torch.flip(torch.cumsum(torch.flip(y, dims=[1]), dim=1), dims=[1])\nfd_output = torch.log(y_cumsum_t2h) + m\nctx.save_for_backward(input, fd_output)\nreturn fd_output", "input, fd_output = ctx.saved_tensors\nbk_output =...
<|body_start_0|> m, _ = torch.max(input, dim=1, keepdim=True) y = input - m y = torch.exp(y) y_cumsum_t2h = torch.flip(torch.cumsum(torch.flip(y, dims=[1]), dim=1), dims=[1]) fd_output = torch.log(y_cumsum_t2h) + m ctx.save_for_backward(input, fd_output) return fd...
LogCumsumExp
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LogCumsumExp: def forward(ctx, input): """In the forward pass we receive a context object and a Tensor containing the input; we must return a Tensor containing the output, and we can use the context object to cache objects for use in the backward pass. Specifically, ctx is a context obje...
stack_v2_sparse_classes_75kplus_train_073031
12,276
permissive
[ { "docstring": "In the forward pass we receive a context object and a Tensor containing the input; we must return a Tensor containing the output, and we can use the context object to cache objects for use in the backward pass. Specifically, ctx is a context object that can be used to stash information for backw...
2
stack_v2_sparse_classes_30k_train_045688
Implement the Python class `LogCumsumExp` described below. Class description: Implement the LogCumsumExp class. Method signatures and docstrings: - def forward(ctx, input): In the forward pass we receive a context object and a Tensor containing the input; we must return a Tensor containing the output, and we can use ...
Implement the Python class `LogCumsumExp` described below. Class description: Implement the LogCumsumExp class. Method signatures and docstrings: - def forward(ctx, input): In the forward pass we receive a context object and a Tensor containing the input; we must return a Tensor containing the output, and we can use ...
4d56d5174c7ce4b15157d112083eb92e57288b04
<|skeleton|> class LogCumsumExp: def forward(ctx, input): """In the forward pass we receive a context object and a Tensor containing the input; we must return a Tensor containing the output, and we can use the context object to cache objects for use in the backward pass. Specifically, ctx is a context obje...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LogCumsumExp: def forward(ctx, input): """In the forward pass we receive a context object and a Tensor containing the input; we must return a Tensor containing the output, and we can use the context object to cache objects for use in the backward pass. Specifically, ctx is a context object that can be...
the_stack_v2_python_sparse
MultiDCP/models/loss_utils.py
qiaoliuhub/MultiDCP
train
3
8898b853696f7e96f1860bd7e80f846e10f1b7ef
[ "try:\n cid = ObjectId(comment_id)\nexcept Exception as e:\n LOGGER.exception(e)\n return ({'message': str(e)}, 400)\ndocument = model.Comment.find_one(id=cid)\nif document is None:\n LOGGER.exception('Error getting comment. Comment %s does not exist.', comment_id)\n return ({'message': 'Comment {} d...
<|body_start_0|> try: cid = ObjectId(comment_id) except Exception as e: LOGGER.exception(e) return ({'message': str(e)}, 400) document = model.Comment.find_one(id=cid) if document is None: LOGGER.exception('Error getting comment. Comment %s...
Comment
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Comment: def get(self, comment_id): """@api {get} /comments/:comment_id/ Get comment by ID @apiName GetComment @apiGroup Comment @apiVersion 1.0.0 @apiParam {String} comment_id Comment ID. @apiSuccess {String} id Comment ID. @apiSuccess {String} event Event ID. @apiSuccess {String} text ...
stack_v2_sparse_classes_75kplus_train_073032
6,603
permissive
[ { "docstring": "@api {get} /comments/:comment_id/ Get comment by ID @apiName GetComment @apiGroup Comment @apiVersion 1.0.0 @apiParam {String} comment_id Comment ID. @apiSuccess {String} id Comment ID. @apiSuccess {String} event Event ID. @apiSuccess {String} text Comment content. @apiSuccess {String} created_b...
2
stack_v2_sparse_classes_30k_train_034447
Implement the Python class `Comment` described below. Class description: Implement the Comment class. Method signatures and docstrings: - def get(self, comment_id): @api {get} /comments/:comment_id/ Get comment by ID @apiName GetComment @apiGroup Comment @apiVersion 1.0.0 @apiParam {String} comment_id Comment ID. @ap...
Implement the Python class `Comment` described below. Class description: Implement the Comment class. Method signatures and docstrings: - def get(self, comment_id): @api {get} /comments/:comment_id/ Get comment by ID @apiName GetComment @apiGroup Comment @apiVersion 1.0.0 @apiParam {String} comment_id Comment ID. @ap...
9d85e592d9e9e998ef7de458034f36186105d027
<|skeleton|> class Comment: def get(self, comment_id): """@api {get} /comments/:comment_id/ Get comment by ID @apiName GetComment @apiGroup Comment @apiVersion 1.0.0 @apiParam {String} comment_id Comment ID. @apiSuccess {String} id Comment ID. @apiSuccess {String} event Event ID. @apiSuccess {String} text ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Comment: def get(self, comment_id): """@api {get} /comments/:comment_id/ Get comment by ID @apiName GetComment @apiGroup Comment @apiVersion 1.0.0 @apiParam {String} comment_id Comment ID. @apiSuccess {String} id Comment ID. @apiSuccess {String} event Event ID. @apiSuccess {String} text Comment conten...
the_stack_v2_python_sparse
mtv/resources/comment.py
dyuliu/MTV
train
3
0504df65a3bc42e0875a61d81ab44bb65e4eb089
[ "Thread.__init__(self)\nself.name = name\nself.dice = dice.Dice()", "print(self.name + ' has started...')\nself.dice.roll_dice()\nprint(self.name + ' has rolled ' + str(self.dice.face) + '.')" ]
<|body_start_0|> Thread.__init__(self) self.name = name self.dice = dice.Dice() <|end_body_0|> <|body_start_1|> print(self.name + ' has started...') self.dice.roll_dice() print(self.name + ' has rolled ' + str(self.dice.face) + '.') <|end_body_1|>
Thread which rolls a dice.
ThreadDice
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ThreadDice: """Thread which rolls a dice.""" def __init__(self, name): """Constructor of the dice thread.""" <|body_0|> def run(self): """Method which rolls and prints the dice.""" <|body_1|> <|end_skeleton|> <|body_start_0|> Thread.__init__(sel...
stack_v2_sparse_classes_75kplus_train_073033
634
no_license
[ { "docstring": "Constructor of the dice thread.", "name": "__init__", "signature": "def __init__(self, name)" }, { "docstring": "Method which rolls and prints the dice.", "name": "run", "signature": "def run(self)" } ]
2
null
Implement the Python class `ThreadDice` described below. Class description: Thread which rolls a dice. Method signatures and docstrings: - def __init__(self, name): Constructor of the dice thread. - def run(self): Method which rolls and prints the dice.
Implement the Python class `ThreadDice` described below. Class description: Thread which rolls a dice. Method signatures and docstrings: - def __init__(self, name): Constructor of the dice thread. - def run(self): Method which rolls and prints the dice. <|skeleton|> class ThreadDice: """Thread which rolls a dice...
7b3c92c151266cd3ccdd63e7dc0a37f7a60476fa
<|skeleton|> class ThreadDice: """Thread which rolls a dice.""" def __init__(self, name): """Constructor of the dice thread.""" <|body_0|> def run(self): """Method which rolls and prints the dice.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ThreadDice: """Thread which rolls a dice.""" def __init__(self, name): """Constructor of the dice thread.""" Thread.__init__(self) self.name = name self.dice = dice.Dice() def run(self): """Method which rolls and prints the dice.""" print(self.name + '...
the_stack_v2_python_sparse
Laboratory 8/problem2/thread.py
BabyCakes13/Python-Treasure
train
0
a9087b65716883c808ef5cf054a9efd232692fe0
[ "super().__init__(grad=grad)\nself.add_background = add_background\nself.seg_key = seg_key if seg_key is not None else instance_key\nself.map_key = map_key\nself.instance_key = instance_key\nself.present_instances = present_instances", "semantic = torch.zeros_like(data[self.instance_key])\n_present_instances = da...
<|body_start_0|> super().__init__(grad=grad) self.add_background = add_background self.seg_key = seg_key if seg_key is not None else instance_key self.map_key = map_key self.instance_key = instance_key self.present_instances = present_instances <|end_body_0|> <|body_star...
Instances2Segmentation
[ "BSD-3-Clause", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Instances2Segmentation: def __init__(self, instance_key: str, map_key: str, seg_key: str=None, add_background: bool=True, grad: bool=False, present_instances: Optional[str]=None): """Convert instances to semantic segmentation Args: instance_key: key where instance segmentation is located...
stack_v2_sparse_classes_75kplus_train_073034
12,908
permissive
[ { "docstring": "Convert instances to semantic segmentation Args: instance_key: key where instance segmentation is located map_key: key where mapping from instances to classes is located seg_key: key where segmentation should be saved; If None, the instance key will be overwritten add_background: adds +1 to clas...
2
stack_v2_sparse_classes_30k_train_004224
Implement the Python class `Instances2Segmentation` described below. Class description: Implement the Instances2Segmentation class. Method signatures and docstrings: - def __init__(self, instance_key: str, map_key: str, seg_key: str=None, add_background: bool=True, grad: bool=False, present_instances: Optional[str]=N...
Implement the Python class `Instances2Segmentation` described below. Class description: Implement the Instances2Segmentation class. Method signatures and docstrings: - def __init__(self, instance_key: str, map_key: str, seg_key: str=None, add_background: bool=True, grad: bool=False, present_instances: Optional[str]=N...
4f41faa7536dcef8fca7b647dcdca25360e5b58a
<|skeleton|> class Instances2Segmentation: def __init__(self, instance_key: str, map_key: str, seg_key: str=None, add_background: bool=True, grad: bool=False, present_instances: Optional[str]=None): """Convert instances to semantic segmentation Args: instance_key: key where instance segmentation is located...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Instances2Segmentation: def __init__(self, instance_key: str, map_key: str, seg_key: str=None, add_background: bool=True, grad: bool=False, present_instances: Optional[str]=None): """Convert instances to semantic segmentation Args: instance_key: key where instance segmentation is located map_key: key ...
the_stack_v2_python_sparse
nndet/io/transforms/instances.py
dboun/nnDetection
train
1
1c6315bf1ee497701ab03a0319aa9cf1024b13f0
[ "url = '/dashboard/moorings/'\nresponse = self.client.get(url, HTTP_HOST='website.domain')\nself.assertEqual(response.status_code, 302)", "url = '/dashboard/moorings/'\nself.client.login(username=self.adminUN, password='pass')\nresponse = self.client.get(url, HTTP_HOST='website.domain')\nself.assertEqual(response...
<|body_start_0|> url = '/dashboard/moorings/' response = self.client.get(url, HTTP_HOST='website.domain') self.assertEqual(response.status_code, 302) <|end_body_0|> <|body_start_1|> url = '/dashboard/moorings/' self.client.login(username=self.adminUN, password='pass') re...
DashboardMooringsTestCase
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DashboardMooringsTestCase: def test_not_logged_in(self): """Test that the dashboard moorings view will redirect whilst not logged in.""" <|body_0|> def test_logged_in_admin(self): """Test that the dashboard moorings view will load whilst logged in as admin.""" ...
stack_v2_sparse_classes_75kplus_train_073035
26,818
permissive
[ { "docstring": "Test that the dashboard moorings view will redirect whilst not logged in.", "name": "test_not_logged_in", "signature": "def test_not_logged_in(self)" }, { "docstring": "Test that the dashboard moorings view will load whilst logged in as admin.", "name": "test_logged_in_admin"...
3
stack_v2_sparse_classes_30k_train_039021
Implement the Python class `DashboardMooringsTestCase` described below. Class description: Implement the DashboardMooringsTestCase class. Method signatures and docstrings: - def test_not_logged_in(self): Test that the dashboard moorings view will redirect whilst not logged in. - def test_logged_in_admin(self): Test t...
Implement the Python class `DashboardMooringsTestCase` described below. Class description: Implement the DashboardMooringsTestCase class. Method signatures and docstrings: - def test_not_logged_in(self): Test that the dashboard moorings view will redirect whilst not logged in. - def test_logged_in_admin(self): Test t...
37d2942efcbdaad072f7a06ac876a40e0f69f702
<|skeleton|> class DashboardMooringsTestCase: def test_not_logged_in(self): """Test that the dashboard moorings view will redirect whilst not logged in.""" <|body_0|> def test_logged_in_admin(self): """Test that the dashboard moorings view will load whilst logged in as admin.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DashboardMooringsTestCase: def test_not_logged_in(self): """Test that the dashboard moorings view will redirect whilst not logged in.""" url = '/dashboard/moorings/' response = self.client.get(url, HTTP_HOST='website.domain') self.assertEqual(response.status_code, 302) def...
the_stack_v2_python_sparse
mooring/test_views.py
dbca-wa/moorings
train
0
c36710aa670ef1aad0851c4a9e4d5254a3646b32
[ "pg_list = []\nnetwork_sys = client_object.get_network_system()\nfor pg in network_sys.networkInfo.portgroup:\n pg_list.append(pg.spec.name)\nreturn pg_list", "host_mor = client_object.get_host_mor()\nnetwork_folder = host_mor.parent.parent.parent.networkFolder\nfor component in network_folder.childEntity:\n ...
<|body_start_0|> pg_list = [] network_sys = client_object.get_network_system() for pg in network_sys.networkInfo.portgroup: pg_list.append(pg.spec.name) return pg_list <|end_body_0|> <|body_start_1|> host_mor = client_object.get_host_mor() network_folder = ho...
Network related operations.
ESX55NetworkImpl
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ESX55NetworkImpl: """Network related operations.""" def list_networks(cls, client_object): """Returns the list of port groups. @type client_object: client instance @param client_object: Hypervisor client instance @rtype: list @return: List of port groups.""" <|body_0|> d...
stack_v2_sparse_classes_75kplus_train_073036
1,942
no_license
[ { "docstring": "Returns the list of port groups. @type client_object: client instance @param client_object: Hypervisor client instance @rtype: list @return: List of port groups.", "name": "list_networks", "signature": "def list_networks(cls, client_object)" }, { "docstring": "Returns the ID(key)...
2
stack_v2_sparse_classes_30k_train_032444
Implement the Python class `ESX55NetworkImpl` described below. Class description: Network related operations. Method signatures and docstrings: - def list_networks(cls, client_object): Returns the list of port groups. @type client_object: client instance @param client_object: Hypervisor client instance @rtype: list @...
Implement the Python class `ESX55NetworkImpl` described below. Class description: Network related operations. Method signatures and docstrings: - def list_networks(cls, client_object): Returns the list of port groups. @type client_object: client instance @param client_object: Hypervisor client instance @rtype: list @...
5b55817c050b637e2747084290f6206d2e622938
<|skeleton|> class ESX55NetworkImpl: """Network related operations.""" def list_networks(cls, client_object): """Returns the list of port groups. @type client_object: client instance @param client_object: Hypervisor client instance @rtype: list @return: List of port groups.""" <|body_0|> d...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ESX55NetworkImpl: """Network related operations.""" def list_networks(cls, client_object): """Returns the list of port groups. @type client_object: client instance @param client_object: Hypervisor client instance @rtype: list @return: List of port groups.""" pg_list = [] network_s...
the_stack_v2_python_sparse
SystemTesting/pylib/vmware/vsphere/esx/api/esx55_network_impl.py
Cloudxtreme/MyProject
train
0
913c0fd29ef3b2b73a91befa2ad32ac046e6108f
[ "WidgetBase.__init__(self, master)\nself.__populate()\nself.__bindKeys()", "self.buttons = [Tk.Button(self, width=2, height=2, text='7', command=lambda: self.triggerEvent('NumberPadClick-7')), Tk.Button(self, width=2, height=2, text='8', command=lambda: self.triggerEvent('NumberPadClick-8')), Tk.Button(self, widt...
<|body_start_0|> WidgetBase.__init__(self, master) self.__populate() self.__bindKeys() <|end_body_0|> <|body_start_1|> self.buttons = [Tk.Button(self, width=2, height=2, text='7', command=lambda: self.triggerEvent('NumberPadClick-7')), Tk.Button(self, width=2, height=2, text='8', comman...
NumberPad
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumberPad: def __init__(self, master=None): """Creates a standard number pad""" <|body_0|> def __populate(self): """Create the Number Pad""" <|body_1|> def __bindKeys(self): """Bind the keys""" <|body_2|> <|end_skeleton|> <|body_start_0...
stack_v2_sparse_classes_75kplus_train_073037
10,445
no_license
[ { "docstring": "Creates a standard number pad", "name": "__init__", "signature": "def __init__(self, master=None)" }, { "docstring": "Create the Number Pad", "name": "__populate", "signature": "def __populate(self)" }, { "docstring": "Bind the keys", "name": "__bindKeys", ...
3
stack_v2_sparse_classes_30k_train_013423
Implement the Python class `NumberPad` described below. Class description: Implement the NumberPad class. Method signatures and docstrings: - def __init__(self, master=None): Creates a standard number pad - def __populate(self): Create the Number Pad - def __bindKeys(self): Bind the keys
Implement the Python class `NumberPad` described below. Class description: Implement the NumberPad class. Method signatures and docstrings: - def __init__(self, master=None): Creates a standard number pad - def __populate(self): Create the Number Pad - def __bindKeys(self): Bind the keys <|skeleton|> class NumberPad...
d12900acb5354956579fc3375b35e18467b37da5
<|skeleton|> class NumberPad: def __init__(self, master=None): """Creates a standard number pad""" <|body_0|> def __populate(self): """Create the Number Pad""" <|body_1|> def __bindKeys(self): """Bind the keys""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NumberPad: def __init__(self, master=None): """Creates a standard number pad""" WidgetBase.__init__(self, master) self.__populate() self.__bindKeys() def __populate(self): """Create the Number Pad""" self.buttons = [Tk.Button(self, width=2, height=2, text='...
the_stack_v2_python_sparse
cs3710/assignments/a05/Widgets.py
VijayEluri/MUN-School-Work
train
0
44d205d41866237008de7ca406626e21753ac164
[ "self.meldings_kode_field = meldings_kode_field\nself.meldings_tekst_field = meldings_tekst_field\nself.additional_properties = additional_properties", "if dictionary is None:\n return None\nmeldings_kode_field = dictionary.get('meldingsKodeField')\nmeldings_tekst_field = dictionary.get('meldingsTekstField')\n...
<|body_start_0|> self.meldings_kode_field = meldings_kode_field self.meldings_tekst_field = meldings_tekst_field self.additional_properties = additional_properties <|end_body_0|> <|body_start_1|> if dictionary is None: return None meldings_kode_field = dictionary.get...
Implementation of the 'Meldinger' model. TODO: type model description here. Attributes: meldings_kode_field (int): TODO: type description here. meldings_tekst_field (string): TODO: type description here.
Meldinger
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Meldinger: """Implementation of the 'Meldinger' model. TODO: type model description here. Attributes: meldings_kode_field (int): TODO: type description here. meldings_tekst_field (string): TODO: type description here.""" def __init__(self, meldings_kode_field=None, meldings_tekst_field=None,...
stack_v2_sparse_classes_75kplus_train_073038
2,224
permissive
[ { "docstring": "Constructor for the Meldinger class", "name": "__init__", "signature": "def __init__(self, meldings_kode_field=None, meldings_tekst_field=None, additional_properties={})" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dicti...
2
stack_v2_sparse_classes_30k_val_000961
Implement the Python class `Meldinger` described below. Class description: Implementation of the 'Meldinger' model. TODO: type model description here. Attributes: meldings_kode_field (int): TODO: type description here. meldings_tekst_field (string): TODO: type description here. Method signatures and docstrings: - def...
Implement the Python class `Meldinger` described below. Class description: Implementation of the 'Meldinger' model. TODO: type model description here. Attributes: meldings_kode_field (int): TODO: type description here. meldings_tekst_field (string): TODO: type description here. Method signatures and docstrings: - def...
fa3918a6c54ea0eedb9146578645b7eb1755b642
<|skeleton|> class Meldinger: """Implementation of the 'Meldinger' model. TODO: type model description here. Attributes: meldings_kode_field (int): TODO: type description here. meldings_tekst_field (string): TODO: type description here.""" def __init__(self, meldings_kode_field=None, meldings_tekst_field=None,...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Meldinger: """Implementation of the 'Meldinger' model. TODO: type model description here. Attributes: meldings_kode_field (int): TODO: type description here. meldings_tekst_field (string): TODO: type description here.""" def __init__(self, meldings_kode_field=None, meldings_tekst_field=None, additional_p...
the_stack_v2_python_sparse
idfy_rest_client/models/meldinger.py
dealflowteam/Idfy
train
0
28a059cdfaaa32e9f484a6a1639b63239456da51
[ "dummy = tail = ListNode(None)\nwhile l1 and l2:\n if l1.val <= l2.val:\n tail.next, tail, l1 = (l1, l1, l1.next)\n else:\n tail.next, tail, l2 = (l2, l2, l2.next)\ntail.next = l1 or l2 if l1 or l2 else None\nreturn dummy.next", "dummyRoot = ListNode(0)\nptr = dummyRoot\nptr1 = l1\nptr2 = l2\n...
<|body_start_0|> dummy = tail = ListNode(None) while l1 and l2: if l1.val <= l2.val: tail.next, tail, l1 = (l1, l1, l1.next) else: tail.next, tail, l2 = (l2, l2, l2.next) tail.next = l1 or l2 if l1 or l2 else None return dummy.next ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def mergeTwoLists(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_0|> def mergeTwoLists_my_first(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|> <|body_star...
stack_v2_sparse_classes_75kplus_train_073039
2,623
no_license
[ { "docstring": ":type l1: ListNode :type l2: ListNode :rtype: ListNode", "name": "mergeTwoLists", "signature": "def mergeTwoLists(self, l1, l2)" }, { "docstring": ":type l1: ListNode :type l2: ListNode :rtype: ListNode", "name": "mergeTwoLists_my_first", "signature": "def mergeTwoLists_m...
2
stack_v2_sparse_classes_30k_train_028644
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeTwoLists(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode - def mergeTwoLists_my_first(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeTwoLists(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode - def mergeTwoLists_my_first(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ...
f0d9070fa292ca36971a465a805faddb12025482
<|skeleton|> class Solution: def mergeTwoLists(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_0|> def mergeTwoLists_my_first(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def mergeTwoLists(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" dummy = tail = ListNode(None) while l1 and l2: if l1.val <= l2.val: tail.next, tail, l1 = (l1, l1, l1.next) else: tail.next, t...
the_stack_v2_python_sparse
21.MergeTwoSortedLists.py
JerryRoc/leetcode
train
0
7dec94b4d57e93288eb0a0ddb865b44de4eb9703
[ "value_dict = defaultdict(lambda: None)\nqueue = [(0, root)]\nwhile len(queue) > 0:\n index, node = queue.pop(0)\n value_dict[index] = node.val\n if node.left:\n queue.append((index * 2 + 1, node.left))\n if node.right:\n queue.append((index * 2 + 2, node.right))\nreturn value_dict", "va...
<|body_start_0|> value_dict = defaultdict(lambda: None) queue = [(0, root)] while len(queue) > 0: index, node = queue.pop(0) value_dict[index] = node.val if node.left: queue.append((index * 2 + 1, node.left)) if node.right: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def tree_to_dict(self, root): """:type root: TreeNode :rtype: defaultdict key: index, value: value""" <|body_0|> def isSymmetric(self, root): """:type root: TreeNode :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> value_dict =...
stack_v2_sparse_classes_75kplus_train_073040
2,019
no_license
[ { "docstring": ":type root: TreeNode :rtype: defaultdict key: index, value: value", "name": "tree_to_dict", "signature": "def tree_to_dict(self, root)" }, { "docstring": ":type root: TreeNode :rtype: bool", "name": "isSymmetric", "signature": "def isSymmetric(self, root)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def tree_to_dict(self, root): :type root: TreeNode :rtype: defaultdict key: index, value: value - def isSymmetric(self, root): :type root: TreeNode :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def tree_to_dict(self, root): :type root: TreeNode :rtype: defaultdict key: index, value: value - def isSymmetric(self, root): :type root: TreeNode :rtype: bool <|skeleton|> cla...
b8771acb31cee3a86610c4c476f2417e1cd08328
<|skeleton|> class Solution: def tree_to_dict(self, root): """:type root: TreeNode :rtype: defaultdict key: index, value: value""" <|body_0|> def isSymmetric(self, root): """:type root: TreeNode :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def tree_to_dict(self, root): """:type root: TreeNode :rtype: defaultdict key: index, value: value""" value_dict = defaultdict(lambda: None) queue = [(0, root)] while len(queue) > 0: index, node = queue.pop(0) value_dict[index] = node.val ...
the_stack_v2_python_sparse
2021/101.py
aacs0130/uttapam
train
0
ab73d6d10a8dac78f1221aa24f297f174f1e52d7
[ "cls = super(PacketFactory, mcs).__new__(mcs, name, bases, attrs)\nif cls.__type__ is not None and cls.__type__ not in PacketFactory._PACKETS:\n PacketFactory._PACKETS[cls.__type__] = cls\nreturn cls", "cls = PacketFactory._PACKETS[dct['type']]\nif type(cls) != mcs:\n cls = type(cls).get_class(dct, server)\...
<|body_start_0|> cls = super(PacketFactory, mcs).__new__(mcs, name, bases, attrs) if cls.__type__ is not None and cls.__type__ not in PacketFactory._PACKETS: PacketFactory._PACKETS[cls.__type__] = cls return cls <|end_body_0|> <|body_start_1|> cls = PacketFactory._PACKETS[dc...
A metaclass that is used to register new packet classes as they are being defined, and instantiate new packets from their name when necessary.
PacketFactory
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PacketFactory: """A metaclass that is used to register new packet classes as they are being defined, and instantiate new packets from their name when necessary.""" def __new__(mcs, name, bases, attrs): """Register a new packet class into the factory.""" <|body_0|> def ge...
stack_v2_sparse_classes_75kplus_train_073041
15,461
no_license
[ { "docstring": "Register a new packet class into the factory.", "name": "__new__", "signature": "def __new__(mcs, name, bases, attrs)" }, { "docstring": "Instantiate the packet corresponding to the serialized dictionary. It will check if the packet type is registered, the deferred the request to...
2
stack_v2_sparse_classes_30k_test_000044
Implement the Python class `PacketFactory` described below. Class description: A metaclass that is used to register new packet classes as they are being defined, and instantiate new packets from their name when necessary. Method signatures and docstrings: - def __new__(mcs, name, bases, attrs): Register a new packet ...
Implement the Python class `PacketFactory` described below. Class description: A metaclass that is used to register new packet classes as they are being defined, and instantiate new packets from their name when necessary. Method signatures and docstrings: - def __new__(mcs, name, bases, attrs): Register a new packet ...
cd19e3168b4661312efdc80b5b7c006a70b8004b
<|skeleton|> class PacketFactory: """A metaclass that is used to register new packet classes as they are being defined, and instantiate new packets from their name when necessary.""" def __new__(mcs, name, bases, attrs): """Register a new packet class into the factory.""" <|body_0|> def ge...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PacketFactory: """A metaclass that is used to register new packet classes as they are being defined, and instantiate new packets from their name when necessary.""" def __new__(mcs, name, bases, attrs): """Register a new packet class into the factory.""" cls = super(PacketFactory, mcs).__n...
the_stack_v2_python_sparse
idarling/idarling/idarling/shared/packets.py
saidelike/IDArling-1
train
0
d73fbd0f214a992f2c275229bfd5988f493ec792
[ "if not email:\n raise ValueError('Ususario debe tener un Email')\nemail = self.normalize_email(email)\nuser = self.model(email=email, name=name)\nuser.set_password(password)\nuser.save(using=self._db)\nreturn user", "user = self.create_user(email, name, password)\nuser.is_superuser = True\nuser.is_staff = Tru...
<|body_start_0|> if not email: raise ValueError('Ususario debe tener un Email') email = self.normalize_email(email) user = self.model(email=email, name=name) user.set_password(password) user.save(using=self._db) return user <|end_body_0|> <|body_start_1|> ...
manager para perfiles de usuario, especifica funciones que sirven para manipular lo que tenemos lo que tenemos dentro del objectos de UserProfile
UserProfileManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserProfileManager: """manager para perfiles de usuario, especifica funciones que sirven para manipular lo que tenemos lo que tenemos dentro del objectos de UserProfile""" def create_user(self, email, name, password=None): """crear nuevo user profile""" <|body_0|> def cr...
stack_v2_sparse_classes_75kplus_train_073042
3,227
no_license
[ { "docstring": "crear nuevo user profile", "name": "create_user", "signature": "def create_user(self, email, name, password=None)" }, { "docstring": "crear un super usuario", "name": "create_superuser", "signature": "def create_superuser(self, email, name, password)" } ]
2
stack_v2_sparse_classes_30k_train_005453
Implement the Python class `UserProfileManager` described below. Class description: manager para perfiles de usuario, especifica funciones que sirven para manipular lo que tenemos lo que tenemos dentro del objectos de UserProfile Method signatures and docstrings: - def create_user(self, email, name, password=None): c...
Implement the Python class `UserProfileManager` described below. Class description: manager para perfiles de usuario, especifica funciones que sirven para manipular lo que tenemos lo que tenemos dentro del objectos de UserProfile Method signatures and docstrings: - def create_user(self, email, name, password=None): c...
30441e5ce1a00455a3dc51a53cee6b34106b663f
<|skeleton|> class UserProfileManager: """manager para perfiles de usuario, especifica funciones que sirven para manipular lo que tenemos lo que tenemos dentro del objectos de UserProfile""" def create_user(self, email, name, password=None): """crear nuevo user profile""" <|body_0|> def cr...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UserProfileManager: """manager para perfiles de usuario, especifica funciones que sirven para manipular lo que tenemos lo que tenemos dentro del objectos de UserProfile""" def create_user(self, email, name, password=None): """crear nuevo user profile""" if not email: raise Val...
the_stack_v2_python_sparse
profiles_project/profiles_api/models.py
AlexRodriguezVillavicencio/Backend
train
1
84847c2e72d17d10c0a17a65c6edb965998c72f5
[ "if not UIDriver.instance:\n UIDriver.instance = self\n UIDriver.root_frame = root\n UIDriver.thread_manager = ThreadManager()\n UIDriver.change_application_state(ApplicationState.STARTUP)\n UIDriver.change_application_state(ApplicationState.WAITING_INPUT)\n UIDriver.timer_5_sec = time.time()", ...
<|body_start_0|> if not UIDriver.instance: UIDriver.instance = self UIDriver.root_frame = root UIDriver.thread_manager = ThreadManager() UIDriver.change_application_state(ApplicationState.STARTUP) UIDriver.change_application_state(ApplicationState.WAIT...
This class is responsible for driving the UI. It holds the root frame wx widget as well as keeping track of the application state. It will send user events and application state changes to the child IUIBehavior objects.
UIDriver
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UIDriver: """This class is responsible for driving the UI. It holds the root frame wx widget as well as keeping track of the application state. It will send user events and application state changes to the child IUIBehavior objects.""" def __init__(self, root): """Default constructor...
stack_v2_sparse_classes_75kplus_train_073043
6,648
permissive
[ { "docstring": "Default constructor for the UIDriver object.", "name": "__init__", "signature": "def __init__(self, root)" }, { "docstring": "Traverse the child-parent relationship between wx widgets. Return all the children objects that are instances of the IUIBehavior. :param root: The root wx...
6
null
Implement the Python class `UIDriver` described below. Class description: This class is responsible for driving the UI. It holds the root frame wx widget as well as keeping track of the application state. It will send user events and application state changes to the child IUIBehavior objects. Method signatures and do...
Implement the Python class `UIDriver` described below. Class description: This class is responsible for driving the UI. It holds the root frame wx widget as well as keeping track of the application state. It will send user events and application state changes to the child IUIBehavior objects. Method signatures and do...
61a3fde105d0c0841a571037537ec3347bae8808
<|skeleton|> class UIDriver: """This class is responsible for driving the UI. It holds the root frame wx widget as well as keeping track of the application state. It will send user events and application state changes to the child IUIBehavior objects.""" def __init__(self, root): """Default constructor...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UIDriver: """This class is responsible for driving the UI. It holds the root frame wx widget as well as keeping track of the application state. It will send user events and application state changes to the child IUIBehavior objects.""" def __init__(self, root): """Default constructor for the UIDr...
the_stack_v2_python_sparse
src/ui/ui_driver.py
sohantamang/lscan
train
0
5ffd5b8169b4465d2a95a514b3eac7f346710331
[ "super(InteractionUI, self).__init__()\nself._logger = logging.getLogger(__name__)\nself._logger.info(\"Setting up input form's interaction buttons...\")\nself.ros_node = ros_node\nself.button_box = QtGui.QGroupBox(self)\nself.button_layout = QtGui.QGridLayout(self.button_box)\nself.button_box.setTitle('Interaction...
<|body_start_0|> super(InteractionUI, self).__init__() self._logger = logging.getLogger(__name__) self._logger.info("Setting up input form's interaction buttons...") self.ros_node = ros_node self.button_box = QtGui.QGroupBox(self) self.button_layout = QtGui.QGridLayout(se...
Buttons for allowing the user to start, stop, pause, and resume the interaction remotely.
InteractionUI
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InteractionUI: """Buttons for allowing the user to start, stop, pause, and resume the interaction remotely.""" def __init__(self, ros_node): """Make buttons for getting stop, pause, resume input from the user.""" <|body_0|> def on_button_selected(self, selected): ...
stack_v2_sparse_classes_75kplus_train_073044
5,040
permissive
[ { "docstring": "Make buttons for getting stop, pause, resume input from the user.", "name": "__init__", "signature": "def __init__(self, ros_node)" }, { "docstring": "When a button is pressed, update the label so the user can check it and confirm.", "name": "on_button_selected", "signatu...
3
stack_v2_sparse_classes_30k_train_048085
Implement the Python class `InteractionUI` described below. Class description: Buttons for allowing the user to start, stop, pause, and resume the interaction remotely. Method signatures and docstrings: - def __init__(self, ros_node): Make buttons for getting stop, pause, resume input from the user. - def on_button_s...
Implement the Python class `InteractionUI` described below. Class description: Buttons for allowing the user to start, stop, pause, and resume the interaction remotely. Method signatures and docstrings: - def __init__(self, ros_node): Make buttons for getting stop, pause, resume input from the user. - def on_button_s...
8bf3f928b442c2890dbbbff110fcde76846b2e16
<|skeleton|> class InteractionUI: """Buttons for allowing the user to start, stop, pause, and resume the interaction remotely.""" def __init__(self, ros_node): """Make buttons for getting stop, pause, resume input from the user.""" <|body_0|> def on_button_selected(self, selected): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class InteractionUI: """Buttons for allowing the user to start, stop, pause, and resume the interaction remotely.""" def __init__(self, ros_node): """Make buttons for getting stop, pause, resume input from the user.""" super(InteractionUI, self).__init__() self._logger = logging.getLogg...
the_stack_v2_python_sparse
src/user_input_interaction_ui.py
mitmedialab/rr_interaction
train
0
8a1bf6c1b80b8b3d8eeefe1e252d534496f2df1f
[ "data = get_applicant_row_by_id(pk)\nif not data:\n abort(NotFound.code, message='没有记录', status=False)\nif data.status_delete == STATUS_DEL_OK:\n abort(NotFound.code, message='已经删除', status=False)\nresult = marshal(data, fields_item, envelope=structure_key_item)\nreturn jsonify(result)", "request_args = req...
<|body_start_0|> data = get_applicant_row_by_id(pk) if not data: abort(NotFound.code, message='没有记录', status=False) if data.status_delete == STATUS_DEL_OK: abort(NotFound.code, message='已经删除', status=False) result = marshal(data, fields_item, envelope=structure_ke...
ApplicantResource
ApplicantResource
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ApplicantResource: """ApplicantResource""" def get(self, pk): """Example: curl http://0.0.0.0:8000/applicant/1 :param pk: :return:""" <|body_0|> def put(self, pk): """Example: curl http://0.0.0.0:8000/applicant/1 -H "Content-Type: application/json" -X PUT -d ' { ...
stack_v2_sparse_classes_75kplus_train_073045
7,189
no_license
[ { "docstring": "Example: curl http://0.0.0.0:8000/applicant/1 :param pk: :return:", "name": "get", "signature": "def get(self, pk)" }, { "docstring": "Example: curl http://0.0.0.0:8000/applicant/1 -H \"Content-Type: application/json\" -X PUT -d ' { \"applicant\": { \"name\": \"applicant name put...
3
null
Implement the Python class `ApplicantResource` described below. Class description: ApplicantResource Method signatures and docstrings: - def get(self, pk): Example: curl http://0.0.0.0:8000/applicant/1 :param pk: :return: - def put(self, pk): Example: curl http://0.0.0.0:8000/applicant/1 -H "Content-Type: application...
Implement the Python class `ApplicantResource` described below. Class description: ApplicantResource Method signatures and docstrings: - def get(self, pk): Example: curl http://0.0.0.0:8000/applicant/1 :param pk: :return: - def put(self, pk): Example: curl http://0.0.0.0:8000/applicant/1 -H "Content-Type: application...
0b44d83b95079734ac9aa78bc7af40a0a7530bca
<|skeleton|> class ApplicantResource: """ApplicantResource""" def get(self, pk): """Example: curl http://0.0.0.0:8000/applicant/1 :param pk: :return:""" <|body_0|> def put(self, pk): """Example: curl http://0.0.0.0:8000/applicant/1 -H "Content-Type: application/json" -X PUT -d ' { ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ApplicantResource: """ApplicantResource""" def get(self, pk): """Example: curl http://0.0.0.0:8000/applicant/1 :param pk: :return:""" data = get_applicant_row_by_id(pk) if not data: abort(NotFound.code, message='没有记录', status=False) if data.status_delete == STA...
the_stack_v2_python_sparse
apps/lims/applicant/resource.py
zhanghe06/lims_project
train
1
5a9daab4114da3539b8233b71115e085b5a9a4fe
[ "paginated = Paginator(models.SiteInvite.objects.filter(user=request.user).order_by('-created_date'), PAGE_LENGTH)\npage = paginated.get_page(request.GET.get('page'))\ndata = {'invites': page, 'page_range': paginated.get_elided_page_range(page.number, on_each_side=2, on_ends=1), 'form': forms.CreateInviteForm()}\nr...
<|body_start_0|> paginated = Paginator(models.SiteInvite.objects.filter(user=request.user).order_by('-created_date'), PAGE_LENGTH) page = paginated.get_page(request.GET.get('page')) data = {'invites': page, 'page_range': paginated.get_elided_page_range(page.number, on_each_side=2, on_ends=1), 'f...
create invites
ManageInvites
[ "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ManageInvites: """create invites""" def get(self, request): """invite management page""" <|body_0|> def post(self, request): """creates an invite database entry""" <|body_1|> <|end_skeleton|> <|body_start_0|> paginated = Paginator(models.SiteInv...
stack_v2_sparse_classes_75kplus_train_073046
6,414
no_license
[ { "docstring": "invite management page", "name": "get", "signature": "def get(self, request)" }, { "docstring": "creates an invite database entry", "name": "post", "signature": "def post(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_035112
Implement the Python class `ManageInvites` described below. Class description: create invites Method signatures and docstrings: - def get(self, request): invite management page - def post(self, request): creates an invite database entry
Implement the Python class `ManageInvites` described below. Class description: create invites Method signatures and docstrings: - def get(self, request): invite management page - def post(self, request): creates an invite database entry <|skeleton|> class ManageInvites: """create invites""" def get(self, re...
0f8da5b738047f3c34d60d93f59bdedd8f797224
<|skeleton|> class ManageInvites: """create invites""" def get(self, request): """invite management page""" <|body_0|> def post(self, request): """creates an invite database entry""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ManageInvites: """create invites""" def get(self, request): """invite management page""" paginated = Paginator(models.SiteInvite.objects.filter(user=request.user).order_by('-created_date'), PAGE_LENGTH) page = paginated.get_page(request.GET.get('page')) data = {'invites': ...
the_stack_v2_python_sparse
bookwyrm/views/admin/invite.py
bookwyrm-social/bookwyrm
train
1,398
ed567eeee35fa9260888599dd67d1019f28d03d4
[ "self._grid = grid\nself.runoff_rate = runoff_rate / 3600000.0\nself.vel_coef = 1.0 / roughness\nself.changing_topo = changing_topo\nself.depth_exp = depth_exp\nself.weight = weight\ntry:\n self.elev = grid.at_node['topographic__elevation']\nexcept:\n raise\nif 'surface_water__depth' in grid.at_node:\n sel...
<|body_start_0|> self._grid = grid self.runoff_rate = runoff_rate / 3600000.0 self.vel_coef = 1.0 / roughness self.changing_topo = changing_topo self.depth_exp = depth_exp self.weight = weight try: self.elev = grid.at_node['topographic__elevation'] ...
Calculate shallow water flow over topography. Landlab component that implements a two-dimensional kinematic wave model. This is a form of the 2D shallow-water equations in which energy slope is assumed to equal bed slope. The solution method is locally implicit, and works as follows. At each time step, we iterate from ...
KinwaveImplicitOverlandFlow
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KinwaveImplicitOverlandFlow: """Calculate shallow water flow over topography. Landlab component that implements a two-dimensional kinematic wave model. This is a form of the 2D shallow-water equations in which energy slope is assumed to equal bed slope. The solution method is locally implicit, an...
stack_v2_sparse_classes_75kplus_train_073047
14,450
permissive
[ { "docstring": "Initialize the KinwaveOverlandFlowModel. Parameters ---------- grid : ModelGrid Landlab ModelGrid object runoff_rate : float, optional (defaults to 1 mm/hr) Precipitation rate, mm/hr roughnes : float, defaults to 0.01 Manning roughness coefficient, s/m^1/3 changing_topo : boolean, optional (defa...
2
stack_v2_sparse_classes_30k_train_014969
Implement the Python class `KinwaveImplicitOverlandFlow` described below. Class description: Calculate shallow water flow over topography. Landlab component that implements a two-dimensional kinematic wave model. This is a form of the 2D shallow-water equations in which energy slope is assumed to equal bed slope. The ...
Implement the Python class `KinwaveImplicitOverlandFlow` described below. Class description: Calculate shallow water flow over topography. Landlab component that implements a two-dimensional kinematic wave model. This is a form of the 2D shallow-water equations in which energy slope is assumed to equal bed slope. The ...
8c8613f8b8653906c1497f6557dd2a0bc555a79a
<|skeleton|> class KinwaveImplicitOverlandFlow: """Calculate shallow water flow over topography. Landlab component that implements a two-dimensional kinematic wave model. This is a form of the 2D shallow-water equations in which energy slope is assumed to equal bed slope. The solution method is locally implicit, an...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class KinwaveImplicitOverlandFlow: """Calculate shallow water flow over topography. Landlab component that implements a two-dimensional kinematic wave model. This is a form of the 2D shallow-water equations in which energy slope is assumed to equal bed slope. The solution method is locally implicit, and works as fo...
the_stack_v2_python_sparse
landlab/components/overland_flow/generate_overland_flow_implicit_kinwave.py
RondaStrauch/landlab
train
2
1bebf5d0ceac2ebb9379f272ee52d5b9dac018d6
[ "key = LibraryUsageLocatorV2.from_string(usage_key_str)\napi.require_permission_for_library_key(key.lib_key, request.user, permissions.CAN_VIEW_THIS_CONTENT_LIBRARY)\nxml_str = api.get_library_block_olx(key)\nreturn Response(LibraryXBlockOlxSerializer({'olx': xml_str}).data)", "key = LibraryUsageLocatorV2.from_st...
<|body_start_0|> key = LibraryUsageLocatorV2.from_string(usage_key_str) api.require_permission_for_library_key(key.lib_key, request.user, permissions.CAN_VIEW_THIS_CONTENT_LIBRARY) xml_str = api.get_library_block_olx(key) return Response(LibraryXBlockOlxSerializer({'olx': xml_str}).data)...
Views to work with an existing XBlock's OLX
LibraryBlockOlxView
[ "AGPL-3.0-only", "AGPL-3.0-or-later", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LibraryBlockOlxView: """Views to work with an existing XBlock's OLX""" def get(self, request, usage_key_str): """Get the block's OLX""" <|body_0|> def post(self, request, usage_key_str): """Replace the block's OLX. This API is only meant for use by developers or ...
stack_v2_sparse_classes_75kplus_train_073048
42,120
permissive
[ { "docstring": "Get the block's OLX", "name": "get", "signature": "def get(self, request, usage_key_str)" }, { "docstring": "Replace the block's OLX. This API is only meant for use by developers or API client applications. Very little validation is done.", "name": "post", "signature": "d...
2
stack_v2_sparse_classes_30k_train_014838
Implement the Python class `LibraryBlockOlxView` described below. Class description: Views to work with an existing XBlock's OLX Method signatures and docstrings: - def get(self, request, usage_key_str): Get the block's OLX - def post(self, request, usage_key_str): Replace the block's OLX. This API is only meant for ...
Implement the Python class `LibraryBlockOlxView` described below. Class description: Views to work with an existing XBlock's OLX Method signatures and docstrings: - def get(self, request, usage_key_str): Get the block's OLX - def post(self, request, usage_key_str): Replace the block's OLX. This API is only meant for ...
5809eaca7079a15ee56b0b7fcfea425337046c97
<|skeleton|> class LibraryBlockOlxView: """Views to work with an existing XBlock's OLX""" def get(self, request, usage_key_str): """Get the block's OLX""" <|body_0|> def post(self, request, usage_key_str): """Replace the block's OLX. This API is only meant for use by developers or ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LibraryBlockOlxView: """Views to work with an existing XBlock's OLX""" def get(self, request, usage_key_str): """Get the block's OLX""" key = LibraryUsageLocatorV2.from_string(usage_key_str) api.require_permission_for_library_key(key.lib_key, request.user, permissions.CAN_VIEW_THI...
the_stack_v2_python_sparse
Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/openedx/core/djangoapps/content_libraries/views.py
luque/better-ways-of-thinking-about-software
train
3
275b25a196344b648eba78c8cb32f5ff5962e33e
[ "if not dataset.dataset.purged:\n dataset.peek = data.get_file_peek(dataset.file_name, is_multi_byte=is_multi_byte)\n dataset.blurb = 'NCBI Blast XML data'\nelse:\n dataset.peek = 'file does not exist'\n dataset.blurb = 'file purged from disk'", "blastxml_header = ['<?xml version=\"1.0\"?>', '<!DOCTYP...
<|body_start_0|> if not dataset.dataset.purged: dataset.peek = data.get_file_peek(dataset.file_name, is_multi_byte=is_multi_byte) dataset.blurb = 'NCBI Blast XML data' else: dataset.peek = 'file does not exist' dataset.blurb = 'file purged from disk' <|end...
NCBI Blast XML Output data
BlastXml
[ "CC-BY-2.5", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BlastXml: """NCBI Blast XML Output data""" def set_peek(self, dataset, is_multi_byte=False): """Set the peek and blurb text""" <|body_0|> def sniff(self, filename): """Determines whether the file is blastxml >>> fname = get_test_fname( 'megablast_xml_parser_test1...
stack_v2_sparse_classes_75kplus_train_073049
1,456
permissive
[ { "docstring": "Set the peek and blurb text", "name": "set_peek", "signature": "def set_peek(self, dataset, is_multi_byte=False)" }, { "docstring": "Determines whether the file is blastxml >>> fname = get_test_fname( 'megablast_xml_parser_test1.blastxml' ) >>> BlastXml().sniff( fname ) True >>> ...
2
null
Implement the Python class `BlastXml` described below. Class description: NCBI Blast XML Output data Method signatures and docstrings: - def set_peek(self, dataset, is_multi_byte=False): Set the peek and blurb text - def sniff(self, filename): Determines whether the file is blastxml >>> fname = get_test_fname( 'megab...
Implement the Python class `BlastXml` described below. Class description: NCBI Blast XML Output data Method signatures and docstrings: - def set_peek(self, dataset, is_multi_byte=False): Set the peek and blurb text - def sniff(self, filename): Determines whether the file is blastxml >>> fname = get_test_fname( 'megab...
7b679ea17ba294893cc560354d759cfd61c0b450
<|skeleton|> class BlastXml: """NCBI Blast XML Output data""" def set_peek(self, dataset, is_multi_byte=False): """Set the peek and blurb text""" <|body_0|> def sniff(self, filename): """Determines whether the file is blastxml >>> fname = get_test_fname( 'megablast_xml_parser_test1...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BlastXml: """NCBI Blast XML Output data""" def set_peek(self, dataset, is_multi_byte=False): """Set the peek and blurb text""" if not dataset.dataset.purged: dataset.peek = data.get_file_peek(dataset.file_name, is_multi_byte=is_multi_byte) dataset.blurb = 'NCBI Bla...
the_stack_v2_python_sparse
lib/galaxy/datatypes/xml.py
msGenDev/Yeps-EURAC
train
0
a5d3a11b6f0db1c7876ec3ad242b5f60799fa71c
[ "context = super().get_context_data(**kwargs)\ncontext['page_title'] = 'IPs in use'\ncontext['table_title'] = 'Overview of IPs in use'\nreturn context", "qs1 = Netdev.objects.filter(decomissioned=False)\nqs2 = Server.objects.filter(decomissioned=False)\nqs4 = Vserver.objects.filter(decomissioned=False)\nip_list =...
<|body_start_0|> context = super().get_context_data(**kwargs) context['page_title'] = 'IPs in use' context['table_title'] = 'Overview of IPs in use' return context <|end_body_0|> <|body_start_1|> qs1 = Netdev.objects.filter(decomissioned=False) qs2 = Server.objects.filte...
Queries all the existing objects in the DB for devices, Then return them as context for the view
IPlist_Used
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IPlist_Used: """Queries all the existing objects in the DB for devices, Then return them as context for the view""" def get_context_data(self, **kwargs): """Feeds more context data to the template, see Stations_Sept_Receivers comments.""" <|body_0|> def get_queryset(self...
stack_v2_sparse_classes_75kplus_train_073050
7,905
no_license
[ { "docstring": "Feeds more context data to the template, see Stations_Sept_Receivers comments.", "name": "get_context_data", "signature": "def get_context_data(self, **kwargs)" }, { "docstring": "We have a qs per model to be queried, then is merged using the chain and returned to the view", ...
2
null
Implement the Python class `IPlist_Used` described below. Class description: Queries all the existing objects in the DB for devices, Then return them as context for the view Method signatures and docstrings: - def get_context_data(self, **kwargs): Feeds more context data to the template, see Stations_Sept_Receivers c...
Implement the Python class `IPlist_Used` described below. Class description: Queries all the existing objects in the DB for devices, Then return them as context for the view Method signatures and docstrings: - def get_context_data(self, **kwargs): Feeds more context data to the template, see Stations_Sept_Receivers c...
12aafa53b362c1e093db70903d7cc3a70208986a
<|skeleton|> class IPlist_Used: """Queries all the existing objects in the DB for devices, Then return them as context for the view""" def get_context_data(self, **kwargs): """Feeds more context data to the template, see Stations_Sept_Receivers comments.""" <|body_0|> def get_queryset(self...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class IPlist_Used: """Queries all the existing objects in the DB for devices, Then return them as context for the view""" def get_context_data(self, **kwargs): """Feeds more context data to the template, see Stations_Sept_Receivers comments.""" context = super().get_context_data(**kwargs) ...
the_stack_v2_python_sparse
inetrecomgr/views.py
mamedxanli/centurion
train
0
db0b68ff0057117a22a8cb28541755d7acc102ce
[ "if rsp is None:\n rsp = rfc1905.Message()\n rsp.apiAlphaSetPdu(self.apiAlphaGetPdu().apiAlphaReply())\nelse:\n self.apiAlphaGetPdu().apiAlphaReply(rsp.apiAlphaGetPdu())\nrsp.apiAlphaSetCommunity(self.apiAlphaGetCommunity())\nreturn rsp", "if not isinstance(rsp, rfc1905.Message):\n raise error.BadArgu...
<|body_start_0|> if rsp is None: rsp = rfc1905.Message() rsp.apiAlphaSetPdu(self.apiAlphaGetPdu().apiAlphaReply()) else: self.apiAlphaGetPdu().apiAlphaReply(rsp.apiAlphaGetPdu()) rsp.apiAlphaSetCommunity(self.apiAlphaGetCommunity()) return rsp <|end_bo...
MessageMixIn
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MessageMixIn: def apiAlphaReply(self, rsp=None): """Return initialized response message""" <|body_0|> def apiAlphaMatch(self, rsp): """Return true if response message matches this request""" <|body_1|> <|end_skeleton|> <|body_start_0|> if rsp is Non...
stack_v2_sparse_classes_75kplus_train_073051
6,735
no_license
[ { "docstring": "Return initialized response message", "name": "apiAlphaReply", "signature": "def apiAlphaReply(self, rsp=None)" }, { "docstring": "Return true if response message matches this request", "name": "apiAlphaMatch", "signature": "def apiAlphaMatch(self, rsp)" } ]
2
null
Implement the Python class `MessageMixIn` described below. Class description: Implement the MessageMixIn class. Method signatures and docstrings: - def apiAlphaReply(self, rsp=None): Return initialized response message - def apiAlphaMatch(self, rsp): Return true if response message matches this request
Implement the Python class `MessageMixIn` described below. Class description: Implement the MessageMixIn class. Method signatures and docstrings: - def apiAlphaReply(self, rsp=None): Return initialized response message - def apiAlphaMatch(self, rsp): Return true if response message matches this request <|skeleton|> ...
256401ac313df2e45c516af1a4d5398f54703b9c
<|skeleton|> class MessageMixIn: def apiAlphaReply(self, rsp=None): """Return initialized response message""" <|body_0|> def apiAlphaMatch(self, rsp): """Return true if response message matches this request""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MessageMixIn: def apiAlphaReply(self, rsp=None): """Return initialized response message""" if rsp is None: rsp = rfc1905.Message() rsp.apiAlphaSetPdu(self.apiAlphaGetPdu().apiAlphaReply()) else: self.apiAlphaGetPdu().apiAlphaReply(rsp.apiAlphaGetPdu(...
the_stack_v2_python_sparse
pre/python/lib/python2.7/dist-packages/pysnmp/proto/api/alpha/rfc1905.py
ag1455/OpenPLi-PC
train
27
bc6752bec93dd843ac212014583c02debf03f8bb
[ "super(STConvBlock, self).__init__()\nf_in, f_m, f_out = channels\nself.t_conv1 = TemporalConvLayer(f_in, f_m, t_cnv_krnl_sz)\nself.s_conv = SpatialConvLayer(f_m, f_m, k_hop)\nself.t_conv2 = TemporalConvLayer(f_m, f_out, t_cnv_krnl_sz)\nself.ln = nn.LayerNorm([n_node, f_out])\nself.dropout = nn.Dropout(dropout)", ...
<|body_start_0|> super(STConvBlock, self).__init__() f_in, f_m, f_out = channels self.t_conv1 = TemporalConvLayer(f_in, f_m, t_cnv_krnl_sz) self.s_conv = SpatialConvLayer(f_m, f_m, k_hop) self.t_conv2 = TemporalConvLayer(f_m, f_out, t_cnv_krnl_sz) self.ln = nn.LayerNorm([...
STConvBlock
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class STConvBlock: def __init__(self, k_hop: int, t_cnv_krnl_sz: int, n_node: int, channels: Tuple[int, int, int], dropout: float): """Spatio-temporal convolutional block, which contains two temporal gated convolution layers and one spatial graph convolution layer in the middle. :param k_hop: ...
stack_v2_sparse_classes_75kplus_train_073052
5,900
no_license
[ { "docstring": "Spatio-temporal convolutional block, which contains two temporal gated convolution layers and one spatial graph convolution layer in the middle. :param k_hop: length of Chebychev polynomial, i.e., kernel size of spatial convolution :param t_cnv_krnl_sz: kernel size of temporal convolution :param...
2
stack_v2_sparse_classes_30k_test_002136
Implement the Python class `STConvBlock` described below. Class description: Implement the STConvBlock class. Method signatures and docstrings: - def __init__(self, k_hop: int, t_cnv_krnl_sz: int, n_node: int, channels: Tuple[int, int, int], dropout: float): Spatio-temporal convolutional block, which contains two tem...
Implement the Python class `STConvBlock` described below. Class description: Implement the STConvBlock class. Method signatures and docstrings: - def __init__(self, k_hop: int, t_cnv_krnl_sz: int, n_node: int, channels: Tuple[int, int, int], dropout: float): Spatio-temporal convolutional block, which contains two tem...
4a9da6eedab6ef3d72492b9445d7a9923abc9833
<|skeleton|> class STConvBlock: def __init__(self, k_hop: int, t_cnv_krnl_sz: int, n_node: int, channels: Tuple[int, int, int], dropout: float): """Spatio-temporal convolutional block, which contains two temporal gated convolution layers and one spatial graph convolution layer in the middle. :param k_hop: ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class STConvBlock: def __init__(self, k_hop: int, t_cnv_krnl_sz: int, n_node: int, channels: Tuple[int, int, int], dropout: float): """Spatio-temporal convolutional block, which contains two temporal gated convolution layers and one spatial graph convolution layer in the middle. :param k_hop: length of Cheb...
the_stack_v2_python_sparse
networks/stgcn.py
WfcCross/traffic-prediction
train
0
9cb79d0b5ef5ae4005c29fd97208432b06dc481b
[ "super(NetworkXFigure, self).__init__(name=name, width=width, height=height, interactive=interactive, font=font, logging=logging, template=template, port=port, **kwargs)\nself.G = graph\nself._save_data()", "data = json_graph.node_link_data(self.G)\ns = json.dumps(data)\nreturn s" ]
<|body_start_0|> super(NetworkXFigure, self).__init__(name=name, width=width, height=height, interactive=interactive, font=font, logging=logging, template=template, port=port, **kwargs) self.G = graph self._save_data() <|end_body_0|> <|body_start_1|> data = json_graph.node_link_data(sel...
NetworkXFigure
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NetworkXFigure: def __init__(self, graph, name='figure', width=400, height=100, interactive=True, font='Asap', logging=False, template=None, port=8000, **kwargs): """data : networkx gprah networkx graph used for the plot. name : string name of visualisation. This will appear in the title...
stack_v2_sparse_classes_75kplus_train_073053
1,847
no_license
[ { "docstring": "data : networkx gprah networkx graph used for the plot. name : string name of visualisation. This will appear in the title bar of the webpage, and is the name of the folder where your files will be stored. width : int width of the figure in pixels (default is 400) height : int height of the figu...
2
stack_v2_sparse_classes_30k_train_022047
Implement the Python class `NetworkXFigure` described below. Class description: Implement the NetworkXFigure class. Method signatures and docstrings: - def __init__(self, graph, name='figure', width=400, height=100, interactive=True, font='Asap', logging=False, template=None, port=8000, **kwargs): data : networkx gpr...
Implement the Python class `NetworkXFigure` described below. Class description: Implement the NetworkXFigure class. Method signatures and docstrings: - def __init__(self, graph, name='figure', width=400, height=100, interactive=True, font='Asap', logging=False, template=None, port=8000, **kwargs): data : networkx gpr...
50aa44b1c893abdfdf4e8a6510ac9f54706c3554
<|skeleton|> class NetworkXFigure: def __init__(self, graph, name='figure', width=400, height=100, interactive=True, font='Asap', logging=False, template=None, port=8000, **kwargs): """data : networkx gprah networkx graph used for the plot. name : string name of visualisation. This will appear in the title...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NetworkXFigure: def __init__(self, graph, name='figure', width=400, height=100, interactive=True, font='Asap', logging=False, template=None, port=8000, **kwargs): """data : networkx gprah networkx graph used for the plot. name : string name of visualisation. This will appear in the title bar of the we...
the_stack_v2_python_sparse
d3py/networkx_figure.py
bigsnarfdude/d3py
train
4
5517b21befbc475c798db26286b46a79e8f7b66b
[ "self.N = ZZ(N)\nself.n = euler_phi(N)\nself.m = m\nself.__i = 0\nself.K = IntegerModRing(q)\nif self.n != D.n:\n raise ValueError('Noise distribution has dimensions %d != %d' % (D.n, self.n))\nself.D = D\nself.q = q\nif poly is not None:\n self.poly = poly\nelse:\n self.poly = cyclotomic_polynomial(self.N...
<|body_start_0|> self.N = ZZ(N) self.n = euler_phi(N) self.m = m self.__i = 0 self.K = IntegerModRing(q) if self.n != D.n: raise ValueError('Noise distribution has dimensions %d != %d' % (D.n, self.n)) self.D = D self.q = q if poly is n...
Ring Learning with Errors oracle. .. automethod:: __init__ .. automethod:: __call__
RingLWE
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RingLWE: """Ring Learning with Errors oracle. .. automethod:: __init__ .. automethod:: __call__""" def __init__(self, N, q, D, poly=None, secret_dist='uniform', m=None): """Construct a Ring-LWE oracle in dimension ``n=phi(N)`` over a ring of order ``q`` with noise distribution ``D``....
stack_v2_sparse_classes_75kplus_train_073054
31,769
no_license
[ { "docstring": "Construct a Ring-LWE oracle in dimension ``n=phi(N)`` over a ring of order ``q`` with noise distribution ``D``. INPUT: - ``N`` - index of cyclotomic polynomial (integer > 0, must be power of 2) - ``q`` - modulus typically > N (integer > 0) - ``D`` - an error distribution such as an instance of :...
3
stack_v2_sparse_classes_30k_train_037836
Implement the Python class `RingLWE` described below. Class description: Ring Learning with Errors oracle. .. automethod:: __init__ .. automethod:: __call__ Method signatures and docstrings: - def __init__(self, N, q, D, poly=None, secret_dist='uniform', m=None): Construct a Ring-LWE oracle in dimension ``n=phi(N)`` ...
Implement the Python class `RingLWE` described below. Class description: Ring Learning with Errors oracle. .. automethod:: __init__ .. automethod:: __call__ Method signatures and docstrings: - def __init__(self, N, q, D, poly=None, secret_dist='uniform', m=None): Construct a Ring-LWE oracle in dimension ``n=phi(N)`` ...
0d9eacbf74e2acffefde93e39f8bcbec745cdaba
<|skeleton|> class RingLWE: """Ring Learning with Errors oracle. .. automethod:: __init__ .. automethod:: __call__""" def __init__(self, N, q, D, poly=None, secret_dist='uniform', m=None): """Construct a Ring-LWE oracle in dimension ``n=phi(N)`` over a ring of order ``q`` with noise distribution ``D``....
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RingLWE: """Ring Learning with Errors oracle. .. automethod:: __init__ .. automethod:: __call__""" def __init__(self, N, q, D, poly=None, secret_dist='uniform', m=None): """Construct a Ring-LWE oracle in dimension ``n=phi(N)`` over a ring of order ``q`` with noise distribution ``D``. INPUT: - ``N...
the_stack_v2_python_sparse
sage/src/sage/crypto/lwe.py
bopopescu/geosci
train
0
4a993a401097f076880d9eea8c5066af9daae10d
[ "super().__init__(config)\nself.indexCorpusRef = indexCorpusRef\nself.k = 2.0\nself.b = 0.75", "index = indexCorpus.getIndex()\navgdl = self.indexCorpusRef.getCorpus().getNbMoyenMot()\nokapiIndex = dict()\nfor doc, dictTermeFreq in index.items():\n tmp = dict()\n for term, freq in dictTermeFreq.items():\n ...
<|body_start_0|> super().__init__(config) self.indexCorpusRef = indexCorpusRef self.k = 2.0 self.b = 0.75 <|end_body_0|> <|body_start_1|> index = indexCorpus.getIndex() avgdl = self.indexCorpusRef.getCorpus().getNbMoyenMot() okapiIndex = dict() for doc, d...
Cette classe attribue comme score aux termes, leur score okapi d'après un corpus de référence et selon l'agrégation choisie dans la config.
ClasseurOkapi
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClasseurOkapi: """Cette classe attribue comme score aux termes, leur score okapi d'après un corpus de référence et selon l'agrégation choisie dans la config.""" def __init__(self, config, indexCorpusRef): """Constructeur de la classe ClasseurOkapi Parameters ---------- config : Confi...
stack_v2_sparse_classes_75kplus_train_073055
2,776
no_license
[ { "docstring": "Constructeur de la classe ClasseurOkapi Parameters ---------- config : Config Objet qui contient tous les paramètres de la configuration de l'extraction. indexCorpusRef : Indexeur L'index du corpus de référence qui permet de calculer l'idf pour okapi.", "name": "__init__", "signature": "...
2
null
Implement the Python class `ClasseurOkapi` described below. Class description: Cette classe attribue comme score aux termes, leur score okapi d'après un corpus de référence et selon l'agrégation choisie dans la config. Method signatures and docstrings: - def __init__(self, config, indexCorpusRef): Constructeur de la ...
Implement the Python class `ClasseurOkapi` described below. Class description: Cette classe attribue comme score aux termes, leur score okapi d'après un corpus de référence et selon l'agrégation choisie dans la config. Method signatures and docstrings: - def __init__(self, config, indexCorpusRef): Constructeur de la ...
e47213fe33f6f6b404c60b0c830c1daa9e57c9fd
<|skeleton|> class ClasseurOkapi: """Cette classe attribue comme score aux termes, leur score okapi d'après un corpus de référence et selon l'agrégation choisie dans la config.""" def __init__(self, config, indexCorpusRef): """Constructeur de la classe ClasseurOkapi Parameters ---------- config : Confi...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ClasseurOkapi: """Cette classe attribue comme score aux termes, leur score okapi d'après un corpus de référence et selon l'agrégation choisie dans la config.""" def __init__(self, config, indexCorpusRef): """Constructeur de la classe ClasseurOkapi Parameters ---------- config : Config Objet qui c...
the_stack_v2_python_sparse
PLDAC/classeur/classeurOkapi.py
antocad/Sorbonne_Master_DAC
train
0
e270144ca54ab5fba77c49ebc0a5dd127302b0b7
[ "res = [[]]\nfor num in nums:\n res = res + [[num] + i for i in res]\nreturn res", "dic = dict()\nfor num in nums:\n dic[num] = dic.get(num, 0) + 1\nres = [[]]\nfor i, v in dic.items():\n tmp = res.copy()\n for j in res:\n tmp.extend((j + [i] * (k + 1) for k in range(v)))\n res = tmp\nreturn...
<|body_start_0|> res = [[]] for num in nums: res = res + [[num] + i for i in res] return res <|end_body_0|> <|body_start_1|> dic = dict() for num in nums: dic[num] = dic.get(num, 0) + 1 res = [[]] for i, v in dic.items(): tmp =...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def subsets(self, nums: List[int]) -> List[List[int]]: """78. 子集 无重复""" <|body_0|> def subsetsWithDup(self, nums: List[int]) -> List[List[int]]: """90. 子集 II 给你一个整数数组 nums ,其中可能包含重复元素,请你返回该数组所有可能的子集(幂集)。 解集 不能 包含重复的子集。返回的解集中,子集可以按 任意顺序 排列。""" <|body...
stack_v2_sparse_classes_75kplus_train_073056
1,094
no_license
[ { "docstring": "78. 子集 无重复", "name": "subsets", "signature": "def subsets(self, nums: List[int]) -> List[List[int]]" }, { "docstring": "90. 子集 II 给你一个整数数组 nums ,其中可能包含重复元素,请你返回该数组所有可能的子集(幂集)。 解集 不能 包含重复的子集。返回的解集中,子集可以按 任意顺序 排列。", "name": "subsetsWithDup", "signature": "def subsetsWithDup...
2
stack_v2_sparse_classes_30k_train_029470
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def subsets(self, nums: List[int]) -> List[List[int]]: 78. 子集 无重复 - def subsetsWithDup(self, nums: List[int]) -> List[List[int]]: 90. 子集 II 给你一个整数数组 nums ,其中可能包含重复元素,请你返回该数组所有可能的...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def subsets(self, nums: List[int]) -> List[List[int]]: 78. 子集 无重复 - def subsetsWithDup(self, nums: List[int]) -> List[List[int]]: 90. 子集 II 给你一个整数数组 nums ,其中可能包含重复元素,请你返回该数组所有可能的...
330330ef6bc42eeb17f4dea53c30d230506b4e8f
<|skeleton|> class Solution: def subsets(self, nums: List[int]) -> List[List[int]]: """78. 子集 无重复""" <|body_0|> def subsetsWithDup(self, nums: List[int]) -> List[List[int]]: """90. 子集 II 给你一个整数数组 nums ,其中可能包含重复元素,请你返回该数组所有可能的子集(幂集)。 解集 不能 包含重复的子集。返回的解集中,子集可以按 任意顺序 排列。""" <|body...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def subsets(self, nums: List[int]) -> List[List[int]]: """78. 子集 无重复""" res = [[]] for num in nums: res = res + [[num] + i for i in res] return res def subsetsWithDup(self, nums: List[int]) -> List[List[int]]: """90. 子集 II 给你一个整数数组 nums ,其中可能包...
the_stack_v2_python_sparse
Code/leetcode_everyday/0331.py
NiceToMeeetU/ToGetReady
train
0
13899fbb5823e3e140cf5c1738ba6da5be2ccd0b
[ "self.service = 'pcm'\nself.root = 'ManagedSystem'\nself.ip = ip\nself.x_api_session = x_api_session\nself.managedsystem_id = managedsystem_id", "HTTP_object = HTTPClient.HTTPClient(self.service, self.ip, self.root, 'application/vnd.ibm.powervm.pcm.xml', self.x_api_session)\nHTTP_object.HTTPGet(append=self.manage...
<|body_start_0|> self.service = 'pcm' self.root = 'ManagedSystem' self.ip = ip self.x_api_session = x_api_session self.managedsystem_id = managedsystem_id <|end_body_0|> <|body_start_1|> HTTP_object = HTTPClient.HTTPClient(self.service, self.ip, self.root, 'application/v...
ManagedSystemPcmPreference
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ManagedSystemPcmPreference: def __init__(self, ip, managedsystem_id, x_api_session): """Initializes the required arguments for ManagedSystemPcmPreferences Args: ip : IP address of the HMC Managedsystem_id : The managed system uuid for which the pcm preferences has to be obtained x_api_se...
stack_v2_sparse_classes_75kplus_train_073057
6,271
permissive
[ { "docstring": "Initializes the required arguments for ManagedSystemPcmPreferences Args: ip : IP address of the HMC Managedsystem_id : The managed system uuid for which the pcm preferences has to be obtained x_api_session: The session id for the current session", "name": "__init__", "signature": "def __...
4
stack_v2_sparse_classes_30k_train_036025
Implement the Python class `ManagedSystemPcmPreference` described below. Class description: Implement the ManagedSystemPcmPreference class. Method signatures and docstrings: - def __init__(self, ip, managedsystem_id, x_api_session): Initializes the required arguments for ManagedSystemPcmPreferences Args: ip : IP addr...
Implement the Python class `ManagedSystemPcmPreference` described below. Class description: Implement the ManagedSystemPcmPreference class. Method signatures and docstrings: - def __init__(self, ip, managedsystem_id, x_api_session): Initializes the required arguments for ManagedSystemPcmPreferences Args: ip : IP addr...
8e46a5a25a57d07f0612404f4b978234d6d2cd4b
<|skeleton|> class ManagedSystemPcmPreference: def __init__(self, ip, managedsystem_id, x_api_session): """Initializes the required arguments for ManagedSystemPcmPreferences Args: ip : IP address of the HMC Managedsystem_id : The managed system uuid for which the pcm preferences has to be obtained x_api_se...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ManagedSystemPcmPreference: def __init__(self, ip, managedsystem_id, x_api_session): """Initializes the required arguments for ManagedSystemPcmPreferences Args: ip : IP address of the HMC Managedsystem_id : The managed system uuid for which the pcm preferences has to be obtained x_api_session: The ses...
the_stack_v2_python_sparse
src/performance_capacity_monitor/ManagedSystemPcm.py
Python3pkg/HmcRestClient
train
0
0c537649fc89f3a6db7c05b8ef1c75265fe7524d
[ "reflection_table = SumIntensityReducer.reduce_on_intensities(reflection_table)\nreflection_table = ScaleIntensityReducer.reduce_on_intensities(reflection_table)\nreturn reflection_table", "reflection_table = SumIntensityReducer.apply_scaling_factors(reflection_table)\nreflection_table = ScaleIntensityReducer.app...
<|body_start_0|> reflection_table = SumIntensityReducer.reduce_on_intensities(reflection_table) reflection_table = ScaleIntensityReducer.reduce_on_intensities(reflection_table) return reflection_table <|end_body_0|> <|body_start_1|> reflection_table = SumIntensityReducer.apply_scaling_f...
Reduction methods for data with sum and scale intensities. Only reflections with valid values for all intensity types are retained.
SumAndScaleIntensityReducer
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SumAndScaleIntensityReducer: """Reduction methods for data with sum and scale intensities. Only reflections with valid values for all intensity types are retained.""" def reduce_on_intensities(reflection_table): """Select those with valid reflections for all values.""" <|body...
stack_v2_sparse_classes_75kplus_train_073058
38,270
permissive
[ { "docstring": "Select those with valid reflections for all values.", "name": "reduce_on_intensities", "signature": "def reduce_on_intensities(reflection_table)" }, { "docstring": "Apply corrections to the intensities and variances.", "name": "apply_scaling_factors", "signature": "def ap...
2
stack_v2_sparse_classes_30k_train_004285
Implement the Python class `SumAndScaleIntensityReducer` described below. Class description: Reduction methods for data with sum and scale intensities. Only reflections with valid values for all intensity types are retained. Method signatures and docstrings: - def reduce_on_intensities(reflection_table): Select those...
Implement the Python class `SumAndScaleIntensityReducer` described below. Class description: Reduction methods for data with sum and scale intensities. Only reflections with valid values for all intensity types are retained. Method signatures and docstrings: - def reduce_on_intensities(reflection_table): Select those...
88bf7f7c5ac44defc046ebf0719cde748092cfff
<|skeleton|> class SumAndScaleIntensityReducer: """Reduction methods for data with sum and scale intensities. Only reflections with valid values for all intensity types are retained.""" def reduce_on_intensities(reflection_table): """Select those with valid reflections for all values.""" <|body...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SumAndScaleIntensityReducer: """Reduction methods for data with sum and scale intensities. Only reflections with valid values for all intensity types are retained.""" def reduce_on_intensities(reflection_table): """Select those with valid reflections for all values.""" reflection_table = ...
the_stack_v2_python_sparse
src/dials/util/filter_reflections.py
dials/dials
train
71
d33f5928e4414fbed5d4a09ae32baa2c6f413c19
[ "super(Decoder, self).__init__()\nself.input_size = input_size\nself.hidden_size = hidden_size\nself.num_layers = num_layers\nself.proba_output = proba_output\nif rnn_type == 'LSTM':\n self.model = nn.LSTM(input_size=self.input_size, hidden_size=self.hidden_size, num_layers=self.num_layers, batch_first=batch_fir...
<|body_start_0|> super(Decoder, self).__init__() self.input_size = input_size self.hidden_size = hidden_size self.num_layers = num_layers self.proba_output = proba_output if rnn_type == 'LSTM': self.model = nn.LSTM(input_size=self.input_size, hidden_size=self....
Decoder Network
Decoder
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Decoder: """Decoder Network""" def __init__(self, input_size, hidden_size, num_layers, dropout=0, batch_first=True, rnn_type='LSTM', proba_output=False): """Create Encoder Args: input_size (int): number of features per time step hidden_size (int): number of hidden nodes per time step...
stack_v2_sparse_classes_75kplus_train_073059
14,969
permissive
[ { "docstring": "Create Encoder Args: input_size (int): number of features per time step hidden_size (int): number of hidden nodes per time step num_layers (int): number of layers dropout (float, optional): percentage of nodes that should switched out at any term. Defaults to 0. batch_first (bool, optional): if ...
2
stack_v2_sparse_classes_30k_train_038284
Implement the Python class `Decoder` described below. Class description: Decoder Network Method signatures and docstrings: - def __init__(self, input_size, hidden_size, num_layers, dropout=0, batch_first=True, rnn_type='LSTM', proba_output=False): Create Encoder Args: input_size (int): number of features per time ste...
Implement the Python class `Decoder` described below. Class description: Decoder Network Method signatures and docstrings: - def __init__(self, input_size, hidden_size, num_layers, dropout=0, batch_first=True, rnn_type='LSTM', proba_output=False): Create Encoder Args: input_size (int): number of features per time ste...
5b4a61b5dd0bc259ffe68223877949ef4ebfa5e3
<|skeleton|> class Decoder: """Decoder Network""" def __init__(self, input_size, hidden_size, num_layers, dropout=0, batch_first=True, rnn_type='LSTM', proba_output=False): """Create Encoder Args: input_size (int): number of features per time step hidden_size (int): number of hidden nodes per time step...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Decoder: """Decoder Network""" def __init__(self, input_size, hidden_size, num_layers, dropout=0, batch_first=True, rnn_type='LSTM', proba_output=False): """Create Encoder Args: input_size (int): number of features per time step hidden_size (int): number of hidden nodes per time step num_layers (...
the_stack_v2_python_sparse
src/models/anomalia/layers.py
maurony/ts-vrae
train
1
7c34c1662c0e62da35a805dbb0ac6efa7ac5f12e
[ "self.w = INITIALIZERS[initializer](inputdim, units) if initializer else INITIALIZERS['random'](inputdim, units)\nself.regularizer = regularizer if regularizer else 'l'\nself.activation = activation\nself.dropout = dropout\nself.optimizer = None\nself.dz_dw = None\nself.dz_dx = None\nself.da_dz = None\nself.dr_dw =...
<|body_start_0|> self.w = INITIALIZERS[initializer](inputdim, units) if initializer else INITIALIZERS['random'](inputdim, units) self.regularizer = regularizer if regularizer else 'l' self.activation = activation self.dropout = dropout self.optimizer = None self.dz_dw = N...
Default dense layer class
DefaultDenseLayer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DefaultDenseLayer: """Default dense layer class""" def __init__(self, inputdim: int, units: int, activation: str, initializer: str=None, regularizer: str=None, dropout: float=None) -> None: """Initialize default dense layer Args: inputdim: number of input units units: number of units...
stack_v2_sparse_classes_75kplus_train_073060
5,858
no_license
[ { "docstring": "Initialize default dense layer Args: inputdim: number of input units units: number of units in layer activation: activation function string => should be a key of ACTIVATIONS initializer: weight initialization scheme => should be a key of INITIALIZERS regularizer: regularization method => should ...
3
stack_v2_sparse_classes_30k_train_028905
Implement the Python class `DefaultDenseLayer` described below. Class description: Default dense layer class Method signatures and docstrings: - def __init__(self, inputdim: int, units: int, activation: str, initializer: str=None, regularizer: str=None, dropout: float=None) -> None: Initialize default dense layer Arg...
Implement the Python class `DefaultDenseLayer` described below. Class description: Default dense layer class Method signatures and docstrings: - def __init__(self, inputdim: int, units: int, activation: str, initializer: str=None, regularizer: str=None, dropout: float=None) -> None: Initialize default dense layer Arg...
9e6d3846968597349eabda3eb07e70253baf4786
<|skeleton|> class DefaultDenseLayer: """Default dense layer class""" def __init__(self, inputdim: int, units: int, activation: str, initializer: str=None, regularizer: str=None, dropout: float=None) -> None: """Initialize default dense layer Args: inputdim: number of input units units: number of units...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DefaultDenseLayer: """Default dense layer class""" def __init__(self, inputdim: int, units: int, activation: str, initializer: str=None, regularizer: str=None, dropout: float=None) -> None: """Initialize default dense layer Args: inputdim: number of input units units: number of units in layer act...
the_stack_v2_python_sparse
Packages/mlr/NN/Layer.py
akshat0123/MLReview
train
0
9afc2eed4b3540dae8c961b8def76698cc1cbfe6
[ "global mongo\nmongo = MongoDb()\nmongo.db = 'xyh_api'\nmongo.collection = 'cj'\nprint('the pid is %s ,and ppid is %s ' % (os.getpid(), os.getppid()))\nfor i in range(len(CJ.price_list) - 1):\n low_price = CJ.price_list[i]\n high_price = CJ.price_list[i + 1]\n cls.deep_exec(advertiser_id, low_price, high_p...
<|body_start_0|> global mongo mongo = MongoDb() mongo.db = 'xyh_api' mongo.collection = 'cj' print('the pid is %s ,and ppid is %s ' % (os.getpid(), os.getppid())) for i in range(len(CJ.price_list) - 1): low_price = CJ.price_list[i] high_price = CJ....
Execute
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Execute: def execute(cls, advertiser_id): """The Thread use global parameter together (pymongo can not connect before create fork ) :param advertiser_id: :return:""" <|body_0|> def deep_exec(cls, advertiser_id, low_price, high_price): """闭包 :param cls: :param adverti...
stack_v2_sparse_classes_75kplus_train_073061
6,683
no_license
[ { "docstring": "The Thread use global parameter together (pymongo can not connect before create fork ) :param advertiser_id: :return:", "name": "execute", "signature": "def execute(cls, advertiser_id)" }, { "docstring": "闭包 :param cls: :param advertiser_id: :param low_price: :param high_price: :...
2
stack_v2_sparse_classes_30k_train_004044
Implement the Python class `Execute` described below. Class description: Implement the Execute class. Method signatures and docstrings: - def execute(cls, advertiser_id): The Thread use global parameter together (pymongo can not connect before create fork ) :param advertiser_id: :return: - def deep_exec(cls, advertis...
Implement the Python class `Execute` described below. Class description: Implement the Execute class. Method signatures and docstrings: - def execute(cls, advertiser_id): The Thread use global parameter together (pymongo can not connect before create fork ) :param advertiser_id: :return: - def deep_exec(cls, advertis...
f40e4f21c3805db164ce84e24711fb9b27c3fa5b
<|skeleton|> class Execute: def execute(cls, advertiser_id): """The Thread use global parameter together (pymongo can not connect before create fork ) :param advertiser_id: :return:""" <|body_0|> def deep_exec(cls, advertiser_id, low_price, high_price): """闭包 :param cls: :param adverti...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Execute: def execute(cls, advertiser_id): """The Thread use global parameter together (pymongo can not connect before create fork ) :param advertiser_id: :return:""" global mongo mongo = MongoDb() mongo.db = 'xyh_api' mongo.collection = 'cj' print('the pid is %s...
the_stack_v2_python_sparse
ApiClass/api/Cj.py
First-met47L/xyhApi
train
0
74cada21c63162ab8915a1fd637e80d2a82fa9ff
[ "super(LogWatcherBuilder, self).__init__(*args, **kwargs)\nself._arguments = None\nreturn", "if self._product is None:\n self._product = LogWatcher(output=self.output_file, connection=self.node.connection, arguments=self.arguments)\nreturn self._product" ]
<|body_start_0|> super(LogWatcherBuilder, self).__init__(*args, **kwargs) self._arguments = None return <|end_body_0|> <|body_start_1|> if self._product is None: self._product = LogWatcher(output=self.output_file, connection=self.node.connection, arguments=self.arguments) ...
A builder of log watchers
LogWatcherBuilder
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LogWatcherBuilder: """A builder of log watchers""" def __init__(self, *args, **kwargs): """:param: - `node`: device to watch - `parameters`: named tuple built from config file - `output`: storageobject to send output to - `name`: a name to add to the output file - `event`: event to w...
stack_v2_sparse_classes_75kplus_train_073062
7,765
permissive
[ { "docstring": ":param: - `node`: device to watch - `parameters`: named tuple built from config file - `output`: storageobject to send output to - `name`: a name to add to the output file - `event`: event to watch to decide when to stop", "name": "__init__", "signature": "def __init__(self, *args, **kwa...
2
stack_v2_sparse_classes_30k_train_010835
Implement the Python class `LogWatcherBuilder` described below. Class description: A builder of log watchers Method signatures and docstrings: - def __init__(self, *args, **kwargs): :param: - `node`: device to watch - `parameters`: named tuple built from config file - `output`: storageobject to send output to - `name...
Implement the Python class `LogWatcherBuilder` described below. Class description: A builder of log watchers Method signatures and docstrings: - def __init__(self, *args, **kwargs): :param: - `node`: device to watch - `parameters`: named tuple built from config file - `output`: storageobject to send output to - `name...
b4d1c77e1d611fe2b30768b42bdc7493afb0ea95
<|skeleton|> class LogWatcherBuilder: """A builder of log watchers""" def __init__(self, *args, **kwargs): """:param: - `node`: device to watch - `parameters`: named tuple built from config file - `output`: storageobject to send output to - `name`: a name to add to the output file - `event`: event to w...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LogWatcherBuilder: """A builder of log watchers""" def __init__(self, *args, **kwargs): """:param: - `node`: device to watch - `parameters`: named tuple built from config file - `output`: storageobject to send output to - `name`: a name to add to the output file - `event`: event to watch to decid...
the_stack_v2_python_sparse
apetools/builders/subbuilders/logwatcherbuilders.py
russell-n/oldape
train
0
3801ed79f7c258e89672eb21a2c6c1d76b473ee8
[ "subv = SimpleMachineVertex(None, '')\npl = Placement(subv, 0, 0, 1)\nPlacements([pl])", "pls = Placements()\nself.assertEqual(pls._placements, dict())\nself.assertEqual(pls._machine_vertices, dict())", "subv = list()\nfor i in range(5):\n subv.append(SimpleMachineVertex(None, ''))\npl = list()\nfor i in ran...
<|body_start_0|> subv = SimpleMachineVertex(None, '') pl = Placement(subv, 0, 0, 1) Placements([pl]) <|end_body_0|> <|body_start_1|> pls = Placements() self.assertEqual(pls._placements, dict()) self.assertEqual(pls._machine_vertices, dict()) <|end_body_1|> <|body_start_...
tester for placements object in pacman.model.placements.placements
TestPlacements
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestPlacements: """tester for placements object in pacman.model.placements.placements""" def test_create_new_placements(self): """test creating a placements object :return:""" <|body_0|> def test_create_new_empty_placements(self): """checks that creating an empty...
stack_v2_sparse_classes_75kplus_train_073063
2,548
no_license
[ { "docstring": "test creating a placements object :return:", "name": "test_create_new_placements", "signature": "def test_create_new_placements(self)" }, { "docstring": "checks that creating an empty placements object is valid :return:", "name": "test_create_new_empty_placements", "signa...
5
stack_v2_sparse_classes_30k_train_021922
Implement the Python class `TestPlacements` described below. Class description: tester for placements object in pacman.model.placements.placements Method signatures and docstrings: - def test_create_new_placements(self): test creating a placements object :return: - def test_create_new_empty_placements(self): checks t...
Implement the Python class `TestPlacements` described below. Class description: tester for placements object in pacman.model.placements.placements Method signatures and docstrings: - def test_create_new_placements(self): test creating a placements object :return: - def test_create_new_empty_placements(self): checks t...
5c2faba4d823e9341e5c18f61ea9bf8c6e15b687
<|skeleton|> class TestPlacements: """tester for placements object in pacman.model.placements.placements""" def test_create_new_placements(self): """test creating a placements object :return:""" <|body_0|> def test_create_new_empty_placements(self): """checks that creating an empty...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestPlacements: """tester for placements object in pacman.model.placements.placements""" def test_create_new_placements(self): """test creating a placements object :return:""" subv = SimpleMachineVertex(None, '') pl = Placement(subv, 0, 0, 1) Placements([pl]) def test...
the_stack_v2_python_sparse
unittests/model_tests/placement_tests/test_placements_model.py
kfriesth/PACMAN
train
0
d9b1fb5855f68d002f52a538077bc2b88fac4ab1
[ "if not root:\n return\nimport collections\nqueue = collections.deque()\nqueue.append(root)\nwhile queue:\n for _ in range(len(queue)):\n node = queue.popleft()\n if node.left:\n queue.append(node.left)\n if node.right:\n queue.append(node.right)\n node.left, ...
<|body_start_0|> if not root: return import collections queue = collections.deque() queue.append(root) while queue: for _ in range(len(queue)): node = queue.popleft() if node.left: queue.append(node.left)...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def mirrorTree_1(self, root: TreeNode) -> TreeNode: """辅助栈(或队列):广度优先搜索 时间复杂度 O(N): 其中 N 为二叉树的节点数量,建立二叉树镜像需要遍历树的所有节点,占用 O(N) 时间。 空间复杂度 O(N): 最差情况下(当为满二叉树时),栈 stack 最多同时存储 N/2 个节点,占用 O(N) 额外空间 :param root: :return:""" <|body_0|> def mirrorTree_2(self, root: TreeNode)...
stack_v2_sparse_classes_75kplus_train_073064
2,479
no_license
[ { "docstring": "辅助栈(或队列):广度优先搜索 时间复杂度 O(N): 其中 N 为二叉树的节点数量,建立二叉树镜像需要遍历树的所有节点,占用 O(N) 时间。 空间复杂度 O(N): 最差情况下(当为满二叉树时),栈 stack 最多同时存储 N/2 个节点,占用 O(N) 额外空间 :param root: :return:", "name": "mirrorTree_1", "signature": "def mirrorTree_1(self, root: TreeNode) -> TreeNode" }, { "docstring": "递归:深度优先搜索 时...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mirrorTree_1(self, root: TreeNode) -> TreeNode: 辅助栈(或队列):广度优先搜索 时间复杂度 O(N): 其中 N 为二叉树的节点数量,建立二叉树镜像需要遍历树的所有节点,占用 O(N) 时间。 空间复杂度 O(N): 最差情况下(当为满二叉树时),栈 stack 最多同时存储 N/2 个节点,占用 ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mirrorTree_1(self, root: TreeNode) -> TreeNode: 辅助栈(或队列):广度优先搜索 时间复杂度 O(N): 其中 N 为二叉树的节点数量,建立二叉树镜像需要遍历树的所有节点,占用 O(N) 时间。 空间复杂度 O(N): 最差情况下(当为满二叉树时),栈 stack 最多同时存储 N/2 个节点,占用 ...
62419b49000e79962bcdc99cd98afd2fb82ea345
<|skeleton|> class Solution: def mirrorTree_1(self, root: TreeNode) -> TreeNode: """辅助栈(或队列):广度优先搜索 时间复杂度 O(N): 其中 N 为二叉树的节点数量,建立二叉树镜像需要遍历树的所有节点,占用 O(N) 时间。 空间复杂度 O(N): 最差情况下(当为满二叉树时),栈 stack 最多同时存储 N/2 个节点,占用 O(N) 额外空间 :param root: :return:""" <|body_0|> def mirrorTree_2(self, root: TreeNode)...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def mirrorTree_1(self, root: TreeNode) -> TreeNode: """辅助栈(或队列):广度优先搜索 时间复杂度 O(N): 其中 N 为二叉树的节点数量,建立二叉树镜像需要遍历树的所有节点,占用 O(N) 时间。 空间复杂度 O(N): 最差情况下(当为满二叉树时),栈 stack 最多同时存储 N/2 个节点,占用 O(N) 额外空间 :param root: :return:""" if not root: return import collections q...
the_stack_v2_python_sparse
剑指 Offer(第 2 版)/mirrorTree.py
MaoningGuan/LeetCode
train
3
ade4e2711c0e4be2ab7391c863047151edbca670
[ "self.public_folders_parameters = public_folders_parameters\nself.acropolis_parameters = acropolis_parameters\nself.continue_on_error = continue_on_error\nself.deploy_vms_to_cloud = deploy_vms_to_cloud\nself.glacier_retrieval_type = glacier_retrieval_type\nself.hyperv_parameters = hyperv_parameters\nself.kubernetes...
<|body_start_0|> self.public_folders_parameters = public_folders_parameters self.acropolis_parameters = acropolis_parameters self.continue_on_error = continue_on_error self.deploy_vms_to_cloud = deploy_vms_to_cloud self.glacier_retrieval_type = glacier_retrieval_type self...
Implementation of the 'RecoverTaskRequest' model. Create a Restore Task Request for recovering VMs or mounting volumes to mount points. Attributes: public_folders_parameters (PublicFoldersRestoreParameters): Specifies additional parameters for 'kRecoverO365PublicFolders' restore objects. acropolis_parameters (Acropolis...
RecoverTaskRequest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RecoverTaskRequest: """Implementation of the 'RecoverTaskRequest' model. Create a Restore Task Request for recovering VMs or mounting volumes to mount points. Attributes: public_folders_parameters (PublicFoldersRestoreParameters): Specifies additional parameters for 'kRecoverO365PublicFolders' re...
stack_v2_sparse_classes_75kplus_train_073065
13,406
permissive
[ { "docstring": "Constructor for the RecoverTaskRequest class", "name": "__init__", "signature": "def __init__(self, public_folders_parameters=None, acropolis_parameters=None, continue_on_error=None, deploy_vms_to_cloud=None, glacier_retrieval_type=None, hyperv_parameters=None, kubernetes_parameters=None...
2
stack_v2_sparse_classes_30k_test_000370
Implement the Python class `RecoverTaskRequest` described below. Class description: Implementation of the 'RecoverTaskRequest' model. Create a Restore Task Request for recovering VMs or mounting volumes to mount points. Attributes: public_folders_parameters (PublicFoldersRestoreParameters): Specifies additional parame...
Implement the Python class `RecoverTaskRequest` described below. Class description: Implementation of the 'RecoverTaskRequest' model. Create a Restore Task Request for recovering VMs or mounting volumes to mount points. Attributes: public_folders_parameters (PublicFoldersRestoreParameters): Specifies additional parame...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class RecoverTaskRequest: """Implementation of the 'RecoverTaskRequest' model. Create a Restore Task Request for recovering VMs or mounting volumes to mount points. Attributes: public_folders_parameters (PublicFoldersRestoreParameters): Specifies additional parameters for 'kRecoverO365PublicFolders' re...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RecoverTaskRequest: """Implementation of the 'RecoverTaskRequest' model. Create a Restore Task Request for recovering VMs or mounting volumes to mount points. Attributes: public_folders_parameters (PublicFoldersRestoreParameters): Specifies additional parameters for 'kRecoverO365PublicFolders' restore objects...
the_stack_v2_python_sparse
cohesity_management_sdk/models/recover_task_request.py
cohesity/management-sdk-python
train
24
f3a6d3467cac101fe045f6a1c37c8795fbb1e426
[ "while True:\n for read_file in file_list:\n try:\n print('Produced %s', read_file.strip())\n queue.put(read_file.strip())\n time.sleep(random.random())\n except ValueError:\n continue", "while True:\n try:\n read_file = queue.get()\n p...
<|body_start_0|> while True: for read_file in file_list: try: print('Produced %s', read_file.strip()) queue.put(read_file.strip()) time.sleep(random.random()) except ValueError: continue <...
Producer Consumer Multi Thread Class Summary. Using the Consumer Producer pattern Reference Python Consumer Producer pattern http://agiliq.com/blog/2013/10/producer-consumer-problem-in-python/ Multi Thread Design pattern
ProducerConsumerClassSummary
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProducerConsumerClassSummary: """Producer Consumer Multi Thread Class Summary. Using the Consumer Producer pattern Reference Python Consumer Producer pattern http://agiliq.com/blog/2013/10/producer-consumer-problem-in-python/ Multi Thread Design pattern""" def producer_run(self, file_list): ...
stack_v2_sparse_classes_75kplus_train_073066
1,578
permissive
[ { "docstring": "Running Producer Setting read word net file into the Queue", "name": "producer_run", "signature": "def producer_run(self, file_list)" }, { "docstring": "Running Consumer Taking the Calculate average vector", "name": "consumer_run", "signature": "def consumer_run(self, wik...
2
stack_v2_sparse_classes_30k_train_054477
Implement the Python class `ProducerConsumerClassSummary` described below. Class description: Producer Consumer Multi Thread Class Summary. Using the Consumer Producer pattern Reference Python Consumer Producer pattern http://agiliq.com/blog/2013/10/producer-consumer-problem-in-python/ Multi Thread Design pattern Met...
Implement the Python class `ProducerConsumerClassSummary` described below. Class description: Producer Consumer Multi Thread Class Summary. Using the Consumer Producer pattern Reference Python Consumer Producer pattern http://agiliq.com/blog/2013/10/producer-consumer-problem-in-python/ Multi Thread Design pattern Met...
2ea8bf0168ea53c804412b40fdb4d9b70b043073
<|skeleton|> class ProducerConsumerClassSummary: """Producer Consumer Multi Thread Class Summary. Using the Consumer Producer pattern Reference Python Consumer Producer pattern http://agiliq.com/blog/2013/10/producer-consumer-problem-in-python/ Multi Thread Design pattern""" def producer_run(self, file_list): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ProducerConsumerClassSummary: """Producer Consumer Multi Thread Class Summary. Using the Consumer Producer pattern Reference Python Consumer Producer pattern http://agiliq.com/blog/2013/10/producer-consumer-problem-in-python/ Multi Thread Design pattern""" def producer_run(self, file_list): """Ru...
the_stack_v2_python_sparse
summary/producer_consumer_class_summary.py
SnowMasaya/Chainer-Slack-Twitter-Dialogue
train
56
fbb71256f7965c966eaed7226399a3ca76b48f19
[ "super(PatchDiscriminator, self).__init__()\nuse_bias = norm_layer == nn.InstanceNorm2d\nself.ganFeat_loss = ganFeat_loss\nsequence = [[nn.Conv2d(in_ch, fch, kernel_size=4, stride=2, padding=1, padding_mode=padding_mode), nn.LeakyReLU(0.2, inplace=False)]]\nfor n in range(1, n_layers_D):\n nf_prev = fch\n fch...
<|body_start_0|> super(PatchDiscriminator, self).__init__() use_bias = norm_layer == nn.InstanceNorm2d self.ganFeat_loss = ganFeat_loss sequence = [[nn.Conv2d(in_ch, fch, kernel_size=4, stride=2, padding=1, padding_mode=padding_mode), nn.LeakyReLU(0.2, inplace=False)]] for n in r...
PatchDiscriminator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PatchDiscriminator: def __init__(self, in_ch=6, fch=64, n_layers_D=4, norm_layer=nn.BatchNorm2d, padding_mode='reflect', ganFeat_loss=True): """:param in_ch: 输入通道数 :param fch: 第一层卷积的通道数""" <|body_0|> def forward(self, x): """:param x: 输入图像 [b, 3, 256, 256] :return:""...
stack_v2_sparse_classes_75kplus_train_073067
4,091
no_license
[ { "docstring": ":param in_ch: 输入通道数 :param fch: 第一层卷积的通道数", "name": "__init__", "signature": "def __init__(self, in_ch=6, fch=64, n_layers_D=4, norm_layer=nn.BatchNorm2d, padding_mode='reflect', ganFeat_loss=True)" }, { "docstring": ":param x: 输入图像 [b, 3, 256, 256] :return:", "name": "forwar...
2
null
Implement the Python class `PatchDiscriminator` described below. Class description: Implement the PatchDiscriminator class. Method signatures and docstrings: - def __init__(self, in_ch=6, fch=64, n_layers_D=4, norm_layer=nn.BatchNorm2d, padding_mode='reflect', ganFeat_loss=True): :param in_ch: 输入通道数 :param fch: 第一层卷积...
Implement the Python class `PatchDiscriminator` described below. Class description: Implement the PatchDiscriminator class. Method signatures and docstrings: - def __init__(self, in_ch=6, fch=64, n_layers_D=4, norm_layer=nn.BatchNorm2d, padding_mode='reflect', ganFeat_loss=True): :param in_ch: 输入通道数 :param fch: 第一层卷积...
431b0fc263e461e28d54e1f6a8bb6b39d7bf9e3d
<|skeleton|> class PatchDiscriminator: def __init__(self, in_ch=6, fch=64, n_layers_D=4, norm_layer=nn.BatchNorm2d, padding_mode='reflect', ganFeat_loss=True): """:param in_ch: 输入通道数 :param fch: 第一层卷积的通道数""" <|body_0|> def forward(self, x): """:param x: 输入图像 [b, 3, 256, 256] :return:""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PatchDiscriminator: def __init__(self, in_ch=6, fch=64, n_layers_D=4, norm_layer=nn.BatchNorm2d, padding_mode='reflect', ganFeat_loss=True): """:param in_ch: 输入通道数 :param fch: 第一层卷积的通道数""" super(PatchDiscriminator, self).__init__() use_bias = norm_layer == nn.InstanceNorm2d sel...
the_stack_v2_python_sparse
Pix2pix/discriminator.py
WICKKKKK/urban_fabric_generation
train
6
67191c9d2aa72935e6e6504f77821b3c72c70711
[ "if not len(viewports) > 0:\n raise Exception('Must provide at least one viewport for MegaViewport!')\nself.viewports = viewports\nself.arc_width = arc_width\nx_min = 16384\ny_min = 16384\nx_max = 0\ny_max = 0\nfor viewport in viewports:\n geometry = ManagedWindow.lookup_viewport_geometry(viewport)\n x_min...
<|body_start_0|> if not len(viewports) > 0: raise Exception('Must provide at least one viewport for MegaViewport!') self.viewports = viewports self.arc_width = arc_width x_min = 16384 y_min = 16384 x_max = 0 y_max = 0 for viewport in viewports:...
Helper for converting angular offsets to viewport coordinates across the span of all viewports. It is assumed that: * All given viewports have the same dimensions. * The pointing device is located roughly at the center of the cylinder.
MegaViewport
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MegaViewport: """Helper for converting angular offsets to viewport coordinates across the span of all viewports. It is assumed that: * All given viewports have the same dimensions. * The pointing device is located roughly at the center of the cylinder.""" def __init__(self, viewports, arc_wi...
stack_v2_sparse_classes_75kplus_train_073068
3,416
permissive
[ { "docstring": "Args: viewports (list[str]): List of viewports from left to right. arc_width (float): Physical arc width of all viewports in radians. Raises: Exception: No viewports provided.", "name": "__init__", "signature": "def __init__(self, viewports, arc_width)" }, { "docstring": "Convert...
3
stack_v2_sparse_classes_30k_train_053626
Implement the Python class `MegaViewport` described below. Class description: Helper for converting angular offsets to viewport coordinates across the span of all viewports. It is assumed that: * All given viewports have the same dimensions. * The pointing device is located roughly at the center of the cylinder. Meth...
Implement the Python class `MegaViewport` described below. Class description: Helper for converting angular offsets to viewport coordinates across the span of all viewports. It is assumed that: * All given viewports have the same dimensions. * The pointing device is located roughly at the center of the cylinder. Meth...
90233b939bb4873c00a72e84ab3f8d1a776edee8
<|skeleton|> class MegaViewport: """Helper for converting angular offsets to viewport coordinates across the span of all viewports. It is assumed that: * All given viewports have the same dimensions. * The pointing device is located roughly at the center of the cylinder.""" def __init__(self, viewports, arc_wi...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MegaViewport: """Helper for converting angular offsets to viewport coordinates across the span of all viewports. It is assumed that: * All given viewports have the same dimensions. * The pointing device is located roughly at the center of the cylinder.""" def __init__(self, viewports, arc_width): ...
the_stack_v2_python_sparse
lg_pointer/src/lg_pointer/megaviewport.py
EndPointCorp/lg_ros_nodes
train
18
755beb1841500cb1e980b91e6f90e5c6e535b5a4
[ "if not root:\n return None\nroot.left = self.removeLeafNodes(root.left, target)\nroot.right = self.removeLeafNodes(root.right, target)\nif root.left == root.right and root.val == target:\n return None\nelse:\n return root", "if not root:\n return None\nif not root.left and (not root.right):\n if r...
<|body_start_0|> if not root: return None root.left = self.removeLeafNodes(root.left, target) root.right = self.removeLeafNodes(root.right, target) if root.left == root.right and root.val == target: return None else: return root <|end_body_0|> ...
简化版本,先处理左右孩子,再处理本身,下面的复杂的写法,也不能算错,只是略显荣誉,但是可以起到剪枝作用
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """简化版本,先处理左右孩子,再处理本身,下面的复杂的写法,也不能算错,只是略显荣誉,但是可以起到剪枝作用""" def removeLeafNodes(self, root, target): """:type root: TreeNode :type target: int :rtype: TreeNode""" <|body_0|> def removeLeafNodes(self, root, target): """:type root: TreeNode :type target: in...
stack_v2_sparse_classes_75kplus_train_073069
2,146
no_license
[ { "docstring": ":type root: TreeNode :type target: int :rtype: TreeNode", "name": "removeLeafNodes", "signature": "def removeLeafNodes(self, root, target)" }, { "docstring": ":type root: TreeNode :type target: int :rtype: TreeNode", "name": "removeLeafNodes", "signature": "def removeLeaf...
2
null
Implement the Python class `Solution` described below. Class description: 简化版本,先处理左右孩子,再处理本身,下面的复杂的写法,也不能算错,只是略显荣誉,但是可以起到剪枝作用 Method signatures and docstrings: - def removeLeafNodes(self, root, target): :type root: TreeNode :type target: int :rtype: TreeNode - def removeLeafNodes(self, root, target): :type root: Tree...
Implement the Python class `Solution` described below. Class description: 简化版本,先处理左右孩子,再处理本身,下面的复杂的写法,也不能算错,只是略显荣誉,但是可以起到剪枝作用 Method signatures and docstrings: - def removeLeafNodes(self, root, target): :type root: TreeNode :type target: int :rtype: TreeNode - def removeLeafNodes(self, root, target): :type root: Tree...
31012a004ba14ddfb468a91925d86bc2dfb60dd4
<|skeleton|> class Solution: """简化版本,先处理左右孩子,再处理本身,下面的复杂的写法,也不能算错,只是略显荣誉,但是可以起到剪枝作用""" def removeLeafNodes(self, root, target): """:type root: TreeNode :type target: int :rtype: TreeNode""" <|body_0|> def removeLeafNodes(self, root, target): """:type root: TreeNode :type target: in...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: """简化版本,先处理左右孩子,再处理本身,下面的复杂的写法,也不能算错,只是略显荣誉,但是可以起到剪枝作用""" def removeLeafNodes(self, root, target): """:type root: TreeNode :type target: int :rtype: TreeNode""" if not root: return None root.left = self.removeLeafNodes(root.left, target) root.right = ...
the_stack_v2_python_sparse
tree/DeleteLeavesWithGivenValue.py
yuhangxiaocs/LeetCodePy
train
1
0063da3aa1ca21c6eea415f3e8cc76f8ba762c44
[ "self.data = data\nself.strict = strict\nself._is_query_dict = isinstance(data, QueryDict)", "data = self.data.get(field_name)\nif filter_param is bool:\n if data is None:\n return default\n else:\n data = handle_bool_value(data)\ndata = value_filter(data, filter_param, strict=self.strict)\nif...
<|body_start_0|> self.data = data self.strict = strict self._is_query_dict = isinstance(data, QueryDict) <|end_body_0|> <|body_start_1|> data = self.data.get(field_name) if filter_param is bool: if data is None: return default else: ...
请求数据过滤器
DataFilter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataFilter: """请求数据过滤器""" def __init__(self, data, strict=False): """初始化 :param data: 请求数据 :param strict: 严格模式""" <|body_0|> def get(self, field_name, filter_param=str, default=None): """获取有效字段值 :param field_name: 字段名称 :param filter_param: 过滤参数 :param default: 默认...
stack_v2_sparse_classes_75kplus_train_073070
3,763
no_license
[ { "docstring": "初始化 :param data: 请求数据 :param strict: 严格模式", "name": "__init__", "signature": "def __init__(self, data, strict=False)" }, { "docstring": "获取有效字段值 :param field_name: 字段名称 :param filter_param: 过滤参数 :param default: 默认值 :return: 字段值", "name": "get", "signature": "def get(self,...
3
null
Implement the Python class `DataFilter` described below. Class description: 请求数据过滤器 Method signatures and docstrings: - def __init__(self, data, strict=False): 初始化 :param data: 请求数据 :param strict: 严格模式 - def get(self, field_name, filter_param=str, default=None): 获取有效字段值 :param field_name: 字段名称 :param filter_param: 过滤...
Implement the Python class `DataFilter` described below. Class description: 请求数据过滤器 Method signatures and docstrings: - def __init__(self, data, strict=False): 初始化 :param data: 请求数据 :param strict: 严格模式 - def get(self, field_name, filter_param=str, default=None): 获取有效字段值 :param field_name: 字段名称 :param filter_param: 过滤...
a4502d14652c6a926e74be6d0f53b2b50ada9c3c
<|skeleton|> class DataFilter: """请求数据过滤器""" def __init__(self, data, strict=False): """初始化 :param data: 请求数据 :param strict: 严格模式""" <|body_0|> def get(self, field_name, filter_param=str, default=None): """获取有效字段值 :param field_name: 字段名称 :param filter_param: 过滤参数 :param default: 默认...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DataFilter: """请求数据过滤器""" def __init__(self, data, strict=False): """初始化 :param data: 请求数据 :param strict: 严格模式""" self.data = data self.strict = strict self._is_query_dict = isinstance(data, QueryDict) def get(self, field_name, filter_param=str, default=None): ...
the_stack_v2_python_sparse
sv/sv_base/extensions/rest/request.py
xianzhishenqie/project_template
train
1
fed57dc3bb8cc0043c1505cca7ff05c86473b362
[ "super().__init__()\nself.inventory = None\nself.supplier_inventory = None\nself.indicators = None\nif inventory is not None and supplier_inventory is not None:\n self.build(inventory, supplier_inventory)", "print(f'Building QUBO')\nself.inventory = inventory\nself.supplier_inventory = supplier_inventory\nself...
<|body_start_0|> super().__init__() self.inventory = None self.supplier_inventory = None self.indicators = None if inventory is not None and supplier_inventory is not None: self.build(inventory, supplier_inventory) <|end_body_0|> <|body_start_1|> print(f'Buil...
SupplierQubo
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SupplierQubo: def __init__(self, inventory: list[int or str] or None, supplier_inventory: list[set[int or str]] or None) -> None: """Initializes the SupplierQubo inventory (list): List of items we want for our inventory supplier_inventory (list of sets): List for each supplier their inve...
stack_v2_sparse_classes_75kplus_train_073071
4,576
permissive
[ { "docstring": "Initializes the SupplierQubo inventory (list): List of items we want for our inventory supplier_inventory (list of sets): List for each supplier their inventory", "name": "__init__", "signature": "def __init__(self, inventory: list[int or str] or None, supplier_inventory: list[set[int or...
4
stack_v2_sparse_classes_30k_train_050324
Implement the Python class `SupplierQubo` described below. Class description: Implement the SupplierQubo class. Method signatures and docstrings: - def __init__(self, inventory: list[int or str] or None, supplier_inventory: list[set[int or str]] or None) -> None: Initializes the SupplierQubo inventory (list): List of...
Implement the Python class `SupplierQubo` described below. Class description: Implement the SupplierQubo class. Method signatures and docstrings: - def __init__(self, inventory: list[int or str] or None, supplier_inventory: list[set[int or str]] or None) -> None: Initializes the SupplierQubo inventory (list): List of...
de3a36e292683485682f0f7b12aabcf8f548bab7
<|skeleton|> class SupplierQubo: def __init__(self, inventory: list[int or str] or None, supplier_inventory: list[set[int or str]] or None) -> None: """Initializes the SupplierQubo inventory (list): List of items we want for our inventory supplier_inventory (list of sets): List for each supplier their inve...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SupplierQubo: def __init__(self, inventory: list[int or str] or None, supplier_inventory: list[set[int or str]] or None) -> None: """Initializes the SupplierQubo inventory (list): List of items we want for our inventory supplier_inventory (list of sets): List for each supplier their inventory""" ...
the_stack_v2_python_sparse
ZebraKet/models/SupplierQubo.py
olegxtend/Hackathon2021
train
0
e0d15e783287de2d262fe73d9af3aab0bc994dbd
[ "context = req.environ['hsm.context']\nauthorize(context)\nnow = timeutils.utcnow()\nservices = db.service_get_all(context)\nhost = ''\nif 'host' in req.GET:\n host = req.GET['host']\nservice = ''\nif 'service' in req.GET:\n service = req.GET['service']\nbinary = ''\nif 'binary' in req.GET:\n binary = req....
<|body_start_0|> context = req.environ['hsm.context'] authorize(context) now = timeutils.utcnow() services = db.service_get_all(context) host = '' if 'host' in req.GET: host = req.GET['host'] service = '' if 'service' in req.GET: se...
ServiceController
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ServiceController: def index(self, req): """Return a list of all running services. Filter by host & service name.""" <|body_0|> def update(self, req, id, body): """Enable/Disable scheduling for a service""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_073072
3,343
permissive
[ { "docstring": "Return a list of all running services. Filter by host & service name.", "name": "index", "signature": "def index(self, req)" }, { "docstring": "Enable/Disable scheduling for a service", "name": "update", "signature": "def update(self, req, id, body)" } ]
2
stack_v2_sparse_classes_30k_train_025575
Implement the Python class `ServiceController` described below. Class description: Implement the ServiceController class. Method signatures and docstrings: - def index(self, req): Return a list of all running services. Filter by host & service name. - def update(self, req, id, body): Enable/Disable scheduling for a s...
Implement the Python class `ServiceController` described below. Class description: Implement the ServiceController class. Method signatures and docstrings: - def index(self, req): Return a list of all running services. Filter by host & service name. - def update(self, req, id, body): Enable/Disable scheduling for a s...
4ce169d5be1c3e8614e5e6f198d3593eb904b97d
<|skeleton|> class ServiceController: def index(self, req): """Return a list of all running services. Filter by host & service name.""" <|body_0|> def update(self, req, id, body): """Enable/Disable scheduling for a service""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ServiceController: def index(self, req): """Return a list of all running services. Filter by host & service name.""" context = req.environ['hsm.context'] authorize(context) now = timeutils.utcnow() services = db.service_get_all(context) host = '' if 'hos...
the_stack_v2_python_sparse
hdcs_manager/source/hsm/hsm/api/contrib/services.py
xuechendi/HDCS
train
1
dbe60bfcd07dcd80e863819d375ee479e710ce1e
[ "self.pat = pat\nM = len(pat)\nR = 256\nself.right = [-1 for i in range(0, R)]\nfor j in range(0, M):\n self.right[ord(pat[j])] = j", "N = len(txt)\nM = len(self.pat)\nskip = 0\ni = 0\nwhile i <= N - M:\n skip = 0\n for j in range(M - 1, -1, -1):\n if not self.pat[j] == txt[i + j]:\n sk...
<|body_start_0|> self.pat = pat M = len(pat) R = 256 self.right = [-1 for i in range(0, R)] for j in range(0, M): self.right[ord(pat[j])] = j <|end_body_0|> <|body_start_1|> N = len(txt) M = len(self.pat) skip = 0 i = 0 while i...
The BoyerMoore class finds the first occurence of a pattern string in a text string. This implementation uses the Boyer-Moore algorithm (with the bad-character rule, but not the strong good suffix rule).
BoyerMoore
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BoyerMoore: """The BoyerMoore class finds the first occurence of a pattern string in a text string. This implementation uses the Boyer-Moore algorithm (with the bad-character rule, but not the strong good suffix rule).""" def __init__(self, pat): """Preprocesses the pattern string. :...
stack_v2_sparse_classes_75kplus_train_073073
2,087
no_license
[ { "docstring": "Preprocesses the pattern string. :param pat: the pattern string", "name": "__init__", "signature": "def __init__(self, pat)" }, { "docstring": "Returns the index of the first occurrrence of the pattern string in the text string. :param txt: the text string :return: the index of t...
2
stack_v2_sparse_classes_30k_train_017895
Implement the Python class `BoyerMoore` described below. Class description: The BoyerMoore class finds the first occurence of a pattern string in a text string. This implementation uses the Boyer-Moore algorithm (with the bad-character rule, but not the strong good suffix rule). Method signatures and docstrings: - de...
Implement the Python class `BoyerMoore` described below. Class description: The BoyerMoore class finds the first occurence of a pattern string in a text string. This implementation uses the Boyer-Moore algorithm (with the bad-character rule, but not the strong good suffix rule). Method signatures and docstrings: - de...
658e3a42b712fb79a4afc8c3acf24161bd5d6737
<|skeleton|> class BoyerMoore: """The BoyerMoore class finds the first occurence of a pattern string in a text string. This implementation uses the Boyer-Moore algorithm (with the bad-character rule, but not the strong good suffix rule).""" def __init__(self, pat): """Preprocesses the pattern string. :...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BoyerMoore: """The BoyerMoore class finds the first occurence of a pattern string in a text string. This implementation uses the Boyer-Moore algorithm (with the bad-character rule, but not the strong good suffix rule).""" def __init__(self, pat): """Preprocesses the pattern string. :param pat: th...
the_stack_v2_python_sparse
algs4/strings/boyer_moore.py
bhavyaagg/python-test
train
0
9abd8b77c1e52da610dfa603796d4cd93ce087b6
[ "self.missing = missing\nself.start_time = None\nself.count = 0\nself.first = missing\nself.datum = None\nreturn", "self.start_time = time.time()\nself.count = 0\nself.first = self.missing\nreturn", "self.datum = CounterDatum(self.first, self.count)\nself.start_time = None\nself.first = self.missing\nself.count...
<|body_start_0|> self.missing = missing self.start_time = None self.count = 0 self.first = missing self.datum = None return <|end_body_0|> <|body_start_1|> self.start_time = time.time() self.count = 0 self.first = self.missing return <|end...
The DataCounter counts the number of times it's called
DataCounter
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataCounter: """The DataCounter counts the number of times it's called""" def __init__(self, missing='na'): """:param: - `missing`: token to use if counter never called""" <|body_0|> def start(self): """:postcondition: - `start_time`: set to time() - `count`: set...
stack_v2_sparse_classes_75kplus_train_073074
1,412
permissive
[ { "docstring": ":param: - `missing`: token to use if counter never called", "name": "__init__", "signature": "def __init__(self, missing='na')" }, { "docstring": ":postcondition: - `start_time`: set to time() - `count`: set to 0 - `first`: set to missing", "name": "start", "signature": "...
3
null
Implement the Python class `DataCounter` described below. Class description: The DataCounter counts the number of times it's called Method signatures and docstrings: - def __init__(self, missing='na'): :param: - `missing`: token to use if counter never called - def start(self): :postcondition: - `start_time`: set to ...
Implement the Python class `DataCounter` described below. Class description: The DataCounter counts the number of times it's called Method signatures and docstrings: - def __init__(self, missing='na'): :param: - `missing`: token to use if counter never called - def start(self): :postcondition: - `start_time`: set to ...
b4d1c77e1d611fe2b30768b42bdc7493afb0ea95
<|skeleton|> class DataCounter: """The DataCounter counts the number of times it's called""" def __init__(self, missing='na'): """:param: - `missing`: token to use if counter never called""" <|body_0|> def start(self): """:postcondition: - `start_time`: set to time() - `count`: set...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DataCounter: """The DataCounter counts the number of times it's called""" def __init__(self, missing='na'): """:param: - `missing`: token to use if counter never called""" self.missing = missing self.start_time = None self.count = 0 self.first = missing sel...
the_stack_v2_python_sparse
apetools/commons/datacounter.py
russell-n/oldape
train
0
99965fb78ed65b5e8eb72500fedfe4844f100ad4
[ "app = Application.objects.as_owner(self.request.user, app_id)\nusers = AccessToken.objects.values('user').filter(application=app).distinct().count()\nreturn super(ApplicationSettings, self).get_context_data(application=app, users=users, **kwargs)", "context = self.get_context_data(app_id)\napp = context.pop('app...
<|body_start_0|> app = Application.objects.as_owner(self.request.user, app_id) users = AccessToken.objects.values('user').filter(application=app).distinct().count() return super(ApplicationSettings, self).get_context_data(application=app, users=users, **kwargs) <|end_body_0|> <|body_start_1|> ...
Displays the Application Settings page. `/admin/apps/settings`
ApplicationSettings
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ApplicationSettings: """Displays the Application Settings page. `/admin/apps/settings`""" def get_context_data(self, app_id, **kwargs): """Returns the context to render the view. Overwrites the method to add the application to the context. Parameters ---------- app_id : int ID identi...
stack_v2_sparse_classes_75kplus_train_073075
8,135
permissive
[ { "docstring": "Returns the context to render the view. Overwrites the method to add the application to the context. Parameters ---------- app_id : int ID identifying the the app in the database. Returns ------- dict context", "name": "get_context_data", "signature": "def get_context_data(self, app_id, ...
2
stack_v2_sparse_classes_30k_train_001256
Implement the Python class `ApplicationSettings` described below. Class description: Displays the Application Settings page. `/admin/apps/settings` Method signatures and docstrings: - def get_context_data(self, app_id, **kwargs): Returns the context to render the view. Overwrites the method to add the application to ...
Implement the Python class `ApplicationSettings` described below. Class description: Displays the Application Settings page. `/admin/apps/settings` Method signatures and docstrings: - def get_context_data(self, app_id, **kwargs): Returns the context to render the view. Overwrites the method to add the application to ...
16d31b5207de9f699fc01054baad1fe65ad1c3ca
<|skeleton|> class ApplicationSettings: """Displays the Application Settings page. `/admin/apps/settings`""" def get_context_data(self, app_id, **kwargs): """Returns the context to render the view. Overwrites the method to add the application to the context. Parameters ---------- app_id : int ID identi...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ApplicationSettings: """Displays the Application Settings page. `/admin/apps/settings`""" def get_context_data(self, app_id, **kwargs): """Returns the context to render the view. Overwrites the method to add the application to the context. Parameters ---------- app_id : int ID identifying the the...
the_stack_v2_python_sparse
geokey/applications/views.py
NeolithEra/geokey
train
0
dceb2f2cb00d255e437826b574cbb22b31bf7de1
[ "partinfo = dict(classes=[], features=[], samples=[])\nfor partname in datadict:\n partition = Partition(datadict[partname], f'{dataset}-{partname}')\n for attr in partinfo:\n partinfo[attr].append(getattr(partition, attr))\n setattr(self, partname.lower(), partition)\nself.classes = tuple(partinfo[...
<|body_start_0|> partinfo = dict(classes=[], features=[], samples=[]) for partname in datadict: partition = Partition(datadict[partname], f'{dataset}-{partname}') for attr in partinfo: partinfo[attr].append(getattr(partition, attr)) setattr(self, partn...
The Dataset class defines the main interfaces for datasets created with this repo. It instantiates Partition objects for each partition of the the dataset and defines methods for viewing metadata and partition information. :func:`__init__`: instantiates Dataset objects :func:`__repr__`: shows dataset metadata and infor...
Dataset
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Dataset: """The Dataset class defines the main interfaces for datasets created with this repo. It instantiates Partition objects for each partition of the the dataset and defines methods for viewing metadata and partition information. :func:`__init__`: instantiates Dataset objects :func:`__repr__...
stack_v2_sparse_classes_75kplus_train_073076
13,734
permissive
[ { "docstring": "This method instantiates a Dataset object with attributes to access the underlying data and labels (as Partition objects), as well as collects and saves partition information and metadata. :param datadict: the partitions to save :type datadict: dict of numpy ndarray objects :param dataset: name ...
2
stack_v2_sparse_classes_30k_train_047059
Implement the Python class `Dataset` described below. Class description: The Dataset class defines the main interfaces for datasets created with this repo. It instantiates Partition objects for each partition of the the dataset and defines methods for viewing metadata and partition information. :func:`__init__`: insta...
Implement the Python class `Dataset` described below. Class description: The Dataset class defines the main interfaces for datasets created with this repo. It instantiates Partition objects for each partition of the the dataset and defines methods for viewing metadata and partition information. :func:`__init__`: insta...
5a508b78cccc581b3b99ec2ba179ecb7fa31aafb
<|skeleton|> class Dataset: """The Dataset class defines the main interfaces for datasets created with this repo. It instantiates Partition objects for each partition of the the dataset and defines methods for viewing metadata and partition information. :func:`__init__`: instantiates Dataset objects :func:`__repr__...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Dataset: """The Dataset class defines the main interfaces for datasets created with this repo. It instantiates Partition objects for each partition of the the dataset and defines methods for viewing metadata and partition information. :func:`__init__`: instantiates Dataset objects :func:`__repr__`: shows data...
the_stack_v2_python_sparse
mlds/datasets.py
sheatsley/datasets
train
13
249c30eb974be3418f6ce8a5587cceb4cd4b1ff4
[ "config = config_manager._config\napp = Flask(__name__)\napp.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://{user}:{pw}@{host}:{port}/{db}'.format(user=config.get('DB_CLIENT', 'user'), pw=os.environ['DB_PASS'], host=config.get('DB_CLIENT', 'host'), port=config.getint('DB_CLIENT', 'port'), db=config.get('DB_CLIEN...
<|body_start_0|> config = config_manager._config app = Flask(__name__) app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://{user}:{pw}@{host}:{port}/{db}'.format(user=config.get('DB_CLIENT', 'user'), pw=os.environ['DB_PASS'], host=config.get('DB_CLIENT', 'host'), port=config.getint('DB_CLIENT'...
DBClient - Label datasets and retrieve datasets with corresponding category - Needed here so that DL2 Notebook can retrieve classifications - Unsure whether DL2 Notebook will use this DBClient (through Virtual Worker instance of UNIX Service) or have its own instance, TBD - Will most likely replace RDS DB with DynamoDB...
DBClient
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DBClient: """DBClient - Label datasets and retrieve datasets with corresponding category - Needed here so that DL2 Notebook can retrieve classifications - Unsure whether DL2 Notebook will use this DBClient (through Virtual Worker instance of UNIX Service) or have its own instance, TBD - Will most...
stack_v2_sparse_classes_75kplus_train_073077
3,677
permissive
[ { "docstring": "Set up DBClient with corresponding database credentials", "name": "__init__", "signature": "def __init__(self, config_manager)" }, { "docstring": "Get category_labels table NOTE: Functionality needs to be tested so that add_classifications can be tested, but this method should no...
4
null
Implement the Python class `DBClient` described below. Class description: DBClient - Label datasets and retrieve datasets with corresponding category - Needed here so that DL2 Notebook can retrieve classifications - Unsure whether DL2 Notebook will use this DBClient (through Virtual Worker instance of UNIX Service) or...
Implement the Python class `DBClient` described below. Class description: DBClient - Label datasets and retrieve datasets with corresponding category - Needed here so that DL2 Notebook can retrieve classifications - Unsure whether DL2 Notebook will use this DBClient (through Virtual Worker instance of UNIX Service) or...
117f998657a0a22c5c865814551082a40da00596
<|skeleton|> class DBClient: """DBClient - Label datasets and retrieve datasets with corresponding category - Needed here so that DL2 Notebook can retrieve classifications - Unsure whether DL2 Notebook will use this DBClient (through Virtual Worker instance of UNIX Service) or have its own instance, TBD - Will most...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DBClient: """DBClient - Label datasets and retrieve datasets with corresponding category - Needed here so that DL2 Notebook can retrieve classifications - Unsure whether DL2 Notebook will use this DBClient (through Virtual Worker instance of UNIX Service) or have its own instance, TBD - Will most likely repla...
the_stack_v2_python_sparse
core/db_client.py
ahmad-abdellatif/decentralized-ml
train
0
697a849fed2a007ba95dbfe3382e7b8cc1ca53d8
[ "result = CooperativeManage(aompLogin).getCooperativeCode(send_data['cooperativeName'])\nself.save_data('activationCode', result)\nAssertions().assert_in_text(result, expect['getActivationCodeMsg'])", "re = RegisterParking(userLogin).registerUser(send_data['activationCode'], send_data['managerName'], send_data['u...
<|body_start_0|> result = CooperativeManage(aompLogin).getCooperativeCode(send_data['cooperativeName']) self.save_data('activationCode', result) Assertions().assert_in_text(result, expect['getActivationCodeMsg']) <|end_body_0|> <|body_start_1|> re = RegisterParking(userLogin).registerUs...
新增车场
TestRegisterParkingFail
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestRegisterParkingFail: """新增车场""" def test_getActivationCode(self, aompLogin, send_data, expect): """在aomp获取激活码""" <|body_0|> def test_registerUser(self, userLogin, send_data, expect): """注册用户""" <|body_1|> def test_addOperatorPark(self, userLogin,...
stack_v2_sparse_classes_75kplus_train_073078
1,972
no_license
[ { "docstring": "在aomp获取激活码", "name": "test_getActivationCode", "signature": "def test_getActivationCode(self, aompLogin, send_data, expect)" }, { "docstring": "注册用户", "name": "test_registerUser", "signature": "def test_registerUser(self, userLogin, send_data, expect)" }, { "docst...
3
stack_v2_sparse_classes_30k_test_001307
Implement the Python class `TestRegisterParkingFail` described below. Class description: 新增车场 Method signatures and docstrings: - def test_getActivationCode(self, aompLogin, send_data, expect): 在aomp获取激活码 - def test_registerUser(self, userLogin, send_data, expect): 注册用户 - def test_addOperatorPark(self, userLogin, sen...
Implement the Python class `TestRegisterParkingFail` described below. Class description: 新增车场 Method signatures and docstrings: - def test_getActivationCode(self, aompLogin, send_data, expect): 在aomp获取激活码 - def test_registerUser(self, userLogin, send_data, expect): 注册用户 - def test_addOperatorPark(self, userLogin, sen...
34c368c109867da26d9256bca85f872b0fac2ea7
<|skeleton|> class TestRegisterParkingFail: """新增车场""" def test_getActivationCode(self, aompLogin, send_data, expect): """在aomp获取激活码""" <|body_0|> def test_registerUser(self, userLogin, send_data, expect): """注册用户""" <|body_1|> def test_addOperatorPark(self, userLogin,...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestRegisterParkingFail: """新增车场""" def test_getActivationCode(self, aompLogin, send_data, expect): """在aomp获取激活码""" result = CooperativeManage(aompLogin).getCooperativeCode(send_data['cooperativeName']) self.save_data('activationCode', result) Assertions().assert_in_text(...
the_stack_v2_python_sparse
test_suite/parkingConfig/test_registerParkingFail.py
oyebino/pomp_api
train
1
9d487c31226a517a782b5d5fd6ada974984e5d90
[ "self._pokemon = pokemon\nwith open(join('jsons', 'pokemon_lookup_s.json'), 'r') as pokemon_lookup_json:\n pokemon_lookup = json.load(pokemon_lookup_json)\n _lookup = pokemon_lookup[self._pokemon.name]\n_offset = (0, _lookup)\nsuper().__init__(join('pokemon', 'pokemon_small.png'), position, offset=_offset)\ns...
<|body_start_0|> self._pokemon = pokemon with open(join('jsons', 'pokemon_lookup_s.json'), 'r') as pokemon_lookup_json: pokemon_lookup = json.load(pokemon_lookup_json) _lookup = pokemon_lookup[self._pokemon.name] _offset = (0, _lookup) super().__init__(join('pokem...
BouncingPokemon
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BouncingPokemon: def __init__(self, pokemon, position, item=True): """Creates a simple bouncing pokemon object. This appear on the left of the pokemon cards/objects""" <|body_0|> def draw(self, draw_surface): """Overwrite parent draw method to possibly draw the item ...
stack_v2_sparse_classes_75kplus_train_073079
23,080
no_license
[ { "docstring": "Creates a simple bouncing pokemon object. This appear on the left of the pokemon cards/objects", "name": "__init__", "signature": "def __init__(self, pokemon, position, item=True)" }, { "docstring": "Overwrite parent draw method to possibly draw the item surface.", "name": "d...
3
stack_v2_sparse_classes_30k_train_041232
Implement the Python class `BouncingPokemon` described below. Class description: Implement the BouncingPokemon class. Method signatures and docstrings: - def __init__(self, pokemon, position, item=True): Creates a simple bouncing pokemon object. This appear on the left of the pokemon cards/objects - def draw(self, dr...
Implement the Python class `BouncingPokemon` described below. Class description: Implement the BouncingPokemon class. Method signatures and docstrings: - def __init__(self, pokemon, position, item=True): Creates a simple bouncing pokemon object. This appear on the left of the pokemon cards/objects - def draw(self, dr...
6718fdb6555d87f0b7b331c10d64a604431f8e81
<|skeleton|> class BouncingPokemon: def __init__(self, pokemon, position, item=True): """Creates a simple bouncing pokemon object. This appear on the left of the pokemon cards/objects""" <|body_0|> def draw(self, draw_surface): """Overwrite parent draw method to possibly draw the item ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BouncingPokemon: def __init__(self, pokemon, position, item=True): """Creates a simple bouncing pokemon object. This appear on the left of the pokemon cards/objects""" self._pokemon = pokemon with open(join('jsons', 'pokemon_lookup_s.json'), 'r') as pokemon_lookup_json: pok...
the_stack_v2_python_sparse
pokered/modules/battle/battle_menus/poke_party.py
surranc20/pokered
train
44
973415825e49ea6743413cdfa55faa94ca472001
[ "BaseController.__init__(self, veh_id, car_following_params, delay=1.0)\nself.max_accel = car_following_params.controller_params['accel']\nself.v_history = []\nself.gamma = 2\nself.g_l = 7\nself.g_u = 30\nself.v_catch = 1\nself.alpha = 0\nself.beta = 1 - 0.5 * self.alpha\nself.U = 0\nself.v_target = 0\nself.v_cmd =...
<|body_start_0|> BaseController.__init__(self, veh_id, car_following_params, delay=1.0) self.max_accel = car_following_params.controller_params['accel'] self.v_history = [] self.gamma = 2 self.g_l = 7 self.g_u = 30 self.v_catch = 1 self.alpha = 0 s...
Inspired by Dan Work's... work. Dissipation of stop-and-go waves via control of autonomous vehicles: Field experiments https://arxiv.org/abs/1705.01693 Usage ----- See base class for example. Parameters ---------- veh_id : str unique vehicle identifier car_following_params : flow.core.params.SumoCarFollowingParams obje...
PISaturation
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PISaturation: """Inspired by Dan Work's... work. Dissipation of stop-and-go waves via control of autonomous vehicles: Field experiments https://arxiv.org/abs/1705.01693 Usage ----- See base class for example. Parameters ---------- veh_id : str unique vehicle identifier car_following_params : flow...
stack_v2_sparse_classes_75kplus_train_073080
7,700
permissive
[ { "docstring": "Instantiate PISaturation.", "name": "__init__", "signature": "def __init__(self, veh_id, car_following_params)" }, { "docstring": "See parent class.", "name": "get_accel", "signature": "def get_accel(self, env)" } ]
2
stack_v2_sparse_classes_30k_train_024523
Implement the Python class `PISaturation` described below. Class description: Inspired by Dan Work's... work. Dissipation of stop-and-go waves via control of autonomous vehicles: Field experiments https://arxiv.org/abs/1705.01693 Usage ----- See base class for example. Parameters ---------- veh_id : str unique vehicle...
Implement the Python class `PISaturation` described below. Class description: Inspired by Dan Work's... work. Dissipation of stop-and-go waves via control of autonomous vehicles: Field experiments https://arxiv.org/abs/1705.01693 Usage ----- See base class for example. Parameters ---------- veh_id : str unique vehicle...
badac3da17f04d8d8ae5691ee8ba2af9d56fac35
<|skeleton|> class PISaturation: """Inspired by Dan Work's... work. Dissipation of stop-and-go waves via control of autonomous vehicles: Field experiments https://arxiv.org/abs/1705.01693 Usage ----- See base class for example. Parameters ---------- veh_id : str unique vehicle identifier car_following_params : flow...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PISaturation: """Inspired by Dan Work's... work. Dissipation of stop-and-go waves via control of autonomous vehicles: Field experiments https://arxiv.org/abs/1705.01693 Usage ----- See base class for example. Parameters ---------- veh_id : str unique vehicle identifier car_following_params : flow.core.params....
the_stack_v2_python_sparse
flow/controllers/velocity_controllers.py
parthjaggi/flow
train
6
1a2dfdf83890287c248e74fb05550cabdf242794
[ "if len(a) == 0:\n return 0\nminVal = a[0]\nsummary = 0\ncurMax = 0\nfor i in range(1, len(a)):\n if a[i] > minVal and a[i] > a[i - 1]:\n curMax = max(curMax, a[i] - minVal)\n else:\n summary += curMax\n curMax = 0\n minVal = a[i]\nsummary += curMax\nreturn summary", "t1 = 0\n...
<|body_start_0|> if len(a) == 0: return 0 minVal = a[0] summary = 0 curMax = 0 for i in range(1, len(a)): if a[i] > minVal and a[i] > a[i - 1]: curMax = max(curMax, a[i] - minVal) else: summary += curMax ...
https://leetcode.com/problems/best-time-to-buy-and-sell-stock-ii/description/
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """https://leetcode.com/problems/best-time-to-buy-and-sell-stock-ii/description/""" def maxProfit(self, a): """:type prices: List[int] :rtype: int""" <|body_0|> def maxProfit2(self, a): """:type prices: List[int] :rtype: int""" <|body_1|> <|end...
stack_v2_sparse_classes_75kplus_train_073081
1,152
no_license
[ { "docstring": ":type prices: List[int] :rtype: int", "name": "maxProfit", "signature": "def maxProfit(self, a)" }, { "docstring": ":type prices: List[int] :rtype: int", "name": "maxProfit2", "signature": "def maxProfit2(self, a)" } ]
2
stack_v2_sparse_classes_30k_train_018388
Implement the Python class `Solution` described below. Class description: https://leetcode.com/problems/best-time-to-buy-and-sell-stock-ii/description/ Method signatures and docstrings: - def maxProfit(self, a): :type prices: List[int] :rtype: int - def maxProfit2(self, a): :type prices: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: https://leetcode.com/problems/best-time-to-buy-and-sell-stock-ii/description/ Method signatures and docstrings: - def maxProfit(self, a): :type prices: List[int] :rtype: int - def maxProfit2(self, a): :type prices: List[int] :rtype: int <|skel...
54d3d9530b25272d4a2e5dc33e7035c44f506dc5
<|skeleton|> class Solution: """https://leetcode.com/problems/best-time-to-buy-and-sell-stock-ii/description/""" def maxProfit(self, a): """:type prices: List[int] :rtype: int""" <|body_0|> def maxProfit2(self, a): """:type prices: List[int] :rtype: int""" <|body_1|> <|end...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: """https://leetcode.com/problems/best-time-to-buy-and-sell-stock-ii/description/""" def maxProfit(self, a): """:type prices: List[int] :rtype: int""" if len(a) == 0: return 0 minVal = a[0] summary = 0 curMax = 0 for i in range(1, len(a...
the_stack_v2_python_sparse
old/Session002/DynamicProgramming/BestTimeBuyandSellStockII.py
MaxIakovliev/algorithms
train
0
43000963394072a9f5c59b23cba2994e254489f1
[ "if len(s1) != len(s2):\n return False\nif s1 == s2:\n return True\nn = len(s1)\ndp = [[[False] * (n + 1) for _ in range(n)] for _ in range(n)]\nfor i in range(n):\n for j in range(n):\n dp[i][j][1] = s1[i] == s2[j]\nfor l in range(2, n + 1):\n for i in range(n - l + 1):\n for j in range(n...
<|body_start_0|> if len(s1) != len(s2): return False if s1 == s2: return True n = len(s1) dp = [[[False] * (n + 1) for _ in range(n)] for _ in range(n)] for i in range(n): for j in range(n): dp[i][j][1] = s1[i] == s2[j] ...
DP.
Solution
[ "WTFPL" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """DP.""" def isScramble1(self, s1: str, s2: str) -> bool: """DP. :param s1: :param s2: :return:""" <|body_0|> def isScramble2(self, s1: str, s2: str) -> bool: """Recursively dp.""" <|body_1|> <|end_skeleton|> <|body_start_0|> if len(s...
stack_v2_sparse_classes_75kplus_train_073082
1,509
permissive
[ { "docstring": "DP. :param s1: :param s2: :return:", "name": "isScramble1", "signature": "def isScramble1(self, s1: str, s2: str) -> bool" }, { "docstring": "Recursively dp.", "name": "isScramble2", "signature": "def isScramble2(self, s1: str, s2: str) -> bool" } ]
2
stack_v2_sparse_classes_30k_train_037858
Implement the Python class `Solution` described below. Class description: DP. Method signatures and docstrings: - def isScramble1(self, s1: str, s2: str) -> bool: DP. :param s1: :param s2: :return: - def isScramble2(self, s1: str, s2: str) -> bool: Recursively dp.
Implement the Python class `Solution` described below. Class description: DP. Method signatures and docstrings: - def isScramble1(self, s1: str, s2: str) -> bool: DP. :param s1: :param s2: :return: - def isScramble2(self, s1: str, s2: str) -> bool: Recursively dp. <|skeleton|> class Solution: """DP.""" def ...
5e5e7098d2310c972314c9c9895aafd048047fe6
<|skeleton|> class Solution: """DP.""" def isScramble1(self, s1: str, s2: str) -> bool: """DP. :param s1: :param s2: :return:""" <|body_0|> def isScramble2(self, s1: str, s2: str) -> bool: """Recursively dp.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: """DP.""" def isScramble1(self, s1: str, s2: str) -> bool: """DP. :param s1: :param s2: :return:""" if len(s1) != len(s2): return False if s1 == s2: return True n = len(s1) dp = [[[False] * (n + 1) for _ in range(n)] for _ in range...
the_stack_v2_python_sparse
0087_Scramble_String.py
imguozr/LC-Solutions
train
0
91a9edaf52f5507e8e8e2eef066fe0061924f3c8
[ "user = request.user\nif date is None:\n entries = WellnessEntry.objects.filter(user=user).order_by('-date')[:50]\n if len(entries) == 0:\n print('no entries')\n return HttpResponse(status=400)\n try:\n serializer = WellnessEntrySerializer(entries, many=True)\n return JsonRespon...
<|body_start_0|> user = request.user if date is None: entries = WellnessEntry.objects.filter(user=user).order_by('-date')[:50] if len(entries) == 0: print('no entries') return HttpResponse(status=400) try: serializer = W...
Wellness
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Wellness: def get(self, request, date=None, format=None): """Will handle single day requests and all entries etc. Return for graph and scroll view etc""" <|body_0|> def post(self, request): """Check if user is authenticated with token - done automatically Check if en...
stack_v2_sparse_classes_75kplus_train_073083
3,840
no_license
[ { "docstring": "Will handle single day requests and all entries etc. Return for graph and scroll view etc", "name": "get", "signature": "def get(self, request, date=None, format=None)" }, { "docstring": "Check if user is authenticated with token - done automatically Check if entry for date alrea...
3
null
Implement the Python class `Wellness` described below. Class description: Implement the Wellness class. Method signatures and docstrings: - def get(self, request, date=None, format=None): Will handle single day requests and all entries etc. Return for graph and scroll view etc - def post(self, request): Check if user...
Implement the Python class `Wellness` described below. Class description: Implement the Wellness class. Method signatures and docstrings: - def get(self, request, date=None, format=None): Will handle single day requests and all entries etc. Return for graph and scroll view etc - def post(self, request): Check if user...
7522e44c88077e6e436ed3462860ec491802a635
<|skeleton|> class Wellness: def get(self, request, date=None, format=None): """Will handle single day requests and all entries etc. Return for graph and scroll view etc""" <|body_0|> def post(self, request): """Check if user is authenticated with token - done automatically Check if en...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Wellness: def get(self, request, date=None, format=None): """Will handle single day requests and all entries etc. Return for graph and scroll view etc""" user = request.user if date is None: entries = WellnessEntry.objects.filter(user=user).order_by('-date')[:50] ...
the_stack_v2_python_sparse
wellness_api/views.py
SteGaff7/WellnessAppDjangoBackend
train
0
bf86fe2976ea705763fd2af9a8229d46a69eafb0
[ "locals()['random'] = random\nlocals()['utils'] = SimUtils\nif data.entity1 is not None:\n entity1_name = data.entity1.__name__.lower()\n locals()['entity1'] = data.entity1\n locals()[entity1_name] = data.entity1\n locals()[entity1_name + '1'] = data.entity1\nif data.entity2 is not None:\n entity2_na...
<|body_start_0|> locals()['random'] = random locals()['utils'] = SimUtils if data.entity1 is not None: entity1_name = data.entity1.__name__.lower() locals()['entity1'] = data.entity1 locals()[entity1_name] = data.entity1 locals()[entity1_name + '1'...
Fonction composant un Trigger anonyme, créer à la volée pour lancer ses fonctions. Cette classe n'offre aucun environnement d'instance, afin de limiter l'utilisation de la mémoire, qui peut s'avérer critique dans le cadre des simulations.
Function
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Function: """Fonction composant un Trigger anonyme, créer à la volée pour lancer ses fonctions. Cette classe n'offre aucun environnement d'instance, afin de limiter l'utilisation de la mémoire, qui peut s'avérer critique dans le cadre des simulations.""" def eval(data, python_code): ...
stack_v2_sparse_classes_75kplus_train_073084
3,419
no_license
[ { "docstring": "Evalue le code donné en paramètre, avec comme scope les différents alias de entity1 et entity2", "name": "eval", "signature": "def eval(data, python_code)" }, { "docstring": "Execute le code python donné en paramètre avec un scope permettant les alias dans les scripts utilisateur...
3
stack_v2_sparse_classes_30k_train_021871
Implement the Python class `Function` described below. Class description: Fonction composant un Trigger anonyme, créer à la volée pour lancer ses fonctions. Cette classe n'offre aucun environnement d'instance, afin de limiter l'utilisation de la mémoire, qui peut s'avérer critique dans le cadre des simulations. Metho...
Implement the Python class `Function` described below. Class description: Fonction composant un Trigger anonyme, créer à la volée pour lancer ses fonctions. Cette classe n'offre aucun environnement d'instance, afin de limiter l'utilisation de la mémoire, qui peut s'avérer critique dans le cadre des simulations. Metho...
d1c7395500b2b5c304cc8a587e00b37e85b200e2
<|skeleton|> class Function: """Fonction composant un Trigger anonyme, créer à la volée pour lancer ses fonctions. Cette classe n'offre aucun environnement d'instance, afin de limiter l'utilisation de la mémoire, qui peut s'avérer critique dans le cadre des simulations.""" def eval(data, python_code): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Function: """Fonction composant un Trigger anonyme, créer à la volée pour lancer ses fonctions. Cette classe n'offre aucun environnement d'instance, afin de limiter l'utilisation de la mémoire, qui peut s'avérer critique dans le cadre des simulations.""" def eval(data, python_code): """Evalue le ...
the_stack_v2_python_sparse
propsim/simutils/function.py
Thomsch/propagation-simulator
train
1
18471566c96f4d1418d5f8a6ad0d165442cdcfa8
[ "Container.__init__(self, child=None)\nUserList.__init__(self)\nif isinstance(rotation, int) is True:\n self.rotation = [0] * arg\nelif isinstance(arg, list):\n self.rotation = rotation\nelse:\n self.rotation = None\nif isinstance(scale, float) is True:\n self.scale = [1.0] * arg\nelif isinstance(scale,...
<|body_start_0|> Container.__init__(self, child=None) UserList.__init__(self) if isinstance(rotation, int) is True: self.rotation = [0] * arg elif isinstance(arg, list): self.rotation = rotation else: self.rotation = None if isinstance(...
Used to add one or more external pdf files to document. Args: ------
PDFs
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PDFs: """Used to add one or more external pdf files to document. Args: ------""" def __init__(self, arg, rotation=None, scale=None): """Args ---- arg: int or list Int specifying the number of pdf files to add or a list of pdf filenames. rotation: int or list degrees table_of_contents...
stack_v2_sparse_classes_75kplus_train_073085
2,943
no_license
[ { "docstring": "Args ---- arg: int or list Int specifying the number of pdf files to add or a list of pdf filenames. rotation: int or list degrees table_of_contents: bool Int specifying the number of pdf files to add or a list ints specifying the degrees of rotation.", "name": "__init__", "signature": "...
2
null
Implement the Python class `PDFs` described below. Class description: Used to add one or more external pdf files to document. Args: ------ Method signatures and docstrings: - def __init__(self, arg, rotation=None, scale=None): Args ---- arg: int or list Int specifying the number of pdf files to add or a list of pdf f...
Implement the Python class `PDFs` described below. Class description: Used to add one or more external pdf files to document. Args: ------ Method signatures and docstrings: - def __init__(self, arg, rotation=None, scale=None): Args ---- arg: int or list Int specifying the number of pdf files to add or a list of pdf f...
515ce39b6ce8fefde098cce16495e60fcef1c4d4
<|skeleton|> class PDFs: """Used to add one or more external pdf files to document. Args: ------""" def __init__(self, arg, rotation=None, scale=None): """Args ---- arg: int or list Int specifying the number of pdf files to add or a list of pdf filenames. rotation: int or list degrees table_of_contents...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PDFs: """Used to add one or more external pdf files to document. Args: ------""" def __init__(self, arg, rotation=None, scale=None): """Args ---- arg: int or list Int specifying the number of pdf files to add or a list of pdf filenames. rotation: int or list degrees table_of_contents: bool Int sp...
the_stack_v2_python_sparse
easytex/classes/PDFs.py
JyuNyar/easytex
train
0
1e1b37bdf82506f151aaa1701c1dea96b8c3b315
[ "kwargs = self.dict()\nkwargs['data'] = fsr.load_result_df(self.path)\nreturn IntExperimentResult(**kwargs)", "sess = check_sess(sess)\nsql_result = crud.create_experiment_result(self)\nself.uid = sql_result.id\nself.path = Path(sql_result.path)", "kwargs = self.dict()\nkwargs['experimentGroups'] = self.experim...
<|body_start_0|> kwargs = self.dict() kwargs['data'] = fsr.load_result_df(self.path) return IntExperimentResult(**kwargs) <|end_body_0|> <|body_start_1|> sess = check_sess(sess) sql_result = crud.create_experiment_result(self) self.uid = sql_result.id self.path =...
A class to handle database and file storage of ExperimentResults Attributes ---------- uid : int the objects unique identifier name : str the objects name hint : str brief description of the object description : str a detailed description of the experiment result experiment_group_id : int unique identifier of the assoc...
DbExperimentResult
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DbExperimentResult: """A class to handle database and file storage of ExperimentResults Attributes ---------- uid : int the objects unique identifier name : str the objects name hint : str brief description of the object description : str a detailed description of the experiment result experiment...
stack_v2_sparse_classes_75kplus_train_073086
4,588
permissive
[ { "docstring": "Returns c_int.IntExperimentResult", "name": "to_int_class", "signature": "def to_int_class(self)" }, { "docstring": "Creates object in db. Path and id are generated and updated in object. Parameters: - sess(sqlalchemy.orm.Session): The database session to be used, if no session i...
3
stack_v2_sparse_classes_30k_train_022706
Implement the Python class `DbExperimentResult` described below. Class description: A class to handle database and file storage of ExperimentResults Attributes ---------- uid : int the objects unique identifier name : str the objects name hint : str brief description of the object description : str a detailed descript...
Implement the Python class `DbExperimentResult` described below. Class description: A class to handle database and file storage of ExperimentResults Attributes ---------- uid : int the objects unique identifier name : str the objects name hint : str brief description of the object description : str a detailed descript...
4bd9f45ad9e49f4178c0b8bb1a177d7db5349c34
<|skeleton|> class DbExperimentResult: """A class to handle database and file storage of ExperimentResults Attributes ---------- uid : int the objects unique identifier name : str the objects name hint : str brief description of the object description : str a detailed description of the experiment result experiment...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DbExperimentResult: """A class to handle database and file storage of ExperimentResults Attributes ---------- uid : int the objects unique identifier name : str the objects name hint : str brief description of the object description : str a detailed description of the experiment result experiment_group_id : i...
the_stack_v2_python_sparse
mistos-backend/src/app/api/classes/experiment_result.py
Maddonix/mistos_2
train
1
851aeda567fcce5c28723f60584ef78ff3a05099
[ "if self.additional_images is True or additional_images:\n if kwargs_lens_eqn_solver is None:\n kwargs_lens_eqn_solver = {}\n ra_source, dec_source = self.source_position(kwargs_ps, kwargs_lens)\n ra_image, dec_image = self._solver.image_position_from_source(ra_source, dec_source, kwargs_lens, magni...
<|body_start_0|> if self.additional_images is True or additional_images: if kwargs_lens_eqn_solver is None: kwargs_lens_eqn_solver = {} ra_source, dec_source = self.source_position(kwargs_ps, kwargs_lens) ra_image, dec_image = self._solver.image_position_from_...
class of a lensed point source parameterized as the (multiple) observed image positions Name within the PointSource module: 'LENSED_POSITION' parameters: ra_image, dec_image, point_amp If fixed_magnification=True, than 'source_amp' is a parameter instead of 'point_amp'
LensedPositions
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LensedPositions: """class of a lensed point source parameterized as the (multiple) observed image positions Name within the PointSource module: 'LENSED_POSITION' parameters: ra_image, dec_image, point_amp If fixed_magnification=True, than 'source_amp' is a parameter instead of 'point_amp'""" ...
stack_v2_sparse_classes_75kplus_train_073087
7,188
permissive
[ { "docstring": "On-sky image positions. :param kwargs_ps: keyword arguments of the point source model :param kwargs_lens: keyword argument list of the lens model(s), only used when requiring the lens equation solver :param magnification_limit: float >0 or None, if float is set and additional images are computed...
4
null
Implement the Python class `LensedPositions` described below. Class description: class of a lensed point source parameterized as the (multiple) observed image positions Name within the PointSource module: 'LENSED_POSITION' parameters: ra_image, dec_image, point_amp If fixed_magnification=True, than 'source_amp' is a p...
Implement the Python class `LensedPositions` described below. Class description: class of a lensed point source parameterized as the (multiple) observed image positions Name within the PointSource module: 'LENSED_POSITION' parameters: ra_image, dec_image, point_amp If fixed_magnification=True, than 'source_amp' is a p...
1b685c4392c00209a19e14d7d0bdfc89cc1a69cd
<|skeleton|> class LensedPositions: """class of a lensed point source parameterized as the (multiple) observed image positions Name within the PointSource module: 'LENSED_POSITION' parameters: ra_image, dec_image, point_amp If fixed_magnification=True, than 'source_amp' is a parameter instead of 'point_amp'""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LensedPositions: """class of a lensed point source parameterized as the (multiple) observed image positions Name within the PointSource module: 'LENSED_POSITION' parameters: ra_image, dec_image, point_amp If fixed_magnification=True, than 'source_amp' is a parameter instead of 'point_amp'""" def image_po...
the_stack_v2_python_sparse
lenstronomy/PointSource/Types/lensed_position.py
ajshajib/lenstronomy
train
0
89db4a888b49d6b0afd816607988d1c9be5f9c03
[ "data = None\nmatch = self.crash_regex.match(output)\nif match:\n msg = 'Stylelint crashed: %s' % match.group(1)\n yield (match, 0, None, 'Error', '', msg, None)\ntry:\n if output and (not match):\n data = json.loads(output)[0]\nexcept:\n yield (match, 0, None, 'Error', '', 'Output json data erro...
<|body_start_0|> data = None match = self.crash_regex.match(output) if match: msg = 'Stylelint crashed: %s' % match.group(1) yield (match, 0, None, 'Error', '', msg, None) try: if output and (not match): data = json.loads(output)[0] ...
Provides an interface to stylelint.
Stylelint
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Stylelint: """Provides an interface to stylelint.""" def find_errors(self, output): """Parse errors from linter's output. We override this method to handle parsing stylelint crashes.""" <|body_0|> def communicate(self, cmd, code=None): """Run an external executab...
stack_v2_sparse_classes_75kplus_train_073088
3,414
permissive
[ { "docstring": "Parse errors from linter's output. We override this method to handle parsing stylelint crashes.", "name": "find_errors", "signature": "def find_errors(self, output)" }, { "docstring": "Run an external executable using stdin to pass code and return its output.", "name": "commu...
2
null
Implement the Python class `Stylelint` described below. Class description: Provides an interface to stylelint. Method signatures and docstrings: - def find_errors(self, output): Parse errors from linter's output. We override this method to handle parsing stylelint crashes. - def communicate(self, cmd, code=None): Run...
Implement the Python class `Stylelint` described below. Class description: Provides an interface to stylelint. Method signatures and docstrings: - def find_errors(self, output): Parse errors from linter's output. We override this method to handle parsing stylelint crashes. - def communicate(self, cmd, code=None): Run...
0ed3d3fd17d4ac0ed52f73e8c3f750302f45da50
<|skeleton|> class Stylelint: """Provides an interface to stylelint.""" def find_errors(self, output): """Parse errors from linter's output. We override this method to handle parsing stylelint crashes.""" <|body_0|> def communicate(self, cmd, code=None): """Run an external executab...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Stylelint: """Provides an interface to stylelint.""" def find_errors(self, output): """Parse errors from linter's output. We override this method to handle parsing stylelint crashes.""" data = None match = self.crash_regex.match(output) if match: msg = 'Styleli...
the_stack_v2_python_sparse
Packages/SublimeLinter-contrib-stylelint/linter.py
fisker/fisker-sublimetext-backup
train
1
d6d5b5bf1a91c649254086f69d0fedf40a5f1b66
[ "super().__init__()\nself.result_button = QPushButton()\nself.result_button.setEnabled(False)\nself.result_button.setText('Open results folder')\nself.result_path = cicada_analysis.get_results_path()\nself.addWidget(self.result_button)\nself.result_button.clicked.connect(self.open_explorer)", "if self.result_path...
<|body_start_0|> super().__init__() self.result_button = QPushButton() self.result_button.setEnabled(False) self.result_button.setText('Open results folder') self.result_path = cicada_analysis.get_results_path() self.addWidget(self.result_button) self.result_butto...
Class containing the button to open the result folder
ResultsButton
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResultsButton: """Class containing the button to open the result folder""" def __init__(self, cicada_analysis): """Args: cicada_analysis (CicadaAnalysis): Chosen analysis""" <|body_0|> def open_explorer(self): """Open the file explorer depending on the OS""" ...
stack_v2_sparse_classes_75kplus_train_073089
9,365
no_license
[ { "docstring": "Args: cicada_analysis (CicadaAnalysis): Chosen analysis", "name": "__init__", "signature": "def __init__(self, cicada_analysis)" }, { "docstring": "Open the file explorer depending on the OS", "name": "open_explorer", "signature": "def open_explorer(self)" }, { "d...
3
stack_v2_sparse_classes_30k_train_024347
Implement the Python class `ResultsButton` described below. Class description: Class containing the button to open the result folder Method signatures and docstrings: - def __init__(self, cicada_analysis): Args: cicada_analysis (CicadaAnalysis): Chosen analysis - def open_explorer(self): Open the file explorer depend...
Implement the Python class `ResultsButton` described below. Class description: Class containing the button to open the result folder Method signatures and docstrings: - def __init__(self, cicada_analysis): Args: cicada_analysis (CicadaAnalysis): Chosen analysis - def open_explorer(self): Open the file explorer depend...
75449d4f0f7ea92e4daf329b5d40820832b62de2
<|skeleton|> class ResultsButton: """Class containing the button to open the result folder""" def __init__(self, cicada_analysis): """Args: cicada_analysis (CicadaAnalysis): Chosen analysis""" <|body_0|> def open_explorer(self): """Open the file explorer depending on the OS""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ResultsButton: """Class containing the button to open the result folder""" def __init__(self, cicada_analysis): """Args: cicada_analysis (CicadaAnalysis): Chosen analysis""" super().__init__() self.result_button = QPushButton() self.result_button.setEnabled(False) ...
the_stack_v2_python_sparse
src/cicada/gui/cicada_analysis_overview.py
PaulUteza/cicada
train
0
c794c73a8f9efaa18a23edd5ecffd38ec007ce2d
[ "for key in inmap:\n objtype, spc, lng = key.partition(' ')\n if spc != ' ' or objtype != 'language':\n raise KeyError('Unrecognized object type: %s' % key)\n inobj = inmap[key]\n self[lng] = Language.from_map(lng, inobj)", "for sch, fnc, arg in dbfunctions:\n func = dbfunctions[sch, fnc, ar...
<|body_start_0|> for key in inmap: objtype, spc, lng = key.partition(' ') if spc != ' ' or objtype != 'language': raise KeyError('Unrecognized object type: %s' % key) inobj = inmap[key] self[lng] = Language.from_map(lng, inobj) <|end_body_0|> <|bo...
The collection of procedural languages in a database.
LanguageDict
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LanguageDict: """The collection of procedural languages in a database.""" def from_map(self, inmap): """Initialize the dictionary of languages by examining the input map :param inmap: the input YAML map defining the languages""" <|body_0|> def link_refs(self, dbfunctions...
stack_v2_sparse_classes_75kplus_train_073090
4,666
permissive
[ { "docstring": "Initialize the dictionary of languages by examining the input map :param inmap: the input YAML map defining the languages", "name": "from_map", "signature": "def from_map(self, inmap)" }, { "docstring": "Connect functions to their respective languages :param dbfunctions: dictiona...
2
stack_v2_sparse_classes_30k_val_000684
Implement the Python class `LanguageDict` described below. Class description: The collection of procedural languages in a database. Method signatures and docstrings: - def from_map(self, inmap): Initialize the dictionary of languages by examining the input map :param inmap: the input YAML map defining the languages -...
Implement the Python class `LanguageDict` described below. Class description: The collection of procedural languages in a database. Method signatures and docstrings: - def from_map(self, inmap): Initialize the dictionary of languages by examining the input map :param inmap: the input YAML map defining the languages -...
ec682513d5256e383647f38f7fba29530cfb9fbe
<|skeleton|> class LanguageDict: """The collection of procedural languages in a database.""" def from_map(self, inmap): """Initialize the dictionary of languages by examining the input map :param inmap: the input YAML map defining the languages""" <|body_0|> def link_refs(self, dbfunctions...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LanguageDict: """The collection of procedural languages in a database.""" def from_map(self, inmap): """Initialize the dictionary of languages by examining the input map :param inmap: the input YAML map defining the languages""" for key in inmap: objtype, spc, lng = key.partit...
the_stack_v2_python_sparse
pyrseas/dbobject/language.py
perseas/Pyrseas
train
323
6bb9624ad6794e35bfa301abc06b194e4e4d66a2
[ "slug = self.kwargs['slug']\npk = self.kwargs['pk']\ntry:\n article = Article.objects.get(slug=slug)\nexcept Article.DoesNotExist:\n raise NotFound('An article with this slug does not exist.')\ntry:\n comment = Comment.objects.get(pk=pk)\nexcept:\n raise NotFound('The comment with that id does not exist...
<|body_start_0|> slug = self.kwargs['slug'] pk = self.kwargs['pk'] try: article = Article.objects.get(slug=slug) except Article.DoesNotExist: raise NotFound('An article with this slug does not exist.') try: comment = Comment.objects.get(pk=pk) ...
View to retreive, update and delete a single comment
CommentRetrieveUpdateDestroy
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CommentRetrieveUpdateDestroy: """View to retreive, update and delete a single comment""" def retrieve(self, request, **kwargs): """Get single comment""" <|body_0|> def destroy(self, request, **kwargs): """Delete comment""" <|body_1|> <|end_skeleton|> <|...
stack_v2_sparse_classes_75kplus_train_073091
24,455
permissive
[ { "docstring": "Get single comment", "name": "retrieve", "signature": "def retrieve(self, request, **kwargs)" }, { "docstring": "Delete comment", "name": "destroy", "signature": "def destroy(self, request, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_050293
Implement the Python class `CommentRetrieveUpdateDestroy` described below. Class description: View to retreive, update and delete a single comment Method signatures and docstrings: - def retrieve(self, request, **kwargs): Get single comment - def destroy(self, request, **kwargs): Delete comment
Implement the Python class `CommentRetrieveUpdateDestroy` described below. Class description: View to retreive, update and delete a single comment Method signatures and docstrings: - def retrieve(self, request, **kwargs): Get single comment - def destroy(self, request, **kwargs): Delete comment <|skeleton|> class Co...
ebe3a4621a5baf36a9345d4b126ba73dc37acd1f
<|skeleton|> class CommentRetrieveUpdateDestroy: """View to retreive, update and delete a single comment""" def retrieve(self, request, **kwargs): """Get single comment""" <|body_0|> def destroy(self, request, **kwargs): """Delete comment""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CommentRetrieveUpdateDestroy: """View to retreive, update and delete a single comment""" def retrieve(self, request, **kwargs): """Get single comment""" slug = self.kwargs['slug'] pk = self.kwargs['pk'] try: article = Article.objects.get(slug=slug) exce...
the_stack_v2_python_sparse
authors/apps/articles/views.py
andela/ah-leagueOfLegends
train
0
9e0fd25b9bc3c5d5a34b8fa6b14ce95f4ed0cbfa
[ "query = quote_plus(query.lower())\nsoup = self.get_soup(search_url % query)\nresults = []\nfor a in soup.select('ul li a'):\n results.append({'title': a.text.strip(), 'url': self.absolute_url(a['href'])})\nreturn results", "logger.debug('Visiting %s', self.novel_url)\nsoup = self.get_soup(self.novel_url)\nima...
<|body_start_0|> query = quote_plus(query.lower()) soup = self.get_soup(search_url % query) results = [] for a in soup.select('ul li a'): results.append({'title': a.text.strip(), 'url': self.absolute_url(a['href'])}) return results <|end_body_0|> <|body_start_1|> ...
NovelFullPlus
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NovelFullPlus: def search_novel(self, query): """Gets a list of {title, url} matching the given query""" <|body_0|> def read_novel_info(self): """Get novel title, autor, cover etc""" <|body_1|> def download_chapter_body(self, chapter): """Downloa...
stack_v2_sparse_classes_75kplus_train_073092
2,378
permissive
[ { "docstring": "Gets a list of {title, url} matching the given query", "name": "search_novel", "signature": "def search_novel(self, query)" }, { "docstring": "Get novel title, autor, cover etc", "name": "read_novel_info", "signature": "def read_novel_info(self)" }, { "docstring":...
3
stack_v2_sparse_classes_30k_train_018070
Implement the Python class `NovelFullPlus` described below. Class description: Implement the NovelFullPlus class. Method signatures and docstrings: - def search_novel(self, query): Gets a list of {title, url} matching the given query - def read_novel_info(self): Get novel title, autor, cover etc - def download_chapte...
Implement the Python class `NovelFullPlus` described below. Class description: Implement the NovelFullPlus class. Method signatures and docstrings: - def search_novel(self, query): Gets a list of {title, url} matching the given query - def read_novel_info(self): Get novel title, autor, cover etc - def download_chapte...
04143afe1abded83bbf221da2df7ea57f4c7778c
<|skeleton|> class NovelFullPlus: def search_novel(self, query): """Gets a list of {title, url} matching the given query""" <|body_0|> def read_novel_info(self): """Get novel title, autor, cover etc""" <|body_1|> def download_chapter_body(self, chapter): """Downloa...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NovelFullPlus: def search_novel(self, query): """Gets a list of {title, url} matching the given query""" query = quote_plus(query.lower()) soup = self.get_soup(search_url % query) results = [] for a in soup.select('ul li a'): results.append({'title': a.text....
the_stack_v2_python_sparse
sources/en/n/novelfullplus.py
Takishima/lightnovel-crawler
train
0
c884dd266eb3c1cecf302774bc47e794f5bd24f2
[ "matcher = ContainsAllIPs(['10.0.0.1', '10.0.0.2', '10.0.0.2'])\nmismatch = matcher.match([{'id': i, 'address': '10.0.0.{0}'.format(i)} for i in (1, 2)])\nself.assertEqual(None, mismatch)", "matcher = ContainsAllIPs(['10.0.0.1', '10.0.0.2', '10.0.0.2'])\nself.assertNotEqual(None, matcher.match([{'id': i, 'address...
<|body_start_0|> matcher = ContainsAllIPs(['10.0.0.1', '10.0.0.2', '10.0.0.2']) mismatch = matcher.match([{'id': i, 'address': '10.0.0.{0}'.format(i)} for i in (1, 2)]) self.assertEqual(None, mismatch) <|end_body_0|> <|body_start_1|> matcher = ContainsAllIPs(['10.0.0.1', '10.0.0.2', '10...
Tests for the CLB matchers.
MatcherTestCase
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MatcherTestCase: """Tests for the CLB matchers.""" def test_contains_all_ips_success(self): """:class:`ContainsAllIPs` succeeds when the nodes contain all the IPs given.""" <|body_0|> def test_contains_all_ips_failure(self): """:class:`ContainsAllIPs` fail when t...
stack_v2_sparse_classes_75kplus_train_073093
18,654
permissive
[ { "docstring": ":class:`ContainsAllIPs` succeeds when the nodes contain all the IPs given.", "name": "test_contains_all_ips_success", "signature": "def test_contains_all_ips_success(self)" }, { "docstring": ":class:`ContainsAllIPs` fail when the nodes contain only some or none of the all the IPs...
5
stack_v2_sparse_classes_30k_val_000055
Implement the Python class `MatcherTestCase` described below. Class description: Tests for the CLB matchers. Method signatures and docstrings: - def test_contains_all_ips_success(self): :class:`ContainsAllIPs` succeeds when the nodes contain all the IPs given. - def test_contains_all_ips_failure(self): :class:`Contai...
Implement the Python class `MatcherTestCase` described below. Class description: Tests for the CLB matchers. Method signatures and docstrings: - def test_contains_all_ips_success(self): :class:`ContainsAllIPs` succeeds when the nodes contain all the IPs given. - def test_contains_all_ips_failure(self): :class:`Contai...
7199cdd67255fe116dbcbedea660c13453671134
<|skeleton|> class MatcherTestCase: """Tests for the CLB matchers.""" def test_contains_all_ips_success(self): """:class:`ContainsAllIPs` succeeds when the nodes contain all the IPs given.""" <|body_0|> def test_contains_all_ips_failure(self): """:class:`ContainsAllIPs` fail when t...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MatcherTestCase: """Tests for the CLB matchers.""" def test_contains_all_ips_success(self): """:class:`ContainsAllIPs` succeeds when the nodes contain all the IPs given.""" matcher = ContainsAllIPs(['10.0.0.1', '10.0.0.2', '10.0.0.2']) mismatch = matcher.match([{'id': i, 'address'...
the_stack_v2_python_sparse
otter/integration/lib/test_cloud_load_balancer.py
rackerlabs/otter
train
20
f73e6f2de88634e45a4411e0a375430bc0ec99b6
[ "t = 0\nwhile Y > X:\n if Y % 2 == 0:\n Y //= 2\n else:\n Y += 1\n t += 1\nreturn t + X - Y", "q = [X]\nt = 0\nhas_larger = False\nwhile q:\n cur_q = []\n for e in q:\n if e == Y:\n return t\n cur = e * 2\n if cur >= 1:\n if cur > Y and (not ...
<|body_start_0|> t = 0 while Y > X: if Y % 2 == 0: Y //= 2 else: Y += 1 t += 1 return t + X - Y <|end_body_0|> <|body_start_1|> q = [X] t = 0 has_larger = False while q: cur_q = [] ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def brokenCalc(self, X: int, Y: int) -> int: """004_greedy + work backward If Y is odd, we can do only Y = Y + 1 If Y is even, if we plus 1 to Y, then Y is odd, we need to plus another 1. And because (Y + 1 + 1) / 2 = (Y / 2) + 1, 3 operations are more than 2. We always choose ...
stack_v2_sparse_classes_75kplus_train_073094
2,145
no_license
[ { "docstring": "004_greedy + work backward If Y is odd, we can do only Y = Y + 1 If Y is even, if we plus 1 to Y, then Y is odd, we need to plus another 1. And because (Y + 1 + 1) / 2 = (Y / 2) + 1, 3 operations are more than 2. We always choose Y / 2 if Y is even.", "name": "brokenCalc", "signature": "...
2
stack_v2_sparse_classes_30k_train_050916
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def brokenCalc(self, X: int, Y: int) -> int: 004_greedy + work backward If Y is odd, we can do only Y = Y + 1 If Y is even, if we plus 1 to Y, then Y is odd, we need to plus anot...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def brokenCalc(self, X: int, Y: int) -> int: 004_greedy + work backward If Y is odd, we can do only Y = Y + 1 If Y is even, if we plus 1 to Y, then Y is odd, we need to plus anot...
929dde1723fb2f54870c8a9badc80fc23e8400d3
<|skeleton|> class Solution: def brokenCalc(self, X: int, Y: int) -> int: """004_greedy + work backward If Y is odd, we can do only Y = Y + 1 If Y is even, if we plus 1 to Y, then Y is odd, we need to plus another 1. And because (Y + 1 + 1) / 2 = (Y / 2) + 1, 3 operations are more than 2. We always choose ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def brokenCalc(self, X: int, Y: int) -> int: """004_greedy + work backward If Y is odd, we can do only Y = Y + 1 If Y is even, if we plus 1 to Y, then Y is odd, we need to plus another 1. And because (Y + 1 + 1) / 2 = (Y / 2) + 1, 3 operations are more than 2. We always choose Y / 2 if Y is ...
the_stack_v2_python_sparse
_algorithms_challenges/leetcode/LeetCode/991 Broken Calculator.py
syurskyi/Algorithms_and_Data_Structure
train
4
f18e04a53af441fdd4d3a7515bf85f835a289cd2
[ "params = request.params.copy()\nif not api_tool.check_api_access(params.get('appid')):\n return json.dumps({'state': False, 'msg': '拒绝访问'})\nimages = request.env['applet.home.images'].sudo().search([('active', '=', True)])\nreturn_list = list()\nfor image in images:\n return_list.append({'name': image.name, ...
<|body_start_0|> params = request.params.copy() if not api_tool.check_api_access(params.get('appid')): return json.dumps({'state': False, 'msg': '拒绝访问'}) images = request.env['applet.home.images'].sudo().search([('active', '=', True)]) return_list = list() for image i...
小程序接口
AppletApiController
[ "GPL-3.0-only", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AppletApiController: """小程序接口""" def get_applet_hemo_images(self, **kw): """获取小程序首页滚动图片 返回所有状态为有效的图片地址 :param kw: :return:""" <|body_0|> def get_all_enterprise_dynamic(self, **kw): """获取企业动态数据 返回所有有效的数据 :param kw: :return:""" <|body_1|> def get_enter...
stack_v2_sparse_classes_75kplus_train_073095
3,558
permissive
[ { "docstring": "获取小程序首页滚动图片 返回所有状态为有效的图片地址 :param kw: :return:", "name": "get_applet_hemo_images", "signature": "def get_applet_hemo_images(self, **kw)" }, { "docstring": "获取企业动态数据 返回所有有效的数据 :param kw: :return:", "name": "get_all_enterprise_dynamic", "signature": "def get_all_enterprise_...
3
null
Implement the Python class `AppletApiController` described below. Class description: 小程序接口 Method signatures and docstrings: - def get_applet_hemo_images(self, **kw): 获取小程序首页滚动图片 返回所有状态为有效的图片地址 :param kw: :return: - def get_all_enterprise_dynamic(self, **kw): 获取企业动态数据 返回所有有效的数据 :param kw: :return: - def get_enterpris...
Implement the Python class `AppletApiController` described below. Class description: 小程序接口 Method signatures and docstrings: - def get_applet_hemo_images(self, **kw): 获取小程序首页滚动图片 返回所有状态为有效的图片地址 :param kw: :return: - def get_all_enterprise_dynamic(self, **kw): 获取企业动态数据 返回所有有效的数据 :param kw: :return: - def get_enterpris...
8608aaeae7a8c86d53b68ce26b7b308f779c3dd8
<|skeleton|> class AppletApiController: """小程序接口""" def get_applet_hemo_images(self, **kw): """获取小程序首页滚动图片 返回所有状态为有效的图片地址 :param kw: :return:""" <|body_0|> def get_all_enterprise_dynamic(self, **kw): """获取企业动态数据 返回所有有效的数据 :param kw: :return:""" <|body_1|> def get_enter...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AppletApiController: """小程序接口""" def get_applet_hemo_images(self, **kw): """获取小程序首页滚动图片 返回所有状态为有效的图片地址 :param kw: :return:""" params = request.params.copy() if not api_tool.check_api_access(params.get('appid')): return json.dumps({'state': False, 'msg': '拒绝访问'}) ...
the_stack_v2_python_sparse
odoo_hcm/controllers/applet_api.py
niulinlnc/odooExtModel
train
4
6d36876cfb54b81bb67d3e61f70f60e4df48e2e2
[ "dic = set()\nwhile headA and headB:\n if headA not in dic and headB not in dic:\n dic.add(headA)\n if headB not in dic:\n dic.add(headB)\n else:\n return headB\n headA = headA.next\n headB = headB.next\n elif headA in dic:\n return headA\n el...
<|body_start_0|> dic = set() while headA and headB: if headA not in dic and headB not in dic: dic.add(headA) if headB not in dic: dic.add(headB) else: return headB headA = headA.next ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def getIntersectionNode(self, headA, headB): """:type head1, head1: ListNode :rtype: ListNode""" <|body_0|> def getIntersectionNode_2_pointers(self, headA, headB): """:type head1, head1: ListNode :rtype: ListNode""" <|body_1|> def getIntersecti...
stack_v2_sparse_classes_75kplus_train_073096
3,332
no_license
[ { "docstring": ":type head1, head1: ListNode :rtype: ListNode", "name": "getIntersectionNode", "signature": "def getIntersectionNode(self, headA, headB)" }, { "docstring": ":type head1, head1: ListNode :rtype: ListNode", "name": "getIntersectionNode_2_pointers", "signature": "def getInte...
3
stack_v2_sparse_classes_30k_train_018528
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getIntersectionNode(self, headA, headB): :type head1, head1: ListNode :rtype: ListNode - def getIntersectionNode_2_pointers(self, headA, headB): :type head1, head1: ListNode ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getIntersectionNode(self, headA, headB): :type head1, head1: ListNode :rtype: ListNode - def getIntersectionNode_2_pointers(self, headA, headB): :type head1, head1: ListNode ...
85f71621c54f6b0029f3a2746f022f89dd7419d9
<|skeleton|> class Solution: def getIntersectionNode(self, headA, headB): """:type head1, head1: ListNode :rtype: ListNode""" <|body_0|> def getIntersectionNode_2_pointers(self, headA, headB): """:type head1, head1: ListNode :rtype: ListNode""" <|body_1|> def getIntersecti...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def getIntersectionNode(self, headA, headB): """:type head1, head1: ListNode :rtype: ListNode""" dic = set() while headA and headB: if headA not in dic and headB not in dic: dic.add(headA) if headB not in dic: di...
the_stack_v2_python_sparse
LeetCode/LinkedList/160_intersection_of_two_linked_lists.py
XyK0907/for_work
train
0
886dc4fc849a4ed7c65a323c6b90eefa5c988563
[ "if lang == 'en':\n self.labMT, self.labMTvector, self.labMTwordList = emotionFileReader(stopval=0.0, lang='english', returnVector=True)\nelif lang == 'ar':\n self.labMT, self.labMTvector, self.labMTwordList = emotionFileReader(stopval=0.0, lang='arabic', returnVector=True)", "valence, fvec = emotion(text, ...
<|body_start_0|> if lang == 'en': self.labMT, self.labMTvector, self.labMTwordList = emotionFileReader(stopval=0.0, lang='english', returnVector=True) elif lang == 'ar': self.labMT, self.labMTvector, self.labMTwordList = emotionFileReader(stopval=0.0, lang='arabic', returnVector=...
Class to interact with LabMT Paper The language-dependent relationship between word happiness and frequency http://www.pnas.org/content/112/23/E2983.full.pdf Credit http://labmt-simple.readthedocs.io/labMTsimple.html
LabMT
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LabMT: """Class to interact with LabMT Paper The language-dependent relationship between word happiness and frequency http://www.pnas.org/content/112/23/E2983.full.pdf Credit http://labmt-simple.readthedocs.io/labMTsimple.html""" def __init__(self, lang='en'): """Initialize the class...
stack_v2_sparse_classes_75kplus_train_073097
1,331
permissive
[ { "docstring": "Initialize the class with the language :param lang: a text to be analyzed :type lang: :py:class:`str`", "name": "__init__", "signature": "def __init__(self, lang='en')" }, { "docstring": "Get sentiment score for a given text text :param text: a text to be analyzed :type text: :py...
2
null
Implement the Python class `LabMT` described below. Class description: Class to interact with LabMT Paper The language-dependent relationship between word happiness and frequency http://www.pnas.org/content/112/23/E2983.full.pdf Credit http://labmt-simple.readthedocs.io/labMTsimple.html Method signatures and docstrin...
Implement the Python class `LabMT` described below. Class description: Class to interact with LabMT Paper The language-dependent relationship between word happiness and frequency http://www.pnas.org/content/112/23/E2983.full.pdf Credit http://labmt-simple.readthedocs.io/labMTsimple.html Method signatures and docstrin...
2b1d8050e701f574890d3484d49954ee6e22df52
<|skeleton|> class LabMT: """Class to interact with LabMT Paper The language-dependent relationship between word happiness and frequency http://www.pnas.org/content/112/23/E2983.full.pdf Credit http://labmt-simple.readthedocs.io/labMTsimple.html""" def __init__(self, lang='en'): """Initialize the class...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LabMT: """Class to interact with LabMT Paper The language-dependent relationship between word happiness and frequency http://www.pnas.org/content/112/23/E2983.full.pdf Credit http://labmt-simple.readthedocs.io/labMTsimple.html""" def __init__(self, lang='en'): """Initialize the class with the lan...
the_stack_v2_python_sparse
wren/data_discovery/sentiment_analyzer/labmt.py
vishnugithub1989/wren
train
0
936d56e95df0eab69456189fd3c8ecc9f181c1d3
[ "for subkey in profile_list_key.GetSubkeys():\n profile_image_path = self._GetValueFromKey(subkey, 'ProfileImagePath')\n yield UserProfile(subkey.name, profile_image_path)", "profile_list_key = registry.GetKeyByPath(self._PROFILE_LIST_KEY_PATH)\nif profile_list_key:\n yield from self._CollectUserProfiles...
<|body_start_0|> for subkey in profile_list_key.GetSubkeys(): profile_image_path = self._GetValueFromKey(subkey, 'ProfileImagePath') yield UserProfile(subkey.name, profile_image_path) <|end_body_0|> <|body_start_1|> profile_list_key = registry.GetKeyByPath(self._PROFILE_LIST_KEY...
Windows user profiles collector.
UserProfilesCollector
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserProfilesCollector: """Windows user profiles collector.""" def _CollectUserProfiles(self, profile_list_key): """Collects user profiles. Args: profile_list_key (dfwinreg.WinRegistryKey): profile list Windows Registry. Yields: UserProfile: an user profile.""" <|body_0|> ...
stack_v2_sparse_classes_75kplus_train_073098
1,644
permissive
[ { "docstring": "Collects user profiles. Args: profile_list_key (dfwinreg.WinRegistryKey): profile list Windows Registry. Yields: UserProfile: an user profile.", "name": "_CollectUserProfiles", "signature": "def _CollectUserProfiles(self, profile_list_key)" }, { "docstring": "Collects user profil...
2
stack_v2_sparse_classes_30k_train_023992
Implement the Python class `UserProfilesCollector` described below. Class description: Windows user profiles collector. Method signatures and docstrings: - def _CollectUserProfiles(self, profile_list_key): Collects user profiles. Args: profile_list_key (dfwinreg.WinRegistryKey): profile list Windows Registry. Yields:...
Implement the Python class `UserProfilesCollector` described below. Class description: Windows user profiles collector. Method signatures and docstrings: - def _CollectUserProfiles(self, profile_list_key): Collects user profiles. Args: profile_list_key (dfwinreg.WinRegistryKey): profile list Windows Registry. Yields:...
d149aff1b8ff97e1cc8d7416fc583b964bad4ccd
<|skeleton|> class UserProfilesCollector: """Windows user profiles collector.""" def _CollectUserProfiles(self, profile_list_key): """Collects user profiles. Args: profile_list_key (dfwinreg.WinRegistryKey): profile list Windows Registry. Yields: UserProfile: an user profile.""" <|body_0|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UserProfilesCollector: """Windows user profiles collector.""" def _CollectUserProfiles(self, profile_list_key): """Collects user profiles. Args: profile_list_key (dfwinreg.WinRegistryKey): profile list Windows Registry. Yields: UserProfile: an user profile.""" for subkey in profile_list_k...
the_stack_v2_python_sparse
winregrc/profiles.py
libyal/winreg-kb
train
129
b88668b8a5ae103983cf64389b1c0ac7cacf313f
[ "if max_iterations < 0:\n raise ValueError(f'Maximum iteration value must be positive, not {max_iterations}')\nself._MAX_ITERATIONS = max_iterations\nself._iteration_counter = 0", "self._iteration_counter += 1\nif self._iteration_counter > self._MAX_ITERATIONS:\n raise RuntimeError(f'Maximum of {self._MAX_I...
<|body_start_0|> if max_iterations < 0: raise ValueError(f'Maximum iteration value must be positive, not {max_iterations}') self._MAX_ITERATIONS = max_iterations self._iteration_counter = 0 <|end_body_0|> <|body_start_1|> self._iteration_counter += 1 if self._iterati...
Class to keep track of an iteration count
IterationCounter
[ "Unlicense" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IterationCounter: """Class to keep track of an iteration count""" def __init__(self, max_iterations: int) -> None: """Creates an IterationCounter with a given amount of maximum iterations :param max_iterations: The maximum amount of iterations allowed :raises ValueError: If the value...
stack_v2_sparse_classes_75kplus_train_073099
1,000
permissive
[ { "docstring": "Creates an IterationCounter with a given amount of maximum iterations :param max_iterations: The maximum amount of iterations allowed :raises ValueError: If the value is negative", "name": "__init__", "signature": "def __init__(self, max_iterations: int) -> None" }, { "docstring"...
2
stack_v2_sparse_classes_30k_train_015328
Implement the Python class `IterationCounter` described below. Class description: Class to keep track of an iteration count Method signatures and docstrings: - def __init__(self, max_iterations: int) -> None: Creates an IterationCounter with a given amount of maximum iterations :param max_iterations: The maximum amou...
Implement the Python class `IterationCounter` described below. Class description: Class to keep track of an iteration count Method signatures and docstrings: - def __init__(self, max_iterations: int) -> None: Creates an IterationCounter with a given amount of maximum iterations :param max_iterations: The maximum amou...
59c9a35289fb29afedad0e3edd0519b67372ef9f
<|skeleton|> class IterationCounter: """Class to keep track of an iteration count""" def __init__(self, max_iterations: int) -> None: """Creates an IterationCounter with a given amount of maximum iterations :param max_iterations: The maximum amount of iterations allowed :raises ValueError: If the value...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class IterationCounter: """Class to keep track of an iteration count""" def __init__(self, max_iterations: int) -> None: """Creates an IterationCounter with a given amount of maximum iterations :param max_iterations: The maximum amount of iterations allowed :raises ValueError: If the value is negative"...
the_stack_v2_python_sparse
hacker/hackvm/counter.py
Tenebrar/codebase
train
1