blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
6.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
438
7.52k
id
stringlengths
40
40
length_bytes
int64
506
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.25k
prompted_full_text
stringlengths
645
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.34k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
302
7.33k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
c68fc85e83eb424ffa23ce3f9e648f1c6a1ba6b1
[ "if a & 1:\n return 3 * a + 1\nelse:\n return int(a / 2)", "seq = []\nwhile True:\n a = cls.collatz(a)\n seq.append(a)\n if a == 1:\n break\nreturn seq", "seq = cls.collatzSequence(a)\nseq = [a] + list(seq[0:-1])\nreturn tuple(map(lambda x: 1 - x & 1, seq))", "w = 1\nfor i in seq[::-1]:\...
<|body_start_0|> if a & 1: return 3 * a + 1 else: return int(a / 2) <|end_body_0|> <|body_start_1|> seq = [] while True: a = cls.collatz(a) seq.append(a) if a == 1: break return seq <|end_body_1|> <|bod...
contains common functions for Collatz Conjecture all methods in this class are class methods so no object creation required
Collatz
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Collatz: """contains common functions for Collatz Conjecture all methods in this class are class methods so no object creation required""" def collatz(cls, a): """apply collatz function on a given number Parameters ---------- a : int Return ------ int""" <|body_0|> def c...
stack_v2_sparse_classes_36k_train_011100
3,247
no_license
[ { "docstring": "apply collatz function on a given number Parameters ---------- a : int Return ------ int", "name": "collatz", "signature": "def collatz(cls, a)" }, { "docstring": "return the collatz sequence of a number This will calculate all the sequence of numbers to get to 1 using collatz fu...
4
stack_v2_sparse_classes_30k_train_004026
Implement the Python class `Collatz` described below. Class description: contains common functions for Collatz Conjecture all methods in this class are class methods so no object creation required Method signatures and docstrings: - def collatz(cls, a): apply collatz function on a given number Parameters ---------- a...
Implement the Python class `Collatz` described below. Class description: contains common functions for Collatz Conjecture all methods in this class are class methods so no object creation required Method signatures and docstrings: - def collatz(cls, a): apply collatz function on a given number Parameters ---------- a...
2fa4eb77826e6d0f901043a900331b0c5e1f24ce
<|skeleton|> class Collatz: """contains common functions for Collatz Conjecture all methods in this class are class methods so no object creation required""" def collatz(cls, a): """apply collatz function on a given number Parameters ---------- a : int Return ------ int""" <|body_0|> def c...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Collatz: """contains common functions for Collatz Conjecture all methods in this class are class methods so no object creation required""" def collatz(cls, a): """apply collatz function on a given number Parameters ---------- a : int Return ------ int""" if a & 1: return 3 * a...
the_stack_v2_python_sparse
collatz.py
ink-hat/xmark
train
1
5587c4f7dfff44dac2a119e2496c1c9512ac691a
[ "if model._meta.app_label == 'statis':\n return 'statis'\nreturn None", "if model._meta.app_label == 'statis':\n return 'statis'\nreturn None", "if obj1._meta.app_label == 'statis' or obj2._meta.app_label == 'statis':\n return True\nreturn None" ]
<|body_start_0|> if model._meta.app_label == 'statis': return 'statis' return None <|end_body_0|> <|body_start_1|> if model._meta.app_label == 'statis': return 'statis' return None <|end_body_1|> <|body_start_2|> if obj1._meta.app_label == 'statis' or ob...
A router to control all database operations on models in the auth application.
StatisRouter
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StatisRouter: """A router to control all database operations on models in the auth application.""" def db_for_read(self, model, **hints): """Attempts to read auth models go to auth_db.""" <|body_0|> def db_for_write(self, model, **hints): """Attempts to write aut...
stack_v2_sparse_classes_36k_train_011101
1,986
permissive
[ { "docstring": "Attempts to read auth models go to auth_db.", "name": "db_for_read", "signature": "def db_for_read(self, model, **hints)" }, { "docstring": "Attempts to write auth models go to auth_db.", "name": "db_for_write", "signature": "def db_for_write(self, model, **hints)" }, ...
3
stack_v2_sparse_classes_30k_train_014673
Implement the Python class `StatisRouter` described below. Class description: A router to control all database operations on models in the auth application. Method signatures and docstrings: - def db_for_read(self, model, **hints): Attempts to read auth models go to auth_db. - def db_for_write(self, model, **hints): ...
Implement the Python class `StatisRouter` described below. Class description: A router to control all database operations on models in the auth application. Method signatures and docstrings: - def db_for_read(self, model, **hints): Attempts to read auth models go to auth_db. - def db_for_write(self, model, **hints): ...
38a551ad768b078278f749e8db8947a00827f1e5
<|skeleton|> class StatisRouter: """A router to control all database operations on models in the auth application.""" def db_for_read(self, model, **hints): """Attempts to read auth models go to auth_db.""" <|body_0|> def db_for_write(self, model, **hints): """Attempts to write aut...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StatisRouter: """A router to control all database operations on models in the auth application.""" def db_for_read(self, model, **hints): """Attempts to read auth models go to auth_db.""" if model._meta.app_label == 'statis': return 'statis' return None def db_for...
the_stack_v2_python_sparse
web_project/app/dbrouter/router.py
cash2one/fruit
train
0
7dd95669338e433f0ed8768f3629ee091e61181a
[ "if not value:\n return []\nreturn value.split(',')", "super().validate(value)\nfor email in value:\n validate_email(email)" ]
<|body_start_0|> if not value: return [] return value.split(',') <|end_body_0|> <|body_start_1|> super().validate(value) for email in value: validate_email(email) <|end_body_1|>
MultiEmailField
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiEmailField: def to_python(self, value): """Normalize data to a list of strings.""" <|body_0|> def validate(self, value): """Check if value consists only of valid emails.""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not value: ...
stack_v2_sparse_classes_36k_train_011102
1,491
permissive
[ { "docstring": "Normalize data to a list of strings.", "name": "to_python", "signature": "def to_python(self, value)" }, { "docstring": "Check if value consists only of valid emails.", "name": "validate", "signature": "def validate(self, value)" } ]
2
stack_v2_sparse_classes_30k_train_015761
Implement the Python class `MultiEmailField` described below. Class description: Implement the MultiEmailField class. Method signatures and docstrings: - def to_python(self, value): Normalize data to a list of strings. - def validate(self, value): Check if value consists only of valid emails.
Implement the Python class `MultiEmailField` described below. Class description: Implement the MultiEmailField class. Method signatures and docstrings: - def to_python(self, value): Normalize data to a list of strings. - def validate(self, value): Check if value consists only of valid emails. <|skeleton|> class Mult...
1babcecabc42b325dc647294599c309d6bda1ad5
<|skeleton|> class MultiEmailField: def to_python(self, value): """Normalize data to a list of strings.""" <|body_0|> def validate(self, value): """Check if value consists only of valid emails.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MultiEmailField: def to_python(self, value): """Normalize data to a list of strings.""" if not value: return [] return value.split(',') def validate(self, value): """Check if value consists only of valid emails.""" super().validate(value) for em...
the_stack_v2_python_sparse
coworker/place/fields.py
upstar77/spacemap
train
0
d7170b7b793d57f11f5c2c21e0a29cd61ec4cc40
[ "self.max_n = n\nself.solution_arr = list()\nself.all_fibs = list()", "self.all_fibs.append(2)\nself.all_fibs.append(1)\nfib_nr = 2\nwhile fib_nr < self.max_n:\n fib_nr = self.all_fibs[0] + self.all_fibs[1]\n self.all_fibs.insert(0, fib_nr)", "self.get_all_fibs()\nself.partition(solution=[])\nif self.solu...
<|body_start_0|> self.max_n = n self.solution_arr = list() self.all_fibs = list() <|end_body_0|> <|body_start_1|> self.all_fibs.append(2) self.all_fibs.append(1) fib_nr = 2 while fib_nr < self.max_n: fib_nr = self.all_fibs[0] + self.all_fibs[1] ...
Class for solving the challenge
FibSolver
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FibSolver: """Class for solving the challenge""" def __init__(self, n: int): """init the solution""" <|body_0|> def get_all_fibs(self): """Generate all fibonacci numbers""" <|body_1|> def find_solutions(self): """Print all solutions""" ...
stack_v2_sparse_classes_36k_train_011103
1,596
no_license
[ { "docstring": "init the solution", "name": "__init__", "signature": "def __init__(self, n: int)" }, { "docstring": "Generate all fibonacci numbers", "name": "get_all_fibs", "signature": "def get_all_fibs(self)" }, { "docstring": "Print all solutions", "name": "find_solutions...
4
null
Implement the Python class `FibSolver` described below. Class description: Class for solving the challenge Method signatures and docstrings: - def __init__(self, n: int): init the solution - def get_all_fibs(self): Generate all fibonacci numbers - def find_solutions(self): Print all solutions - def partition(self, id...
Implement the Python class `FibSolver` described below. Class description: Class for solving the challenge Method signatures and docstrings: - def __init__(self, n: int): init the solution - def get_all_fibs(self): Generate all fibonacci numbers - def find_solutions(self): Print all solutions - def partition(self, id...
63fb76188e132564e50feefd2d9d5b8491568948
<|skeleton|> class FibSolver: """Class for solving the challenge""" def __init__(self, n: int): """init the solution""" <|body_0|> def get_all_fibs(self): """Generate all fibonacci numbers""" <|body_1|> def find_solutions(self): """Print all solutions""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FibSolver: """Class for solving the challenge""" def __init__(self, n: int): """init the solution""" self.max_n = n self.solution_arr = list() self.all_fibs = list() def get_all_fibs(self): """Generate all fibonacci numbers""" self.all_fibs.append(2) ...
the_stack_v2_python_sparse
challenge-077/lubos-kolouch/python/ch-1.py
southpawgeek/perlweeklychallenge-club
train
1
13ecdc3abf138774ecd6ae0a21a5abc0bc3c11a0
[ "try:\n uuid_value = getattr(model, 'uuid')\n return uuid_value[:8] + '_' + uuid_value[-12:]\nexcept:\n return 'no_model_uuid'", "if username is None:\n return 'anonymous'\nelse:\n return username", "if test is None:\n return 'raw simulation without running any CerebUnit test'\nelse:\n retu...
<|body_start_0|> try: uuid_value = getattr(model, 'uuid') return uuid_value[:8] + '_' + uuid_value[-12:] except: return 'no_model_uuid' <|end_body_0|> <|body_start_1|> if username is None: return 'anonymous' else: return userna...
**Available Methods:** +---------------------------------+----------------------------------+ | Method name | Method type | +=================================+==================================+ | :py:meth:`.forfile` | class method | +---------------------------------+----------------------------------+ | :py:meth:`.ge...
FileGenerator
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FileGenerator: """**Available Methods:** +---------------------------------+----------------------------------+ | Method name | Method type | +=================================+==================================+ | :py:meth:`.forfile` | class method | +---------------------------------+----------...
stack_v2_sparse_classes_36k_train_011104
7,147
permissive
[ { "docstring": "Try extracting the ``uuid`` attribute value of the model and return it or return ``\"no_model_uuid\"``. **Argument:** The instantiated model is passed into this function.", "name": "get_modelID", "signature": "def get_modelID(model)" }, { "docstring": "Returns the username (also ...
6
null
Implement the Python class `FileGenerator` described below. Class description: **Available Methods:** +---------------------------------+----------------------------------+ | Method name | Method type | +=================================+==================================+ | :py:meth:`.forfile` | class method | +-----...
Implement the Python class `FileGenerator` described below. Class description: **Available Methods:** +---------------------------------+----------------------------------+ | Method name | Method type | +=================================+==================================+ | :py:meth:`.forfile` | class method | +-----...
316d69d7aed7a0292ce93c7fea20473e48cfce60
<|skeleton|> class FileGenerator: """**Available Methods:** +---------------------------------+----------------------------------+ | Method name | Method type | +=================================+==================================+ | :py:meth:`.forfile` | class method | +---------------------------------+----------...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FileGenerator: """**Available Methods:** +---------------------------------+----------------------------------+ | Method name | Method type | +=================================+==================================+ | :py:meth:`.forfile` | class method | +---------------------------------+-----------------------...
the_stack_v2_python_sparse
managers/operatorsTranscribe/metadata_filegenerator.py
cerebunit/cerebmodels
train
0
6020acf1143a12164983ea1e03fd1c2d2c0b8430
[ "try:\n verify_token(request.headers)\nexcept Exception as err:\n ns.abort(401, message=err)\ntry:\n prog = programas_sociales.read(id)\nexcept psycopg2.Error as err:\n ns.abort(400, message=get_msg_pgerror(err))\nexcept EmptySetError:\n ns.abort(404, message=self.progr_not_found)\nexcept Exception a...
<|body_start_0|> try: verify_token(request.headers) except Exception as err: ns.abort(401, message=err) try: prog = programas_sociales.read(id) except psycopg2.Error as err: ns.abort(400, message=get_msg_pgerror(err)) except EmptySe...
ProgramaSocial
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProgramaSocial: def get(self, id): """Recuperar un programa social""" <|body_0|> def put(self, id): """Actualizar un programa social""" <|body_1|> def delete(self, id): """Eliminar un programa social""" <|body_2|> <|end_skeleton|> <|bod...
stack_v2_sparse_classes_36k_train_011105
6,332
no_license
[ { "docstring": "Recuperar un programa social", "name": "get", "signature": "def get(self, id)" }, { "docstring": "Actualizar un programa social", "name": "put", "signature": "def put(self, id)" }, { "docstring": "Eliminar un programa social", "name": "delete", "signature"...
3
stack_v2_sparse_classes_30k_train_007117
Implement the Python class `ProgramaSocial` described below. Class description: Implement the ProgramaSocial class. Method signatures and docstrings: - def get(self, id): Recuperar un programa social - def put(self, id): Actualizar un programa social - def delete(self, id): Eliminar un programa social
Implement the Python class `ProgramaSocial` described below. Class description: Implement the ProgramaSocial class. Method signatures and docstrings: - def get(self, id): Recuperar un programa social - def put(self, id): Actualizar un programa social - def delete(self, id): Eliminar un programa social <|skeleton|> c...
e00610fac26ef3ca078fd037c0649b70fa0e9a09
<|skeleton|> class ProgramaSocial: def get(self, id): """Recuperar un programa social""" <|body_0|> def put(self, id): """Actualizar un programa social""" <|body_1|> def delete(self, id): """Eliminar un programa social""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProgramaSocial: def get(self, id): """Recuperar un programa social""" try: verify_token(request.headers) except Exception as err: ns.abort(401, message=err) try: prog = programas_sociales.read(id) except psycopg2.Error as err: ...
the_stack_v2_python_sparse
DOS/soa/service/genl/endpoints/programas_sociales.py
Telematica/knight-rider
train
1
8c7cfa3d87641eb05219100477fa3ddc517a357e
[ "if not head:\n return 0\ngraph = {}\nfor node in G:\n graph[node] = []\nprev = head\ncurr = head.next\nwhile curr:\n if prev.val in graph and curr.val in graph:\n graph[prev.val].append(curr.val)\n graph[curr.val].append(prev.val)\n prev, curr = (curr, curr.next)\n\ndef dfs_from(visited, ...
<|body_start_0|> if not head: return 0 graph = {} for node in G: graph[node] = [] prev = head curr = head.next while curr: if prev.val in graph and curr.val in graph: graph[prev.val].append(curr.val) grap...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def numComponents(self, head: ListNode, G: List[int]) -> int: """The crazy solution is to go for a graph""" <|body_0|> def numComponents(self, head: ListNode, G: List[int]) -> int: """The wise solution is just to check if a node is missing in G""" <...
stack_v2_sparse_classes_36k_train_011106
2,254
no_license
[ { "docstring": "The crazy solution is to go for a graph", "name": "numComponents", "signature": "def numComponents(self, head: ListNode, G: List[int]) -> int" }, { "docstring": "The wise solution is just to check if a node is missing in G", "name": "numComponents", "signature": "def numC...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numComponents(self, head: ListNode, G: List[int]) -> int: The crazy solution is to go for a graph - def numComponents(self, head: ListNode, G: List[int]) -> int: The wise sol...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numComponents(self, head: ListNode, G: List[int]) -> int: The crazy solution is to go for a graph - def numComponents(self, head: ListNode, G: List[int]) -> int: The wise sol...
3ffcfee5cedf421d5de6d0dec4ba53b0eecbbff8
<|skeleton|> class Solution: def numComponents(self, head: ListNode, G: List[int]) -> int: """The crazy solution is to go for a graph""" <|body_0|> def numComponents(self, head: ListNode, G: List[int]) -> int: """The wise solution is just to check if a node is missing in G""" <...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def numComponents(self, head: ListNode, G: List[int]) -> int: """The crazy solution is to go for a graph""" if not head: return 0 graph = {} for node in G: graph[node] = [] prev = head curr = head.next while curr: ...
the_stack_v2_python_sparse
linked/LinkedListComponents.py
QuentinDuval/PythonExperiments
train
3
752da414c55b3fe8263ed1021c94349cd718e345
[ "try:\n with db.cursor() as cursor:\n sql = \"\\n SELECT \\n c.id as coupon_id,\\n ct.name as coupon_type,\\n ci.name as coupon_issue,\\n cd.name as coupon_name, \\n cd.discount_price,\\n ...
<|body_start_0|> try: with db.cursor() as cursor: sql = "\n SELECT \n c.id as coupon_id,\n ct.name as coupon_type,\n ci.name as coupon_issue,\n cd.name as coupon_name, \n cd....
CouponDao
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CouponDao: def get_coupons(self, db): """다운로드 가능한 쿠폰조회 - Persistence Layer(Model) function Args : db : 데이터베이스 연결 객체 Returns : 쿠폰리스트 Authors : 1218kim23@gmail.com(김기욱) History : 2020-10-07 : 초기생성""" <|body_0|> def check_downloaded_coupons(self, user_id, c, db): """쿠폰 ...
stack_v2_sparse_classes_36k_train_011107
6,989
no_license
[ { "docstring": "다운로드 가능한 쿠폰조회 - Persistence Layer(Model) function Args : db : 데이터베이스 연결 객체 Returns : 쿠폰리스트 Authors : 1218kim23@gmail.com(김기욱) History : 2020-10-07 : 초기생성", "name": "get_coupons", "signature": "def get_coupons(self, db)" }, { "docstring": "쿠폰 다운로드 유무 체크 - Persistence Layer(Model) ...
5
stack_v2_sparse_classes_30k_train_013296
Implement the Python class `CouponDao` described below. Class description: Implement the CouponDao class. Method signatures and docstrings: - def get_coupons(self, db): 다운로드 가능한 쿠폰조회 - Persistence Layer(Model) function Args : db : 데이터베이스 연결 객체 Returns : 쿠폰리스트 Authors : 1218kim23@gmail.com(김기욱) History : 2020-10-07 : ...
Implement the Python class `CouponDao` described below. Class description: Implement the CouponDao class. Method signatures and docstrings: - def get_coupons(self, db): 다운로드 가능한 쿠폰조회 - Persistence Layer(Model) function Args : db : 데이터베이스 연결 객체 Returns : 쿠폰리스트 Authors : 1218kim23@gmail.com(김기욱) History : 2020-10-07 : ...
a1a799e3643eca088531de6ab5adf5559613efd8
<|skeleton|> class CouponDao: def get_coupons(self, db): """다운로드 가능한 쿠폰조회 - Persistence Layer(Model) function Args : db : 데이터베이스 연결 객체 Returns : 쿠폰리스트 Authors : 1218kim23@gmail.com(김기욱) History : 2020-10-07 : 초기생성""" <|body_0|> def check_downloaded_coupons(self, user_id, c, db): """쿠폰 ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CouponDao: def get_coupons(self, db): """다운로드 가능한 쿠폰조회 - Persistence Layer(Model) function Args : db : 데이터베이스 연결 객체 Returns : 쿠폰리스트 Authors : 1218kim23@gmail.com(김기욱) History : 2020-10-07 : 초기생성""" try: with db.cursor() as cursor: sql = "\n SELECT \n ...
the_stack_v2_python_sparse
service_back/model/coupon_dao.py
taeha7b/Service
train
0
ba912051ccec2401d9fcb658c84ac4edce1c48d3
[ "try:\n self.user = User.objects.get(email=attrs['email'])\nexcept User.DoesNotExist:\n raise serializers.ValidationError('Invalid email address')\nreturn attrs", "new_password = User.objects.make_random_password(length=10)\nself.user.set_password(new_password)\nself.user.save()\nsend_mail('Password reset',...
<|body_start_0|> try: self.user = User.objects.get(email=attrs['email']) except User.DoesNotExist: raise serializers.ValidationError('Invalid email address') return attrs <|end_body_0|> <|body_start_1|> new_password = User.objects.make_random_password(length=10) ...
Serializes email and provides method to reset password for user with passed email
ResetPasswordSerializer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResetPasswordSerializer: """Serializes email and provides method to reset password for user with passed email""" def validate(self, attrs): """Checks if user with passed email exists in database""" <|body_0|> def reset_password(self): """Generate and set new pass...
stack_v2_sparse_classes_36k_train_011108
16,387
no_license
[ { "docstring": "Checks if user with passed email exists in database", "name": "validate", "signature": "def validate(self, attrs)" }, { "docstring": "Generate and set new password. Send email with new password", "name": "reset_password", "signature": "def reset_password(self)" } ]
2
stack_v2_sparse_classes_30k_train_008653
Implement the Python class `ResetPasswordSerializer` described below. Class description: Serializes email and provides method to reset password for user with passed email Method signatures and docstrings: - def validate(self, attrs): Checks if user with passed email exists in database - def reset_password(self): Gene...
Implement the Python class `ResetPasswordSerializer` described below. Class description: Serializes email and provides method to reset password for user with passed email Method signatures and docstrings: - def validate(self, attrs): Checks if user with passed email exists in database - def reset_password(self): Gene...
8eee83921563a7410c2d12a396ef93e0a895e0f4
<|skeleton|> class ResetPasswordSerializer: """Serializes email and provides method to reset password for user with passed email""" def validate(self, attrs): """Checks if user with passed email exists in database""" <|body_0|> def reset_password(self): """Generate and set new pass...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ResetPasswordSerializer: """Serializes email and provides method to reset password for user with passed email""" def validate(self, attrs): """Checks if user with passed email exists in database""" try: self.user = User.objects.get(email=attrs['email']) except User.Doe...
the_stack_v2_python_sparse
citifleet/users/serializers.py
CityFleetApp/backend
train
0
490b8cb3534d501c235da6e93a5d649dbb153400
[ "resp = req.get_response(self.app, method='HEAD')\nacl = resp.object_acl if req.is_object_request else resp.bucket_acl\nresp = HTTPOk()\nresp.body = tostring(acl.elem())\nreturn resp", "if req.is_object_request:\n headers = {}\n src_path = '/%s/%s' % (req.container_name, req.object_name)\n headers['X-Cop...
<|body_start_0|> resp = req.get_response(self.app, method='HEAD') acl = resp.object_acl if req.is_object_request else resp.bucket_acl resp = HTTPOk() resp.body = tostring(acl.elem()) return resp <|end_body_0|> <|body_start_1|> if req.is_object_request: header...
Handles the following APIs: * GET Bucket acl * PUT Bucket acl * GET Object acl * PUT Object acl Those APIs are logged as ACL operations in the S3 server log.
S3AclController
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class S3AclController: """Handles the following APIs: * GET Bucket acl * PUT Bucket acl * GET Object acl * PUT Object acl Those APIs are logged as ACL operations in the S3 server log.""" def GET(self, req): """Handles GET Bucket acl and GET Object acl.""" <|body_0|> def PUT(se...
stack_v2_sparse_classes_36k_train_011109
2,097
permissive
[ { "docstring": "Handles GET Bucket acl and GET Object acl.", "name": "GET", "signature": "def GET(self, req)" }, { "docstring": "Handles PUT Bucket acl and PUT Object acl.", "name": "PUT", "signature": "def PUT(self, req)" } ]
2
stack_v2_sparse_classes_30k_train_012128
Implement the Python class `S3AclController` described below. Class description: Handles the following APIs: * GET Bucket acl * PUT Bucket acl * GET Object acl * PUT Object acl Those APIs are logged as ACL operations in the S3 server log. Method signatures and docstrings: - def GET(self, req): Handles GET Bucket acl ...
Implement the Python class `S3AclController` described below. Class description: Handles the following APIs: * GET Bucket acl * PUT Bucket acl * GET Object acl * PUT Object acl Those APIs are logged as ACL operations in the S3 server log. Method signatures and docstrings: - def GET(self, req): Handles GET Bucket acl ...
f06e5369579599648cc78e4b556887bc6d978c2b
<|skeleton|> class S3AclController: """Handles the following APIs: * GET Bucket acl * PUT Bucket acl * GET Object acl * PUT Object acl Those APIs are logged as ACL operations in the S3 server log.""" def GET(self, req): """Handles GET Bucket acl and GET Object acl.""" <|body_0|> def PUT(se...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class S3AclController: """Handles the following APIs: * GET Bucket acl * PUT Bucket acl * GET Object acl * PUT Object acl Those APIs are logged as ACL operations in the S3 server log.""" def GET(self, req): """Handles GET Bucket acl and GET Object acl.""" resp = req.get_response(self.app, metho...
the_stack_v2_python_sparse
swift/common/middleware/s3api/controllers/s3_acl.py
openstack/swift
train
2,370
48c872e2fbd0632b2be57454b8af44263048dbc8
[ "status = attrs.get('status')\nnote = attrs.get('note')\nif status == SubmissionReview.REJECTED and (not note):\n raise exceptions.ValidationError({'note': COMMENT_REQUIRED})\nreturn attrs", "request = self.context.get('request')\nif request:\n validated_data['created_by'] = request.user\nif 'note' in valid...
<|body_start_0|> status = attrs.get('status') note = attrs.get('note') if status == SubmissionReview.REJECTED and (not note): raise exceptions.ValidationError({'note': COMMENT_REQUIRED}) return attrs <|end_body_0|> <|body_start_1|> request = self.context.get('request...
SubmissionReviewSerializer Class
SubmissionReviewSerializer
[ "BSD-2-Clause", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SubmissionReviewSerializer: """SubmissionReviewSerializer Class""" def validate(self, attrs): """Custom Validate Method for SubmissionReviewSerializer""" <|body_0|> def create(self, validated_data): """Custom create method for SubmissionReviewSerializer""" ...
stack_v2_sparse_classes_36k_train_011110
2,435
permissive
[ { "docstring": "Custom Validate Method for SubmissionReviewSerializer", "name": "validate", "signature": "def validate(self, attrs)" }, { "docstring": "Custom create method for SubmissionReviewSerializer", "name": "create", "signature": "def create(self, validated_data)" }, { "do...
3
null
Implement the Python class `SubmissionReviewSerializer` described below. Class description: SubmissionReviewSerializer Class Method signatures and docstrings: - def validate(self, attrs): Custom Validate Method for SubmissionReviewSerializer - def create(self, validated_data): Custom create method for SubmissionRevie...
Implement the Python class `SubmissionReviewSerializer` described below. Class description: SubmissionReviewSerializer Class Method signatures and docstrings: - def validate(self, attrs): Custom Validate Method for SubmissionReviewSerializer - def create(self, validated_data): Custom create method for SubmissionRevie...
e5bdec91cb47179172b515bbcb91701262ff3377
<|skeleton|> class SubmissionReviewSerializer: """SubmissionReviewSerializer Class""" def validate(self, attrs): """Custom Validate Method for SubmissionReviewSerializer""" <|body_0|> def create(self, validated_data): """Custom create method for SubmissionReviewSerializer""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SubmissionReviewSerializer: """SubmissionReviewSerializer Class""" def validate(self, attrs): """Custom Validate Method for SubmissionReviewSerializer""" status = attrs.get('status') note = attrs.get('note') if status == SubmissionReview.REJECTED and (not note): ...
the_stack_v2_python_sparse
onadata/libs/serializers/submission_review_serializer.py
onaio/onadata
train
177
3c88f93df22dfcd613ae198b0733b3e1a3c96890
[ "self.d = {}\nfor i, elem in enumerate(arr):\n if self.d.has_key(elem):\n self.d[elem].append(i)\n else:\n self.d[elem] = [i]", "if value not in self.d.keys():\n return 0\nres = 0\nfor ind in self.d[value]:\n if left <= ind <= right:\n res += 1\nreturn res" ]
<|body_start_0|> self.d = {} for i, elem in enumerate(arr): if self.d.has_key(elem): self.d[elem].append(i) else: self.d[elem] = [i] <|end_body_0|> <|body_start_1|> if value not in self.d.keys(): return 0 res = 0 ...
RangeFreqQuery
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RangeFreqQuery: def __init__(self, arr): """:type arr: List[int]""" <|body_0|> def query(self, left, right, value): """:type left: int :type right: int :type value: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.d = {} ...
stack_v2_sparse_classes_36k_train_011111
1,037
no_license
[ { "docstring": ":type arr: List[int]", "name": "__init__", "signature": "def __init__(self, arr)" }, { "docstring": ":type left: int :type right: int :type value: int :rtype: int", "name": "query", "signature": "def query(self, left, right, value)" } ]
2
stack_v2_sparse_classes_30k_train_010456
Implement the Python class `RangeFreqQuery` described below. Class description: Implement the RangeFreqQuery class. Method signatures and docstrings: - def __init__(self, arr): :type arr: List[int] - def query(self, left, right, value): :type left: int :type right: int :type value: int :rtype: int
Implement the Python class `RangeFreqQuery` described below. Class description: Implement the RangeFreqQuery class. Method signatures and docstrings: - def __init__(self, arr): :type arr: List[int] - def query(self, left, right, value): :type left: int :type right: int :type value: int :rtype: int <|skeleton|> class...
ee59b82125f100970c842d5e1245287c484d6649
<|skeleton|> class RangeFreqQuery: def __init__(self, arr): """:type arr: List[int]""" <|body_0|> def query(self, left, right, value): """:type left: int :type right: int :type value: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RangeFreqQuery: def __init__(self, arr): """:type arr: List[int]""" self.d = {} for i, elem in enumerate(arr): if self.d.has_key(elem): self.d[elem].append(i) else: self.d[elem] = [i] def query(self, left, right, value): ...
the_stack_v2_python_sparse
_CodeTopics/LeetCode_contest/weekly/weekly2021/268/TLE--268_3.py
BIAOXYZ/variousCodes
train
0
e7c01186267cb80bb25b592346df7f6f5918cd11
[ "treatment_request = json.loads(request.body.decode('utf-8'))\nTreatmentView.validate_treatment_request(treatment_request)\nnew_treatment_info = TreatmentService.treat_patient(treatment_request, id_patient, id_treatment_cycle, request.auth_user['id'])\nreturn JsonResponse(new_treatment_info)", "pagination_args = ...
<|body_start_0|> treatment_request = json.loads(request.body.decode('utf-8')) TreatmentView.validate_treatment_request(treatment_request) new_treatment_info = TreatmentService.treat_patient(treatment_request, id_patient, id_treatment_cycle, request.auth_user['id']) return JsonResponse(ne...
All endpoints related to treatment actions
TreatmentView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TreatmentView: """All endpoints related to treatment actions""" def post(request, id_patient, id_treatment_cycle): """Action when calling the endpoint with POST""" <|body_0|> def get(request, id_patient, id_treatment_cycle): """Action when calling the endpoint wi...
stack_v2_sparse_classes_36k_train_011112
9,453
no_license
[ { "docstring": "Action when calling the endpoint with POST", "name": "post", "signature": "def post(request, id_patient, id_treatment_cycle)" }, { "docstring": "Action when calling the endpoint with GET Return list of treatments of treatment cycle :param id_treatment_cycle: :param id_patient: :p...
3
null
Implement the Python class `TreatmentView` described below. Class description: All endpoints related to treatment actions Method signatures and docstrings: - def post(request, id_patient, id_treatment_cycle): Action when calling the endpoint with POST - def get(request, id_patient, id_treatment_cycle): Action when ca...
Implement the Python class `TreatmentView` described below. Class description: All endpoints related to treatment actions Method signatures and docstrings: - def post(request, id_patient, id_treatment_cycle): Action when calling the endpoint with POST - def get(request, id_patient, id_treatment_cycle): Action when ca...
941e8b2870f8724db3d5103dda5157fd597cfcc7
<|skeleton|> class TreatmentView: """All endpoints related to treatment actions""" def post(request, id_patient, id_treatment_cycle): """Action when calling the endpoint with POST""" <|body_0|> def get(request, id_patient, id_treatment_cycle): """Action when calling the endpoint wi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TreatmentView: """All endpoints related to treatment actions""" def post(request, id_patient, id_treatment_cycle): """Action when calling the endpoint with POST""" treatment_request = json.loads(request.body.decode('utf-8')) TreatmentView.validate_treatment_request(treatment_reque...
the_stack_v2_python_sparse
backend/martin_helder/views/treatment_view.py
JoaoAlvaroFerreira/FEUP-LGP
train
1
43ff8b0c6ee8708dc99acba83615cf2f6f125781
[ "self.head = None\nif nodes is not None:\n node = Node(value=nodes.pop(0))\n self.head = node\n for elem in nodes:\n node.next = Node(value=elem)\n node = node.next", "node = self.head\nnodes = []\nwhile node is not None:\n nodes.append(node.value)\n node = node.next\nnodes.append('No...
<|body_start_0|> self.head = None if nodes is not None: node = Node(value=nodes.pop(0)) self.head = node for elem in nodes: node.next = Node(value=elem) node = node.next <|end_body_0|> <|body_start_1|> node = self.head ...
This is my Class LinkedList with methods __init__ and __insert__
LinkedList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LinkedList: """This is my Class LinkedList with methods __init__ and __insert__""" def __init__(self, nodes=None): """This is my initialize of LinkedList""" <|body_0|> def __repr__(self): """Return an object instance""" <|body_1|> def __iter__(self):...
stack_v2_sparse_classes_36k_train_011113
2,355
no_license
[ { "docstring": "This is my initialize of LinkedList", "name": "__init__", "signature": "def __init__(self, nodes=None)" }, { "docstring": "Return an object instance", "name": "__repr__", "signature": "def __repr__(self)" }, { "docstring": "To traverse a linked list", "name": ...
3
stack_v2_sparse_classes_30k_train_014301
Implement the Python class `LinkedList` described below. Class description: This is my Class LinkedList with methods __init__ and __insert__ Method signatures and docstrings: - def __init__(self, nodes=None): This is my initialize of LinkedList - def __repr__(self): Return an object instance - def __iter__(self): To ...
Implement the Python class `LinkedList` described below. Class description: This is my Class LinkedList with methods __init__ and __insert__ Method signatures and docstrings: - def __init__(self, nodes=None): This is my initialize of LinkedList - def __repr__(self): Return an object instance - def __iter__(self): To ...
a864173664324769e9de004d387f0ffde45f5cfc
<|skeleton|> class LinkedList: """This is my Class LinkedList with methods __init__ and __insert__""" def __init__(self, nodes=None): """This is my initialize of LinkedList""" <|body_0|> def __repr__(self): """Return an object instance""" <|body_1|> def __iter__(self):...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LinkedList: """This is my Class LinkedList with methods __init__ and __insert__""" def __init__(self, nodes=None): """This is my initialize of LinkedList""" self.head = None if nodes is not None: node = Node(value=nodes.pop(0)) self.head = node ...
the_stack_v2_python_sparse
challenges/ll_merge/ll_merge.py
sydoruk89/python-data-structures-and-algorithms
train
0
a1452bb04e99ef839c88685e6a77e3733388b772
[ "mols = [Chem.MolFromSmiles(s) for s in smiles]\nscores = SmilesChecker.checkSmiles(smiles, frags=frags, no_multifrag_smiles=no_multifrag_smiles)\nfor scorer in self.scorers:\n scores.loc[:, scorer.getKey()] = scorer(mols)\nscores.loc[scores['Valid'] == 0, self.getScorerKeys()] = 0.0\nundesire = scores[self.getS...
<|body_start_0|> mols = [Chem.MolFromSmiles(s) for s in smiles] scores = SmilesChecker.checkSmiles(smiles, frags=frags, no_multifrag_smiles=no_multifrag_smiles) for scorer in self.scorers: scores.loc[:, scorer.getKey()] = scorer(mols) scores.loc[scores['Valid'] == 0, self.get...
Original implementation of the environment scoring strategy for DrugEx v3.
DrugExEnvironment
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DrugExEnvironment: """Original implementation of the environment scoring strategy for DrugEx v3.""" def getScores(self, smiles, frags=None, no_multifrag_smiles=True): """This method is used to get the scores from the scorers and to check molecule validity and desireability. Parameter...
stack_v2_sparse_classes_36k_train_011114
2,544
permissive
[ { "docstring": "This method is used to get the scores from the scorers and to check molecule validity and desireability. Parameters ---------- smiles : list of str List of SMILES strings to score. frags : list of str, optional List of SMILES strings of fragments to check for. no_multifrag_smiles : bool, optiona...
2
null
Implement the Python class `DrugExEnvironment` described below. Class description: Original implementation of the environment scoring strategy for DrugEx v3. Method signatures and docstrings: - def getScores(self, smiles, frags=None, no_multifrag_smiles=True): This method is used to get the scores from the scorers an...
Implement the Python class `DrugExEnvironment` described below. Class description: Original implementation of the environment scoring strategy for DrugEx v3. Method signatures and docstrings: - def getScores(self, smiles, frags=None, no_multifrag_smiles=True): This method is used to get the scores from the scorers an...
b61d31a4b98b6d600184e52ca24640d3e64fd425
<|skeleton|> class DrugExEnvironment: """Original implementation of the environment scoring strategy for DrugEx v3.""" def getScores(self, smiles, frags=None, no_multifrag_smiles=True): """This method is used to get the scores from the scorers and to check molecule validity and desireability. Parameter...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DrugExEnvironment: """Original implementation of the environment scoring strategy for DrugEx v3.""" def getScores(self, smiles, frags=None, no_multifrag_smiles=True): """This method is used to get the scores from the scorers and to check molecule validity and desireability. Parameters ---------- ...
the_stack_v2_python_sparse
drugex/training/environment.py
CDDLeiden/DrugEx
train
70
98db034bcef575d979fd1bcbf9d53896af0819c0
[ "super().__init__(channel)\nconfig = get_config()\nself.LOGGER = logging.getLogger('fm.device.service.messages')\nself.exchange_name = config.RABBITMQ_MESSAGES_EXCHANGE_NAME\nself.exchange_type = config.RABBITMQ_MESSAGES_EXCHANGE_TYPE\nself.routing_key = '_internal'\nself.setup_exchange(self.exchange_name)", "pay...
<|body_start_0|> super().__init__(channel) config = get_config() self.LOGGER = logging.getLogger('fm.device.service.messages') self.exchange_name = config.RABBITMQ_MESSAGES_EXCHANGE_NAME self.exchange_type = config.RABBITMQ_MESSAGES_EXCHANGE_TYPE self.routing_key = '_inte...
Receive and respond to internal message requests.
DeviceMessage
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeviceMessage: """Receive and respond to internal message requests.""" def __init__(self, channel): """Override the __init__ method from Message class. Create the logger instance, and set the required config info. Call the setup_exchange function to start the communication""" ...
stack_v2_sparse_classes_36k_train_011115
9,633
permissive
[ { "docstring": "Override the __init__ method from Message class. Create the logger instance, and set the required config info. Call the setup_exchange function to start the communication", "name": "__init__", "signature": "def __init__(self, channel)" }, { "docstring": "Invoked by pika when a me...
2
stack_v2_sparse_classes_30k_train_019369
Implement the Python class `DeviceMessage` described below. Class description: Receive and respond to internal message requests. Method signatures and docstrings: - def __init__(self, channel): Override the __init__ method from Message class. Create the logger instance, and set the required config info. Call the setu...
Implement the Python class `DeviceMessage` described below. Class description: Receive and respond to internal message requests. Method signatures and docstrings: - def __init__(self, channel): Override the __init__ method from Message class. Create the logger instance, and set the required config info. Call the setu...
7d37690a8c42091a5892aa45518bfe6003728a18
<|skeleton|> class DeviceMessage: """Receive and respond to internal message requests.""" def __init__(self, channel): """Override the __init__ method from Message class. Create the logger instance, and set the required config info. Call the setup_exchange function to start the communication""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DeviceMessage: """Receive and respond to internal message requests.""" def __init__(self, channel): """Override the __init__ method from Message class. Create the logger instance, and set the required config info. Call the setup_exchange function to start the communication""" super().__in...
the_stack_v2_python_sparse
server/fm_server/device/service.py
nstoik/farm_monitor
train
0
0ba10e5e9838fb4d7ea0f1a90122de5e7a78f3fa
[ "self.a = array_check(a, 1)\nself._n = a.size\nself._s = None\nself._r = None\nself.m = None", "self.m = int_check(m, 0)\nr, s, s_smoothing = prepare_empty_container_with_same_size((m + 1,), 3)\ndac_ = DelayAuto(self.a)\ndac = np.vectorize(lambda x: dac_(x).statistics)\nr = dac(np.arange(m + 1))\ns[0] = (r[0] + r...
<|body_start_0|> self.a = array_check(a, 1) self._n = a.size self._s = None self._r = None self.m = None <|end_body_0|> <|body_start_1|> self.m = int_check(m, 0) r, s, s_smoothing = prepare_empty_container_with_same_size((m + 1,), 3) dac_ = DelayAuto(self...
Power sepectrum
PowerSpectrum
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PowerSpectrum: """Power sepectrum""" def __init__(self, a: array_like): """:param a: array_like 1-D array""" <|body_0|> def fit(self, m: int): """Fit method :param m: int delay length :return: class self""" <|body_1|> def s(self) -> np.ndarray: ...
stack_v2_sparse_classes_36k_train_011116
8,729
no_license
[ { "docstring": ":param a: array_like 1-D array", "name": "__init__", "signature": "def __init__(self, a: array_like)" }, { "docstring": "Fit method :param m: int delay length :return: class self", "name": "fit", "signature": "def fit(self, m: int)" }, { "docstring": "Get statisti...
5
null
Implement the Python class `PowerSpectrum` described below. Class description: Power sepectrum Method signatures and docstrings: - def __init__(self, a: array_like): :param a: array_like 1-D array - def fit(self, m: int): Fit method :param m: int delay length :return: class self - def s(self) -> np.ndarray: Get stati...
Implement the Python class `PowerSpectrum` described below. Class description: Power sepectrum Method signatures and docstrings: - def __init__(self, a: array_like): :param a: array_like 1-D array - def fit(self, m: int): Fit method :param m: int delay length :return: class self - def s(self) -> np.ndarray: Get stati...
1c8d5fbf3676dc81e9f143e93ee2564359519b11
<|skeleton|> class PowerSpectrum: """Power sepectrum""" def __init__(self, a: array_like): """:param a: array_like 1-D array""" <|body_0|> def fit(self, m: int): """Fit method :param m: int delay length :return: class self""" <|body_1|> def s(self) -> np.ndarray: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PowerSpectrum: """Power sepectrum""" def __init__(self, a: array_like): """:param a: array_like 1-D array""" self.a = array_check(a, 1) self._n = a.size self._s = None self._r = None self.m = None def fit(self, m: int): """Fit method :param m: ...
the_stack_v2_python_sparse
statistics/cycle.py
qliu0/PythonInAirSeaScience
train
0
41d0a4eeef47b8a2478b32980f723c1eab1456b0
[ "request_dict = rest_utils.get_json_and_verify_params({'tenant_name': {'type': unicode}, 'username': {'type': unicode}, 'role': {'type': unicode}})\nrest_utils.validate_inputs(request_dict)\nrole_name = request_dict.get('role')\nif role_name:\n rest_utils.verify_role(role_name)\nelse:\n role_name = constants....
<|body_start_0|> request_dict = rest_utils.get_json_and_verify_params({'tenant_name': {'type': unicode}, 'username': {'type': unicode}, 'role': {'type': unicode}}) rest_utils.validate_inputs(request_dict) role_name = request_dict.get('role') if role_name: rest_utils.verify_ro...
TenantUsers
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TenantUsers: def put(self, multi_tenancy): """Add a user to a tenant""" <|body_0|> def patch(self, multi_tenancy): """Update role in user tenant association.""" <|body_1|> def delete(self, multi_tenancy): """Remove a user from a tenant""" ...
stack_v2_sparse_classes_36k_train_011117
9,658
permissive
[ { "docstring": "Add a user to a tenant", "name": "put", "signature": "def put(self, multi_tenancy)" }, { "docstring": "Update role in user tenant association.", "name": "patch", "signature": "def patch(self, multi_tenancy)" }, { "docstring": "Remove a user from a tenant", "na...
3
stack_v2_sparse_classes_30k_train_006409
Implement the Python class `TenantUsers` described below. Class description: Implement the TenantUsers class. Method signatures and docstrings: - def put(self, multi_tenancy): Add a user to a tenant - def patch(self, multi_tenancy): Update role in user tenant association. - def delete(self, multi_tenancy): Remove a u...
Implement the Python class `TenantUsers` described below. Class description: Implement the TenantUsers class. Method signatures and docstrings: - def put(self, multi_tenancy): Add a user to a tenant - def patch(self, multi_tenancy): Update role in user tenant association. - def delete(self, multi_tenancy): Remove a u...
760affb83facbe154c35c6ce20acb9432daa8bbd
<|skeleton|> class TenantUsers: def put(self, multi_tenancy): """Add a user to a tenant""" <|body_0|> def patch(self, multi_tenancy): """Update role in user tenant association.""" <|body_1|> def delete(self, multi_tenancy): """Remove a user from a tenant""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TenantUsers: def put(self, multi_tenancy): """Add a user to a tenant""" request_dict = rest_utils.get_json_and_verify_params({'tenant_name': {'type': unicode}, 'username': {'type': unicode}, 'role': {'type': unicode}}) rest_utils.validate_inputs(request_dict) role_name = reques...
the_stack_v2_python_sparse
rest-service/manager_rest/rest/resources_v3/tenants.py
Metaswitch/cloudify-manager
train
0
a4646da9f864ad16d92c13259e4cba52041ca990
[ "folder_path = os.path.abspath(raw_folder)\ndata = dict()\nfiles = os.listdir(folder_path)\nfor file in files:\n if is_ignored(file):\n continue\n try:\n file = os.path.join(raw_folder, file)\n datum = cls.process_file(file)\n except FileNotCompatible:\n continue\n _, kwrd = ...
<|body_start_0|> folder_path = os.path.abspath(raw_folder) data = dict() files = os.listdir(folder_path) for file in files: if is_ignored(file): continue try: file = os.path.join(raw_folder, file) datum = cls.process...
SpectreParser
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SpectreParser: def parse(cls, raw_folder: str) -> Dict[str, Any]: """parses the spectre data in the raw folder :param raw_folder: absolute path to the spectre raw data :return: dictionary representing all the simulation data that has been saved.""" <|body_0|> def process_fil...
stack_v2_sparse_classes_36k_train_011118
2,408
permissive
[ { "docstring": "parses the spectre data in the raw folder :param raw_folder: absolute path to the spectre raw data :return: dictionary representing all the simulation data that has been saved.", "name": "parse", "signature": "def parse(cls, raw_folder: str) -> Dict[str, Any]" }, { "docstring": "...
2
stack_v2_sparse_classes_30k_train_008570
Implement the Python class `SpectreParser` described below. Class description: Implement the SpectreParser class. Method signatures and docstrings: - def parse(cls, raw_folder: str) -> Dict[str, Any]: parses the spectre data in the raw folder :param raw_folder: absolute path to the spectre raw data :return: dictionar...
Implement the Python class `SpectreParser` described below. Class description: Implement the SpectreParser class. Method signatures and docstrings: - def parse(cls, raw_folder: str) -> Dict[str, Any]: parses the spectre data in the raw folder :param raw_folder: absolute path to the spectre raw data :return: dictionar...
2ce6da8665d944bab8508a83bc4d3d07fd5afb35
<|skeleton|> class SpectreParser: def parse(cls, raw_folder: str) -> Dict[str, Any]: """parses the spectre data in the raw folder :param raw_folder: absolute path to the spectre raw data :return: dictionary representing all the simulation data that has been saved.""" <|body_0|> def process_fil...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SpectreParser: def parse(cls, raw_folder: str) -> Dict[str, Any]: """parses the spectre data in the raw folder :param raw_folder: absolute path to the spectre raw data :return: dictionary representing all the simulation data that has been saved.""" folder_path = os.path.abspath(raw_folder) ...
the_stack_v2_python_sparse
eval_engines/spectre/parser.py
kouroshHakha/bag_deep_ckt
train
19
edd85c517a28e0d07098960a989d08a439a70eaf
[ "def preorder(node: TreeNode) -> str:\n if not node:\n return ''\n return ','.join([str(node.val), preorder(node.left), preorder(node.right)])\nreturn preorder(root)", "arr = data.split(',')\narr.reverse()\n\ndef build(arr) -> TreeNode:\n val = arr.pop()\n if val == '':\n return None\n ...
<|body_start_0|> def preorder(node: TreeNode) -> str: if not node: return '' return ','.join([str(node.val), preorder(node.left), preorder(node.right)]) return preorder(root) <|end_body_0|> <|body_start_1|> arr = data.split(',') arr.reverse() ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data: str) -> TreeNode: """Decodes your encoded data to tree.""" <|body_1|> <|end_skeleton|> <|body_start_0|> def preorder(n...
stack_v2_sparse_classes_36k_train_011119
1,297
no_license
[ { "docstring": "Encodes a tree to a single string.", "name": "serialize", "signature": "def serialize(self, root: TreeNode) -> str" }, { "docstring": "Decodes your encoded data to tree.", "name": "deserialize", "signature": "def deserialize(self, data: str) -> TreeNode" } ]
2
stack_v2_sparse_classes_30k_train_019579
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string. - def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree.
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string. - def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree. <|skeleton|> class Co...
64fd7baf3543a7a32ebcbaadb39c11fcc152bf4c
<|skeleton|> class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data: str) -> TreeNode: """Decodes your encoded data to tree.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" def preorder(node: TreeNode) -> str: if not node: return '' return ','.join([str(node.val), preorder(node.left), preorder(node.right)]) return preorder(ro...
the_stack_v2_python_sparse
daily/20201009-serialize-bst.py
kapppa-joe/leetcode-practice
train
0
6aa8dafabca703a1b59028c5adbe8f4934756575
[ "self.name = name\nself.tags = tags\nself.lat = lat\nself.lng = lng\nself.address = address\nself.notes = notes\nself.move_map_marker = move_map_marker\nself.switch_profile_id = switch_profile_id\nself.floor_plan_id = floor_plan_id", "if dictionary is None:\n return None\nname = dictionary.get('name')\ntags = ...
<|body_start_0|> self.name = name self.tags = tags self.lat = lat self.lng = lng self.address = address self.notes = notes self.move_map_marker = move_map_marker self.switch_profile_id = switch_profile_id self.floor_plan_id = floor_plan_id <|end_bo...
Implementation of the 'updateNetworkDevice' model. TODO: type model description here. Attributes: name (string): The name of a device tags (string): The tags of a device lat (float): The latitude of a device lng (float): The longitude of a device address (string): The address of a device notes (string): The notes for t...
UpdateNetworkDeviceModel
[ "MIT", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UpdateNetworkDeviceModel: """Implementation of the 'updateNetworkDevice' model. TODO: type model description here. Attributes: name (string): The name of a device tags (string): The tags of a device lat (float): The latitude of a device lng (float): The longitude of a device address (string): The...
stack_v2_sparse_classes_36k_train_011120
3,873
permissive
[ { "docstring": "Constructor for the UpdateNetworkDeviceModel class", "name": "__init__", "signature": "def __init__(self, name=None, tags=None, lat=None, lng=None, address=None, notes=None, move_map_marker=None, switch_profile_id=None, floor_plan_id=None)" }, { "docstring": "Creates an instance ...
2
null
Implement the Python class `UpdateNetworkDeviceModel` described below. Class description: Implementation of the 'updateNetworkDevice' model. TODO: type model description here. Attributes: name (string): The name of a device tags (string): The tags of a device lat (float): The latitude of a device lng (float): The long...
Implement the Python class `UpdateNetworkDeviceModel` described below. Class description: Implementation of the 'updateNetworkDevice' model. TODO: type model description here. Attributes: name (string): The name of a device tags (string): The tags of a device lat (float): The latitude of a device lng (float): The long...
9894089eb013318243ae48869cc5130eb37f80c0
<|skeleton|> class UpdateNetworkDeviceModel: """Implementation of the 'updateNetworkDevice' model. TODO: type model description here. Attributes: name (string): The name of a device tags (string): The tags of a device lat (float): The latitude of a device lng (float): The longitude of a device address (string): The...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UpdateNetworkDeviceModel: """Implementation of the 'updateNetworkDevice' model. TODO: type model description here. Attributes: name (string): The name of a device tags (string): The tags of a device lat (float): The latitude of a device lng (float): The longitude of a device address (string): The address of a...
the_stack_v2_python_sparse
meraki_sdk/models/update_network_device_model.py
RaulCatalano/meraki-python-sdk
train
1
be44dd07365bc7b545def11d9cc4288f6a0eef02
[ "self.messages = messages\nself.source_permissions = permissions\nself.testable_permissions_map = {}\nif permissions:\n for permission in GetTestablePermissions(iam_client, messages, resource):\n self.testable_permissions_map[permission.name] = permission", "testing_permissions = []\nfor permission in s...
<|body_start_0|> self.messages = messages self.source_permissions = permissions self.testable_permissions_map = {} if permissions: for permission in GetTestablePermissions(iam_client, messages, resource): self.testable_permissions_map[permission.name] = permis...
Get different kinds of permissions list from permissions provided. Attributes: messages: The iam messages. source_permissions: A list of permissions to inspect. testable_permissions_map: A dict maps from permissions name string to Permission message provided by the API.
PermissionsHelper
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PermissionsHelper: """Get different kinds of permissions list from permissions provided. Attributes: messages: The iam messages. source_permissions: A list of permissions to inspect. testable_permissions_map: A dict maps from permissions name string to Permission message provided by the API.""" ...
stack_v2_sparse_classes_36k_train_011121
5,171
permissive
[ { "docstring": "Create a PermissionsHelper object. To get the testable permissions for the given resource and store as a dict. Args: iam_client: The iam client. messages: The iam messages. resource: Resource reference for the project/organization whose permissions are being inspected. permissions: A list of per...
6
stack_v2_sparse_classes_30k_train_013933
Implement the Python class `PermissionsHelper` described below. Class description: Get different kinds of permissions list from permissions provided. Attributes: messages: The iam messages. source_permissions: A list of permissions to inspect. testable_permissions_map: A dict maps from permissions name string to Permi...
Implement the Python class `PermissionsHelper` described below. Class description: Get different kinds of permissions list from permissions provided. Attributes: messages: The iam messages. source_permissions: A list of permissions to inspect. testable_permissions_map: A dict maps from permissions name string to Permi...
85bb264e273568b5a0408f733b403c56373e2508
<|skeleton|> class PermissionsHelper: """Get different kinds of permissions list from permissions provided. Attributes: messages: The iam messages. source_permissions: A list of permissions to inspect. testable_permissions_map: A dict maps from permissions name string to Permission message provided by the API.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PermissionsHelper: """Get different kinds of permissions list from permissions provided. Attributes: messages: The iam messages. source_permissions: A list of permissions to inspect. testable_permissions_map: A dict maps from permissions name string to Permission message provided by the API.""" def __ini...
the_stack_v2_python_sparse
google-cloud-sdk/lib/googlecloudsdk/api_lib/iam/util.py
bopopescu/socialliteapp
train
0
b1ce38513fa29a3f798ad2eb817977500f41db31
[ "input_should_stop = abs(x_delta) <= abs(x_delta) / 2 * cls.EPSILON_RELATIVE + cls.EPSILON_ABSOLUTE and abs(y_delta) <= abs(y_delta) / 2 * cls.EPSILON_RELATIVE + cls.EPSILON_ABSOLUTE\noutput_should_stop = abs(f_delta) <= abs(f_delta) / 2 * cls.EPSILON_RELATIVE + cls.EPSILON_ABSOLUTE\nreturn input_should_stop or out...
<|body_start_0|> input_should_stop = abs(x_delta) <= abs(x_delta) / 2 * cls.EPSILON_RELATIVE + cls.EPSILON_ABSOLUTE and abs(y_delta) <= abs(y_delta) / 2 * cls.EPSILON_RELATIVE + cls.EPSILON_ABSOLUTE output_should_stop = abs(f_delta) <= abs(f_delta) / 2 * cls.EPSILON_RELATIVE + cls.EPSILON_ABSOLUTE ...
Optimizer2D
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Optimizer2D: def should_stop(cls, x_delta, y_delta, f_delta): """Stopping criteria for 2D optimizer. Check delta for input and output and compare to relative machine epsilon. :param x_delta: :param y_delta: :param f_delta: :return:""" <|body_0|> def coordinate_descent(cls, f...
stack_v2_sparse_classes_36k_train_011122
3,099
no_license
[ { "docstring": "Stopping criteria for 2D optimizer. Check delta for input and output and compare to relative machine epsilon. :param x_delta: :param y_delta: :param f_delta: :return:", "name": "should_stop", "signature": "def should_stop(cls, x_delta, y_delta, f_delta)" }, { "docstring": "Coordi...
2
stack_v2_sparse_classes_30k_train_020530
Implement the Python class `Optimizer2D` described below. Class description: Implement the Optimizer2D class. Method signatures and docstrings: - def should_stop(cls, x_delta, y_delta, f_delta): Stopping criteria for 2D optimizer. Check delta for input and output and compare to relative machine epsilon. :param x_delt...
Implement the Python class `Optimizer2D` described below. Class description: Implement the Optimizer2D class. Method signatures and docstrings: - def should_stop(cls, x_delta, y_delta, f_delta): Stopping criteria for 2D optimizer. Check delta for input and output and compare to relative machine epsilon. :param x_delt...
5917aa6c2fb9921c66f8da89058ed8386e9f6718
<|skeleton|> class Optimizer2D: def should_stop(cls, x_delta, y_delta, f_delta): """Stopping criteria for 2D optimizer. Check delta for input and output and compare to relative machine epsilon. :param x_delta: :param y_delta: :param f_delta: :return:""" <|body_0|> def coordinate_descent(cls, f...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Optimizer2D: def should_stop(cls, x_delta, y_delta, f_delta): """Stopping criteria for 2D optimizer. Check delta for input and output and compare to relative machine epsilon. :param x_delta: :param y_delta: :param f_delta: :return:""" input_should_stop = abs(x_delta) <= abs(x_delta) / 2 * cls....
the_stack_v2_python_sparse
HW1/optimizer_2d.py
matt-dees/optimization-algs
train
0
e96c5fba21e437a9560b722118a7598cee8844b6
[ "self.kinds = []\ninvalid_kinds = []\nfor kind in kinds:\n if self.validate_kind(kind):\n self.kinds.append(kind)\n elif len(kind) == 2:\n invalid_kinds.append('{}: {}'.format(kind[0], kind[1]))\n else:\n invalid_kinds.append(str(kind))\nif len(invalid_kinds) > 0:\n raise ValueError...
<|body_start_0|> self.kinds = [] invalid_kinds = [] for kind in kinds: if self.validate_kind(kind): self.kinds.append(kind) elif len(kind) == 2: invalid_kinds.append('{}: {}'.format(kind[0], kind[1])) else: inval...
For getting a list of the most recently posted objects across various apps. Use like: kinds = (('blog_posts', 'writing'),) objects = RecentObjects(kinds).get_objects(num=5) See __init__() for the valid `kinds`. The returned `objects` will be a list of dicts. Each dict will have these keys: 'object': A Django object of ...
RecentObjects
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RecentObjects: """For getting a list of the most recently posted objects across various apps. Use like: kinds = (('blog_posts', 'writing'),) objects = RecentObjects(kinds).get_objects(num=5) See __init__() for the valid `kinds`. The returned `objects` will be a list of dicts. Each dict will have ...
stack_v2_sparse_classes_36k_train_011123
6,769
no_license
[ { "docstring": "Adds the supplied list of kinds to self.kinds kinds is like: ( ('blog_posts', 'writing'), # A Blog slug ('flickr_photos', '35034346050@N01'), # A Flickr Account User's NSID ('pinboard_bookmarks', 'philgyford'), # A Pinboard Account's username )", "name": "__init__", "signature": "def __i...
6
stack_v2_sparse_classes_30k_train_015420
Implement the Python class `RecentObjects` described below. Class description: For getting a list of the most recently posted objects across various apps. Use like: kinds = (('blog_posts', 'writing'),) objects = RecentObjects(kinds).get_objects(num=5) See __init__() for the valid `kinds`. The returned `objects` will b...
Implement the Python class `RecentObjects` described below. Class description: For getting a list of the most recently posted objects across various apps. Use like: kinds = (('blog_posts', 'writing'),) objects = RecentObjects(kinds).get_objects(num=5) See __init__() for the valid `kinds`. The returned `objects` will b...
af5ab91deae688ba67d1561cee31359b67b0d582
<|skeleton|> class RecentObjects: """For getting a list of the most recently posted objects across various apps. Use like: kinds = (('blog_posts', 'writing'),) objects = RecentObjects(kinds).get_objects(num=5) See __init__() for the valid `kinds`. The returned `objects` will be a list of dicts. Each dict will have ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RecentObjects: """For getting a list of the most recently posted objects across various apps. Use like: kinds = (('blog_posts', 'writing'),) objects = RecentObjects(kinds).get_objects(num=5) See __init__() for the valid `kinds`. The returned `objects` will be a list of dicts. Each dict will have these keys: '...
the_stack_v2_python_sparse
hines/core/recent.py
philgyford/django-hines
train
14
64cb4e793ca61ce19118f676967e3e30ff39517e
[ "if not dir:\n self.dir = '.'\nself.dir = str(dir)", "logging.debug('Dir : ' + str(self.dir))\nlogging.debug('asset : ' + str(asset))\nlogging.debug('asset : ' + str(asset))\nif retain_dam_path:\n full_path = self.dir + asset\n dir_path = os.path.dirname(full_path)\nelse:\n full_path = self.dir + '/' ...
<|body_start_0|> if not dir: self.dir = '.' self.dir = str(dir) <|end_body_0|> <|body_start_1|> logging.debug('Dir : ' + str(self.dir)) logging.debug('asset : ' + str(asset)) logging.debug('asset : ' + str(asset)) if retain_dam_path: full_path = s...
Provides a handle to work with the local file system Initialized with a directory which is the base under which reads and writes can be performed
Env
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Env: """Provides a handle to work with the local file system Initialized with a directory which is the base under which reads and writes can be performed""" def __init__(self, dir): """Initialize an Env instance with a directory""" <|body_0|> def _ensure(self, asset, ret...
stack_v2_sparse_classes_36k_train_011124
2,576
permissive
[ { "docstring": "Initialize an Env instance with a directory", "name": "__init__", "signature": "def __init__(self, dir)" }, { "docstring": "Checks and creates the folders needed under the env directory to store an asset and returns the full path reference for an asset", "name": "_ensure", ...
6
stack_v2_sparse_classes_30k_train_001620
Implement the Python class `Env` described below. Class description: Provides a handle to work with the local file system Initialized with a directory which is the base under which reads and writes can be performed Method signatures and docstrings: - def __init__(self, dir): Initialize an Env instance with a director...
Implement the Python class `Env` described below. Class description: Provides a handle to work with the local file system Initialized with a directory which is the base under which reads and writes can be performed Method signatures and docstrings: - def __init__(self, dir): Initialize an Env instance with a director...
432d802f62da95eaa630cae651dabba56d50029c
<|skeleton|> class Env: """Provides a handle to work with the local file system Initialized with a directory which is the base under which reads and writes can be performed""" def __init__(self, dir): """Initialize an Env instance with a directory""" <|body_0|> def _ensure(self, asset, ret...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Env: """Provides a handle to work with the local file system Initialized with a directory which is the base under which reads and writes can be performed""" def __init__(self, dir): """Initialize an Env instance with a directory""" if not dir: self.dir = '.' self.dir =...
the_stack_v2_python_sparse
dampy/lib/Env.py
moonraker46/dampy
train
0
1f08d7d6956a1e5f6d69b1ef2ed632cb97bae6f0
[ "if char:\n char = _ReconUtils._to_ord(char)\n return ord('A') <= char <= ord('Z') or char == ord('_') or ord('a') <= char <= ord('z')\nelse:\n return False", "if char:\n char = _ReconUtils._to_ord(char)\n return char == ord('-') or _ReconUtils._is_digit(char) or _ReconUtils._is_ident_start_char(ch...
<|body_start_0|> if char: char = _ReconUtils._to_ord(char) return ord('A') <= char <= ord('Z') or char == ord('_') or ord('a') <= char <= ord('z') else: return False <|end_body_0|> <|body_start_1|> if char: char = _ReconUtils._to_ord(char) ...
_ReconUtils
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _ReconUtils: def _is_ident_start_char(char: Union[str, int]) -> bool: """Check if a character is a valid first character of an identifier. Valid start characters for identifiers: [A-Za-z_] :param char: - Character to check. :return: - True if the character is valid, False otherwise.""" ...
stack_v2_sparse_classes_36k_train_011125
7,203
permissive
[ { "docstring": "Check if a character is a valid first character of an identifier. Valid start characters for identifiers: [A-Za-z_] :param char: - Character to check. :return: - True if the character is valid, False otherwise.", "name": "_is_ident_start_char", "signature": "def _is_ident_start_char(char...
6
stack_v2_sparse_classes_30k_train_005385
Implement the Python class `_ReconUtils` described below. Class description: Implement the _ReconUtils class. Method signatures and docstrings: - def _is_ident_start_char(char: Union[str, int]) -> bool: Check if a character is a valid first character of an identifier. Valid start characters for identifiers: [A-Za-z_]...
Implement the Python class `_ReconUtils` described below. Class description: Implement the _ReconUtils class. Method signatures and docstrings: - def _is_ident_start_char(char: Union[str, int]) -> bool: Check if a character is a valid first character of an identifier. Valid start characters for identifiers: [A-Za-z_]...
727c09b6e7300b063e320364373ff724d9b8af90
<|skeleton|> class _ReconUtils: def _is_ident_start_char(char: Union[str, int]) -> bool: """Check if a character is a valid first character of an identifier. Valid start characters for identifiers: [A-Za-z_] :param char: - Character to check. :return: - True if the character is valid, False otherwise.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class _ReconUtils: def _is_ident_start_char(char: Union[str, int]) -> bool: """Check if a character is a valid first character of an identifier. Valid start characters for identifiers: [A-Za-z_] :param char: - Character to check. :return: - True if the character is valid, False otherwise.""" if char...
the_stack_v2_python_sparse
swimai/recon/_utils.py
knut0815/swim-system-python
train
0
7fac0b9d8ff0b4d25baa015863f3c2e097c7c05d
[ "if n < 2:\n return 0\nif n == 2:\n return 1\nif n == 3:\n return 2\nproducts = [0] * (n + 1)\nproducts[0] = 0\nproducts[1] = 1\nproducts[2] = 2\nproducts[3] = 3\nfor i in range(4, n + 1):\n max = 0\n for j in range(1, int(i / 2) + 1):\n product = products[j] * products[i - j]\n if max ...
<|body_start_0|> if n < 2: return 0 if n == 2: return 1 if n == 3: return 2 products = [0] * (n + 1) products[0] = 0 products[1] = 1 products[2] = 2 products[3] = 3 for i in range(4, n + 1): max = 0 ...
Solution
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def cuttingRope_1(self, n): """:type n: int :rtype: int""" <|body_0|> def cuttingRope(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if n < 2: return 0 if n == 2: retur...
stack_v2_sparse_classes_36k_train_011126
1,441
permissive
[ { "docstring": ":type n: int :rtype: int", "name": "cuttingRope_1", "signature": "def cuttingRope_1(self, n)" }, { "docstring": ":type n: int :rtype: int", "name": "cuttingRope", "signature": "def cuttingRope(self, n)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def cuttingRope_1(self, n): :type n: int :rtype: int - def cuttingRope(self, n): :type n: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def cuttingRope_1(self, n): :type n: int :rtype: int - def cuttingRope(self, n): :type n: int :rtype: int <|skeleton|> class Solution: def cuttingRope_1(self, n): "...
4a6d46c179d7f52054c417b2aa21708331ac84c5
<|skeleton|> class Solution: def cuttingRope_1(self, n): """:type n: int :rtype: int""" <|body_0|> def cuttingRope(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def cuttingRope_1(self, n): """:type n: int :rtype: int""" if n < 2: return 0 if n == 2: return 1 if n == 3: return 2 products = [0] * (n + 1) products[0] = 0 products[1] = 1 products[2] = 2 p...
the_stack_v2_python_sparse
problems/动态规划/343. 整数拆分/integer-break.py
HannibalXZX/LeetCode
train
1
881b990daf1d7e913a1d67e1001b3b861dfa706e
[ "self.num_points = num_points\nself.x_values = [0]\nself.y_values = [0]", "while len(self.x_values) < self.num_points:\n x_direction = choice([1, -1])\n x_distance = choice([0, 1, 2, 3, 4])\n x_step = x_direction * x_distance\n y_direction = choice([1, -1])\n y_distance = choice([0, 1, 2, 3, 4])\n ...
<|body_start_0|> self.num_points = num_points self.x_values = [0] self.y_values = [0] <|end_body_0|> <|body_start_1|> while len(self.x_values) < self.num_points: x_direction = choice([1, -1]) x_distance = choice([0, 1, 2, 3, 4]) x_step = x_direction *...
a class which generate random walking data
RandomWalk
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RandomWalk: """a class which generate random walking data""" def __init__(self, num_points=20): """initial the attribute of random walking""" <|body_0|> def fill_walk(self): """calculate all points belong to random walking""" <|body_1|> <|end_skeleton|> ...
stack_v2_sparse_classes_36k_train_011127
1,083
no_license
[ { "docstring": "initial the attribute of random walking", "name": "__init__", "signature": "def __init__(self, num_points=20)" }, { "docstring": "calculate all points belong to random walking", "name": "fill_walk", "signature": "def fill_walk(self)" } ]
2
null
Implement the Python class `RandomWalk` described below. Class description: a class which generate random walking data Method signatures and docstrings: - def __init__(self, num_points=20): initial the attribute of random walking - def fill_walk(self): calculate all points belong to random walking
Implement the Python class `RandomWalk` described below. Class description: a class which generate random walking data Method signatures and docstrings: - def __init__(self, num_points=20): initial the attribute of random walking - def fill_walk(self): calculate all points belong to random walking <|skeleton|> class...
9134f5d3525a48811893790303b1b5eabc29fd50
<|skeleton|> class RandomWalk: """a class which generate random walking data""" def __init__(self, num_points=20): """initial the attribute of random walking""" <|body_0|> def fill_walk(self): """calculate all points belong to random walking""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RandomWalk: """a class which generate random walking data""" def __init__(self, num_points=20): """initial the attribute of random walking""" self.num_points = num_points self.x_values = [0] self.y_values = [0] def fill_walk(self): """calculate all points belo...
the_stack_v2_python_sparse
random_walk.py
douzhenjun/python_work
train
1
86bc777c79b3ee0fde7d8c7933348dc4517bdd0b
[ "length = len(haystack)\nk = 0\nwhile k < length:\n j = 0\n i = k\n while i < length and j < len(needle) and (haystack[i] == needle[j]):\n j += 1\n i += 1\n if j == len(needle):\n return i - len(needle)\n k += 1\nreturn -1", "try:\n return haystack.index(needle)\nexcept Valu...
<|body_start_0|> length = len(haystack) k = 0 while k < length: j = 0 i = k while i < length and j < len(needle) and (haystack[i] == needle[j]): j += 1 i += 1 if j == len(needle): return i - len(needl...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def strStr(self, haystack, needle): """:type haystack: str :type needle: str :rtype: int""" <|body_0|> def strStrv1(self, haystack, needle): """:type haystack: str :type needle: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_011128
935
no_license
[ { "docstring": ":type haystack: str :type needle: str :rtype: int", "name": "strStr", "signature": "def strStr(self, haystack, needle)" }, { "docstring": ":type haystack: str :type needle: str :rtype: int", "name": "strStrv1", "signature": "def strStrv1(self, haystack, needle)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def strStr(self, haystack, needle): :type haystack: str :type needle: str :rtype: int - def strStrv1(self, haystack, needle): :type haystack: str :type needle: str :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def strStr(self, haystack, needle): :type haystack: str :type needle: str :rtype: int - def strStrv1(self, haystack, needle): :type haystack: str :type needle: str :rtype: int <...
328408860fcf6bffbbd2096b4c7182d8abb2ea66
<|skeleton|> class Solution: def strStr(self, haystack, needle): """:type haystack: str :type needle: str :rtype: int""" <|body_0|> def strStrv1(self, haystack, needle): """:type haystack: str :type needle: str :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def strStr(self, haystack, needle): """:type haystack: str :type needle: str :rtype: int""" length = len(haystack) k = 0 while k < length: j = 0 i = k while i < length and j < len(needle) and (haystack[i] == needle[j]): ...
the_stack_v2_python_sparse
lcode1-99/ex81/strStr.py
rh01/gofiles
train
0
f9b2cb35c8ca6c8d72637448951ca72c4c986618
[ "if not height:\n return 0\nlength = len(height)\nmax_left = [0] * length\nmax_right = [0] * length\nans = 0\nmax_left[0] = height[0]\nmax_right[length - 1] = height[length - 1]\nfor i in range(1, length):\n max_left[i] = max(height[i], max_left[i - 1])\nfor j in range(length - 2, -1, -1):\n max_right[j] =...
<|body_start_0|> if not height: return 0 length = len(height) max_left = [0] * length max_right = [0] * length ans = 0 max_left[0] = height[0] max_right[length - 1] = height[length - 1] for i in range(1, length): max_left[i] = max(h...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def trap(cls, height: List[int]) -> int: """动态规划O(N), O(N)""" <|body_0|> def trap_v2(cls, height: List[int]) -> int: """双指针O(N), O(1)""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not height: return 0 length = len(...
stack_v2_sparse_classes_36k_train_011129
1,911
no_license
[ { "docstring": "动态规划O(N), O(N)", "name": "trap", "signature": "def trap(cls, height: List[int]) -> int" }, { "docstring": "双指针O(N), O(1)", "name": "trap_v2", "signature": "def trap_v2(cls, height: List[int]) -> int" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def trap(cls, height: List[int]) -> int: 动态规划O(N), O(N) - def trap_v2(cls, height: List[int]) -> int: 双指针O(N), O(1)
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def trap(cls, height: List[int]) -> int: 动态规划O(N), O(N) - def trap_v2(cls, height: List[int]) -> int: 双指针O(N), O(1) <|skeleton|> class Solution: def trap(cls, height: List[...
1d1876620a55ff88af7bc390cf1a4fd4350d8d16
<|skeleton|> class Solution: def trap(cls, height: List[int]) -> int: """动态规划O(N), O(N)""" <|body_0|> def trap_v2(cls, height: List[int]) -> int: """双指针O(N), O(1)""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def trap(cls, height: List[int]) -> int: """动态规划O(N), O(N)""" if not height: return 0 length = len(height) max_left = [0] * length max_right = [0] * length ans = 0 max_left[0] = height[0] max_right[length - 1] = height[lengt...
the_stack_v2_python_sparse
01-数据结构/数组/042.接雨水(H).py
jh-lau/leetcode_in_python
train
0
9b4bf71db2e52b0be0a35d89d62c3370082ef68e
[ "super().__init__()\nself.modelName = None\nself.roiFluxMinimum = 2000\nself.roiExposureTime = 8000\nself.fullExposureTime = 8000\nself.cameraIndex = 0", "self.modelName = config['modelName']\nself.roiFluxMinimum = config['roi']['fluxMin']\nself.roiExposureTime = config['roi']['exposureTime']\nself.fullExposureTi...
<|body_start_0|> super().__init__() self.modelName = None self.roiFluxMinimum = 2000 self.roiExposureTime = 8000 self.fullExposureTime = 8000 self.cameraIndex = 0 <|end_body_0|> <|body_start_1|> self.modelName = config['modelName'] self.roiFluxMinimum = c...
Class that handles the configuration of the Vimba class cameras. Attributes ---------- cameraIndex : int The current index of the camera if multiple present. fullExposureTime : int The exposure time (microseconds) in full frame mode. modelName : str A description of the camera model. roiExposureTime : int The exposure ...
VimbaCameraConfig
[ "Python-2.0", "BSD-3-Clause", "LicenseRef-scancode-free-unknown" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VimbaCameraConfig: """Class that handles the configuration of the Vimba class cameras. Attributes ---------- cameraIndex : int The current index of the camera if multiple present. fullExposureTime : int The exposure time (microseconds) in full frame mode. modelName : str A description of the came...
stack_v2_sparse_classes_36k_train_011130
2,404
permissive
[ { "docstring": "Initialize the class.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Translate config to class attributes. Parameters ---------- config : dict The configuration to translate.", "name": "fromDict", "signature": "def fromDict(self, config)" }, ...
3
null
Implement the Python class `VimbaCameraConfig` described below. Class description: Class that handles the configuration of the Vimba class cameras. Attributes ---------- cameraIndex : int The current index of the camera if multiple present. fullExposureTime : int The exposure time (microseconds) in full frame mode. mo...
Implement the Python class `VimbaCameraConfig` described below. Class description: Class that handles the configuration of the Vimba class cameras. Attributes ---------- cameraIndex : int The current index of the camera if multiple present. fullExposureTime : int The exposure time (microseconds) in full frame mode. mo...
3d0242276198126240667ba13e95b7bdf901d053
<|skeleton|> class VimbaCameraConfig: """Class that handles the configuration of the Vimba class cameras. Attributes ---------- cameraIndex : int The current index of the camera if multiple present. fullExposureTime : int The exposure time (microseconds) in full frame mode. modelName : str A description of the came...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VimbaCameraConfig: """Class that handles the configuration of the Vimba class cameras. Attributes ---------- cameraIndex : int The current index of the camera if multiple present. fullExposureTime : int The exposure time (microseconds) in full frame mode. modelName : str A description of the camera model. roi...
the_stack_v2_python_sparse
spot_motion_monitor/config/vimba_camera_config.py
lsst-sitcom/spot_motion_monitor
train
0
8bb4e1d84e0e241613078f499335823acb52ddd4
[ "if _data is None:\n _data = b'None'\nself._mint(self.msg.sender, _amount, _data)", "if _data is None:\n _data = b'None'\nself._mint(_account, _amount, _data)" ]
<|body_start_0|> if _data is None: _data = b'None' self._mint(self.msg.sender, _amount, _data) <|end_body_0|> <|body_start_1|> if _data is None: _data = b'None' self._mint(_account, _amount, _data) <|end_body_1|>
Implementation of IRC2Mintable
IRC2Mintable
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IRC2Mintable: """Implementation of IRC2Mintable""" def mint(self, _amount: int, _data: bytes=None) -> None: """Creates `_amount` number of tokens, and assigns to caller account. Increases the balance of that account and total supply. See {IRC2-_mint} :param _amount: Number of tokens ...
stack_v2_sparse_classes_36k_train_011131
986
permissive
[ { "docstring": "Creates `_amount` number of tokens, and assigns to caller account. Increases the balance of that account and total supply. See {IRC2-_mint} :param _amount: Number of tokens to be created at the account. :param _data:", "name": "mint", "signature": "def mint(self, _amount: int, _data: byt...
2
stack_v2_sparse_classes_30k_train_015136
Implement the Python class `IRC2Mintable` described below. Class description: Implementation of IRC2Mintable Method signatures and docstrings: - def mint(self, _amount: int, _data: bytes=None) -> None: Creates `_amount` number of tokens, and assigns to caller account. Increases the balance of that account and total s...
Implement the Python class `IRC2Mintable` described below. Class description: Implementation of IRC2Mintable Method signatures and docstrings: - def mint(self, _amount: int, _data: bytes=None) -> None: Creates `_amount` number of tokens, and assigns to caller account. Increases the balance of that account and total s...
cd185fa831de18b4d9c634689a3c6e7b559bbabe
<|skeleton|> class IRC2Mintable: """Implementation of IRC2Mintable""" def mint(self, _amount: int, _data: bytes=None) -> None: """Creates `_amount` number of tokens, and assigns to caller account. Increases the balance of that account and total supply. See {IRC2-_mint} :param _amount: Number of tokens ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IRC2Mintable: """Implementation of IRC2Mintable""" def mint(self, _amount: int, _data: bytes=None) -> None: """Creates `_amount` number of tokens, and assigns to caller account. Increases the balance of that account and total supply. See {IRC2-_mint} :param _amount: Number of tokens to be created...
the_stack_v2_python_sparse
token_contracts/bnDOGE/tokens/IRC2mintable.py
subba72/balanced-contracts
train
0
3ffe07fed3c3793cbb338bff726b083c6d682555
[ "self.day = day\nself.end_time = end_time\nself.start_time = start_time", "if dictionary is None:\n return None\nday = dictionary.get('day')\nend_time = cohesity_management_sdk.models.time.Time.from_dictionary(dictionary.get('endTime')) if dictionary.get('endTime') else None\nstart_time = cohesity_management_s...
<|body_start_0|> self.day = day self.end_time = end_time self.start_time = start_time <|end_body_0|> <|body_start_1|> if dictionary is None: return None day = dictionary.get('day') end_time = cohesity_management_sdk.models.time.Time.from_dictionary(dictionary...
Implementation of the 'BackupJobProto_ExclusionTimeRange' model. A proto to specify a time range within a single day when backups are not permitted to run. Attributes: day (int): If the day is not set, the time range applies to all days. end_time (Time): End time of the time range. start_time (Time): Start time of the ...
BackupJobProto_ExclusionTimeRange
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BackupJobProto_ExclusionTimeRange: """Implementation of the 'BackupJobProto_ExclusionTimeRange' model. A proto to specify a time range within a single day when backups are not permitted to run. Attributes: day (int): If the day is not set, the time range applies to all days. end_time (Time): End ...
stack_v2_sparse_classes_36k_train_011132
2,089
permissive
[ { "docstring": "Constructor for the BackupJobProto_ExclusionTimeRange class", "name": "__init__", "signature": "def __init__(self, day=None, end_time=None, start_time=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary represe...
2
stack_v2_sparse_classes_30k_train_007571
Implement the Python class `BackupJobProto_ExclusionTimeRange` described below. Class description: Implementation of the 'BackupJobProto_ExclusionTimeRange' model. A proto to specify a time range within a single day when backups are not permitted to run. Attributes: day (int): If the day is not set, the time range app...
Implement the Python class `BackupJobProto_ExclusionTimeRange` described below. Class description: Implementation of the 'BackupJobProto_ExclusionTimeRange' model. A proto to specify a time range within a single day when backups are not permitted to run. Attributes: day (int): If the day is not set, the time range app...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class BackupJobProto_ExclusionTimeRange: """Implementation of the 'BackupJobProto_ExclusionTimeRange' model. A proto to specify a time range within a single day when backups are not permitted to run. Attributes: day (int): If the day is not set, the time range applies to all days. end_time (Time): End ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BackupJobProto_ExclusionTimeRange: """Implementation of the 'BackupJobProto_ExclusionTimeRange' model. A proto to specify a time range within a single day when backups are not permitted to run. Attributes: day (int): If the day is not set, the time range applies to all days. end_time (Time): End time of the t...
the_stack_v2_python_sparse
cohesity_management_sdk/models/backup_job_proto_exclusion_time_range.py
cohesity/management-sdk-python
train
24
c7f0a39910e06dd77e74f07b26f5e4fa5ac9e1d3
[ "super(Annotation, self).__init__(*args, **kwargs)\nif not TOKEN:\n raise exceptions.InvalidCredentials('Missing the \"LIBRATO_TOKEN\" environment variable.')\nif not EMAIL:\n raise exceptions.InvalidCredentials('Missing the \"LIBRATO_EMAIL\" environment variable.')", "try:\n res = (yield self._fetch(*ar...
<|body_start_0|> super(Annotation, self).__init__(*args, **kwargs) if not TOKEN: raise exceptions.InvalidCredentials('Missing the "LIBRATO_TOKEN" environment variable.') if not EMAIL: raise exceptions.InvalidCredentials('Missing the "LIBRATO_EMAIL" environment variable.')...
Librato Annotation Actor Posts an Annotation to Librato. **Options** :title: The title of the annotation :description: The description of the annotation :name: Name of the metric to annotate **Examples** .. code-block:: json { "actor": "librato.Annotation", "desc": "Mark our deployment", "options": { "title": "Deploy",...
Annotation
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Annotation: """Librato Annotation Actor Posts an Annotation to Librato. **Options** :title: The title of the annotation :description: The description of the annotation :name: Name of the metric to annotate **Examples** .. code-block:: json { "actor": "librato.Annotation", "desc": "Mark our deploy...
stack_v2_sparse_classes_36k_train_011133
5,119
permissive
[ { "docstring": "Check for the needed environment variables.", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Wrap the superclass _fetch method to catch known Librato errors.", "name": "_fetch_wrapper", "signature": "def _fetch_wrapper(self, *arg...
3
stack_v2_sparse_classes_30k_train_020542
Implement the Python class `Annotation` described below. Class description: Librato Annotation Actor Posts an Annotation to Librato. **Options** :title: The title of the annotation :description: The description of the annotation :name: Name of the metric to annotate **Examples** .. code-block:: json { "actor": "librat...
Implement the Python class `Annotation` described below. Class description: Librato Annotation Actor Posts an Annotation to Librato. **Options** :title: The title of the annotation :description: The description of the annotation :name: Name of the metric to annotate **Examples** .. code-block:: json { "actor": "librat...
d0abaf93ff321f12c0504c99eacb89f9288e892b
<|skeleton|> class Annotation: """Librato Annotation Actor Posts an Annotation to Librato. **Options** :title: The title of the annotation :description: The description of the annotation :name: Name of the metric to annotate **Examples** .. code-block:: json { "actor": "librato.Annotation", "desc": "Mark our deploy...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Annotation: """Librato Annotation Actor Posts an Annotation to Librato. **Options** :title: The title of the annotation :description: The description of the annotation :name: Name of the metric to annotate **Examples** .. code-block:: json { "actor": "librato.Annotation", "desc": "Mark our deployment", "optio...
the_stack_v2_python_sparse
kingpin/actors/librato.py
Nextdoor/kingpin
train
29
b9b2002d877d4ba901c817d04112a42d2e3d500f
[ "super(CTCModule, self).__init__()\nself.pred_output_position_inclu_blank = nn.LSTM(in_dim, out_seq_len + 1, num_layers=2, batch_first=True)\nself.out_seq_len = out_seq_len\nself.softmax = nn.Softmax(dim=2)", "pred_output_position_inclu_blank, _ = self.pred_output_position_inclu_blank(x)\nprob_pred_output_positio...
<|body_start_0|> super(CTCModule, self).__init__() self.pred_output_position_inclu_blank = nn.LSTM(in_dim, out_seq_len + 1, num_layers=2, batch_first=True) self.out_seq_len = out_seq_len self.softmax = nn.Softmax(dim=2) <|end_body_0|> <|body_start_1|> pred_output_position_inclu_...
CTCModule
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CTCModule: def __init__(self, in_dim, out_seq_len): """This module is performing alignment from A (e.g., audio) to B (e.g., text). :param in_dim: Dimension for input modality A :param out_seq_len: Sequence length for output modality B""" <|body_0|> def forward(self, x): ...
stack_v2_sparse_classes_36k_train_011134
25,941
no_license
[ { "docstring": "This module is performing alignment from A (e.g., audio) to B (e.g., text). :param in_dim: Dimension for input modality A :param out_seq_len: Sequence length for output modality B", "name": "__init__", "signature": "def __init__(self, in_dim, out_seq_len)" }, { "docstring": ":inp...
2
stack_v2_sparse_classes_30k_train_007403
Implement the Python class `CTCModule` described below. Class description: Implement the CTCModule class. Method signatures and docstrings: - def __init__(self, in_dim, out_seq_len): This module is performing alignment from A (e.g., audio) to B (e.g., text). :param in_dim: Dimension for input modality A :param out_se...
Implement the Python class `CTCModule` described below. Class description: Implement the CTCModule class. Method signatures and docstrings: - def __init__(self, in_dim, out_seq_len): This module is performing alignment from A (e.g., audio) to B (e.g., text). :param in_dim: Dimension for input modality A :param out_se...
7e55a422588c1d1e00f35a3d3a3ff896cce59e18
<|skeleton|> class CTCModule: def __init__(self, in_dim, out_seq_len): """This module is performing alignment from A (e.g., audio) to B (e.g., text). :param in_dim: Dimension for input modality A :param out_seq_len: Sequence length for output modality B""" <|body_0|> def forward(self, x): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CTCModule: def __init__(self, in_dim, out_seq_len): """This module is performing alignment from A (e.g., audio) to B (e.g., text). :param in_dim: Dimension for input modality A :param out_seq_len: Sequence length for output modality B""" super(CTCModule, self).__init__() self.pred_outp...
the_stack_v2_python_sparse
generated/test_yaohungt_Multimodal_Transformer.py
jansel/pytorch-jit-paritybench
train
35
028a20ae7c5ff3524ccfc04dd2bfeb1d0493e36f
[ "super().__init__(pred_name, target_name, filter_func, **kwargs)\nself._class_names = class_names\nself._operation_point = operation_point\nself._metrics = metrics\nself._sum_weights = sum_weights", "if isinstance(self._operation_point, Callable):\n class_thresholds = self._operation_point(self.epoch_preds, se...
<|body_start_0|> super().__init__(pred_name, target_name, filter_func, **kwargs) self._class_names = class_names self._operation_point = operation_point self._metrics = metrics self._sum_weights = sum_weights <|end_body_0|> <|body_start_1|> if isinstance(self._operation_...
Multi class version for confusion metrics including: sensitivity, specificity, recall., precision, f1.
FuseMetricConfusion
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FuseMetricConfusion: """Multi class version for confusion metrics including: sensitivity, specificity, recall., precision, f1.""" def __init__(self, pred_name: str, target_name: str, filter_func: Optional[Callable]=None, class_names: List=None, operation_point: Optional[Union[float, List[Tup...
stack_v2_sparse_classes_36k_train_011135
5,198
permissive
[ { "docstring": ":param pred_name: batch_dict key for predicted output (e.g., class probabilities after softmax) :param target_name: batch_dict key for target (e.g., ground truth label) :param filter_func: function that filters batch_dict/ The function gets ans input batch_dict and returns filtered batch_dict :p...
2
null
Implement the Python class `FuseMetricConfusion` described below. Class description: Multi class version for confusion metrics including: sensitivity, specificity, recall., precision, f1. Method signatures and docstrings: - def __init__(self, pred_name: str, target_name: str, filter_func: Optional[Callable]=None, cla...
Implement the Python class `FuseMetricConfusion` described below. Class description: Multi class version for confusion metrics including: sensitivity, specificity, recall., precision, f1. Method signatures and docstrings: - def __init__(self, pred_name: str, target_name: str, filter_func: Optional[Callable]=None, cla...
acbfd4975f18cd4361d31697faf2f82036399865
<|skeleton|> class FuseMetricConfusion: """Multi class version for confusion metrics including: sensitivity, specificity, recall., precision, f1.""" def __init__(self, pred_name: str, target_name: str, filter_func: Optional[Callable]=None, class_names: List=None, operation_point: Optional[Union[float, List[Tup...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FuseMetricConfusion: """Multi class version for confusion metrics including: sensitivity, specificity, recall., precision, f1.""" def __init__(self, pred_name: str, target_name: str, filter_func: Optional[Callable]=None, class_names: List=None, operation_point: Optional[Union[float, List[Tuple], Callable...
the_stack_v2_python_sparse
fuse/metrics/classification/metric_confusion.py
rosenzvi/fuse-med-ml
train
0
8facccb193cc9b3d0636edc3be2890470aebd3ac
[ "super().__init__()\nprototype_shape = (num_prototypes, num_features, w_1, h_1)\nself.prototype_vectors = nn.Parameter(torch.randn(prototype_shape), requires_grad=True)", "ones = torch.ones_like(self.prototype_vectors, device=xs.device)\nxs_squared_l2 = F.conv2d(xs ** 2, weight=ones)\nps_squared_l2 = torch.sum(se...
<|body_start_0|> super().__init__() prototype_shape = (num_prototypes, num_features, w_1, h_1) self.prototype_vectors = nn.Parameter(torch.randn(prototype_shape), requires_grad=True) <|end_body_0|> <|body_start_1|> ones = torch.ones_like(self.prototype_vectors, device=xs.device) ...
Convolutional layer that computes the squared L2 distance instead of the conventional inner product.
L2Conv2D
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class L2Conv2D: """Convolutional layer that computes the squared L2 distance instead of the conventional inner product.""" def __init__(self, num_prototypes, num_features, w_1, h_1): """Create a new L2Conv2D layer :param num_prototypes: The number of prototypes in the layer :param num_feat...
stack_v2_sparse_classes_36k_train_011136
3,404
permissive
[ { "docstring": "Create a new L2Conv2D layer :param num_prototypes: The number of prototypes in the layer :param num_features: The number of channels in the input features :param w_1: Width of the prototypes :param h_1: Height of the prototypes", "name": "__init__", "signature": "def __init__(self, num_p...
2
stack_v2_sparse_classes_30k_train_021545
Implement the Python class `L2Conv2D` described below. Class description: Convolutional layer that computes the squared L2 distance instead of the conventional inner product. Method signatures and docstrings: - def __init__(self, num_prototypes, num_features, w_1, h_1): Create a new L2Conv2D layer :param num_prototyp...
Implement the Python class `L2Conv2D` described below. Class description: Convolutional layer that computes the squared L2 distance instead of the conventional inner product. Method signatures and docstrings: - def __init__(self, num_prototypes, num_features, w_1, h_1): Create a new L2Conv2D layer :param num_prototyp...
d9e77a90b47cb1efe19f1736c6701872a3c4a62e
<|skeleton|> class L2Conv2D: """Convolutional layer that computes the squared L2 distance instead of the conventional inner product.""" def __init__(self, num_prototypes, num_features, w_1, h_1): """Create a new L2Conv2D layer :param num_prototypes: The number of prototypes in the layer :param num_feat...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class L2Conv2D: """Convolutional layer that computes the squared L2 distance instead of the conventional inner product.""" def __init__(self, num_prototypes, num_features, w_1, h_1): """Create a new L2Conv2D layer :param num_prototypes: The number of prototypes in the layer :param num_features: The num...
the_stack_v2_python_sparse
util/l2conv.py
TristanGomez44/ProtoTree
train
0
ced2282fd1496fd7cc8701766813e04594a05b7a
[ "self.__timezone = Timezone()\nself.__screen = screen\nself.__msg = TextboxReflowed(40, 'Select the timezone for the system')\nself.__list = Listbox(5, scroll=1, returnExit=1)\nself.__utc = Checkbox('System clock uses UTC', isOn=0)\nself.__buttonsBar = ButtonBar(self.__screen, [('OK', 'ok'), ('Back', 'back')])\nsel...
<|body_start_0|> self.__timezone = Timezone() self.__screen = screen self.__msg = TextboxReflowed(40, 'Select the timezone for the system') self.__list = Listbox(5, scroll=1, returnExit=1) self.__utc = Checkbox('System clock uses UTC', isOn=0) self.__buttonsBar = ButtonBa...
List all the timezones
ListTimezones
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ListTimezones: """List all the timezones""" def __init__(self, screen): """Constructor @type screen: SnackScreen @param screen: SnackScreen instance""" <|body_0|> def __show(self): """Shows screen once @rtype: integer @returns: status of operation""" <|bo...
stack_v2_sparse_classes_36k_train_011137
1,898
no_license
[ { "docstring": "Constructor @type screen: SnackScreen @param screen: SnackScreen instance", "name": "__init__", "signature": "def __init__(self, screen)" }, { "docstring": "Shows screen once @rtype: integer @returns: status of operation", "name": "__show", "signature": "def __show(self)"...
3
null
Implement the Python class `ListTimezones` described below. Class description: List all the timezones Method signatures and docstrings: - def __init__(self, screen): Constructor @type screen: SnackScreen @param screen: SnackScreen instance - def __show(self): Shows screen once @rtype: integer @returns: status of oper...
Implement the Python class `ListTimezones` described below. Class description: List all the timezones Method signatures and docstrings: - def __init__(self, screen): Constructor @type screen: SnackScreen @param screen: SnackScreen instance - def __show(self): Shows screen once @rtype: integer @returns: status of oper...
1c738fd5e6ee3f8fd4f47acf2207038f20868212
<|skeleton|> class ListTimezones: """List all the timezones""" def __init__(self, screen): """Constructor @type screen: SnackScreen @param screen: SnackScreen instance""" <|body_0|> def __show(self): """Shows screen once @rtype: integer @returns: status of operation""" <|bo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ListTimezones: """List all the timezones""" def __init__(self, screen): """Constructor @type screen: SnackScreen @param screen: SnackScreen instance""" self.__timezone = Timezone() self.__screen = screen self.__msg = TextboxReflowed(40, 'Select the timezone for the system'...
the_stack_v2_python_sparse
zfrobisher-installer/src/ui/datetimecfg/listtimezones.py
fedosu85nce/work
train
2
2faddcb468f8aa850f14711e9ddc0a67040c5eb9
[ "self.lvm = lvm\nself.n_particles = n_particles\nself.h_sampler = h_sampler", "h_sampler = self.lvm.sample_h if self.h_sampler is None else functools.partial(self.h_sampler, self.lvm)\nh = h_sampler(self.n_particles * len(v))\nh = h.view(self.n_particles, len(v), *h.shape[1:]).to(v.device)\nlog_p = self.lvm.log_c...
<|body_start_0|> self.lvm = lvm self.n_particles = n_particles self.h_sampler = h_sampler <|end_body_0|> <|body_start_1|> h_sampler = self.lvm.sample_h if self.h_sampler is None else functools.partial(self.h_sampler, self.lvm) h = h_sampler(self.n_particles * len(v)) h =...
BruteForceLL
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BruteForceLL: def __init__(self, lvm, n_particles, h_sampler=None): """Brute force estimation of log-likelihood by log p(v) = log E_h[p(v|h)] Args: lvm: a LVM instance n_particles: #h per v h_sampler: (lvm, n_samples) → samples from p(h) of lvm""" <|body_0|> def estimate_ll(...
stack_v2_sparse_classes_36k_train_011138
985
no_license
[ { "docstring": "Brute force estimation of log-likelihood by log p(v) = log E_h[p(v|h)] Args: lvm: a LVM instance n_particles: #h per v h_sampler: (lvm, n_samples) → samples from p(h) of lvm", "name": "__init__", "signature": "def __init__(self, lvm, n_particles, h_sampler=None)" }, { "docstring"...
2
stack_v2_sparse_classes_30k_train_017543
Implement the Python class `BruteForceLL` described below. Class description: Implement the BruteForceLL class. Method signatures and docstrings: - def __init__(self, lvm, n_particles, h_sampler=None): Brute force estimation of log-likelihood by log p(v) = log E_h[p(v|h)] Args: lvm: a LVM instance n_particles: #h per...
Implement the Python class `BruteForceLL` described below. Class description: Implement the BruteForceLL class. Method signatures and docstrings: - def __init__(self, lvm, n_particles, h_sampler=None): Brute force estimation of log-likelihood by log p(v) = log E_h[p(v|h)] Args: lvm: a LVM instance n_particles: #h per...
5c0c29b5c2864a1a2b2bd61b8561be70de231878
<|skeleton|> class BruteForceLL: def __init__(self, lvm, n_particles, h_sampler=None): """Brute force estimation of log-likelihood by log p(v) = log E_h[p(v|h)] Args: lvm: a LVM instance n_particles: #h per v h_sampler: (lvm, n_samples) → samples from p(h) of lvm""" <|body_0|> def estimate_ll(...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BruteForceLL: def __init__(self, lvm, n_particles, h_sampler=None): """Brute force estimation of log-likelihood by log p(v) = log E_h[p(v|h)] Args: lvm: a LVM instance n_particles: #h per v h_sampler: (lvm, n_samples) → samples from p(h) of lvm""" self.lvm = lvm self.n_particles = n_pa...
the_stack_v2_python_sparse
core/inference/ll/brute_force_ll.py
WN1695173791/VaGES
train
0
1c6576e5a1eb917bdc4badfd9d64f4736caae5ca
[ "self.c = capacity\nself.dic = {}\nself.stack = []\nself.count = 0", "if key in self.dic:\n self.stack.remove(key)\n self.stack.insert(0, key)\n return self.dic[key]\nelse:\n return -1", "if self.count < self.c:\n if key not in self.dic:\n self.count += 1\n else:\n self.stack.rem...
<|body_start_0|> self.c = capacity self.dic = {} self.stack = [] self.count = 0 <|end_body_0|> <|body_start_1|> if key in self.dic: self.stack.remove(key) self.stack.insert(0, key) return self.dic[key] else: return -1 <|end...
LRUCache
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: void""" <|body_2|> <|end_s...
stack_v2_sparse_classes_36k_train_011139
1,228
no_license
[ { "docstring": ":type capacity: int", "name": "__init__", "signature": "def __init__(self, capacity)" }, { "docstring": ":type key: int :rtype: int", "name": "get", "signature": "def get(self, key)" }, { "docstring": ":type key: int :type value: int :rtype: void", "name": "pu...
3
null
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: void
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: void <|sk...
bccd0f6ebb00e9569093f8ec18ebf0e94035dce6
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: void""" <|body_2|> <|end_s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LRUCache: def __init__(self, capacity): """:type capacity: int""" self.c = capacity self.dic = {} self.stack = [] self.count = 0 def get(self, key): """:type key: int :rtype: int""" if key in self.dic: self.stack.remove(key) ...
the_stack_v2_python_sparse
LRU Cache.py
nan0445/Leetcode-Python
train
0
ac5b3484ebbde711f9664e8f3e1d80107aab542f
[ "lock_time = utils.milliseconds_now()\nwith session.begin_transaction() as tx:\n instance = cls.find_transaction(tx, uuid)\n if instance is None:\n instance = cls(uuid=uuid, account_number=account_number, name=name, locked=lock_time)\n instance._update(tx, lock_time)\n elif instance.locked ==...
<|body_start_0|> lock_time = utils.milliseconds_now() with session.begin_transaction() as tx: instance = cls.find_transaction(tx, uuid) if instance is None: instance = cls(uuid=uuid, account_number=account_number, name=name, locked=lock_time) insta...
Model an environment lock in the graph. A lock on an environment exists if the locked property for an environmentlock node is not null.
EnvironmentLockEntity
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EnvironmentLockEntity: """Model an environment lock in the graph. A lock on an environment exists if the locked property for an environmentlock node is not null.""" def lock(cls, session, uuid, account_number, name): """Locks an environment with matching uuid. Lock is obtained in a s...
stack_v2_sparse_classes_36k_train_011140
3,581
permissive
[ { "docstring": "Locks an environment with matching uuid. Lock is obtained in a single transaction. :param session: neo4j driver session :type session: neo4j.v1.session.BoltSession :param uuid: Environment uuid. :type uuid: str :param account_number: Account number :type account_number: str :param name: Name of ...
2
stack_v2_sparse_classes_30k_train_004902
Implement the Python class `EnvironmentLockEntity` described below. Class description: Model an environment lock in the graph. A lock on an environment exists if the locked property for an environmentlock node is not null. Method signatures and docstrings: - def lock(cls, session, uuid, account_number, name): Locks a...
Implement the Python class `EnvironmentLockEntity` described below. Class description: Model an environment lock in the graph. A lock on an environment exists if the locked property for an environmentlock node is not null. Method signatures and docstrings: - def lock(cls, session, uuid, account_number, name): Locks a...
aaab76706c8268d3ff3e87c275baee9dd4714314
<|skeleton|> class EnvironmentLockEntity: """Model an environment lock in the graph. A lock on an environment exists if the locked property for an environmentlock node is not null.""" def lock(cls, session, uuid, account_number, name): """Locks an environment with matching uuid. Lock is obtained in a s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EnvironmentLockEntity: """Model an environment lock in the graph. A lock on an environment exists if the locked property for an environmentlock node is not null.""" def lock(cls, session, uuid, account_number, name): """Locks an environment with matching uuid. Lock is obtained in a single transac...
the_stack_v2_python_sparse
cloud_snitch/models/environmentlock.py
rcbops/FleetDeploymentReporting
train
1
24946af70bd19f4df06148cc31a255e1e471b47b
[ "if not kwargs.get('obj_ids'):\n obj_model = facade.get_route_map_by_search(self.search)\n objects = obj_model['query_set']\n only_main_property = False\nelse:\n ids = kwargs.get('obj_ids').split(';')\n objects = facade.get_route_map_by_ids(ids)\n only_main_property = True\n obj_model = None\ns...
<|body_start_0|> if not kwargs.get('obj_ids'): obj_model = facade.get_route_map_by_search(self.search) objects = obj_model['query_set'] only_main_property = False else: ids = kwargs.get('obj_ids').split(';') objects = facade.get_route_map_by_id...
RouteMapDBView
[ "Apache-2.0", "BSD-3-Clause", "MIT", "LicenseRef-scancode-public-domain", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RouteMapDBView: def get(self, request, *args, **kwargs): """Returns a list of RouteMaps by ids ou dict.""" <|body_0|> def post(self, request, *args, **kwargs): """Create new RouteMap.""" <|body_1|> def put(self, request, *args, **kwargs): """Upda...
stack_v2_sparse_classes_36k_train_011141
9,414
permissive
[ { "docstring": "Returns a list of RouteMaps by ids ou dict.", "name": "get", "signature": "def get(self, request, *args, **kwargs)" }, { "docstring": "Create new RouteMap.", "name": "post", "signature": "def post(self, request, *args, **kwargs)" }, { "docstring": "Update RouteMap...
4
stack_v2_sparse_classes_30k_train_002255
Implement the Python class `RouteMapDBView` described below. Class description: Implement the RouteMapDBView class. Method signatures and docstrings: - def get(self, request, *args, **kwargs): Returns a list of RouteMaps by ids ou dict. - def post(self, request, *args, **kwargs): Create new RouteMap. - def put(self, ...
Implement the Python class `RouteMapDBView` described below. Class description: Implement the RouteMapDBView class. Method signatures and docstrings: - def get(self, request, *args, **kwargs): Returns a list of RouteMaps by ids ou dict. - def post(self, request, *args, **kwargs): Create new RouteMap. - def put(self, ...
eb27e1d977a1c4bb1fee8fb51b8d8050c64696d9
<|skeleton|> class RouteMapDBView: def get(self, request, *args, **kwargs): """Returns a list of RouteMaps by ids ou dict.""" <|body_0|> def post(self, request, *args, **kwargs): """Create new RouteMap.""" <|body_1|> def put(self, request, *args, **kwargs): """Upda...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RouteMapDBView: def get(self, request, *args, **kwargs): """Returns a list of RouteMaps by ids ou dict.""" if not kwargs.get('obj_ids'): obj_model = facade.get_route_map_by_search(self.search) objects = obj_model['query_set'] only_main_property = False ...
the_stack_v2_python_sparse
networkapi/api_route_map/v4/views.py
globocom/GloboNetworkAPI
train
86
3de7e65d8aff5eeabe000b15a93114d834d21ec2
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "conte...
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
The CAS (content-addressable storage) is used to store the inputs to and outputs from the execution service. Each piece of content is addressed by the digest of its binary data. Most of the binary data stored in the CAS is opaque to the execution engine, and is only used as a communication medium. In order to build an ...
ContentAddressableStorageServicer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ContentAddressableStorageServicer: """The CAS (content-addressable storage) is used to store the inputs to and outputs from the execution service. Each piece of content is addressed by the digest of its binary data. Most of the binary data stored in the CAS is opaque to the execution engine, and ...
stack_v2_sparse_classes_36k_train_011142
24,490
no_license
[ { "docstring": "Determine if blobs are present in the CAS. Clients can use this API before uploading blobs to determine which ones are already present in the CAS and do not need to be uploaded again. There are no method-specific errors.", "name": "FindMissingBlobs", "signature": "def FindMissingBlobs(se...
3
stack_v2_sparse_classes_30k_train_017647
Implement the Python class `ContentAddressableStorageServicer` described below. Class description: The CAS (content-addressable storage) is used to store the inputs to and outputs from the execution service. Each piece of content is addressed by the digest of its binary data. Most of the binary data stored in the CAS ...
Implement the Python class `ContentAddressableStorageServicer` described below. Class description: The CAS (content-addressable storage) is used to store the inputs to and outputs from the execution service. Each piece of content is addressed by the digest of its binary data. Most of the binary data stored in the CAS ...
d7424d21aa0dc121acc4d64b427ba365a3581a20
<|skeleton|> class ContentAddressableStorageServicer: """The CAS (content-addressable storage) is used to store the inputs to and outputs from the execution service. Each piece of content is addressed by the digest of its binary data. Most of the binary data stored in the CAS is opaque to the execution engine, and ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ContentAddressableStorageServicer: """The CAS (content-addressable storage) is used to store the inputs to and outputs from the execution service. Each piece of content is addressed by the digest of its binary data. Most of the binary data stored in the CAS is opaque to the execution engine, and is only used ...
the_stack_v2_python_sparse
google/devtools/remoteexecution/v1test/remote_execution_pb2_grpc.py
msachtler/bazel-event-protocol-parser
train
1
e348c5bffd35f16bbd71d083a51ddfe8b2dd4b60
[ "match = DATA_MATCHER.match(self.raw_data)\nif not match:\n raise SampleException('Issmcnsm_flortdParserDataParticle: No regex match of parsed sample data [%s]', self.raw_data)\ntry:\n date_match = DATA_TIME_MATCHER.match(match.group(1))\n if not date_match:\n raise...
<|body_start_0|> match = DATA_MATCHER.match(self.raw_data) if not match: raise SampleException('Issmcnsm_flortdParserDataParticle: No regex match of parsed sample data [%s]', self.raw_data) try: date_match = DATA_TIME_MATCHER.match(match....
Class for parsing data from the issmcnsm_flort instrument
Issmcnsm_flortdParserDataParticle
[ "BSD-2-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Issmcnsm_flortdParserDataParticle: """Class for parsing data from the issmcnsm_flort instrument""" def _build_parsed_values(self): """Take something in the data format and turn it into a particle with the appropriate tag. @throws SampleException If there is a problem with sample crea...
stack_v2_sparse_classes_36k_train_011143
12,527
permissive
[ { "docstring": "Take something in the data format and turn it into a particle with the appropriate tag. @throws SampleException If there is a problem with sample creation", "name": "_build_parsed_values", "signature": "def _build_parsed_values(self)" }, { "docstring": "Quick equality check for t...
2
stack_v2_sparse_classes_30k_train_013181
Implement the Python class `Issmcnsm_flortdParserDataParticle` described below. Class description: Class for parsing data from the issmcnsm_flort instrument Method signatures and docstrings: - def _build_parsed_values(self): Take something in the data format and turn it into a particle with the appropriate tag. @thro...
Implement the Python class `Issmcnsm_flortdParserDataParticle` described below. Class description: Class for parsing data from the issmcnsm_flort instrument Method signatures and docstrings: - def _build_parsed_values(self): Take something in the data format and turn it into a particle with the appropriate tag. @thro...
a1f2fa611b773cb2ae309fce7b9df2dec6d739d6
<|skeleton|> class Issmcnsm_flortdParserDataParticle: """Class for parsing data from the issmcnsm_flort instrument""" def _build_parsed_values(self): """Take something in the data format and turn it into a particle with the appropriate tag. @throws SampleException If there is a problem with sample crea...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Issmcnsm_flortdParserDataParticle: """Class for parsing data from the issmcnsm_flort instrument""" def _build_parsed_values(self): """Take something in the data format and turn it into a particle with the appropriate tag. @throws SampleException If there is a problem with sample creation""" ...
the_stack_v2_python_sparse
mi/dataset/parser/issmcnsm_flortd.py
AYCS/marine-integrations
train
0
47e53984d6376001b5033363c8f56d063d95b193
[ "self.verbose = verbose\nself.__get_spatial_data__(dsName)\nself.__format_date_time__(date, time)\nself.__format_outname__(outName)\nself.__create_tide_maps__()", "if self.verbose == True:\n print('Retrieving data set bounds and resolution')\nDS = load_gdal_dataset(dsName)\ntnsf = DS.GetGeoTransform()\nM, N = ...
<|body_start_0|> self.verbose = verbose self.__get_spatial_data__(dsName) self.__format_date_time__(date, time) self.__format_outname__(outName) self.__create_tide_maps__() <|end_body_0|> <|body_start_1|> if self.verbose == True: print('Retrieving data set bo...
create_tide_map
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class create_tide_map: def __init__(self, dsName, date, time, outName, verbose=False): """Create one or more tide maps using GMT 6's earthtide functionality. This class Inherits os IOsupport: load_gdal_dataset, load_gdal_datasets GeoFormatting: get_raster_size, parse_transform Viewing: raster_...
stack_v2_sparse_classes_36k_train_011144
6,224
no_license
[ { "docstring": "Create one or more tide maps using GMT 6's earthtide functionality. This class Inherits os IOsupport: load_gdal_dataset, load_gdal_datasets GeoFormatting: get_raster_size, parse_transform Viewing: raster_multiplot", "name": "__init__", "signature": "def __init__(self, dsName, date, time,...
6
stack_v2_sparse_classes_30k_train_017361
Implement the Python class `create_tide_map` described below. Class description: Implement the create_tide_map class. Method signatures and docstrings: - def __init__(self, dsName, date, time, outName, verbose=False): Create one or more tide maps using GMT 6's earthtide functionality. This class Inherits os IOsupport...
Implement the Python class `create_tide_map` described below. Class description: Implement the create_tide_map class. Method signatures and docstrings: - def __init__(self, dsName, date, time, outName, verbose=False): Create one or more tide maps using GMT 6's earthtide functionality. This class Inherits os IOsupport...
91550a563afe4739af4cf638c3560a21a33b75db
<|skeleton|> class create_tide_map: def __init__(self, dsName, date, time, outName, verbose=False): """Create one or more tide maps using GMT 6's earthtide functionality. This class Inherits os IOsupport: load_gdal_dataset, load_gdal_datasets GeoFormatting: get_raster_size, parse_transform Viewing: raster_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class create_tide_map: def __init__(self, dsName, date, time, outName, verbose=False): """Create one or more tide maps using GMT 6's earthtide functionality. This class Inherits os IOsupport: load_gdal_dataset, load_gdal_datasets GeoFormatting: get_raster_size, parse_transform Viewing: raster_multiplot""" ...
the_stack_v2_python_sparse
bin/compute_earthtide.py
cherishing99/InsarToolkit
train
0
7fe72cec041732b4afd3fee2b13d0e8fa4f14673
[ "self.name = name\nself.first_name = first_name\nself.middle_name = middle_name\nself.last_name = last_name\nself.date_of_birth = date_of_birth\nself.status = status\nself.social_security_number = social_security_number\nself.identity_provider_unique_id = identity_provider_unique_id\nself.identity_provider = identi...
<|body_start_0|> self.name = name self.first_name = first_name self.middle_name = middle_name self.last_name = last_name self.date_of_birth = date_of_birth self.status = status self.social_security_number = social_security_number self.identity_provider_uni...
Implementation of the 'IdentificationResponse' model. The reponse for the identity process. Contains users name, id number etc Attributes: name (string): The fullname of the user as reported back from the IdentityProvider first_name (string): The first name of the user middle_name (string): The middle name of the user ...
IdentificationResponse
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IdentificationResponse: """Implementation of the 'IdentificationResponse' model. The reponse for the identity process. Contains users name, id number etc Attributes: name (string): The fullname of the user as reported back from the IdentityProvider first_name (string): The first name of the user ...
stack_v2_sparse_classes_36k_train_011145
6,423
permissive
[ { "docstring": "Constructor for the IdentificationResponse class", "name": "__init__", "signature": "def __init__(self, name=None, first_name=None, middle_name=None, last_name=None, date_of_birth=None, status=None, social_security_number=None, identity_provider_unique_id=None, identity_provider=None, er...
2
null
Implement the Python class `IdentificationResponse` described below. Class description: Implementation of the 'IdentificationResponse' model. The reponse for the identity process. Contains users name, id number etc Attributes: name (string): The fullname of the user as reported back from the IdentityProvider first_nam...
Implement the Python class `IdentificationResponse` described below. Class description: Implementation of the 'IdentificationResponse' model. The reponse for the identity process. Contains users name, id number etc Attributes: name (string): The fullname of the user as reported back from the IdentityProvider first_nam...
fa3918a6c54ea0eedb9146578645b7eb1755b642
<|skeleton|> class IdentificationResponse: """Implementation of the 'IdentificationResponse' model. The reponse for the identity process. Contains users name, id number etc Attributes: name (string): The fullname of the user as reported back from the IdentityProvider first_name (string): The first name of the user ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IdentificationResponse: """Implementation of the 'IdentificationResponse' model. The reponse for the identity process. Contains users name, id number etc Attributes: name (string): The fullname of the user as reported back from the IdentityProvider first_name (string): The first name of the user middle_name (...
the_stack_v2_python_sparse
idfy_rest_client/models/identification_response.py
dealflowteam/Idfy
train
0
408c46e8af6b2eb87c4ec1cd1b9d6459725e88fd
[ "self.base_url = 'https://follow-api-ms.juejin.im/v1/getUserFollowerList'\nself.user_id = ''\nself.src = 'web'\nself.before = ''\nself.param = {}\nself.user_list = []\nself.json_file = 'follower_user.json'\nself.user_count = 0", "headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537....
<|body_start_0|> self.base_url = 'https://follow-api-ms.juejin.im/v1/getUserFollowerList' self.user_id = '' self.src = 'web' self.before = '' self.param = {} self.user_list = [] self.json_file = 'follower_user.json' self.user_count = 0 <|end_body_0|> <|bo...
抓取掘金用户的关注者
GetFollwerUser
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GetFollwerUser: """抓取掘金用户的关注者""" def __init__(self): """初始化变量""" <|body_0|> def get_users(self): """获取一页的用户""" <|body_1|> def get_follower_user(self, user_id): """获取关注者的关注者""" <|body_2|> def read_write_by_json(self, data): ...
stack_v2_sparse_classes_36k_train_011146
4,825
no_license
[ { "docstring": "初始化变量", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "获取一页的用户", "name": "get_users", "signature": "def get_users(self)" }, { "docstring": "获取关注者的关注者", "name": "get_follower_user", "signature": "def get_follower_user(self, user_id...
5
null
Implement the Python class `GetFollwerUser` described below. Class description: 抓取掘金用户的关注者 Method signatures and docstrings: - def __init__(self): 初始化变量 - def get_users(self): 获取一页的用户 - def get_follower_user(self, user_id): 获取关注者的关注者 - def read_write_by_json(self, data): 读写json文件 - def run(self, user_id): 开始爬取
Implement the Python class `GetFollwerUser` described below. Class description: 抓取掘金用户的关注者 Method signatures and docstrings: - def __init__(self): 初始化变量 - def get_users(self): 获取一页的用户 - def get_follower_user(self, user_id): 获取关注者的关注者 - def read_write_by_json(self, data): 读写json文件 - def run(self, user_id): 开始爬取 <|ske...
85252128df681c472acda8ae2467c4426612f9b6
<|skeleton|> class GetFollwerUser: """抓取掘金用户的关注者""" def __init__(self): """初始化变量""" <|body_0|> def get_users(self): """获取一页的用户""" <|body_1|> def get_follower_user(self, user_id): """获取关注者的关注者""" <|body_2|> def read_write_by_json(self, data): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GetFollwerUser: """抓取掘金用户的关注者""" def __init__(self): """初始化变量""" self.base_url = 'https://follow-api-ms.juejin.im/v1/getUserFollowerList' self.user_id = '' self.src = 'web' self.before = '' self.param = {} self.user_list = [] self.json_file ...
the_stack_v2_python_sparse
取个队名真难-C/day18/follower_user_to_more.py
lxiaokai/team-learning-python
train
12
f89b4c257775bcc222c8dc0203a5defabbbd1b04
[ "if not digits:\n return []\ndigit_dict = {'2': 'abc', '3': 'def', '4': 'ghi', '5': 'jkl', '6': 'mno', '7': 'pqrs', '8': 'tuv', '9': 'wxyz'}\ndq = collections.deque(list(digit_dict[digits[0]]))\nfor i, d in enumerate(digits[1:], 1):\n while len(dq[0]) <= i:\n s = dq.popleft()\n for c in digit_di...
<|body_start_0|> if not digits: return [] digit_dict = {'2': 'abc', '3': 'def', '4': 'ghi', '5': 'jkl', '6': 'mno', '7': 'pqrs', '8': 'tuv', '9': 'wxyz'} dq = collections.deque(list(digit_dict[digits[0]])) for i, d in enumerate(digits[1:], 1): while len(dq[0]) <= ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def letterCombinations2(self, digits: str) -> List[str]: """AC: 05/09/2022 Runtime: 34 ms, faster than 76.96% Memory Usage: 13.9 MB, less than 79.68% :param digits: 0 <= digits.length <= 4 digits[i] is a digit in the range ['2', '9'] :return:""" <|body_0|> def lett...
stack_v2_sparse_classes_36k_train_011147
1,805
permissive
[ { "docstring": "AC: 05/09/2022 Runtime: 34 ms, faster than 76.96% Memory Usage: 13.9 MB, less than 79.68% :param digits: 0 <= digits.length <= 4 digits[i] is a digit in the range ['2', '9'] :return:", "name": "letterCombinations2", "signature": "def letterCombinations2(self, digits: str) -> List[str]" ...
2
stack_v2_sparse_classes_30k_train_021096
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def letterCombinations2(self, digits: str) -> List[str]: AC: 05/09/2022 Runtime: 34 ms, faster than 76.96% Memory Usage: 13.9 MB, less than 79.68% :param digits: 0 <= digits.leng...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def letterCombinations2(self, digits: str) -> List[str]: AC: 05/09/2022 Runtime: 34 ms, faster than 76.96% Memory Usage: 13.9 MB, less than 79.68% :param digits: 0 <= digits.leng...
4dd1e54d8d08f7e6590bc76abd08ecaacaf775e5
<|skeleton|> class Solution: def letterCombinations2(self, digits: str) -> List[str]: """AC: 05/09/2022 Runtime: 34 ms, faster than 76.96% Memory Usage: 13.9 MB, less than 79.68% :param digits: 0 <= digits.length <= 4 digits[i] is a digit in the range ['2', '9'] :return:""" <|body_0|> def lett...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def letterCombinations2(self, digits: str) -> List[str]: """AC: 05/09/2022 Runtime: 34 ms, faster than 76.96% Memory Usage: 13.9 MB, less than 79.68% :param digits: 0 <= digits.length <= 4 digits[i] is a digit in the range ['2', '9'] :return:""" if not digits: return [] ...
the_stack_v2_python_sparse
src/17-LetterCombinationsOfAPhoneNumber.py
Jiezhi/myleetcode
train
1
835296b8bf555f955db865bc87f64328015dced8
[ "super(TransformerEncoderLayer, self).__init__()\nself.layer_norm = nn.LayerNorm(size, eps=1e-06)\nself.src_src_att = MultiHeadedAttention(num_heads, size, dropout=dropout)\nself.feed_forward = PositionwiseFeedForward(input_size=size, ff_size=ff_size, dropout=dropout)\nself.dropout = nn.Dropout(dropout)\nself.size ...
<|body_start_0|> super(TransformerEncoderLayer, self).__init__() self.layer_norm = nn.LayerNorm(size, eps=1e-06) self.src_src_att = MultiHeadedAttention(num_heads, size, dropout=dropout) self.feed_forward = PositionwiseFeedForward(input_size=size, ff_size=ff_size, dropout=dropout) ...
One Transformer encoder layer has a Multi-head attention layer plus a position-wise feed-forward layer.
TransformerEncoderLayer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TransformerEncoderLayer: """One Transformer encoder layer has a Multi-head attention layer plus a position-wise feed-forward layer.""" def __init__(self, size: int=0, ff_size: int=0, num_heads: int=0, dropout: float=0.1): """A single Transformer layer. :param size: :param ff_size: :p...
stack_v2_sparse_classes_36k_train_011148
6,117
no_license
[ { "docstring": "A single Transformer layer. :param size: :param ff_size: :param num_heads: :param dropout:", "name": "__init__", "signature": "def __init__(self, size: int=0, ff_size: int=0, num_heads: int=0, dropout: float=0.1)" }, { "docstring": "Forward pass for a single transformer encoder l...
2
stack_v2_sparse_classes_30k_train_012792
Implement the Python class `TransformerEncoderLayer` described below. Class description: One Transformer encoder layer has a Multi-head attention layer plus a position-wise feed-forward layer. Method signatures and docstrings: - def __init__(self, size: int=0, ff_size: int=0, num_heads: int=0, dropout: float=0.1): A ...
Implement the Python class `TransformerEncoderLayer` described below. Class description: One Transformer encoder layer has a Multi-head attention layer plus a position-wise feed-forward layer. Method signatures and docstrings: - def __init__(self, size: int=0, ff_size: int=0, num_heads: int=0, dropout: float=0.1): A ...
e213665be8d3820fa2fc0aa9afe9949fd2e3d488
<|skeleton|> class TransformerEncoderLayer: """One Transformer encoder layer has a Multi-head attention layer plus a position-wise feed-forward layer.""" def __init__(self, size: int=0, ff_size: int=0, num_heads: int=0, dropout: float=0.1): """A single Transformer layer. :param size: :param ff_size: :p...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TransformerEncoderLayer: """One Transformer encoder layer has a Multi-head attention layer plus a position-wise feed-forward layer.""" def __init__(self, size: int=0, ff_size: int=0, num_heads: int=0, dropout: float=0.1): """A single Transformer layer. :param size: :param ff_size: :param num_head...
the_stack_v2_python_sparse
modules/transformer_layers.py
zqp111/transformer_ar
train
1
45a2b73b5b66b0059ee6dcbfeac393737c946a39
[ "super().__init__(pos_enc_class)\nself.conv = nn.Sequential(Conv2D(1, odim, 3, 2), nn.ReLU(), Conv2D(odim, odim, 3, 2), nn.ReLU(), Conv2D(odim, odim, 3, 2), nn.ReLU())\nself.linear = Linear(odim * ((((idim - 1) // 2 - 1) // 2 - 1) // 2), odim)\nself.subsampling_rate = 8\nself.right_context = 14", "x = x.unsqueeze...
<|body_start_0|> super().__init__(pos_enc_class) self.conv = nn.Sequential(Conv2D(1, odim, 3, 2), nn.ReLU(), Conv2D(odim, odim, 3, 2), nn.ReLU(), Conv2D(odim, odim, 3, 2), nn.ReLU()) self.linear = Linear(odim * ((((idim - 1) // 2 - 1) // 2 - 1) // 2), odim) self.subsampling_rate = 8 ...
Convolutional 2D subsampling (to 1/8 length).
Conv2dSubsampling8
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Conv2dSubsampling8: """Convolutional 2D subsampling (to 1/8 length).""" def __init__(self, idim: int, odim: int, dropout_rate: float, pos_enc_class: nn.Layer=PositionalEncoding): """Construct an Conv2dSubsampling8 object. Args: idim (int): Input dimension. odim (int): Output dimensio...
stack_v2_sparse_classes_36k_train_011149
11,942
permissive
[ { "docstring": "Construct an Conv2dSubsampling8 object. Args: idim (int): Input dimension. odim (int): Output dimension. dropout_rate (float): Dropout rate.", "name": "__init__", "signature": "def __init__(self, idim: int, odim: int, dropout_rate: float, pos_enc_class: nn.Layer=PositionalEncoding)" },...
2
stack_v2_sparse_classes_30k_train_009565
Implement the Python class `Conv2dSubsampling8` described below. Class description: Convolutional 2D subsampling (to 1/8 length). Method signatures and docstrings: - def __init__(self, idim: int, odim: int, dropout_rate: float, pos_enc_class: nn.Layer=PositionalEncoding): Construct an Conv2dSubsampling8 object. Args:...
Implement the Python class `Conv2dSubsampling8` described below. Class description: Convolutional 2D subsampling (to 1/8 length). Method signatures and docstrings: - def __init__(self, idim: int, odim: int, dropout_rate: float, pos_enc_class: nn.Layer=PositionalEncoding): Construct an Conv2dSubsampling8 object. Args:...
17854a04d43c231eff66bfed9d6aa55e94a29e79
<|skeleton|> class Conv2dSubsampling8: """Convolutional 2D subsampling (to 1/8 length).""" def __init__(self, idim: int, odim: int, dropout_rate: float, pos_enc_class: nn.Layer=PositionalEncoding): """Construct an Conv2dSubsampling8 object. Args: idim (int): Input dimension. odim (int): Output dimensio...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Conv2dSubsampling8: """Convolutional 2D subsampling (to 1/8 length).""" def __init__(self, idim: int, odim: int, dropout_rate: float, pos_enc_class: nn.Layer=PositionalEncoding): """Construct an Conv2dSubsampling8 object. Args: idim (int): Input dimension. odim (int): Output dimension. dropout_ra...
the_stack_v2_python_sparse
paddlespeech/s2t/modules/subsampling.py
anniyanvr/DeepSpeech-1
train
0
7edbd5ec43c9ac6da2d579907204f6252653f8c1
[ "with open(filename) as runfile:\n data = runfile.read()\ndecoded = json.loads(data)\nreturn cls(**decoded)", "filename = os.path.join(directory, self.station_id)\nwith open(filename, 'w') as runfile:\n runfile.write(self.AsJSON())\nreturn filename", "data = self._asdict()\ndata['http_host'] = self.http_h...
<|body_start_0|> with open(filename) as runfile: data = runfile.read() decoded = json.loads(data) return cls(**decoded) <|end_body_0|> <|body_start_1|> filename = os.path.join(directory, self.station_id) with open(filename, 'w') as runfile: runfile.write(...
Encapsulates the run data stored in an openhtf file.
RunData
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RunData: """Encapsulates the run data stored in an openhtf file.""" def FromFile(cls, filename): """Creates RunData from a run file.""" <|body_0|> def SaveToFile(self, directory): """Saves this run data to a file, typically in /var/run/openhtf. Args: directory: T...
stack_v2_sparse_classes_36k_train_011150
3,099
permissive
[ { "docstring": "Creates RunData from a run file.", "name": "FromFile", "signature": "def FromFile(cls, filename)" }, { "docstring": "Saves this run data to a file, typically in /var/run/openhtf. Args: directory: The directory in which to save this file. Return: The filename of this rundata.", ...
4
stack_v2_sparse_classes_30k_test_000335
Implement the Python class `RunData` described below. Class description: Encapsulates the run data stored in an openhtf file. Method signatures and docstrings: - def FromFile(cls, filename): Creates RunData from a run file. - def SaveToFile(self, directory): Saves this run data to a file, typically in /var/run/openht...
Implement the Python class `RunData` described below. Class description: Encapsulates the run data stored in an openhtf file. Method signatures and docstrings: - def FromFile(cls, filename): Creates RunData from a run file. - def SaveToFile(self, directory): Saves this run data to a file, typically in /var/run/openht...
bc41fcf0b804530c36cbeccacba5d5b98c5df243
<|skeleton|> class RunData: """Encapsulates the run data stored in an openhtf file.""" def FromFile(cls, filename): """Creates RunData from a run file.""" <|body_0|> def SaveToFile(self, directory): """Saves this run data to a file, typically in /var/run/openhtf. Args: directory: T...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RunData: """Encapsulates the run data stored in an openhtf file.""" def FromFile(cls, filename): """Creates RunData from a run file.""" with open(filename) as runfile: data = runfile.read() decoded = json.loads(data) return cls(**decoded) def SaveToFile(se...
the_stack_v2_python_sparse
openhtf/io/rundata.py
googlerhuili/openhtf
train
1
38842145fb4093a1e86ed8ef81538bde37835646
[ "if not language in ACCEPTED_LANGUAGES:\n raise ValueError(f'Language {language} is not supported yet')\nelif descriptive_indices is not None and descriptive_indices.language != language:\n raise ValueError(f'The descriptive indices analyzer must be of the same language as the word information analyzer.')\nse...
<|body_start_0|> if not language in ACCEPTED_LANGUAGES: raise ValueError(f'Language {language} is not supported yet') elif descriptive_indices is not None and descriptive_indices.language != language: raise ValueError(f'The descriptive indices analyzer must be of the same languag...
This class will handle all operations to find the readability indices of a text according to Coh-Metrix.
ReadabilityIndices
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReadabilityIndices: """This class will handle all operations to find the readability indices of a text according to Coh-Metrix.""" def __init__(self, nlp, language: str='es', descriptive_indices: DescriptiveIndices=None) -> None: """The constructor will initialize this object that ca...
stack_v2_sparse_classes_36k_train_011151
3,373
no_license
[ { "docstring": "The constructor will initialize this object that calculates the readability indices for a specific language of those that are available. Parameters: nlp: The spacy model that corresponds to a language. language(str): The language that the texts to process will have. descriptive_indices(Descripti...
2
stack_v2_sparse_classes_30k_train_001170
Implement the Python class `ReadabilityIndices` described below. Class description: This class will handle all operations to find the readability indices of a text according to Coh-Metrix. Method signatures and docstrings: - def __init__(self, nlp, language: str='es', descriptive_indices: DescriptiveIndices=None) -> ...
Implement the Python class `ReadabilityIndices` described below. Class description: This class will handle all operations to find the readability indices of a text according to Coh-Metrix. Method signatures and docstrings: - def __init__(self, nlp, language: str='es', descriptive_indices: DescriptiveIndices=None) -> ...
f23342fbf2cb54a89cd381813ad9eee754b61094
<|skeleton|> class ReadabilityIndices: """This class will handle all operations to find the readability indices of a text according to Coh-Metrix.""" def __init__(self, nlp, language: str='es', descriptive_indices: DescriptiveIndices=None) -> None: """The constructor will initialize this object that ca...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ReadabilityIndices: """This class will handle all operations to find the readability indices of a text according to Coh-Metrix.""" def __init__(self, nlp, language: str='es', descriptive_indices: DescriptiveIndices=None) -> None: """The constructor will initialize this object that calculates the ...
the_stack_v2_python_sparse
src/processing/coh_metrix_indices/readability_indices.py
persuaide/Tesis_Chatbot
train
0
414af5a198fa6917131305d0d692a8aa3273f099
[ "wave = np.asarray(wave)\nflux = np.asarray(flux)\nassert flux.shape[1] == len(wave)\nself.type = template_type\nself.subtype = subtype\nself.redshifts = np.asarray(redshifts)\nself.wave = wave\nself.flux = flux\nself.nbasis = flux.shape[0]\nself.nwave = flux.shape[1]", "if self.subtype != '':\n return '{}:{}'...
<|body_start_0|> wave = np.asarray(wave) flux = np.asarray(flux) assert flux.shape[1] == len(wave) self.type = template_type self.subtype = subtype self.redshifts = np.asarray(redshifts) self.wave = wave self.flux = flux self.nbasis = flux.shape[0]...
Template
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Template: def __init__(self, template_type, redshifts, wave, flux, subtype=''): """Create a spectral Template PCA object Args: template_type : str, type of template, e.g. 'galaxy' or 'qso' redshifts : array of redshifts to consider for this template wave : 1D array of restframe wavelengt...
stack_v2_sparse_classes_36k_train_011152
15,834
permissive
[ { "docstring": "Create a spectral Template PCA object Args: template_type : str, type of template, e.g. 'galaxy' or 'qso' redshifts : array of redshifts to consider for this template wave : 1D array of restframe wavelengths flux : 2D array of PCA eigenvectors[number of basis eigenvectors, nwave]", "name": "...
3
null
Implement the Python class `Template` described below. Class description: Implement the Template class. Method signatures and docstrings: - def __init__(self, template_type, redshifts, wave, flux, subtype=''): Create a spectral Template PCA object Args: template_type : str, type of template, e.g. 'galaxy' or 'qso' re...
Implement the Python class `Template` described below. Class description: Implement the Template class. Method signatures and docstrings: - def __init__(self, template_type, redshifts, wave, flux, subtype=''): Create a spectral Template PCA object Args: template_type : str, type of template, e.g. 'galaxy' or 'qso' re...
fca7d0cd515b756233dfd530e9f779c637730bc4
<|skeleton|> class Template: def __init__(self, template_type, redshifts, wave, flux, subtype=''): """Create a spectral Template PCA object Args: template_type : str, type of template, e.g. 'galaxy' or 'qso' redshifts : array of redshifts to consider for this template wave : 1D array of restframe wavelengt...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Template: def __init__(self, template_type, redshifts, wave, flux, subtype=''): """Create a spectral Template PCA object Args: template_type : str, type of template, e.g. 'galaxy' or 'qso' redshifts : array of redshifts to consider for this template wave : 1D array of restframe wavelengths flux : 2D a...
the_stack_v2_python_sparse
desihub/redrock/py/redrock/dataobj.py
michaelJwilson/LBGCMB
train
2
231db2c3fc0c6bbc3cdda02c8c4e94891fb21a91
[ "class Other:\n\n def __init__(self):\n self.keystring = ''\n self.valuesum = 0\n\n def add_function(self, items):\n for key, value in items:\n self.valuesum += value\n self.keystring += key\n\n def remove_function(self, items):\n for key, value in items:\n...
<|body_start_0|> class Other: def __init__(self): self.keystring = '' self.valuesum = 0 def add_function(self, items): for key, value in items: self.valuesum += value self.keystring += key ...
An extension of python `dict` with enforcment hooks that call functions whenever items are added/overwritten or removed/overwritten.
EnforcerDictSpec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EnforcerDictSpec: """An extension of python `dict` with enforcment hooks that call functions whenever items are added/overwritten or removed/overwritten.""" def ENFORCER_DICT(EnforcerDict, dict_like=None, add_function=None, remove_function=None): """Build a dictionary with enforcemen...
stack_v2_sparse_classes_36k_train_011153
4,361
no_license
[ { "docstring": "Build a dictionary with enforcement hooks. `add_function(added)` is a function that is called whenever a new (or replacement) key:value pair is added, and it should expect `added` to be a `iterable<tuple<key, value>>` as an argument. The return of `add_function(added)` should be an `iterable<tup...
4
stack_v2_sparse_classes_30k_train_011569
Implement the Python class `EnforcerDictSpec` described below. Class description: An extension of python `dict` with enforcment hooks that call functions whenever items are added/overwritten or removed/overwritten. Method signatures and docstrings: - def ENFORCER_DICT(EnforcerDict, dict_like=None, add_function=None, ...
Implement the Python class `EnforcerDictSpec` described below. Class description: An extension of python `dict` with enforcment hooks that call functions whenever items are added/overwritten or removed/overwritten. Method signatures and docstrings: - def ENFORCER_DICT(EnforcerDict, dict_like=None, add_function=None, ...
47c1512bc2d593dd33ac55ec6137d035fff2e2a9
<|skeleton|> class EnforcerDictSpec: """An extension of python `dict` with enforcment hooks that call functions whenever items are added/overwritten or removed/overwritten.""" def ENFORCER_DICT(EnforcerDict, dict_like=None, add_function=None, remove_function=None): """Build a dictionary with enforcemen...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EnforcerDictSpec: """An extension of python `dict` with enforcment hooks that call functions whenever items are added/overwritten or removed/overwritten.""" def ENFORCER_DICT(EnforcerDict, dict_like=None, add_function=None, remove_function=None): """Build a dictionary with enforcement hooks. `add...
the_stack_v2_python_sparse
structpy/collection/enforcer/enforcer_dict_spec.py
jdfinch/structpy
train
0
e37c7a2b403a5ea08a4c4dca7671bbb891921288
[ "super(MolTransModel, self).__init__()\nself.model_config = model_config\nself.drug_max_seq = model_config['drug_max_seq']\nself.target_max_seq = model_config['target_max_seq']\nself.emb_size = model_config['emb_size']\nself.dropout_ratio = model_config['dropout_ratio']\nself.input_drug_dim = model_config['input_dr...
<|body_start_0|> super(MolTransModel, self).__init__() self.model_config = model_config self.drug_max_seq = model_config['drug_max_seq'] self.target_max_seq = model_config['target_max_seq'] self.emb_size = model_config['emb_size'] self.dropout_ratio = model_config['dropou...
Interaction Module
MolTransModel
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MolTransModel: """Interaction Module""" def __init__(self, model_config): """Initialization""" <|body_0|> def forward(self, d, t, d_masking, t_masking): """Double Towers""" <|body_1|> <|end_skeleton|> <|body_start_0|> super(MolTransModel, self)....
stack_v2_sparse_classes_36k_train_011154
12,741
permissive
[ { "docstring": "Initialization", "name": "__init__", "signature": "def __init__(self, model_config)" }, { "docstring": "Double Towers", "name": "forward", "signature": "def forward(self, d, t, d_masking, t_masking)" } ]
2
null
Implement the Python class `MolTransModel` described below. Class description: Interaction Module Method signatures and docstrings: - def __init__(self, model_config): Initialization - def forward(self, d, t, d_masking, t_masking): Double Towers
Implement the Python class `MolTransModel` described below. Class description: Interaction Module Method signatures and docstrings: - def __init__(self, model_config): Initialization - def forward(self, d, t, d_masking, t_masking): Double Towers <|skeleton|> class MolTransModel: """Interaction Module""" def...
e6ab0261eb719c21806bbadfd94001ecfe27de45
<|skeleton|> class MolTransModel: """Interaction Module""" def __init__(self, model_config): """Initialization""" <|body_0|> def forward(self, d, t, d_masking, t_masking): """Double Towers""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MolTransModel: """Interaction Module""" def __init__(self, model_config): """Initialization""" super(MolTransModel, self).__init__() self.model_config = model_config self.drug_max_seq = model_config['drug_max_seq'] self.target_max_seq = model_config['target_max_seq...
the_stack_v2_python_sparse
apps/drug_target_interaction/moltrans_dti/double_towers.py
PaddlePaddle/PaddleHelix
train
771
b4226dfc15781b27c1f62bdf7c72cd1392462a7b
[ "self.hass = hass\nself.bot = bot\nself.dispatcher = dispatcher\nself.trusted_networks = trusted_networks", "real_ip = ip_address(request.remote)\nif not any((real_ip in net for net in self.trusted_networks)):\n _LOGGER.warning('Access denied from %s', real_ip)\n return self.json_message('Access denied', HT...
<|body_start_0|> self.hass = hass self.bot = bot self.dispatcher = dispatcher self.trusted_networks = trusted_networks <|end_body_0|> <|body_start_1|> real_ip = ip_address(request.remote) if not any((real_ip in net for net in self.trusted_networks)): _LOGGER....
View for handling webhook calls from Telegram.
PushBotView
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PushBotView: """View for handling webhook calls from Telegram.""" def __init__(self, hass, bot, dispatcher, trusted_networks): """Initialize by storing stuff needed for setting up our webhook endpoint.""" <|body_0|> async def post(self, request): """Accept the PO...
stack_v2_sparse_classes_36k_train_011155
5,021
permissive
[ { "docstring": "Initialize by storing stuff needed for setting up our webhook endpoint.", "name": "__init__", "signature": "def __init__(self, hass, bot, dispatcher, trusted_networks)" }, { "docstring": "Accept the POST from telegram.", "name": "post", "signature": "async def post(self, ...
2
null
Implement the Python class `PushBotView` described below. Class description: View for handling webhook calls from Telegram. Method signatures and docstrings: - def __init__(self, hass, bot, dispatcher, trusted_networks): Initialize by storing stuff needed for setting up our webhook endpoint. - async def post(self, re...
Implement the Python class `PushBotView` described below. Class description: View for handling webhook calls from Telegram. Method signatures and docstrings: - def __init__(self, hass, bot, dispatcher, trusted_networks): Initialize by storing stuff needed for setting up our webhook endpoint. - async def post(self, re...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class PushBotView: """View for handling webhook calls from Telegram.""" def __init__(self, hass, bot, dispatcher, trusted_networks): """Initialize by storing stuff needed for setting up our webhook endpoint.""" <|body_0|> async def post(self, request): """Accept the PO...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PushBotView: """View for handling webhook calls from Telegram.""" def __init__(self, hass, bot, dispatcher, trusted_networks): """Initialize by storing stuff needed for setting up our webhook endpoint.""" self.hass = hass self.bot = bot self.dispatcher = dispatcher ...
the_stack_v2_python_sparse
homeassistant/components/telegram_bot/webhooks.py
home-assistant/core
train
35,501
0d65bdee099cfd21e80c837f14281944ebe55d3c
[ "cords = np.zeros((8, 4))\nextent = bbox.extent\ncords[0, :] = np.array([extent.x, extent.y, -extent.z, 1])\ncords[1, :] = np.array([-extent.x, extent.y, -extent.z, 1])\ncords[2, :] = np.array([-extent.x, -extent.y, -extent.z, 1])\ncords[3, :] = np.array([extent.x, -extent.y, -extent.z, 1])\ncords[4, :] = np.array(...
<|body_start_0|> cords = np.zeros((8, 4)) extent = bbox.extent cords[0, :] = np.array([extent.x, extent.y, -extent.z, 1]) cords[1, :] = np.array([-extent.x, extent.y, -extent.z, 1]) cords[2, :] = np.array([-extent.x, -extent.y, -extent.z, 1]) cords[3, :] = np.array([exten...
utility functions to handle carla bounding boxes
BboxUtils
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BboxUtils: """utility functions to handle carla bounding boxes""" def get_3d_bb_points(bbox): """Returns 3D bounding box""" <|body_0|> def get_2d_bb_points(bbox): """Returns 3D bounding box""" <|body_1|> def get_matrix(transform): """Creates ...
stack_v2_sparse_classes_36k_train_011156
9,169
no_license
[ { "docstring": "Returns 3D bounding box", "name": "get_3d_bb_points", "signature": "def get_3d_bb_points(bbox)" }, { "docstring": "Returns 3D bounding box", "name": "get_2d_bb_points", "signature": "def get_2d_bb_points(bbox)" }, { "docstring": "Creates matrix from carla transfor...
3
stack_v2_sparse_classes_30k_train_001821
Implement the Python class `BboxUtils` described below. Class description: utility functions to handle carla bounding boxes Method signatures and docstrings: - def get_3d_bb_points(bbox): Returns 3D bounding box - def get_2d_bb_points(bbox): Returns 3D bounding box - def get_matrix(transform): Creates matrix from car...
Implement the Python class `BboxUtils` described below. Class description: utility functions to handle carla bounding boxes Method signatures and docstrings: - def get_3d_bb_points(bbox): Returns 3D bounding box - def get_2d_bb_points(bbox): Returns 3D bounding box - def get_matrix(transform): Creates matrix from car...
d0db1c4124751e83ec8b121c8e3a9ccfc9cdf577
<|skeleton|> class BboxUtils: """utility functions to handle carla bounding boxes""" def get_3d_bb_points(bbox): """Returns 3D bounding box""" <|body_0|> def get_2d_bb_points(bbox): """Returns 3D bounding box""" <|body_1|> def get_matrix(transform): """Creates ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BboxUtils: """utility functions to handle carla bounding boxes""" def get_3d_bb_points(bbox): """Returns 3D bounding box""" cords = np.zeros((8, 4)) extent = bbox.extent cords[0, :] = np.array([extent.x, extent.y, -extent.z, 1]) cords[1, :] = np.array([-extent.x, e...
the_stack_v2_python_sparse
mapping/plane_map.py
mengxingshifen1218/Safe_Occlusion_Aware_Planning
train
1
ad3e822a848fb09cb289c5f4a5df3359ac7a962e
[ "if self.request.method == 'GET':\n return (permissions.IsAuthenticated(), IsInActiveCommunity(), IsAbleToRetrieveInvitation())\nelif self.request.method == 'POST':\n return (permissions.IsAuthenticated(),)\nelif self.request.method in ('PUT', 'PATCH'):\n return (permissions.IsAuthenticated(), IsInActiveCo...
<|body_start_0|> if self.request.method == 'GET': return (permissions.IsAuthenticated(), IsInActiveCommunity(), IsAbleToRetrieveInvitation()) elif self.request.method == 'POST': return (permissions.IsAuthenticated(),) elif self.request.method in ('PUT', 'PATCH'): ...
Invitation view set
InvitationViewSet
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InvitationViewSet: """Invitation view set""" def get_permissions(self): """Get permissions""" <|body_0|> def get_serializer_class(self): """Get serializer class""" <|body_1|> def list(self, request, *args, **kwargs): """List invitations""" ...
stack_v2_sparse_classes_36k_train_011157
27,778
permissive
[ { "docstring": "Get permissions", "name": "get_permissions", "signature": "def get_permissions(self)" }, { "docstring": "Get serializer class", "name": "get_serializer_class", "signature": "def get_serializer_class(self)" }, { "docstring": "List invitations", "name": "list", ...
5
stack_v2_sparse_classes_30k_train_008492
Implement the Python class `InvitationViewSet` described below. Class description: Invitation view set Method signatures and docstrings: - def get_permissions(self): Get permissions - def get_serializer_class(self): Get serializer class - def list(self, request, *args, **kwargs): List invitations - def create(self, r...
Implement the Python class `InvitationViewSet` described below. Class description: Invitation view set Method signatures and docstrings: - def get_permissions(self): Get permissions - def get_serializer_class(self): Get serializer class - def list(self, request, *args, **kwargs): List invitations - def create(self, r...
cf429f43251ad7e77c0d9bc9fe91bb030ca8bae8
<|skeleton|> class InvitationViewSet: """Invitation view set""" def get_permissions(self): """Get permissions""" <|body_0|> def get_serializer_class(self): """Get serializer class""" <|body_1|> def list(self, request, *args, **kwargs): """List invitations""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InvitationViewSet: """Invitation view set""" def get_permissions(self): """Get permissions""" if self.request.method == 'GET': return (permissions.IsAuthenticated(), IsInActiveCommunity(), IsAbleToRetrieveInvitation()) elif self.request.method == 'POST': re...
the_stack_v2_python_sparse
membership/views.py
810Teams/clubs-and-events-backend
train
3
323825955fb97ddbf7cdc9664094623166c278d1
[ "try:\n if not await get_data_from_req(self.request).analyses.has_right(analysis_id, self.request['client'], 'read'):\n raise InsufficientRights\nexcept ResourceNotFoundError:\n raise NotFound\nif_modified_since = self.request.headers.get('If-Modified-Since')\nif if_modified_since:\n if_modified_sin...
<|body_start_0|> try: if not await get_data_from_req(self.request).analyses.has_right(analysis_id, self.request['client'], 'read'): raise InsufficientRights except ResourceNotFoundError: raise NotFound if_modified_since = self.request.headers.get('If-Modif...
AnalysisView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AnalysisView: async def get(self, analysis_id: str, /) -> r200[AnalysisResponse] | r400 | r403 | r404: """Get an analysis. Fetches the details of an analysis. Status Codes: 200: Successful operation 304: Not modified 400: Parent sample does not exist 403: Insufficient rights 404: Not fou...
stack_v2_sparse_classes_36k_train_011158
10,876
permissive
[ { "docstring": "Get an analysis. Fetches the details of an analysis. Status Codes: 200: Successful operation 304: Not modified 400: Parent sample does not exist 403: Insufficient rights 404: Not found", "name": "get", "signature": "async def get(self, analysis_id: str, /) -> r200[AnalysisResponse] | r40...
2
null
Implement the Python class `AnalysisView` described below. Class description: Implement the AnalysisView class. Method signatures and docstrings: - async def get(self, analysis_id: str, /) -> r200[AnalysisResponse] | r400 | r403 | r404: Get an analysis. Fetches the details of an analysis. Status Codes: 200: Successfu...
Implement the Python class `AnalysisView` described below. Class description: Implement the AnalysisView class. Method signatures and docstrings: - async def get(self, analysis_id: str, /) -> r200[AnalysisResponse] | r400 | r403 | r404: Get an analysis. Fetches the details of an analysis. Status Codes: 200: Successfu...
1d17d2ba570cf5487e7514bec29250a5b368bb0a
<|skeleton|> class AnalysisView: async def get(self, analysis_id: str, /) -> r200[AnalysisResponse] | r400 | r403 | r404: """Get an analysis. Fetches the details of an analysis. Status Codes: 200: Successful operation 304: Not modified 400: Parent sample does not exist 403: Insufficient rights 404: Not fou...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AnalysisView: async def get(self, analysis_id: str, /) -> r200[AnalysisResponse] | r400 | r403 | r404: """Get an analysis. Fetches the details of an analysis. Status Codes: 200: Successful operation 304: Not modified 400: Parent sample does not exist 403: Insufficient rights 404: Not found""" ...
the_stack_v2_python_sparse
virtool/analyses/api.py
virtool/virtool
train
45
cf754d1216bea6b69655063f4aac0330ba5d10a2
[ "for member in [self.team2_admin, self.team2_member, self.common_member]:\n self.client.force_login(member)\n response = self.client.get(self.list_url)\n self.assertContains(response, 'Ratings for Category %s' % self.team2_category3.name, status_code=200)\n for rating in self.team2_category3.ratings.all...
<|body_start_0|> for member in [self.team2_admin, self.team2_member, self.common_member]: self.client.force_login(member) response = self.client.get(self.list_url) self.assertContains(response, 'Ratings for Category %s' % self.team2_category3.name, status_code=200) ...
Test RatingListView
RatingListViewTest
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RatingListViewTest: """Test RatingListView""" def test_rating_list_member(self): """Assert that all the right ratings are listed for the team admin and regular members""" <|body_0|> def test_rating_list_nonmember(self): """Assert that non-members can not list rat...
stack_v2_sparse_classes_36k_train_011159
3,396
permissive
[ { "docstring": "Assert that all the right ratings are listed for the team admin and regular members", "name": "test_rating_list_member", "signature": "def test_rating_list_member(self)" }, { "docstring": "Assert that non-members can not list ratings", "name": "test_rating_list_nonmember", ...
2
stack_v2_sparse_classes_30k_train_008518
Implement the Python class `RatingListViewTest` described below. Class description: Test RatingListView Method signatures and docstrings: - def test_rating_list_member(self): Assert that all the right ratings are listed for the team admin and regular members - def test_rating_list_nonmember(self): Assert that non-mem...
Implement the Python class `RatingListViewTest` described below. Class description: Test RatingListView Method signatures and docstrings: - def test_rating_list_member(self): Assert that all the right ratings are listed for the team admin and regular members - def test_rating_list_nonmember(self): Assert that non-mem...
b3a61462d46d33de25fb96c029b2bd822001b669
<|skeleton|> class RatingListViewTest: """Test RatingListView""" def test_rating_list_member(self): """Assert that all the right ratings are listed for the team admin and regular members""" <|body_0|> def test_rating_list_nonmember(self): """Assert that non-members can not list rat...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RatingListViewTest: """Test RatingListView""" def test_rating_list_member(self): """Assert that all the right ratings are listed for the team admin and regular members""" for member in [self.team2_admin, self.team2_member, self.common_member]: self.client.force_login(member) ...
the_stack_v2_python_sparse
src/rating/tests.py
tykling/socialrating
train
3
e2a2b656c2cb78b67b27fbd06e8ffede7fcd1dfd
[ "rights = access.Checker(params)\nrights['home'] = ['allow']\nnew_params = {}\nnew_params['rights'] = rights\nnew_params['extra_dynaexclude'] = ['home']\nnew_params['home_template'] = 'soc/presence/home.html'\nnew_params['create_extra_dynaproperties'] = {'clean_link_id': cleaning.clean_link_id('link_id'), 'clean_fe...
<|body_start_0|> rights = access.Checker(params) rights['home'] = ['allow'] new_params = {} new_params['rights'] = rights new_params['extra_dynaexclude'] = ['home'] new_params['home_template'] = 'soc/presence/home.html' new_params['create_extra_dynaproperties'] = ...
View methods for the Presence model.
View
[ "BSD-3-Clause", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class View: """View methods for the Presence model.""" def __init__(self, params): """Defines the fields and methods required for the base View class to provide the user with list, public, create, edit and delete views. Params: params: a dict with params for this View""" <|body_0|>...
stack_v2_sparse_classes_36k_train_011160
6,113
permissive
[ { "docstring": "Defines the fields and methods required for the base View class to provide the user with list, public, create, edit and delete views. Params: params: a dict with params for this View", "name": "__init__", "signature": "def __init__(self, params)" }, { "docstring": "See base.View....
5
null
Implement the Python class `View` described below. Class description: View methods for the Presence model. Method signatures and docstrings: - def __init__(self, params): Defines the fields and methods required for the base View class to provide the user with list, public, create, edit and delete views. Params: param...
Implement the Python class `View` described below. Class description: View methods for the Presence model. Method signatures and docstrings: - def __init__(self, params): Defines the fields and methods required for the base View class to provide the user with list, public, create, edit and delete views. Params: param...
9bd45c168f8ddb5c0e6c04eacdcaeafd61908be7
<|skeleton|> class View: """View methods for the Presence model.""" def __init__(self, params): """Defines the fields and methods required for the base View class to provide the user with list, public, create, edit and delete views. Params: params: a dict with params for this View""" <|body_0|>...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class View: """View methods for the Presence model.""" def __init__(self, params): """Defines the fields and methods required for the base View class to provide the user with list, public, create, edit and delete views. Params: params: a dict with params for this View""" rights = access.Checker...
the_stack_v2_python_sparse
app/soc/views/models/presence.py
pombredanne/Melange-1
train
0
aef4684aa0a78c136e357c62ad0a1623a244d660
[ "with tables(db.engine, 'vcfs') as (con, runs):\n q = select(runs.c).where(runs.c.id == run_id)\n run = dict(_abort_if_none(q.execute().fetchone(), run_id))\nbams.attach_bams_to_vcfs([run])\nreturn run", "with tables(db.engine, 'vcfs') as (con, runs):\n q = runs.update(runs.c.id == run_id).values(**reque...
<|body_start_0|> with tables(db.engine, 'vcfs') as (con, runs): q = select(runs.c).where(runs.c.id == run_id) run = dict(_abort_if_none(q.execute().fetchone(), run_id)) bams.attach_bams_to_vcfs([run]) return run <|end_body_0|> <|body_start_1|> with tables(db.engi...
Run
[ "Apache-2.0", "CC-BY-3.0", "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Run: def get(self, run_id): """Return a vcf with a given ID.""" <|body_0|> def put(self, run_id): """Update the run by its ID.""" <|body_1|> def delete(self, run_id): """Delete a run by its ID.""" <|body_2|> <|end_skeleton|> <|body_star...
stack_v2_sparse_classes_36k_train_011161
7,342
permissive
[ { "docstring": "Return a vcf with a given ID.", "name": "get", "signature": "def get(self, run_id)" }, { "docstring": "Update the run by its ID.", "name": "put", "signature": "def put(self, run_id)" }, { "docstring": "Delete a run by its ID.", "name": "delete", "signature...
3
stack_v2_sparse_classes_30k_test_000517
Implement the Python class `Run` described below. Class description: Implement the Run class. Method signatures and docstrings: - def get(self, run_id): Return a vcf with a given ID. - def put(self, run_id): Update the run by its ID. - def delete(self, run_id): Delete a run by its ID.
Implement the Python class `Run` described below. Class description: Implement the Run class. Method signatures and docstrings: - def get(self, run_id): Return a vcf with a given ID. - def put(self, run_id): Update the run by its ID. - def delete(self, run_id): Delete a run by its ID. <|skeleton|> class Run: de...
a436c4fc212e4429fb5196a9a4d36c37bd050c52
<|skeleton|> class Run: def get(self, run_id): """Return a vcf with a given ID.""" <|body_0|> def put(self, run_id): """Update the run by its ID.""" <|body_1|> def delete(self, run_id): """Delete a run by its ID.""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Run: def get(self, run_id): """Return a vcf with a given ID.""" with tables(db.engine, 'vcfs') as (con, runs): q = select(runs.c).where(runs.c.id == run_id) run = dict(_abort_if_none(q.execute().fetchone(), run_id)) bams.attach_bams_to_vcfs([run]) return...
the_stack_v2_python_sparse
cycledash/api/runs.py
haoziyeung/cycledash
train
0
118b13c4003ef41be67e7cf52bdc626f68c07633
[ "xy = numpy.insert(x, 0, values=y, axis=1)\ndf = pandas.DataFrame.from_records(xy)\ncolumns = ['y']\ncolumns_x = ['x' + str(i) for i in range(x.shape[1])]\ncolumns.extend(columns_x)\ndf.columns = columns\ndf.to_excel(path)", "columns = ['x' + str(i) for i in range(x.shape[1])]\ndf = pandas.DataFrame.from_records(...
<|body_start_0|> xy = numpy.insert(x, 0, values=y, axis=1) df = pandas.DataFrame.from_records(xy) columns = ['y'] columns_x = ['x' + str(i) for i in range(x.shape[1])] columns.extend(columns_x) df.columns = columns df.to_excel(path) <|end_body_0|> <|body_start_1|...
ExcelTool
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExcelTool: def saveXY2Excel(x, y, path='SALP_TRAIN_DATA.xlsx'): """:param self: :param x: :param y: :param path: 输出excel路径 :return:""" <|body_0|> def saveX2Excel(x, path='SALP_PREDICT_DATA.xlsx'): """存储预测数据集 :param x: :param path: :return:""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_011162
1,144
no_license
[ { "docstring": ":param self: :param x: :param y: :param path: 输出excel路径 :return:", "name": "saveXY2Excel", "signature": "def saveXY2Excel(x, y, path='SALP_TRAIN_DATA.xlsx')" }, { "docstring": "存储预测数据集 :param x: :param path: :return:", "name": "saveX2Excel", "signature": "def saveX2Excel(...
3
stack_v2_sparse_classes_30k_train_019941
Implement the Python class `ExcelTool` described below. Class description: Implement the ExcelTool class. Method signatures and docstrings: - def saveXY2Excel(x, y, path='SALP_TRAIN_DATA.xlsx'): :param self: :param x: :param y: :param path: 输出excel路径 :return: - def saveX2Excel(x, path='SALP_PREDICT_DATA.xlsx'): 存储预测数...
Implement the Python class `ExcelTool` described below. Class description: Implement the ExcelTool class. Method signatures and docstrings: - def saveXY2Excel(x, y, path='SALP_TRAIN_DATA.xlsx'): :param self: :param x: :param y: :param path: 输出excel路径 :return: - def saveX2Excel(x, path='SALP_PREDICT_DATA.xlsx'): 存储预测数...
69b740332eaaecac553a4cc74c3e25f2af6889ac
<|skeleton|> class ExcelTool: def saveXY2Excel(x, y, path='SALP_TRAIN_DATA.xlsx'): """:param self: :param x: :param y: :param path: 输出excel路径 :return:""" <|body_0|> def saveX2Excel(x, path='SALP_PREDICT_DATA.xlsx'): """存储预测数据集 :param x: :param path: :return:""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ExcelTool: def saveXY2Excel(x, y, path='SALP_TRAIN_DATA.xlsx'): """:param self: :param x: :param y: :param path: 输出excel路径 :return:""" xy = numpy.insert(x, 0, values=y, axis=1) df = pandas.DataFrame.from_records(xy) columns = ['y'] columns_x = ['x' + str(i) for i in ran...
the_stack_v2_python_sparse
data/excelTools.py
9DemonFox/simpleLearning
train
9
b8b90be5e51c7791e44f73ac4a3aa20ab9adc52f
[ "found = False\nrows, columns = (len(array), len(array[0]))\nif array and rows > 0 and (columns > 0):\n for row in range(rows):\n for column in range(columns):\n if array[row][column] == target:\n found = True\nreturn found", "found = False\nrows = len(array)\ncolumns = len(arr...
<|body_start_0|> found = False rows, columns = (len(array), len(array[0])) if array and rows > 0 and (columns > 0): for row in range(rows): for column in range(columns): if array[row][column] == target: found = True ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def Find(self, target, array): """简单粗暴,二层遍历,时间不是最优""" <|body_0|> def Find2(self, target, array): """从右上角开始判断""" <|body_1|> def Find3(self, target, array): """从左下角开始判断""" <|body_2|> <|end_skeleton|> <|body_start_0|> fou...
stack_v2_sparse_classes_36k_train_011163
2,217
no_license
[ { "docstring": "简单粗暴,二层遍历,时间不是最优", "name": "Find", "signature": "def Find(self, target, array)" }, { "docstring": "从右上角开始判断", "name": "Find2", "signature": "def Find2(self, target, array)" }, { "docstring": "从左下角开始判断", "name": "Find3", "signature": "def Find3(self, target...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def Find(self, target, array): 简单粗暴,二层遍历,时间不是最优 - def Find2(self, target, array): 从右上角开始判断 - def Find3(self, target, array): 从左下角开始判断
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def Find(self, target, array): 简单粗暴,二层遍历,时间不是最优 - def Find2(self, target, array): 从右上角开始判断 - def Find3(self, target, array): 从左下角开始判断 <|skeleton|> class Solution: def Find(...
060e809175cff96e91c694b93417c0c1d21719f0
<|skeleton|> class Solution: def Find(self, target, array): """简单粗暴,二层遍历,时间不是最优""" <|body_0|> def Find2(self, target, array): """从右上角开始判断""" <|body_1|> def Find3(self, target, array): """从左下角开始判断""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def Find(self, target, array): """简单粗暴,二层遍历,时间不是最优""" found = False rows, columns = (len(array), len(array[0])) if array and rows > 0 and (columns > 0): for row in range(rows): for column in range(columns): if array[row]...
the_stack_v2_python_sparse
ProgrammingOJ/CodingInterviewOffer_nowcoder_python/04_FindInPartiallySortedMatrix.py
PandoraLS/CodingInterview
train
2
99f061aa214cc4993a3a1e02c0805a6f6c3bf848
[ "session = Session()\ntry:\n organization = session.query(Organization).get(organization_code)\n if organization is None:\n raise falcon.HTTPNotFound()\n query = session.query(OrganizationITAsset).join(ITAsset).filter(OrganizationITAsset.organization_id == organization_code).order_by(ITAsset.name, O...
<|body_start_0|> session = Session() try: organization = session.query(Organization).get(organization_code) if organization is None: raise falcon.HTTPNotFound() query = session.query(OrganizationITAsset).join(ITAsset).filter(OrganizationITAsset.organiz...
GET and POST IT assets of an organization.
Collection
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Collection: """GET and POST IT assets of an organization.""" def on_get(self, req, resp, organization_code): """GETs a paged collection of IT assets of an organization. :param req: See Falcon Request documentation. :param resp: See Falcon Response documentation. :param organization_c...
stack_v2_sparse_classes_36k_train_011164
9,295
no_license
[ { "docstring": "GETs a paged collection of IT assets of an organization. :param req: See Falcon Request documentation. :param resp: See Falcon Response documentation. :param organization_code: The code of the organization.", "name": "on_get", "signature": "def on_get(self, req, resp, organization_code)"...
2
stack_v2_sparse_classes_30k_train_008032
Implement the Python class `Collection` described below. Class description: GET and POST IT assets of an organization. Method signatures and docstrings: - def on_get(self, req, resp, organization_code): GETs a paged collection of IT assets of an organization. :param req: See Falcon Request documentation. :param resp:...
Implement the Python class `Collection` described below. Class description: GET and POST IT assets of an organization. Method signatures and docstrings: - def on_get(self, req, resp, organization_code): GETs a paged collection of IT assets of an organization. :param req: See Falcon Request documentation. :param resp:...
62723133595829230e5b589431a32cda3b092460
<|skeleton|> class Collection: """GET and POST IT assets of an organization.""" def on_get(self, req, resp, organization_code): """GETs a paged collection of IT assets of an organization. :param req: See Falcon Request documentation. :param resp: See Falcon Response documentation. :param organization_c...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Collection: """GET and POST IT assets of an organization.""" def on_get(self, req, resp, organization_code): """GETs a paged collection of IT assets of an organization. :param req: See Falcon Request documentation. :param resp: See Falcon Response documentation. :param organization_code: The code...
the_stack_v2_python_sparse
knoweak/api/resources/organization_it_asset.py
psvaiter/knoweak-api
train
0
db2c5312beb5bbae00b5c9b4ad44ef4c3c80e458
[ "try:\n return User.objects.get(pk=user_pk)\nexcept User.DoesNotExist:\n raise Http404", "user = self.get_object(pk)\nresponse = UserHeavySerializer(user)\nreturn Response(response.data, status=status.HTTP_200_OK)", "user = self.get_object(pk)\nresponse = self.serializer(user, data=request.data)\nif respo...
<|body_start_0|> try: return User.objects.get(pk=user_pk) except User.DoesNotExist: raise Http404 <|end_body_0|> <|body_start_1|> user = self.get_object(pk) response = UserHeavySerializer(user) return Response(response.data, status=status.HTTP_200_OK) <|e...
...
UserDetailView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserDetailView: """...""" def get_object(user_pk): """hello""" <|body_0|> def get(self, request, pk: Union[int, str], format=None): """...""" <|body_1|> def put(self, request, pk: Union[int, str], format=None): """...""" <|body_2|> ...
stack_v2_sparse_classes_36k_train_011165
4,540
permissive
[ { "docstring": "hello", "name": "get_object", "signature": "def get_object(user_pk)" }, { "docstring": "...", "name": "get", "signature": "def get(self, request, pk: Union[int, str], format=None)" }, { "docstring": "...", "name": "put", "signature": "def put(self, request...
4
stack_v2_sparse_classes_30k_test_001107
Implement the Python class `UserDetailView` described below. Class description: ... Method signatures and docstrings: - def get_object(user_pk): hello - def get(self, request, pk: Union[int, str], format=None): ... - def put(self, request, pk: Union[int, str], format=None): ... - def delete(self, request, pk: Union[i...
Implement the Python class `UserDetailView` described below. Class description: ... Method signatures and docstrings: - def get_object(user_pk): hello - def get(self, request, pk: Union[int, str], format=None): ... - def put(self, request, pk: Union[int, str], format=None): ... - def delete(self, request, pk: Union[i...
9c7f82a3fdaa7a8f2f34062d8803b4f33f8c07b7
<|skeleton|> class UserDetailView: """...""" def get_object(user_pk): """hello""" <|body_0|> def get(self, request, pk: Union[int, str], format=None): """...""" <|body_1|> def put(self, request, pk: Union[int, str], format=None): """...""" <|body_2|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserDetailView: """...""" def get_object(user_pk): """hello""" try: return User.objects.get(pk=user_pk) except User.DoesNotExist: raise Http404 def get(self, request, pk: Union[int, str], format=None): """...""" user = self.get_object(p...
the_stack_v2_python_sparse
apps/user/views/vuser.py
magocod/dj_chat
train
2
a090617359a136aa0503563c73521ad0fb859e10
[ "self.lr = lr\nself.use_target = use_target\nself.target_update_every = target_update_every\nself.print_error = print_error\nself.print_error_every = print_error_every\nself.Q = self._create_net(input_size, action_size, num_layers, num_hidden_per_layer)\nself.QTarget = self._create_net(input_size, action_size, num_...
<|body_start_0|> self.lr = lr self.use_target = use_target self.target_update_every = target_update_every self.print_error = print_error self.print_error_every = print_error_every self.Q = self._create_net(input_size, action_size, num_layers, num_hidden_per_layer) ...
Deep QLearning Agent class for playing with it
DeepQLearningAgent
[ "Unlicense" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeepQLearningAgent: """Deep QLearning Agent class for playing with it""" def __init__(self, input_size: int, action_size: int, num_layers: int=3, num_hidden_per_layer: int=256, epsilon: float=0.01, lr: float=0.01, gamma: float=0.9, use_target: bool=True, target_update_every: int=100, print_e...
stack_v2_sparse_classes_36k_train_011166
6,466
permissive
[ { "docstring": "Initializer of the `DeepQLearningAgent` :param input_size: The input size of the model :param action_size: The action size to choose from :param num_layers: The number of layers of the model :param num_hidden_per_layer: The number of hidden layer per layer for the model :param epsilon: ??? :para...
5
stack_v2_sparse_classes_30k_train_020591
Implement the Python class `DeepQLearningAgent` described below. Class description: Deep QLearning Agent class for playing with it Method signatures and docstrings: - def __init__(self, input_size: int, action_size: int, num_layers: int=3, num_hidden_per_layer: int=256, epsilon: float=0.01, lr: float=0.01, gamma: flo...
Implement the Python class `DeepQLearningAgent` described below. Class description: Deep QLearning Agent class for playing with it Method signatures and docstrings: - def __init__(self, input_size: int, action_size: int, num_layers: int=3, num_hidden_per_layer: int=256, epsilon: float=0.01, lr: float=0.01, gamma: flo...
0b7e73f462b1b95fc0d47534fcebb6c2e7c3b045
<|skeleton|> class DeepQLearningAgent: """Deep QLearning Agent class for playing with it""" def __init__(self, input_size: int, action_size: int, num_layers: int=3, num_hidden_per_layer: int=256, epsilon: float=0.01, lr: float=0.01, gamma: float=0.9, use_target: bool=True, target_update_every: int=100, print_e...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DeepQLearningAgent: """Deep QLearning Agent class for playing with it""" def __init__(self, input_size: int, action_size: int, num_layers: int=3, num_hidden_per_layer: int=256, epsilon: float=0.01, lr: float=0.01, gamma: float=0.9, use_target: bool=True, target_update_every: int=100, print_error: bool=Tr...
the_stack_v2_python_sparse
reinforcement_ecosystem/agents/DeepQLearningAgent.py
fuldev/DL_project_5ibd
train
0
805bfbf43cf1efe8510ae0c42617b37696836059
[ "for clean, _ in self.file_list:\n proc = subprocess.Popen(['../mat-cli', '-d', clean], stdout=subprocess.PIPE)\n stdout, _ = proc.communicate()\n self.assertEqual(stdout.strip('\\n'), '[+] File %s :\\nNo harmful meta found' % clean)", "for _, dirty in self.file_list:\n proc = subprocess.Popen(['../ma...
<|body_start_0|> for clean, _ in self.file_list: proc = subprocess.Popen(['../mat-cli', '-d', clean], stdout=subprocess.PIPE) stdout, _ = proc.communicate() self.assertEqual(stdout.strip('\n'), '[+] File %s :\nNo harmful meta found' % clean) <|end_body_0|> <|body_start_1|> ...
test if cli correctly display metadatas
TestListcli
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestListcli: """test if cli correctly display metadatas""" def test_list_clean(self): """check if get_meta returns meta""" <|body_0|> def test_list_dirty(self): """check if get_meta returns all the expected meta""" <|body_1|> <|end_skeleton|> <|body_sta...
stack_v2_sparse_classes_36k_train_011167
2,739
no_license
[ { "docstring": "check if get_meta returns meta", "name": "test_list_clean", "signature": "def test_list_clean(self)" }, { "docstring": "check if get_meta returns all the expected meta", "name": "test_list_dirty", "signature": "def test_list_dirty(self)" } ]
2
null
Implement the Python class `TestListcli` described below. Class description: test if cli correctly display metadatas Method signatures and docstrings: - def test_list_clean(self): check if get_meta returns meta - def test_list_dirty(self): check if get_meta returns all the expected meta
Implement the Python class `TestListcli` described below. Class description: test if cli correctly display metadatas Method signatures and docstrings: - def test_list_clean(self): check if get_meta returns meta - def test_list_dirty(self): check if get_meta returns all the expected meta <|skeleton|> class TestListcl...
e67b23fc4eb3e50b722a28336f93163946912bac
<|skeleton|> class TestListcli: """test if cli correctly display metadatas""" def test_list_clean(self): """check if get_meta returns meta""" <|body_0|> def test_list_dirty(self): """check if get_meta returns all the expected meta""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestListcli: """test if cli correctly display metadatas""" def test_list_clean(self): """check if get_meta returns meta""" for clean, _ in self.file_list: proc = subprocess.Popen(['../mat-cli', '-d', clean], stdout=subprocess.PIPE) stdout, _ = proc.communicate() ...
the_stack_v2_python_sparse
data/python/46.py
devsagul/HanabiHack
train
0
e1e0734dd753998d9eedd57d9bc36bb566ebaf94
[ "if not head:\n return []\nhead = self.reverseLinkedList(head)\nlst = []\nwhile head:\n lst.append(head.val)\n head = head.next\nreturn lst", "if not head or not head.next:\n return head\npre = None\nwhile head:\n current = head\n head = head.next\n current.next = pre\n pre = current\nretu...
<|body_start_0|> if not head: return [] head = self.reverseLinkedList(head) lst = [] while head: lst.append(head.val) head = head.next return lst <|end_body_0|> <|body_start_1|> if not head or not head.next: return head ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reversePrint(self, head): """:type head: ListNode :rtype: List[int]""" <|body_0|> def reverseLinkedList(self, head): """:param head: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not head: return [] he...
stack_v2_sparse_classes_36k_train_011168
1,036
no_license
[ { "docstring": ":type head: ListNode :rtype: List[int]", "name": "reversePrint", "signature": "def reversePrint(self, head)" }, { "docstring": ":param head: :return:", "name": "reverseLinkedList", "signature": "def reverseLinkedList(self, head)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reversePrint(self, head): :type head: ListNode :rtype: List[int] - def reverseLinkedList(self, head): :param head: :return:
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reversePrint(self, head): :type head: ListNode :rtype: List[int] - def reverseLinkedList(self, head): :param head: :return: <|skeleton|> class Solution: def reversePrin...
a75310a96d2b165b15d5ee10ec409a17cdc880ba
<|skeleton|> class Solution: def reversePrint(self, head): """:type head: ListNode :rtype: List[int]""" <|body_0|> def reverseLinkedList(self, head): """:param head: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def reversePrint(self, head): """:type head: ListNode :rtype: List[int]""" if not head: return [] head = self.reverseLinkedList(head) lst = [] while head: lst.append(head.val) head = head.next return lst def rev...
the_stack_v2_python_sparse
leetcode/offer/code/6.py
skyxyz-lang/CS_Note
train
0
17d6169090f2bcd7b73f08bb21894e3c940a14ee
[ "nodes_gpu = max(1, int(ceil(ngpus / cls.gpus_per_node)))\nnodes_cpu = max(1, int(ceil(ncpus / cls.cores_per_node)))\nif nodes_gpu >= nodes_cpu:\n check_utilization(nodes_gpu, ngpus, cls.gpus_per_node, threshold, 'compute')\n return nodes_gpu\ncheck_utilization(nodes_cpu, ncpus, cls.cores_per_node, threshold,...
<|body_start_0|> nodes_gpu = max(1, int(ceil(ngpus / cls.gpus_per_node))) nodes_cpu = max(1, int(ceil(ncpus / cls.cores_per_node))) if nodes_gpu >= nodes_cpu: check_utilization(nodes_gpu, ngpus, cls.gpus_per_node, threshold, 'compute') return nodes_gpu check_utili...
Environment profile for the Cluster supercomputer. https://docs.olcf.ornl.gov/systems/crusher_quick_start_guide.html
CrusherEnvironment
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CrusherEnvironment: """Environment profile for the Cluster supercomputer. https://docs.olcf.ornl.gov/systems/crusher_quick_start_guide.html""" def calc_num_nodes(cls, ngpus, ncpus, threshold): """Compute the number of nodes needed to meet the resource request. Also raise an error whe...
stack_v2_sparse_classes_36k_train_011169
10,994
permissive
[ { "docstring": "Compute the number of nodes needed to meet the resource request. Also raise an error when the requested resource do not come close to saturating the asked for nodes.", "name": "calc_num_nodes", "signature": "def calc_num_nodes(cls, ngpus, ncpus, threshold)" }, { "docstring": "Get...
2
stack_v2_sparse_classes_30k_train_020427
Implement the Python class `CrusherEnvironment` described below. Class description: Environment profile for the Cluster supercomputer. https://docs.olcf.ornl.gov/systems/crusher_quick_start_guide.html Method signatures and docstrings: - def calc_num_nodes(cls, ngpus, ncpus, threshold): Compute the number of nodes nee...
Implement the Python class `CrusherEnvironment` described below. Class description: Environment profile for the Cluster supercomputer. https://docs.olcf.ornl.gov/systems/crusher_quick_start_guide.html Method signatures and docstrings: - def calc_num_nodes(cls, ngpus, ncpus, threshold): Compute the number of nodes nee...
845865c5f34135243ac21800495c46c915662c64
<|skeleton|> class CrusherEnvironment: """Environment profile for the Cluster supercomputer. https://docs.olcf.ornl.gov/systems/crusher_quick_start_guide.html""" def calc_num_nodes(cls, ngpus, ncpus, threshold): """Compute the number of nodes needed to meet the resource request. Also raise an error whe...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CrusherEnvironment: """Environment profile for the Cluster supercomputer. https://docs.olcf.ornl.gov/systems/crusher_quick_start_guide.html""" def calc_num_nodes(cls, ngpus, ncpus, threshold): """Compute the number of nodes needed to meet the resource request. Also raise an error when the request...
the_stack_v2_python_sparse
flow/environments/incite.py
glotzerlab/signac-flow
train
54
14c4bc9375274d83f0d9cdd9799505ba24934674
[ "assert isinstance(output_size, (int, tuple))\nassert isinstance(return_tensor, bool)\nassert isinstance(channel_first, bool)\nself.output_size = output_size\nself.return_tensor = return_tensor\nself.channel_first = channel_first\nself.rescale_transform = BatchResize(output_size=self.output_size, return_tensor=self...
<|body_start_0|> assert isinstance(output_size, (int, tuple)) assert isinstance(return_tensor, bool) assert isinstance(channel_first, bool) self.output_size = output_size self.return_tensor = return_tensor self.channel_first = channel_first self.rescale_transform ...
Resizes and normalizes the color channels, for a collection of images, to have zero mean and unit standard deviation.
BatchResizeNormalize
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BatchResizeNormalize: """Resizes and normalizes the color channels, for a collection of images, to have zero mean and unit standard deviation.""" def __init__(self, output_size, return_tensor=True, channel_first=True): """Instantiates a new BatchResizeNormalize object. Parameters ---...
stack_v2_sparse_classes_36k_train_011170
14,169
no_license
[ { "docstring": "Instantiates a new BatchResizeNormalize object. Parameters ---------- output_size : int or tuple The output size of the image (height and width). If an integer is passed as input, then the output size of the image is determined by scaling the height and width of the original image. return_tensor...
2
stack_v2_sparse_classes_30k_train_011953
Implement the Python class `BatchResizeNormalize` described below. Class description: Resizes and normalizes the color channels, for a collection of images, to have zero mean and unit standard deviation. Method signatures and docstrings: - def __init__(self, output_size, return_tensor=True, channel_first=True): Insta...
Implement the Python class `BatchResizeNormalize` described below. Class description: Resizes and normalizes the color channels, for a collection of images, to have zero mean and unit standard deviation. Method signatures and docstrings: - def __init__(self, output_size, return_tensor=True, channel_first=True): Insta...
a7c30481822ecb945e3ff6ad184d104361a40ed1
<|skeleton|> class BatchResizeNormalize: """Resizes and normalizes the color channels, for a collection of images, to have zero mean and unit standard deviation.""" def __init__(self, output_size, return_tensor=True, channel_first=True): """Instantiates a new BatchResizeNormalize object. Parameters ---...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BatchResizeNormalize: """Resizes and normalizes the color channels, for a collection of images, to have zero mean and unit standard deviation.""" def __init__(self, output_size, return_tensor=True, channel_first=True): """Instantiates a new BatchResizeNormalize object. Parameters ---------- outpu...
the_stack_v2_python_sparse
cheapfake/contrib/transforms.py
hu-simon/cheapfake
train
0
2fe0e8334b63126b2babb56f528f4b2233c8d4ad
[ "raw_value = read_value_from_path(value)\nargs: Dict[str, str] = {}\nif '@' in raw_value:\n args['region'], raw_value = raw_value.split('@', 1)\nmatches = re.findall('([0-9a-zA-z_-]+:[^\\\\s$]+)', raw_value)\nfor match in matches:\n k, v = match.split(':', 1)\n args[k] = v\nreturn (args.pop('name_regex'), ...
<|body_start_0|> raw_value = read_value_from_path(value) args: Dict[str, str] = {} if '@' in raw_value: args['region'], raw_value = raw_value.split('@', 1) matches = re.findall('([0-9a-zA-z_-]+:[^\\s$]+)', raw_value) for match in matches: k, v = match.spli...
AMI lookup.
AmiLookup
[ "BSD-2-Clause", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AmiLookup: """AMI lookup.""" def parse(cls, value: str) -> Tuple[str, Dict[str, str]]: """Parse the value passed to the lookup. This overrides the default parsing to account for special requirements. Args: value: The raw value passed to a lookup. Returns: The lookup query and a dict ...
stack_v2_sparse_classes_36k_train_011171
4,479
permissive
[ { "docstring": "Parse the value passed to the lookup. This overrides the default parsing to account for special requirements. Args: value: The raw value passed to a lookup. Returns: The lookup query and a dict of arguments", "name": "parse", "signature": "def parse(cls, value: str) -> Tuple[str, Dict[st...
2
stack_v2_sparse_classes_30k_train_018359
Implement the Python class `AmiLookup` described below. Class description: AMI lookup. Method signatures and docstrings: - def parse(cls, value: str) -> Tuple[str, Dict[str, str]]: Parse the value passed to the lookup. This overrides the default parsing to account for special requirements. Args: value: The raw value ...
Implement the Python class `AmiLookup` described below. Class description: AMI lookup. Method signatures and docstrings: - def parse(cls, value: str) -> Tuple[str, Dict[str, str]]: Parse the value passed to the lookup. This overrides the default parsing to account for special requirements. Args: value: The raw value ...
0763b06aee07d2cf3f037a49ca0cb81a048c5deb
<|skeleton|> class AmiLookup: """AMI lookup.""" def parse(cls, value: str) -> Tuple[str, Dict[str, str]]: """Parse the value passed to the lookup. This overrides the default parsing to account for special requirements. Args: value: The raw value passed to a lookup. Returns: The lookup query and a dict ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AmiLookup: """AMI lookup.""" def parse(cls, value: str) -> Tuple[str, Dict[str, str]]: """Parse the value passed to the lookup. This overrides the default parsing to account for special requirements. Args: value: The raw value passed to a lookup. Returns: The lookup query and a dict of arguments"...
the_stack_v2_python_sparse
runway/cfngin/lookups/handlers/ami.py
onicagroup/runway
train
156
84ebbd65944f2b754ddeb282dce41adfe8035703
[ "found_dna = set()\nrtn_dna = set()\ntmp = s[0:10]\nfound_dna.add(tmp)\nfor i in range(10, len(s)):\n tmp = tmp[1:] + s[i]\n if tmp in found_dna:\n rtn_dna.add(tmp)\n else:\n found_dna.add(tmp)\nreturn list(rtn_dna)", "if s == None or len(s) < 10:\n return []\ntmp = 0\nbase_num = 3\nfor ...
<|body_start_0|> found_dna = set() rtn_dna = set() tmp = s[0:10] found_dna.add(tmp) for i in range(10, len(s)): tmp = tmp[1:] + s[i] if tmp in found_dna: rtn_dna.add(tmp) else: found_dna.add(tmp) return l...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findRepeatedDnaSequencesOld(self, s): """:type s: str :rtype: List[str]""" <|body_0|> def findRepeatedDnaSequences(self, s): """:type s: str :rtype: List[str]""" <|body_1|> <|end_skeleton|> <|body_start_0|> found_dna = set() rt...
stack_v2_sparse_classes_36k_train_011172
1,661
no_license
[ { "docstring": ":type s: str :rtype: List[str]", "name": "findRepeatedDnaSequencesOld", "signature": "def findRepeatedDnaSequencesOld(self, s)" }, { "docstring": ":type s: str :rtype: List[str]", "name": "findRepeatedDnaSequences", "signature": "def findRepeatedDnaSequences(self, s)" }...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findRepeatedDnaSequencesOld(self, s): :type s: str :rtype: List[str] - def findRepeatedDnaSequences(self, s): :type s: str :rtype: List[str]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findRepeatedDnaSequencesOld(self, s): :type s: str :rtype: List[str] - def findRepeatedDnaSequences(self, s): :type s: str :rtype: List[str] <|skeleton|> class Solution: ...
196e58cd38db846653fb074cfd0363997121a7cf
<|skeleton|> class Solution: def findRepeatedDnaSequencesOld(self, s): """:type s: str :rtype: List[str]""" <|body_0|> def findRepeatedDnaSequences(self, s): """:type s: str :rtype: List[str]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findRepeatedDnaSequencesOld(self, s): """:type s: str :rtype: List[str]""" found_dna = set() rtn_dna = set() tmp = s[0:10] found_dna.add(tmp) for i in range(10, len(s)): tmp = tmp[1:] + s[i] if tmp in found_dna: ...
the_stack_v2_python_sparse
Repeated DNA Sequences.py
nithinveer/leetcode-solutions
train
0
b95b07a6a7f342f8e5be17d0c8cebdfdeee59ba3
[ "self.lonpole = lonpole\nlatpoler = latpole * dtor\nself.coslatpole = math.cos(latpoler)\nself.sinlatpole = math.sin(latpoler)\nif nPoleGridLon is None:\n self.polerotate = polerotate\nelse:\n self.polerotate = lonpole - nPoleGridLon + 180.0\nself.lonMin = lonMin\nself.lonMax = lonMin + 360.0", "lonpole = s...
<|body_start_0|> self.lonpole = lonpole latpoler = latpole * dtor self.coslatpole = math.cos(latpoler) self.sinlatpole = math.sin(latpoler) if nPoleGridLon is None: self.polerotate = polerotate else: self.polerotate = lonpole - nPoleGridLon + 180.0...
Rotated grid class. For more info, see doc strings for '__init__' and 'transform' methods.
Rotgrid
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Rotgrid: """Rotated grid class. For more info, see doc strings for '__init__' and 'transform' methods.""" def __init__(self, lonpole, latpole, polerotate=0, nPoleGridLon=None, lonMin=-180.0): """Set up rotated grid for transformations. Inputs: lonpole, latpole: longitude (degrees) an...
stack_v2_sparse_classes_36k_train_011173
6,762
no_license
[ { "docstring": "Set up rotated grid for transformations. Inputs: lonpole, latpole: longitude (degrees) and latitude (degrees) of the pole of the rotated grid, as seen in the non-rotated grid polerotate: optional input -- by default, the calculation assumes that the rotated grid is singly rotated, i.e. that the ...
2
null
Implement the Python class `Rotgrid` described below. Class description: Rotated grid class. For more info, see doc strings for '__init__' and 'transform' methods. Method signatures and docstrings: - def __init__(self, lonpole, latpole, polerotate=0, nPoleGridLon=None, lonMin=-180.0): Set up rotated grid for transfor...
Implement the Python class `Rotgrid` described below. Class description: Rotated grid class. For more info, see doc strings for '__init__' and 'transform' methods. Method signatures and docstrings: - def __init__(self, lonpole, latpole, polerotate=0, nPoleGridLon=None, lonMin=-180.0): Set up rotated grid for transfor...
790ad1aa7e7a8c6593a21ee53b2c946b2f7a356b
<|skeleton|> class Rotgrid: """Rotated grid class. For more info, see doc strings for '__init__' and 'transform' methods.""" def __init__(self, lonpole, latpole, polerotate=0, nPoleGridLon=None, lonMin=-180.0): """Set up rotated grid for transformations. Inputs: lonpole, latpole: longitude (degrees) an...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Rotgrid: """Rotated grid class. For more info, see doc strings for '__init__' and 'transform' methods.""" def __init__(self, lonpole, latpole, polerotate=0, nPoleGridLon=None, lonMin=-180.0): """Set up rotated grid for transformations. Inputs: lonpole, latpole: longitude (degrees) and latitude (d...
the_stack_v2_python_sparse
utils/u_rotgrid.py
cornkle/proj_CEH
train
2
aed51c9f1c5ad2be2cac83529724a579f0a641b1
[ "super(Bass, self).__init__(classes=classes)\nassert out_channels_in_block1 % nb == 0, 'Number of output channels for the first block must be divisible by the number of convolutional blocks.'\nself.dtype = self.__class__.check_dtype(dtype=dtype)\nself._nb = nb\nself._batch_size = batch_size\nself._block2 = torch.nn...
<|body_start_0|> super(Bass, self).__init__(classes=classes) assert out_channels_in_block1 % nb == 0, 'Number of output channels for the first block must be divisible by the number of convolutional blocks.' self.dtype = self.__class__.check_dtype(dtype=dtype) self._nb = nb self._...
Bass
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Bass: def __init__(self, classes: int, nb: int, in_channels_in_block1: int, out_channels_in_block1: int, neighborhood_size: int, batch_size: int, dtype: str, lr=0.0005): """BASS model. (Configuration 4). Cost function: CrossEntropyLoss. Optimizer: Adam, (lr=0.0005). :param classes: Numbe...
stack_v2_sparse_classes_36k_train_011174
3,883
permissive
[ { "docstring": "BASS model. (Configuration 4). Cost function: CrossEntropyLoss. Optimizer: Adam, (lr=0.0005). :param classes: Number of classes. :param nb: Number of convolutional blocks. :param in_channels_in_block1: Number of input channels for first block of the network. :param out_channels_in_block1: Number...
2
null
Implement the Python class `Bass` described below. Class description: Implement the Bass class. Method signatures and docstrings: - def __init__(self, classes: int, nb: int, in_channels_in_block1: int, out_channels_in_block1: int, neighborhood_size: int, batch_size: int, dtype: str, lr=0.0005): BASS model. (Configura...
Implement the Python class `Bass` described below. Class description: Implement the Bass class. Method signatures and docstrings: - def __init__(self, classes: int, nb: int, in_channels_in_block1: int, out_channels_in_block1: int, neighborhood_size: int, batch_size: int, dtype: str, lr=0.0005): BASS model. (Configura...
b33f7893d3dfcbbc2c10076fb61b2b1f1316402a
<|skeleton|> class Bass: def __init__(self, classes: int, nb: int, in_channels_in_block1: int, out_channels_in_block1: int, neighborhood_size: int, batch_size: int, dtype: str, lr=0.0005): """BASS model. (Configuration 4). Cost function: CrossEntropyLoss. Optimizer: Adam, (lr=0.0005). :param classes: Numbe...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Bass: def __init__(self, classes: int, nb: int, in_channels_in_block1: int, out_channels_in_block1: int, neighborhood_size: int, batch_size: int, dtype: str, lr=0.0005): """BASS model. (Configuration 4). Cost function: CrossEntropyLoss. Optimizer: Adam, (lr=0.0005). :param classes: Number of classes. ...
the_stack_v2_python_sparse
python_research/experiments/sota_models/bass/bass.py
ESA-PhiLab/hypernet
train
44
69fa6a58db728757d94cfa402293a227b838258b
[ "if not grid:\n return 0\ntotal = 0\nr_size = len(grid)\nc_size = len(grid[0])\nr_limit = [0] * r_size\nc_limit = [0] * c_size\nfor r in range(r_size):\n for c in range(c_size):\n height = grid[r][c]\n r_limit[r] = max(r_limit[r], height)\n c_limit[c] = max(c_limit[c], height)\nfor r in r...
<|body_start_0|> if not grid: return 0 total = 0 r_size = len(grid) c_size = len(grid[0]) r_limit = [0] * r_size c_limit = [0] * c_size for r in range(r_size): for c in range(c_size): height = grid[r][c] r_li...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxIncreaseKeepingSkyline(self, grid): """More readable version. Find the tallest building height for each row and column, then increase the heights of other buildings to those limits. Time: O(n^2) Space: O(n) :type grid: List[List[int]] :rtype: int""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_011175
1,397
no_license
[ { "docstring": "More readable version. Find the tallest building height for each row and column, then increase the heights of other buildings to those limits. Time: O(n^2) Space: O(n) :type grid: List[List[int]] :rtype: int", "name": "maxIncreaseKeepingSkyline", "signature": "def maxIncreaseKeepingSkyli...
2
stack_v2_sparse_classes_30k_train_004874
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxIncreaseKeepingSkyline(self, grid): More readable version. Find the tallest building height for each row and column, then increase the heights of other buildings to those ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxIncreaseKeepingSkyline(self, grid): More readable version. Find the tallest building height for each row and column, then increase the heights of other buildings to those ...
c14d8829c95f61ff6691816e8c0de76b9319f389
<|skeleton|> class Solution: def maxIncreaseKeepingSkyline(self, grid): """More readable version. Find the tallest building height for each row and column, then increase the heights of other buildings to those limits. Time: O(n^2) Space: O(n) :type grid: List[List[int]] :rtype: int""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxIncreaseKeepingSkyline(self, grid): """More readable version. Find the tallest building height for each row and column, then increase the heights of other buildings to those limits. Time: O(n^2) Space: O(n) :type grid: List[List[int]] :rtype: int""" if not grid: re...
the_stack_v2_python_sparse
medium/max-increase-to-keep-city-skyline/solution.py
hsuanhauliu/leetcode-solutions
train
0
570063b5fe19abc96070a1826721ae87c626059c
[ "super().__init__()\nnout_new = nout - nin\nself.eesp = EESP(nin, nout_new, stride=2, k=k, r_lim=r_lim, down_method='avg')\nself.avg = nn.AvgPool2d(kernel_size=3, padding=1, stride=2)\nif reinf:\n self.inp_reinf = nn.Sequential(CBR(config_inp_reinf, config_inp_reinf, 3, 1), CB(config_inp_reinf, nout, 1, 1))\nsel...
<|body_start_0|> super().__init__() nout_new = nout - nin self.eesp = EESP(nin, nout_new, stride=2, k=k, r_lim=r_lim, down_method='avg') self.avg = nn.AvgPool2d(kernel_size=3, padding=1, stride=2) if reinf: self.inp_reinf = nn.Sequential(CBR(config_inp_reinf, config_i...
Down-sampling fucntion that has two parallel branches: (1) avg pooling and (2) EESP block with stride of 2. The output feature maps of these branches are then concatenated and thresholded using an activation function (PReLU in our case) to produce the final output.
DownSampler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DownSampler: """Down-sampling fucntion that has two parallel branches: (1) avg pooling and (2) EESP block with stride of 2. The output feature maps of these branches are then concatenated and thresholded using an activation function (PReLU in our case) to produce the final output.""" def __i...
stack_v2_sparse_classes_36k_train_011176
12,060
permissive
[ { "docstring": ":param nin: number of input channels :param nout: number of output channels :param k: # of parallel branches :param r_lim: A maximum value of receptive field allowed for EESP block :param g: number of groups to be used in the feature map reduction step.", "name": "__init__", "signature":...
2
null
Implement the Python class `DownSampler` described below. Class description: Down-sampling fucntion that has two parallel branches: (1) avg pooling and (2) EESP block with stride of 2. The output feature maps of these branches are then concatenated and thresholded using an activation function (PReLU in our case) to pr...
Implement the Python class `DownSampler` described below. Class description: Down-sampling fucntion that has two parallel branches: (1) avg pooling and (2) EESP block with stride of 2. The output feature maps of these branches are then concatenated and thresholded using an activation function (PReLU in our case) to pr...
0721cbbb278af027409ed4c115ccc743b6daed1b
<|skeleton|> class DownSampler: """Down-sampling fucntion that has two parallel branches: (1) avg pooling and (2) EESP block with stride of 2. The output feature maps of these branches are then concatenated and thresholded using an activation function (PReLU in our case) to produce the final output.""" def __i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DownSampler: """Down-sampling fucntion that has two parallel branches: (1) avg pooling and (2) EESP block with stride of 2. The output feature maps of these branches are then concatenated and thresholded using an activation function (PReLU in our case) to produce the final output.""" def __init__(self, n...
the_stack_v2_python_sparse
deepclustering/arch/segmentation/epsnetv2/Model.py
jizongFox/deep-clustering-toolbox
train
37
3f6b63bc362bd06e0292996757533b79a1716961
[ "for proj in conf.get('appengine.projects', []):\n if fnmatch(branch_name, proj['branch']):\n proj = dict(proj)\n proj.pop('branch')\n proj['deployables'] = list(frozenset(itertools.chain(conf.get('appengine.deployables', []), proj.get('deployables', []))))\n return cls(**proj)\nretur...
<|body_start_0|> for proj in conf.get('appengine.projects', []): if fnmatch(branch_name, proj['branch']): proj = dict(proj) proj.pop('branch') proj['deployables'] = list(frozenset(itertools.chain(conf.get('appengine.deployables', []), proj.get('deploya...
Represents an AppEngine app. Attributes: app_id (str): AppEngine project ID. version (str): AppEngine project version. deployables (list[str]): List of YAML files to deploy. Defaults to all yaml files in the project root directory.
GaeApp
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GaeApp: """Represents an AppEngine app. Attributes: app_id (str): AppEngine project ID. version (str): AppEngine project version. deployables (list[str]): List of YAML files to deploy. Defaults to all yaml files in the project root directory.""" def for_branch(cls, branch_name: str) -> Optio...
stack_v2_sparse_classes_36k_train_011177
7,507
permissive
[ { "docstring": "Return app configuration for the given branch. This will look for the configuration in the ``appengine.projects`` config variable. Args: branch_name (str): The name of the branch we want the configuration for. Returns: Optional[GaeApp]: The `GaeApp` instance with the configuration for the projec...
3
stack_v2_sparse_classes_30k_train_021301
Implement the Python class `GaeApp` described below. Class description: Represents an AppEngine app. Attributes: app_id (str): AppEngine project ID. version (str): AppEngine project version. deployables (list[str]): List of YAML files to deploy. Defaults to all yaml files in the project root directory. Method signatu...
Implement the Python class `GaeApp` described below. Class description: Represents an AppEngine app. Attributes: app_id (str): AppEngine project ID. version (str): AppEngine project version. deployables (list[str]): List of YAML files to deploy. Defaults to all yaml files in the project root directory. Method signatu...
3b4242ace18e73eb0298b4a7a677425f5eac6a68
<|skeleton|> class GaeApp: """Represents an AppEngine app. Attributes: app_id (str): AppEngine project ID. version (str): AppEngine project version. deployables (list[str]): List of YAML files to deploy. Defaults to all yaml files in the project root directory.""" def for_branch(cls, branch_name: str) -> Optio...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GaeApp: """Represents an AppEngine app. Attributes: app_id (str): AppEngine project ID. version (str): AppEngine project version. deployables (list[str]): List of YAML files to deploy. Defaults to all yaml files in the project root directory.""" def for_branch(cls, branch_name: str) -> Optional['GaeApp']...
the_stack_v2_python_sparse
plugins/_old/peltak_appengine/logic.py
novopl/peltak
train
7
516fd9315e65bf427e2f9826f8d43297d388fb22
[ "self.config = Configuration.from_filepath()\nif name is None or name not in self.config.get_values_strategy():\n raise Exception(\"La Strategie {NOM} n'existe pas\".format(NOM=name))\nself.name = name", "if self.name.strip() == 'DEV':\n return StrategieDev()\nelse:\n raise ValueError('Strategie non-pris...
<|body_start_0|> self.config = Configuration.from_filepath() if name is None or name not in self.config.get_values_strategy(): raise Exception("La Strategie {NOM} n'existe pas".format(NOM=name)) self.name = name <|end_body_0|> <|body_start_1|> if self.name.strip() == 'DEV': ...
Classe permttant d'initialiser les Strategies
StgyFactory
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StgyFactory: """Classe permttant d'initialiser les Strategies""" def __init__(self, name=None): """Initialisation Objet""" <|body_0|> def make(self): """Créez et renvoyez une instance de la classe Strategy telle que configurée dans le fichier de configuration""" ...
stack_v2_sparse_classes_36k_train_011178
1,138
permissive
[ { "docstring": "Initialisation Objet", "name": "__init__", "signature": "def __init__(self, name=None)" }, { "docstring": "Créez et renvoyez une instance de la classe Strategy telle que configurée dans le fichier de configuration", "name": "make", "signature": "def make(self)" } ]
2
stack_v2_sparse_classes_30k_train_004537
Implement the Python class `StgyFactory` described below. Class description: Classe permttant d'initialiser les Strategies Method signatures and docstrings: - def __init__(self, name=None): Initialisation Objet - def make(self): Créez et renvoyez une instance de la classe Strategy telle que configurée dans le fichier...
Implement the Python class `StgyFactory` described below. Class description: Classe permttant d'initialiser les Strategies Method signatures and docstrings: - def __init__(self, name=None): Initialisation Objet - def make(self): Créez et renvoyez une instance de la classe Strategy telle que configurée dans le fichier...
fa0af604752d7a3905f988b9164eb24c0d2cc8d2
<|skeleton|> class StgyFactory: """Classe permttant d'initialiser les Strategies""" def __init__(self, name=None): """Initialisation Objet""" <|body_0|> def make(self): """Créez et renvoyez une instance de la classe Strategy telle que configurée dans le fichier de configuration""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StgyFactory: """Classe permttant d'initialiser les Strategies""" def __init__(self, name=None): """Initialisation Objet""" self.config = Configuration.from_filepath() if name is None or name not in self.config.get_values_strategy(): raise Exception("La Strategie {NOM} ...
the_stack_v2_python_sparse
src/lib/strategie/factory.py
Ileouleyuki/MyTradingBot
train
0
f76383172df6a097b474bbc0ba83fbe7101dbc45
[ "for flow, args in [('ListDirectory', {'pathspec': rdfvalue.PathSpec(pathtype=rdfvalue.PathSpec.PathType.REGISTRY, path=self.reg_path)}), ('FindFiles', {'findspec': rdfvalue.FindSpec(pathspec=rdfvalue.PathSpec(path=self.reg_path, pathtype=rdfvalue.PathSpec.PathType.REGISTRY), path_regex='ProfileImagePath'), 'output...
<|body_start_0|> for flow, args in [('ListDirectory', {'pathspec': rdfvalue.PathSpec(pathtype=rdfvalue.PathSpec.PathType.REGISTRY, path=self.reg_path)}), ('FindFiles', {'findspec': rdfvalue.FindSpec(pathspec=rdfvalue.PathSpec(path=self.reg_path, pathtype=rdfvalue.PathSpec.PathType.REGISTRY), path_regex='Profile...
Test that user listing from the registry works. We basically list the registry and then run Find on the same place, we expect a single ProfileImagePath value for each user. TODO(user): this is excluded from automated tests for now because it needs to run two flows and defines its own runTest to do so. We should support...
TestFindWindowsRegistry
[ "Apache-2.0", "DOC" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestFindWindowsRegistry: """Test that user listing from the registry works. We basically list the registry and then run Find on the same place, we expect a single ProfileImagePath value for each user. TODO(user): this is excluded from automated tests for now because it needs to run two flows and ...
stack_v2_sparse_classes_36k_train_011179
3,412
permissive
[ { "docstring": "Launch our flows.", "name": "runTest", "signature": "def runTest(self)" }, { "docstring": "Check that all profiles listed have an ProfileImagePath.", "name": "CheckFlow", "signature": "def CheckFlow(self)" } ]
2
null
Implement the Python class `TestFindWindowsRegistry` described below. Class description: Test that user listing from the registry works. We basically list the registry and then run Find on the same place, we expect a single ProfileImagePath value for each user. TODO(user): this is excluded from automated tests for now...
Implement the Python class `TestFindWindowsRegistry` described below. Class description: Test that user listing from the registry works. We basically list the registry and then run Find on the same place, we expect a single ProfileImagePath value for each user. TODO(user): this is excluded from automated tests for now...
ba1648b97a76f844ffb8e1891cc9e2680f9b1c6e
<|skeleton|> class TestFindWindowsRegistry: """Test that user listing from the registry works. We basically list the registry and then run Find on the same place, we expect a single ProfileImagePath value for each user. TODO(user): this is excluded from automated tests for now because it needs to run two flows and ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestFindWindowsRegistry: """Test that user listing from the registry works. We basically list the registry and then run Find on the same place, we expect a single ProfileImagePath value for each user. TODO(user): this is excluded from automated tests for now because it needs to run two flows and defines its o...
the_stack_v2_python_sparse
endtoend_tests/registry.py
defaultnamehere/grr
train
3
dfdfa68417d9f47f51319862aca75b714a3ad0cf
[ "self._use_layer_norm_att = use_layer_norm_att\nself._use_layer_norm_ffn = use_layer_norm_ffn\nself._use_spec_norm_att = use_spec_norm_att\nself._use_spec_norm_ffn = use_spec_norm_ffn\nself._spec_norm_kwargs = spec_norm_kwargs\nfeedforward_cls = functools.partial(SpectralNormalizedFeedforwardLayer, use_layer_norm=s...
<|body_start_0|> self._use_layer_norm_att = use_layer_norm_att self._use_layer_norm_ffn = use_layer_norm_ffn self._use_spec_norm_att = use_spec_norm_att self._use_spec_norm_ffn = use_spec_norm_ffn self._spec_norm_kwargs = spec_norm_kwargs feedforward_cls = functools.parti...
Transformer layer with spectral-normalized dense layers.
SpectralNormalizedTransformer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SpectralNormalizedTransformer: """Transformer layer with spectral-normalized dense layers.""" def __init__(self, use_layer_norm_att: bool=True, use_layer_norm_ffn: bool=True, use_spec_norm_att: bool=False, use_spec_norm_ffn: bool=False, spec_norm_kwargs: Optional[Mapping[str, Any]]=None, **k...
stack_v2_sparse_classes_36k_train_011180
24,406
permissive
[ { "docstring": "Initializer. Args: use_layer_norm_att: Whether to use layer normalization in the attention layer. use_layer_norm_ffn: Whether to use layer normalization in the feedforward layer. use_spec_norm_att: Whether to use spectral normalization in the attention layer. use_spec_norm_ffn: Whether to use sp...
2
null
Implement the Python class `SpectralNormalizedTransformer` described below. Class description: Transformer layer with spectral-normalized dense layers. Method signatures and docstrings: - def __init__(self, use_layer_norm_att: bool=True, use_layer_norm_ffn: bool=True, use_spec_norm_att: bool=False, use_spec_norm_ffn:...
Implement the Python class `SpectralNormalizedTransformer` described below. Class description: Transformer layer with spectral-normalized dense layers. Method signatures and docstrings: - def __init__(self, use_layer_norm_att: bool=True, use_layer_norm_ffn: bool=True, use_spec_norm_att: bool=False, use_spec_norm_ffn:...
f5f6f50f82bd441339c9d9efbef3f09e72c5fef6
<|skeleton|> class SpectralNormalizedTransformer: """Transformer layer with spectral-normalized dense layers.""" def __init__(self, use_layer_norm_att: bool=True, use_layer_norm_ffn: bool=True, use_spec_norm_att: bool=False, use_spec_norm_ffn: bool=False, spec_norm_kwargs: Optional[Mapping[str, Any]]=None, **k...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SpectralNormalizedTransformer: """Transformer layer with spectral-normalized dense layers.""" def __init__(self, use_layer_norm_att: bool=True, use_layer_norm_ffn: bool=True, use_spec_norm_att: bool=False, use_spec_norm_ffn: bool=False, spec_norm_kwargs: Optional[Mapping[str, Any]]=None, **kwargs): ...
the_stack_v2_python_sparse
uncertainty_baselines/models/bert_sngp.py
google/uncertainty-baselines
train
1,235
5c46a7fb9d88039f0ffaed65f60968f64d0c6618
[ "login_mothod(self, 'admin123', '12345678')\nself.assertTitle('慕课网在线')\nprint('登录成功!')", "self.login()\nself.click(BaseEle.link_teachers)\nself.click('link_text=>全部')\nele = self.driver.find_elements_by_xpath(BaseEle.list_teacher)\nl = []\nnum = len(ele)\nfor i in range(0, num):\n print(i)\n l.append(ele[i]...
<|body_start_0|> login_mothod(self, 'admin123', '12345678') self.assertTitle('慕课网在线') print('登录成功!') <|end_body_0|> <|body_start_1|> self.login() self.click(BaseEle.link_teachers) self.click('link_text=>全部') ele = self.driver.find_elements_by_xpath(BaseEle.list_t...
课程详情检查, 涉及到机构的,延迟
TeacherList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TeacherList: """课程详情检查, 涉及到机构的,延迟""" def login(self): """baidu search key : pyse""" <|body_0|> def test_sort_addtime(self): """默认排序""" <|body_1|> def test_sort_clicknums(self): """默认人气""" <|body_2|> <|end_skeleton|> <|body_start_0|>...
stack_v2_sparse_classes_36k_train_011181
2,148
no_license
[ { "docstring": "baidu search key : pyse", "name": "login", "signature": "def login(self)" }, { "docstring": "默认排序", "name": "test_sort_addtime", "signature": "def test_sort_addtime(self)" }, { "docstring": "默认人气", "name": "test_sort_clicknums", "signature": "def test_sort...
3
stack_v2_sparse_classes_30k_train_010658
Implement the Python class `TeacherList` described below. Class description: 课程详情检查, 涉及到机构的,延迟 Method signatures and docstrings: - def login(self): baidu search key : pyse - def test_sort_addtime(self): 默认排序 - def test_sort_clicknums(self): 默认人气
Implement the Python class `TeacherList` described below. Class description: 课程详情检查, 涉及到机构的,延迟 Method signatures and docstrings: - def login(self): baidu search key : pyse - def test_sort_addtime(self): 默认排序 - def test_sort_clicknums(self): 默认人气 <|skeleton|> class TeacherList: """课程详情检查, 涉及到机构的,延迟""" def lo...
b8db5dc4acf995286b9275ec2f25284d64961184
<|skeleton|> class TeacherList: """课程详情检查, 涉及到机构的,延迟""" def login(self): """baidu search key : pyse""" <|body_0|> def test_sort_addtime(self): """默认排序""" <|body_1|> def test_sort_clicknums(self): """默认人气""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TeacherList: """课程详情检查, 涉及到机构的,延迟""" def login(self): """baidu search key : pyse""" login_mothod(self, 'admin123', '12345678') self.assertTitle('慕课网在线') print('登录成功!') def test_sort_addtime(self): """默认排序""" self.login() self.click(BaseEle.link...
the_stack_v2_python_sparse
src/mxonline/easy/test_teacher_list.py
hi-cbh/seleniumDemo
train
0
34ed1bc0519bccb84c46ebe7848e5726a209f6bd
[ "q = p1.clone()\nq.x += t * (p2.x - p1.x)\nq.y += t * (p2.y - p1.y)\nreturn q", "a = MyTrinaryFractal.a\nq1 = MyTrinaryFractal.pointOnLineBetween(p0, p1, -a)\nq2 = MyTrinaryFractal.pointOnLineBetween(p0, p2, -a)\nreturn (p0, q1, q2)" ]
<|body_start_0|> q = p1.clone() q.x += t * (p2.x - p1.x) q.y += t * (p2.y - p1.y) return q <|end_body_0|> <|body_start_1|> a = MyTrinaryFractal.a q1 = MyTrinaryFractal.pointOnLineBetween(p0, p1, -a) q2 = MyTrinaryFractal.pointOnLineBetween(p0, p2, -a) ret...
MyTrinaryFractal
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyTrinaryFractal: def pointOnLineBetween(p1, p2, t): """Returns a point p1+t(p2-p1).""" <|body_0|> def expandTriangleByCorner(p0, p1, p2): """This should take a triangle and expand a corners with another triangle, scaled by a factor a.""" <|body_1|> <|end_sk...
stack_v2_sparse_classes_36k_train_011182
3,813
no_license
[ { "docstring": "Returns a point p1+t(p2-p1).", "name": "pointOnLineBetween", "signature": "def pointOnLineBetween(p1, p2, t)" }, { "docstring": "This should take a triangle and expand a corners with another triangle, scaled by a factor a.", "name": "expandTriangleByCorner", "signature": ...
2
null
Implement the Python class `MyTrinaryFractal` described below. Class description: Implement the MyTrinaryFractal class. Method signatures and docstrings: - def pointOnLineBetween(p1, p2, t): Returns a point p1+t(p2-p1). - def expandTriangleByCorner(p0, p1, p2): This should take a triangle and expand a corners with an...
Implement the Python class `MyTrinaryFractal` described below. Class description: Implement the MyTrinaryFractal class. Method signatures and docstrings: - def pointOnLineBetween(p1, p2, t): Returns a point p1+t(p2-p1). - def expandTriangleByCorner(p0, p1, p2): This should take a triangle and expand a corners with an...
a6b69775a2b4c9fe9b7d00881630209b16e9b111
<|skeleton|> class MyTrinaryFractal: def pointOnLineBetween(p1, p2, t): """Returns a point p1+t(p2-p1).""" <|body_0|> def expandTriangleByCorner(p0, p1, p2): """This should take a triangle and expand a corners with another triangle, scaled by a factor a.""" <|body_1|> <|end_sk...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MyTrinaryFractal: def pointOnLineBetween(p1, p2, t): """Returns a point p1+t(p2-p1).""" q = p1.clone() q.x += t * (p2.x - p1.x) q.y += t * (p2.y - p1.y) return q def expandTriangleByCorner(p0, p1, p2): """This should take a triangle and expand a corners wit...
the_stack_v2_python_sparse
graphicstest2-fraktal.py
s-tefan/python-exercises
train
0
d1f920c4b734e4d8ec7287cb65df9bb3491375a7
[ "mes = {'message': 'success'}\ncli = mongo_db.get_client()\ncol = mongo_db.get_conn(table_name=cls.get_table_name(), db_client=cli)\nwith cli.start_session(causal_consistency=True) as session:\n with session.start_transaction():\n f = {'phone': phone}\n r = col.find_one(filter=f, session=session)\n...
<|body_start_0|> mes = {'message': 'success'} cli = mongo_db.get_client() col = mongo_db.get_conn(table_name=cls.get_table_name(), db_client=cli) with cli.start_session(causal_consistency=True) as session: with session.start_transaction(): f = {'phone': phone}...
UserInfo
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserInfo: def register(cls, phone: str, password: str) -> dict: """注册 :param phone: :param password: :return:""" <|body_0|> def login(cls, phone: str, password: str) -> dict: """登录 :param phone: :param password: :return:""" <|body_1|> <|end_skeleton|> <|bod...
stack_v2_sparse_classes_36k_train_011183
3,012
no_license
[ { "docstring": "注册 :param phone: :param password: :return:", "name": "register", "signature": "def register(cls, phone: str, password: str) -> dict" }, { "docstring": "登录 :param phone: :param password: :return:", "name": "login", "signature": "def login(cls, phone: str, password: str) ->...
2
stack_v2_sparse_classes_30k_train_004710
Implement the Python class `UserInfo` described below. Class description: Implement the UserInfo class. Method signatures and docstrings: - def register(cls, phone: str, password: str) -> dict: 注册 :param phone: :param password: :return: - def login(cls, phone: str, password: str) -> dict: 登录 :param phone: :param pass...
Implement the Python class `UserInfo` described below. Class description: Implement the UserInfo class. Method signatures and docstrings: - def register(cls, phone: str, password: str) -> dict: 注册 :param phone: :param password: :return: - def login(cls, phone: str, password: str) -> dict: 登录 :param phone: :param pass...
3a2bdfd1598bfcdfe56386ec0c46fcede772cbfe
<|skeleton|> class UserInfo: def register(cls, phone: str, password: str) -> dict: """注册 :param phone: :param password: :return:""" <|body_0|> def login(cls, phone: str, password: str) -> dict: """登录 :param phone: :param password: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserInfo: def register(cls, phone: str, password: str) -> dict: """注册 :param phone: :param password: :return:""" mes = {'message': 'success'} cli = mongo_db.get_client() col = mongo_db.get_conn(table_name=cls.get_table_name(), db_client=cli) with cli.start_session(causa...
the_stack_v2_python_sparse
BiH_site/module/user_module.py
SYYDSN/py_projects
train
0
5fd84ee1516a9cee0ef615fcf765a694833c913f
[ "self.count = 0\nself.index = []\nself.elem = dict()", "if val not in self.elem:\n self.elem[val] = self.count\n self.index.append(val)\n self.count += 1\n return True\nelse:\n return False", "if val not in self.elem:\n return False\nelse:\n ind = self.elem[val]\n self.elem.pop(val)\n ...
<|body_start_0|> self.count = 0 self.index = [] self.elem = dict() <|end_body_0|> <|body_start_1|> if val not in self.elem: self.elem[val] = self.count self.index.append(val) self.count += 1 return True else: return Fal...
RandomizedSet
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RandomizedSet: def __init__(self): """Initialize your data structure here.""" <|body_0|> def insert(self, val: int) -> bool: """Inserts a value to the set. Returns true if the set did not already contain the specified element.""" <|body_1|> def remove(se...
stack_v2_sparse_classes_36k_train_011184
1,538
permissive
[ { "docstring": "Initialize your data structure here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Inserts a value to the set. Returns true if the set did not already contain the specified element.", "name": "insert", "signature": "def insert(self, val: int) ...
4
stack_v2_sparse_classes_30k_train_004759
Implement the Python class `RandomizedSet` described below. Class description: Implement the RandomizedSet class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def insert(self, val: int) -> bool: Inserts a value to the set. Returns true if the set did not already conta...
Implement the Python class `RandomizedSet` described below. Class description: Implement the RandomizedSet class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def insert(self, val: int) -> bool: Inserts a value to the set. Returns true if the set did not already conta...
84c229eaf5a2e617ca00cabed04dd76d508d60b8
<|skeleton|> class RandomizedSet: def __init__(self): """Initialize your data structure here.""" <|body_0|> def insert(self, val: int) -> bool: """Inserts a value to the set. Returns true if the set did not already contain the specified element.""" <|body_1|> def remove(se...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RandomizedSet: def __init__(self): """Initialize your data structure here.""" self.count = 0 self.index = [] self.elem = dict() def insert(self, val: int) -> bool: """Inserts a value to the set. Returns true if the set did not already contain the specified element....
the_stack_v2_python_sparse
Code/py3/380.常数时间插入、删除和获取随机元素.py
ApocalypseMac/LeetCode
train
1
f020b6a2454831d5e24333952fea63f9bba16c89
[ "super(MLP, self).__init__()\nself.input_layer = torch.nn.Linear(D_inp, D_hid)\nself.hidden_layer = torch.nn.Linear(D_hid, D_hid)\nself.output_layer = torch.nn.Linear(D_hid, D_out)\nself.layers = layers\nself.sigmoid = torch.nn.Sigmoid()\nself.x_scale = x_scale.cuda() if use_cuda else x_scale\nself.y_scale = y_scal...
<|body_start_0|> super(MLP, self).__init__() self.input_layer = torch.nn.Linear(D_inp, D_hid) self.hidden_layer = torch.nn.Linear(D_hid, D_hid) self.output_layer = torch.nn.Linear(D_hid, D_out) self.layers = layers self.sigmoid = torch.nn.Sigmoid() self.x_scale = ...
MLP
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MLP: def __init__(self, D_inp, D_hid, D_out, layers, x_scale, y_scale): """Multilayer Perceptron with a variable amount of layers Args: D_inp: Dimension of the input layer D_hid: Dimension of all hidden layers D_out: Dimension of the output layer layers: The total amount of layers (2 mea...
stack_v2_sparse_classes_36k_train_011185
9,067
permissive
[ { "docstring": "Multilayer Perceptron with a variable amount of layers Args: D_inp: Dimension of the input layer D_hid: Dimension of all hidden layers D_out: Dimension of the output layer layers: The total amount of layers (2 means 1 hidden layer) x_scale: The maximum values for all input variables y_scale: The...
3
stack_v2_sparse_classes_30k_train_016416
Implement the Python class `MLP` described below. Class description: Implement the MLP class. Method signatures and docstrings: - def __init__(self, D_inp, D_hid, D_out, layers, x_scale, y_scale): Multilayer Perceptron with a variable amount of layers Args: D_inp: Dimension of the input layer D_hid: Dimension of all ...
Implement the Python class `MLP` described below. Class description: Implement the MLP class. Method signatures and docstrings: - def __init__(self, D_inp, D_hid, D_out, layers, x_scale, y_scale): Multilayer Perceptron with a variable amount of layers Args: D_inp: Dimension of the input layer D_hid: Dimension of all ...
257441138ebcce3928f100f28e58d9d5a7221d8a
<|skeleton|> class MLP: def __init__(self, D_inp, D_hid, D_out, layers, x_scale, y_scale): """Multilayer Perceptron with a variable amount of layers Args: D_inp: Dimension of the input layer D_hid: Dimension of all hidden layers D_out: Dimension of the output layer layers: The total amount of layers (2 mea...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MLP: def __init__(self, D_inp, D_hid, D_out, layers, x_scale, y_scale): """Multilayer Perceptron with a variable amount of layers Args: D_inp: Dimension of the input layer D_hid: Dimension of all hidden layers D_out: Dimension of the output layer layers: The total amount of layers (2 means 1 hidden la...
the_stack_v2_python_sparse
mlp.py
joramwessels/torcs-client
train
2
d78ded9245649e3ba3019fc5702ec13f7a7e5c21
[ "parser = reqparse.RequestParser()\nparser.add_argument('old_password', type=inputs.regex('^[0-9a-zA-Z\\\\_\\\\.\\\\!\\\\@\\\\#\\\\$\\\\%\\\\^\\\\&\\\\*]{6,20}$'), required=True, location='form')\nparser.add_argument('new_password', type=inputs.regex('^[0-9a-zA-Z\\\\_\\\\.\\\\!\\\\@\\\\#\\\\$\\\\%\\\\^\\\\&\\\\*]{6...
<|body_start_0|> parser = reqparse.RequestParser() parser.add_argument('old_password', type=inputs.regex('^[0-9a-zA-Z\\_\\.\\!\\@\\#\\$\\%\\^\\&\\*]{6,20}$'), required=True, location='form') parser.add_argument('new_password', type=inputs.regex('^[0-9a-zA-Z\\_\\.\\!\\@\\#\\$\\%\\^\\&\\*]{6,20}$'...
UserPassword
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserPassword: def patch(self): """change password""" <|body_0|> def put(self): """reset password""" <|body_1|> <|end_skeleton|> <|body_start_0|> parser = reqparse.RequestParser() parser.add_argument('old_password', type=inputs.regex('^[0-9a-...
stack_v2_sparse_classes_36k_train_011186
17,895
permissive
[ { "docstring": "change password", "name": "patch", "signature": "def patch(self)" }, { "docstring": "reset password", "name": "put", "signature": "def put(self)" } ]
2
stack_v2_sparse_classes_30k_train_010871
Implement the Python class `UserPassword` described below. Class description: Implement the UserPassword class. Method signatures and docstrings: - def patch(self): change password - def put(self): reset password
Implement the Python class `UserPassword` described below. Class description: Implement the UserPassword class. Method signatures and docstrings: - def patch(self): change password - def put(self): reset password <|skeleton|> class UserPassword: def patch(self): """change password""" <|body_0|> ...
fb1e88eccee1140d215ef8f1f789f215b1b3c2cf
<|skeleton|> class UserPassword: def patch(self): """change password""" <|body_0|> def put(self): """reset password""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserPassword: def patch(self): """change password""" parser = reqparse.RequestParser() parser.add_argument('old_password', type=inputs.regex('^[0-9a-zA-Z\\_\\.\\!\\@\\#\\$\\%\\^\\&\\*]{6,20}$'), required=True, location='form') parser.add_argument('new_password', type=inputs.reg...
the_stack_v2_python_sparse
app/v2/user.py
shanhezhao/flask_douban_moive_web
train
0
fc41ac5dcf67b67ef7ff676a857b0707655ba648
[ "if what == None and values == None:\n raise RuntimeWarning('Test convergence is set to ecutwfc')\n self.what = 'ecutwfc'\n self.values = np.arange(20, 80, 10)\nself.pwinput = pwinput\nself.what = what\nself.values = values\nself.Ndata = len(values)\nself.energies = None\nself.prefixInp = prefixInp\nself.p...
<|body_start_0|> if what == None and values == None: raise RuntimeWarning('Test convergence is set to ecutwfc') self.what = 'ecutwfc' self.values = np.arange(20, 80, 10) self.pwinput = pwinput self.what = what self.values = values self.Ndata = ...
A class for doing 1D convergence test.
ConvergenceTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConvergenceTest: """A class for doing 1D convergence test.""" def __init__(self, pwinput, what=None, values=None, prefixInp='TEMP_PWINPUT_', prefixOut='LOG_'): """`what` can be one of ecutwfc, kpts `values`""" <|body_0|> def run(self): """one-time run""" ...
stack_v2_sparse_classes_36k_train_011187
26,022
no_license
[ { "docstring": "`what` can be one of ecutwfc, kpts `values`", "name": "__init__", "signature": "def __init__(self, pwinput, what=None, values=None, prefixInp='TEMP_PWINPUT_', prefixOut='LOG_')" }, { "docstring": "one-time run", "name": "run", "signature": "def run(self)" }, { "do...
4
stack_v2_sparse_classes_30k_train_006710
Implement the Python class `ConvergenceTest` described below. Class description: A class for doing 1D convergence test. Method signatures and docstrings: - def __init__(self, pwinput, what=None, values=None, prefixInp='TEMP_PWINPUT_', prefixOut='LOG_'): `what` can be one of ecutwfc, kpts `values` - def run(self): one...
Implement the Python class `ConvergenceTest` described below. Class description: A class for doing 1D convergence test. Method signatures and docstrings: - def __init__(self, pwinput, what=None, values=None, prefixInp='TEMP_PWINPUT_', prefixOut='LOG_'): `what` can be one of ecutwfc, kpts `values` - def run(self): one...
c173a8fd90134120e3e1fedddf4babeee8aed74e
<|skeleton|> class ConvergenceTest: """A class for doing 1D convergence test.""" def __init__(self, pwinput, what=None, values=None, prefixInp='TEMP_PWINPUT_', prefixOut='LOG_'): """`what` can be one of ecutwfc, kpts `values`""" <|body_0|> def run(self): """one-time run""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ConvergenceTest: """A class for doing 1D convergence test.""" def __init__(self, pwinput, what=None, values=None, prefixInp='TEMP_PWINPUT_', prefixOut='LOG_'): """`what` can be one of ecutwfc, kpts `values`""" if what == None and values == None: raise RuntimeWarning('Test conv...
the_stack_v2_python_sparse
python_modules/qeManager_PWSCF.py
f-fathurrahman/IntroKomputasiMaterial
train
0
fe18fcdeb64e94cf39cc7d7cfa85a11099ef9987
[ "if not root:\n return 0\nleft_height, right_height = (Solution.get_depth_recur(root.left), Solution.get_depth_recur(root.right))\nif left_height == right_height:\n return (1 << left_height) + self.countNodes(root.right)\nelse:\n return (1 << right_height) + self.countNodes(root.left)", "height = 0\nwhil...
<|body_start_0|> if not root: return 0 left_height, right_height = (Solution.get_depth_recur(root.left), Solution.get_depth_recur(root.right)) if left_height == right_height: return (1 << left_height) + self.countNodes(root.right) else: return (1 << ri...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def countNodes(self, root: TreeNode) -> int: """:param root: input tree :return: number of nodes in tree""" <|body_0|> def get_depth_recur(self, root: TreeNode) -> int: """Get the height of a tree recursively :param root: the input tree :return: height of t...
stack_v2_sparse_classes_36k_train_011188
1,511
no_license
[ { "docstring": ":param root: input tree :return: number of nodes in tree", "name": "countNodes", "signature": "def countNodes(self, root: TreeNode) -> int" }, { "docstring": "Get the height of a tree recursively :param root: the input tree :return: height of the tree", "name": "get_depth_rec...
3
stack_v2_sparse_classes_30k_train_009739
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countNodes(self, root: TreeNode) -> int: :param root: input tree :return: number of nodes in tree - def get_depth_recur(self, root: TreeNode) -> int: Get the height of a tree...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countNodes(self, root: TreeNode) -> int: :param root: input tree :return: number of nodes in tree - def get_depth_recur(self, root: TreeNode) -> int: Get the height of a tree...
9fc527fa8cfebc1bffd2310e8a1a61229a17b7d8
<|skeleton|> class Solution: def countNodes(self, root: TreeNode) -> int: """:param root: input tree :return: number of nodes in tree""" <|body_0|> def get_depth_recur(self, root: TreeNode) -> int: """Get the height of a tree recursively :param root: the input tree :return: height of t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def countNodes(self, root: TreeNode) -> int: """:param root: input tree :return: number of nodes in tree""" if not root: return 0 left_height, right_height = (Solution.get_depth_recur(root.left), Solution.get_depth_recur(root.right)) if left_height == righ...
the_stack_v2_python_sparse
222/222_version2.py
RunhuaGao/LeetCode
train
0
8f44a0a412fe1eb563b8fb996417ddc0e5be6cfa
[ "if unmatched_thres > matched_thres:\n raise ValueError('unmatched_thres must be <= matched_thres.')\nif unmatched_thres == matched_thres and (not negatives_lower_than_unmatched):\n raise ValueError('unmatched_thres must be < matche_thres, when negatives are in between them, got {} and {}.'.format(unmatched_t...
<|body_start_0|> if unmatched_thres > matched_thres: raise ValueError('unmatched_thres must be <= matched_thres.') if unmatched_thres == matched_thres and (not negatives_lower_than_unmatched): raise ValueError('unmatched_thres must be < matche_thres, when negatives are in between...
Picks the row index that maximizes the column.
ArgMaxMatcher
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ArgMaxMatcher: """Picks the row index that maximizes the column.""" def __init__(self, matched_thres, unmatched_thres, negatives_lower_than_unmatched=True, force_match_for_each_row=False): """Constructor. Args: matched_thres: float scalar between 0 and 1, threshold for positive match...
stack_v2_sparse_classes_36k_train_011189
11,746
no_license
[ { "docstring": "Constructor. Args: matched_thres: float scalar between 0 and 1, threshold for positive match. unmatched_thres: float scalar between 0 and 1, threshold for negative match. Must be no greater than `matched_thres`. negatives_lower_than_unmatched: bool scalar, whether to consider those below `unmatc...
2
stack_v2_sparse_classes_30k_train_008852
Implement the Python class `ArgMaxMatcher` described below. Class description: Picks the row index that maximizes the column. Method signatures and docstrings: - def __init__(self, matched_thres, unmatched_thres, negatives_lower_than_unmatched=True, force_match_for_each_row=False): Constructor. Args: matched_thres: f...
Implement the Python class `ArgMaxMatcher` described below. Class description: Picks the row index that maximizes the column. Method signatures and docstrings: - def __init__(self, matched_thres, unmatched_thres, negatives_lower_than_unmatched=True, force_match_for_each_row=False): Constructor. Args: matched_thres: f...
5a53e02c690632bcf140d1b17327959609aab395
<|skeleton|> class ArgMaxMatcher: """Picks the row index that maximizes the column.""" def __init__(self, matched_thres, unmatched_thres, negatives_lower_than_unmatched=True, force_match_for_each_row=False): """Constructor. Args: matched_thres: float scalar between 0 and 1, threshold for positive match...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ArgMaxMatcher: """Picks the row index that maximizes the column.""" def __init__(self, matched_thres, unmatched_thres, negatives_lower_than_unmatched=True, force_match_for_each_row=False): """Constructor. Args: matched_thres: float scalar between 0 and 1, threshold for positive match. unmatched_t...
the_stack_v2_python_sparse
core/matcher.py
chao-ji/tf-detection
train
2
bd4f9df349d897f13541cc77626cea225e17e552
[ "super().__init__()\nself.ensemble = ensemble\nself.p_vae = p_vae\nself.q_vae = q_vae\nself.latent_size = latent_size", "xs = []\nys = []\nws = []\nfor j in range(num_batches):\n z = tf.random.normal([num_samples, self.latent_size])\n q_dx = self.q_vae.decoder.get_distribution(z, training=False)\n p_dx =...
<|body_start_0|> super().__init__() self.ensemble = ensemble self.p_vae = p_vae self.q_vae = q_vae self.latent_size = latent_size <|end_body_0|> <|body_start_1|> xs = [] ys = [] ws = [] for j in range(num_batches): z = tf.random.normal...
CBAS
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CBAS: def __init__(self, ensemble, p_vae, q_vae, latent_size=20): """Build a trainer for an ensemble of probabilistic neural networks trained on bootstraps of a dataset Args: encoder: tf.keras.Model the encoder neural network that outputs parameters for a gaussian decoder: tf.keras.Model...
stack_v2_sparse_classes_36k_train_011190
19,704
permissive
[ { "docstring": "Build a trainer for an ensemble of probabilistic neural networks trained on bootstraps of a dataset Args: encoder: tf.keras.Model the encoder neural network that outputs parameters for a gaussian decoder: tf.keras.Model the decoder neural network that outputs parameters for a gaussian vae_optim:...
4
stack_v2_sparse_classes_30k_train_001392
Implement the Python class `CBAS` described below. Class description: Implement the CBAS class. Method signatures and docstrings: - def __init__(self, ensemble, p_vae, q_vae, latent_size=20): Build a trainer for an ensemble of probabilistic neural networks trained on bootstraps of a dataset Args: encoder: tf.keras.Mo...
Implement the Python class `CBAS` described below. Class description: Implement the CBAS class. Method signatures and docstrings: - def __init__(self, ensemble, p_vae, q_vae, latent_size=20): Build a trainer for an ensemble of probabilistic neural networks trained on bootstraps of a dataset Args: encoder: tf.keras.Mo...
d46ff40d8b665953afb64a3332ddf1953b8a0766
<|skeleton|> class CBAS: def __init__(self, ensemble, p_vae, q_vae, latent_size=20): """Build a trainer for an ensemble of probabilistic neural networks trained on bootstraps of a dataset Args: encoder: tf.keras.Model the encoder neural network that outputs parameters for a gaussian decoder: tf.keras.Model...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CBAS: def __init__(self, ensemble, p_vae, q_vae, latent_size=20): """Build a trainer for an ensemble of probabilistic neural networks trained on bootstraps of a dataset Args: encoder: tf.keras.Model the encoder neural network that outputs parameters for a gaussian decoder: tf.keras.Model the decoder n...
the_stack_v2_python_sparse
design_baselines/autofocused_cbas/trainers.py
stjordanis/design-baselines
train
0
484ab52a9b288846d4ff055d7a46687ac2ba512d
[ "super(ExpandImage, self).__init__()\nself.max_ratio = max_ratio\nself.mean = mean\nself.prob = prob", "prob = np.random.uniform(0, 1)\nassert 'image' in sample, 'not found image data'\nim = sample['image']\ngt_bbox = sample['gt_bbox']\ngt_class = sample['gt_class']\nim_width = sample['w']\nim_height = sample['h'...
<|body_start_0|> super(ExpandImage, self).__init__() self.max_ratio = max_ratio self.mean = mean self.prob = prob <|end_body_0|> <|body_start_1|> prob = np.random.uniform(0, 1) assert 'image' in sample, 'not found image data' im = sample['image'] gt_bbox ...
ExpandImage
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExpandImage: def __init__(self, max_ratio, prob, mean=[127.5, 127.5, 127.5]): """Args: max_ratio (float): the ratio of expanding prob (float): the probability of expanding image mean (list): the pixel mean""" <|body_0|> def __call__(self, sample, context): """Expand ...
stack_v2_sparse_classes_36k_train_011191
39,037
permissive
[ { "docstring": "Args: max_ratio (float): the ratio of expanding prob (float): the probability of expanding image mean (list): the pixel mean", "name": "__init__", "signature": "def __init__(self, max_ratio, prob, mean=[127.5, 127.5, 127.5])" }, { "docstring": "Expand the image and modify boundin...
2
stack_v2_sparse_classes_30k_train_001559
Implement the Python class `ExpandImage` described below. Class description: Implement the ExpandImage class. Method signatures and docstrings: - def __init__(self, max_ratio, prob, mean=[127.5, 127.5, 127.5]): Args: max_ratio (float): the ratio of expanding prob (float): the probability of expanding image mean (list...
Implement the Python class `ExpandImage` described below. Class description: Implement the ExpandImage class. Method signatures and docstrings: - def __init__(self, max_ratio, prob, mean=[127.5, 127.5, 127.5]): Args: max_ratio (float): the ratio of expanding prob (float): the probability of expanding image mean (list...
420527996b6da60ca401717a734329f126ed0680
<|skeleton|> class ExpandImage: def __init__(self, max_ratio, prob, mean=[127.5, 127.5, 127.5]): """Args: max_ratio (float): the ratio of expanding prob (float): the probability of expanding image mean (list): the pixel mean""" <|body_0|> def __call__(self, sample, context): """Expand ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ExpandImage: def __init__(self, max_ratio, prob, mean=[127.5, 127.5, 127.5]): """Args: max_ratio (float): the ratio of expanding prob (float): the probability of expanding image mean (list): the pixel mean""" super(ExpandImage, self).__init__() self.max_ratio = max_ratio self.m...
the_stack_v2_python_sparse
PaddleCV/PaddleDetection/ppdet/data/transform/operators.py
chenbjin/models
train
3
89d849461b48b0b5895d271a9cf96bcd728763f7
[ "if not ctx.invoked_subcommand and ctx.channel.type == discord.ChannelType.private:\n settings = [(setting.replace('_', ' ').title(), value) for setting, value in (await self.config.custom('MONGODB').get_raw()).items() if value]\n await ctx.send(chat.box(tabulate(settings, tablefmt='plain')))", "message = a...
<|body_start_0|> if not ctx.invoked_subcommand and ctx.channel.type == discord.ChannelType.private: settings = [(setting.replace('_', ' ').title(), value) for setting, value in (await self.config.custom('MONGODB').get_raw()).items() if value] await ctx.send(chat.box(tabulate(settings, ta...
DataBase
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataBase: async def levelerset(self, ctx): """MongoDB server configuration options. Use that command in DM to see current settings.""" <|body_0|> async def reconnect(self, ctx): """Attempt to reconnect to MongoDB without changing settings""" <|body_1|> a...
stack_v2_sparse_classes_36k_train_011192
4,667
permissive
[ { "docstring": "MongoDB server configuration options. Use that command in DM to see current settings.", "name": "levelerset", "signature": "async def levelerset(self, ctx)" }, { "docstring": "Attempt to reconnect to MongoDB without changing settings", "name": "reconnect", "signature": "a...
6
stack_v2_sparse_classes_30k_train_002682
Implement the Python class `DataBase` described below. Class description: Implement the DataBase class. Method signatures and docstrings: - async def levelerset(self, ctx): MongoDB server configuration options. Use that command in DM to see current settings. - async def reconnect(self, ctx): Attempt to reconnect to M...
Implement the Python class `DataBase` described below. Class description: Implement the DataBase class. Method signatures and docstrings: - async def levelerset(self, ctx): MongoDB server configuration options. Use that command in DM to see current settings. - async def reconnect(self, ctx): Attempt to reconnect to M...
c977b1d127629b858235b23dd86e5fe0756d1edb
<|skeleton|> class DataBase: async def levelerset(self, ctx): """MongoDB server configuration options. Use that command in DM to see current settings.""" <|body_0|> async def reconnect(self, ctx): """Attempt to reconnect to MongoDB without changing settings""" <|body_1|> a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DataBase: async def levelerset(self, ctx): """MongoDB server configuration options. Use that command in DM to see current settings.""" if not ctx.invoked_subcommand and ctx.channel.type == discord.ChannelType.private: settings = [(setting.replace('_', ' ').title(), value) for setti...
the_stack_v2_python_sparse
leveler/commands/database.py
fixator10/Fixator10-Cogs
train
90
1b80b877db73eb271893b54c5d67642ca942c463
[ "start, end = data.split(' -> ')\nstart = Point2D(*map(int, start.split(',')))\nend = Point2D(*map(int, end.split(',')))\nreturn cls(start, end)", "if self.start.x == self.end.x:\n min_y, max_y = (min(self.start.y, self.end.y), max(self.start.y, self.end.y))\n return [Point2D(self.start.x, y) for y in range...
<|body_start_0|> start, end = data.split(' -> ') start = Point2D(*map(int, start.split(','))) end = Point2D(*map(int, end.split(','))) return cls(start, end) <|end_body_0|> <|body_start_1|> if self.start.x == self.end.x: min_y, max_y = (min(self.start.y, self.end.y),...
A straight two-dimensional line. Args: start (Point2D): The starting point of the line. end (Point2D): The ending point of the line. Attributes: start (Point2D): The starting point of the line. end (Point2D): The ending point of the line.
Line2D
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Line2D: """A straight two-dimensional line. Args: start (Point2D): The starting point of the line. end (Point2D): The ending point of the line. Attributes: start (Point2D): The starting point of the line. end (Point2D): The ending point of the line.""" def from_data(cls, data: str) -> Line2D...
stack_v2_sparse_classes_36k_train_011193
2,536
permissive
[ { "docstring": "Create a line object from an input line. Args: data (str): The data to create the line from, formatted as \"x1,y1 -> x2,y2\". Returns: Line2D: The created bingo card.", "name": "from_data", "signature": "def from_data(cls, data: str) -> Line2D" }, { "docstring": "Get the points o...
2
null
Implement the Python class `Line2D` described below. Class description: A straight two-dimensional line. Args: start (Point2D): The starting point of the line. end (Point2D): The ending point of the line. Attributes: start (Point2D): The starting point of the line. end (Point2D): The ending point of the line. Method ...
Implement the Python class `Line2D` described below. Class description: A straight two-dimensional line. Args: start (Point2D): The starting point of the line. end (Point2D): The ending point of the line. Attributes: start (Point2D): The starting point of the line. end (Point2D): The ending point of the line. Method ...
c3bc41418240bf1808be84a72507abaf2da3bff4
<|skeleton|> class Line2D: """A straight two-dimensional line. Args: start (Point2D): The starting point of the line. end (Point2D): The ending point of the line. Attributes: start (Point2D): The starting point of the line. end (Point2D): The ending point of the line.""" def from_data(cls, data: str) -> Line2D...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Line2D: """A straight two-dimensional line. Args: start (Point2D): The starting point of the line. end (Point2D): The ending point of the line. Attributes: start (Point2D): The starting point of the line. end (Point2D): The ending point of the line.""" def from_data(cls, data: str) -> Line2D: """...
the_stack_v2_python_sparse
utils/bsoyka_aoc_utils/lines.py
bsoyka/advent-of-code
train
3
56afcfcfd36419fc1ee6dcd3661a4d3243c22008
[ "super(CustomStatusFormset, self).__init__(*args, **kwargs)\nfor form in self.forms:\n for field in form.fields:\n form.fields[field].widget.attrs.update({'class': 'form-control'})", "for form in self.forms:\n status = form.cleaned_data.get('status')\n if not status:\n raise ValidationError...
<|body_start_0|> super(CustomStatusFormset, self).__init__(*args, **kwargs) for form in self.forms: for field in form.fields: form.fields[field].widget.attrs.update({'class': 'form-control'}) <|end_body_0|> <|body_start_1|> for form in self.forms: status ...
Django BaseInlineFormset to include StatusUpdateForm on page displaying NewTicketForm
CustomStatusFormset
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CustomStatusFormset: """Django BaseInlineFormset to include StatusUpdateForm on page displaying NewTicketForm""" def __init__(self, *args, **kwargs): """Custom __init__ behavior to enable Bootstrap form styling""" <|body_0|> def clean(self): """Custom clean behav...
stack_v2_sparse_classes_36k_train_011194
3,647
no_license
[ { "docstring": "Custom __init__ behavior to enable Bootstrap form styling", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Custom clean behavior to raise ValidationError if no status selected", "name": "clean", "signature": "def clean(self)" }...
2
stack_v2_sparse_classes_30k_train_003833
Implement the Python class `CustomStatusFormset` described below. Class description: Django BaseInlineFormset to include StatusUpdateForm on page displaying NewTicketForm Method signatures and docstrings: - def __init__(self, *args, **kwargs): Custom __init__ behavior to enable Bootstrap form styling - def clean(self...
Implement the Python class `CustomStatusFormset` described below. Class description: Django BaseInlineFormset to include StatusUpdateForm on page displaying NewTicketForm Method signatures and docstrings: - def __init__(self, *args, **kwargs): Custom __init__ behavior to enable Bootstrap form styling - def clean(self...
2493b8d5c865452f75290566ba43cab548d573bd
<|skeleton|> class CustomStatusFormset: """Django BaseInlineFormset to include StatusUpdateForm on page displaying NewTicketForm""" def __init__(self, *args, **kwargs): """Custom __init__ behavior to enable Bootstrap form styling""" <|body_0|> def clean(self): """Custom clean behav...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CustomStatusFormset: """Django BaseInlineFormset to include StatusUpdateForm on page displaying NewTicketForm""" def __init__(self, *args, **kwargs): """Custom __init__ behavior to enable Bootstrap form styling""" super(CustomStatusFormset, self).__init__(*args, **kwargs) for form...
the_stack_v2_python_sparse
apps/warranty/forms.py
ryanpdaly/megabike_crm_django
train
0
cef39fdab9b07f1efb5514edf48889e5b764df00
[ "self.m = 1000\nself.h = [None] * self.m\nself.NOT_IN_LIST = -1", "index = key % self.m\nif self.h[index] == None:\n self.h[index] = ListNode(key, value)\nelse:\n cur = self.h[index]\n while True:\n if cur.pair[0] == key:\n cur.pair = (key, value)\n return\n if cur.nex...
<|body_start_0|> self.m = 1000 self.h = [None] * self.m self.NOT_IN_LIST = -1 <|end_body_0|> <|body_start_1|> index = key % self.m if self.h[index] == None: self.h[index] = ListNode(key, value) else: cur = self.h[index] while True: ...
MyHashMap
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyHashMap: def __init__(self): """Initialize your data structure here.""" <|body_0|> def put(self, key, value): """value will always be non-negative. :type key: int :type value: int :rtype: void""" <|body_1|> def get(self, key): """Returns the va...
stack_v2_sparse_classes_36k_train_011195
2,860
no_license
[ { "docstring": "Initialize your data structure here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "value will always be non-negative. :type key: int :type value: int :rtype: void", "name": "put", "signature": "def put(self, key, value)" }, { "docstrin...
4
stack_v2_sparse_classes_30k_train_016479
Implement the Python class `MyHashMap` described below. Class description: Implement the MyHashMap class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def put(self, key, value): value will always be non-negative. :type key: int :type value: int :rtype: void - def get(...
Implement the Python class `MyHashMap` described below. Class description: Implement the MyHashMap class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def put(self, key, value): value will always be non-negative. :type key: int :type value: int :rtype: void - def get(...
4ddeb506f984503d83cb0ad1a2fa2e915009c38f
<|skeleton|> class MyHashMap: def __init__(self): """Initialize your data structure here.""" <|body_0|> def put(self, key, value): """value will always be non-negative. :type key: int :type value: int :rtype: void""" <|body_1|> def get(self, key): """Returns the va...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MyHashMap: def __init__(self): """Initialize your data structure here.""" self.m = 1000 self.h = [None] * self.m self.NOT_IN_LIST = -1 def put(self, key, value): """value will always be non-negative. :type key: int :type value: int :rtype: void""" index = k...
the_stack_v2_python_sparse
hash_map.py
EugeneStill/PythonCodeChallenges
train
0
232b0ab35c39ae33779d8d46f496162e61b53517
[ "for rec in self:\n base_url = rec.get_base_url()\n share_url = rec._get_share_url(redirect=True, signup_partner=True)\n url = base_url + share_url\n return url", "for rec in self:\n templated_id = self.env.ref('sale_whatsapp_connector.sale_order_status', raise_if_not_found=False)\n whatsapp_log...
<|body_start_0|> for rec in self: base_url = rec.get_base_url() share_url = rec._get_share_url(redirect=True, signup_partner=True) url = base_url + share_url return url <|end_body_0|> <|body_start_1|> for rec in self: templated_id = self.env.r...
Inherit Sale Order.
SaleOrder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SaleOrder: """Inherit Sale Order.""" def get_link(self): """Method to genrate the share Link.""" <|body_0|> def send_order_status(self): """Send Message to Customer.""" <|body_1|> <|end_skeleton|> <|body_start_0|> for rec in self: ba...
stack_v2_sparse_classes_36k_train_011196
3,182
no_license
[ { "docstring": "Method to genrate the share Link.", "name": "get_link", "signature": "def get_link(self)" }, { "docstring": "Send Message to Customer.", "name": "send_order_status", "signature": "def send_order_status(self)" } ]
2
stack_v2_sparse_classes_30k_train_014155
Implement the Python class `SaleOrder` described below. Class description: Inherit Sale Order. Method signatures and docstrings: - def get_link(self): Method to genrate the share Link. - def send_order_status(self): Send Message to Customer.
Implement the Python class `SaleOrder` described below. Class description: Inherit Sale Order. Method signatures and docstrings: - def get_link(self): Method to genrate the share Link. - def send_order_status(self): Send Message to Customer. <|skeleton|> class SaleOrder: """Inherit Sale Order.""" def get_li...
e5c27a9201d27f6a1dfabbc73a92cc62d25c9702
<|skeleton|> class SaleOrder: """Inherit Sale Order.""" def get_link(self): """Method to genrate the share Link.""" <|body_0|> def send_order_status(self): """Send Message to Customer.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SaleOrder: """Inherit Sale Order.""" def get_link(self): """Method to genrate the share Link.""" for rec in self: base_url = rec.get_base_url() share_url = rec._get_share_url(redirect=True, signup_partner=True) url = base_url + share_url ret...
the_stack_v2_python_sparse
sale_whatsapp_connector/models/sale_order.py
Raniani-lab/dxm
train
0
700f976c1465bfdf9256c7a2e2cc916226e22762
[ "q = []\nfor x, y in points:\n heapq.heappush(q, (math.sqrt(x ** 2 + y ** 2), x, y))\nclosest = [[x, y] for _, x, y in heapq.nsmallest(k, q)]\nreturn closest", "q = []\nfor x, y in points:\n if len(q) < k:\n heapq.heappush(q, (-math.sqrt(x ** 2 + y ** 2), x, y))\n else:\n distance = math.sq...
<|body_start_0|> q = [] for x, y in points: heapq.heappush(q, (math.sqrt(x ** 2 + y ** 2), x, y)) closest = [[x, y] for _, x, y in heapq.nsmallest(k, q)] return closest <|end_body_0|> <|body_start_1|> q = [] for x, y in points: if len(q) < k: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def kClosest(self, points: List[List[int]], k: int) -> List[List[int]]: """O(N*log(N)) Solution""" <|body_0|> def kClosest2(self, points: List[List[int]], k: int) -> List[List[int]]: """O(N*log(K)) Solution""" <|body_1|> <|end_skeleton|> <|body_st...
stack_v2_sparse_classes_36k_train_011197
916
no_license
[ { "docstring": "O(N*log(N)) Solution", "name": "kClosest", "signature": "def kClosest(self, points: List[List[int]], k: int) -> List[List[int]]" }, { "docstring": "O(N*log(K)) Solution", "name": "kClosest2", "signature": "def kClosest2(self, points: List[List[int]], k: int) -> List[List[...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def kClosest(self, points: List[List[int]], k: int) -> List[List[int]]: O(N*log(N)) Solution - def kClosest2(self, points: List[List[int]], k: int) -> List[List[int]]: O(N*log(K)...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def kClosest(self, points: List[List[int]], k: int) -> List[List[int]]: O(N*log(N)) Solution - def kClosest2(self, points: List[List[int]], k: int) -> List[List[int]]: O(N*log(K)...
b72229c50e87d1ff32d3538d13779953451b9daf
<|skeleton|> class Solution: def kClosest(self, points: List[List[int]], k: int) -> List[List[int]]: """O(N*log(N)) Solution""" <|body_0|> def kClosest2(self, points: List[List[int]], k: int) -> List[List[int]]: """O(N*log(K)) Solution""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def kClosest(self, points: List[List[int]], k: int) -> List[List[int]]: """O(N*log(N)) Solution""" q = [] for x, y in points: heapq.heappush(q, (math.sqrt(x ** 2 + y ** 2), x, y)) closest = [[x, y] for _, x, y in heapq.nsmallest(k, q)] return close...
the_stack_v2_python_sparse
leetcode/K Closest Points to Origin/main.py
dalleng/Interview-Practice
train
2
4ec352982d44085b7c1fa9add44edc9702436c85
[ "if len(strs) == 0:\n return None\nresult = ''\nfor str in strs:\n lengthstr = [chr(0)] * 4\n length = len(str)\n byte = 4\n while length:\n lengthstr[byte - 1] = chr(length % 256)\n byte -= 1\n length /= 256\n prefix = ''.join(lengthstr)\n result += prefix + str.encode('ut...
<|body_start_0|> if len(strs) == 0: return None result = '' for str in strs: lengthstr = [chr(0)] * 4 length = len(str) byte = 4 while length: lengthstr[byte - 1] = chr(length % 256) byte -= 1 ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def encode(self, strs): """Encodes a list of strings to a single string. :type strs: List[str] :rtype: str""" <|body_0|> def decode(self, s): """Decodes a single string to a list of strings. :type s: str :rtype: List[str]""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_36k_train_011198
1,936
no_license
[ { "docstring": "Encodes a list of strings to a single string. :type strs: List[str] :rtype: str", "name": "encode", "signature": "def encode(self, strs)" }, { "docstring": "Decodes a single string to a list of strings. :type s: str :rtype: List[str]", "name": "decode", "signature": "def ...
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def encode(self, strs): Encodes a list of strings to a single string. :type strs: List[str] :rtype: str - def decode(self, s): Decodes a single string to a list of strings. :type s: st...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def encode(self, strs): Encodes a list of strings to a single string. :type strs: List[str] :rtype: str - def decode(self, s): Decodes a single string to a list of strings. :type s: st...
d953abe2c9680f636563e76287d2f907e90ced63
<|skeleton|> class Codec: def encode(self, strs): """Encodes a list of strings to a single string. :type strs: List[str] :rtype: str""" <|body_0|> def decode(self, s): """Decodes a single string to a list of strings. :type s: str :rtype: List[str]""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def encode(self, strs): """Encodes a list of strings to a single string. :type strs: List[str] :rtype: str""" if len(strs) == 0: return None result = '' for str in strs: lengthstr = [chr(0)] * 4 length = len(str) byte = 4 ...
the_stack_v2_python_sparse
Python_leetcode/271_encode_and_decode_strings.py
xiangcao/Leetcode
train
0
b2a45618b02c9babe1661231eefdf1d309e6fe6d
[ "assert isinstance(response, scrapy.http.response.html.HtmlResponse)\ncurboard = response.selector.xpath('//div[contains(@class, \"titleBar\")]/h1/text()').extract()\nlast_page = MAX_PAGE[curboard[0].lower()]\n'try:\\n last_page = int(response.selector.xpath(\\'//nav/a[@class=\"PageNavNext\"]/following::...
<|body_start_0|> assert isinstance(response, scrapy.http.response.html.HtmlResponse) curboard = response.selector.xpath('//div[contains(@class, "titleBar")]/h1/text()').extract() last_page = MAX_PAGE[curboard[0].lower()] 'try:\n last_page = int(response.selector.xpath(\'//nav/...
scrape reports from angling addicts forum
worldseafishingReportsSpider
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class worldseafishingReportsSpider: """scrape reports from angling addicts forum""" def parse(self, response): """generate links to pages in a board yields: https://www.worldseafishing.com/forums/forums/south-east-catch-reports.39/, ...""" <|body_0|> def crawl_board_threads(se...
stack_v2_sparse_classes_36k_train_011199
9,045
no_license
[ { "docstring": "generate links to pages in a board yields: https://www.worldseafishing.com/forums/forums/south-east-catch-reports.39/, ...", "name": "parse", "signature": "def parse(self, response)" }, { "docstring": "crawl", "name": "crawl_board_threads", "signature": "def crawl_board_t...
3
stack_v2_sparse_classes_30k_train_007859
Implement the Python class `worldseafishingReportsSpider` described below. Class description: scrape reports from angling addicts forum Method signatures and docstrings: - def parse(self, response): generate links to pages in a board yields: https://www.worldseafishing.com/forums/forums/south-east-catch-reports.39/, ...
Implement the Python class `worldseafishingReportsSpider` described below. Class description: scrape reports from angling addicts forum Method signatures and docstrings: - def parse(self, response): generate links to pages in a board yields: https://www.worldseafishing.com/forums/forums/south-east-catch-reports.39/, ...
9123aa6baf538b662143b9098d963d55165e8409
<|skeleton|> class worldseafishingReportsSpider: """scrape reports from angling addicts forum""" def parse(self, response): """generate links to pages in a board yields: https://www.worldseafishing.com/forums/forums/south-east-catch-reports.39/, ...""" <|body_0|> def crawl_board_threads(se...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class worldseafishingReportsSpider: """scrape reports from angling addicts forum""" def parse(self, response): """generate links to pages in a board yields: https://www.worldseafishing.com/forums/forums/south-east-catch-reports.39/, ...""" assert isinstance(response, scrapy.http.response.html.H...
the_stack_v2_python_sparse
imgscrape/spiders/worldseafishing_reports.py
gmonkman/python
train
0