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
d6dc80526e56e13f040c7c5de14b670968174450
[ "from xpedite.dependencies import Package, DEPENDENCY_LOADER\nDEPENDENCY_LOADER.load(Package.Numpy, Package.FuncTools)\nif len(probes) < 2:\n raise Exception('invalid request - profiling needs at least two named probes to be enabled. Found only {}'.format(probes))\ntry:\n AbstractRuntime.__init__(self, app, p...
<|body_start_0|> from xpedite.dependencies import Package, DEPENDENCY_LOADER DEPENDENCY_LOADER.load(Package.Numpy, Package.FuncTools) if len(probes) < 2: raise Exception('invalid request - profiling needs at least two named probes to be enabled. Found only {}'.format(probes)) ...
Xpedite suite runtime to orchestrate profile session
Runtime
[ "MIT", "BSD-3-Clause", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Runtime: """Xpedite suite runtime to orchestrate profile session""" def __init__(self, app, probes, pmc=None, cpuSet=None, pollInterval=4, benchmarkProbes=None): """Creates a new profiler runtime Construction of the runtime will execute the following steps 1. Starts the xpedite app t...
stack_v2_sparse_classes_75kplus_train_073200
10,620
permissive
[ { "docstring": "Creates a new profiler runtime Construction of the runtime will execute the following steps 1. Starts the xpedite app to attach to profiling target 2. Queries and resolves location of probes in profile info 3. Load events and topdown database for the target cpu's micro architecture 4. Resolves p...
2
stack_v2_sparse_classes_30k_train_046531
Implement the Python class `Runtime` described below. Class description: Xpedite suite runtime to orchestrate profile session Method signatures and docstrings: - def __init__(self, app, probes, pmc=None, cpuSet=None, pollInterval=4, benchmarkProbes=None): Creates a new profiler runtime Construction of the runtime wil...
Implement the Python class `Runtime` described below. Class description: Xpedite suite runtime to orchestrate profile session Method signatures and docstrings: - def __init__(self, app, probes, pmc=None, cpuSet=None, pollInterval=4, benchmarkProbes=None): Creates a new profiler runtime Construction of the runtime wil...
d6b67e98d4b640c98499a373425f1f009e5b9061
<|skeleton|> class Runtime: """Xpedite suite runtime to orchestrate profile session""" def __init__(self, app, probes, pmc=None, cpuSet=None, pollInterval=4, benchmarkProbes=None): """Creates a new profiler runtime Construction of the runtime will execute the following steps 1. Starts the xpedite app t...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Runtime: """Xpedite suite runtime to orchestrate profile session""" def __init__(self, app, probes, pmc=None, cpuSet=None, pollInterval=4, benchmarkProbes=None): """Creates a new profiler runtime Construction of the runtime will execute the following steps 1. Starts the xpedite app to attach to p...
the_stack_v2_python_sparse
scripts/lib/xpedite/profiler/runtime.py
dendisuhubdy/Xpedite
train
1
9cc119613e1c46cda66c3272a9d549a78fbb1e57
[ "while True:\n r = s.replace('()', '').replace('[]', '').replace('{}', '')\n if r == '':\n return True\n elif r == s:\n return False\n else:\n s = r", "pair = {'(': ')', '[': ']', '{': '}'}\nstack = []\nfor p in s:\n if p in pair:\n stack.append(p)\n else:\n if...
<|body_start_0|> while True: r = s.replace('()', '').replace('[]', '').replace('{}', '') if r == '': return True elif r == s: return False else: s = r <|end_body_0|> <|body_start_1|> pair = {'(': ')', '[': '...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isValid(self, s): """:type s: str :rtype: bool""" <|body_0|> def isValid2(self, s): """Using stack.""" <|body_1|> <|end_skeleton|> <|body_start_0|> while True: r = s.replace('()', '').replace('[]', '').replace('{}', '') ...
stack_v2_sparse_classes_75kplus_train_073201
996
no_license
[ { "docstring": ":type s: str :rtype: bool", "name": "isValid", "signature": "def isValid(self, s)" }, { "docstring": "Using stack.", "name": "isValid2", "signature": "def isValid2(self, s)" } ]
2
stack_v2_sparse_classes_30k_train_032536
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isValid(self, s): :type s: str :rtype: bool - def isValid2(self, s): Using stack.
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isValid(self, s): :type s: str :rtype: bool - def isValid2(self, s): Using stack. <|skeleton|> class Solution: def isValid(self, s): """:type s: str :rtype: boo...
11942efcf481ab79a1c4a7e020e4353e0e0d3901
<|skeleton|> class Solution: def isValid(self, s): """:type s: str :rtype: bool""" <|body_0|> def isValid2(self, s): """Using stack.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def isValid(self, s): """:type s: str :rtype: bool""" while True: r = s.replace('()', '').replace('[]', '').replace('{}', '') if r == '': return True elif r == s: return False else: s = r ...
the_stack_v2_python_sparse
python/solveleet/validParentheses.py
clumsyme/learn
train
0
6cfc156d7435c579ca0fef2d7ad88d03c723d482
[ "stack = []\ntemp = self.head\nwhile temp:\n stack.append(temp.data)\n temp = temp.next\ntemp = self.head\nwhile temp:\n if temp.data != stack[0]:\n return False\n stack.pop(0)\n temp = temp.next\nreturn True", "temp1 = first\ntemp2 = second\nwhile temp1 and temp2:\n if temp1.data == temp...
<|body_start_0|> stack = [] temp = self.head while temp: stack.append(temp.data) temp = temp.next temp = self.head while temp: if temp.data != stack[0]: return False stack.pop(0) temp = temp.next ...
CheckPalindrome
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CheckPalindrome: def check_palindrome_using_stack(self): """Function to check whether elements in linked list form a palindrome of not. It traverses the linked list twice, once to push all elements in stack and other to verify elements in the stack :return: Bool""" <|body_0|> ...
stack_v2_sparse_classes_75kplus_train_073202
2,715
no_license
[ { "docstring": "Function to check whether elements in linked list form a palindrome of not. It traverses the linked list twice, once to push all elements in stack and other to verify elements in the stack :return: Bool", "name": "check_palindrome_using_stack", "signature": "def check_palindrome_using_st...
3
stack_v2_sparse_classes_30k_train_014335
Implement the Python class `CheckPalindrome` described below. Class description: Implement the CheckPalindrome class. Method signatures and docstrings: - def check_palindrome_using_stack(self): Function to check whether elements in linked list form a palindrome of not. It traverses the linked list twice, once to push...
Implement the Python class `CheckPalindrome` described below. Class description: Implement the CheckPalindrome class. Method signatures and docstrings: - def check_palindrome_using_stack(self): Function to check whether elements in linked list form a palindrome of not. It traverses the linked list twice, once to push...
7e484faa5c75e690f2cb33ee95eedf4472c0089b
<|skeleton|> class CheckPalindrome: def check_palindrome_using_stack(self): """Function to check whether elements in linked list form a palindrome of not. It traverses the linked list twice, once to push all elements in stack and other to verify elements in the stack :return: Bool""" <|body_0|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CheckPalindrome: def check_palindrome_using_stack(self): """Function to check whether elements in linked list form a palindrome of not. It traverses the linked list twice, once to push all elements in stack and other to verify elements in the stack :return: Bool""" stack = [] temp = se...
the_stack_v2_python_sparse
linkedlists/singly_linked_list/check_palindrome_in_linkedlist.py
sunny0910/Data-Structures-Algorithms
train
5
6db91ab7e1880380d05dd608ea4c27e02c0a6d24
[ "if obj == cls.IGNORE:\n return dataset_options_pb2.ExternalStatePolicy.POLICY_IGNORE\nif obj == cls.FAIL:\n return dataset_options_pb2.ExternalStatePolicy.POLICY_FAIL\nif obj == cls.WARN:\n return dataset_options_pb2.ExternalStatePolicy.POLICY_WARN\nraise ValueError(f'Invalid `obj.` Supported values inclu...
<|body_start_0|> if obj == cls.IGNORE: return dataset_options_pb2.ExternalStatePolicy.POLICY_IGNORE if obj == cls.FAIL: return dataset_options_pb2.ExternalStatePolicy.POLICY_FAIL if obj == cls.WARN: return dataset_options_pb2.ExternalStatePolicy.POLICY_WARN ...
Represents how to handle external state during serialization. See the `tf.data.Options.experimental_external_state_policy` documentation for more information.
ExternalStatePolicy
[ "Apache-2.0", "LicenseRef-scancode-generic-cla", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExternalStatePolicy: """Represents how to handle external state during serialization. See the `tf.data.Options.experimental_external_state_policy` documentation for more information.""" def _to_proto(cls, obj): """Convert enum to proto.""" <|body_0|> def _from_proto(cls,...
stack_v2_sparse_classes_75kplus_train_073203
28,211
permissive
[ { "docstring": "Convert enum to proto.", "name": "_to_proto", "signature": "def _to_proto(cls, obj)" }, { "docstring": "Convert proto to enum.", "name": "_from_proto", "signature": "def _from_proto(cls, pb)" } ]
2
stack_v2_sparse_classes_30k_train_011138
Implement the Python class `ExternalStatePolicy` described below. Class description: Represents how to handle external state during serialization. See the `tf.data.Options.experimental_external_state_policy` documentation for more information. Method signatures and docstrings: - def _to_proto(cls, obj): Convert enum ...
Implement the Python class `ExternalStatePolicy` described below. Class description: Represents how to handle external state during serialization. See the `tf.data.Options.experimental_external_state_policy` documentation for more information. Method signatures and docstrings: - def _to_proto(cls, obj): Convert enum ...
a7f3934a67900720af3d3b15389551483bee50b8
<|skeleton|> class ExternalStatePolicy: """Represents how to handle external state during serialization. See the `tf.data.Options.experimental_external_state_policy` documentation for more information.""" def _to_proto(cls, obj): """Convert enum to proto.""" <|body_0|> def _from_proto(cls,...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ExternalStatePolicy: """Represents how to handle external state during serialization. See the `tf.data.Options.experimental_external_state_policy` documentation for more information.""" def _to_proto(cls, obj): """Convert enum to proto.""" if obj == cls.IGNORE: return dataset_...
the_stack_v2_python_sparse
tensorflow/python/data/ops/options.py
tensorflow/tensorflow
train
208,740
3cb7ac30d6378245cb03105ad64688616ed662a9
[ "if not request.user.is_authenticated():\n return render(request, 'users/login.html')\nelse:\n return HttpResponseRedirect('/personal/')", "redirect_to = request.GET.get('next', '/personal/')\nlogin_form = LoginForm(request.POST)\nif login_form.is_valid():\n user_name = request.POST.get('username', '')\n...
<|body_start_0|> if not request.user.is_authenticated(): return render(request, 'users/login.html') else: return HttpResponseRedirect('/personal/') <|end_body_0|> <|body_start_1|> redirect_to = request.GET.get('next', '/personal/') login_form = LoginForm(request....
用户登录认证,通过form表单进行输入合规验证 django使用会话和中间件来拦截认证系统中的请求对象。他们在每一个请求上都提供一个request.user属性, 表示当前用户。如果当前用户没有接入,该属性将设置成AnonymousUser的一个实例,否则将会是User实例;
LoginView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LoginView: """用户登录认证,通过form表单进行输入合规验证 django使用会话和中间件来拦截认证系统中的请求对象。他们在每一个请求上都提供一个request.user属性, 表示当前用户。如果当前用户没有接入,该属性将设置成AnonymousUser的一个实例,否则将会是User实例;""" def get(self, request): """若用户没有被授权,则跳转到登陆页面,否则显示登陆成功主界面 :param request: :return:""" <|body_0|> def post(self, requ...
stack_v2_sparse_classes_75kplus_train_073204
7,681
no_license
[ { "docstring": "若用户没有被授权,则跳转到登陆页面,否则显示登陆成功主界面 :param request: :return:", "name": "get", "signature": "def get(self, request)" }, { "docstring": "若用户状态为0,在登陆页面显示为未激活; 若输入用户名与密码与数据库不一致,在登陆界面显示用户名或密码错误; 若用户没有输入用户名或者密码,在登陆页面显示用户名或密码错误; 否则,用户登陆成功,保存用户信息至session,并显示跳转之后的主界面; :param request: :return:",...
2
null
Implement the Python class `LoginView` described below. Class description: 用户登录认证,通过form表单进行输入合规验证 django使用会话和中间件来拦截认证系统中的请求对象。他们在每一个请求上都提供一个request.user属性, 表示当前用户。如果当前用户没有接入,该属性将设置成AnonymousUser的一个实例,否则将会是User实例; Method signatures and docstrings: - def get(self, request): 若用户没有被授权,则跳转到登陆页面,否则显示登陆成功主界面 :param request...
Implement the Python class `LoginView` described below. Class description: 用户登录认证,通过form表单进行输入合规验证 django使用会话和中间件来拦截认证系统中的请求对象。他们在每一个请求上都提供一个request.user属性, 表示当前用户。如果当前用户没有接入,该属性将设置成AnonymousUser的一个实例,否则将会是User实例; Method signatures and docstrings: - def get(self, request): 若用户没有被授权,则跳转到登陆页面,否则显示登陆成功主界面 :param request...
e83b94a44e6188b0c745b61512845c3da5cc9643
<|skeleton|> class LoginView: """用户登录认证,通过form表单进行输入合规验证 django使用会话和中间件来拦截认证系统中的请求对象。他们在每一个请求上都提供一个request.user属性, 表示当前用户。如果当前用户没有接入,该属性将设置成AnonymousUser的一个实例,否则将会是User实例;""" def get(self, request): """若用户没有被授权,则跳转到登陆页面,否则显示登陆成功主界面 :param request: :return:""" <|body_0|> def post(self, requ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LoginView: """用户登录认证,通过form表单进行输入合规验证 django使用会话和中间件来拦截认证系统中的请求对象。他们在每一个请求上都提供一个request.user属性, 表示当前用户。如果当前用户没有接入,该属性将设置成AnonymousUser的一个实例,否则将会是User实例;""" def get(self, request): """若用户没有被授权,则跳转到登陆页面,否则显示登陆成功主界面 :param request: :return:""" if not request.user.is_authenticated(): ...
the_stack_v2_python_sparse
apps/users/views.py
TTWen/REProject-RED
train
1
0a7bb81c88338d5bcebdb82e6c6931febb20808c
[ "super().__init__()\nself._use_condition = use_condition\nself._model = tf.keras.Sequential([tf.keras.layers.Dense(7 * 7 * 256, use_bias=False), tf.keras.layers.BatchNormalization(), tf.keras.layers.ReLU(), tf.keras.layers.Reshape([7, 7, 256]), tf.keras.layers.Conv2DTranspose(128, [5, 5], padding='same', use_bias=F...
<|body_start_0|> super().__init__() self._use_condition = use_condition self._model = tf.keras.Sequential([tf.keras.layers.Dense(7 * 7 * 256, use_bias=False), tf.keras.layers.BatchNormalization(), tf.keras.layers.ReLU(), tf.keras.layers.Reshape([7, 7, 256]), tf.keras.layers.Conv2DTranspose(128, ...
Class conditioned decoder. This decoder is used by MNIST and FMNIST datasets. Attributes: _use_condition: _model:
ClassConditionedDecoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClassConditionedDecoder: """Class conditioned decoder. This decoder is used by MNIST and FMNIST datasets. Attributes: _use_condition: _model:""" def __init__(self, use_condition): """Initializes the object. Args: use_condition:""" <|body_0|> def call(self, noise, embeddi...
stack_v2_sparse_classes_75kplus_train_073205
10,560
no_license
[ { "docstring": "Initializes the object. Args: use_condition:", "name": "__init__", "signature": "def __init__(self, use_condition)" }, { "docstring": "Applies the model to the inputs. Args: noise: embedding: Returns:", "name": "call", "signature": "def call(self, noise, embedding)" } ]
2
stack_v2_sparse_classes_30k_train_047124
Implement the Python class `ClassConditionedDecoder` described below. Class description: Class conditioned decoder. This decoder is used by MNIST and FMNIST datasets. Attributes: _use_condition: _model: Method signatures and docstrings: - def __init__(self, use_condition): Initializes the object. Args: use_condition:...
Implement the Python class `ClassConditionedDecoder` described below. Class description: Class conditioned decoder. This decoder is used by MNIST and FMNIST datasets. Attributes: _use_condition: _model: Method signatures and docstrings: - def __init__(self, use_condition): Initializes the object. Args: use_condition:...
6d04861ef87ba2ba2a4182ad36f3b322fcf47cfa
<|skeleton|> class ClassConditionedDecoder: """Class conditioned decoder. This decoder is used by MNIST and FMNIST datasets. Attributes: _use_condition: _model:""" def __init__(self, use_condition): """Initializes the object. Args: use_condition:""" <|body_0|> def call(self, noise, embeddi...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ClassConditionedDecoder: """Class conditioned decoder. This decoder is used by MNIST and FMNIST datasets. Attributes: _use_condition: _model:""" def __init__(self, use_condition): """Initializes the object. Args: use_condition:""" super().__init__() self._use_condition = use_condi...
the_stack_v2_python_sparse
vae.py
gaotianxiang/text-to-image-synthesis
train
0
0bf40241710cf09f23cd8dcaf357a872193cdabb
[ "startTime = datetime.datetime.now()\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('ruipang_zhou482', 'ruipang_zhou482')\npublic_school = []\nfor i in repo['ruipang_zhou482.PublicSchool'].find():\n public_school.append(i)\nprivate_school = []\nfor i in repo['ruipang_zhou482.PrivateSc...
<|body_start_0|> startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('ruipang_zhou482', 'ruipang_zhou482') public_school = [] for i in repo['ruipang_zhou482.PublicSchool'].find(): public_school.append(i) ...
TotalSchool
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TotalSchool: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing everything h...
stack_v2_sparse_classes_75kplus_train_073206
3,994
no_license
[ { "docstring": "Retrieve some data sets (not using the API here for the sake of simplicity).", "name": "execute", "signature": "def execute(trial=False)" }, { "docstring": "Create the provenance document describing everything happening in this script. Each run of the script will generate a new d...
2
stack_v2_sparse_classes_30k_train_004818
Implement the Python class `TotalSchool` described below. Class description: Implement the TotalSchool class. Method signatures and docstrings: - def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity). - def provenance(doc=prov.model.ProvDocument(), startTime=None, endTi...
Implement the Python class `TotalSchool` described below. Class description: Implement the TotalSchool class. Method signatures and docstrings: - def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity). - def provenance(doc=prov.model.ProvDocument(), startTime=None, endTi...
90284cf3debbac36eead07b8d2339cdd191b86cf
<|skeleton|> class TotalSchool: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing everything h...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TotalSchool: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('ruipang_zhou482', 'ruipang_zhou482') ...
the_stack_v2_python_sparse
ruipang_zhou482/TotalSchool.py
maximega/course-2019-spr-proj
train
2
e5903bb10b06c2fd6acc1b4280b242d774a8d5db
[ "self.weightlist = wl\nself.demandlist = dl.copy()\nself.MAX_PLACE = MAX_PLACE", "ant_solution = []\nfor i in range(len(weightlist)):\n ant_solution.append(np.random.choice(range(self.MAX_PLACE), p=weightlist[i]))\nreturn ant_solution" ]
<|body_start_0|> self.weightlist = wl self.demandlist = dl.copy() self.MAX_PLACE = MAX_PLACE <|end_body_0|> <|body_start_1|> ant_solution = [] for i in range(len(weightlist)): ant_solution.append(np.random.choice(range(self.MAX_PLACE), p=weightlist[i])) retur...
Ant
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Ant: def __init__(self, wl, dl, MAX_PLACE): """Creates and initializes Ant() object Args: wl (list): Weightlist which contains the percentages of a cell being picked dl (list): Demandlist of demanded pods (-> one pod per iteration) MAX_PLACE (int): Limits highest possible solution value ...
stack_v2_sparse_classes_75kplus_train_073207
6,561
no_license
[ { "docstring": "Creates and initializes Ant() object Args: wl (list): Weightlist which contains the percentages of a cell being picked dl (list): Demandlist of demanded pods (-> one pod per iteration) MAX_PLACE (int): Limits highest possible solution value in heuristic", "name": "__init__", "signature":...
2
null
Implement the Python class `Ant` described below. Class description: Implement the Ant class. Method signatures and docstrings: - def __init__(self, wl, dl, MAX_PLACE): Creates and initializes Ant() object Args: wl (list): Weightlist which contains the percentages of a cell being picked dl (list): Demandlist of deman...
Implement the Python class `Ant` described below. Class description: Implement the Ant class. Method signatures and docstrings: - def __init__(self, wl, dl, MAX_PLACE): Creates and initializes Ant() object Args: wl (list): Weightlist which contains the percentages of a cell being picked dl (list): Demandlist of deman...
7a3adc2182a932c5a4f0dde12a1025bfe373b9cd
<|skeleton|> class Ant: def __init__(self, wl, dl, MAX_PLACE): """Creates and initializes Ant() object Args: wl (list): Weightlist which contains the percentages of a cell being picked dl (list): Demandlist of demanded pods (-> one pod per iteration) MAX_PLACE (int): Limits highest possible solution value ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Ant: def __init__(self, wl, dl, MAX_PLACE): """Creates and initializes Ant() object Args: wl (list): Weightlist which contains the percentages of a cell being picked dl (list): Demandlist of demanded pods (-> one pod per iteration) MAX_PLACE (int): Limits highest possible solution value in heuristic""...
the_stack_v2_python_sparse
proj4/aco.py
Broncks/researchlab
train
0
35a1278cccb18d15aed26b6add0860d905920a97
[ "if root is None:\n return '()'\nreturn '({}{}{})'.format(root.val, self.serialize(root.left), self.serialize(root.right))", "data = data[1:len(data) - 1]\nif not data:\n return None\nflp = data.index('(')\ncur_node = TreeNode(int(data[:flp]))\nscore = 0\nfor i in range(flp, len(data)):\n if data[i] == '...
<|body_start_0|> if root is None: return '()' return '({}{}{})'.format(root.val, self.serialize(root.left), self.serialize(root.right)) <|end_body_0|> <|body_start_1|> data = data[1:len(data) - 1] if not data: return None flp = data.index('(') cur...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_75kplus_train_073208
2,318
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_val_000063
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
34a78e06d493e61b21d4442747e9102abf9b319b
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" if root is None: return '()' return '({}{}{})'.format(root.val, self.serialize(root.left), self.serialize(root.right)) def deserialize(self, data): """De...
the_stack_v2_python_sparse
297_Serialize_and_Deserialize_Binary_Tree.py
sunnyyeti/Leetcode-solutions
train
0
691f0fd5e7e589b2aa9e25ec1864ac3e6de91bd0
[ "_logout(self.ixiacrapp)\nres = self.ixiacrapp.get('/')\nself.assertTrue('303' in res.status)\nself.assertTrue('login' in res.location)", "_logout(self.ixiacrapp)\nres = _login(self.ixiacrapp)\nself.assertFalse('Please check your login credentials and try again.' in res.body, 'login failed')\nself.assertTrue('302...
<|body_start_0|> _logout(self.ixiacrapp) res = self.ixiacrapp.get('/') self.assertTrue('303' in res.status) self.assertTrue('login' in res.location) <|end_body_0|> <|body_start_1|> _logout(self.ixiacrapp) res = _login(self.ixiacrapp) self.assertFalse('Please chec...
NavigationTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NavigationTest: def test_root(self): """Test login redirect for guest user.""" <|body_0|> def test_login(self): """Test the ability for a user to login to the system.""" <|body_1|> def test_logout(self): """Test the ability for a user to logout o...
stack_v2_sparse_classes_75kplus_train_073209
3,234
no_license
[ { "docstring": "Test login redirect for guest user.", "name": "test_root", "signature": "def test_root(self)" }, { "docstring": "Test the ability for a user to login to the system.", "name": "test_login", "signature": "def test_login(self)" }, { "docstring": "Test the ability for...
3
null
Implement the Python class `NavigationTest` described below. Class description: Implement the NavigationTest class. Method signatures and docstrings: - def test_root(self): Test login redirect for guest user. - def test_login(self): Test the ability for a user to login to the system. - def test_logout(self): Test the...
Implement the Python class `NavigationTest` described below. Class description: Implement the NavigationTest class. Method signatures and docstrings: - def test_root(self): Test login redirect for guest user. - def test_login(self): Test the ability for a user to login to the system. - def test_logout(self): Test the...
4306bf4d2b29b19d4b3092aab152192f7d623a19
<|skeleton|> class NavigationTest: def test_root(self): """Test login redirect for guest user.""" <|body_0|> def test_login(self): """Test the ability for a user to login to the system.""" <|body_1|> def test_logout(self): """Test the ability for a user to logout o...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NavigationTest: def test_root(self): """Test login redirect for guest user.""" _logout(self.ixiacrapp) res = self.ixiacrapp.get('/') self.assertTrue('303' in res.status) self.assertTrue('login' in res.location) def test_login(self): """Test the ability for ...
the_stack_v2_python_sparse
IxiaCR/webtests/tests.py
jundong/CRManager
train
2
bacff5c3a77b80414fa510abea6f489743d5c636
[ "future_question = create_question(question_text='future question.', days=30)\nurl = reverse('polls:detail', args=(future_question.id,))\nresponse = self.client.get(url)\nself.assertEqual(response.status_code, 404)", "past_question = create_question(question_text='Past question.', days=-30)\nurl = reverse('polls:...
<|body_start_0|> future_question = create_question(question_text='future question.', days=30) url = reverse('polls:detail', args=(future_question.id,)) response = self.client.get(url) self.assertEqual(response.status_code, 404) <|end_body_0|> <|body_start_1|> past_question = cre...
QuestionDetailViewTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QuestionDetailViewTest: def test_future_question(self): """The detail view of a question with a pub_date in the future returns a 404 not found.""" <|body_0|> def test_past_question(self): """The detail view of a question with a pub_date in the past displays the quest...
stack_v2_sparse_classes_75kplus_train_073210
3,343
no_license
[ { "docstring": "The detail view of a question with a pub_date in the future returns a 404 not found.", "name": "test_future_question", "signature": "def test_future_question(self)" }, { "docstring": "The detail view of a question with a pub_date in the past displays the question's text", "na...
2
null
Implement the Python class `QuestionDetailViewTest` described below. Class description: Implement the QuestionDetailViewTest class. Method signatures and docstrings: - def test_future_question(self): The detail view of a question with a pub_date in the future returns a 404 not found. - def test_past_question(self): T...
Implement the Python class `QuestionDetailViewTest` described below. Class description: Implement the QuestionDetailViewTest class. Method signatures and docstrings: - def test_future_question(self): The detail view of a question with a pub_date in the future returns a 404 not found. - def test_past_question(self): T...
f398b6e72609ed2d392991e0d18765d4240e252a
<|skeleton|> class QuestionDetailViewTest: def test_future_question(self): """The detail view of a question with a pub_date in the future returns a 404 not found.""" <|body_0|> def test_past_question(self): """The detail view of a question with a pub_date in the past displays the quest...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class QuestionDetailViewTest: def test_future_question(self): """The detail view of a question with a pub_date in the future returns a 404 not found.""" future_question = create_question(question_text='future question.', days=30) url = reverse('polls:detail', args=(future_question.id,)) ...
the_stack_v2_python_sparse
polls/test_scripts/test_view.py
supriadi-yusuf/mysite-django
train
0
ac6ba083dd41ede2f02d17ba4bef0d776ab3d10a
[ "ensuredb()\ncheck_uuid(self.uuid)\nself.wait_task()\nif self.print_info:\n TaskInfoApp(uuid=self.uuid, output_format=self.output_format).run()\nelif self.print_status:\n TaskInfoApp(uuid=self.uuid, extract_field='exit_status').run()\nelif self.return_status:\n if (status := Task.from_id(self.uuid).exit_st...
<|body_start_0|> ensuredb() check_uuid(self.uuid) self.wait_task() if self.print_info: TaskInfoApp(uuid=self.uuid, output_format=self.output_format).run() elif self.print_status: TaskInfoApp(uuid=self.uuid, extract_field='exit_status').run() elif s...
Wait for task to complete.
TaskWaitApp
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TaskWaitApp: """Wait for task to complete.""" def run(self: TaskWaitApp) -> None: """Wait for task to complete.""" <|body_0|> def wait_task(self: TaskWaitApp): """Wait for the task to complete.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ens...
stack_v2_sparse_classes_75kplus_train_073211
31,601
permissive
[ { "docstring": "Wait for task to complete.", "name": "run", "signature": "def run(self: TaskWaitApp) -> None" }, { "docstring": "Wait for the task to complete.", "name": "wait_task", "signature": "def wait_task(self: TaskWaitApp)" } ]
2
stack_v2_sparse_classes_30k_train_052534
Implement the Python class `TaskWaitApp` described below. Class description: Wait for task to complete. Method signatures and docstrings: - def run(self: TaskWaitApp) -> None: Wait for task to complete. - def wait_task(self: TaskWaitApp): Wait for the task to complete.
Implement the Python class `TaskWaitApp` described below. Class description: Wait for task to complete. Method signatures and docstrings: - def run(self: TaskWaitApp) -> None: Wait for task to complete. - def wait_task(self: TaskWaitApp): Wait for the task to complete. <|skeleton|> class TaskWaitApp: """Wait for...
e142376249e0fe3de624790600f3c5e99022e047
<|skeleton|> class TaskWaitApp: """Wait for task to complete.""" def run(self: TaskWaitApp) -> None: """Wait for task to complete.""" <|body_0|> def wait_task(self: TaskWaitApp): """Wait for the task to complete.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TaskWaitApp: """Wait for task to complete.""" def run(self: TaskWaitApp) -> None: """Wait for task to complete.""" ensuredb() check_uuid(self.uuid) self.wait_task() if self.print_info: TaskInfoApp(uuid=self.uuid, output_format=self.output_format).run() ...
the_stack_v2_python_sparse
src/hypershell/task.py
glentner/hyper-shell
train
20
bc6fccdc775a1a0f779b120218f5eb1eb57e6f55
[ "self._model1 = None\nself._model2 = None\nself._model_mix = None", "self._model_mix = None\nparser = sppasACMRW(model_text_dir)\nmodel_text = parser.read()\nparser.set_folder(model_spk_dir)\nmodel_spk = parser.read()\nself.set_models(model_text, model_spk)", "if model_text.get_mfcc_parameter_kind() != model_sp...
<|body_start_0|> self._model1 = None self._model2 = None self._model_mix = None <|end_body_0|> <|body_start_1|> self._model_mix = None parser = sppasACMRW(model_text_dir) model_text = parser.read() parser.set_folder(model_spk_dir) model_spk = parser.read(...
Mix two acoustic models. :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :license: GPL, v3 :copyright: Copyright (C) 2011-2018 Brigitte Bigi :author: Brigitte Bigi :contact: develop@sppas.org Create a mixed monophones model. Typical use is to create an acoustic model of a non-native speaker.
sppasModelMixer
[ "GPL-3.0-only", "MIT", "GFDL-1.1-or-later", "GPL-3.0-or-later" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class sppasModelMixer: """Mix two acoustic models. :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :license: GPL, v3 :copyright: Copyright (C) 2011-2018 Brigitte Bigi :author: Brigitte Bigi :contact: develop@sppas.org Create a mixed monophones model. Typical use is to create an ac...
stack_v2_sparse_classes_75kplus_train_073212
6,198
permissive
[ { "docstring": "Create a sppasModelMixer instance.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Read the acoustic models from their directories. :param model_text_dir: (str) :param model_spk_dir: (str)", "name": "read", "signature": "def read(self, model_tex...
4
null
Implement the Python class `sppasModelMixer` described below. Class description: Mix two acoustic models. :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :license: GPL, v3 :copyright: Copyright (C) 2011-2018 Brigitte Bigi :author: Brigitte Bigi :contact: develop@sppas.org Create a mixed monophone...
Implement the Python class `sppasModelMixer` described below. Class description: Mix two acoustic models. :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :license: GPL, v3 :copyright: Copyright (C) 2011-2018 Brigitte Bigi :author: Brigitte Bigi :contact: develop@sppas.org Create a mixed monophone...
3167b65f576abcc27a8767d24c274a04712bd948
<|skeleton|> class sppasModelMixer: """Mix two acoustic models. :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :license: GPL, v3 :copyright: Copyright (C) 2011-2018 Brigitte Bigi :author: Brigitte Bigi :contact: develop@sppas.org Create a mixed monophones model. Typical use is to create an ac...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class sppasModelMixer: """Mix two acoustic models. :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :license: GPL, v3 :copyright: Copyright (C) 2011-2018 Brigitte Bigi :author: Brigitte Bigi :contact: develop@sppas.org Create a mixed monophones model. Typical use is to create an acoustic model ...
the_stack_v2_python_sparse
sppas/sppas/src/models/acm/modelmixer.py
mirfan899/MTTS
train
0
c8bba57c54dde924b9063fec2968f208618ae100
[ "char.race = givenRace\nchar.cclass = givenClass\nchar.background = givenBackground", "possible_class = ['Barbarian', 'Bard', 'Cleic', 'Druid', 'Fighter', 'Monk', 'Paladin', 'Ranger', 'Rouge', 'Sorcerer', 'Warlock', 'Wizard']\nfor i in possible_class:\n if i == char.cclass:\n return True\nreturn False",...
<|body_start_0|> char.race = givenRace char.cclass = givenClass char.background = givenBackground <|end_body_0|> <|body_start_1|> possible_class = ['Barbarian', 'Bard', 'Cleic', 'Druid', 'Fighter', 'Monk', 'Paladin', 'Ranger', 'Rouge', 'Sorcerer', 'Warlock', 'Wizard'] for i in p...
Character
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Character: def __init__(char, givenRace, givenClass, givenBackground): """This function initalizes the character""" <|body_0|> def validate_class(char): """This function validates the character Class using a class""" <|body_1|> def Val_bg(char): ...
stack_v2_sparse_classes_75kplus_train_073213
2,171
no_license
[ { "docstring": "This function initalizes the character", "name": "__init__", "signature": "def __init__(char, givenRace, givenClass, givenBackground)" }, { "docstring": "This function validates the character Class using a class", "name": "validate_class", "signature": "def validate_class...
4
stack_v2_sparse_classes_30k_test_001054
Implement the Python class `Character` described below. Class description: Implement the Character class. Method signatures and docstrings: - def __init__(char, givenRace, givenClass, givenBackground): This function initalizes the character - def validate_class(char): This function validates the character Class using...
Implement the Python class `Character` described below. Class description: Implement the Character class. Method signatures and docstrings: - def __init__(char, givenRace, givenClass, givenBackground): This function initalizes the character - def validate_class(char): This function validates the character Class using...
ff2c820f8c171296b28483a54ee48a97ac0a9b50
<|skeleton|> class Character: def __init__(char, givenRace, givenClass, givenBackground): """This function initalizes the character""" <|body_0|> def validate_class(char): """This function validates the character Class using a class""" <|body_1|> def Val_bg(char): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Character: def __init__(char, givenRace, givenClass, givenBackground): """This function initalizes the character""" char.race = givenRace char.cclass = givenClass char.background = givenBackground def validate_class(char): """This function validates the character C...
the_stack_v2_python_sparse
D&D_input_Check.py
annebell881/ENGR-102
train
0
0be55e10dd20e645863071bdfb339a9200d36bd2
[ "general_mapping_payload = request.data\nassert_valid(general_mapping_payload is not None, 'Request body is empty')\nmapping_utils = MappingUtils(kwargs['workspace_id'])\ngeneral_mapping = mapping_utils.create_or_update_general_mapping(general_mapping_payload)\nreturn Response(data=self.serializer_class(general_map...
<|body_start_0|> general_mapping_payload = request.data assert_valid(general_mapping_payload is not None, 'Request body is empty') mapping_utils = MappingUtils(kwargs['workspace_id']) general_mapping = mapping_utils.create_or_update_general_mapping(general_mapping_payload) return...
General mappings
GeneralMappingView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GeneralMappingView: """General mappings""" def post(self, request, *args, **kwargs): """Create general mappings""" <|body_0|> def get(self, request, *args, **kwargs): """Get general mappings""" <|body_1|> <|end_skeleton|> <|body_start_0|> genera...
stack_v2_sparse_classes_75kplus_train_073214
5,203
permissive
[ { "docstring": "Create general mappings", "name": "post", "signature": "def post(self, request, *args, **kwargs)" }, { "docstring": "Get general mappings", "name": "get", "signature": "def get(self, request, *args, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_009694
Implement the Python class `GeneralMappingView` described below. Class description: General mappings Method signatures and docstrings: - def post(self, request, *args, **kwargs): Create general mappings - def get(self, request, *args, **kwargs): Get general mappings
Implement the Python class `GeneralMappingView` described below. Class description: General mappings Method signatures and docstrings: - def post(self, request, *args, **kwargs): Create general mappings - def get(self, request, *args, **kwargs): Get general mappings <|skeleton|> class GeneralMappingView: """Gene...
53f595170a073f245b9930bfce2ca07bdf998ce3
<|skeleton|> class GeneralMappingView: """General mappings""" def post(self, request, *args, **kwargs): """Create general mappings""" <|body_0|> def get(self, request, *args, **kwargs): """Get general mappings""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GeneralMappingView: """General mappings""" def post(self, request, *args, **kwargs): """Create general mappings""" general_mapping_payload = request.data assert_valid(general_mapping_payload is not None, 'Request body is empty') mapping_utils = MappingUtils(kwargs['workspa...
the_stack_v2_python_sparse
apps/mappings/views.py
Sravanksk/fyle-qbo-api
train
0
9837e0ceb9ecd095197aedf4ff3ab6cd3ff061e5
[ "self.angle = a\nself.velocity = 0\nself.colour = Colour(c)\nself.active = True", "a = (6 + math.floor(self.angle / (2 * math.pi) % 1 * num_pixels)) % num_pixels\nif self.active:\n clrs[a] = self.colour.add(clrs[a])\nelse:\n clrs[a] = Colour(255, 255, 255)", "if not self.active:\n return\nself.oangle =...
<|body_start_0|> self.angle = a self.velocity = 0 self.colour = Colour(c) self.active = True <|end_body_0|> <|body_start_1|> a = (6 + math.floor(self.angle / (2 * math.pi) % 1 * num_pixels)) % num_pixels if self.active: clrs[a] = self.colour.add(clrs[a]) ...
Ball
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Ball: def __init__(self, a, c): """Initialise the ball with a position and colour.""" <|body_0|> def draw(self, clrs): """Draw a pixel at the right position.""" <|body_1|> def update(self, g, dt): """Update the position and velocity given the gra...
stack_v2_sparse_classes_75kplus_train_073215
5,073
permissive
[ { "docstring": "Initialise the ball with a position and colour.", "name": "__init__", "signature": "def __init__(self, a, c)" }, { "docstring": "Draw a pixel at the right position.", "name": "draw", "signature": "def draw(self, clrs)" }, { "docstring": "Update the position and ve...
4
stack_v2_sparse_classes_30k_train_049412
Implement the Python class `Ball` described below. Class description: Implement the Ball class. Method signatures and docstrings: - def __init__(self, a, c): Initialise the ball with a position and colour. - def draw(self, clrs): Draw a pixel at the right position. - def update(self, g, dt): Update the position and v...
Implement the Python class `Ball` described below. Class description: Implement the Ball class. Method signatures and docstrings: - def __init__(self, a, c): Initialise the ball with a position and colour. - def draw(self, clrs): Draw a pixel at the right position. - def update(self, g, dt): Update the position and v...
cd3ad65b8d7aed1247fdfccc3a10a0da7b4d8f8c
<|skeleton|> class Ball: def __init__(self, a, c): """Initialise the ball with a position and colour.""" <|body_0|> def draw(self, clrs): """Draw a pixel at the right position.""" <|body_1|> def update(self, g, dt): """Update the position and velocity given the gra...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Ball: def __init__(self, a, c): """Initialise the ball with a position and colour.""" self.angle = a self.velocity = 0 self.colour = Colour(c) self.active = True def draw(self, clrs): """Draw a pixel at the right position.""" a = (6 + math.floor(sel...
the_stack_v2_python_sparse
ziphalo/test.py
doyouknowhow/microbit
train
0
99a87fe03277e547784639afcc75577f1456fcd7
[ "super().__init__()\nvalidate_config(config, self.required_config_keys)\nself.config = config\nself._initialize_layers()\nself.n_outputs = 1", "n_channels = self.config['n_channels']\nn_classes = self.config['n_classes']\nself.conv1 = Conv2d(in_channels=n_channels, out_channels=96, kernel_size=(11, 11), stride=(4...
<|body_start_0|> super().__init__() validate_config(config, self.required_config_keys) self.config = config self._initialize_layers() self.n_outputs = 1 <|end_body_0|> <|body_start_1|> n_channels = self.config['n_channels'] n_classes = self.config['n_classes'] ...
AlexNet model
AlexNet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AlexNet: """AlexNet model""" def __init__(self, config): """Init `config` must contain the following keys: - int n_channels: number of channels of the input - int n_classes: number of classes in the output layer :param config: specifies the configuration for the network :type config:...
stack_v2_sparse_classes_75kplus_train_073216
3,630
no_license
[ { "docstring": "Init `config` must contain the following keys: - int n_channels: number of channels of the input - int n_classes: number of classes in the output layer :param config: specifies the configuration for the network :type config: dict", "name": "__init__", "signature": "def __init__(self, con...
3
stack_v2_sparse_classes_30k_val_000696
Implement the Python class `AlexNet` described below. Class description: AlexNet model Method signatures and docstrings: - def __init__(self, config): Init `config` must contain the following keys: - int n_channels: number of channels of the input - int n_classes: number of classes in the output layer :param config: ...
Implement the Python class `AlexNet` described below. Class description: AlexNet model Method signatures and docstrings: - def __init__(self, config): Init `config` must contain the following keys: - int n_channels: number of channels of the input - int n_classes: number of classes in the output layer :param config: ...
e05b2a15dd2925fca5206c2509e1da29c1806834
<|skeleton|> class AlexNet: """AlexNet model""" def __init__(self, config): """Init `config` must contain the following keys: - int n_channels: number of channels of the input - int n_classes: number of classes in the output layer :param config: specifies the configuration for the network :type config:...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AlexNet: """AlexNet model""" def __init__(self, config): """Init `config` must contain the following keys: - int n_channels: number of channels of the input - int n_classes: number of classes in the output layer :param config: specifies the configuration for the network :type config: dict""" ...
the_stack_v2_python_sparse
dl_playground/networks/pytorch/object_classification/alexnet.py
sallamander/dl-playground
train
5
8a3226e63734299e8f1f1476300cecd239ba6372
[ "def util(root, min_value, max_value):\n if not root:\n return True\n if not min_value < root.val < max_value:\n return False\n return util(root.left, min_value, root.val) and util(root.right, root.val, max_value)\nreturn util(root, float('-inf'), float('inf'))", "def util(root):\n if no...
<|body_start_0|> def util(root, min_value, max_value): if not root: return True if not min_value < root.val < max_value: return False return util(root.left, min_value, root.val) and util(root.right, root.val, max_value) return util(root...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isValidBST(self, root): """:type root: TreeNode :rtype: bool""" <|body_0|> def isValidBST2(self, root): """:type root: TreeNode :rtype: bool""" <|body_1|> def isValidBST3(self, root): """:type root: TreeNode :rtype: bool""" ...
stack_v2_sparse_classes_75kplus_train_073217
2,311
permissive
[ { "docstring": ":type root: TreeNode :rtype: bool", "name": "isValidBST", "signature": "def isValidBST(self, root)" }, { "docstring": ":type root: TreeNode :rtype: bool", "name": "isValidBST2", "signature": "def isValidBST2(self, root)" }, { "docstring": ":type root: TreeNode :rt...
3
stack_v2_sparse_classes_30k_train_020203
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isValidBST(self, root): :type root: TreeNode :rtype: bool - def isValidBST2(self, root): :type root: TreeNode :rtype: bool - def isValidBST3(self, root): :type root: TreeNode...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isValidBST(self, root): :type root: TreeNode :rtype: bool - def isValidBST2(self, root): :type root: TreeNode :rtype: bool - def isValidBST3(self, root): :type root: TreeNode...
aec1ddd0c51b619c1bae1e05f940d9ed587aa82f
<|skeleton|> class Solution: def isValidBST(self, root): """:type root: TreeNode :rtype: bool""" <|body_0|> def isValidBST2(self, root): """:type root: TreeNode :rtype: bool""" <|body_1|> def isValidBST3(self, root): """:type root: TreeNode :rtype: bool""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def isValidBST(self, root): """:type root: TreeNode :rtype: bool""" def util(root, min_value, max_value): if not root: return True if not min_value < root.val < max_value: return False return util(root.left, min_valu...
the_stack_v2_python_sparse
Python/leetcode/ValidateBinarySearchTree.py
darrencheng0817/AlgorithmLearning
train
2
323db1a1fb016da14f5a8490b1aea0604903bc09
[ "Frame.__init__(self)\nself.master.title('Bouncy')\nself.grid()\nself._heightLabel = Label(self, text='Initial height')\nself._heightLabel.grid(row=0, column=0)\nself._heightVar = DoubleVar()\nself._heightEntry = Entry(self, textvariable=self._heightVar)\nself._heightEntry.grid(row=0, column=1)\nself._indexLabel = ...
<|body_start_0|> Frame.__init__(self) self.master.title('Bouncy') self.grid() self._heightLabel = Label(self, text='Initial height') self._heightLabel.grid(row=0, column=0) self._heightVar = DoubleVar() self._heightEntry = Entry(self, textvariable=self._heightVar)...
BouncyGUI
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BouncyGUI: def __init__(self): """Set up the window and widgets.""" <|body_0|> def _computeDistance(self): """Event handler for the Compute button.""" <|body_1|> <|end_skeleton|> <|body_start_0|> Frame.__init__(self) self.master.title('Bounc...
stack_v2_sparse_classes_75kplus_train_073218
2,501
no_license
[ { "docstring": "Set up the window and widgets.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Event handler for the Compute button.", "name": "_computeDistance", "signature": "def _computeDistance(self)" } ]
2
stack_v2_sparse_classes_30k_train_033119
Implement the Python class `BouncyGUI` described below. Class description: Implement the BouncyGUI class. Method signatures and docstrings: - def __init__(self): Set up the window and widgets. - def _computeDistance(self): Event handler for the Compute button.
Implement the Python class `BouncyGUI` described below. Class description: Implement the BouncyGUI class. Method signatures and docstrings: - def __init__(self): Set up the window and widgets. - def _computeDistance(self): Event handler for the Compute button. <|skeleton|> class BouncyGUI: def __init__(self): ...
a955c48d3c7209ed61c08f2e950da1967d730c1d
<|skeleton|> class BouncyGUI: def __init__(self): """Set up the window and widgets.""" <|body_0|> def _computeDistance(self): """Event handler for the Compute button.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BouncyGUI: def __init__(self): """Set up the window and widgets.""" Frame.__init__(self) self.master.title('Bouncy') self.grid() self._heightLabel = Label(self, text='Initial height') self._heightLabel.grid(row=0, column=0) self._heightVar = DoubleVar() ...
the_stack_v2_python_sparse
WA170 - Programming with Python/WA170_exercise_solutions/9781111822705_Solutions_ch09/Ch_09_Projects/9.1/bouncy.py
janesferr/WADD-Courses
train
3
ed62db215e18d4840ea32da6914b316698a53260
[ "saved_model_file = open(pickled_model_path, 'rb')\nsaved_model_obj = pickle.load(saved_model_file)\nself.decision_map = saved_model_obj.get('model')\nself.default_map = saved_model_obj.get('defaults')\nsaved_model_file.close()\nself.frame_delay = delay\nself.screenshot_dir = os.path.join(helper.get_home_folder(), ...
<|body_start_0|> saved_model_file = open(pickled_model_path, 'rb') saved_model_obj = pickle.load(saved_model_file) self.decision_map = saved_model_obj.get('model') self.default_map = saved_model_obj.get('defaults') saved_model_file.close() self.frame_delay = delay ...
Class implementing a basic Mario Kart AI agent using conditional probability.
MarioKartAgent
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MarioKartAgent: """Class implementing a basic Mario Kart AI agent using conditional probability.""" def __init__(self, pickled_model_path, delay=0.2): """Create a MarioKart Agent instance. Args: pickled_model_path: Path to the stored state-decision model file. screenshot_folder: Name...
stack_v2_sparse_classes_75kplus_train_073219
3,976
permissive
[ { "docstring": "Create a MarioKart Agent instance. Args: pickled_model_path: Path to the stored state-decision model file. screenshot_folder: Name of the folder where the current Dolphin game's screenshots are stored.", "name": "__init__", "signature": "def __init__(self, pickled_model_path, delay=0.2)"...
2
stack_v2_sparse_classes_30k_train_031722
Implement the Python class `MarioKartAgent` described below. Class description: Class implementing a basic Mario Kart AI agent using conditional probability. Method signatures and docstrings: - def __init__(self, pickled_model_path, delay=0.2): Create a MarioKart Agent instance. Args: pickled_model_path: Path to the ...
Implement the Python class `MarioKartAgent` described below. Class description: Class implementing a basic Mario Kart AI agent using conditional probability. Method signatures and docstrings: - def __init__(self, pickled_model_path, delay=0.2): Create a MarioKart Agent instance. Args: pickled_model_path: Path to the ...
c8a7d0f84ca39b41ebd3acb3791dd19cd7907264
<|skeleton|> class MarioKartAgent: """Class implementing a basic Mario Kart AI agent using conditional probability.""" def __init__(self, pickled_model_path, delay=0.2): """Create a MarioKart Agent instance. Args: pickled_model_path: Path to the stored state-decision model file. screenshot_folder: Name...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MarioKartAgent: """Class implementing a basic Mario Kart AI agent using conditional probability.""" def __init__(self, pickled_model_path, delay=0.2): """Create a MarioKart Agent instance. Args: pickled_model_path: Path to the stored state-decision model file. screenshot_folder: Name of the folde...
the_stack_v2_python_sparse
src/agents/mk_naive_agent.py
adriendod/dolphin-env-api
train
0
3b8baff861d5b8f24d1eb2d8c265e93fe9bc9376
[ "self.main_view = go.Figure()\nself.main_view.update_layout(margin=dict(l=10, r=10, b=30, t=30), autosize=True)\ngrapher.plot_layers(self.main_view)", "if len(test_data.y) > 0:\n selected_unit = grapher.pre_select_unit(test_data.y[0])\nelse:\n selected_unit = grapher.pre_select_unit(0)\ngraph_config = dict(...
<|body_start_0|> self.main_view = go.Figure() self.main_view.update_layout(margin=dict(l=10, r=10, b=30, t=30), autosize=True) grapher.plot_layers(self.main_view) <|end_body_0|> <|body_start_1|> if len(test_data.y) > 0: selected_unit = grapher.pre_select_unit(test_data.y[0])...
CenterPane
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CenterPane: def render(self, grapher): """Prepare graphical structures before Dash rendering""" <|body_0|> def get_layout(self, model_sequence, grapher, test_data): """Get pane layout""" <|body_1|> def callbacks(self, app, model_sequence: AbstractModelSe...
stack_v2_sparse_classes_75kplus_train_073220
4,537
permissive
[ { "docstring": "Prepare graphical structures before Dash rendering", "name": "render", "signature": "def render(self, grapher)" }, { "docstring": "Get pane layout", "name": "get_layout", "signature": "def get_layout(self, model_sequence, grapher, test_data)" }, { "docstring": "Da...
3
stack_v2_sparse_classes_30k_train_039692
Implement the Python class `CenterPane` described below. Class description: Implement the CenterPane class. Method signatures and docstrings: - def render(self, grapher): Prepare graphical structures before Dash rendering - def get_layout(self, model_sequence, grapher, test_data): Get pane layout - def callbacks(self...
Implement the Python class `CenterPane` described below. Class description: Implement the CenterPane class. Method signatures and docstrings: - def render(self, grapher): Prepare graphical structures before Dash rendering - def get_layout(self, model_sequence, grapher, test_data): Get pane layout - def callbacks(self...
2abb89665d1d99cdb5d8b6d85d0353dc22d226f4
<|skeleton|> class CenterPane: def render(self, grapher): """Prepare graphical structures before Dash rendering""" <|body_0|> def get_layout(self, model_sequence, grapher, test_data): """Get pane layout""" <|body_1|> def callbacks(self, app, model_sequence: AbstractModelSe...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CenterPane: def render(self, grapher): """Prepare graphical structures before Dash rendering""" self.main_view = go.Figure() self.main_view.update_layout(margin=dict(l=10, r=10, b=30, t=30), autosize=True) grapher.plot_layers(self.main_view) def get_layout(self, model_sequ...
the_stack_v2_python_sparse
dnnviewer/panes/center.py
lufeng22/dnnviewer
train
0
a4b67c39b2e2d375b923ec7857b069de0f2d7cd0
[ "new_urls = set()\nlinks = soup.find_all('a', href=re.compile('/view/\\\\d+\\\\.htm'))\nfor link in links:\n new_url = link['href']\n new_full_url = urlparse.urljoin(page_url, new_url)\n new_urls.add(new_full_url)\nreturn new_urls", "res_data = {}\nres_data['url'] = page_url\ntitle_node = soup.find('dd',...
<|body_start_0|> new_urls = set() links = soup.find_all('a', href=re.compile('/view/\\d+\\.htm')) for link in links: new_url = link['href'] new_full_url = urlparse.urljoin(page_url, new_url) new_urls.add(new_full_url) return new_urls <|end_body_0|> <|...
HtmlParser
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HtmlParser: def _get_new_urls(self, page_url, soup): """获取url列表,匹配出页面所有词条的url :param page_url: :param soup: :return:""" <|body_0|> def _get_new_data(self, page_url, soup): """获取数据,解析出了titel与summary两个数据 :param page_url: url地址 :param soup: :return: 返回解析好的数据 url,title,s...
stack_v2_sparse_classes_75kplus_train_073221
2,723
no_license
[ { "docstring": "获取url列表,匹配出页面所有词条的url :param page_url: :param soup: :return:", "name": "_get_new_urls", "signature": "def _get_new_urls(self, page_url, soup)" }, { "docstring": "获取数据,解析出了titel与summary两个数据 :param page_url: url地址 :param soup: :return: 返回解析好的数据 url,title,summary", "name": "_get...
3
stack_v2_sparse_classes_30k_train_018242
Implement the Python class `HtmlParser` described below. Class description: Implement the HtmlParser class. Method signatures and docstrings: - def _get_new_urls(self, page_url, soup): 获取url列表,匹配出页面所有词条的url :param page_url: :param soup: :return: - def _get_new_data(self, page_url, soup): 获取数据,解析出了titel与summary两个数据 :p...
Implement the Python class `HtmlParser` described below. Class description: Implement the HtmlParser class. Method signatures and docstrings: - def _get_new_urls(self, page_url, soup): 获取url列表,匹配出页面所有词条的url :param page_url: :param soup: :return: - def _get_new_data(self, page_url, soup): 获取数据,解析出了titel与summary两个数据 :p...
5273553a10243744905de92f325ee7d4b2fd94bf
<|skeleton|> class HtmlParser: def _get_new_urls(self, page_url, soup): """获取url列表,匹配出页面所有词条的url :param page_url: :param soup: :return:""" <|body_0|> def _get_new_data(self, page_url, soup): """获取数据,解析出了titel与summary两个数据 :param page_url: url地址 :param soup: :return: 返回解析好的数据 url,title,s...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class HtmlParser: def _get_new_urls(self, page_url, soup): """获取url列表,匹配出页面所有词条的url :param page_url: :param soup: :return:""" new_urls = set() links = soup.find_all('a', href=re.compile('/view/\\d+\\.htm')) for link in links: new_url = link['href'] new_full_ur...
the_stack_v2_python_sparse
baike_spider/html_parser.py
linuxhub/python
train
3
a7c6666fc6cb18af06220de88256868eb700a474
[ "try:\n clusters = Cluster.get_all_clusters()\nexcept:\n AppException(exception_message.get('FETCH_CLUSTER_EXCEPTION'))\ncluster_list = []\ndict_keys = ['cluster_id', 'cluster_name', 'cloud_region']\nfor cluster in clusters:\n result_dict = dict(zip(dict_keys, cluster))\n cluster_list.append(result_dict...
<|body_start_0|> try: clusters = Cluster.get_all_clusters() except: AppException(exception_message.get('FETCH_CLUSTER_EXCEPTION')) cluster_list = [] dict_keys = ['cluster_id', 'cluster_name', 'cloud_region'] for cluster in clusters: result_dict...
ClusterService
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClusterService: def get_clusters(): """Fetches all the clusters :return:""" <|body_0|> def create_cluster(input_data): """Creates cluster based on given details :param input_data: :return:""" <|body_1|> def delete_cluster(input_data): """Deletes ...
stack_v2_sparse_classes_75kplus_train_073222
2,159
no_license
[ { "docstring": "Fetches all the clusters :return:", "name": "get_clusters", "signature": "def get_clusters()" }, { "docstring": "Creates cluster based on given details :param input_data: :return:", "name": "create_cluster", "signature": "def create_cluster(input_data)" }, { "docs...
3
null
Implement the Python class `ClusterService` described below. Class description: Implement the ClusterService class. Method signatures and docstrings: - def get_clusters(): Fetches all the clusters :return: - def create_cluster(input_data): Creates cluster based on given details :param input_data: :return: - def delet...
Implement the Python class `ClusterService` described below. Class description: Implement the ClusterService class. Method signatures and docstrings: - def get_clusters(): Fetches all the clusters :return: - def create_cluster(input_data): Creates cluster based on given details :param input_data: :return: - def delet...
a4a452a02a1f1882c9e3f862854746d2fc7f54b6
<|skeleton|> class ClusterService: def get_clusters(): """Fetches all the clusters :return:""" <|body_0|> def create_cluster(input_data): """Creates cluster based on given details :param input_data: :return:""" <|body_1|> def delete_cluster(input_data): """Deletes ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ClusterService: def get_clusters(): """Fetches all the clusters :return:""" try: clusters = Cluster.get_all_clusters() except: AppException(exception_message.get('FETCH_CLUSTER_EXCEPTION')) cluster_list = [] dict_keys = ['cluster_id', 'cluster_na...
the_stack_v2_python_sparse
services/cluster_service.py
himani07/ManageCloud
train
0
c1455c78dc7a1a22b2f2328125a649df0bf37ec8
[ "assert isinstance(orientations, list), 'orientations must be a list'\nself.imsize = IMAGE_SIZE\nself.orientations = orientations\nself.nblocks = nblocks\nself.padding = PIX_PAD\nself.createGabors()\nself.nfeatures = len(self.Gabors) * pow(self.nblocks, 2)", "self.total_size = self.imsize + 2 * self.padding\nself...
<|body_start_0|> assert isinstance(orientations, list), 'orientations must be a list' self.imsize = IMAGE_SIZE self.orientations = orientations self.nblocks = nblocks self.padding = PIX_PAD self.createGabors() self.nfeatures = len(self.Gabors) * pow(self.nblocks, ...
Gist
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Gist: def __init__(self, orientations, nblocks): """Creates an object type Gist Args: orientations: a list of number of orientations at each scale nblocks: number of blocks considered to for a grid and compute the gist Assertions: AssertionError if orientations is not a list""" <...
stack_v2_sparse_classes_75kplus_train_073223
4,223
no_license
[ { "docstring": "Creates an object type Gist Args: orientations: a list of number of orientations at each scale nblocks: number of blocks considered to for a grid and compute the gist Assertions: AssertionError if orientations is not a list", "name": "__init__", "signature": "def __init__(self, orientati...
3
stack_v2_sparse_classes_30k_train_053627
Implement the Python class `Gist` described below. Class description: Implement the Gist class. Method signatures and docstrings: - def __init__(self, orientations, nblocks): Creates an object type Gist Args: orientations: a list of number of orientations at each scale nblocks: number of blocks considered to for a gr...
Implement the Python class `Gist` described below. Class description: Implement the Gist class. Method signatures and docstrings: - def __init__(self, orientations, nblocks): Creates an object type Gist Args: orientations: a list of number of orientations at each scale nblocks: number of blocks considered to for a gr...
2f9c33c4e1a26b3e9e699210ac974047936f49e1
<|skeleton|> class Gist: def __init__(self, orientations, nblocks): """Creates an object type Gist Args: orientations: a list of number of orientations at each scale nblocks: number of blocks considered to for a grid and compute the gist Assertions: AssertionError if orientations is not a list""" <...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Gist: def __init__(self, orientations, nblocks): """Creates an object type Gist Args: orientations: a list of number of orientations at each scale nblocks: number of blocks considered to for a grid and compute the gist Assertions: AssertionError if orientations is not a list""" assert isinstan...
the_stack_v2_python_sparse
vision/utils/gist.py
winkash/image-classification
train
0
d00aba6c37f9bb09f46592d521c1758c3ed33fa7
[ "if arr is None:\n return arr\nn = len(arr)\nif n <= 1:\n return arr\nfor i in range(0, n):\n min_index = i\n j = i + 1\n while j < n:\n if arr[j] < arr[min_index]:\n min_index = j\n j += 1\n arr[i], arr[min_index] = (arr[min_index], arr[i])\nreturn arr", "if arr is None...
<|body_start_0|> if arr is None: return arr n = len(arr) if n <= 1: return arr for i in range(0, n): min_index = i j = i + 1 while j < n: if arr[j] < arr[min_index]: min_index = j ...
SelectionSort
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SelectionSort: def selection_sort_min_version(arr): """Selection sort in selecting-min-element style. Note that selection is the slowest of all the common sorting algorithms. It requires quadratic time even in the best case (i.e., when the array is already sorted). :param arr: List[int],...
stack_v2_sparse_classes_75kplus_train_073224
2,594
permissive
[ { "docstring": "Selection sort in selecting-min-element style. Note that selection is the slowest of all the common sorting algorithms. It requires quadratic time even in the best case (i.e., when the array is already sorted). :param arr: List[int], list to be sorted :return: List[int], sorted list", "name"...
2
stack_v2_sparse_classes_30k_train_009064
Implement the Python class `SelectionSort` described below. Class description: Implement the SelectionSort class. Method signatures and docstrings: - def selection_sort_min_version(arr): Selection sort in selecting-min-element style. Note that selection is the slowest of all the common sorting algorithms. It requires...
Implement the Python class `SelectionSort` described below. Class description: Implement the SelectionSort class. Method signatures and docstrings: - def selection_sort_min_version(arr): Selection sort in selecting-min-element style. Note that selection is the slowest of all the common sorting algorithms. It requires...
8504db89a3f6a1596c0bb7343a4936884b44e6ea
<|skeleton|> class SelectionSort: def selection_sort_min_version(arr): """Selection sort in selecting-min-element style. Note that selection is the slowest of all the common sorting algorithms. It requires quadratic time even in the best case (i.e., when the array is already sorted). :param arr: List[int],...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SelectionSort: def selection_sort_min_version(arr): """Selection sort in selecting-min-element style. Note that selection is the slowest of all the common sorting algorithms. It requires quadratic time even in the best case (i.e., when the array is already sorted). :param arr: List[int], list to be so...
the_stack_v2_python_sparse
sorting/selection_sort.py
fimh/dsa-py
train
2
6729dc202743738c0a7e77cfabd18ed7dc3727c2
[ "self.array = [None for _ in range(size)]\nself.i = 0\nself.total = 0", "if self.array[self.i] is not None:\n self.total -= self.array[self.i]\nself.total += val\nself.array[self.i] = val\nself.i = (self.i + 1) % len(self.array)\ncount = len(self.array)\nif self.array[-1] is None:\n count = self.i\nreturn s...
<|body_start_0|> self.array = [None for _ in range(size)] self.i = 0 self.total = 0 <|end_body_0|> <|body_start_1|> if self.array[self.i] is not None: self.total -= self.array[self.i] self.total += val self.array[self.i] = val self.i = (self.i + 1) % ...
MovingAverage
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MovingAverage: def __init__(self, size): """Initialize your data structure here. :type size: int""" <|body_0|> def next(self, val): """:type val: int :rtype: float""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.array = [None for _ in range(siz...
stack_v2_sparse_classes_75kplus_train_073225
1,359
no_license
[ { "docstring": "Initialize your data structure here. :type size: int", "name": "__init__", "signature": "def __init__(self, size)" }, { "docstring": ":type val: int :rtype: float", "name": "next", "signature": "def next(self, val)" } ]
2
stack_v2_sparse_classes_30k_train_038185
Implement the Python class `MovingAverage` described below. Class description: Implement the MovingAverage class. Method signatures and docstrings: - def __init__(self, size): Initialize your data structure here. :type size: int - def next(self, val): :type val: int :rtype: float
Implement the Python class `MovingAverage` described below. Class description: Implement the MovingAverage class. Method signatures and docstrings: - def __init__(self, size): Initialize your data structure here. :type size: int - def next(self, val): :type val: int :rtype: float <|skeleton|> class MovingAverage: ...
05e0beff0047f0ad399d0b46d625bb8d3459814e
<|skeleton|> class MovingAverage: def __init__(self, size): """Initialize your data structure here. :type size: int""" <|body_0|> def next(self, val): """:type val: int :rtype: float""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MovingAverage: def __init__(self, size): """Initialize your data structure here. :type size: int""" self.array = [None for _ in range(size)] self.i = 0 self.total = 0 def next(self, val): """:type val: int :rtype: float""" if self.array[self.i] is not None:...
the_stack_v2_python_sparse
python_1_to_1000/346_Moving_Average_from_Data_Stream.py
jakehoare/leetcode
train
58
9efd2c2fa03dd092c0269a3975ec56c0777c6684
[ "self._attr_name = name\nself._query = query\nself._attr_native_unit_of_measurement = unit\nself._template = value_template\nself._column_name = column\nself.sessionmaker = sessmaker\nself._attr_extra_state_attributes = {}", "data = None\nself._attr_extra_state_attributes = {}\nsess: scoped_session = self.session...
<|body_start_0|> self._attr_name = name self._query = query self._attr_native_unit_of_measurement = unit self._template = value_template self._column_name = column self.sessionmaker = sessmaker self._attr_extra_state_attributes = {} <|end_body_0|> <|body_start_1|...
Representation of an SQL sensor.
SQLSensor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SQLSensor: """Representation of an SQL sensor.""" def __init__(self, name: str, sessmaker: scoped_session, query: str, column: str, unit: str | None, value_template: Template | None) -> None: """Initialize the SQL sensor.""" <|body_0|> def update(self) -> None: "...
stack_v2_sparse_classes_75kplus_train_073226
5,560
permissive
[ { "docstring": "Initialize the SQL sensor.", "name": "__init__", "signature": "def __init__(self, name: str, sessmaker: scoped_session, query: str, column: str, unit: str | None, value_template: Template | None) -> None" }, { "docstring": "Retrieve sensor data from the query.", "name": "upda...
2
stack_v2_sparse_classes_30k_val_002705
Implement the Python class `SQLSensor` described below. Class description: Representation of an SQL sensor. Method signatures and docstrings: - def __init__(self, name: str, sessmaker: scoped_session, query: str, column: str, unit: str | None, value_template: Template | None) -> None: Initialize the SQL sensor. - def...
Implement the Python class `SQLSensor` described below. Class description: Representation of an SQL sensor. Method signatures and docstrings: - def __init__(self, name: str, sessmaker: scoped_session, query: str, column: str, unit: str | None, value_template: Template | None) -> None: Initialize the SQL sensor. - def...
8f4ec89be6c2505d8a59eee44de335abe308ac9f
<|skeleton|> class SQLSensor: """Representation of an SQL sensor.""" def __init__(self, name: str, sessmaker: scoped_session, query: str, column: str, unit: str | None, value_template: Template | None) -> None: """Initialize the SQL sensor.""" <|body_0|> def update(self) -> None: "...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SQLSensor: """Representation of an SQL sensor.""" def __init__(self, name: str, sessmaker: scoped_session, query: str, column: str, unit: str | None, value_template: Template | None) -> None: """Initialize the SQL sensor.""" self._attr_name = name self._query = query self....
the_stack_v2_python_sparse
homeassistant/components/sql/sensor.py
JeffLIrion/home-assistant
train
5
349b2810c61c313980c76b11eac7aca85f9ad93e
[ "super(InceptionModule, self).__init__()\nself.branch_1 = nn.Sequential(nn.Conv2d(in_planes, n_1x1, kernel_size=1), nn.BatchNorm2d(n_1x1), nn.ReLU(True))\nself.branch_2 = nn.Sequential(nn.Conv2d(in_planes, n_red_3x3, kernel_size=1), nn.BatchNorm2d(n_red_3x3), nn.ReLU(True), nn.Conv2d(n_red_3x3, n_3x3, kernel_size=3...
<|body_start_0|> super(InceptionModule, self).__init__() self.branch_1 = nn.Sequential(nn.Conv2d(in_planes, n_1x1, kernel_size=1), nn.BatchNorm2d(n_1x1), nn.ReLU(True)) self.branch_2 = nn.Sequential(nn.Conv2d(in_planes, n_red_3x3, kernel_size=1), nn.BatchNorm2d(n_red_3x3), nn.ReLU(True), nn.Conv...
Implementation of the Inception Module of GoogLeNet 2014
InceptionModule
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InceptionModule: """Implementation of the Inception Module of GoogLeNet 2014""" def __init__(self, in_planes, n_1x1, n_red_3x3, n_3x3, n_red_5x5, n_5x5, pool_proj): """Initialize the Module with the sizes of the filters used for the convolutions and maxpooling Args: in_planes: number...
stack_v2_sparse_classes_75kplus_train_073227
6,855
no_license
[ { "docstring": "Initialize the Module with the sizes of the filters used for the convolutions and maxpooling Args: in_planes: number of input filters n_1x1: number of filters for the 1x1 conv branch n_red_3x3: number of filters in the reduction layer before the 3x3 conv branch n_3x3 : number of filters for the ...
2
stack_v2_sparse_classes_30k_train_027479
Implement the Python class `InceptionModule` described below. Class description: Implementation of the Inception Module of GoogLeNet 2014 Method signatures and docstrings: - def __init__(self, in_planes, n_1x1, n_red_3x3, n_3x3, n_red_5x5, n_5x5, pool_proj): Initialize the Module with the sizes of the filters used fo...
Implement the Python class `InceptionModule` described below. Class description: Implementation of the Inception Module of GoogLeNet 2014 Method signatures and docstrings: - def __init__(self, in_planes, n_1x1, n_red_3x3, n_3x3, n_red_5x5, n_5x5, pool_proj): Initialize the Module with the sizes of the filters used fo...
aaee82f03c63e2a76f99ce9b69dad09d625a38f7
<|skeleton|> class InceptionModule: """Implementation of the Inception Module of GoogLeNet 2014""" def __init__(self, in_planes, n_1x1, n_red_3x3, n_3x3, n_red_5x5, n_5x5, pool_proj): """Initialize the Module with the sizes of the filters used for the convolutions and maxpooling Args: in_planes: number...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class InceptionModule: """Implementation of the Inception Module of GoogLeNet 2014""" def __init__(self, in_planes, n_1x1, n_red_3x3, n_3x3, n_red_5x5, n_5x5, pool_proj): """Initialize the Module with the sizes of the filters used for the convolutions and maxpooling Args: in_planes: number of input fil...
the_stack_v2_python_sparse
googLeNet.py
DomChey/ORIU_Project
train
0
83985e7afb400526472f3f68a35658cef5c1cafe
[ "self.failfast = failfast\nif stdout is None:\n stdout = sys.stdout\nself.stdout = stdout\nself.tb_locals = tb_locals", "test_ids, _ = list_test(test)\nfor test_id in test_ids:\n self.stdout.write('%s\\n' % test_id)\nerrors = loader.errors\nif errors:\n for test_id in errors:\n self.stdout.write('...
<|body_start_0|> self.failfast = failfast if stdout is None: stdout = sys.stdout self.stdout = stdout self.tb_locals = tb_locals <|end_body_0|> <|body_start_1|> test_ids, _ = list_test(test) for test_id in test_ids: self.stdout.write('%s\n' % test...
A thunk object to support unittest.TestProgram.
TestToolsTestRunner
[ "LicenseRef-scancode-ssleay", "MIT", "BSD-3-Clause", "LicenseRef-scancode-openssl", "LicenseRef-scancode-ssleay-windows", "LicenseRef-scancode-pcre", "LicenseRef-scancode-public-domain", "Zlib", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestToolsTestRunner: """A thunk object to support unittest.TestProgram.""" def __init__(self, verbosity=None, failfast=None, buffer=None, stdout=None, tb_locals=False, **kwargs): """Create a TestToolsTestRunner. :param verbosity: Ignored. :param failfast: Stop running tests at the fi...
stack_v2_sparse_classes_75kplus_train_073228
10,141
permissive
[ { "docstring": "Create a TestToolsTestRunner. :param verbosity: Ignored. :param failfast: Stop running tests at the first failure. :param buffer: Ignored. :param stdout: Stream to use for stdout. :param tb_locals: If True include local variables in tracebacks.", "name": "__init__", "signature": "def __i...
3
stack_v2_sparse_classes_30k_test_002699
Implement the Python class `TestToolsTestRunner` described below. Class description: A thunk object to support unittest.TestProgram. Method signatures and docstrings: - def __init__(self, verbosity=None, failfast=None, buffer=None, stdout=None, tb_locals=False, **kwargs): Create a TestToolsTestRunner. :param verbosit...
Implement the Python class `TestToolsTestRunner` described below. Class description: A thunk object to support unittest.TestProgram. Method signatures and docstrings: - def __init__(self, verbosity=None, failfast=None, buffer=None, stdout=None, tb_locals=False, **kwargs): Create a TestToolsTestRunner. :param verbosit...
bfbb9d7526020eda1788a0ed24f2be3c8be5c1c3
<|skeleton|> class TestToolsTestRunner: """A thunk object to support unittest.TestProgram.""" def __init__(self, verbosity=None, failfast=None, buffer=None, stdout=None, tb_locals=False, **kwargs): """Create a TestToolsTestRunner. :param verbosity: Ignored. :param failfast: Stop running tests at the fi...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestToolsTestRunner: """A thunk object to support unittest.TestProgram.""" def __init__(self, verbosity=None, failfast=None, buffer=None, stdout=None, tb_locals=False, **kwargs): """Create a TestToolsTestRunner. :param verbosity: Ignored. :param failfast: Stop running tests at the first failure. ...
the_stack_v2_python_sparse
openresty-win32-build/thirdparty/x86/pgsql/pgAdmin 4/venv/Lib/site-packages/testtools/run.py
nneesshh/openresty-oss
train
1
d8229174eac98cd51a50c4ce0cf320bb6fa01493
[ "super().__init__(*args, **kwargs)\nself.processor = 'scratch'\nself.pattern = re.compile(ext.processor_info[self.processor]['pattern'])\nself.template = ext.jinja_templates[self.processor]\nself.fenced_compatibility = 'fenced_code_block' in ext.compatibility", "code_elements = []\nfor node in root.iterfind('.//p...
<|body_start_0|> super().__init__(*args, **kwargs) self.processor = 'scratch' self.pattern = re.compile(ext.processor_info[self.processor]['pattern']) self.template = ext.jinja_templates[self.processor] self.fenced_compatibility = 'fenced_code_block' in ext.compatibility <|end_bo...
Searches a Document for codeblocks with the scratch language. These are then processed into the verto result and hashed for another program in the pipeline to retrieve or create into images.
ScratchTreeprocessor
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ScratchTreeprocessor: """Searches a Document for codeblocks with the scratch language. These are then processed into the verto result and hashed for another program in the pipeline to retrieve or create into images.""" def __init__(self, ext, *args, **kwargs): """Args: ext: The paren...
stack_v2_sparse_classes_75kplus_train_073229
3,528
permissive
[ { "docstring": "Args: ext: The parent node of the element tree that children will reside in.", "name": "__init__", "signature": "def __init__(self, ext, *args, **kwargs)" }, { "docstring": "Processes the html tree finding code tags where scratch code is used and replaces with template html. Args...
3
stack_v2_sparse_classes_30k_train_003527
Implement the Python class `ScratchTreeprocessor` described below. Class description: Searches a Document for codeblocks with the scratch language. These are then processed into the verto result and hashed for another program in the pipeline to retrieve or create into images. Method signatures and docstrings: - def _...
Implement the Python class `ScratchTreeprocessor` described below. Class description: Searches a Document for codeblocks with the scratch language. These are then processed into the verto result and hashed for another program in the pipeline to retrieve or create into images. Method signatures and docstrings: - def _...
bfce624d59968767c07ee805352dceae3a543bd1
<|skeleton|> class ScratchTreeprocessor: """Searches a Document for codeblocks with the scratch language. These are then processed into the verto result and hashed for another program in the pipeline to retrieve or create into images.""" def __init__(self, ext, *args, **kwargs): """Args: ext: The paren...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ScratchTreeprocessor: """Searches a Document for codeblocks with the scratch language. These are then processed into the verto result and hashed for another program in the pipeline to retrieve or create into images.""" def __init__(self, ext, *args, **kwargs): """Args: ext: The parent node of the...
the_stack_v2_python_sparse
verto/processors/ScratchTreeprocessor.py
uccser/verto
train
4
f81919377c16ac3cbb9dbfebac0f38f35dffb9ee
[ "super().__init__(filterFineData, universeSettings, securityInitializer)\nself.numberOfSymbolsCoarse = 1000\nself.numberOfSymbolsFine = 25\nself.dollarVolumeBySymbol = {}\nself.lastMonth = -1", "if algorithm.Time.month == self.lastMonth:\n return Universe.Unchanged\nsortedByDollarVolume = sorted([x for x in co...
<|body_start_0|> super().__init__(filterFineData, universeSettings, securityInitializer) self.numberOfSymbolsCoarse = 1000 self.numberOfSymbolsFine = 25 self.dollarVolumeBySymbol = {} self.lastMonth = -1 <|end_body_0|> <|body_start_1|> if algorithm.Time.month == self.las...
Defines the QC500 universe as a universe selection model for framework algorithm For details: https://github.com/QuantConnect/Lean/pull/1663
QC500UniverseSelectionModel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QC500UniverseSelectionModel: """Defines the QC500 universe as a universe selection model for framework algorithm For details: https://github.com/QuantConnect/Lean/pull/1663""" def __init__(self, filterFineData=True, universeSettings=None, securityInitializer=None): """Initializes a n...
stack_v2_sparse_classes_75kplus_train_073230
3,930
no_license
[ { "docstring": "Initializes a new default instance of the QC500UniverseSelectionModel", "name": "__init__", "signature": "def __init__(self, filterFineData=True, universeSettings=None, securityInitializer=None)" }, { "docstring": "Performs coarse selection for the QC500 constituents. The stocks ...
3
null
Implement the Python class `QC500UniverseSelectionModel` described below. Class description: Defines the QC500 universe as a universe selection model for framework algorithm For details: https://github.com/QuantConnect/Lean/pull/1663 Method signatures and docstrings: - def __init__(self, filterFineData=True, universe...
Implement the Python class `QC500UniverseSelectionModel` described below. Class description: Defines the QC500 universe as a universe selection model for framework algorithm For details: https://github.com/QuantConnect/Lean/pull/1663 Method signatures and docstrings: - def __init__(self, filterFineData=True, universe...
be8593c516afcb52a5ba0bc8b84b7fa61fd53f33
<|skeleton|> class QC500UniverseSelectionModel: """Defines the QC500 universe as a universe selection model for framework algorithm For details: https://github.com/QuantConnect/Lean/pull/1663""" def __init__(self, filterFineData=True, universeSettings=None, securityInitializer=None): """Initializes a n...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class QC500UniverseSelectionModel: """Defines the QC500 universe as a universe selection model for framework algorithm For details: https://github.com/QuantConnect/Lean/pull/1663""" def __init__(self, filterFineData=True, universeSettings=None, securityInitializer=None): """Initializes a new default in...
the_stack_v2_python_sparse
Framework_Algorithms/Universe/QC500.py
UIC-QTC/Trading-Algorithms
train
4
16bc8ecb17588632994166b86d86fe43af14e912
[ "with self.settings(FEATURES={'MITXONLINE_LOGIN': True}):\n coupon = CouponFactory.create(program=True)\n next_url = f'/dashboard/?coupon={coupon.coupon_code}'\n response = self.client.get(f\"{reverse('signin')}?{urlencode({'next': next_url})}\")\n redirect_params = urlencode({'next': next_url, 'program...
<|body_start_0|> with self.settings(FEATURES={'MITXONLINE_LOGIN': True}): coupon = CouponFactory.create(program=True) next_url = f'/dashboard/?coupon={coupon.coupon_code}' response = self.client.get(f"{reverse('signin')}?{urlencode({'next': next_url})}") redirect_...
Tests for the sign in page
TestSignIn
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestSignIn: """Tests for the sign in page""" def test_login_program_coupon_redirect(self): """Test that the login page redirects if the next url has a coupon for a program""" <|body_0|> def test_login_course_coupon_redirect(self): """Test that the login page redi...
stack_v2_sparse_classes_75kplus_train_073231
36,848
permissive
[ { "docstring": "Test that the login page redirects if the next url has a coupon for a program", "name": "test_login_program_coupon_redirect", "signature": "def test_login_program_coupon_redirect(self)" }, { "docstring": "Test that the login page redirects if the next url has a coupon for a cours...
2
stack_v2_sparse_classes_30k_train_023583
Implement the Python class `TestSignIn` described below. Class description: Tests for the sign in page Method signatures and docstrings: - def test_login_program_coupon_redirect(self): Test that the login page redirects if the next url has a coupon for a program - def test_login_course_coupon_redirect(self): Test tha...
Implement the Python class `TestSignIn` described below. Class description: Tests for the sign in page Method signatures and docstrings: - def test_login_program_coupon_redirect(self): Test that the login page redirects if the next url has a coupon for a program - def test_login_course_coupon_redirect(self): Test tha...
d6564caca0b7bbfd31e67a751564107fd17d6eb0
<|skeleton|> class TestSignIn: """Tests for the sign in page""" def test_login_program_coupon_redirect(self): """Test that the login page redirects if the next url has a coupon for a program""" <|body_0|> def test_login_course_coupon_redirect(self): """Test that the login page redi...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestSignIn: """Tests for the sign in page""" def test_login_program_coupon_redirect(self): """Test that the login page redirects if the next url has a coupon for a program""" with self.settings(FEATURES={'MITXONLINE_LOGIN': True}): coupon = CouponFactory.create(program=True) ...
the_stack_v2_python_sparse
ui/views_test.py
mitodl/micromasters
train
35
67571e2fa6ba6caefc0c4cc2421cf831dbd42d09
[ "super(BatchCube2, self).__init__()\nself.perturbations = None\n' (torch.autograd.Variable) Perturbation of attack. '\nself.max_iterations = None\n' (int) Maximum number of iterations. '\nself.probability = None\n' (float) Probability. '\nself.epsilon = None\n' (float) Epsilon. '\nself.projection = None\n' (attacks...
<|body_start_0|> super(BatchCube2, self).__init__() self.perturbations = None ' (torch.autograd.Variable) Perturbation of attack. ' self.max_iterations = None ' (int) Maximum number of iterations. ' self.probability = None ' (float) Probability. ' self.eps...
Random sampling.
BatchCube2
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BatchCube2: """Random sampling.""" def __init__(self): """Constructor.""" <|body_0|> def run(self, model, images, objective, writer=common.summary.SummaryWriter(), prefix=''): """Run attack. :param model: model to attack :type model: torch.nn.Module :param images...
stack_v2_sparse_classes_75kplus_train_073232
16,294
no_license
[ { "docstring": "Constructor.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Run attack. :param model: model to attack :type model: torch.nn.Module :param images: images :type images: torch.autograd.Variable :param objective: objective :type objective: UntargetedObject...
2
null
Implement the Python class `BatchCube2` described below. Class description: Random sampling. Method signatures and docstrings: - def __init__(self): Constructor. - def run(self, model, images, objective, writer=common.summary.SummaryWriter(), prefix=''): Run attack. :param model: model to attack :type model: torch.nn...
Implement the Python class `BatchCube2` described below. Class description: Random sampling. Method signatures and docstrings: - def __init__(self): Constructor. - def run(self, model, images, objective, writer=common.summary.SummaryWriter(), prefix=''): Run attack. :param model: model to attack :type model: torch.nn...
1997c4cc7c6cdc11bf9a0ced50fa1ed91ff8dcec
<|skeleton|> class BatchCube2: """Random sampling.""" def __init__(self): """Constructor.""" <|body_0|> def run(self, model, images, objective, writer=common.summary.SummaryWriter(), prefix=''): """Run attack. :param model: model to attack :type model: torch.nn.Module :param images...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BatchCube2: """Random sampling.""" def __init__(self): """Constructor.""" super(BatchCube2, self).__init__() self.perturbations = None ' (torch.autograd.Variable) Perturbation of attack. ' self.max_iterations = None ' (int) Maximum number of iterations. ' ...
the_stack_v2_python_sparse
attacks/batch_cube2.py
Scintillare/confidence-calibrated-adversarial-training
train
0
08dbdbabc7f3d86e78704da64e02ddd164c4e4bb
[ "illiness = self.env['zakat.illness'].search([])\nfor illi in illiness:\n if illi.sector_id.id in self.ids:\n raise exceptions.ValidationError(_('Diagnosis Sector Cannot Be Removed'))\nreturn super(ZakatDiagnosticSectors, self).unlink()", "num_pattern = re.compile('\\\\d', re.I | re.M)\nwhite_space = re...
<|body_start_0|> illiness = self.env['zakat.illness'].search([]) for illi in illiness: if illi.sector_id.id in self.ids: raise exceptions.ValidationError(_('Diagnosis Sector Cannot Be Removed')) return super(ZakatDiagnosticSectors, self).unlink() <|end_body_0|> <|bod...
ZakatDiagnosticSectors
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ZakatDiagnosticSectors: def unlink(self): """If sector hase an Illness should not be removed :raise exception""" <|body_0|> def fields_check(self): """Check if name field contain an invalid value :raise exception""" <|body_1|> <|end_skeleton|> <|body_start_...
stack_v2_sparse_classes_75kplus_train_073233
47,323
no_license
[ { "docstring": "If sector hase an Illness should not be removed :raise exception", "name": "unlink", "signature": "def unlink(self)" }, { "docstring": "Check if name field contain an invalid value :raise exception", "name": "fields_check", "signature": "def fields_check(self)" } ]
2
stack_v2_sparse_classes_30k_train_026188
Implement the Python class `ZakatDiagnosticSectors` described below. Class description: Implement the ZakatDiagnosticSectors class. Method signatures and docstrings: - def unlink(self): If sector hase an Illness should not be removed :raise exception - def fields_check(self): Check if name field contain an invalid va...
Implement the Python class `ZakatDiagnosticSectors` described below. Class description: Implement the ZakatDiagnosticSectors class. Method signatures and docstrings: - def unlink(self): If sector hase an Illness should not be removed :raise exception - def fields_check(self): Check if name field contain an invalid va...
0b997095c260d58b026440967fea3a202bef7efb
<|skeleton|> class ZakatDiagnosticSectors: def unlink(self): """If sector hase an Illness should not be removed :raise exception""" <|body_0|> def fields_check(self): """Check if name field contain an invalid value :raise exception""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ZakatDiagnosticSectors: def unlink(self): """If sector hase an Illness should not be removed :raise exception""" illiness = self.env['zakat.illness'].search([]) for illi in illiness: if illi.sector_id.id in self.ids: raise exceptions.ValidationError(_('Diagn...
the_stack_v2_python_sparse
v_11/zakat-project/branches/dzc_1/models/dzc_1_config.py
musabahmed/baba
train
0
57fe1ef3247ddcbbd3274545bc56ae87e89f04fd
[ "super().validate(data)\nhandle_invalid_fields(self, data)\nreturn data", "dh = DateHelper()\nif value >= materialized_view_month_start(dh).date() and value <= dh.today.date():\n return value\nerror = 'Parameter start_date must be from {} to {}'.format(dh.last_month_start.date(), dh.today.date())\nraise serial...
<|body_start_0|> super().validate(data) handle_invalid_fields(self, data) return data <|end_body_0|> <|body_start_1|> dh = DateHelper() if value >= materialized_view_month_start(dh).date() and value <= dh.today.date(): return value error = 'Parameter start_da...
Serializer for handling query parameters.
TagsQueryParamSerializer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TagsQueryParamSerializer: """Serializer for handling query parameters.""" def validate(self, data): """Validate incoming data. Args: data (Dict): data to be validated Returns: (Dict): Validated data Raises: (ValidationError): if field inputs are invalid""" <|body_0|> def...
stack_v2_sparse_classes_75kplus_train_073234
11,000
permissive
[ { "docstring": "Validate incoming data. Args: data (Dict): data to be validated Returns: (Dict): Validated data Raises: (ValidationError): if field inputs are invalid", "name": "validate", "signature": "def validate(self, data)" }, { "docstring": "Validate that the start_date is within the expec...
3
stack_v2_sparse_classes_30k_train_014927
Implement the Python class `TagsQueryParamSerializer` described below. Class description: Serializer for handling query parameters. Method signatures and docstrings: - def validate(self, data): Validate incoming data. Args: data (Dict): data to be validated Returns: (Dict): Validated data Raises: (ValidationError): i...
Implement the Python class `TagsQueryParamSerializer` described below. Class description: Serializer for handling query parameters. Method signatures and docstrings: - def validate(self, data): Validate incoming data. Args: data (Dict): data to be validated Returns: (Dict): Validated data Raises: (ValidationError): i...
2979f03fbdd1c20c3abc365a963a1282b426f321
<|skeleton|> class TagsQueryParamSerializer: """Serializer for handling query parameters.""" def validate(self, data): """Validate incoming data. Args: data (Dict): data to be validated Returns: (Dict): Validated data Raises: (ValidationError): if field inputs are invalid""" <|body_0|> def...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TagsQueryParamSerializer: """Serializer for handling query parameters.""" def validate(self, data): """Validate incoming data. Args: data (Dict): data to be validated Returns: (Dict): Validated data Raises: (ValidationError): if field inputs are invalid""" super().validate(data) h...
the_stack_v2_python_sparse
koku/api/tags/serializers.py
luisfdez/koku
train
0
e6e967b2cb19512e9bcb4534981ed707ed7a4d28
[ "try:\n p = models.Player.objects.filter(avatar__name__iexact=username, enabled=True)[:1]\n if not p:\n log.error('Django auth failed.')\n return None\n p = p[0]\n if p.crypt != crypt.crypt(password, p.crypt[0:2]):\n return None\n log.info('%s logged in' % p.avatar)\n return p...
<|body_start_0|> try: p = models.Player.objects.filter(avatar__name__iexact=username, enabled=True)[:1] if not p: log.error('Django auth failed.') return None p = p[0] if p.crypt != crypt.crypt(password, p.crypt[0:2]): ...
Authenticate against the antioch object database.
AntiochObjectBackend
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AntiochObjectBackend: """Authenticate against the antioch object database.""" def authenticate(self, request, username=None, password=None): """Attempt to authenticate the provided request with the given credentials.""" <|body_0|> def get_user(self, user_id): """...
stack_v2_sparse_classes_75kplus_train_073235
2,332
permissive
[ { "docstring": "Attempt to authenticate the provided request with the given credentials.", "name": "authenticate", "signature": "def authenticate(self, request, username=None, password=None)" }, { "docstring": "Return the user object represented by user_id", "name": "get_user", "signatur...
2
stack_v2_sparse_classes_30k_train_047843
Implement the Python class `AntiochObjectBackend` described below. Class description: Authenticate against the antioch object database. Method signatures and docstrings: - def authenticate(self, request, username=None, password=None): Attempt to authenticate the provided request with the given credentials. - def get_...
Implement the Python class `AntiochObjectBackend` described below. Class description: Authenticate against the antioch object database. Method signatures and docstrings: - def authenticate(self, request, username=None, password=None): Attempt to authenticate the provided request with the given credentials. - def get_...
7fe27c961ae81b7655c6428038c85eefad27e980
<|skeleton|> class AntiochObjectBackend: """Authenticate against the antioch object database.""" def authenticate(self, request, username=None, password=None): """Attempt to authenticate the provided request with the given credentials.""" <|body_0|> def get_user(self, user_id): """...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AntiochObjectBackend: """Authenticate against the antioch object database.""" def authenticate(self, request, username=None, password=None): """Attempt to authenticate the provided request with the given credentials.""" try: p = models.Player.objects.filter(avatar__name__iexac...
the_stack_v2_python_sparse
antioch/core/auth.py
philchristensen/antioch
train
18
a5e7513bf28b8d0c2626a9266c6ce470987f85c9
[ "if padding == 'VALID':\n return input_data\nrow = np.zeros(input_data.shape[0])\nfor row_index in range(pad_add_number[1]):\n input_data = np.insert(input_data, 0, values=row, axis=1)\n input_data = np.insert(input_data, input_data.shape[1], values=row, axis=1)\ncol = np.zeros(input_data.shape[1])\nfor co...
<|body_start_0|> if padding == 'VALID': return input_data row = np.zeros(input_data.shape[0]) for row_index in range(pad_add_number[1]): input_data = np.insert(input_data, 0, values=row, axis=1) input_data = np.insert(input_data, input_data.shape[1], values=ro...
Padding2D
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Padding2D: def padding_matrix(input_data, filter_size, pad_add_number, padding='SAME'): """padding matrix data Padding the specific input matrix with the specific padding pattern Parameters ---------- input_data : {array-like, matrix} of shape (in_data_col, in_data_row) filter_size : {tu...
stack_v2_sparse_classes_75kplus_train_073236
3,282
permissive
[ { "docstring": "padding matrix data Padding the specific input matrix with the specific padding pattern Parameters ---------- input_data : {array-like, matrix} of shape (in_data_col, in_data_row) filter_size : {tuple-like, vector_2} of shape (filter_height, filter_wide) pad_add_number : {tuple-like, vector_2} o...
2
stack_v2_sparse_classes_30k_train_051502
Implement the Python class `Padding2D` described below. Class description: Implement the Padding2D class. Method signatures and docstrings: - def padding_matrix(input_data, filter_size, pad_add_number, padding='SAME'): padding matrix data Padding the specific input matrix with the specific padding pattern Parameters ...
Implement the Python class `Padding2D` described below. Class description: Implement the Padding2D class. Method signatures and docstrings: - def padding_matrix(input_data, filter_size, pad_add_number, padding='SAME'): padding matrix data Padding the specific input matrix with the specific padding pattern Parameters ...
6b2766a72ab9f4814d6f9e69080dc39e23a0000d
<|skeleton|> class Padding2D: def padding_matrix(input_data, filter_size, pad_add_number, padding='SAME'): """padding matrix data Padding the specific input matrix with the specific padding pattern Parameters ---------- input_data : {array-like, matrix} of shape (in_data_col, in_data_row) filter_size : {tu...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Padding2D: def padding_matrix(input_data, filter_size, pad_add_number, padding='SAME'): """padding matrix data Padding the specific input matrix with the specific padding pattern Parameters ---------- input_data : {array-like, matrix} of shape (in_data_col, in_data_row) filter_size : {tuple-like, vect...
the_stack_v2_python_sparse
13_CNN/Code/padding.py
jaheel/Machine-Learning-Method_Code
train
3
41a1c1881303d0428174cc6def4c8f2c933de978
[ "for i, num1 in enumerate(nums):\n for j, num2 in enumerate(nums[i + 1:]):\n if num1 + num2 == target:\n return [i, j + i + 1]", "d = {}\nfor i, num in enumerate(nums):\n d[num] = i\nfor i, num in enumerate(nums):\n n = target - num\n if n in d and i is not d[n]:\n return [i, ...
<|body_start_0|> for i, num1 in enumerate(nums): for j, num2 in enumerate(nums[i + 1:]): if num1 + num2 == target: return [i, j + i + 1] <|end_body_0|> <|body_start_1|> d = {} for i, num in enumerate(nums): d[num] = i for i, nu...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def twoSum_1(self, nums, target): """Brute Force :type nums: List[int] :type target: int :rtype: List[int]""" <|body_0|> def twoSum_2(self, nums, target): """Two-pass Hash Table :type nums: List[int] :type target: int :rtype: List[int]""" <|body_1|>...
stack_v2_sparse_classes_75kplus_train_073237
1,556
no_license
[ { "docstring": "Brute Force :type nums: List[int] :type target: int :rtype: List[int]", "name": "twoSum_1", "signature": "def twoSum_1(self, nums, target)" }, { "docstring": "Two-pass Hash Table :type nums: List[int] :type target: int :rtype: List[int]", "name": "twoSum_2", "signature": ...
4
stack_v2_sparse_classes_30k_train_036739
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def twoSum_1(self, nums, target): Brute Force :type nums: List[int] :type target: int :rtype: List[int] - def twoSum_2(self, nums, target): Two-pass Hash Table :type nums: List[i...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def twoSum_1(self, nums, target): Brute Force :type nums: List[int] :type target: int :rtype: List[int] - def twoSum_2(self, nums, target): Two-pass Hash Table :type nums: List[i...
3ac66a1bf85a344234c746ebf3de30e643838e5f
<|skeleton|> class Solution: def twoSum_1(self, nums, target): """Brute Force :type nums: List[int] :type target: int :rtype: List[int]""" <|body_0|> def twoSum_2(self, nums, target): """Two-pass Hash Table :type nums: List[int] :type target: int :rtype: List[int]""" <|body_1|>...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def twoSum_1(self, nums, target): """Brute Force :type nums: List[int] :type target: int :rtype: List[int]""" for i, num1 in enumerate(nums): for j, num2 in enumerate(nums[i + 1:]): if num1 + num2 == target: return [i, j + i + 1] d...
the_stack_v2_python_sparse
1. Two Sum/1.py
JohnHuiWB/leetcode
train
0
119936d66be3ec60a1021821b97d508930512212
[ "super(PyTorchModel, self).__init__()\nself.linear1 = nn.Linear(D_in, H)\nself.linear2 = nn.Linear(H, D_out)", "h_relu = self.linear1(x).clamp(min=0)\ny_pred = self.linear2(h_relu)\nreturn y_pred" ]
<|body_start_0|> super(PyTorchModel, self).__init__() self.linear1 = nn.Linear(D_in, H) self.linear2 = nn.Linear(H, D_out) <|end_body_0|> <|body_start_1|> h_relu = self.linear1(x).clamp(min=0) y_pred = self.linear2(h_relu) return y_pred <|end_body_1|>
PyTorchModel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PyTorchModel: def __init__(self, D_in, H, D_out): """In the constructor we instantiate two nn.Linear modules and assign them as member variables.""" <|body_0|> def forward(self, x): """In the forward function we accept a Tensor of input data""" <|body_1|> <|...
stack_v2_sparse_classes_75kplus_train_073238
11,357
no_license
[ { "docstring": "In the constructor we instantiate two nn.Linear modules and assign them as member variables.", "name": "__init__", "signature": "def __init__(self, D_in, H, D_out)" }, { "docstring": "In the forward function we accept a Tensor of input data", "name": "forward", "signature...
2
stack_v2_sparse_classes_30k_train_049290
Implement the Python class `PyTorchModel` described below. Class description: Implement the PyTorchModel class. Method signatures and docstrings: - def __init__(self, D_in, H, D_out): In the constructor we instantiate two nn.Linear modules and assign them as member variables. - def forward(self, x): In the forward fu...
Implement the Python class `PyTorchModel` described below. Class description: Implement the PyTorchModel class. Method signatures and docstrings: - def __init__(self, D_in, H, D_out): In the constructor we instantiate two nn.Linear modules and assign them as member variables. - def forward(self, x): In the forward fu...
7e55a422588c1d1e00f35a3d3a3ff896cce59e18
<|skeleton|> class PyTorchModel: def __init__(self, D_in, H, D_out): """In the constructor we instantiate two nn.Linear modules and assign them as member variables.""" <|body_0|> def forward(self, x): """In the forward function we accept a Tensor of input data""" <|body_1|> <|...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PyTorchModel: def __init__(self, D_in, H, D_out): """In the constructor we instantiate two nn.Linear modules and assign them as member variables.""" super(PyTorchModel, self).__init__() self.linear1 = nn.Linear(D_in, H) self.linear2 = nn.Linear(H, D_out) def forward(self, ...
the_stack_v2_python_sparse
generated/test_bentoml_BentoML.py
jansel/pytorch-jit-paritybench
train
35
c55c5029ae1f27829a4a25ae194fa50520fdfd25
[ "if self.action in ('create', 'partial_update'):\n return ResponseWriteableSerializer\nreturn super().get_serializer_class()", "children_belonging_to_user = Child.objects.filter(user__id=self.request.user.id)\nif 'study_uuid' in self.kwargs:\n study_uuid = self.kwargs['study_uuid']\n study = get_object_o...
<|body_start_0|> if self.action in ('create', 'partial_update'): return ResponseWriteableSerializer return super().get_serializer_class() <|end_body_0|> <|body_start_1|> children_belonging_to_user = Child.objects.filter(user__id=self.request.user.id) if 'study_uuid' in self....
Allows viewing a list of responses, retrieving a response, creating a response, or updating a response. You can view responses to studies that you have permission to view, or responses by your own children.
ResponseViewSet
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResponseViewSet: """Allows viewing a list of responses, retrieving a response, creating a response, or updating a response. You can view responses to studies that you have permission to view, or responses by your own children.""" def get_serializer_class(self): """Return a different ...
stack_v2_sparse_classes_75kplus_train_073239
18,786
permissive
[ { "docstring": "Return a different serializer for create views", "name": "get_serializer_class", "signature": "def get_serializer_class(self)" }, { "docstring": "Overrides queryset. The overall idea is that we want to limit the responses one can retrieve through the API to two cases: 1) A user i...
2
stack_v2_sparse_classes_30k_train_042714
Implement the Python class `ResponseViewSet` described below. Class description: Allows viewing a list of responses, retrieving a response, creating a response, or updating a response. You can view responses to studies that you have permission to view, or responses by your own children. Method signatures and docstrin...
Implement the Python class `ResponseViewSet` described below. Class description: Allows viewing a list of responses, retrieving a response, creating a response, or updating a response. You can view responses to studies that you have permission to view, or responses by your own children. Method signatures and docstrin...
053714ecfbceeb2f27f73ebee3ae890726874693
<|skeleton|> class ResponseViewSet: """Allows viewing a list of responses, retrieving a response, creating a response, or updating a response. You can view responses to studies that you have permission to view, or responses by your own children.""" def get_serializer_class(self): """Return a different ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ResponseViewSet: """Allows viewing a list of responses, retrieving a response, creating a response, or updating a response. You can view responses to studies that you have permission to view, or responses by your own children.""" def get_serializer_class(self): """Return a different serializer fo...
the_stack_v2_python_sparse
api/views.py
lookit/lookit-api
train
12
9d5a4fbec550c064962294f0554ae2bb67f32496
[ "boolean = z <= 0\nz[boolean] = 0\nreturn z", "boolean = z > 0\nz[boolean] = 1\nz[~boolean] = 0\nreturn z" ]
<|body_start_0|> boolean = z <= 0 z[boolean] = 0 return z <|end_body_0|> <|body_start_1|> boolean = z > 0 z[boolean] = 1 z[~boolean] = 0 return z <|end_body_1|>
Computes the ReLU activation function and its derivative.
RELU
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RELU: """Computes the ReLU activation function and its derivative.""" def __call__(self, z): """Applies the ReLU activation function. Keyword arguments: z -- input data Return value: z -- output data from ReLU function""" <|body_0|> def deriv(self, z): """Compute...
stack_v2_sparse_classes_75kplus_train_073240
3,822
no_license
[ { "docstring": "Applies the ReLU activation function. Keyword arguments: z -- input data Return value: z -- output data from ReLU function", "name": "__call__", "signature": "def __call__(self, z)" }, { "docstring": "Computes the derivative of the ReLU function. Keyword arguments: z -- input dat...
2
stack_v2_sparse_classes_30k_train_031775
Implement the Python class `RELU` described below. Class description: Computes the ReLU activation function and its derivative. Method signatures and docstrings: - def __call__(self, z): Applies the ReLU activation function. Keyword arguments: z -- input data Return value: z -- output data from ReLU function - def de...
Implement the Python class `RELU` described below. Class description: Computes the ReLU activation function and its derivative. Method signatures and docstrings: - def __call__(self, z): Applies the ReLU activation function. Keyword arguments: z -- input data Return value: z -- output data from ReLU function - def de...
f9fbe289ebe1e90dddf288a6e713cabc8d02b1f0
<|skeleton|> class RELU: """Computes the ReLU activation function and its derivative.""" def __call__(self, z): """Applies the ReLU activation function. Keyword arguments: z -- input data Return value: z -- output data from ReLU function""" <|body_0|> def deriv(self, z): """Compute...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RELU: """Computes the ReLU activation function and its derivative.""" def __call__(self, z): """Applies the ReLU activation function. Keyword arguments: z -- input data Return value: z -- output data from ReLU function""" boolean = z <= 0 z[boolean] = 0 return z def d...
the_stack_v2_python_sparse
Project2/source/activation.py
elinfi/FYS-STK4155
train
1
a94352b76efb0c58cdac5c58685aa8a65e341bc3
[ "if not root:\n return 0\nreturn 1 + max(self.maxDepth(root.left), self.maxDepth(root.right))", "if not root:\n return 0\nreturn 1 + max(self.maxDepth(root.left), self.maxDepth(root.right))" ]
<|body_start_0|> if not root: return 0 return 1 + max(self.maxDepth(root.left), self.maxDepth(root.right)) <|end_body_0|> <|body_start_1|> if not root: return 0 return 1 + max(self.maxDepth(root.left), self.maxDepth(root.right)) <|end_body_1|>
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxDepth(self, root): """:type root: TreeNode :rtype: int 递归""" <|body_0|> def maxDepth1(self, root): """:type root: TreeNode :rtype: int 非递归 没想出来。。。。。。。。。。。。""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not root: ret...
stack_v2_sparse_classes_75kplus_train_073241
1,026
no_license
[ { "docstring": ":type root: TreeNode :rtype: int 递归", "name": "maxDepth", "signature": "def maxDepth(self, root)" }, { "docstring": ":type root: TreeNode :rtype: int 非递归 没想出来。。。。。。。。。。。。", "name": "maxDepth1", "signature": "def maxDepth1(self, root)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxDepth(self, root): :type root: TreeNode :rtype: int 递归 - def maxDepth1(self, root): :type root: TreeNode :rtype: int 非递归 没想出来。。。。。。。。。。。。
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxDepth(self, root): :type root: TreeNode :rtype: int 递归 - def maxDepth1(self, root): :type root: TreeNode :rtype: int 非递归 没想出来。。。。。。。。。。。。 <|skeleton|> class Solution: ...
069bb0b751ef7f469036b9897436eb5d138ffa24
<|skeleton|> class Solution: def maxDepth(self, root): """:type root: TreeNode :rtype: int 递归""" <|body_0|> def maxDepth1(self, root): """:type root: TreeNode :rtype: int 非递归 没想出来。。。。。。。。。。。。""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def maxDepth(self, root): """:type root: TreeNode :rtype: int 递归""" if not root: return 0 return 1 + max(self.maxDepth(root.left), self.maxDepth(root.right)) def maxDepth1(self, root): """:type root: TreeNode :rtype: int 非递归 没想出来。。。。。。。。。。。。""" ...
the_stack_v2_python_sparse
算法/二叉树/二叉树最大深度.py
RichieSong/algorithm
train
0
7fbb463e4bb3a49eae4d633c246a094666ce1add
[ "self.product_code = product_code\nself.description = description\nself.market_price = market_price\nself.rental_price = rental_price", "output_dict = {}\noutput_dict['productCode'] = self.product_code\noutput_dict['description'] = self.description\noutput_dict['marketPrice'] = self.market_price\noutput_dict['ren...
<|body_start_0|> self.product_code = product_code self.description = description self.market_price = market_price self.rental_price = rental_price <|end_body_0|> <|body_start_1|> output_dict = {} output_dict['productCode'] = self.product_code output_dict['descrip...
Invetory class definiton
Inventory
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Inventory: """Invetory class definiton""" def __init__(self, product_code, description, market_price, rental_price): """:param product_code: :type product_code: :param description: :type description: :param market_price: :type market_price: :param rental_price: :type rental_price:"""...
stack_v2_sparse_classes_75kplus_train_073242
1,035
no_license
[ { "docstring": ":param product_code: :type product_code: :param description: :type description: :param market_price: :type market_price: :param rental_price: :type rental_price:", "name": "__init__", "signature": "def __init__(self, product_code, description, market_price, rental_price)" }, { "d...
2
stack_v2_sparse_classes_30k_train_038200
Implement the Python class `Inventory` described below. Class description: Invetory class definiton Method signatures and docstrings: - def __init__(self, product_code, description, market_price, rental_price): :param product_code: :type product_code: :param description: :type description: :param market_price: :type ...
Implement the Python class `Inventory` described below. Class description: Invetory class definiton Method signatures and docstrings: - def __init__(self, product_code, description, market_price, rental_price): :param product_code: :type product_code: :param description: :type description: :param market_price: :type ...
5dac60f39e3909ff05b26721d602ed20f14d6be3
<|skeleton|> class Inventory: """Invetory class definiton""" def __init__(self, product_code, description, market_price, rental_price): """:param product_code: :type product_code: :param description: :type description: :param market_price: :type market_price: :param rental_price: :type rental_price:"""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Inventory: """Invetory class definiton""" def __init__(self, product_code, description, market_price, rental_price): """:param product_code: :type product_code: :param description: :type description: :param market_price: :type market_price: :param rental_price: :type rental_price:""" self...
the_stack_v2_python_sparse
students/vmedina/lesson_01/inventory_management/inventory_class.py
JavaRod/SP_Python220B_2019
train
1
ee6475f54db8beec0ada304b22068b11ad606c88
[ "if ui_test_task_id == '':\n return response_failed({'status': 10102, 'message': 'ui_test_task_id不能为空'})\nr = UITestResult.objects.filter(ui_task_id=ui_test_task_id)\ndata = []\nfor i in r:\n result = {'id': i.id, 'ui_test_result_name': i.ui_test_result_name, 'ui_error_total_number': i.ui_error_total_number, ...
<|body_start_0|> if ui_test_task_id == '': return response_failed({'status': 10102, 'message': 'ui_test_task_id不能为空'}) r = UITestResult.objects.filter(ui_task_id=ui_test_task_id) data = [] for i in r: result = {'id': i.id, 'ui_test_result_name': i.ui_test_result_n...
CheckResultList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CheckResultList: def get(self, request, ui_test_task_id, *args, **kwargs): """查看测试报告列表 :param request: :param ui_test_task_id: :param args: :param kwargs: :return:""" <|body_0|> def delete(self, request, ui_test_task_id, ui_test_result_id, *args, **kwargs): """删除单独测试...
stack_v2_sparse_classes_75kplus_train_073243
13,627
no_license
[ { "docstring": "查看测试报告列表 :param request: :param ui_test_task_id: :param args: :param kwargs: :return:", "name": "get", "signature": "def get(self, request, ui_test_task_id, *args, **kwargs)" }, { "docstring": "删除单独测试报告列表 :param ui_test_result_id: :param request: :param ui_test_task_id: :param ar...
2
stack_v2_sparse_classes_30k_train_041830
Implement the Python class `CheckResultList` described below. Class description: Implement the CheckResultList class. Method signatures and docstrings: - def get(self, request, ui_test_task_id, *args, **kwargs): 查看测试报告列表 :param request: :param ui_test_task_id: :param args: :param kwargs: :return: - def delete(self, r...
Implement the Python class `CheckResultList` described below. Class description: Implement the CheckResultList class. Method signatures and docstrings: - def get(self, request, ui_test_task_id, *args, **kwargs): 查看测试报告列表 :param request: :param ui_test_task_id: :param args: :param kwargs: :return: - def delete(self, r...
730bbb7a048e0f41a2fb61c8cdf554bcc2bd042c
<|skeleton|> class CheckResultList: def get(self, request, ui_test_task_id, *args, **kwargs): """查看测试报告列表 :param request: :param ui_test_task_id: :param args: :param kwargs: :return:""" <|body_0|> def delete(self, request, ui_test_task_id, ui_test_result_id, *args, **kwargs): """删除单独测试...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CheckResultList: def get(self, request, ui_test_task_id, *args, **kwargs): """查看测试报告列表 :param request: :param ui_test_task_id: :param args: :param kwargs: :return:""" if ui_test_task_id == '': return response_failed({'status': 10102, 'message': 'ui_test_task_id不能为空'}) r = U...
the_stack_v2_python_sparse
automated_main/view/ui_automation/ui_test_task/ui_test_task_view.py
a877429929/TestPlatformDjango
train
0
c22b8a188c46185ce9d9ed85466fabeb59a45d2b
[ "if ax is None:\n fig, ax = plt.subplots()\nlines, markers = plt.triplot(self.tri, **kwargs)", "vertices = self.node_map(self.tri.triangles)\nget_level = lambda node_id: self.data[label_by].loc[node_id]\nlevels = np.apply_along_axis(get_level, axis=1, arr=vertices)\nget_mode = lambda x: Counter(x).most_common(...
<|body_start_0|> if ax is None: fig, ax = plt.subplots() lines, markers = plt.triplot(self.tri, **kwargs) <|end_body_0|> <|body_start_1|> vertices = self.node_map(self.tri.triangles) get_level = lambda node_id: self.data[label_by].loc[node_id] levels = np.apply_along...
Methods for visualizing a Graph instance.
GraphVisualizationMethods
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GraphVisualizationMethods: """Methods for visualizing a Graph instance.""" def plot_edges(self, ax=None, **kwargs): """Plot triangulation edges. Args: ax (matplotlib.axes.AxesSubplot) kwargs: keyword arguments for matplotlib.pyplot.triplot""" <|body_0|> def label_triangl...
stack_v2_sparse_classes_75kplus_train_073244
23,136
permissive
[ { "docstring": "Plot triangulation edges. Args: ax (matplotlib.axes.AxesSubplot) kwargs: keyword arguments for matplotlib.pyplot.triplot", "name": "plot_edges", "signature": "def plot_edges(self, ax=None, **kwargs)" }, { "docstring": "Label each triangle with most common node attribute value. Ar...
4
stack_v2_sparse_classes_30k_train_052198
Implement the Python class `GraphVisualizationMethods` described below. Class description: Methods for visualizing a Graph instance. Method signatures and docstrings: - def plot_edges(self, ax=None, **kwargs): Plot triangulation edges. Args: ax (matplotlib.axes.AxesSubplot) kwargs: keyword arguments for matplotlib.py...
Implement the Python class `GraphVisualizationMethods` described below. Class description: Methods for visualizing a Graph instance. Method signatures and docstrings: - def plot_edges(self, ax=None, **kwargs): Plot triangulation edges. Args: ax (matplotlib.axes.AxesSubplot) kwargs: keyword arguments for matplotlib.py...
4a622c3f5fed4456c3b9240f5a96428789fde9bd
<|skeleton|> class GraphVisualizationMethods: """Methods for visualizing a Graph instance.""" def plot_edges(self, ax=None, **kwargs): """Plot triangulation edges. Args: ax (matplotlib.axes.AxesSubplot) kwargs: keyword arguments for matplotlib.pyplot.triplot""" <|body_0|> def label_triangl...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GraphVisualizationMethods: """Methods for visualizing a Graph instance.""" def plot_edges(self, ax=None, **kwargs): """Plot triangulation edges. Args: ax (matplotlib.axes.AxesSubplot) kwargs: keyword arguments for matplotlib.pyplot.triplot""" if ax is None: fig, ax = plt.subpl...
the_stack_v2_python_sparse
flyqma/annotation/spatial/graphs.py
sbernasek/flyqma
train
1
536df71401a84e09bfde81ec684ace3abfcdf8b1
[ "super().__init__()\nself.generator = generator_cls(latent_dim, n_classes, code_dim, img_size, num_channels)\nself.discriminator = discriminator_cls(code_dim, n_classes, num_channels, img_size)\nself._n_classes = n_classes\nself._latent_dim = latent_dim\nself._code_dim = code_dim\nself.lambda_cat = lambda_cat\nself...
<|body_start_0|> super().__init__() self.generator = generator_cls(latent_dim, n_classes, code_dim, img_size, num_channels) self.discriminator = discriminator_cls(code_dim, n_classes, num_channels, img_size) self._n_classes = n_classes self._latent_dim = latent_dim self._...
Class implementing the Information Maximization Generative Adversarial Networks. References ---------- `Paper <https://arxiv.org/abs/1606.03657>`_ Warnings -------- This Network is designed for training only; if you want to predict from an already trained network, it might be best, to split this network into its parts ...
InfoGAN
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InfoGAN: """Class implementing the Information Maximization Generative Adversarial Networks. References ---------- `Paper <https://arxiv.org/abs/1606.03657>`_ Warnings -------- This Network is designed for training only; if you want to predict from an already trained network, it might be best, to...
stack_v2_sparse_classes_75kplus_train_073245
6,693
permissive
[ { "docstring": "Parameters ---------- latent_dim : int the size of the latent dimension n_classes : int the number of classes code_dim : int the size of the code dimension img_size : int the number of pixels per image side num_channels : int number of image channels lambda_cat : float weighting factor specifyin...
2
stack_v2_sparse_classes_30k_train_023283
Implement the Python class `InfoGAN` described below. Class description: Class implementing the Information Maximization Generative Adversarial Networks. References ---------- `Paper <https://arxiv.org/abs/1606.03657>`_ Warnings -------- This Network is designed for training only; if you want to predict from an alread...
Implement the Python class `InfoGAN` described below. Class description: Class implementing the Information Maximization Generative Adversarial Networks. References ---------- `Paper <https://arxiv.org/abs/1606.03657>`_ Warnings -------- This Network is designed for training only; if you want to predict from an alread...
1078f5030b8aac2bf022daf5fa14d66f74c3c893
<|skeleton|> class InfoGAN: """Class implementing the Information Maximization Generative Adversarial Networks. References ---------- `Paper <https://arxiv.org/abs/1606.03657>`_ Warnings -------- This Network is designed for training only; if you want to predict from an already trained network, it might be best, to...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class InfoGAN: """Class implementing the Information Maximization Generative Adversarial Networks. References ---------- `Paper <https://arxiv.org/abs/1606.03657>`_ Warnings -------- This Network is designed for training only; if you want to predict from an already trained network, it might be best, to split this n...
the_stack_v2_python_sparse
dlutils/models/gans/info/info_gan.py
justusschock/dl-utils
train
15
a5035abdaf95ae881047ed870275a1a5ef156d41
[ "url = reverse('create_url')\ndata = {'link': 'somedummyurltotest.com'}\nresponse = self.client.post(url, data, format='json')\nself.assertEqual(response.status_code, status.HTTP_200_OK)\nself.assertEqual(Url.objects.count(), 1)\nself.assertEqual(Url.objects.get().link, 'somedummyurltotest.com')", "url = reverse(...
<|body_start_0|> url = reverse('create_url') data = {'link': 'somedummyurltotest.com'} response = self.client.post(url, data, format='json') self.assertEqual(response.status_code, status.HTTP_200_OK) self.assertEqual(Url.objects.count(), 1) self.assertEqual(Url.objects.ge...
PathsUrlsTestCase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PathsUrlsTestCase: def test_url_object_creation(self): """Testing that the post should create a new Url object""" <|body_0|> def test_two_request_different_url(self): """a second different request should create a new object""" <|body_1|> def test_second_...
stack_v2_sparse_classes_75kplus_train_073246
1,544
no_license
[ { "docstring": "Testing that the post should create a new Url object", "name": "test_url_object_creation", "signature": "def test_url_object_creation(self)" }, { "docstring": "a second different request should create a new object", "name": "test_two_request_different_url", "signature": "...
3
null
Implement the Python class `PathsUrlsTestCase` described below. Class description: Implement the PathsUrlsTestCase class. Method signatures and docstrings: - def test_url_object_creation(self): Testing that the post should create a new Url object - def test_two_request_different_url(self): a second different request ...
Implement the Python class `PathsUrlsTestCase` described below. Class description: Implement the PathsUrlsTestCase class. Method signatures and docstrings: - def test_url_object_creation(self): Testing that the post should create a new Url object - def test_two_request_different_url(self): a second different request ...
bcf0c6df2a2607cb0e918122ed1d5b435a385c14
<|skeleton|> class PathsUrlsTestCase: def test_url_object_creation(self): """Testing that the post should create a new Url object""" <|body_0|> def test_two_request_different_url(self): """a second different request should create a new object""" <|body_1|> def test_second_...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PathsUrlsTestCase: def test_url_object_creation(self): """Testing that the post should create a new Url object""" url = reverse('create_url') data = {'link': 'somedummyurltotest.com'} response = self.client.post(url, data, format='json') self.assertEqual(response.status...
the_stack_v2_python_sparse
rest_api/tests.py
fabinhojorge/urlshortener
train
0
c8dc2093eb41c7305aafdad7d9f40ea1316bca38
[ "if not super(HookPluginManager, self).is_plugin(plugin_path):\n return False\nif self.loading_point_filename not in os.listdir(plugin_path):\n return False\nreturn True", "plugin = super(HookPluginManager, self).load_plugin(plugin_path)\nloading_point_name = self.loading_point_filename[:-3]\nplugin['module...
<|body_start_0|> if not super(HookPluginManager, self).is_plugin(plugin_path): return False if self.loading_point_filename not in os.listdir(plugin_path): return False return True <|end_body_0|> <|body_start_1|> plugin = super(HookPluginManager, self).load_plugin...
A hook plugin is a directory containing python modules or packages that: * allow creating, including, and running custom code at specific 'hook' points/events * are not tracked in the Galaxy repository and allow adding custom code to a Galaxy installation A HookPluginManager imports the plugin code needed and calls the...
HookPluginManager
[ "CC-BY-2.5", "AFL-2.1", "AFL-3.0", "CC-BY-3.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HookPluginManager: """A hook plugin is a directory containing python modules or packages that: * allow creating, including, and running custom code at specific 'hook' points/events * are not tracked in the Galaxy repository and allow adding custom code to a Galaxy installation A HookPluginManager...
stack_v2_sparse_classes_75kplus_train_073247
23,805
permissive
[ { "docstring": "Determines whether the given filesystem path contains a hookable plugin. All sub-directories that contain ``loading_point_filename`` are considered plugins. :type plugin_path: string :param plugin_path: relative or absolute filesystem path to the potential plugin :rtype: bool :returns: True if t...
5
null
Implement the Python class `HookPluginManager` described below. Class description: A hook plugin is a directory containing python modules or packages that: * allow creating, including, and running custom code at specific 'hook' points/events * are not tracked in the Galaxy repository and allow adding custom code to a ...
Implement the Python class `HookPluginManager` described below. Class description: A hook plugin is a directory containing python modules or packages that: * allow creating, including, and running custom code at specific 'hook' points/events * are not tracked in the Galaxy repository and allow adding custom code to a ...
1ad89511540e6800cd2d0da5d878c1c77d8ccfe9
<|skeleton|> class HookPluginManager: """A hook plugin is a directory containing python modules or packages that: * allow creating, including, and running custom code at specific 'hook' points/events * are not tracked in the Galaxy repository and allow adding custom code to a Galaxy installation A HookPluginManager...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class HookPluginManager: """A hook plugin is a directory containing python modules or packages that: * allow creating, including, and running custom code at specific 'hook' points/events * are not tracked in the Galaxy repository and allow adding custom code to a Galaxy installation A HookPluginManager imports the ...
the_stack_v2_python_sparse
lib/galaxy/web/base/pluginframework.py
abretaud/galaxy
train
0
54ba03d7405958dd2f00fa5e2fd869f5f51a04df
[ "self.maxlen = maxlen\nself.val_range = val_range\nself.img = np.ones((maxlen, maxlen))\nself.time_step = 0\nself.one_img = np.ones((maxlen, maxlen))", "assert isinstance(data, np.ndarray)\ndata = np.expand_dims(data, 1)\ndata = np.resize(data, (1, self.maxlen))\nif self.time_step >= self.maxlen:\n self.img = ...
<|body_start_0|> self.maxlen = maxlen self.val_range = val_range self.img = np.ones((maxlen, maxlen)) self.time_step = 0 self.one_img = np.ones((maxlen, maxlen)) <|end_body_0|> <|body_start_1|> assert isinstance(data, np.ndarray) data = np.expand_dims(data, 1) ...
Overview: ``DistributionTimeImage`` can be used to store images accorrding to ``time_steps``, for data with 3 dims``(time, category, value)`` Interface: ``__init__``, ``add_one_time_step``, ``get_image``
DistributionTimeImage
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DistributionTimeImage: """Overview: ``DistributionTimeImage`` can be used to store images accorrding to ``time_steps``, for data with 3 dims``(time, category, value)`` Interface: ``__init__``, ``add_one_time_step``, ``get_image``""" def __init__(self, maxlen: int=600, val_range: Optional[dic...
stack_v2_sparse_classes_75kplus_train_073248
6,951
permissive
[ { "docstring": "Overview: Init the ``DistributionTimeImage`` class Arguments: - maxlen (:obj:`int`): The max length of data inputs - val_range (:obj:`dict` or :obj:`None`): Dict with ``val_range['min']`` and ``val_range['max']``.", "name": "__init__", "signature": "def __init__(self, maxlen: int=600, va...
3
stack_v2_sparse_classes_30k_train_026326
Implement the Python class `DistributionTimeImage` described below. Class description: Overview: ``DistributionTimeImage`` can be used to store images accorrding to ``time_steps``, for data with 3 dims``(time, category, value)`` Interface: ``__init__``, ``add_one_time_step``, ``get_image`` Method signatures and docst...
Implement the Python class `DistributionTimeImage` described below. Class description: Overview: ``DistributionTimeImage`` can be used to store images accorrding to ``time_steps``, for data with 3 dims``(time, category, value)`` Interface: ``__init__``, ``add_one_time_step``, ``get_image`` Method signatures and docst...
eb483fa6e46602d58c8e7d2ca1e566adca28e703
<|skeleton|> class DistributionTimeImage: """Overview: ``DistributionTimeImage`` can be used to store images accorrding to ``time_steps``, for data with 3 dims``(time, category, value)`` Interface: ``__init__``, ``add_one_time_step``, ``get_image``""" def __init__(self, maxlen: int=600, val_range: Optional[dic...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DistributionTimeImage: """Overview: ``DistributionTimeImage`` can be used to store images accorrding to ``time_steps``, for data with 3 dims``(time, category, value)`` Interface: ``__init__``, ``add_one_time_step``, ``get_image``""" def __init__(self, maxlen: int=600, val_range: Optional[dict]=None): ...
the_stack_v2_python_sparse
ding/utils/log_helper.py
shengxuesun/DI-engine
train
1
dff1d84f49f77d3dc4242eac368d9cab9380ccda
[ "self.df = df\nkeys_list = ['train_dir', 'test_dir', 'train_out', 'test_out', 'mask_out']\nfor key in keys_list:\n setattr(self, key, None)\nfor key in paths_dict.keys():\n setattr(self, key, paths_dict[key])\nif self.train_dir is not None:\n assert os.path.isdir(self.train_dir), 'Please make sure train_di...
<|body_start_0|> self.df = df keys_list = ['train_dir', 'test_dir', 'train_out', 'test_out', 'mask_out'] for key in keys_list: setattr(self, key, None) for key in paths_dict.keys(): setattr(self, key, paths_dict[key]) if self.train_dir is not None: ...
Preprocessor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Preprocessor: def __init__(self, df, paths_dict=COLAB_PATHS_DICT, out_shape_cv2=(640, 320), file_type='.jpg'): """Attributes: df: dataframe with cols ["Image_Label", "EncodedPixels"]; the first dataframe from running `setup_train_and_sub_df(...)` paths_dict (dict): for all of the paths t...
stack_v2_sparse_classes_75kplus_train_073249
5,617
permissive
[ { "docstring": "Attributes: df: dataframe with cols [\"Image_Label\", \"EncodedPixels\"]; the first dataframe from running `setup_train_and_sub_df(...)` paths_dict (dict): for all of the paths to the input and output dirs and files. Keys: - train_dir - test_dir - train_out: path to the output training images zi...
4
null
Implement the Python class `Preprocessor` described below. Class description: Implement the Preprocessor class. Method signatures and docstrings: - def __init__(self, df, paths_dict=COLAB_PATHS_DICT, out_shape_cv2=(640, 320), file_type='.jpg'): Attributes: df: dataframe with cols ["Image_Label", "EncodedPixels"]; the...
Implement the Python class `Preprocessor` described below. Class description: Implement the Preprocessor class. Method signatures and docstrings: - def __init__(self, df, paths_dict=COLAB_PATHS_DICT, out_shape_cv2=(640, 320), file_type='.jpg'): Attributes: df: dataframe with cols ["Image_Label", "EncodedPixels"]; the...
6972deb25cdf363ae0d9a9ad26d538280613fc94
<|skeleton|> class Preprocessor: def __init__(self, df, paths_dict=COLAB_PATHS_DICT, out_shape_cv2=(640, 320), file_type='.jpg'): """Attributes: df: dataframe with cols ["Image_Label", "EncodedPixels"]; the first dataframe from running `setup_train_and_sub_df(...)` paths_dict (dict): for all of the paths t...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Preprocessor: def __init__(self, df, paths_dict=COLAB_PATHS_DICT, out_shape_cv2=(640, 320), file_type='.jpg'): """Attributes: df: dataframe with cols ["Image_Label", "EncodedPixels"]; the first dataframe from running `setup_train_and_sub_df(...)` paths_dict (dict): for all of the paths to the input an...
the_stack_v2_python_sparse
clouds/preprocess.py
jchen42703/understanding-clouds-kaggle
train
1
3afa8354d945dc883ca91a0d7536eeb02b40d3e3
[ "from cbc_sdk.platform import Device\nself.vulnerability = vulnerability\nsuper().__init__(Device, cb)", "if self._vcenter_uuid:\n additional = '/vcenters/{}/vulnerabilities/{}/devices'.format(self._vcenter_uuid, self.vulnerability._model_unique_id)\nelse:\n additional = '/vulnerabilities/{}/devices'.format...
<|body_start_0|> from cbc_sdk.platform import Device self.vulnerability = vulnerability super().__init__(Device, cb) <|end_body_0|> <|body_start_1|> if self._vcenter_uuid: additional = '/vcenters/{}/vulnerabilities/{}/devices'.format(self._vcenter_uuid, self.vulnerability._m...
Query Class for the Vulnerability
AffectedAssetQuery
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AffectedAssetQuery: """Query Class for the Vulnerability""" def __init__(self, vulnerability, cb): """Initialize the AffectedAssetQuery. Args: vulnerability (class): The vulnerability that will be returned by this query. cb (BaseAPI): Reference to API object used to communicate with ...
stack_v2_sparse_classes_75kplus_train_073250
33,144
permissive
[ { "docstring": "Initialize the AffectedAssetQuery. Args: vulnerability (class): The vulnerability that will be returned by this query. cb (BaseAPI): Reference to API object used to communicate with the server.", "name": "__init__", "signature": "def __init__(self, vulnerability, cb)" }, { "docst...
5
stack_v2_sparse_classes_30k_train_039378
Implement the Python class `AffectedAssetQuery` described below. Class description: Query Class for the Vulnerability Method signatures and docstrings: - def __init__(self, vulnerability, cb): Initialize the AffectedAssetQuery. Args: vulnerability (class): The vulnerability that will be returned by this query. cb (Ba...
Implement the Python class `AffectedAssetQuery` described below. Class description: Query Class for the Vulnerability Method signatures and docstrings: - def __init__(self, vulnerability, cb): Initialize the AffectedAssetQuery. Args: vulnerability (class): The vulnerability that will be returned by this query. cb (Ba...
a8a2ec8ff6b9985b4fb4700d9d566e8e2a297381
<|skeleton|> class AffectedAssetQuery: """Query Class for the Vulnerability""" def __init__(self, vulnerability, cb): """Initialize the AffectedAssetQuery. Args: vulnerability (class): The vulnerability that will be returned by this query. cb (BaseAPI): Reference to API object used to communicate with ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AffectedAssetQuery: """Query Class for the Vulnerability""" def __init__(self, vulnerability, cb): """Initialize the AffectedAssetQuery. Args: vulnerability (class): The vulnerability that will be returned by this query. cb (BaseAPI): Reference to API object used to communicate with the server.""...
the_stack_v2_python_sparse
src/cbc_sdk/platform/vulnerability_assessment.py
fslds/carbon-black-cloud-sdk-python
train
0
00ff5f8f672c81e1eac1ca9fd13a8116810fe8df
[ "isLeaf = self.isQuadTree(grid)\nl = len(grid)\nif isLeaf is None:\n mid = l // 2\n topLeftGrid = [[grid[i][j] for j in range(mid)] for i in range(mid)]\n topRightGrid = [[grid[i][j] for j in range(mid, l)] for i in range(mid)]\n bottomLeftGrid = [[grid[i][j] for j in range(mid)] for i in range(mid, l)]...
<|body_start_0|> isLeaf = self.isQuadTree(grid) l = len(grid) if isLeaf is None: mid = l // 2 topLeftGrid = [[grid[i][j] for j in range(mid)] for i in range(mid)] topRightGrid = [[grid[i][j] for j in range(mid, l)] for i in range(mid)] bottomLeftGr...
Solution
[ "ICU" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def construct(self, grid): """:type grid: List[List[int]] :rtype: Node""" <|body_0|> def isQuadTree(self, grid): """:type grid: List[List[int]] :return: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> isLeaf = self.isQuadTree(grid) ...
stack_v2_sparse_classes_75kplus_train_073251
3,193
permissive
[ { "docstring": ":type grid: List[List[int]] :rtype: Node", "name": "construct", "signature": "def construct(self, grid)" }, { "docstring": ":type grid: List[List[int]] :return: bool", "name": "isQuadTree", "signature": "def isQuadTree(self, grid)" } ]
2
stack_v2_sparse_classes_30k_train_017842
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def construct(self, grid): :type grid: List[List[int]] :rtype: Node - def isQuadTree(self, grid): :type grid: List[List[int]] :return: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def construct(self, grid): :type grid: List[List[int]] :rtype: Node - def isQuadTree(self, grid): :type grid: List[List[int]] :return: bool <|skeleton|> class Solution: def...
304d91d793b2dc6e8ce1c91abea16cd5a1c8fe76
<|skeleton|> class Solution: def construct(self, grid): """:type grid: List[List[int]] :rtype: Node""" <|body_0|> def isQuadTree(self, grid): """:type grid: List[List[int]] :return: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def construct(self, grid): """:type grid: List[List[int]] :rtype: Node""" isLeaf = self.isQuadTree(grid) l = len(grid) if isLeaf is None: mid = l // 2 topLeftGrid = [[grid[i][j] for j in range(mid)] for i in range(mid)] topRightGrid...
the_stack_v2_python_sparse
427. Construct Quad Tree/Construct Quad Tree/main.py
boaass/Leetcode
train
0
cb9c469d1df50f59a1b1673c45f39db7aaf992f0
[ "self.branch = 'master'\nself.fix = False\nsuper(lint, self).initialize_options()", "cmd = 'black .'\ncmd = cmd.format(branch=self.branch)\nself.call_and_exit(self.apply_options(cmd, ('fix',)))" ]
<|body_start_0|> self.branch = 'master' self.fix = False super(lint, self).initialize_options() <|end_body_0|> <|body_start_1|> cmd = 'black .' cmd = cmd.format(branch=self.branch) self.call_and_exit(self.apply_options(cmd, ('fix',))) <|end_body_1|>
A PEP 8 lint command that optionally fixes violations.
lint
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class lint: """A PEP 8 lint command that optionally fixes violations.""" def initialize_options(self): """Set the default options.""" <|body_0|> def run(self): """Run the linter.""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.branch = 'master' ...
stack_v2_sparse_classes_75kplus_train_073252
3,851
permissive
[ { "docstring": "Set the default options.", "name": "initialize_options", "signature": "def initialize_options(self)" }, { "docstring": "Run the linter.", "name": "run", "signature": "def run(self)" } ]
2
stack_v2_sparse_classes_30k_val_001677
Implement the Python class `lint` described below. Class description: A PEP 8 lint command that optionally fixes violations. Method signatures and docstrings: - def initialize_options(self): Set the default options. - def run(self): Run the linter.
Implement the Python class `lint` described below. Class description: A PEP 8 lint command that optionally fixes violations. Method signatures and docstrings: - def initialize_options(self): Set the default options. - def run(self): Run the linter. <|skeleton|> class lint: """A PEP 8 lint command that optionally...
4e2c417f68bc07c72b508e107431569b0783c4ef
<|skeleton|> class lint: """A PEP 8 lint command that optionally fixes violations.""" def initialize_options(self): """Set the default options.""" <|body_0|> def run(self): """Run the linter.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class lint: """A PEP 8 lint command that optionally fixes violations.""" def initialize_options(self): """Set the default options.""" self.branch = 'master' self.fix = False super(lint, self).initialize_options() def run(self): """Run the linter.""" cmd = 'b...
the_stack_v2_python_sparse
tasks.py
dbcli/cli_helpers
train
102
1f61e0ed43d06a9ba910a30e0ad30565dac62fc1
[ "if namespace is None:\n self.use_main_ns = 1\nelse:\n self.use_main_ns = 0\n self.namespace = namespace\nif global_namespace is None:\n self.global_namespace = {}\nelse:\n self.global_namespace = global_namespace\nsuper(Completer, self).__init__(**kwargs)", "if self.use_main_ns:\n self.namespac...
<|body_start_0|> if namespace is None: self.use_main_ns = 1 else: self.use_main_ns = 0 self.namespace = namespace if global_namespace is None: self.global_namespace = {} else: self.global_namespace = global_namespace sup...
Completer
[ "BSD-3-Clause", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Completer: def __init__(self, namespace=None, global_namespace=None, **kwargs): """Create a new completer for the command line. Completer(namespace=ns, global_namespace=ns2) -> completer instance. If unspecified, the default namespace where completions are performed is __main__ (technica...
stack_v2_sparse_classes_75kplus_train_073253
42,482
permissive
[ { "docstring": "Create a new completer for the command line. Completer(namespace=ns, global_namespace=ns2) -> completer instance. If unspecified, the default namespace where completions are performed is __main__ (technically, __main__.__dict__). Namespaces should be given as dictionaries. An optional second nam...
4
stack_v2_sparse_classes_30k_train_043874
Implement the Python class `Completer` described below. Class description: Implement the Completer class. Method signatures and docstrings: - def __init__(self, namespace=None, global_namespace=None, **kwargs): Create a new completer for the command line. Completer(namespace=ns, global_namespace=ns2) -> completer ins...
Implement the Python class `Completer` described below. Class description: Implement the Completer class. Method signatures and docstrings: - def __init__(self, namespace=None, global_namespace=None, **kwargs): Create a new completer for the command line. Completer(namespace=ns, global_namespace=ns2) -> completer ins...
f5042e35b945aded77b23470ead62d7eacefde92
<|skeleton|> class Completer: def __init__(self, namespace=None, global_namespace=None, **kwargs): """Create a new completer for the command line. Completer(namespace=ns, global_namespace=ns2) -> completer instance. If unspecified, the default namespace where completions are performed is __main__ (technica...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Completer: def __init__(self, namespace=None, global_namespace=None, **kwargs): """Create a new completer for the command line. Completer(namespace=ns, global_namespace=ns2) -> completer instance. If unspecified, the default namespace where completions are performed is __main__ (technically, __main__....
the_stack_v2_python_sparse
contrib/python/ipython/py2/IPython/core/completer.py
catboost/catboost
train
8,012
027ffea2b3983f93a5b22611ebbb9bcf12d3689d
[ "super().__init__()\nself.__file_list_str = []\nself.__file_list_pathlib = []\nself.__inc_dirs = inc_dirs\nif path is not None:\n os.chdir(path)\nself._recursive_find_files()", "for f in Path.cwd().iterdir():\n if f.is_file():\n self.__file_list_str.append(str(f))\n self.__file_list_pathlib.ap...
<|body_start_0|> super().__init__() self.__file_list_str = [] self.__file_list_pathlib = [] self.__inc_dirs = inc_dirs if path is not None: os.chdir(path) self._recursive_find_files() <|end_body_0|> <|body_start_1|> for f in Path.cwd().iterdir(): ...
RecursiveFindFiles
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RecursiveFindFiles: def __init__(self, path: Path=None, inc_dirs: bool=False): """:param path: will recursively find all files in this path, if None will use CWD :param inc_dirs: include directories otherwise only include files""" <|body_0|> def _recursive_find_files(self): ...
stack_v2_sparse_classes_75kplus_train_073254
3,368
no_license
[ { "docstring": ":param path: will recursively find all files in this path, if None will use CWD :param inc_dirs: include directories otherwise only include files", "name": "__init__", "signature": "def __init__(self, path: Path=None, inc_dirs: bool=False)" }, { "docstring": "gets a list of all f...
3
stack_v2_sparse_classes_30k_val_002936
Implement the Python class `RecursiveFindFiles` described below. Class description: Implement the RecursiveFindFiles class. Method signatures and docstrings: - def __init__(self, path: Path=None, inc_dirs: bool=False): :param path: will recursively find all files in this path, if None will use CWD :param inc_dirs: in...
Implement the Python class `RecursiveFindFiles` described below. Class description: Implement the RecursiveFindFiles class. Method signatures and docstrings: - def __init__(self, path: Path=None, inc_dirs: bool=False): :param path: will recursively find all files in this path, if None will use CWD :param inc_dirs: in...
1fa14cd2c742097e95e3b44bfda445c4dbf5c136
<|skeleton|> class RecursiveFindFiles: def __init__(self, path: Path=None, inc_dirs: bool=False): """:param path: will recursively find all files in this path, if None will use CWD :param inc_dirs: include directories otherwise only include files""" <|body_0|> def _recursive_find_files(self): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RecursiveFindFiles: def __init__(self, path: Path=None, inc_dirs: bool=False): """:param path: will recursively find all files in this path, if None will use CWD :param inc_dirs: include directories otherwise only include files""" super().__init__() self.__file_list_str = [] se...
the_stack_v2_python_sparse
python/utils/recursion.py
thermitegod/shell-scripts
train
0
70d1bbbb1fd62a2b977b7f956e3d36e29dd047ec
[ "assert dataset in ('europarl7', 'un2000'), 'invalid dataset'\nprocessed_file = os.path.join(path, dataset + '-' + split + '.h5')\nassert os.path.exists(processed_file), \"Dataset at '\" + processed_file + \"' not found\"\nself.subset_pct = subset_pct\nsuper(TextNMT, self).__init__(time_steps, processed_file, vocab...
<|body_start_0|> assert dataset in ('europarl7', 'un2000'), 'invalid dataset' processed_file = os.path.join(path, dataset + '-' + split + '.h5') assert os.path.exists(processed_file), "Dataset at '" + processed_file + "' not found" self.subset_pct = subset_pct super(TextNMT, self...
Datasets for neural machine translation on French / English bilingual datasets. Available at http://www-lium.univ-lemans.fr/~schwenk/cslm_joint_paper/data/bitexts.tgz Arguments: time_steps (int) : Length of a sequence. path (str) : Path to text file. tokenizer (function) : Tokenizer function. onehot_input (boolean): On...
TextNMT
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TextNMT: """Datasets for neural machine translation on French / English bilingual datasets. Available at http://www-lium.univ-lemans.fr/~schwenk/cslm_joint_paper/data/bitexts.tgz Arguments: time_steps (int) : Length of a sequence. path (str) : Path to text file. tokenizer (function) : Tokenizer f...
stack_v2_sparse_classes_75kplus_train_073255
22,856
permissive
[ { "docstring": "Load French and English sentence data from file.", "name": "__init__", "signature": "def __init__(self, time_steps, path, tokenizer=None, onehot_input=False, get_prev_target=False, split=None, dataset='un2000', subset_pct=100)" }, { "docstring": "Tokenizer and vocab are unused bu...
2
stack_v2_sparse_classes_30k_train_043193
Implement the Python class `TextNMT` described below. Class description: Datasets for neural machine translation on French / English bilingual datasets. Available at http://www-lium.univ-lemans.fr/~schwenk/cslm_joint_paper/data/bitexts.tgz Arguments: time_steps (int) : Length of a sequence. path (str) : Path to text f...
Implement the Python class `TextNMT` described below. Class description: Datasets for neural machine translation on French / English bilingual datasets. Available at http://www-lium.univ-lemans.fr/~schwenk/cslm_joint_paper/data/bitexts.tgz Arguments: time_steps (int) : Length of a sequence. path (str) : Path to text f...
cba318c9f0a2acf2ab8a3d7725b588b2a8b17cb9
<|skeleton|> class TextNMT: """Datasets for neural machine translation on French / English bilingual datasets. Available at http://www-lium.univ-lemans.fr/~schwenk/cslm_joint_paper/data/bitexts.tgz Arguments: time_steps (int) : Length of a sequence. path (str) : Path to text file. tokenizer (function) : Tokenizer f...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TextNMT: """Datasets for neural machine translation on French / English bilingual datasets. Available at http://www-lium.univ-lemans.fr/~schwenk/cslm_joint_paper/data/bitexts.tgz Arguments: time_steps (int) : Length of a sequence. path (str) : Path to text file. tokenizer (function) : Tokenizer function. oneh...
the_stack_v2_python_sparse
neon/data/text.py
anlthms/neon
train
1
c3bf98d508ff4aabff35f00d21470f4b7264d438
[ "self.network_type = NETWORK_TYPE_FABRIC_PRE_V1\nself.consensus_plugin = consensus_plugin\nself.consensus_mode = consensus_mode\nself.size = size\nsuper(FabricPreNetworkConfig, self).__init__()", "if self.consensus_plugin not in CONSENSUS_PLUGINS_FABRIC_V1:\n error_msg = 'Unknown consensus plugin={}'.format(se...
<|body_start_0|> self.network_type = NETWORK_TYPE_FABRIC_PRE_V1 self.consensus_plugin = consensus_plugin self.consensus_mode = consensus_mode self.size = size super(FabricPreNetworkConfig, self).__init__() <|end_body_0|> <|body_start_1|> if self.consensus_plugin not in C...
FabricPreNetworkConfig includes configs for fabric v0.6 network.
FabricPreNetworkConfig
[ "CC-BY-4.0", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FabricPreNetworkConfig: """FabricPreNetworkConfig includes configs for fabric v0.6 network.""" def __init__(self, consensus_plugin, consensus_mode, size): """Init. Args: consensus_plugin: consensus plugin to use, e.g., pbft consensus_mode: consensus mode, e.g., sieve size: size of no...
stack_v2_sparse_classes_75kplus_train_073256
3,001
permissive
[ { "docstring": "Init. Args: consensus_plugin: consensus plugin to use, e.g., pbft consensus_mode: consensus mode, e.g., sieve size: size of nodes in the network >>> config = FabricPreNetworkConfig('plugin', 'mode', 'size')", "name": "__init__", "signature": "def __init__(self, consensus_plugin, consensu...
2
stack_v2_sparse_classes_30k_train_049792
Implement the Python class `FabricPreNetworkConfig` described below. Class description: FabricPreNetworkConfig includes configs for fabric v0.6 network. Method signatures and docstrings: - def __init__(self, consensus_plugin, consensus_mode, size): Init. Args: consensus_plugin: consensus plugin to use, e.g., pbft con...
Implement the Python class `FabricPreNetworkConfig` described below. Class description: FabricPreNetworkConfig includes configs for fabric v0.6 network. Method signatures and docstrings: - def __init__(self, consensus_plugin, consensus_mode, size): Init. Args: consensus_plugin: consensus plugin to use, e.g., pbft con...
43f537380b93896c543a1248bf2b04c3fafe993d
<|skeleton|> class FabricPreNetworkConfig: """FabricPreNetworkConfig includes configs for fabric v0.6 network.""" def __init__(self, consensus_plugin, consensus_mode, size): """Init. Args: consensus_plugin: consensus plugin to use, e.g., pbft consensus_mode: consensus mode, e.g., sieve size: size of no...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FabricPreNetworkConfig: """FabricPreNetworkConfig includes configs for fabric v0.6 network.""" def __init__(self, consensus_plugin, consensus_mode, size): """Init. Args: consensus_plugin: consensus plugin to use, e.g., pbft consensus_mode: consensus mode, e.g., sieve size: size of nodes in the ne...
the_stack_v2_python_sparse
src/common/fabric_network_config.py
zale144/cello
train
0
013f9fe8f295c9a33ae81355e4da900224a0ae29
[ "if not graph.is_directed():\n raise ValueError('the graph is not directed')\nself.graph = graph\nself.distance = dict()\nfor source in self.graph.iternodes():\n self.distance[source] = dict()\n for target in self.graph.iternodes():\n self.distance[source][target] = float('inf')\n self.distance[s...
<|body_start_0|> if not graph.is_directed(): raise ValueError('the graph is not directed') self.graph = graph self.distance = dict() for source in self.graph.iternodes(): self.distance[source] = dict() for target in self.graph.iternodes(): ...
All-pairs shortest paths algorithm in O(V^3 log V) time. Attributes ---------- graph : input directed weighted graph distance : dict-of-dict Examples -------- >>> from graphtheory.structures.edges import Edge >>> from graphtheory.structures.graphs import Graph >>> from graphtheory.shortestpaths.allpairs import FasterAl...
FasterAllPairs
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FasterAllPairs: """All-pairs shortest paths algorithm in O(V^3 log V) time. Attributes ---------- graph : input directed weighted graph distance : dict-of-dict Examples -------- >>> from graphtheory.structures.edges import Edge >>> from graphtheory.structures.graphs import Graph >>> from graphthe...
stack_v2_sparse_classes_75kplus_train_073257
11,361
permissive
[ { "docstring": "The algorithm initialization. Parameters ---------- graph : directed weighted graph", "name": "__init__", "signature": "def __init__(self, graph)" }, { "docstring": "Executable pseudocode.", "name": "run", "signature": "def run(self)" }, { "docstring": "O(V^3) tim...
3
stack_v2_sparse_classes_30k_train_043544
Implement the Python class `FasterAllPairs` described below. Class description: All-pairs shortest paths algorithm in O(V^3 log V) time. Attributes ---------- graph : input directed weighted graph distance : dict-of-dict Examples -------- >>> from graphtheory.structures.edges import Edge >>> from graphtheory.structure...
Implement the Python class `FasterAllPairs` described below. Class description: All-pairs shortest paths algorithm in O(V^3 log V) time. Attributes ---------- graph : input directed weighted graph distance : dict-of-dict Examples -------- >>> from graphtheory.structures.edges import Edge >>> from graphtheory.structure...
0ff4ae303e8824e6bb8474d23b29a7b3e5ed8e60
<|skeleton|> class FasterAllPairs: """All-pairs shortest paths algorithm in O(V^3 log V) time. Attributes ---------- graph : input directed weighted graph distance : dict-of-dict Examples -------- >>> from graphtheory.structures.edges import Edge >>> from graphtheory.structures.graphs import Graph >>> from graphthe...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FasterAllPairs: """All-pairs shortest paths algorithm in O(V^3 log V) time. Attributes ---------- graph : input directed weighted graph distance : dict-of-dict Examples -------- >>> from graphtheory.structures.edges import Edge >>> from graphtheory.structures.graphs import Graph >>> from graphtheory.shortestp...
the_stack_v2_python_sparse
graphtheory/shortestpaths/allpairs.py
kgashok/graphs-dict
train
0
0c537649fc89f3a6db7c05b8ef1c75265fe7524d
[ "reflection_table = SumAndPrfIntensityReducer.reduce_on_intensities(reflection_table)\nreflection_table = ScaleIntensityReducer.reduce_on_intensities(reflection_table)\nreturn reflection_table", "reflection_table = SumAndPrfIntensityReducer.apply_scaling_factors(reflection_table)\nreflection_table = ScaleIntensit...
<|body_start_0|> reflection_table = SumAndPrfIntensityReducer.reduce_on_intensities(reflection_table) reflection_table = ScaleIntensityReducer.reduce_on_intensities(reflection_table) return reflection_table <|end_body_0|> <|body_start_1|> reflection_table = SumAndPrfIntensityReducer.app...
Reduction methods for data with sum, profile and scale intensities. Only reflections with valid values for all intensity types are retained.
AllSumPrfScaleIntensityReducer
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AllSumPrfScaleIntensityReducer: """Reduction methods for data with sum, profile 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.""" ...
stack_v2_sparse_classes_75kplus_train_073258
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_051864
Implement the Python class `AllSumPrfScaleIntensityReducer` described below. Class description: Reduction methods for data with sum, profile and scale intensities. Only reflections with valid values for all intensity types are retained. Method signatures and docstrings: - def reduce_on_intensities(reflection_table): ...
Implement the Python class `AllSumPrfScaleIntensityReducer` described below. Class description: Reduction methods for data with sum, profile and scale intensities. Only reflections with valid values for all intensity types are retained. Method signatures and docstrings: - def reduce_on_intensities(reflection_table): ...
88bf7f7c5ac44defc046ebf0719cde748092cfff
<|skeleton|> class AllSumPrfScaleIntensityReducer: """Reduction methods for data with sum, profile 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.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AllSumPrfScaleIntensityReducer: """Reduction methods for data with sum, profile 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.""" reflect...
the_stack_v2_python_sparse
src/dials/util/filter_reflections.py
dials/dials
train
71
06e850714657e9824d7d193c6e7476800c351a07
[ "if not root:\n return 0\ntr_l = root.left\ntr_r = root.right\nmin_depth = 1\nif not tr_l and (not tr_r):\n return min_depth\nelif tr_l and (not tr_r):\n min_depth += self.minDepth(tr_l)\nelif not tr_l and tr_r:\n min_depth += self.minDepth(tr_r)\nelse:\n min_depth += min(self.minDepth(tr_l), self.mi...
<|body_start_0|> if not root: return 0 tr_l = root.left tr_r = root.right min_depth = 1 if not tr_l and (not tr_r): return min_depth elif tr_l and (not tr_r): min_depth += self.minDepth(tr_l) elif not tr_l and tr_r: ...
Solution
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minDepth(self, root: TreeNode) -> int: """DFS""" <|body_0|> def minDepth2(self, root): """BFS""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not root: return 0 tr_l = root.left tr_r = root.right ...
stack_v2_sparse_classes_75kplus_train_073259
1,714
permissive
[ { "docstring": "DFS", "name": "minDepth", "signature": "def minDepth(self, root: TreeNode) -> int" }, { "docstring": "BFS", "name": "minDepth2", "signature": "def minDepth2(self, root)" } ]
2
stack_v2_sparse_classes_30k_train_000887
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minDepth(self, root: TreeNode) -> int: DFS - def minDepth2(self, root): BFS
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minDepth(self, root: TreeNode) -> int: DFS - def minDepth2(self, root): BFS <|skeleton|> class Solution: def minDepth(self, root: TreeNode) -> int: """DFS""" ...
49a0b03c55d8a702785888d473ef96539265ce9c
<|skeleton|> class Solution: def minDepth(self, root: TreeNode) -> int: """DFS""" <|body_0|> def minDepth2(self, root): """BFS""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def minDepth(self, root: TreeNode) -> int: """DFS""" if not root: return 0 tr_l = root.left tr_r = root.right min_depth = 1 if not tr_l and (not tr_r): return min_depth elif tr_l and (not tr_r): min_depth += ...
the_stack_v2_python_sparse
leetcode/0111_minimum_depth_of_binary_tree.py
chaosWsF/Python-Practice
train
1
3d77182f30e49c7f63023ac4a1d1b4ebe2059fed
[ "if self.action in ['create', 'update']:\n permissions = [IsAuthenticated]\nelse:\n permissions = []\nreturn [permission() for permission in permissions]", "if self.action in ['create', 'update']:\n return CreateUpdatePinSerializer\nreturn PinModelSerializer", "if self.action == 'list':\n return sel...
<|body_start_0|> if self.action in ['create', 'update']: permissions = [IsAuthenticated] else: permissions = [] return [permission() for permission in permissions] <|end_body_0|> <|body_start_1|> if self.action in ['create', 'update']: return CreateUp...
Pin view set. Crud for a pins
PinViewSet
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PinViewSet: """Pin view set. Crud for a pins""" def get_permissions(self): """Assign permission based on action.""" <|body_0|> def get_serializer_class(self): """Return serializer based on action.""" <|body_1|> def get_queryset(self): """Rest...
stack_v2_sparse_classes_75kplus_train_073260
1,671
permissive
[ { "docstring": "Assign permission based on action.", "name": "get_permissions", "signature": "def get_permissions(self)" }, { "docstring": "Return serializer based on action.", "name": "get_serializer_class", "signature": "def get_serializer_class(self)" }, { "docstring": "Restri...
3
stack_v2_sparse_classes_30k_train_039932
Implement the Python class `PinViewSet` described below. Class description: Pin view set. Crud for a pins Method signatures and docstrings: - def get_permissions(self): Assign permission based on action. - def get_serializer_class(self): Return serializer based on action. - def get_queryset(self): Restrict list to pu...
Implement the Python class `PinViewSet` described below. Class description: Pin view set. Crud for a pins Method signatures and docstrings: - def get_permissions(self): Assign permission based on action. - def get_serializer_class(self): Return serializer based on action. - def get_queryset(self): Restrict list to pu...
6a6cb4f8cbc4c8ad01e184264486ae466f403059
<|skeleton|> class PinViewSet: """Pin view set. Crud for a pins""" def get_permissions(self): """Assign permission based on action.""" <|body_0|> def get_serializer_class(self): """Return serializer based on action.""" <|body_1|> def get_queryset(self): """Rest...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PinViewSet: """Pin view set. Crud for a pins""" def get_permissions(self): """Assign permission based on action.""" if self.action in ['create', 'update']: permissions = [IsAuthenticated] else: permissions = [] return [permission() for permission in...
the_stack_v2_python_sparse
pinterest/pin/api/views/pin.py
platzi-pinterest/backend
train
0
29c22d9df7712b673548751a11cfab6b25bdc7bb
[ "self.valleyLower = valleyLower\nself.valleyUpper = valleyUpper\nself.kappa = kappa", "dW = np.zeros(currentW.shape)\nindexBelow = np.where(currentW < self.valleyLower)\nindexAbove = np.where(currentW > self.valleyUpper)\ndW[indexBelow] = -self.kappa * (currentW[indexBelow] - self.valleyLower)\ndW[indexAbove] = -...
<|body_start_0|> self.valleyLower = valleyLower self.valleyUpper = valleyUpper self.kappa = kappa <|end_body_0|> <|body_start_1|> dW = np.zeros(currentW.shape) indexBelow = np.where(currentW < self.valleyLower) indexAbove = np.where(currentW > self.valleyUpper) d...
flatValleyL2Decay
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class flatValleyL2Decay: def __init__(self, valleyLower, valleyUpper, kappa): """Weight decay model with no weight decay in the middle of the valley and l2 like decay other wise: if W < valleyLower: dW = - kappa * (W - valleyLower) if valleyLower < W < valleyUpper: dW = 0 if valleyUpper < W: d...
stack_v2_sparse_classes_75kplus_train_073261
1,632
no_license
[ { "docstring": "Weight decay model with no weight decay in the middle of the valley and l2 like decay other wise: if W < valleyLower: dW = - kappa * (W - valleyLower) if valleyLower < W < valleyUpper: dW = 0 if valleyUpper < W: dW = - kappa * (W - valleyUpper)", "name": "__init__", "signature": "def __i...
2
stack_v2_sparse_classes_30k_train_017758
Implement the Python class `flatValleyL2Decay` described below. Class description: Implement the flatValleyL2Decay class. Method signatures and docstrings: - def __init__(self, valleyLower, valleyUpper, kappa): Weight decay model with no weight decay in the middle of the valley and l2 like decay other wise: if W < va...
Implement the Python class `flatValleyL2Decay` described below. Class description: Implement the flatValleyL2Decay class. Method signatures and docstrings: - def __init__(self, valleyLower, valleyUpper, kappa): Weight decay model with no weight decay in the middle of the valley and l2 like decay other wise: if W < va...
22f73607e64537e16ebd9914a669b837b88cd12a
<|skeleton|> class flatValleyL2Decay: def __init__(self, valleyLower, valleyUpper, kappa): """Weight decay model with no weight decay in the middle of the valley and l2 like decay other wise: if W < valleyLower: dW = - kappa * (W - valleyLower) if valleyLower < W < valleyUpper: dW = 0 if valleyUpper < W: d...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class flatValleyL2Decay: def __init__(self, valleyLower, valleyUpper, kappa): """Weight decay model with no weight decay in the middle of the valley and l2 like decay other wise: if W < valleyLower: dW = - kappa * (W - valleyLower) if valleyLower < W < valleyUpper: dW = 0 if valleyUpper < W: dW = - kappa * ...
the_stack_v2_python_sparse
lagrangeRL/tools/weightDecayModels.py
afkungl/lagrangeRL
train
0
f8d905e5ed9f4871ff85d67e1d9ac02b2a376908
[ "model = Pagtn(n_tasks=n_tasks, number_atom_features=number_atom_features, number_bond_features=number_bond_features, mode=mode, n_classes=n_classes, output_node_features=output_node_features, hidden_features=hidden_features, num_layers=num_layers, num_heads=num_heads, dropout=dropout, pool_mode=pool_mode)\nif mode...
<|body_start_0|> model = Pagtn(n_tasks=n_tasks, number_atom_features=number_atom_features, number_bond_features=number_bond_features, mode=mode, n_classes=n_classes, output_node_features=output_node_features, hidden_features=hidden_features, num_layers=num_layers, num_heads=num_heads, dropout=dropout, pool_mode...
Model for Graph Property Prediction. This model proceeds as follows: * Update node representations in graphs with a variant of GAT, where a linear additive form of attention is applied. Attention Weights are derived by concatenating the node and edge features for each bond. * Update node representations with multiple r...
PagtnModel
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PagtnModel: """Model for Graph Property Prediction. This model proceeds as follows: * Update node representations in graphs with a variant of GAT, where a linear additive form of attention is applied. Attention Weights are derived by concatenating the node and edge features for each bond. * Updat...
stack_v2_sparse_classes_75kplus_train_073262
12,297
permissive
[ { "docstring": "Parameters ---------- n_tasks: int Number of tasks. number_atom_features : int Size for the input node features. Default to 94. number_bond_features : int Size for the input edge features. Default to 42. mode: str The model type, 'classification' or 'regression'. Default to 'regression'. n_class...
2
stack_v2_sparse_classes_30k_train_014021
Implement the Python class `PagtnModel` described below. Class description: Model for Graph Property Prediction. This model proceeds as follows: * Update node representations in graphs with a variant of GAT, where a linear additive form of attention is applied. Attention Weights are derived by concatenating the node a...
Implement the Python class `PagtnModel` described below. Class description: Model for Graph Property Prediction. This model proceeds as follows: * Update node representations in graphs with a variant of GAT, where a linear additive form of attention is applied. Attention Weights are derived by concatenating the node a...
ee6e67ebcf7bf04259cf13aff6388e2b791fea3d
<|skeleton|> class PagtnModel: """Model for Graph Property Prediction. This model proceeds as follows: * Update node representations in graphs with a variant of GAT, where a linear additive form of attention is applied. Attention Weights are derived by concatenating the node and edge features for each bond. * Updat...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PagtnModel: """Model for Graph Property Prediction. This model proceeds as follows: * Update node representations in graphs with a variant of GAT, where a linear additive form of attention is applied. Attention Weights are derived by concatenating the node and edge features for each bond. * Update node repres...
the_stack_v2_python_sparse
deepchem/models/torch_models/pagtn.py
deepchem/deepchem
train
4,876
b48097d3ce679e0c11ed2948205eff79878cc1fc
[ "res_graph = self.get_cache_graph(sparql=J2QueryStrService.j2_query(file_name='construct_user_query', constraints=[{'var_name': '?userUri', 'var_values': [user_uri.n3()]}]))\nuser = self._graph_get_user_by_uri(user_uri=user_uri)\nreturn user", "if (user_uri, None, None) not in self.cache_graph:\n raise UserNot...
<|body_start_0|> res_graph = self.get_cache_graph(sparql=J2QueryStrService.j2_query(file_name='construct_user_query', constraints=[{'var_name': '?userUri', 'var_values': [user_uri.n3()]}])) user = self._graph_get_user_by_uri(user_uri=user_uri) return user <|end_body_0|> <|body_start_1|> ...
GraphUserKgQueryService
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GraphUserKgQueryService: def get_user_by_uri(self, *, user_uri: URIRef) -> FoodKgUser: """Query the User KG to retrieve a FoodKGUser object with the target URI. :param user_uri: the URI of the user to return :return: a FoodKGUser object with the target URI""" <|body_0|> def ...
stack_v2_sparse_classes_75kplus_train_073263
4,529
no_license
[ { "docstring": "Query the User KG to retrieve a FoodKGUser object with the target URI. :param user_uri: the URI of the user to return :return: a FoodKGUser object with the target URI", "name": "get_user_by_uri", "signature": "def get_user_by_uri(self, *, user_uri: URIRef) -> FoodKgUser" }, { "do...
2
stack_v2_sparse_classes_30k_test_002206
Implement the Python class `GraphUserKgQueryService` described below. Class description: Implement the GraphUserKgQueryService class. Method signatures and docstrings: - def get_user_by_uri(self, *, user_uri: URIRef) -> FoodKgUser: Query the User KG to retrieve a FoodKGUser object with the target URI. :param user_uri...
Implement the Python class `GraphUserKgQueryService` described below. Class description: Implement the GraphUserKgQueryService class. Method signatures and docstrings: - def get_user_by_uri(self, *, user_uri: URIRef) -> FoodKgUser: Query the User KG to retrieve a FoodKGUser object with the target URI. :param user_uri...
a14fcf2cafaf26c5bb6396485a16052c6925aa6f
<|skeleton|> class GraphUserKgQueryService: def get_user_by_uri(self, *, user_uri: URIRef) -> FoodKgUser: """Query the User KG to retrieve a FoodKGUser object with the target URI. :param user_uri: the URI of the user to return :return: a FoodKGUser object with the target URI""" <|body_0|> def ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GraphUserKgQueryService: def get_user_by_uri(self, *, user_uri: URIRef) -> FoodKgUser: """Query the User KG to retrieve a FoodKGUser object with the target URI. :param user_uri: the URI of the user to return :return: a FoodKGUser object with the target URI""" res_graph = self.get_cache_graph(s...
the_stack_v2_python_sparse
food_rec/services/user/graph_user_kg_query_service.py
solashirai/FoodRec
train
0
9d1db3091eabbdfdf66e5208a76530a480752331
[ "if not root:\n return None\nbt_root = TreeNode(root.val)\nbt_sub = map(self.encode, root.children)\nif bt_sub:\n for i in range(1, len(bt_sub)):\n bt_sub[i - 1].right = bt_sub[i]\n bt_root.left = bt_sub[0]\nreturn bt_root", "if not data:\n return None\np = data.left\nchildren = []\nwhile p:\n ...
<|body_start_0|> if not root: return None bt_root = TreeNode(root.val) bt_sub = map(self.encode, root.children) if bt_sub: for i in range(1, len(bt_sub)): bt_sub[i - 1].right = bt_sub[i] bt_root.left = bt_sub[0] return bt_root <...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def encode(self, root): """Encodes an n-ary tree to a binary tree. :type root: Node :rtype: TreeNode""" <|body_0|> def decode(self, data): """Decodes your binary tree to an n-ary tree. :type data: TreeNode :rtype: Node""" <|body_1|> <|end_skeleton|> ...
stack_v2_sparse_classes_75kplus_train_073264
1,445
no_license
[ { "docstring": "Encodes an n-ary tree to a binary tree. :type root: Node :rtype: TreeNode", "name": "encode", "signature": "def encode(self, root)" }, { "docstring": "Decodes your binary tree to an n-ary tree. :type data: TreeNode :rtype: Node", "name": "decode", "signature": "def decode...
2
stack_v2_sparse_classes_30k_train_025630
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def encode(self, root): Encodes an n-ary tree to a binary tree. :type root: Node :rtype: TreeNode - def decode(self, data): Decodes your binary tree to an n-ary tree. :type data: TreeN...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def encode(self, root): Encodes an n-ary tree to a binary tree. :type root: Node :rtype: TreeNode - def decode(self, data): Decodes your binary tree to an n-ary tree. :type data: TreeN...
2722c0deafcd094ce64140a9a837b4027d29ed6f
<|skeleton|> class Codec: def encode(self, root): """Encodes an n-ary tree to a binary tree. :type root: Node :rtype: TreeNode""" <|body_0|> def decode(self, data): """Decodes your binary tree to an n-ary tree. :type data: TreeNode :rtype: Node""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Codec: def encode(self, root): """Encodes an n-ary tree to a binary tree. :type root: Node :rtype: TreeNode""" if not root: return None bt_root = TreeNode(root.val) bt_sub = map(self.encode, root.children) if bt_sub: for i in range(1, len(bt_sub)...
the_stack_v2_python_sparse
431_deser_n_ary_bst_h/main.py
chao-shi/lclc
train
0
207c8e986baf711d1a3b1dd3b9bcd225d29f8865
[ "DBFormatter.__init__(self, logger, dbi)\nself.owner = '%s.' % owner if not owner in ('', '__MYSQL__') else ''\nself.sql = 'UPDATE {owner}BLOCKS SET ORIGIN_SITE_NAME = :origin_site_name , LAST_MODIFIED_BY=:myuser,\\nLAST_MODIFICATION_DATE = :mtime where BLOCK_NAME = :block_name'.format(owner=self.owner)", "if not...
<|body_start_0|> DBFormatter.__init__(self, logger, dbi) self.owner = '%s.' % owner if not owner in ('', '__MYSQL__') else '' self.sql = 'UPDATE {owner}BLOCKS SET ORIGIN_SITE_NAME = :origin_site_name , LAST_MODIFIED_BY=:myuser,\nLAST_MODIFICATION_DATE = :mtime where BLOCK_NAME = :block_name'.for...
Block Update Origin Site Name DAO class.
UpdateSiteName
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UpdateSiteName: """Block Update Origin Site Name DAO class.""" def __init__(self, logger, dbi, owner): """Add schema owner and sql.""" <|body_0|> def execute(self, conn, block_name, origin_site_name, transaction=False): """Update origin_site_name for a given bloc...
stack_v2_sparse_classes_75kplus_train_073265
1,348
permissive
[ { "docstring": "Add schema owner and sql.", "name": "__init__", "signature": "def __init__(self, logger, dbi, owner)" }, { "docstring": "Update origin_site_name for a given block_name", "name": "execute", "signature": "def execute(self, conn, block_name, origin_site_name, transaction=Fal...
2
null
Implement the Python class `UpdateSiteName` described below. Class description: Block Update Origin Site Name DAO class. Method signatures and docstrings: - def __init__(self, logger, dbi, owner): Add schema owner and sql. - def execute(self, conn, block_name, origin_site_name, transaction=False): Update origin_site_...
Implement the Python class `UpdateSiteName` described below. Class description: Block Update Origin Site Name DAO class. Method signatures and docstrings: - def __init__(self, logger, dbi, owner): Add schema owner and sql. - def execute(self, conn, block_name, origin_site_name, transaction=False): Update origin_site_...
14df8bbe8ee8f874fe423399b18afef911fe78c7
<|skeleton|> class UpdateSiteName: """Block Update Origin Site Name DAO class.""" def __init__(self, logger, dbi, owner): """Add schema owner and sql.""" <|body_0|> def execute(self, conn, block_name, origin_site_name, transaction=False): """Update origin_site_name for a given bloc...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UpdateSiteName: """Block Update Origin Site Name DAO class.""" def __init__(self, logger, dbi, owner): """Add schema owner and sql.""" DBFormatter.__init__(self, logger, dbi) self.owner = '%s.' % owner if not owner in ('', '__MYSQL__') else '' self.sql = 'UPDATE {owner}BLO...
the_stack_v2_python_sparse
Server/Python/src/dbs/dao/Oracle/Block/UpdateSiteName.py
vkuznet/DBS
train
0
c72a5600552958dbc55f3db8cb20060c991f6e7a
[ "self.probability_distribution = []\ntot = 0\nfor i in range(len(w)):\n tot += w[i]\n self.probability_distribution.append(tot)\nself.tot = tot", "x = random.randint(0, self.tot - 1)\nlo = 0\nhi = len(self.probability_distribution) - 1\nwhile lo + 1 < hi:\n mid = (lo + hi) // 2\n if x >= self.probabil...
<|body_start_0|> self.probability_distribution = [] tot = 0 for i in range(len(w)): tot += w[i] self.probability_distribution.append(tot) self.tot = tot <|end_body_0|> <|body_start_1|> x = random.randint(0, self.tot - 1) lo = 0 hi = len(se...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def __init__(self, w): """:type w: List[int]""" <|body_0|> def pickIndex(self): """:rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.probability_distribution = [] tot = 0 for i in range(len(w)): t...
stack_v2_sparse_classes_75kplus_train_073266
1,644
no_license
[ { "docstring": ":type w: List[int]", "name": "__init__", "signature": "def __init__(self, w)" }, { "docstring": ":rtype: int", "name": "pickIndex", "signature": "def pickIndex(self)" } ]
2
stack_v2_sparse_classes_30k_train_032321
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, w): :type w: List[int] - def pickIndex(self): :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, w): :type w: List[int] - def pickIndex(self): :rtype: int <|skeleton|> class Solution: def __init__(self, w): """:type w: List[int]""" <|...
aac41ddd2ec5f6e5c0f46659696ed5b67769bde2
<|skeleton|> class Solution: def __init__(self, w): """:type w: List[int]""" <|body_0|> def pickIndex(self): """:rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def __init__(self, w): """:type w: List[int]""" self.probability_distribution = [] tot = 0 for i in range(len(w)): tot += w[i] self.probability_distribution.append(tot) self.tot = tot def pickIndex(self): """:rtype: int""" ...
the_stack_v2_python_sparse
random_pick_with_weight.py
aroraakshit/coding_prep
train
8
a858ed5244385c365bf716a1cab15a68c7b681f0
[ "self.__line_ab = line_ab\nself.__ab_slope_value_tracker = ab_val_tracker\nself.__line_cd = line_cd\nself.__cd_slope_value_tracker = cd_val_tracker", "theta_ab = self.__ab_slope_value_tracker.get_value()\ntheta_cd = self.__cd_slope_value_tracker.get_value()\nO_ab = self.__line_ab.get_center()[1]\nO_cd = self.__li...
<|body_start_0|> self.__line_ab = line_ab self.__ab_slope_value_tracker = ab_val_tracker self.__line_cd = line_cd self.__cd_slope_value_tracker = cd_val_tracker <|end_body_0|> <|body_start_1|> theta_ab = self.__ab_slope_value_tracker.get_value() theta_cd = self.__cd_slop...
Intersection point e position updater. The point e is an intersection point on line A'B' and line CD. This follows the a'b's rotation change. Where * the line AB: y = m_ab x + o_ab * the line CD: y = m_cd x + o_cd line AB * m_ab: slope of line AB * O_ab: origin, the center point, of the line segment AB (O_ab_x, O_ab_y,...
Intersection_point_e_updater_by_line_ab_2_rotation
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Intersection_point_e_updater_by_line_ab_2_rotation: """Intersection point e position updater. The point e is an intersection point on line A'B' and line CD. This follows the a'b's rotation change. Where * the line AB: y = m_ab x + o_ab * the line CD: y = m_cd x + o_cd line AB * m_ab: slope of lin...
stack_v2_sparse_classes_75kplus_train_073267
28,855
permissive
[ { "docstring": "param[in] line_ab line AB param[in] ab_val_tracker line AB's slope angle value tracker param[in] line_cd line CD param[in] cd_val_tracker line CD's slope angle value tracker", "name": "__init__", "signature": "def __init__(self, line_ab, ab_val_tracker, line_cd, cd_val_tracker)" }, {...
2
stack_v2_sparse_classes_30k_train_032990
Implement the Python class `Intersection_point_e_updater_by_line_ab_2_rotation` described below. Class description: Intersection point e position updater. The point e is an intersection point on line A'B' and line CD. This follows the a'b's rotation change. Where * the line AB: y = m_ab x + o_ab * the line CD: y = m_c...
Implement the Python class `Intersection_point_e_updater_by_line_ab_2_rotation` described below. Class description: Intersection point e position updater. The point e is an intersection point on line A'B' and line CD. This follows the a'b's rotation change. Where * the line AB: y = m_ab x + o_ab * the line CD: y = m_c...
ff8b30ff6b6a8ea746e6739ac170784a08491e7a
<|skeleton|> class Intersection_point_e_updater_by_line_ab_2_rotation: """Intersection point e position updater. The point e is an intersection point on line A'B' and line CD. This follows the a'b's rotation change. Where * the line AB: y = m_ab x + o_ab * the line CD: y = m_cd x + o_cd line AB * m_ab: slope of lin...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Intersection_point_e_updater_by_line_ab_2_rotation: """Intersection point e position updater. The point e is an intersection point on line A'B' and line CD. This follows the a'b's rotation change. Where * the line AB: y = m_ab x + o_ab * the line CD: y = m_cd x + o_cd line AB * m_ab: slope of line AB * O_ab: ...
the_stack_v2_python_sparse
202008_corner_cube_mirror/03_corresponding_angles.py
yamauchih/3b1b_manim_examples
train
1
8596fb43811289c36edd8bd6d2207e30107bd590
[ "result = super(self.__class__, self).is_valid()\nif result:\n if not Foto.objects.filter(id=self.cleaned_data['foto_id']):\n result = False\nreturn result", "for f in os.listdir(dir):\n if re.search(re_exp, f):\n os.remove(os.path.join(dir, f))\nreturn self", "foto = Foto.objects.get(id=sel...
<|body_start_0|> result = super(self.__class__, self).is_valid() if result: if not Foto.objects.filter(id=self.cleaned_data['foto_id']): result = False return result <|end_body_0|> <|body_start_1|> for f in os.listdir(dir): if re.search(re_exp, f)...
DeletePhotoForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeletePhotoForm: def is_valid(self, user): """Verifica que el id no haya sido alterado y que este dentro del rango de fotos""" <|body_0|> def delete_thumbnails_files(self, re_exp, dir): """Borra los archivos thumbnails que cumplen con la expresion regular re_exp y qu...
stack_v2_sparse_classes_75kplus_train_073268
29,716
no_license
[ { "docstring": "Verifica que el id no haya sido alterado y que este dentro del rango de fotos", "name": "is_valid", "signature": "def is_valid(self, user)" }, { "docstring": "Borra los archivos thumbnails que cumplen con la expresion regular re_exp y que estan dentro del path dir", "name": "...
3
stack_v2_sparse_classes_30k_train_047333
Implement the Python class `DeletePhotoForm` described below. Class description: Implement the DeletePhotoForm class. Method signatures and docstrings: - def is_valid(self, user): Verifica que el id no haya sido alterado y que este dentro del rango de fotos - def delete_thumbnails_files(self, re_exp, dir): Borra los ...
Implement the Python class `DeletePhotoForm` described below. Class description: Implement the DeletePhotoForm class. Method signatures and docstrings: - def is_valid(self, user): Verifica que el id no haya sido alterado y que este dentro del rango de fotos - def delete_thumbnails_files(self, re_exp, dir): Borra los ...
a68d39a3e3b93c0b81f2893d61773b5a6453d108
<|skeleton|> class DeletePhotoForm: def is_valid(self, user): """Verifica que el id no haya sido alterado y que este dentro del rango de fotos""" <|body_0|> def delete_thumbnails_files(self, re_exp, dir): """Borra los archivos thumbnails que cumplen con la expresion regular re_exp y qu...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DeletePhotoForm: def is_valid(self, user): """Verifica que el id no haya sido alterado y que este dentro del rango de fotos""" result = super(self.__class__, self).is_valid() if result: if not Foto.objects.filter(id=self.cleaned_data['foto_id']): result = Fa...
the_stack_v2_python_sparse
fotos/forms.py
ljarufe/mp100
train
0
41145683fe5c34069af48a96205796310aa0123c
[ "ret_data = []\ncomment_reply = await self.application.objects.execute(PostComment.extend().where(PostComment.parent_comment_id == int(comment_id)))\nfor item in comment_reply:\n item_dict = {'user': model_to_dict(item.user), 'content': item.content, 'reply_nums': item.reply_nums, 'add_time': item.add_time.strft...
<|body_start_0|> ret_data = [] comment_reply = await self.application.objects.execute(PostComment.extend().where(PostComment.parent_comment_id == int(comment_id))) for item in comment_reply: item_dict = {'user': model_to_dict(item.user), 'content': item.content, 'reply_nums': item.re...
获取评论的回复评论,回复评论
CommentReplyHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CommentReplyHandler: """获取评论的回复评论,回复评论""" async def get(self, comment_id, *args, **kwargs): """获取评论回复 :param comment_id: :param args: :param kwargs: :return:""" <|body_0|> async def post(self, comment_id, *args, **kwargs): """回复评论 :param comment_id: 被回复评论id :para...
stack_v2_sparse_classes_75kplus_train_073269
16,600
no_license
[ { "docstring": "获取评论回复 :param comment_id: :param args: :param kwargs: :return:", "name": "get", "signature": "async def get(self, comment_id, *args, **kwargs)" }, { "docstring": "回复评论 :param comment_id: 被回复评论id :param args: :param kwargs: :return:", "name": "post", "signature": "async de...
2
stack_v2_sparse_classes_30k_train_010082
Implement the Python class `CommentReplyHandler` described below. Class description: 获取评论的回复评论,回复评论 Method signatures and docstrings: - async def get(self, comment_id, *args, **kwargs): 获取评论回复 :param comment_id: :param args: :param kwargs: :return: - async def post(self, comment_id, *args, **kwargs): 回复评论 :param comm...
Implement the Python class `CommentReplyHandler` described below. Class description: 获取评论的回复评论,回复评论 Method signatures and docstrings: - async def get(self, comment_id, *args, **kwargs): 获取评论回复 :param comment_id: :param args: :param kwargs: :return: - async def post(self, comment_id, *args, **kwargs): 回复评论 :param comm...
7ae3bfaef5bffa366ebe11d7af0111a5988bba64
<|skeleton|> class CommentReplyHandler: """获取评论的回复评论,回复评论""" async def get(self, comment_id, *args, **kwargs): """获取评论回复 :param comment_id: :param args: :param kwargs: :return:""" <|body_0|> async def post(self, comment_id, *args, **kwargs): """回复评论 :param comment_id: 被回复评论id :para...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CommentReplyHandler: """获取评论的回复评论,回复评论""" async def get(self, comment_id, *args, **kwargs): """获取评论回复 :param comment_id: :param args: :param kwargs: :return:""" ret_data = [] comment_reply = await self.application.objects.execute(PostComment.extend().where(PostComment.parent_comme...
the_stack_v2_python_sparse
Q&A_site/apps/community/handler.py
miniYYan/tornado_web
train
0
6aecd5dabb578f3374ae5c7f8842b28054c7c5da
[ "self.workflow = kwargs.pop('workflow', None)\nsuper().__init__(*args, **kwargs)\nself.set_fields_from_dict(['name', 'description_text', 'execute', 'frequency', 'execute_until'])\nself.fields['execute'].initial = parse_datetime(self.get_payload_field('execute', ''))\nself.fields['execute_until'].initial = parse_dat...
<|body_start_0|> self.workflow = kwargs.pop('workflow', None) super().__init__(*args, **kwargs) self.set_fields_from_dict(['name', 'description_text', 'execute', 'frequency', 'execute_until']) self.fields['execute'].initial = parse_datetime(self.get_payload_field('execute', '')) ...
Form to create/edit objects of the ScheduleAction. To be used for the various types of actions.
ScheduleBasicForm
[ "LGPL-2.0-or-later", "BSD-3-Clause", "MIT", "Apache-2.0", "LGPL-2.1-only", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ScheduleBasicForm: """Form to create/edit objects of the ScheduleAction. To be used for the various types of actions.""" def __init__(self, *args, **kwargs): """Set item_column values.""" <|body_0|> def clean(self) -> Dict: """Verify that the date is correct.""" ...
stack_v2_sparse_classes_75kplus_train_073270
3,761
permissive
[ { "docstring": "Set item_column values.", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Verify that the date is correct.", "name": "clean", "signature": "def clean(self) -> Dict" } ]
2
null
Implement the Python class `ScheduleBasicForm` described below. Class description: Form to create/edit objects of the ScheduleAction. To be used for the various types of actions. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Set item_column values. - def clean(self) -> Dict: Verify that the...
Implement the Python class `ScheduleBasicForm` described below. Class description: Form to create/edit objects of the ScheduleAction. To be used for the various types of actions. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Set item_column values. - def clean(self) -> Dict: Verify that the...
c432745dfff932cbe7397100422d49df78f0a882
<|skeleton|> class ScheduleBasicForm: """Form to create/edit objects of the ScheduleAction. To be used for the various types of actions.""" def __init__(self, *args, **kwargs): """Set item_column values.""" <|body_0|> def clean(self) -> Dict: """Verify that the date is correct.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ScheduleBasicForm: """Form to create/edit objects of the ScheduleAction. To be used for the various types of actions.""" def __init__(self, *args, **kwargs): """Set item_column values.""" self.workflow = kwargs.pop('workflow', None) super().__init__(*args, **kwargs) self.s...
the_stack_v2_python_sparse
ontask/scheduler/forms/basic.py
abelardopardo/ontask_b
train
43
643d6fbe3097285cdf4be092dca634bced9bd6bc
[ "fpath = opj(self.ds.path, DATASET_METADATA_FILE)\nobj = {}\nif exists(fpath):\n obj = jsonload(fpath, fixup=True)\nif 'definition' in obj:\n obj['@context'] = obj['definition']\n del obj['definition']\nobj['@id'] = self.ds.id\nsubdsinfo = [{'type': sds['type'], 'name': sds['gitmodule_name']} for sds in su...
<|body_start_0|> fpath = opj(self.ds.path, DATASET_METADATA_FILE) obj = {} if exists(fpath): obj = jsonload(fpath, fixup=True) if 'definition' in obj: obj['@context'] = obj['definition'] del obj['definition'] obj['@id'] = self.ds.id sub...
DataladCoreMetadataExtractor
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataladCoreMetadataExtractor: def _get_dataset_metadata(self): """Returns ------- dict keys are homogenized datalad metadata keys, values are arbitrary""" <|body_0|> def _get_content_metadata(self): """Get ALL metadata for all dataset content. Returns ------- generat...
stack_v2_sparse_classes_75kplus_train_073271
4,814
permissive
[ { "docstring": "Returns ------- dict keys are homogenized datalad metadata keys, values are arbitrary", "name": "_get_dataset_metadata", "signature": "def _get_dataset_metadata(self)" }, { "docstring": "Get ALL metadata for all dataset content. Returns ------- generator((location, metadata_dict)...
2
stack_v2_sparse_classes_30k_train_039289
Implement the Python class `DataladCoreMetadataExtractor` described below. Class description: Implement the DataladCoreMetadataExtractor class. Method signatures and docstrings: - def _get_dataset_metadata(self): Returns ------- dict keys are homogenized datalad metadata keys, values are arbitrary - def _get_content_...
Implement the Python class `DataladCoreMetadataExtractor` described below. Class description: Implement the DataladCoreMetadataExtractor class. Method signatures and docstrings: - def _get_dataset_metadata(self): Returns ------- dict keys are homogenized datalad metadata keys, values are arbitrary - def _get_content_...
c0d5ff8757bffba6ccb237b47b1994339e4d49e1
<|skeleton|> class DataladCoreMetadataExtractor: def _get_dataset_metadata(self): """Returns ------- dict keys are homogenized datalad metadata keys, values are arbitrary""" <|body_0|> def _get_content_metadata(self): """Get ALL metadata for all dataset content. Returns ------- generat...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DataladCoreMetadataExtractor: def _get_dataset_metadata(self): """Returns ------- dict keys are homogenized datalad metadata keys, values are arbitrary""" fpath = opj(self.ds.path, DATASET_METADATA_FILE) obj = {} if exists(fpath): obj = jsonload(fpath, fixup=True) ...
the_stack_v2_python_sparse
datalad_metalad/extractors/legacy/datalad_core.py
datalad/datalad-metalad
train
10
5b098b0dffdc9364717ae53978dc471f1a595efd
[ "super().__init__(config, vocab)\nself.config.setdefault('word_threshold', 0.1)\nif '_' not in vocab:\n self.vocab = vocab.copy()\n self.vocab.append('_')\nself.reset()", "text = []\nprob = 1.0\nprobs = []\nfor i in range(logits.shape[0]):\n argmax = np.argmax(logits[i])\n text.append(self.vocab[argma...
<|body_start_0|> super().__init__(config, vocab) self.config.setdefault('word_threshold', 0.1) if '_' not in vocab: self.vocab = vocab.copy() self.vocab.append('_') self.reset() <|end_body_0|> <|body_start_1|> text = [] prob = 1.0 probs = ...
CTC greedy decoder that simply chooses the highest-probability logits.
CTCGreedyDecoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CTCGreedyDecoder: """CTC greedy decoder that simply chooses the highest-probability logits.""" def __init__(self, config, vocab): """Create a new CTCGreedyDecoder. TODO document config. See CTCDecoder.from_config() to automatically create the correct type of instance dependening on c...
stack_v2_sparse_classes_75kplus_train_073272
5,274
no_license
[ { "docstring": "Create a new CTCGreedyDecoder. TODO document config. See CTCDecoder.from_config() to automatically create the correct type of instance dependening on config.", "name": "__init__", "signature": "def __init__(self, config, vocab)" }, { "docstring": "Decode logits into words, and me...
4
stack_v2_sparse_classes_30k_val_000430
Implement the Python class `CTCGreedyDecoder` described below. Class description: CTC greedy decoder that simply chooses the highest-probability logits. Method signatures and docstrings: - def __init__(self, config, vocab): Create a new CTCGreedyDecoder. TODO document config. See CTCDecoder.from_config() to automatic...
Implement the Python class `CTCGreedyDecoder` described below. Class description: CTC greedy decoder that simply chooses the highest-probability logits. Method signatures and docstrings: - def __init__(self, config, vocab): Create a new CTCGreedyDecoder. TODO document config. See CTCDecoder.from_config() to automatic...
1938da6661e33b2e56846d8df9cce83c9353b233
<|skeleton|> class CTCGreedyDecoder: """CTC greedy decoder that simply chooses the highest-probability logits.""" def __init__(self, config, vocab): """Create a new CTCGreedyDecoder. TODO document config. See CTCDecoder.from_config() to automatically create the correct type of instance dependening on c...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CTCGreedyDecoder: """CTC greedy decoder that simply chooses the highest-probability logits.""" def __init__(self, config, vocab): """Create a new CTCGreedyDecoder. TODO document config. See CTCDecoder.from_config() to automatically create the correct type of instance dependening on config.""" ...
the_stack_v2_python_sparse
jetson_voice/models/asr/ctc_greedy.py
Barleysack/jetson-voice
train
0
ba008f71ec629db5107a315f0747981d2faac79c
[ "self.ID = trial_nr\nself.bar_pass_direction_at_TR = bar_pass_direction_at_TR\nself.bar_midpoint_at_TR = bar_midpoint_at_TR\nself.session = session\nself.phase_durations = phase_durations\nself.phase_names = phase_names\nsuper().__init__(session, trial_nr, phase_durations, phase_names, *args, verbose=False, **kwarg...
<|body_start_0|> self.ID = trial_nr self.bar_pass_direction_at_TR = bar_pass_direction_at_TR self.bar_midpoint_at_TR = bar_midpoint_at_TR self.session = session self.phase_durations = phase_durations self.phase_names = phase_names super().__init__(session, trial_n...
PRFTrial
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PRFTrial: def __init__(self, session, trial_nr, bar_pass_direction_at_TR, bar_midpoint_at_TR, phase_durations, phase_names, timing='seconds', *args, **kwargs): """Initializes a PRFTrial object. Parameters ---------- session : exptools Session object A Session object (needed for metadata)...
stack_v2_sparse_classes_75kplus_train_073273
20,707
no_license
[ { "docstring": "Initializes a PRFTrial object. Parameters ---------- session : exptools Session object A Session object (needed for metadata) trial_nr: int Trial nr of trial phase_durations : array-like List/tuple/array with phase durations phase_names : array-like List/tuple/array with names for phases (only f...
3
stack_v2_sparse_classes_30k_train_036170
Implement the Python class `PRFTrial` described below. Class description: Implement the PRFTrial class. Method signatures and docstrings: - def __init__(self, session, trial_nr, bar_pass_direction_at_TR, bar_midpoint_at_TR, phase_durations, phase_names, timing='seconds', *args, **kwargs): Initializes a PRFTrial objec...
Implement the Python class `PRFTrial` described below. Class description: Implement the PRFTrial class. Method signatures and docstrings: - def __init__(self, session, trial_nr, bar_pass_direction_at_TR, bar_midpoint_at_TR, phase_durations, phase_names, timing='seconds', *args, **kwargs): Initializes a PRFTrial objec...
41fd68e93607570c2f71c33cf1d8bce609b229bf
<|skeleton|> class PRFTrial: def __init__(self, session, trial_nr, bar_pass_direction_at_TR, bar_midpoint_at_TR, phase_durations, phase_names, timing='seconds', *args, **kwargs): """Initializes a PRFTrial object. Parameters ---------- session : exptools Session object A Session object (needed for metadata)...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PRFTrial: def __init__(self, session, trial_nr, bar_pass_direction_at_TR, bar_midpoint_at_TR, phase_durations, phase_names, timing='seconds', *args, **kwargs): """Initializes a PRFTrial object. Parameters ---------- session : exptools Session object A Session object (needed for metadata) trial_nr: int...
the_stack_v2_python_sparse
experiment/trial.py
iverissimo/feature_attention_mapping
train
0
caf207926993d2d7e551eb793446fb962794c086
[ "method = '/cluster/member/add'\ndata = {'peerURLs': peerURLs}\nreturn self.call_rpc(method, data=data)", "method = '/cluster/member/list'\ndata = {}\nreturn self.call_rpc(method, data=data)", "method = '/cluster/member/remove'\ndata = {'ID': ID}\nreturn self.call_rpc(method, data=data)", "method = '/cluster/...
<|body_start_0|> method = '/cluster/member/add' data = {'peerURLs': peerURLs} return self.call_rpc(method, data=data) <|end_body_0|> <|body_start_1|> method = '/cluster/member/list' data = {} return self.call_rpc(method, data=data) <|end_body_1|> <|body_start_2|> ...
ClusterAPI
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClusterAPI: def member_add(self, peerURLs): """MemberAdd adds a member into the cluster. :type peerURLs: list of str :param peerURLs: peerURLs is the list of URLs the added member will use to communicate with the cluster.""" <|body_0|> def member_list(self): """Membe...
stack_v2_sparse_classes_75kplus_train_073274
1,556
permissive
[ { "docstring": "MemberAdd adds a member into the cluster. :type peerURLs: list of str :param peerURLs: peerURLs is the list of URLs the added member will use to communicate with the cluster.", "name": "member_add", "signature": "def member_add(self, peerURLs)" }, { "docstring": "MemberList lists...
4
stack_v2_sparse_classes_30k_val_002209
Implement the Python class `ClusterAPI` described below. Class description: Implement the ClusterAPI class. Method signatures and docstrings: - def member_add(self, peerURLs): MemberAdd adds a member into the cluster. :type peerURLs: list of str :param peerURLs: peerURLs is the list of URLs the added member will use ...
Implement the Python class `ClusterAPI` described below. Class description: Implement the ClusterAPI class. Method signatures and docstrings: - def member_add(self, peerURLs): MemberAdd adds a member into the cluster. :type peerURLs: list of str :param peerURLs: peerURLs is the list of URLs the added member will use ...
deea4583c2e61a7d8af58c8790d4fa50cf602544
<|skeleton|> class ClusterAPI: def member_add(self, peerURLs): """MemberAdd adds a member into the cluster. :type peerURLs: list of str :param peerURLs: peerURLs is the list of URLs the added member will use to communicate with the cluster.""" <|body_0|> def member_list(self): """Membe...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ClusterAPI: def member_add(self, peerURLs): """MemberAdd adds a member into the cluster. :type peerURLs: list of str :param peerURLs: peerURLs is the list of URLs the added member will use to communicate with the cluster.""" method = '/cluster/member/add' data = {'peerURLs': peerURLs} ...
the_stack_v2_python_sparse
etcd3/apis/cluster.py
Revolution1/etcd3-py
train
106
100e6d9a0609147cdc94f186222bf9bb6d58c69d
[ "self.Init = True\nself.mapServices = {}\nself.mutex = RLock()", "debug('ServiceManager::Run')\nwith self.mutex:\n output, returnCode = executeCommand('service --status-all')\n servicesList = output.split('\\n')\n service_names = []\n for line in servicesList:\n splitLine = line.strip().split('...
<|body_start_0|> self.Init = True self.mapServices = {} self.mutex = RLock() <|end_body_0|> <|body_start_1|> debug('ServiceManager::Run') with self.mutex: output, returnCode = executeCommand('service --status-all') servicesList = output.split('\n') ...
Class for retrieving service info and managing services
ServiceManager
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ServiceManager: """Class for retrieving service info and managing services""" def __init__(self): """Initialize service info""" <|body_0|> def Run(self): """Get info about services""" <|body_1|> def GetServiceList(self): """Return list of ser...
stack_v2_sparse_classes_75kplus_train_073275
8,931
permissive
[ { "docstring": "Initialize service info", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Get info about services", "name": "Run", "signature": "def Run(self)" }, { "docstring": "Return list of services", "name": "GetServiceList", "signature": "de...
6
stack_v2_sparse_classes_30k_train_021916
Implement the Python class `ServiceManager` described below. Class description: Class for retrieving service info and managing services Method signatures and docstrings: - def __init__(self): Initialize service info - def Run(self): Get info about services - def GetServiceList(self): Return list of services - def Sta...
Implement the Python class `ServiceManager` described below. Class description: Class for retrieving service info and managing services Method signatures and docstrings: - def __init__(self): Initialize service info - def Run(self): Get info about services - def GetServiceList(self): Return list of services - def Sta...
4fa4360d0c05dbbb65bd53cca0ca1014fcd45071
<|skeleton|> class ServiceManager: """Class for retrieving service info and managing services""" def __init__(self): """Initialize service info""" <|body_0|> def Run(self): """Get info about services""" <|body_1|> def GetServiceList(self): """Return list of ser...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ServiceManager: """Class for retrieving service info and managing services""" def __init__(self): """Initialize service info""" self.Init = True self.mapServices = {} self.mutex = RLock() def Run(self): """Get info about services""" debug('ServiceManag...
the_stack_v2_python_sparse
myDevices/system/services.py
myDevicesIoT/Cayenne-Agent
train
21
a08ea37da9983e7a0f878a6033468aeb6e238d9e
[ "super().__init__(**kwargs)\ncs_dict = _get_driver_settings(self.CONFIG_NAME, self._ALT_CONFIG_NAMES, instance)\nself.cloud = cs_dict.pop('cloud', 'global')\nif 'cloud' in kwargs and kwargs['cloud']:\n self.cloud = kwargs['cloud']\napi_uri, oauth_uri, api_suffix = _select_api_uris(self.data_environment, self.clo...
<|body_start_0|> super().__init__(**kwargs) cs_dict = _get_driver_settings(self.CONFIG_NAME, self._ALT_CONFIG_NAMES, instance) self.cloud = cs_dict.pop('cloud', 'global') if 'cloud' in kwargs and kwargs['cloud']: self.cloud = kwargs['cloud'] api_uri, oauth_uri, api_su...
KqlDriver class to retreive date from MS Defender APIs.
MDATPDriver
[ "LicenseRef-scancode-generic-cla", "MIT", "LGPL-3.0-only", "LGPL-2.0-or-later", "BSD-3-Clause", "LicenseRef-scancode-free-unknown", "EPL-1.0", "GPL-1.0-or-later", "LGPL-2.1-only", "MPL-2.0", "Python-2.0", "PSF-2.0", "LicenseRef-scancode-python-cwi", "GPL-2.0-or-later", "LGPL-2.1-or-later...
stack_v2_sparse_python_classes_v1
<|skeleton|> class MDATPDriver: """KqlDriver class to retreive date from MS Defender APIs.""" def __init__(self, connection_str: str=None, instance: str='Default', **kwargs): """Instantiate MSDefenderDriver and optionally connect. Parameters ---------- connection_str : str, optional Connection string i...
stack_v2_sparse_classes_75kplus_train_073276
4,334
permissive
[ { "docstring": "Instantiate MSDefenderDriver and optionally connect. Parameters ---------- connection_str : str, optional Connection string instance : str, optional The instance name from config to use", "name": "__init__", "signature": "def __init__(self, connection_str: str=None, instance: str='Defaul...
2
stack_v2_sparse_classes_30k_train_008292
Implement the Python class `MDATPDriver` described below. Class description: KqlDriver class to retreive date from MS Defender APIs. Method signatures and docstrings: - def __init__(self, connection_str: str=None, instance: str='Default', **kwargs): Instantiate MSDefenderDriver and optionally connect. Parameters ----...
Implement the Python class `MDATPDriver` described below. Class description: KqlDriver class to retreive date from MS Defender APIs. Method signatures and docstrings: - def __init__(self, connection_str: str=None, instance: str='Default', **kwargs): Instantiate MSDefenderDriver and optionally connect. Parameters ----...
55c6c1aebb8505a220046705b7c74194f83d62f3
<|skeleton|> class MDATPDriver: """KqlDriver class to retreive date from MS Defender APIs.""" def __init__(self, connection_str: str=None, instance: str='Default', **kwargs): """Instantiate MSDefenderDriver and optionally connect. Parameters ---------- connection_str : str, optional Connection string i...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MDATPDriver: """KqlDriver class to retreive date from MS Defender APIs.""" def __init__(self, connection_str: str=None, instance: str='Default', **kwargs): """Instantiate MSDefenderDriver and optionally connect. Parameters ---------- connection_str : str, optional Connection string instance : str...
the_stack_v2_python_sparse
msticpy/data/drivers/mdatp_driver.py
rhaug77/msticpy
train
0
6c62dc0a60c54cf5c3ec38c3c43b02ee80434a9a
[ "vms = list(VirtualMachine.objects.values_list('name', flat=True))\nsuccess = 0\npuppetdb_isvirtual = self._get_puppetdb_fact('is_virtual')\nfor device, is_virtual in puppetdb_isvirtual.items():\n if not is_virtual:\n continue\n if device not in vms:\n self.log_failure(None, f'missing VM from Ne...
<|body_start_0|> vms = list(VirtualMachine.objects.values_list('name', flat=True)) success = 0 puppetdb_isvirtual = self._get_puppetdb_fact('is_virtual') for device, is_virtual in puppetdb_isvirtual.items(): if not is_virtual: continue if device no...
Report parity errors between PuppetDB and Netbox for Virtual Machines.
VirtualMachines
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VirtualMachines: """Report parity errors between PuppetDB and Netbox for Virtual Machines.""" def test_puppetdb_vms_in_netbox(self): """Check that all PuppetDB VMs are in Netbox VMs.""" <|body_0|> def test_netbox_vms_in_puppetdb(self): """Check that all Netbox VM...
stack_v2_sparse_classes_75kplus_train_073277
7,320
permissive
[ { "docstring": "Check that all PuppetDB VMs are in Netbox VMs.", "name": "test_puppetdb_vms_in_netbox", "signature": "def test_puppetdb_vms_in_netbox(self)" }, { "docstring": "Check that all Netbox VMs are in PuppetDB VMs.", "name": "test_netbox_vms_in_puppetdb", "signature": "def test_n...
2
stack_v2_sparse_classes_30k_train_019127
Implement the Python class `VirtualMachines` described below. Class description: Report parity errors between PuppetDB and Netbox for Virtual Machines. Method signatures and docstrings: - def test_puppetdb_vms_in_netbox(self): Check that all PuppetDB VMs are in Netbox VMs. - def test_netbox_vms_in_puppetdb(self): Che...
Implement the Python class `VirtualMachines` described below. Class description: Report parity errors between PuppetDB and Netbox for Virtual Machines. Method signatures and docstrings: - def test_puppetdb_vms_in_netbox(self): Check that all PuppetDB VMs are in Netbox VMs. - def test_netbox_vms_in_puppetdb(self): Che...
0e58c08f75bb6fb17c2ce32eba6b49947c811dae
<|skeleton|> class VirtualMachines: """Report parity errors between PuppetDB and Netbox for Virtual Machines.""" def test_puppetdb_vms_in_netbox(self): """Check that all PuppetDB VMs are in Netbox VMs.""" <|body_0|> def test_netbox_vms_in_puppetdb(self): """Check that all Netbox VM...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class VirtualMachines: """Report parity errors between PuppetDB and Netbox for Virtual Machines.""" def test_puppetdb_vms_in_netbox(self): """Check that all PuppetDB VMs are in Netbox VMs.""" vms = list(VirtualMachine.objects.values_list('name', flat=True)) success = 0 puppetdb_...
the_stack_v2_python_sparse
reports/puppetdb.py
wikimedia/operations-software-netbox-extras
train
7
8413c7900431e3b091ada29df856f930bc0f374b
[ "prices = []\nfor i, pair in enumerate(costs):\n prices.append((abs(costs[i][1] - costs[i][0]), i))\ncity1_max, city2_max = (len(costs) / 2, len(costs) / 2)\ntotal_cost = 0\nfor price in sorted(prices, reverse=True):\n i = price[1]\n flight1 = costs[i][0]\n flight2 = costs[i][1]\n if city1_max and ci...
<|body_start_0|> prices = [] for i, pair in enumerate(costs): prices.append((abs(costs[i][1] - costs[i][0]), i)) city1_max, city2_max = (len(costs) / 2, len(costs) / 2) total_cost = 0 for price in sorted(prices, reverse=True): i = price[1] flig...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def twoCitySchedCost(self, costs): """:type costs: List[List[int]] :rtype: int""" <|body_0|> def twoCitySchedCost(self, costs): """:type costs: List[List[int]] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> prices = [] ...
stack_v2_sparse_classes_75kplus_train_073278
2,390
no_license
[ { "docstring": ":type costs: List[List[int]] :rtype: int", "name": "twoCitySchedCost", "signature": "def twoCitySchedCost(self, costs)" }, { "docstring": ":type costs: List[List[int]] :rtype: int", "name": "twoCitySchedCost", "signature": "def twoCitySchedCost(self, costs)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def twoCitySchedCost(self, costs): :type costs: List[List[int]] :rtype: int - def twoCitySchedCost(self, costs): :type costs: List[List[int]] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def twoCitySchedCost(self, costs): :type costs: List[List[int]] :rtype: int - def twoCitySchedCost(self, costs): :type costs: List[List[int]] :rtype: int <|skeleton|> class Solu...
844f502da4d6fb9cd69cf0a1ef71da3385a4d2b4
<|skeleton|> class Solution: def twoCitySchedCost(self, costs): """:type costs: List[List[int]] :rtype: int""" <|body_0|> def twoCitySchedCost(self, costs): """:type costs: List[List[int]] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def twoCitySchedCost(self, costs): """:type costs: List[List[int]] :rtype: int""" prices = [] for i, pair in enumerate(costs): prices.append((abs(costs[i][1] - costs[i][0]), i)) city1_max, city2_max = (len(costs) / 2, len(costs) / 2) total_cost = 0...
the_stack_v2_python_sparse
1029-two_city_scheduling.py
stevestar888/leetcode-problems
train
2
85adb625b5050f6939e0e0611478cbe599c34d21
[ "def flatten_(root):\n if not root:\n return (None, None)\n t = root\n hl, tl = flatten_(root.left)\n hr, tr = flatten_(root.right)\n if hl:\n root.right = hl\n t = tl\n if hr:\n t.right = hr\n t = tr\n root.left = None\n return (root, t)\nflatten_(root)\nr...
<|body_start_0|> def flatten_(root): if not root: return (None, None) t = root hl, tl = flatten_(root.left) hr, tr = flatten_(root.right) if hl: root.right = hl t = tl if hr: t...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def flatten(self, root): """05/07/2018 14:19""" <|body_0|> def flatten(self, root: TreeNode) -> None: """05/27/2021 06:25""" <|body_1|> def flatten(self, root: Optional[TreeNode]) -> None: """08/06/2022 22:42""" <|body_2|> <|en...
stack_v2_sparse_classes_75kplus_train_073279
3,446
no_license
[ { "docstring": "05/07/2018 14:19", "name": "flatten", "signature": "def flatten(self, root)" }, { "docstring": "05/27/2021 06:25", "name": "flatten", "signature": "def flatten(self, root: TreeNode) -> None" }, { "docstring": "08/06/2022 22:42", "name": "flatten", "signatu...
3
stack_v2_sparse_classes_30k_train_035180
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def flatten(self, root): 05/07/2018 14:19 - def flatten(self, root: TreeNode) -> None: 05/27/2021 06:25 - def flatten(self, root: Optional[TreeNode]) -> None: 08/06/2022 22:42
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def flatten(self, root): 05/07/2018 14:19 - def flatten(self, root: TreeNode) -> None: 05/27/2021 06:25 - def flatten(self, root: Optional[TreeNode]) -> None: 08/06/2022 22:42 <...
1389a009a02e90e8700a7a00e0b7f797c129cdf4
<|skeleton|> class Solution: def flatten(self, root): """05/07/2018 14:19""" <|body_0|> def flatten(self, root: TreeNode) -> None: """05/27/2021 06:25""" <|body_1|> def flatten(self, root: Optional[TreeNode]) -> None: """08/06/2022 22:42""" <|body_2|> <|en...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def flatten(self, root): """05/07/2018 14:19""" def flatten_(root): if not root: return (None, None) t = root hl, tl = flatten_(root.left) hr, tr = flatten_(root.right) if hl: root.right = hl ...
the_stack_v2_python_sparse
leetcode/solved/114_Flatten_Binary_Tree_to_Linked_List/solution.py
sungminoh/algorithms
train
0
5e16931af8c0104e94532c897d9043652f1c3ae4
[ "super(Bottleneck, self).__init__()\nplanes = expansion * growthRate\nself.conv1 = ConvBNReLU(inplanes, planes, kernel_size=1)\nself.conv2 = ConvBNReLU(planes, growthRate, kernel_size=3)\nself.efficient = efficient", "concated_features = torch.cat(features, 1)\nbottleneck_output = self.conv1(concated_features)\nr...
<|body_start_0|> super(Bottleneck, self).__init__() planes = expansion * growthRate self.conv1 = ConvBNReLU(inplanes, planes, kernel_size=1) self.conv2 = ConvBNReLU(planes, growthRate, kernel_size=3) self.efficient = efficient <|end_body_0|> <|body_start_1|> concated_fea...
Bottleneck block for DenseNet.
Bottleneck
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Bottleneck: """Bottleneck block for DenseNet.""" def __init__(self, inplanes: int, expansion: int, growthRate: int, efficient: bool) -> None: """Initialize.""" <|body_0|> def _expand(self, *features: torch.Tensor) -> torch.Tensor: """Bottleneck foward function.""...
stack_v2_sparse_classes_75kplus_train_073280
5,614
permissive
[ { "docstring": "Initialize.", "name": "__init__", "signature": "def __init__(self, inplanes: int, expansion: int, growthRate: int, efficient: bool) -> None" }, { "docstring": "Bottleneck foward function.", "name": "_expand", "signature": "def _expand(self, *features: torch.Tensor) -> tor...
3
stack_v2_sparse_classes_30k_train_039469
Implement the Python class `Bottleneck` described below. Class description: Bottleneck block for DenseNet. Method signatures and docstrings: - def __init__(self, inplanes: int, expansion: int, growthRate: int, efficient: bool) -> None: Initialize. - def _expand(self, *features: torch.Tensor) -> torch.Tensor: Bottlene...
Implement the Python class `Bottleneck` described below. Class description: Bottleneck block for DenseNet. Method signatures and docstrings: - def __init__(self, inplanes: int, expansion: int, growthRate: int, efficient: bool) -> None: Initialize. - def _expand(self, *features: torch.Tensor) -> torch.Tensor: Bottlene...
88bcff70e93dd68058a5cf0dfeac119a57abc6de
<|skeleton|> class Bottleneck: """Bottleneck block for DenseNet.""" def __init__(self, inplanes: int, expansion: int, growthRate: int, efficient: bool) -> None: """Initialize.""" <|body_0|> def _expand(self, *features: torch.Tensor) -> torch.Tensor: """Bottleneck foward function.""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Bottleneck: """Bottleneck block for DenseNet.""" def __init__(self, inplanes: int, expansion: int, growthRate: int, efficient: bool) -> None: """Initialize.""" super(Bottleneck, self).__init__() planes = expansion * growthRate self.conv1 = ConvBNReLU(inplanes, planes, kern...
the_stack_v2_python_sparse
src/models/densenet.py
scott-mao/DenseDepth_Pruning
train
1
95d76f3adc9cde5140c1759f6b2c72ac92f9cea5
[ "results = search_fn(species=species, locations=locations, inlet=inlet, instrument=instrument, start_datetime=start_datetime, end_datetime=end_datetime)\nself._results = results\nreturn results", "if not isinstance(selected_keys, list):\n selected_keys = [selected_keys]\nkey_dict = {key: self._results[key]['ke...
<|body_start_0|> results = search_fn(species=species, locations=locations, inlet=inlet, instrument=instrument, start_datetime=start_datetime, end_datetime=end_datetime) self._results = results return results <|end_body_0|> <|body_start_1|> if not isinstance(selected_keys, list): ...
Used to search and download data from the object store
Search
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Search: """Used to search and download data from the object store""" def search(self, species, locations, inlet=None, instrument=None, start_datetime=None, end_datetime=None): """This is just a wrapper for the search function that allows easy access through LocalClient Args: species ...
stack_v2_sparse_classes_75kplus_train_073281
2,647
permissive
[ { "docstring": "This is just a wrapper for the search function that allows easy access through LocalClient Args: species (str or list): Terms to search for in Datasources locations (str or list): Where to search for the terms in species inlet (str, default=None): Inlet height such as 100m instrument (str, defau...
2
stack_v2_sparse_classes_30k_train_035247
Implement the Python class `Search` described below. Class description: Used to search and download data from the object store Method signatures and docstrings: - def search(self, species, locations, inlet=None, instrument=None, start_datetime=None, end_datetime=None): This is just a wrapper for the search function t...
Implement the Python class `Search` described below. Class description: Used to search and download data from the object store Method signatures and docstrings: - def search(self, species, locations, inlet=None, instrument=None, start_datetime=None, end_datetime=None): This is just a wrapper for the search function t...
93c58c9e0381f453a604f39141f73022d4003322
<|skeleton|> class Search: """Used to search and download data from the object store""" def search(self, species, locations, inlet=None, instrument=None, start_datetime=None, end_datetime=None): """This is just a wrapper for the search function that allows easy access through LocalClient Args: species ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Search: """Used to search and download data from the object store""" def search(self, species, locations, inlet=None, instrument=None, start_datetime=None, end_datetime=None): """This is just a wrapper for the search function that allows easy access through LocalClient Args: species (str or list)...
the_stack_v2_python_sparse
HUGS/LocalClient/_search.py
hugs-cloud/hugs
train
0
93f24ca08dba796948c1bf26d3bd8948d7f5cafd
[ "nodes = mo_graph.nodes\nGraph.__init__(self, nodes)\nord_nodes = list(nodes)\nself.star_heap = []\nnode_dict = dict(zip(cp.deepcopy(ord_nodes), ord_nodes))\nfor node_key in node_dict.keys():\n he.heappush(self.star_heap, Star(node_key))\ncliques = []\nid_num = 0\nwhile self.star_heap:\n pop_star = he.heappop...
<|body_start_0|> nodes = mo_graph.nodes Graph.__init__(self, nodes) ord_nodes = list(nodes) self.star_heap = [] node_dict = dict(zip(cp.deepcopy(ord_nodes), ord_nodes)) for node_key in node_dict.keys(): he.heappush(self.star_heap, Star(node_key)) cliqu...
A TriangulatedGraph is an undirected Graph that is constructed from a MoralGraph by adding additional edges to it. The new edges are added using a non-unique heuristic. Construction of the TriangulatedGraph yields a set of cliques of the original BayesNet that was used to construct the MoralGraph in the first place. Th...
TriangulatedGraph
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TriangulatedGraph: """A TriangulatedGraph is an undirected Graph that is constructed from a MoralGraph by adding additional edges to it. The new edges are added using a non-unique heuristic. Construction of the TriangulatedGraph yields a set of cliques of the original BayesNet that was used to co...
stack_v2_sparse_classes_75kplus_train_073282
4,677
permissive
[ { "docstring": "Constructor Parameters ---------- mo_graph : MoralGraph verbose : bool Returns -------", "name": "__init__", "signature": "def __init__(self, mo_graph, verbose=False)" }, { "docstring": "Return False iff the set 'preclique' is contained in any of the cliques in 'clique_list'. Par...
3
stack_v2_sparse_classes_30k_train_018198
Implement the Python class `TriangulatedGraph` described below. Class description: A TriangulatedGraph is an undirected Graph that is constructed from a MoralGraph by adding additional edges to it. The new edges are added using a non-unique heuristic. Construction of the TriangulatedGraph yields a set of cliques of th...
Implement the Python class `TriangulatedGraph` described below. Class description: A TriangulatedGraph is an undirected Graph that is constructed from a MoralGraph by adding additional edges to it. The new edges are added using a non-unique heuristic. Construction of the TriangulatedGraph yields a set of cliques of th...
5b4a3055ea14c2ee9c80c339f759fe2b9c8c51e2
<|skeleton|> class TriangulatedGraph: """A TriangulatedGraph is an undirected Graph that is constructed from a MoralGraph by adding additional edges to it. The new edges are added using a non-unique heuristic. Construction of the TriangulatedGraph yields a set of cliques of the original BayesNet that was used to co...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TriangulatedGraph: """A TriangulatedGraph is an undirected Graph that is constructed from a MoralGraph by adding additional edges to it. The new edges are added using a non-unique heuristic. Construction of the TriangulatedGraph yields a set of cliques of the original BayesNet that was used to construct the M...
the_stack_v2_python_sparse
graphs/TriangulatedGraph.py
artiste-qb-net/quantum-fog
train
95
d1742ec12dc4bb8a2f78e3cb02a4f54815bdfcbc
[ "enum_descriptor = descriptor.EnumDescriptor()\nenum_descriptor.name = 'Empty'\nenum_class = definition.define_enum(enum_descriptor, 'whatever')\nself.assertEquals('Empty', enum_class.__name__)\nself.assertEquals('whatever', enum_class.__module__)\nself.assertEquals(enum_descriptor, descriptor.describe_enum(enum_cl...
<|body_start_0|> enum_descriptor = descriptor.EnumDescriptor() enum_descriptor.name = 'Empty' enum_class = definition.define_enum(enum_descriptor, 'whatever') self.assertEquals('Empty', enum_class.__name__) self.assertEquals('whatever', enum_class.__module__) self.assertE...
Test for define_enum.
DefineEnumTest
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DefineEnumTest: """Test for define_enum.""" def testDefineEnum_Empty(self): """Test defining an empty enum.""" <|body_0|> def testDefineEnum(self): """Test defining an enum.""" <|body_1|> <|end_skeleton|> <|body_start_0|> enum_descriptor = descr...
stack_v2_sparse_classes_75kplus_train_073283
23,499
permissive
[ { "docstring": "Test defining an empty enum.", "name": "testDefineEnum_Empty", "signature": "def testDefineEnum_Empty(self)" }, { "docstring": "Test defining an enum.", "name": "testDefineEnum", "signature": "def testDefineEnum(self)" } ]
2
stack_v2_sparse_classes_30k_train_022216
Implement the Python class `DefineEnumTest` described below. Class description: Test for define_enum. Method signatures and docstrings: - def testDefineEnum_Empty(self): Test defining an empty enum. - def testDefineEnum(self): Test defining an enum.
Implement the Python class `DefineEnumTest` described below. Class description: Test for define_enum. Method signatures and docstrings: - def testDefineEnum_Empty(self): Test defining an empty enum. - def testDefineEnum(self): Test defining an enum. <|skeleton|> class DefineEnumTest: """Test for define_enum.""" ...
2cb4493d796746cb46c8519a100ef3ef128a761a
<|skeleton|> class DefineEnumTest: """Test for define_enum.""" def testDefineEnum_Empty(self): """Test defining an empty enum.""" <|body_0|> def testDefineEnum(self): """Test defining an enum.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DefineEnumTest: """Test for define_enum.""" def testDefineEnum_Empty(self): """Test defining an empty enum.""" enum_descriptor = descriptor.EnumDescriptor() enum_descriptor.name = 'Empty' enum_class = definition.define_enum(enum_descriptor, 'whatever') self.assertE...
the_stack_v2_python_sparse
src/lib/protorpc/definition_test.py
thonkify/thonkify
train
17
dd2c45ebc06a35305d6745172563a242b25652f7
[ "infile = open(FileName, 'r', encoding='utf-8')\nfor i in range(4):\n infile.readline()\nline = infile.readline()", "data = line.strip().split(',')\nif len(data) != 7:\n return False\ntry:\n list(map(int, data[:5]))\nexcept ValueError:\n return False\ntry:\n list(map(float, data[5:]))\nexcept Value...
<|body_start_0|> infile = open(FileName, 'r', encoding='utf-8') for i in range(4): infile.readline() line = infile.readline() <|end_body_0|> <|body_start_1|> data = line.strip().split(',') if len(data) != 7: return False try: list(map(...
Class for reading data from OSSM format files. This is subclassed for the different types... The trick here is that OSSM format files often don't have any info about what the data is, or units, or... Not all that well tested!
OSSM_ReaderClass
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OSSM_ReaderClass: """Class for reading data from OSSM format files. This is subclassed for the different types... The trick here is that OSSM format files often don't have any info about what the data is, or units, or... Not all that well tested!""" def IsType(self, FileName): """How...
stack_v2_sparse_classes_75kplus_train_073284
33,158
no_license
[ { "docstring": "How to do this??? The data should be 7 comma separated values", "name": "IsType", "signature": "def IsType(self, FileName)" }, { "docstring": "Check if a line of data fits the OSSM format.", "name": "CheckDataLine", "signature": "def CheckDataLine(self, line)" }, { ...
4
stack_v2_sparse_classes_30k_train_049903
Implement the Python class `OSSM_ReaderClass` described below. Class description: Class for reading data from OSSM format files. This is subclassed for the different types... The trick here is that OSSM format files often don't have any info about what the data is, or units, or... Not all that well tested! Method sig...
Implement the Python class `OSSM_ReaderClass` described below. Class description: Class for reading data from OSSM format files. This is subclassed for the different types... The trick here is that OSSM format files often don't have any info about what the data is, or units, or... Not all that well tested! Method sig...
990b54c260bcd0e1c55f2f6be4bfa73be5f40bfe
<|skeleton|> class OSSM_ReaderClass: """Class for reading data from OSSM format files. This is subclassed for the different types... The trick here is that OSSM format files often don't have any info about what the data is, or units, or... Not all that well tested!""" def IsType(self, FileName): """How...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class OSSM_ReaderClass: """Class for reading data from OSSM format files. This is subclassed for the different types... The trick here is that OSSM format files often don't have any info about what the data is, or units, or... Not all that well tested!""" def IsType(self, FileName): """How to do this??...
the_stack_v2_python_sparse
windtools/met_data.py
NOAA-ORR-ERD/windtools
train
1
6a192b5d3589512e1186f9a24874c5a71dbb6ea5
[ "super().__init__(dmm, f'ch{channel}', **kwargs)\nself.channel = channel\nself.dmm = dmm\nself.add_parameter('resistance', unit='Ohm', label=f'Resistance CH{self.channel}', get_parser=float, get_cmd=partial(self._measure, 'RES'))\nself.add_parameter('resistance_4w', unit='Ohm', label=f'Resistance (4-wire) CH{self.c...
<|body_start_0|> super().__init__(dmm, f'ch{channel}', **kwargs) self.channel = channel self.dmm = dmm self.add_parameter('resistance', unit='Ohm', label=f'Resistance CH{self.channel}', get_parser=float, get_cmd=partial(self._measure, 'RES')) self.add_parameter('resistance_4w', u...
This is the qcodes driver for a channel of the 2000-SCAN scanner card.
Keithley_2000_Scan_Channel
[ "GPL-2.0-only", "GPL-2.0-or-later", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Keithley_2000_Scan_Channel: """This is the qcodes driver for a channel of the 2000-SCAN scanner card.""" def __init__(self, dmm: 'Keithley_6500', channel: int, **kwargs) -> None: """Initialize instance of scanner card Keithley 2000-SCAN Args: dmm: Instance of digital multimeter Keith...
stack_v2_sparse_classes_75kplus_train_073285
2,543
permissive
[ { "docstring": "Initialize instance of scanner card Keithley 2000-SCAN Args: dmm: Instance of digital multimeter Keithley6500 containing the scanner card channel: Channel number **kwargs: Keyword arguments to pass to __init__ function of InstrumentChannel class", "name": "__init__", "signature": "def __...
2
stack_v2_sparse_classes_30k_train_022227
Implement the Python class `Keithley_2000_Scan_Channel` described below. Class description: This is the qcodes driver for a channel of the 2000-SCAN scanner card. Method signatures and docstrings: - def __init__(self, dmm: 'Keithley_6500', channel: int, **kwargs) -> None: Initialize instance of scanner card Keithley ...
Implement the Python class `Keithley_2000_Scan_Channel` described below. Class description: This is the qcodes driver for a channel of the 2000-SCAN scanner card. Method signatures and docstrings: - def __init__(self, dmm: 'Keithley_6500', channel: int, **kwargs) -> None: Initialize instance of scanner card Keithley ...
e07c9f23339ab00b0f4c4cc46711593d88f7fc84
<|skeleton|> class Keithley_2000_Scan_Channel: """This is the qcodes driver for a channel of the 2000-SCAN scanner card.""" def __init__(self, dmm: 'Keithley_6500', channel: int, **kwargs) -> None: """Initialize instance of scanner card Keithley 2000-SCAN Args: dmm: Instance of digital multimeter Keith...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Keithley_2000_Scan_Channel: """This is the qcodes driver for a channel of the 2000-SCAN scanner card.""" def __init__(self, dmm: 'Keithley_6500', channel: int, **kwargs) -> None: """Initialize instance of scanner card Keithley 2000-SCAN Args: dmm: Instance of digital multimeter Keithley6500 conta...
the_stack_v2_python_sparse
qcodes_contrib_drivers/drivers/Tektronix/Keithley_2000_Scan.py
QCoDeS/Qcodes_contrib_drivers
train
32
f22c433740a0824bdc4772e5ad5badc639ba752a
[ "self.driver = driver\nself.ProjectFilePath = GetProjectFilePath()\nself.Page_object_data_file = open(self.ProjectFilePath + '\\\\Page_object\\\\Data\\\\DistTransformerEleQuaDayCalResult.yaml')\nself.Page_Data = yaml.load(self.Page_object_data_file)\nself.Page_object_data_file.close()\nself.Data = self.Page_Data['D...
<|body_start_0|> self.driver = driver self.ProjectFilePath = GetProjectFilePath() self.Page_object_data_file = open(self.ProjectFilePath + '\\Page_object\\Data\\DistTransformerEleQuaDayCalResult.yaml') self.Page_Data = yaml.load(self.Page_object_data_file) self.Page_object_data_f...
DistTransformerSquDaycalcResult
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DistTransformerSquDaycalcResult: def __init__(self, driver): """配线日均方根电流法变压器损耗表链接页面结果验证""" <|body_0|> def DistTransformerSquDaycalcResult_Fun(self): """配电日均方根电流法变压器损耗表链接页面结果验证""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.driver = driver ...
stack_v2_sparse_classes_75kplus_train_073286
4,167
no_license
[ { "docstring": "配线日均方根电流法变压器损耗表链接页面结果验证", "name": "__init__", "signature": "def __init__(self, driver)" }, { "docstring": "配电日均方根电流法变压器损耗表链接页面结果验证", "name": "DistTransformerSquDaycalcResult_Fun", "signature": "def DistTransformerSquDaycalcResult_Fun(self)" } ]
2
null
Implement the Python class `DistTransformerSquDaycalcResult` described below. Class description: Implement the DistTransformerSquDaycalcResult class. Method signatures and docstrings: - def __init__(self, driver): 配线日均方根电流法变压器损耗表链接页面结果验证 - def DistTransformerSquDaycalcResult_Fun(self): 配电日均方根电流法变压器损耗表链接页面结果验证
Implement the Python class `DistTransformerSquDaycalcResult` described below. Class description: Implement the DistTransformerSquDaycalcResult class. Method signatures and docstrings: - def __init__(self, driver): 配线日均方根电流法变压器损耗表链接页面结果验证 - def DistTransformerSquDaycalcResult_Fun(self): 配电日均方根电流法变压器损耗表链接页面结果验证 <|skel...
190796e380df1e28770f73a392ac92f482eb9809
<|skeleton|> class DistTransformerSquDaycalcResult: def __init__(self, driver): """配线日均方根电流法变压器损耗表链接页面结果验证""" <|body_0|> def DistTransformerSquDaycalcResult_Fun(self): """配电日均方根电流法变压器损耗表链接页面结果验证""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DistTransformerSquDaycalcResult: def __init__(self, driver): """配线日均方根电流法变压器损耗表链接页面结果验证""" self.driver = driver self.ProjectFilePath = GetProjectFilePath() self.Page_object_data_file = open(self.ProjectFilePath + '\\Page_object\\Data\\DistTransformerEleQuaDayCalResult.yaml') ...
the_stack_v2_python_sparse
Project/Page_object/Page_object/DistTransformerSquDaycalcResult.py
RainsWang/Python2.7-Selenium
train
1
e71978c5e927b461b1e23b6e32d2d10885e7ba2f
[ "self.distribution = distribution\nself.d = self.distribution.dimension\nif isscalar(lower_bound):\n lower_bound = tile(lower_bound, self.d)\nif isscalar(upper_bound):\n upper_bound = tile(upper_bound, self.d)\nself.lower_bound = array(lower_bound)\nself.upper_bound = array(upper_bound)\nif len(self.lower_bou...
<|body_start_0|> self.distribution = distribution self.d = self.distribution.dimension if isscalar(lower_bound): lower_bound = tile(lower_bound, self.d) if isscalar(upper_bound): upper_bound = tile(upper_bound, self.d) self.lower_bound = array(lower_bound)...
>>> dd = Sobol(2,seed=7) >>> Lebesgue(dd,lower_bound=[-1,0],upper_bound=[1,3]) Lebesgue (TrueMeasure Object) lower_bound [-1 0] upper_bound [1 3] >>> Lebesgue(dd,lower_bound=-inf,upper_bound=inf) Lebesgue (TrueMeasure Object) lower_bound [-inf -inf] upper_bound [inf inf]
Lebesgue
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Lebesgue: """>>> dd = Sobol(2,seed=7) >>> Lebesgue(dd,lower_bound=[-1,0],upper_bound=[1,3]) Lebesgue (TrueMeasure Object) lower_bound [-1 0] upper_bound [1 3] >>> Lebesgue(dd,lower_bound=-inf,upper_bound=inf) Lebesgue (TrueMeasure Object) lower_bound [-inf -inf] upper_bound [inf inf]""" def ...
stack_v2_sparse_classes_75kplus_train_073287
3,880
permissive
[ { "docstring": "Args: distribution (DiscreteDistribution): DiscreteDistribution instance lower_bound (float or inf): lower bound of integration upper_bound (float or inf): upper bound of integration", "name": "__init__", "signature": "def __init__(self, distribution, lower_bound=0.0, upper_bound=1.0)" ...
3
stack_v2_sparse_classes_30k_train_031816
Implement the Python class `Lebesgue` described below. Class description: >>> dd = Sobol(2,seed=7) >>> Lebesgue(dd,lower_bound=[-1,0],upper_bound=[1,3]) Lebesgue (TrueMeasure Object) lower_bound [-1 0] upper_bound [1 3] >>> Lebesgue(dd,lower_bound=-inf,upper_bound=inf) Lebesgue (TrueMeasure Object) lower_bound [-inf -...
Implement the Python class `Lebesgue` described below. Class description: >>> dd = Sobol(2,seed=7) >>> Lebesgue(dd,lower_bound=[-1,0],upper_bound=[1,3]) Lebesgue (TrueMeasure Object) lower_bound [-1 0] upper_bound [1 3] >>> Lebesgue(dd,lower_bound=-inf,upper_bound=inf) Lebesgue (TrueMeasure Object) lower_bound [-inf -...
0ed9da2f10b9ac0004c993c01392b4c86002954c
<|skeleton|> class Lebesgue: """>>> dd = Sobol(2,seed=7) >>> Lebesgue(dd,lower_bound=[-1,0],upper_bound=[1,3]) Lebesgue (TrueMeasure Object) lower_bound [-1 0] upper_bound [1 3] >>> Lebesgue(dd,lower_bound=-inf,upper_bound=inf) Lebesgue (TrueMeasure Object) lower_bound [-inf -inf] upper_bound [inf inf]""" def ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Lebesgue: """>>> dd = Sobol(2,seed=7) >>> Lebesgue(dd,lower_bound=[-1,0],upper_bound=[1,3]) Lebesgue (TrueMeasure Object) lower_bound [-1 0] upper_bound [1 3] >>> Lebesgue(dd,lower_bound=-inf,upper_bound=inf) Lebesgue (TrueMeasure Object) lower_bound [-inf -inf] upper_bound [inf inf]""" def __init__(self...
the_stack_v2_python_sparse
qmcpy/true_measure/lebesgue.py
kachiann/QMCSoftware
train
1
ff046794a50e5573310e08474cb3fab7f40dd21d
[ "super(RNNEncoder, self).__init__()\nself.batch = batch\nself.units = units\nself.embedding = tf.keras.layers.Embedding(vocab, embedding)\nself.gru = tf.keras.layers.GRU(units, recurrent_initializer='glorot_uniform', return_sequences=True, return_state=True)", "initializer = tf.keras.initializers.Zeros()\nvalues ...
<|body_start_0|> super(RNNEncoder, self).__init__() self.batch = batch self.units = units self.embedding = tf.keras.layers.Embedding(vocab, embedding) self.gru = tf.keras.layers.GRU(units, recurrent_initializer='glorot_uniform', return_sequences=True, return_state=True) <|end_bod...
RNN Encoder part of the translation model
RNNEncoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RNNEncoder: """RNN Encoder part of the translation model""" def __init__(self, vocab, embedding, units, batch): """Class constructor Arguments: - vocab: is an integer representing the size of the input vocabulary - embedding: is an integer representing the dimensionality of the embed...
stack_v2_sparse_classes_75kplus_train_073288
2,597
no_license
[ { "docstring": "Class constructor Arguments: - vocab: is an integer representing the size of the input vocabulary - embedding: is an integer representing the dimensionality of the embedding vector - units: is an integer representing the number of hidden units in the RNN cell - batch: is an integer representing ...
3
stack_v2_sparse_classes_30k_train_011101
Implement the Python class `RNNEncoder` described below. Class description: RNN Encoder part of the translation model Method signatures and docstrings: - def __init__(self, vocab, embedding, units, batch): Class constructor Arguments: - vocab: is an integer representing the size of the input vocabulary - embedding: i...
Implement the Python class `RNNEncoder` described below. Class description: RNN Encoder part of the translation model Method signatures and docstrings: - def __init__(self, vocab, embedding, units, batch): Class constructor Arguments: - vocab: is an integer representing the size of the input vocabulary - embedding: i...
fc2cec306961f7ca2448965ddd3a2f656bbe10c7
<|skeleton|> class RNNEncoder: """RNN Encoder part of the translation model""" def __init__(self, vocab, embedding, units, batch): """Class constructor Arguments: - vocab: is an integer representing the size of the input vocabulary - embedding: is an integer representing the dimensionality of the embed...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RNNEncoder: """RNN Encoder part of the translation model""" def __init__(self, vocab, embedding, units, batch): """Class constructor Arguments: - vocab: is an integer representing the size of the input vocabulary - embedding: is an integer representing the dimensionality of the embedding vector -...
the_stack_v2_python_sparse
supervised_learning/0x11-attention/0-rnn_encoder.py
dalexach/holbertonschool-machine_learning
train
2
909332cf615a35c18232bfc9f2b8c5920e3760f6
[ "super(GLM, self).__init__(dim_param=len_filter + 1, seed=seed)\nself.duration = duration\nself.len_filter = len_filter\nself.seed_input = seed_input\nself.n_params = self.len_filter + 1\nself.dt = 1\nself.t = np.arange(0, self.duration, self.dt)\nif self.seed_input is None:\n new_seed = self.gen_newseed()\nelse...
<|body_start_0|> super(GLM, self).__init__(dim_param=len_filter + 1, seed=seed) self.duration = duration self.len_filter = len_filter self.seed_input = seed_input self.n_params = self.len_filter + 1 self.dt = 1 self.t = np.arange(0, self.duration, self.dt) ...
GLM
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GLM: def __init__(self, duration=100, len_filter=9, seed=None, seed_input=None): """GLM simulator Parameters ---------- duration : int Duration of traces in ms len_filter : int Length of filter seed : int or None If set, randomness across runs is disabled seed_input : int or None If set,...
stack_v2_sparse_classes_75kplus_train_073289
2,387
permissive
[ { "docstring": "GLM simulator Parameters ---------- duration : int Duration of traces in ms len_filter : int Length of filter seed : int or None If set, randomness across runs is disabled seed_input : int or None If set, randomness in input is controlled by seed_input rather than by seed", "name": "__init__...
2
stack_v2_sparse_classes_30k_train_050829
Implement the Python class `GLM` described below. Class description: Implement the GLM class. Method signatures and docstrings: - def __init__(self, duration=100, len_filter=9, seed=None, seed_input=None): GLM simulator Parameters ---------- duration : int Duration of traces in ms len_filter : int Length of filter se...
Implement the Python class `GLM` described below. Class description: Implement the GLM class. Method signatures and docstrings: - def __init__(self, duration=100, len_filter=9, seed=None, seed_input=None): GLM simulator Parameters ---------- duration : int Duration of traces in ms len_filter : int Length of filter se...
b93c90ec6156ae5f8afee6aaac7317373e9caf5e
<|skeleton|> class GLM: def __init__(self, duration=100, len_filter=9, seed=None, seed_input=None): """GLM simulator Parameters ---------- duration : int Duration of traces in ms len_filter : int Length of filter seed : int or None If set, randomness across runs is disabled seed_input : int or None If set,...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GLM: def __init__(self, duration=100, len_filter=9, seed=None, seed_input=None): """GLM simulator Parameters ---------- duration : int Duration of traces in ms len_filter : int Length of filter seed : int or None If set, randomness across runs is disabled seed_input : int or None If set, randomness in...
the_stack_v2_python_sparse
2_glm/model/GLM.py
daesungc/IdentifyMechanisticModels_2020
train
0
ba46b2f01f4abecdb95c16af0c9daf99f98fa17d
[ "super(MutanFusion, self).__init__()\nself.mm_hidden_size = mm_hidden_size\nself.R = R\nself.linear_v = nn.Linear(I_input_hidden, I_core_hidden)\nself.linear_q = nn.Linear(T_input_hidden, T_core_hidden)\nself.list_linear_hv = nn.ModuleList([nn.Linear(I_core_hidden, mm_hidden_size) for _ in range(R)])\nself.list_lin...
<|body_start_0|> super(MutanFusion, self).__init__() self.mm_hidden_size = mm_hidden_size self.R = R self.linear_v = nn.Linear(I_input_hidden, I_core_hidden) self.linear_q = nn.Linear(T_input_hidden, T_core_hidden) self.list_linear_hv = nn.ModuleList([nn.Linear(I_core_hid...
MutanFusion
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MutanFusion: def __init__(self, T_input_hidden, I_input_hidden, mm_hidden_size=510, T_core_hidden=310, I_core_hidden=310, T_activate_func=gelu, I_activate_func=gelu, T_core_activate=gelu, I_core_activate=gelu, mm_activate=gelu, dropout_T=0.5, dropout_I=0.5, dropout_core_T=0, dropout_core_I=0, R=...
stack_v2_sparse_classes_75kplus_train_073290
5,761
no_license
[ { "docstring": ":param T_input_hidden: Text input hidden size :param I_input_hidden: Image input hidden size :param mm_hidden_size: output multi-modal feature size :param T_core_hidden: Text core hidden size :param I_core_hidden: Image core hidden size :param T_activate_func: Text activate function, should be c...
2
stack_v2_sparse_classes_30k_train_054238
Implement the Python class `MutanFusion` described below. Class description: Implement the MutanFusion class. Method signatures and docstrings: - def __init__(self, T_input_hidden, I_input_hidden, mm_hidden_size=510, T_core_hidden=310, I_core_hidden=310, T_activate_func=gelu, I_activate_func=gelu, T_core_activate=gel...
Implement the Python class `MutanFusion` described below. Class description: Implement the MutanFusion class. Method signatures and docstrings: - def __init__(self, T_input_hidden, I_input_hidden, mm_hidden_size=510, T_core_hidden=310, I_core_hidden=310, T_activate_func=gelu, I_activate_func=gelu, T_core_activate=gel...
6209dc7a9f17e52dd570bbcbd1c9829a2b14f52c
<|skeleton|> class MutanFusion: def __init__(self, T_input_hidden, I_input_hidden, mm_hidden_size=510, T_core_hidden=310, I_core_hidden=310, T_activate_func=gelu, I_activate_func=gelu, T_core_activate=gelu, I_core_activate=gelu, mm_activate=gelu, dropout_T=0.5, dropout_I=0.5, dropout_core_T=0, dropout_core_I=0, R=...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MutanFusion: def __init__(self, T_input_hidden, I_input_hidden, mm_hidden_size=510, T_core_hidden=310, I_core_hidden=310, T_activate_func=gelu, I_activate_func=gelu, T_core_activate=gelu, I_core_activate=gelu, mm_activate=gelu, dropout_T=0.5, dropout_I=0.5, dropout_core_T=0, dropout_core_I=0, R=5): ""...
the_stack_v2_python_sparse
models/base/modal_fusion.py
yiranyyu/Phrase-Grounding
train
2
caf55774dd78edc3261046c448ffcb174a696ea2
[ "parser.display_info.AddFormat(vmware_constants.VMWARE_CLUSTERS_FORMAT)\nvmware_flags.AddClusterResourceArg(parser, 'to create', True)\nvmware_flags.AddAdminClusterMembershipResourceArg(parser, positional=False)\nbase.ASYNC_FLAG.AddToParser(parser)\nvmware_flags.AddValidationOnly(parser)\nvmware_flags.AddDescriptio...
<|body_start_0|> parser.display_info.AddFormat(vmware_constants.VMWARE_CLUSTERS_FORMAT) vmware_flags.AddClusterResourceArg(parser, 'to create', True) vmware_flags.AddAdminClusterMembershipResourceArg(parser, positional=False) base.ASYNC_FLAG.AddToParser(parser) vmware_flags.AddVa...
Create an Anthos cluster on VMware.
CreateBeta
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CreateBeta: """Create an Anthos cluster on VMware.""" def Args(parser: parser_arguments.ArgumentInterceptor): """Gathers command line arguments for the create command. Args: parser: The argparse parser to add the flag to.""" <|body_0|> def Run(self, args: parser_extensio...
stack_v2_sparse_classes_75kplus_train_073291
6,590
permissive
[ { "docstring": "Gathers command line arguments for the create command. Args: parser: The argparse parser to add the flag to.", "name": "Args", "signature": "def Args(parser: parser_arguments.ArgumentInterceptor)" }, { "docstring": "Runs the create command. Args: args: The arguments received from...
2
stack_v2_sparse_classes_30k_train_038253
Implement the Python class `CreateBeta` described below. Class description: Create an Anthos cluster on VMware. Method signatures and docstrings: - def Args(parser: parser_arguments.ArgumentInterceptor): Gathers command line arguments for the create command. Args: parser: The argparse parser to add the flag to. - def...
Implement the Python class `CreateBeta` described below. Class description: Create an Anthos cluster on VMware. Method signatures and docstrings: - def Args(parser: parser_arguments.ArgumentInterceptor): Gathers command line arguments for the create command. Args: parser: The argparse parser to add the flag to. - def...
392abf004b16203030e6efd2f0af24db7c8d669e
<|skeleton|> class CreateBeta: """Create an Anthos cluster on VMware.""" def Args(parser: parser_arguments.ArgumentInterceptor): """Gathers command line arguments for the create command. Args: parser: The argparse parser to add the flag to.""" <|body_0|> def Run(self, args: parser_extensio...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CreateBeta: """Create an Anthos cluster on VMware.""" def Args(parser: parser_arguments.ArgumentInterceptor): """Gathers command line arguments for the create command. Args: parser: The argparse parser to add the flag to.""" parser.display_info.AddFormat(vmware_constants.VMWARE_CLUSTERS_F...
the_stack_v2_python_sparse
lib/surface/container/vmware/clusters/create.py
google-cloud-sdk-unofficial/google-cloud-sdk
train
9
e312033310afd8cf17dabfcdc970a4e4f28ab64f
[ "config = MySQLSchema(**self.configuration.secrets or {})\nuser_password = ''\nif config.username:\n user = config.username\n password = f':{config.password}' if config.password else ''\n user_password = f'{user}{password}@'\nnetloc = config.host\nport = f':{config.port}' if config.port else ''\ndbname = f...
<|body_start_0|> config = MySQLSchema(**self.configuration.secrets or {}) user_password = '' if config.username: user = config.username password = f':{config.password}' if config.password else '' user_password = f'{user}{password}@' netloc = config.hos...
Connector specific to MySQL
MySQLConnector
[ "CC-BY-4.0", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MySQLConnector: """Connector specific to MySQL""" def build_uri(self) -> str: """Build URI of format mysql+pymysql://[user[:password]@][netloc][:port][/dbname]""" <|body_0|> def client(self) -> Engine: """Returns a SQLAlchemy Engine that can be used to interact w...
stack_v2_sparse_classes_75kplus_train_073292
5,868
permissive
[ { "docstring": "Build URI of format mysql+pymysql://[user[:password]@][netloc][:port][/dbname]", "name": "build_uri", "signature": "def build_uri(self) -> str" }, { "docstring": "Returns a SQLAlchemy Engine that can be used to interact with a MySQL database", "name": "client", "signature...
2
stack_v2_sparse_classes_30k_train_001617
Implement the Python class `MySQLConnector` described below. Class description: Connector specific to MySQL Method signatures and docstrings: - def build_uri(self) -> str: Build URI of format mysql+pymysql://[user[:password]@][netloc][:port][/dbname] - def client(self) -> Engine: Returns a SQLAlchemy Engine that can ...
Implement the Python class `MySQLConnector` described below. Class description: Connector specific to MySQL Method signatures and docstrings: - def build_uri(self) -> str: Build URI of format mysql+pymysql://[user[:password]@][netloc][:port][/dbname] - def client(self) -> Engine: Returns a SQLAlchemy Engine that can ...
1ab840206a78e60673aebd5838ba567095512a58
<|skeleton|> class MySQLConnector: """Connector specific to MySQL""" def build_uri(self) -> str: """Build URI of format mysql+pymysql://[user[:password]@][netloc][:port][/dbname]""" <|body_0|> def client(self) -> Engine: """Returns a SQLAlchemy Engine that can be used to interact w...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MySQLConnector: """Connector specific to MySQL""" def build_uri(self) -> str: """Build URI of format mysql+pymysql://[user[:password]@][netloc][:port][/dbname]""" config = MySQLSchema(**self.configuration.secrets or {}) user_password = '' if config.username: us...
the_stack_v2_python_sparse
src/fidesops/service/connectors/sql_connector.py
nathanawmk/fidesops
train
0
13a705286855428685854833d92523ae412d3d60
[ "dir_name = os.path.dirname(outfile)\ninfile_stub = P.snip(os.path.basename(infile), '.bam')\ncontrol_stub = P.snip(os.path.basename(controlfile), '.bam')\noutfile_stub = infile_stub + '_VS_' + control_stub\noutfile_stub = os.path.join(dir_name, outfile_stub)\nstatement = ['macs2 callpeak --treatment %(infile)s --c...
<|body_start_0|> dir_name = os.path.dirname(outfile) infile_stub = P.snip(os.path.basename(infile), '.bam') control_stub = P.snip(os.path.basename(controlfile), '.bam') outfile_stub = infile_stub + '_VS_' + control_stub outfile_stub = os.path.join(dir_name, outfile_stub) ...
macs2IDRPeaks
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class macs2IDRPeaks: def getRunStatement(self, infile, outfile, controlfile): """Generate a specific run statement for each peakcaller class""" <|body_0|> def postProcess(self, infile, outfile, controlfile): """Takes the narrowPeak files output by macs2. If macs2 given pva...
stack_v2_sparse_classes_75kplus_train_073293
19,216
permissive
[ { "docstring": "Generate a specific run statement for each peakcaller class", "name": "getRunStatement", "signature": "def getRunStatement(self, infile, outfile, controlfile)" }, { "docstring": "Takes the narrowPeak files output by macs2. If macs2 given pvalue, then sorts by column 8 (-log10(pva...
2
stack_v2_sparse_classes_30k_train_050493
Implement the Python class `macs2IDRPeaks` described below. Class description: Implement the macs2IDRPeaks class. Method signatures and docstrings: - def getRunStatement(self, infile, outfile, controlfile): Generate a specific run statement for each peakcaller class - def postProcess(self, infile, outfile, controlfil...
Implement the Python class `macs2IDRPeaks` described below. Class description: Implement the macs2IDRPeaks class. Method signatures and docstrings: - def getRunStatement(self, infile, outfile, controlfile): Generate a specific run statement for each peakcaller class - def postProcess(self, infile, outfile, controlfil...
7ae2e893a41f952c07f35b5cebb4c3c408d8477b
<|skeleton|> class macs2IDRPeaks: def getRunStatement(self, infile, outfile, controlfile): """Generate a specific run statement for each peakcaller class""" <|body_0|> def postProcess(self, infile, outfile, controlfile): """Takes the narrowPeak files output by macs2. If macs2 given pva...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class macs2IDRPeaks: def getRunStatement(self, infile, outfile, controlfile): """Generate a specific run statement for each peakcaller class""" dir_name = os.path.dirname(outfile) infile_stub = P.snip(os.path.basename(infile), '.bam') control_stub = P.snip(os.path.basename(controlfil...
the_stack_v2_python_sparse
obsolete/PipelineIDR.py
cgat-developers/cgat-flow
train
13
63d9321f25894963ef75a18b8cac17fdd6ccb80a
[ "model = User\nname = 'Users'\nsuper().__init__(model=model, collection_name=name)\nself.__dog_owner_repository = dog_owner_repository", "users = list()\nowners = self.__dog_owner_repository.search(f'dog_id=={dog_id}')\nfor dog_owner in owners.to_list():\n try:\n user = self.read(dog_owner.owner_id)\n ...
<|body_start_0|> model = User name = 'Users' super().__init__(model=model, collection_name=name) self.__dog_owner_repository = dog_owner_repository <|end_body_0|> <|body_start_1|> users = list() owners = self.__dog_owner_repository.search(f'dog_id=={dog_id}') for...
User repository.
UserRepository
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserRepository: """User repository.""" def __init__(self, dog_owner_repository): """Initialize user repository.""" <|body_0|> def read_owners_of_dog(self, dog_id): """Get dogs associated with this user_id.""" <|body_1|> <|end_skeleton|> <|body_start_0|>...
stack_v2_sparse_classes_75kplus_train_073294
925
no_license
[ { "docstring": "Initialize user repository.", "name": "__init__", "signature": "def __init__(self, dog_owner_repository)" }, { "docstring": "Get dogs associated with this user_id.", "name": "read_owners_of_dog", "signature": "def read_owners_of_dog(self, dog_id)" } ]
2
stack_v2_sparse_classes_30k_train_042523
Implement the Python class `UserRepository` described below. Class description: User repository. Method signatures and docstrings: - def __init__(self, dog_owner_repository): Initialize user repository. - def read_owners_of_dog(self, dog_id): Get dogs associated with this user_id.
Implement the Python class `UserRepository` described below. Class description: User repository. Method signatures and docstrings: - def __init__(self, dog_owner_repository): Initialize user repository. - def read_owners_of_dog(self, dog_id): Get dogs associated with this user_id. <|skeleton|> class UserRepository: ...
129dc7f8213fb3112c35b1551d9ed3d8a14b7fb5
<|skeleton|> class UserRepository: """User repository.""" def __init__(self, dog_owner_repository): """Initialize user repository.""" <|body_0|> def read_owners_of_dog(self, dog_id): """Get dogs associated with this user_id.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UserRepository: """User repository.""" def __init__(self, dog_owner_repository): """Initialize user repository.""" model = User name = 'Users' super().__init__(model=model, collection_name=name) self.__dog_owner_repository = dog_owner_repository def read_owner...
the_stack_v2_python_sparse
hugbunadarfr_backend/src/app/repository/repositories/user_repository.py
birna17/veff_hugb
train
0
c69a04ccbdd4ee81d2c047e05f96252479a0bf8e
[ "k %= len(nums)\nr = nums[-k:] + nums[0:-k]\nfor i in range(len(r)):\n nums[i] = r[i]", "a = [0] * len(nums)\nfor i in range(len(nums)):\n a[(i + k) % len(nums)] = nums[i]\nfor i in range(len(nums)):\n nums[i] = a[i]" ]
<|body_start_0|> k %= len(nums) r = nums[-k:] + nums[0:-k] for i in range(len(r)): nums[i] = r[i] <|end_body_0|> <|body_start_1|> a = [0] * len(nums) for i in range(len(nums)): a[(i + k) % len(nums)] = nums[i] for i in range(len(nums)): ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def rotate(self, nums: List[int], k: int) -> None: """Do not return anything, modify nums in-place instead.""" <|body_0|> def rotate_v2(self, nums: List[int], k: int) -> None: """Do not return anything, modify nums in-place instead.""" <|body_1|> <...
stack_v2_sparse_classes_75kplus_train_073295
763
no_license
[ { "docstring": "Do not return anything, modify nums in-place instead.", "name": "rotate", "signature": "def rotate(self, nums: List[int], k: int) -> None" }, { "docstring": "Do not return anything, modify nums in-place instead.", "name": "rotate_v2", "signature": "def rotate_v2(self, num...
2
stack_v2_sparse_classes_30k_train_012198
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rotate(self, nums: List[int], k: int) -> None: Do not return anything, modify nums in-place instead. - def rotate_v2(self, nums: List[int], k: int) -> None: Do not return any...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rotate(self, nums: List[int], k: int) -> None: Do not return anything, modify nums in-place instead. - def rotate_v2(self, nums: List[int], k: int) -> None: Do not return any...
17948ea26649dfc9bda97a54e968f9477b3172d5
<|skeleton|> class Solution: def rotate(self, nums: List[int], k: int) -> None: """Do not return anything, modify nums in-place instead.""" <|body_0|> def rotate_v2(self, nums: List[int], k: int) -> None: """Do not return anything, modify nums in-place instead.""" <|body_1|> <...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def rotate(self, nums: List[int], k: int) -> None: """Do not return anything, modify nums in-place instead.""" k %= len(nums) r = nums[-k:] + nums[0:-k] for i in range(len(r)): nums[i] = r[i] def rotate_v2(self, nums: List[int], k: int) -> None: ...
the_stack_v2_python_sparse
189.rotate-array.py
MingxingSu/Leetcode-python
train
0
0e7fd2cc98ffd4fd5a836539f6bb2aa7d1becde6
[ "self.client = APIClient()\nuser = Custom_User.objects.create(username='user12', first_name='tom', last_name='jerry')\nself.story_data = {'title': 'No Promises', 'artists': 'Cheat Codes', 'owner': user.id, 'text': 'hi there'}\nself.response = self.client.post(reverse('create_story'), self.story_data, format='json')...
<|body_start_0|> self.client = APIClient() user = Custom_User.objects.create(username='user12', first_name='tom', last_name='jerry') self.story_data = {'title': 'No Promises', 'artists': 'Cheat Codes', 'owner': user.id, 'text': 'hi there'} self.response = self.client.post(reverse('create...
Test suite for the api views.
StoryAPITestCase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StoryAPITestCase: """Test suite for the api views.""" def setUp(self): """Define the test client and other test variables.""" <|body_0|> def test_api_can_create_a_story(self): """POST: Test the api has story creation capability.""" <|body_1|> def tes...
stack_v2_sparse_classes_75kplus_train_073296
25,406
no_license
[ { "docstring": "Define the test client and other test variables.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "POST: Test the api has story creation capability.", "name": "test_api_can_create_a_story", "signature": "def test_api_can_create_a_story(self)" }, { ...
6
null
Implement the Python class `StoryAPITestCase` described below. Class description: Test suite for the api views. Method signatures and docstrings: - def setUp(self): Define the test client and other test variables. - def test_api_can_create_a_story(self): POST: Test the api has story creation capability. - def test_ap...
Implement the Python class `StoryAPITestCase` described below. Class description: Test suite for the api views. Method signatures and docstrings: - def setUp(self): Define the test client and other test variables. - def test_api_can_create_a_story(self): POST: Test the api has story creation capability. - def test_ap...
efac560c0ddfb315e8704d15090e8f4286a1029d
<|skeleton|> class StoryAPITestCase: """Test suite for the api views.""" def setUp(self): """Define the test client and other test variables.""" <|body_0|> def test_api_can_create_a_story(self): """POST: Test the api has story creation capability.""" <|body_1|> def tes...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class StoryAPITestCase: """Test suite for the api views.""" def setUp(self): """Define the test client and other test variables.""" self.client = APIClient() user = Custom_User.objects.create(username='user12', first_name='tom', last_name='jerry') self.story_data = {'title': 'No...
the_stack_v2_python_sparse
app/test_project/project2/tests.py
EtonMon/cs4501
train
0
3f9e81b8ab8e6d91c2619f1a6c36a8f698d679d6
[ "self.capacity = capacity\nself.cur_size = 0\nself.freq_stack = collections.defaultdict(DoubleLL)\nself.key_node_map = {}\nself.key_freq_map = {}\nself.min_freq = 1", "if not self.capacity:\n return -1\nif key in self.key_freq_map:\n freq = self.key_freq_map[key]\n incoming = self.key_node_map[key]\n ...
<|body_start_0|> self.capacity = capacity self.cur_size = 0 self.freq_stack = collections.defaultdict(DoubleLL) self.key_node_map = {} self.key_freq_map = {} self.min_freq = 1 <|end_body_0|> <|body_start_1|> if not self.capacity: return -1 if ...
LFUCache
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LFUCache: def __init__(self, capacity): """:type capacity: int Each frequency has a custom linked list We track the minimum frequency with hashmaps. This frequency can always be found whenever we override it, usually by resetting it to one.""" <|body_0|> def get(self, key): ...
stack_v2_sparse_classes_75kplus_train_073297
4,600
permissive
[ { "docstring": ":type capacity: int Each frequency has a custom linked list We track the minimum frequency with hashmaps. This frequency can always be found whenever we override it, usually by resetting it to one.", "name": "__init__", "signature": "def __init__(self, capacity)" }, { "docstring"...
3
stack_v2_sparse_classes_30k_train_046388
Implement the Python class `LFUCache` described below. Class description: Implement the LFUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int Each frequency has a custom linked list We track the minimum frequency with hashmaps. This frequency can always be found wheneve...
Implement the Python class `LFUCache` described below. Class description: Implement the LFUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int Each frequency has a custom linked list We track the minimum frequency with hashmaps. This frequency can always be found wheneve...
e8bffeb457936d28c75ecfefb5a1f316c15a9b6c
<|skeleton|> class LFUCache: def __init__(self, capacity): """:type capacity: int Each frequency has a custom linked list We track the minimum frequency with hashmaps. This frequency can always be found whenever we override it, usually by resetting it to one.""" <|body_0|> def get(self, key): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LFUCache: def __init__(self, capacity): """:type capacity: int Each frequency has a custom linked list We track the minimum frequency with hashmaps. This frequency can always be found whenever we override it, usually by resetting it to one.""" self.capacity = capacity self.cur_size = 0...
the_stack_v2_python_sparse
Leetcode/460-LFU-cache.py
EdwaRen/Competitve-Programming
train
1
13862ee6a7e468bf2e4b73072a2960e0d647d72c
[ "if self.request.user.is_authenticated:\n session_sub = Sub.objects.get(user=self.request.user)\n return {'session_sub': session_sub}\nreturn None", "queryset = self.get_queryset()\ncontext = self.get_serializer_context()\nresults = self.paginator.paginate_queryset(queryset, request)\nposts = self.serialize...
<|body_start_0|> if self.request.user.is_authenticated: session_sub = Sub.objects.get(user=self.request.user) return {'session_sub': session_sub} return None <|end_body_0|> <|body_start_1|> queryset = self.get_queryset() context = self.get_serializer_context() ...
provide a base view that can be inherited
GenericListAPIView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GenericListAPIView: """provide a base view that can be inherited""" def get_serializer_context(self): """get context to be used by serializer""" <|body_0|> def list(self, request, *args, **kwargs): """override list method and return a list of filtered Post object...
stack_v2_sparse_classes_75kplus_train_073298
2,393
no_license
[ { "docstring": "get context to be used by serializer", "name": "get_serializer_context", "signature": "def get_serializer_context(self)" }, { "docstring": "override list method and return a list of filtered Post objects", "name": "list", "signature": "def list(self, request, *args, **kwa...
2
stack_v2_sparse_classes_30k_train_011746
Implement the Python class `GenericListAPIView` described below. Class description: provide a base view that can be inherited Method signatures and docstrings: - def get_serializer_context(self): get context to be used by serializer - def list(self, request, *args, **kwargs): override list method and return a list of...
Implement the Python class `GenericListAPIView` described below. Class description: provide a base view that can be inherited Method signatures and docstrings: - def get_serializer_context(self): get context to be used by serializer - def list(self, request, *args, **kwargs): override list method and return a list of...
a20bc7b0be7092788df720e48f163bacaa508b3d
<|skeleton|> class GenericListAPIView: """provide a base view that can be inherited""" def get_serializer_context(self): """get context to be used by serializer""" <|body_0|> def list(self, request, *args, **kwargs): """override list method and return a list of filtered Post object...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GenericListAPIView: """provide a base view that can be inherited""" def get_serializer_context(self): """get context to be used by serializer""" if self.request.user.is_authenticated: session_sub = Sub.objects.get(user=self.request.user) return {'session_sub': sess...
the_stack_v2_python_sparse
src/posts_app/views/GenericListAPIViews.py
mrpiggy97/bloggit_api
train
0
c5e0dad4cc0eed51beef649c18f3b2d6113f20b9
[ "self.n_kernels = n_kernels\nself.n_strides = n_strides\nself.dropout = dropout\nself.norm_type = normalization\nself.activation_type = activation", "if padding:\n activation = Conv2D(filters=n_filters, kernel_size=n_kernels if n_kernels else self.n_kernels, strides=n_strides if n_strides else self.n_strides, ...
<|body_start_0|> self.n_kernels = n_kernels self.n_strides = n_strides self.dropout = dropout self.norm_type = normalization self.activation_type = activation <|end_body_0|> <|body_start_1|> if padding: activation = Conv2D(filters=n_filters, kernel_size=n_ker...
Class to create Patch blocks for the Discriminator.
PatchBlock
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PatchBlock: """Class to create Patch blocks for the Discriminator.""" def __init__(self, n_kernels, n_strides, dropout, activation, normalization): """Initialize the Patchblock. Args: n_kernels (int): Number of kernels for Conv2D. n_strides (int): Stride size. dropout (float): Includ...
stack_v2_sparse_classes_75kplus_train_073299
11,636
no_license
[ { "docstring": "Initialize the Patchblock. Args: n_kernels (int): Number of kernels for Conv2D. n_strides (int): Stride size. dropout (float): Include dropout for intermediate layers. activation (str): Type of activation layer to use. normalization (str): Type of normalization layer to use.", "name": "__ini...
2
stack_v2_sparse_classes_30k_train_003442
Implement the Python class `PatchBlock` described below. Class description: Class to create Patch blocks for the Discriminator. Method signatures and docstrings: - def __init__(self, n_kernels, n_strides, dropout, activation, normalization): Initialize the Patchblock. Args: n_kernels (int): Number of kernels for Conv...
Implement the Python class `PatchBlock` described below. Class description: Class to create Patch blocks for the Discriminator. Method signatures and docstrings: - def __init__(self, n_kernels, n_strides, dropout, activation, normalization): Initialize the Patchblock. Args: n_kernels (int): Number of kernels for Conv...
1b953d87968dac46ebbc9b1d5c254ea9493ee328
<|skeleton|> class PatchBlock: """Class to create Patch blocks for the Discriminator.""" def __init__(self, n_kernels, n_strides, dropout, activation, normalization): """Initialize the Patchblock. Args: n_kernels (int): Number of kernels for Conv2D. n_strides (int): Stride size. dropout (float): Includ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PatchBlock: """Class to create Patch blocks for the Discriminator.""" def __init__(self, n_kernels, n_strides, dropout, activation, normalization): """Initialize the Patchblock. Args: n_kernels (int): Number of kernels for Conv2D. n_strides (int): Stride size. dropout (float): Include dropout for...
the_stack_v2_python_sparse
fmlwright/trainer/neural_networks/blocks.py
rgresia-umd/fml-wright
train
0