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
2e0a284678a344763d16d6ed8100887908ec4bdc
[ "self.data = []\nif data is not None:\n if type(data) != list:\n raise TypeError('data must be a list')\n if len(data) < 2:\n raise ValueError('data must contain multiple values')\n self.lambtha = sum(data) / len(data)\nelif lambtha >= 1:\n self.lambtha = float(lambtha)\nelse:\n raise V...
<|body_start_0|> self.data = [] if data is not None: if type(data) != list: raise TypeError('data must be a list') if len(data) < 2: raise ValueError('data must contain multiple values') self.lambtha = sum(data) / len(data) elif...
This class is to represent a poisson distribution
Poisson
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Poisson: """This class is to represent a poisson distribution""" def __init__(self, data=None, lambtha=1.0): """All begins here""" <|body_0|> def pmf(self, k): """Method to calculate the pmf""" <|body_1|> def cdf(self, k): """This method calc...
stack_v2_sparse_classes_36k_train_009300
1,386
permissive
[ { "docstring": "All begins here", "name": "__init__", "signature": "def __init__(self, data=None, lambtha=1.0)" }, { "docstring": "Method to calculate the pmf", "name": "pmf", "signature": "def pmf(self, k)" }, { "docstring": "This method calculates the CDF", "name": "cdf", ...
3
null
Implement the Python class `Poisson` described below. Class description: This class is to represent a poisson distribution Method signatures and docstrings: - def __init__(self, data=None, lambtha=1.0): All begins here - def pmf(self, k): Method to calculate the pmf - def cdf(self, k): This method calculates the CDF
Implement the Python class `Poisson` described below. Class description: This class is to represent a poisson distribution Method signatures and docstrings: - def __init__(self, data=None, lambtha=1.0): All begins here - def pmf(self, k): Method to calculate the pmf - def cdf(self, k): This method calculates the CDF ...
58c367f3014919f95157426121093b9fe14d4035
<|skeleton|> class Poisson: """This class is to represent a poisson distribution""" def __init__(self, data=None, lambtha=1.0): """All begins here""" <|body_0|> def pmf(self, k): """Method to calculate the pmf""" <|body_1|> def cdf(self, k): """This method calc...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Poisson: """This class is to represent a poisson distribution""" def __init__(self, data=None, lambtha=1.0): """All begins here""" self.data = [] if data is not None: if type(data) != list: raise TypeError('data must be a list') if len(data)...
the_stack_v2_python_sparse
math/0x03-probability/poisson.py
linkem97/holbertonschool-machine_learning
train
0
e3e95ab004a4190267d621f5ef244f71697dd8e8
[ "try:\n user_type_data = UserType.query.filter(UserType.id == user_type_id).first()\n if not user_type_data:\n raise UserTypeObjectNotFound('Users type with this id does not exit')\n result = user_type_schema.dump(user_type_data)\n logger.info('Response for get with id request for user type {}'.f...
<|body_start_0|> try: user_type_data = UserType.query.filter(UserType.id == user_type_id).first() if not user_type_data: raise UserTypeObjectNotFound('Users type with this id does not exit') result = user_type_schema.dump(user_type_data) logger.inf...
UserTypeResourceId
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserTypeResourceId: def get(self, user_type_id): """This is GET API Call this api passing a user type id parameters: id:int user_type: string responses: 404: description: User type with this id does not exist 200: description: Users type with this id return successfully schema: UserTypeS...
stack_v2_sparse_classes_36k_train_009301
25,221
no_license
[ { "docstring": "This is GET API Call this api passing a user type id parameters: id:int user_type: string responses: 404: description: User type with this id does not exist 200: description: Users type with this id return successfully schema: UserTypeSchema", "name": "get", "signature": "def get(self, u...
2
stack_v2_sparse_classes_30k_train_014864
Implement the Python class `UserTypeResourceId` described below. Class description: Implement the UserTypeResourceId class. Method signatures and docstrings: - def get(self, user_type_id): This is GET API Call this api passing a user type id parameters: id:int user_type: string responses: 404: description: User type ...
Implement the Python class `UserTypeResourceId` described below. Class description: Implement the UserTypeResourceId class. Method signatures and docstrings: - def get(self, user_type_id): This is GET API Call this api passing a user type id parameters: id:int user_type: string responses: 404: description: User type ...
b6bc7dc48d27e843a5d0d3657952464ad4707471
<|skeleton|> class UserTypeResourceId: def get(self, user_type_id): """This is GET API Call this api passing a user type id parameters: id:int user_type: string responses: 404: description: User type with this id does not exist 200: description: Users type with this id return successfully schema: UserTypeS...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserTypeResourceId: def get(self, user_type_id): """This is GET API Call this api passing a user type id parameters: id:int user_type: string responses: 404: description: User type with this id does not exist 200: description: Users type with this id return successfully schema: UserTypeSchema""" ...
the_stack_v2_python_sparse
app/views/user.py
pyarati/bank-system
train
0
530e55664d24765897171f933fc13463793da4b7
[ "self._backend = subprocess.Popen(['python', 'backend.py'], stdout=subprocess.PIPE)\nsubprocess.Popen(['./frontend/node_modules/.bin/electron', './frontend'])\nself._noised = noised\nself._left_eye_gaze = np.array([0, -1, 0])\nself._right_eye_gaze = np.array([0, -1, 0])\nself._plane = np.array([0.0, 1.0, 0.0, -100....
<|body_start_0|> self._backend = subprocess.Popen(['python', 'backend.py'], stdout=subprocess.PIPE) subprocess.Popen(['./frontend/node_modules/.bin/electron', './frontend']) self._noised = noised self._left_eye_gaze = np.array([0, -1, 0]) self._right_eye_gaze = np.array([0, -1, 0...
A watcher representation of visual debug predictor :ivar _backend: (subprocess.Popen), backend for debug predictor :ivar _noised: (bool), whether noising of gaze vectors is needed :ivar _left_eye_gaze: (np.ndarray, shape [3]), left eye gaze vector :ivar _right_eye_gaze: (np.ndarray, shape [3]), right eye gaze vector :i...
VisualDebugPredictor
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VisualDebugPredictor: """A watcher representation of visual debug predictor :ivar _backend: (subprocess.Popen), backend for debug predictor :ivar _noised: (bool), whether noising of gaze vectors is needed :ivar _left_eye_gaze: (np.ndarray, shape [3]), left eye gaze vector :ivar _right_eye_gaze: (...
stack_v2_sparse_classes_36k_train_009302
6,279
permissive
[ { "docstring": "Construct object Constructor runs both backend and frontend subprocess Backend can't be run in a thread as gevent(zerorpc) doesn't like threads :param noised: whether to noise the predicted gaze vectors and fake landmarks", "name": "__init__", "signature": "def __init__(self, noised: boo...
3
stack_v2_sparse_classes_30k_train_015683
Implement the Python class `VisualDebugPredictor` described below. Class description: A watcher representation of visual debug predictor :ivar _backend: (subprocess.Popen), backend for debug predictor :ivar _noised: (bool), whether noising of gaze vectors is needed :ivar _left_eye_gaze: (np.ndarray, shape [3]), left e...
Implement the Python class `VisualDebugPredictor` described below. Class description: A watcher representation of visual debug predictor :ivar _backend: (subprocess.Popen), backend for debug predictor :ivar _noised: (bool), whether noising of gaze vectors is needed :ivar _left_eye_gaze: (np.ndarray, shape [3]), left e...
2b4a15b95b4e1f2e9e8c7359416747fd4d26d4a9
<|skeleton|> class VisualDebugPredictor: """A watcher representation of visual debug predictor :ivar _backend: (subprocess.Popen), backend for debug predictor :ivar _noised: (bool), whether noising of gaze vectors is needed :ivar _left_eye_gaze: (np.ndarray, shape [3]), left eye gaze vector :ivar _right_eye_gaze: (...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VisualDebugPredictor: """A watcher representation of visual debug predictor :ivar _backend: (subprocess.Popen), backend for debug predictor :ivar _noised: (bool), whether noising of gaze vectors is needed :ivar _left_eye_gaze: (np.ndarray, shape [3]), left eye gaze vector :ivar _right_eye_gaze: (np.ndarray, s...
the_stack_v2_python_sparse
watcher/predictor_module/visual_debug_predictor.py
framaz/eye_control
train
3
5de6bd2a4c10705121b1334a795e857450d708bb
[ "self.type = self.__class__.__name__\nself.name = name\nself.hardwareComm = hardwareComm\nself.modelLock = modelLock", "self.modelLock.Acquire()\npReturn1 = pGetFunction(False)\nself.modelLock.Release()\nreturn pReturn1", "self.modelLock.Acquire()\npReturn1, pReturn2 = pGetFunction(False)\nself.modelLock.Releas...
<|body_start_0|> self.type = self.__class__.__name__ self.name = name self.hardwareComm = hardwareComm self.modelLock = modelLock <|end_body_0|> <|body_start_1|> self.modelLock.Acquire() pReturn1 = pGetFunction(False) self.modelLock.Release() return pRetu...
ComponentModel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ComponentModel: def __init__(self, name, hardwareComm, modelLock): """ComponentModel base class constructor""" <|body_0|> def protectedReturn1(self, pGetFunction): """Returns the value of the variable as protected by the model lock""" <|body_1|> def prot...
stack_v2_sparse_classes_36k_train_009303
1,492
no_license
[ { "docstring": "ComponentModel base class constructor", "name": "__init__", "signature": "def __init__(self, name, hardwareComm, modelLock)" }, { "docstring": "Returns the value of the variable as protected by the model lock", "name": "protectedReturn1", "signature": "def protectedReturn...
5
null
Implement the Python class `ComponentModel` described below. Class description: Implement the ComponentModel class. Method signatures and docstrings: - def __init__(self, name, hardwareComm, modelLock): ComponentModel base class constructor - def protectedReturn1(self, pGetFunction): Returns the value of the variable...
Implement the Python class `ComponentModel` described below. Class description: Implement the ComponentModel class. Method signatures and docstrings: - def __init__(self, name, hardwareComm, modelLock): ComponentModel base class constructor - def protectedReturn1(self, pGetFunction): Returns the value of the variable...
c6954ca0fff935ce1eb8154744f6307743765dc5
<|skeleton|> class ComponentModel: def __init__(self, name, hardwareComm, modelLock): """ComponentModel base class constructor""" <|body_0|> def protectedReturn1(self, pGetFunction): """Returns the value of the variable as protected by the model lock""" <|body_1|> def prot...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ComponentModel: def __init__(self, name, hardwareComm, modelLock): """ComponentModel base class constructor""" self.type = self.__class__.__name__ self.name = name self.hardwareComm = hardwareComm self.modelLock = modelLock def protectedReturn1(self, pGetFunction):...
the_stack_v2_python_sparse
server/core/ComponentModel.py
henryeherman/elixys
train
1
19840523d2f4b992ef7ad6aacf8518ed7d68d3b6
[ "if not nums or len(nums) < 1:\n return -1\nnum_set = set()\nfor ele in nums:\n if ele in num_set:\n num_set.remove(ele)\n else:\n num_set.add(ele)\nreturn num_set.pop()", "if not nums or len(nums) < 1:\n return -1\nres = nums[0]\nfor i in range(1, len(nums)):\n res ^= nums[i]\nreturn...
<|body_start_0|> if not nums or len(nums) < 1: return -1 num_set = set() for ele in nums: if ele in num_set: num_set.remove(ele) else: num_set.add(ele) return num_set.pop() <|end_body_0|> <|body_start_1|> if not...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def single_number(self, nums: List[int]) -> int: """求只出现一次的数字 Args: nums: 数组 Returns: 数字""" <|body_0|> def single_number2(self, nums: List[int]) -> int: """求只出现一次的数字 Args: nums: 数组 Returns: 数字""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_009304
1,924
permissive
[ { "docstring": "求只出现一次的数字 Args: nums: 数组 Returns: 数字", "name": "single_number", "signature": "def single_number(self, nums: List[int]) -> int" }, { "docstring": "求只出现一次的数字 Args: nums: 数组 Returns: 数字", "name": "single_number2", "signature": "def single_number2(self, nums: List[int]) -> in...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def single_number(self, nums: List[int]) -> int: 求只出现一次的数字 Args: nums: 数组 Returns: 数字 - def single_number2(self, nums: List[int]) -> int: 求只出现一次的数字 Args: nums: 数组 Returns: 数字
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def single_number(self, nums: List[int]) -> int: 求只出现一次的数字 Args: nums: 数组 Returns: 数字 - def single_number2(self, nums: List[int]) -> int: 求只出现一次的数字 Args: nums: 数组 Returns: 数字 <|...
50f35eef6a0ad63173efed10df3c835b1dceaa3f
<|skeleton|> class Solution: def single_number(self, nums: List[int]) -> int: """求只出现一次的数字 Args: nums: 数组 Returns: 数字""" <|body_0|> def single_number2(self, nums: List[int]) -> int: """求只出现一次的数字 Args: nums: 数组 Returns: 数字""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def single_number(self, nums: List[int]) -> int: """求只出现一次的数字 Args: nums: 数组 Returns: 数字""" if not nums or len(nums) < 1: return -1 num_set = set() for ele in nums: if ele in num_set: num_set.remove(ele) else: ...
the_stack_v2_python_sparse
src/leetcodepython/array/single_number_136.py
zhangyu345293721/leetcode
train
101
508e92b584dbf04c6df9b34c38bc0776801c8f68
[ "text = ''\nshortened = False\nif self.abstract:\n text = self.abstract\nelif self.description:\n for block in json.loads(self.description)['data']:\n if block.get('type') == 'text':\n data = block['data']\n if len(data['text']) > settings.ABSTRACT_LENGTH:\n trimmed...
<|body_start_0|> text = '' shortened = False if self.abstract: text = self.abstract elif self.description: for block in json.loads(self.description)['data']: if block.get('type') == 'text': data = block['data'] ...
Adds the abstract_html method. Assumes the object has an abstract and description field, where the description field is sir-trevor json. Also assumes that the object has a primary_url method (for the read-more link).
AbstractHTMLMixin
[ "CC0-1.0", "MIT", "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AbstractHTMLMixin: """Adds the abstract_html method. Assumes the object has an abstract and description field, where the description field is sir-trevor json. Also assumes that the object has a primary_url method (for the read-more link).""" def abstract_plaintext(self, include_shortened=Fal...
stack_v2_sparse_classes_36k_train_009305
24,965
permissive
[ { "docstring": "If an explicit abstract is present, return it. Otherwise, return the first paragraph of the description", "name": "abstract_plaintext", "signature": "def abstract_plaintext(self, include_shortened=False)" }, { "docstring": "Take the plaintext and run it through a sir trevor templ...
2
stack_v2_sparse_classes_30k_train_017521
Implement the Python class `AbstractHTMLMixin` described below. Class description: Adds the abstract_html method. Assumes the object has an abstract and description field, where the description field is sir-trevor json. Also assumes that the object has a primary_url method (for the read-more link). Method signatures ...
Implement the Python class `AbstractHTMLMixin` described below. Class description: Adds the abstract_html method. Assumes the object has an abstract and description field, where the description field is sir-trevor json. Also assumes that the object has a primary_url method (for the read-more link). Method signatures ...
840c451eff415ebc57203bfeca55409131e9ab05
<|skeleton|> class AbstractHTMLMixin: """Adds the abstract_html method. Assumes the object has an abstract and description field, where the description field is sir-trevor json. Also assumes that the object has a primary_url method (for the read-more link).""" def abstract_plaintext(self, include_shortened=Fal...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AbstractHTMLMixin: """Adds the abstract_html method. Assumes the object has an abstract and description field, where the description field is sir-trevor json. Also assumes that the object has a primary_url method (for the read-more link).""" def abstract_plaintext(self, include_shortened=False): ...
the_stack_v2_python_sparse
peacecorps/peacecorps/models.py
forumone/peacecorps-site
train
1
b484fffff2d6e59801407c6b9567f02f3ef51272
[ "print('==== Test Edit Distance Recursive ====')\nstr1 = 'sunday'\nstr2 = 'saturday'\nprint('Given strs: {} and {}'.format(str1, str2))\nresult = edit_distance_rec(str1, str2, len(str1), len(str2))\nprint('Need to perform {} operations', result)\nself.assertEqual(result, 3)\nstr1 = ''\nstr2 = 'test'\nprint('Given s...
<|body_start_0|> print('==== Test Edit Distance Recursive ====') str1 = 'sunday' str2 = 'saturday' print('Given strs: {} and {}'.format(str1, str2)) result = edit_distance_rec(str1, str2, len(str1), len(str2)) print('Need to perform {} operations', result) self.as...
Test cases for Edit Distance
TestEditDistance
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestEditDistance: """Test cases for Edit Distance""" def test_edit_distance_rec(self): """Test Edit Distance Recursive""" <|body_0|> def test_edit_distance_dp(self): """Test Edit Distance DP""" <|body_1|> <|end_skeleton|> <|body_start_0|> print(...
stack_v2_sparse_classes_36k_train_009306
5,036
no_license
[ { "docstring": "Test Edit Distance Recursive", "name": "test_edit_distance_rec", "signature": "def test_edit_distance_rec(self)" }, { "docstring": "Test Edit Distance DP", "name": "test_edit_distance_dp", "signature": "def test_edit_distance_dp(self)" } ]
2
null
Implement the Python class `TestEditDistance` described below. Class description: Test cases for Edit Distance Method signatures and docstrings: - def test_edit_distance_rec(self): Test Edit Distance Recursive - def test_edit_distance_dp(self): Test Edit Distance DP
Implement the Python class `TestEditDistance` described below. Class description: Test cases for Edit Distance Method signatures and docstrings: - def test_edit_distance_rec(self): Test Edit Distance Recursive - def test_edit_distance_dp(self): Test Edit Distance DP <|skeleton|> class TestEditDistance: """Test c...
74007a5ef4f8b0a7a1416dcc65eeeab3504792b4
<|skeleton|> class TestEditDistance: """Test cases for Edit Distance""" def test_edit_distance_rec(self): """Test Edit Distance Recursive""" <|body_0|> def test_edit_distance_dp(self): """Test Edit Distance DP""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestEditDistance: """Test cases for Edit Distance""" def test_edit_distance_rec(self): """Test Edit Distance Recursive""" print('==== Test Edit Distance Recursive ====') str1 = 'sunday' str2 = 'saturday' print('Given strs: {} and {}'.format(str1, str2)) res...
the_stack_v2_python_sparse
python/dynamic_programming/edit_distance/edit_distance.py
ktp-forked-repos/algorithms-8
train
0
182f83363a5447abdefea693b2c65c64e712ca04
[ "if action is not None:\n raise APIError(422, 'Action must be None')\nif session_id is None:\n filter_data = dict(self.request.arguments)\n self.success(get_all_session_dicts(self.session, filter_data))\nelse:\n try:\n self.success(Session.get_by_id(self.session, session_id))\n except exceptio...
<|body_start_0|> if action is not None: raise APIError(422, 'Action must be None') if session_id is None: filter_data = dict(self.request.arguments) self.success(get_all_session_dicts(self.session, filter_data)) else: try: self.succ...
Handles OWTF sessions.
OWTFSessionHandler
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OWTFSessionHandler: """Handles OWTF sessions.""" def get(self, session_id=None, action=None): """Get all registered sessions. **Example request**: .. sourcecode:: http GET /api/v1/sessions/ HTTP/1.1 Accept: application/json, text/javascript, */*; q=0.01 X-Requested-With: XMLHttpReque...
stack_v2_sparse_classes_36k_train_009307
5,183
permissive
[ { "docstring": "Get all registered sessions. **Example request**: .. sourcecode:: http GET /api/v1/sessions/ HTTP/1.1 Accept: application/json, text/javascript, */*; q=0.01 X-Requested-With: XMLHttpRequest **Example response**: .. sourcecode:: http HTTP/1.1 200 OK Content-Type: application/json { \"status\": \"...
4
null
Implement the Python class `OWTFSessionHandler` described below. Class description: Handles OWTF sessions. Method signatures and docstrings: - def get(self, session_id=None, action=None): Get all registered sessions. **Example request**: .. sourcecode:: http GET /api/v1/sessions/ HTTP/1.1 Accept: application/json, te...
Implement the Python class `OWTFSessionHandler` described below. Class description: Handles OWTF sessions. Method signatures and docstrings: - def get(self, session_id=None, action=None): Get all registered sessions. **Example request**: .. sourcecode:: http GET /api/v1/sessions/ HTTP/1.1 Accept: application/json, te...
240825989a3850241b6b5dba6bcae1042a5dc384
<|skeleton|> class OWTFSessionHandler: """Handles OWTF sessions.""" def get(self, session_id=None, action=None): """Get all registered sessions. **Example request**: .. sourcecode:: http GET /api/v1/sessions/ HTTP/1.1 Accept: application/json, text/javascript, */*; q=0.01 X-Requested-With: XMLHttpReque...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OWTFSessionHandler: """Handles OWTF sessions.""" def get(self, session_id=None, action=None): """Get all registered sessions. **Example request**: .. sourcecode:: http GET /api/v1/sessions/ HTTP/1.1 Accept: application/json, text/javascript, */*; q=0.01 X-Requested-With: XMLHttpRequest **Example ...
the_stack_v2_python_sparse
owtf/api/handlers/session.py
owtf/owtf
train
1,683
7da8491278a244e043ee142a75b55de0b6cfeac1
[ "self.cone = Cone(3, 5)\nself.cube = Cube(3)\nself.cylinder = Cylinder(3, 7)\nself.sphere = Sphere(3)", "attributes = [self.cone, self.cube, self.cylinder, self.sphere]\nvolume = 0\nfor a in attributes:\n volume += a.get_volume()\nreturn round(volume, 2)" ]
<|body_start_0|> self.cone = Cone(3, 5) self.cube = Cube(3) self.cylinder = Cylinder(3, 7) self.sphere = Sphere(3) <|end_body_0|> <|body_start_1|> attributes = [self.cone, self.cube, self.cylinder, self.sphere] volume = 0 for a in attributes: volume +...
Class which generates a facade for computing the weirdly shaped object.
Facade
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Facade: """Class which generates a facade for computing the weirdly shaped object.""" def __init__(self): """Constructor of the Facade class.""" <|body_0|> def get_volume(self): """Method which computes the volume of the weird shape. :return: The volume of the sh...
stack_v2_sparse_classes_36k_train_009308
904
no_license
[ { "docstring": "Constructor of the Facade class.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Method which computes the volume of the weird shape. :return: The volume of the shape.", "name": "get_volume", "signature": "def get_volume(self)" } ]
2
stack_v2_sparse_classes_30k_train_005804
Implement the Python class `Facade` described below. Class description: Class which generates a facade for computing the weirdly shaped object. Method signatures and docstrings: - def __init__(self): Constructor of the Facade class. - def get_volume(self): Method which computes the volume of the weird shape. :return:...
Implement the Python class `Facade` described below. Class description: Class which generates a facade for computing the weirdly shaped object. Method signatures and docstrings: - def __init__(self): Constructor of the Facade class. - def get_volume(self): Method which computes the volume of the weird shape. :return:...
7b3c92c151266cd3ccdd63e7dc0a37f7a60476fa
<|skeleton|> class Facade: """Class which generates a facade for computing the weirdly shaped object.""" def __init__(self): """Constructor of the Facade class.""" <|body_0|> def get_volume(self): """Method which computes the volume of the weird shape. :return: The volume of the sh...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Facade: """Class which generates a facade for computing the weirdly shaped object.""" def __init__(self): """Constructor of the Facade class.""" self.cone = Cone(3, 5) self.cube = Cube(3) self.cylinder = Cylinder(3, 7) self.sphere = Sphere(3) def get_volume(se...
the_stack_v2_python_sparse
Laboratory 9/problem2/facade.py
BabyCakes13/Python-Treasure
train
0
75b91843c83e94bb16740c0dc597e2bfd21f3864
[ "goods_id = request.POST.get('goods_id')\ngoods_lable = request.POST.get('goods_lable')\nu_login_name = request.session.get('u_login_name')\nuser = User.objects.get(u_login_name=u_login_name)\ngoods = Goods.objects.get(g_id=goods_id)\ngl = GoodsLable.objects.filter(gl_lable=goods_lable, gl_goods=goods)\nif len(gl) ...
<|body_start_0|> goods_id = request.POST.get('goods_id') goods_lable = request.POST.get('goods_lable') u_login_name = request.session.get('u_login_name') user = User.objects.get(u_login_name=u_login_name) goods = Goods.objects.get(g_id=goods_id) gl = GoodsLable.objects.fi...
产品标签添加,删除
GoodsLableHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GoodsLableHandler: """产品标签添加,删除""" def post(self, request): """添加""" <|body_0|> def get(self, request): """删除""" <|body_1|> <|end_skeleton|> <|body_start_0|> goods_id = request.POST.get('goods_id') goods_lable = request.POST.get('goods_l...
stack_v2_sparse_classes_36k_train_009309
21,132
no_license
[ { "docstring": "添加", "name": "post", "signature": "def post(self, request)" }, { "docstring": "删除", "name": "get", "signature": "def get(self, request)" } ]
2
null
Implement the Python class `GoodsLableHandler` described below. Class description: 产品标签添加,删除 Method signatures and docstrings: - def post(self, request): 添加 - def get(self, request): 删除
Implement the Python class `GoodsLableHandler` described below. Class description: 产品标签添加,删除 Method signatures and docstrings: - def post(self, request): 添加 - def get(self, request): 删除 <|skeleton|> class GoodsLableHandler: """产品标签添加,删除""" def post(self, request): """添加""" <|body_0|> de...
b6185fe5fb138a5a124e0efc9c266a249cce5459
<|skeleton|> class GoodsLableHandler: """产品标签添加,删除""" def post(self, request): """添加""" <|body_0|> def get(self, request): """删除""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GoodsLableHandler: """产品标签添加,删除""" def post(self, request): """添加""" goods_id = request.POST.get('goods_id') goods_lable = request.POST.get('goods_lable') u_login_name = request.session.get('u_login_name') user = User.objects.get(u_login_name=u_login_name) ...
the_stack_v2_python_sparse
goods/views.py
bingfengxindong/goods_info
train
0
0a2b8318c408ade9c01639129d4bdf4b9e82fe1f
[ "super(Decoder, self).__init__()\nself.N = N\nself.dm = dm\nself.embedding = tf.keras.layers.Embedding(target_vocab, dm)\nself.positional_encoding = positional_encoding(max_seq_len, dm)\nself.blocks = [DecoderBlock(dm, h, hidden, drop_rate) for i in range(N)]\nself.dropout = tf.keras.layers.Dropout(drop_rate)", "...
<|body_start_0|> super(Decoder, self).__init__() self.N = N self.dm = dm self.embedding = tf.keras.layers.Embedding(target_vocab, dm) self.positional_encoding = positional_encoding(max_seq_len, dm) self.blocks = [DecoderBlock(dm, h, hidden, drop_rate) for i in range(N)] ...
create the decoder for a transformer
Decoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Decoder: """create the decoder for a transformer""" def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1): """N - the number of blocks in the encoder dm - the dimensionality of the model h - the number of heads hidden - the number of hidden units in the fully...
stack_v2_sparse_classes_36k_train_009310
3,024
no_license
[ { "docstring": "N - the number of blocks in the encoder dm - the dimensionality of the model h - the number of heads hidden - the number of hidden units in the fully connected layer target_vocab - the size of the target vocabulary max_seq_len - the maximum sequence length possible drop_rate - the dropout rate p...
2
stack_v2_sparse_classes_30k_train_015494
Implement the Python class `Decoder` described below. Class description: create the decoder for a transformer Method signatures and docstrings: - def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1): N - the number of blocks in the encoder dm - the dimensionality of the model h - the number ...
Implement the Python class `Decoder` described below. Class description: create the decoder for a transformer Method signatures and docstrings: - def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1): N - the number of blocks in the encoder dm - the dimensionality of the model h - the number ...
e10b4e9b6f3fa00639e6e9e5b35f0cdb43a339a3
<|skeleton|> class Decoder: """create the decoder for a transformer""" def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1): """N - the number of blocks in the encoder dm - the dimensionality of the model h - the number of heads hidden - the number of hidden units in the fully...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Decoder: """create the decoder for a transformer""" def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1): """N - the number of blocks in the encoder dm - the dimensionality of the model h - the number of heads hidden - the number of hidden units in the fully connected la...
the_stack_v2_python_sparse
supervised_learning/0x11-attention/10-transformer_decoder.py
HeimerR/holbertonschool-machine_learning
train
0
4c11945770efad48978903132ba77619cc967fe3
[ "self.kode_type_field = kode_type_field\nself.kode_tekst_field = kode_tekst_field\nself.navn_field = navn_field\nself.gate_adresse_field = gate_adresse_field\nself.gate_postboks_field = gate_postboks_field\nself.gate_postnr_field = gate_postnr_field\nself.gate_poststed_field = gate_poststed_field\nself.post_adresse...
<|body_start_0|> self.kode_type_field = kode_type_field self.kode_tekst_field = kode_tekst_field self.navn_field = navn_field self.gate_adresse_field = gate_adresse_field self.gate_postboks_field = gate_postboks_field self.gate_postnr_field = gate_postnr_field sel...
Implementation of the 'NavnAdresse' model. TODO: type model description here. Attributes: kode_type_field (string): TODO: type description here. kode_tekst_field (string): TODO: type description here. navn_field (string): TODO: type description here. gate_adresse_field (string): TODO: type description here. gate_postbo...
NavnAdresse
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NavnAdresse: """Implementation of the 'NavnAdresse' model. TODO: type model description here. Attributes: kode_type_field (string): TODO: type description here. kode_tekst_field (string): TODO: type description here. navn_field (string): TODO: type description here. gate_adresse_field (string): T...
stack_v2_sparse_classes_36k_train_009311
4,971
permissive
[ { "docstring": "Constructor for the NavnAdresse class", "name": "__init__", "signature": "def __init__(self, kode_type_field=None, kode_tekst_field=None, navn_field=None, gate_adresse_field=None, gate_postboks_field=None, gate_postnr_field=None, gate_poststed_field=None, post_adresse_field=None, post_po...
2
null
Implement the Python class `NavnAdresse` described below. Class description: Implementation of the 'NavnAdresse' model. TODO: type model description here. Attributes: kode_type_field (string): TODO: type description here. kode_tekst_field (string): TODO: type description here. navn_field (string): TODO: type descripti...
Implement the Python class `NavnAdresse` described below. Class description: Implementation of the 'NavnAdresse' model. TODO: type model description here. Attributes: kode_type_field (string): TODO: type description here. kode_tekst_field (string): TODO: type description here. navn_field (string): TODO: type descripti...
fa3918a6c54ea0eedb9146578645b7eb1755b642
<|skeleton|> class NavnAdresse: """Implementation of the 'NavnAdresse' model. TODO: type model description here. Attributes: kode_type_field (string): TODO: type description here. kode_tekst_field (string): TODO: type description here. navn_field (string): TODO: type description here. gate_adresse_field (string): T...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NavnAdresse: """Implementation of the 'NavnAdresse' model. TODO: type model description here. Attributes: kode_type_field (string): TODO: type description here. kode_tekst_field (string): TODO: type description here. navn_field (string): TODO: type description here. gate_adresse_field (string): TODO: type des...
the_stack_v2_python_sparse
idfy_rest_client/models/navn_adresse.py
dealflowteam/Idfy
train
0
cecd1d3885345eaaa5338945449e39ab49cdf41e
[ "for entry in cls:\n if entry.value.name == category_name:\n return entry\nraise KeyError(category_name)", "for entry in cls:\n if entry.value.code_prefix == prefix:\n return entry\nraise KeyError(prefix)" ]
<|body_start_0|> for entry in cls: if entry.value.name == category_name: return entry raise KeyError(category_name) <|end_body_0|> <|body_start_1|> for entry in cls: if entry.value.code_prefix == prefix: return entry raise KeyError...
All enuemrated error categories.
ErrorCategories
[ "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ErrorCategories: """All enuemrated error categories.""" def by_category_name(cls, category_name: str) -> 'ErrorCategories': """Get a subsystem by its category name.""" <|body_0|> def by_code_prefix(cls, prefix: str) -> 'ErrorCategories': """Get an error category ...
stack_v2_sparse_classes_36k_train_009312
1,687
permissive
[ { "docstring": "Get a subsystem by its category name.", "name": "by_category_name", "signature": "def by_category_name(cls, category_name: str) -> 'ErrorCategories'" }, { "docstring": "Get an error category by its code prefix.", "name": "by_code_prefix", "signature": "def by_code_prefix(...
2
null
Implement the Python class `ErrorCategories` described below. Class description: All enuemrated error categories. Method signatures and docstrings: - def by_category_name(cls, category_name: str) -> 'ErrorCategories': Get a subsystem by its category name. - def by_code_prefix(cls, prefix: str) -> 'ErrorCategories': G...
Implement the Python class `ErrorCategories` described below. Class description: All enuemrated error categories. Method signatures and docstrings: - def by_category_name(cls, category_name: str) -> 'ErrorCategories': Get a subsystem by its category name. - def by_code_prefix(cls, prefix: str) -> 'ErrorCategories': G...
026b523c8c9e5d45910c490efb89194d72595be9
<|skeleton|> class ErrorCategories: """All enuemrated error categories.""" def by_category_name(cls, category_name: str) -> 'ErrorCategories': """Get a subsystem by its category name.""" <|body_0|> def by_code_prefix(cls, prefix: str) -> 'ErrorCategories': """Get an error category ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ErrorCategories: """All enuemrated error categories.""" def by_category_name(cls, category_name: str) -> 'ErrorCategories': """Get a subsystem by its category name.""" for entry in cls: if entry.value.name == category_name: return entry raise KeyError(c...
the_stack_v2_python_sparse
shared-data/python/opentrons_shared_data/errors/categories.py
Opentrons/opentrons
train
326
2d858c32871d5b958dc12f0ec79e92063d6e2c30
[ "if root == None:\n return 0\nmax_sub_depth = 0\nfor node in root.children:\n cur_depth = self.maxDepthWithRecursion(node)\n max_sub_depth = max(cur_depth, max_sub_depth)\nreturn max_sub_depth + 1", "if root == None:\n return 0\nmax_depth = 0\nqueue = []\nqueue.append([root, 1])\nwhile len(queue) > 0:...
<|body_start_0|> if root == None: return 0 max_sub_depth = 0 for node in root.children: cur_depth = self.maxDepthWithRecursion(node) max_sub_depth = max(cur_depth, max_sub_depth) return max_sub_depth + 1 <|end_body_0|> <|body_start_1|> if root...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxDepthWithRecursion(self, root): """:type root: Node :rtype: int""" <|body_0|> def maxDepthWithQueue(self, root): """:type root: Node :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if root == None: return 0 ...
stack_v2_sparse_classes_36k_train_009313
1,003
no_license
[ { "docstring": ":type root: Node :rtype: int", "name": "maxDepthWithRecursion", "signature": "def maxDepthWithRecursion(self, root)" }, { "docstring": ":type root: Node :rtype: int", "name": "maxDepthWithQueue", "signature": "def maxDepthWithQueue(self, root)" } ]
2
stack_v2_sparse_classes_30k_train_003423
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxDepthWithRecursion(self, root): :type root: Node :rtype: int - def maxDepthWithQueue(self, root): :type root: Node :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxDepthWithRecursion(self, root): :type root: Node :rtype: int - def maxDepthWithQueue(self, root): :type root: Node :rtype: int <|skeleton|> class Solution: def maxDe...
176cc1db3291843fb068f06d0180766dd8c3122c
<|skeleton|> class Solution: def maxDepthWithRecursion(self, root): """:type root: Node :rtype: int""" <|body_0|> def maxDepthWithQueue(self, root): """:type root: Node :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxDepthWithRecursion(self, root): """:type root: Node :rtype: int""" if root == None: return 0 max_sub_depth = 0 for node in root.children: cur_depth = self.maxDepthWithRecursion(node) max_sub_depth = max(cur_depth, max_sub_dep...
the_stack_v2_python_sparse
2020/tree/maximum_depth_of_n_ary_tree_559.py
yehongyu/acode
train
0
a61fb6ce4a881c67a866331b46431b13d2597472
[ "hashdict = {}\nfor i in range(len(nums)):\n if nums[i] not in hashdict:\n hashdict[nums[i]] = 1\n else:\n hashdict[nums[i]] += 1\n if hashdict[nums[i]] > len(nums) // 2:\n return nums[i]", "votes = 0\nfor num in nums:\n if votes == 0:\n x = num\n votes += 1 if num == x ...
<|body_start_0|> hashdict = {} for i in range(len(nums)): if nums[i] not in hashdict: hashdict[nums[i]] = 1 else: hashdict[nums[i]] += 1 if hashdict[nums[i]] > len(nums) // 2: return nums[i] <|end_body_0|> <|body_start_...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def majorityElement(self, nums: List[int]) -> int: """寻找数组中出现次数超过数组长度的一半(哈希表法) :param nums: :return: 复杂度分析:时间复杂度O(N)""" <|body_0|> def majorityElementPlus(self, nums: List[int]) -> int: """正负抵消法(摩尔投票法) :param nums: :return: 复杂度分析:时间复杂度O(N),空间复杂度O(1)""" ...
stack_v2_sparse_classes_36k_train_009314
2,387
no_license
[ { "docstring": "寻找数组中出现次数超过数组长度的一半(哈希表法) :param nums: :return: 复杂度分析:时间复杂度O(N)", "name": "majorityElement", "signature": "def majorityElement(self, nums: List[int]) -> int" }, { "docstring": "正负抵消法(摩尔投票法) :param nums: :return: 复杂度分析:时间复杂度O(N),空间复杂度O(1)", "name": "majorityElementPlus", "s...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def majorityElement(self, nums: List[int]) -> int: 寻找数组中出现次数超过数组长度的一半(哈希表法) :param nums: :return: 复杂度分析:时间复杂度O(N) - def majorityElementPlus(self, nums: List[int]) -> int: 正负抵消法(摩...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def majorityElement(self, nums: List[int]) -> int: 寻找数组中出现次数超过数组长度的一半(哈希表法) :param nums: :return: 复杂度分析:时间复杂度O(N) - def majorityElementPlus(self, nums: List[int]) -> int: 正负抵消法(摩...
32941ee052d0985a9569441d314378700ff4d225
<|skeleton|> class Solution: def majorityElement(self, nums: List[int]) -> int: """寻找数组中出现次数超过数组长度的一半(哈希表法) :param nums: :return: 复杂度分析:时间复杂度O(N)""" <|body_0|> def majorityElementPlus(self, nums: List[int]) -> int: """正负抵消法(摩尔投票法) :param nums: :return: 复杂度分析:时间复杂度O(N),空间复杂度O(1)""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def majorityElement(self, nums: List[int]) -> int: """寻找数组中出现次数超过数组长度的一半(哈希表法) :param nums: :return: 复杂度分析:时间复杂度O(N)""" hashdict = {} for i in range(len(nums)): if nums[i] not in hashdict: hashdict[nums[i]] = 1 else: has...
the_stack_v2_python_sparse
cecilia-python/剑指offer/chapter-6/MajorityElement.py
Cecilia520/algorithmic-learning-leetcode
train
7
5252d1b38d382d88a008fe795b8ab33ad96a1bf7
[ "self.err_int = np.zeros(2)\nself.err_d1 = np.zeros(2)\nself.diff_d1 = np.zeros(2)\nself.ctrl_look = control_lookahead\nself.last_closest_idx = 0\nself.t_d1 = 0", "self.err_int = np.zeros(2)\nself.err_d1 = np.zeros(2)\nself.diff_d1 = np.zeros(2)\nself.last_closest_idx = 0\nself.t_d1 = 0", "dist_squared = [(stat...
<|body_start_0|> self.err_int = np.zeros(2) self.err_d1 = np.zeros(2) self.diff_d1 = np.zeros(2) self.ctrl_look = control_lookahead self.last_closest_idx = 0 self.t_d1 = 0 <|end_body_0|> <|body_start_1|> self.err_int = np.zeros(2) self.err_d1 = np.zeros(2...
NNControl
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NNControl: def __init__(self, control_lookahead=50): """Initialization for a neural network controller. Inputs: control_lookahead: Number of points ahead of the previous closest point on the path that the controller looks to find the next closest point. Used to handle paths that cross ba...
stack_v2_sparse_classes_36k_train_009315
9,955
no_license
[ { "docstring": "Initialization for a neural network controller. Inputs: control_lookahead: Number of points ahead of the previous closest point on the path that the controller looks to find the next closest point. Used to handle paths that cross back on themselves.", "name": "__init__", "signature": "de...
3
stack_v2_sparse_classes_30k_train_012737
Implement the Python class `NNControl` described below. Class description: Implement the NNControl class. Method signatures and docstrings: - def __init__(self, control_lookahead=50): Initialization for a neural network controller. Inputs: control_lookahead: Number of points ahead of the previous closest point on the...
Implement the Python class `NNControl` described below. Class description: Implement the NNControl class. Method signatures and docstrings: - def __init__(self, control_lookahead=50): Initialization for a neural network controller. Inputs: control_lookahead: Number of points ahead of the previous closest point on the...
cf864712c4cdb40b252bae3b01a5bd86318d32d2
<|skeleton|> class NNControl: def __init__(self, control_lookahead=50): """Initialization for a neural network controller. Inputs: control_lookahead: Number of points ahead of the previous closest point on the path that the controller looks to find the next closest point. Used to handle paths that cross ba...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NNControl: def __init__(self, control_lookahead=50): """Initialization for a neural network controller. Inputs: control_lookahead: Number of points ahead of the previous closest point on the path that the controller looks to find the next closest point. Used to handle paths that cross back on themselv...
the_stack_v2_python_sparse
src/ego_sim/nn_control.py
zabrock/tractor_trailer_learning_control
train
1
af6cea748f93ed25c5b702539b6858e064e93f8d
[ "Parametre.__init__(self, 'miens', 'mine')\nself.tronquer = True\nself.aide_courte = 'affiche vos familiers'\nself.aide_longue = 'Cette commande affiche la liste de vos familiers et donne un aperçu du lieu où ils se trouvent, ainsi que de leur condition (faim et soif).'", "familiers = importeur.familier.familiers...
<|body_start_0|> Parametre.__init__(self, 'miens', 'mine') self.tronquer = True self.aide_courte = 'affiche vos familiers' self.aide_longue = 'Cette commande affiche la liste de vos familiers et donne un aperçu du lieu où ils se trouvent, ainsi que de leur condition (faim et soif).' <|en...
Commande 'familier miens'.
PrmMiens
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PrmMiens: """Commande 'familier miens'.""" def __init__(self): """Constructeur du paramètre""" <|body_0|> def interpreter(self, personnage, dic_masques): """Interprétation du paramètre""" <|body_1|> <|end_skeleton|> <|body_start_0|> Parametre.__...
stack_v2_sparse_classes_36k_train_009316
2,981
permissive
[ { "docstring": "Constructeur du paramètre", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Interprétation du paramètre", "name": "interpreter", "signature": "def interpreter(self, personnage, dic_masques)" } ]
2
null
Implement the Python class `PrmMiens` described below. Class description: Commande 'familier miens'. Method signatures and docstrings: - def __init__(self): Constructeur du paramètre - def interpreter(self, personnage, dic_masques): Interprétation du paramètre
Implement the Python class `PrmMiens` described below. Class description: Commande 'familier miens'. Method signatures and docstrings: - def __init__(self): Constructeur du paramètre - def interpreter(self, personnage, dic_masques): Interprétation du paramètre <|skeleton|> class PrmMiens: """Commande 'familier m...
7e93bff08cdf891352efba587e89c40f3b4a2301
<|skeleton|> class PrmMiens: """Commande 'familier miens'.""" def __init__(self): """Constructeur du paramètre""" <|body_0|> def interpreter(self, personnage, dic_masques): """Interprétation du paramètre""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PrmMiens: """Commande 'familier miens'.""" def __init__(self): """Constructeur du paramètre""" Parametre.__init__(self, 'miens', 'mine') self.tronquer = True self.aide_courte = 'affiche vos familiers' self.aide_longue = 'Cette commande affiche la liste de vos famil...
the_stack_v2_python_sparse
src/secondaires/familier/commandes/familier/miens.py
vincent-lg/tsunami
train
5
d20646d560e273c3e86319dd707e4e97cd063a68
[ "l = len(matrix)\ndp_row = [[0] * l for _ in range(l)]\ndp_col = [[0] * l for _ in range(l)]\nfor i in range(l):\n for j in range(l):\n if matrix[i][j] == 0:\n dp_row[i][j] = dp_row[i][j - 1] + 1\n dp_col[i][j] = dp_col[i - 1][j] + 1\nres = []\nfor i in range(l - 1, -1, -1):\n for...
<|body_start_0|> l = len(matrix) dp_row = [[0] * l for _ in range(l)] dp_col = [[0] * l for _ in range(l)] for i in range(l): for j in range(l): if matrix[i][j] == 0: dp_row[i][j] = dp_row[i][j - 1] + 1 dp_col[i][j] = dp...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findSquare(self, matrix): """:type matrix: List[List[int]] :rtype: List[int]""" <|body_0|> def findSquare_2(self, matrix): """实现找到最大的边为全0的方阵,看做卷积运算,但是会超时 :type matrix: List[List[int]] :rtype: List[int]""" <|body_1|> def findSquare_3(self, m...
stack_v2_sparse_classes_36k_train_009317
4,012
no_license
[ { "docstring": ":type matrix: List[List[int]] :rtype: List[int]", "name": "findSquare", "signature": "def findSquare(self, matrix)" }, { "docstring": "实现找到最大的边为全0的方阵,看做卷积运算,但是会超时 :type matrix: List[List[int]] :rtype: List[int]", "name": "findSquare_2", "signature": "def findSquare_2(self...
3
stack_v2_sparse_classes_30k_train_013715
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findSquare(self, matrix): :type matrix: List[List[int]] :rtype: List[int] - def findSquare_2(self, matrix): 实现找到最大的边为全0的方阵,看做卷积运算,但是会超时 :type matrix: List[List[int]] :rtype: ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findSquare(self, matrix): :type matrix: List[List[int]] :rtype: List[int] - def findSquare_2(self, matrix): 实现找到最大的边为全0的方阵,看做卷积运算,但是会超时 :type matrix: List[List[int]] :rtype: ...
64bc823e2a7325f36d09fd282b13da56962d8218
<|skeleton|> class Solution: def findSquare(self, matrix): """:type matrix: List[List[int]] :rtype: List[int]""" <|body_0|> def findSquare_2(self, matrix): """实现找到最大的边为全0的方阵,看做卷积运算,但是会超时 :type matrix: List[List[int]] :rtype: List[int]""" <|body_1|> def findSquare_3(self, m...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findSquare(self, matrix): """:type matrix: List[List[int]] :rtype: List[int]""" l = len(matrix) dp_row = [[0] * l for _ in range(l)] dp_col = [[0] * l for _ in range(l)] for i in range(l): for j in range(l): if matrix[i][j] == 0...
the_stack_v2_python_sparse
LCCI/0928M最大黑方阵.py
Kittyuzu1207/Leecode
train
0
6b9562f55aa4a283e035d02af087d05e4496be3c
[ "idx = {element: i for i, element in enumerate(inorder)}\n\ndef build(preorder_left, preorder_right, inorder_left, inorder_right: int) -> TreeNode:\n \"\"\"递归构造树。\"\"\"\n if preorder_left > preorder_right:\n return None\n root = TreeNode(preorder[preorder_left])\n inorder_root = idx[root.val]\n ...
<|body_start_0|> idx = {element: i for i, element in enumerate(inorder)} def build(preorder_left, preorder_right, inorder_left, inorder_right: int) -> TreeNode: """递归构造树。""" if preorder_left > preorder_right: return None root = TreeNode(preorder[preor...
OfficialSolution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OfficialSolution: def build_tree(self, preorder: List[int], inorder: List[int]) -> TreeNode: """递归。""" <|body_0|> def build_tree_2(self, preorder: List[int], inorder: List[int]) -> TreeNode: """递归。""" <|body_1|> <|end_skeleton|> <|body_start_0|> idx...
stack_v2_sparse_classes_36k_train_009318
4,140
no_license
[ { "docstring": "递归。", "name": "build_tree", "signature": "def build_tree(self, preorder: List[int], inorder: List[int]) -> TreeNode" }, { "docstring": "递归。", "name": "build_tree_2", "signature": "def build_tree_2(self, preorder: List[int], inorder: List[int]) -> TreeNode" } ]
2
stack_v2_sparse_classes_30k_test_000746
Implement the Python class `OfficialSolution` described below. Class description: Implement the OfficialSolution class. Method signatures and docstrings: - def build_tree(self, preorder: List[int], inorder: List[int]) -> TreeNode: 递归。 - def build_tree_2(self, preorder: List[int], inorder: List[int]) -> TreeNode: 递归。
Implement the Python class `OfficialSolution` described below. Class description: Implement the OfficialSolution class. Method signatures and docstrings: - def build_tree(self, preorder: List[int], inorder: List[int]) -> TreeNode: 递归。 - def build_tree_2(self, preorder: List[int], inorder: List[int]) -> TreeNode: 递归。 ...
6932d69353b94ec824dd0ddc86a92453f6673232
<|skeleton|> class OfficialSolution: def build_tree(self, preorder: List[int], inorder: List[int]) -> TreeNode: """递归。""" <|body_0|> def build_tree_2(self, preorder: List[int], inorder: List[int]) -> TreeNode: """递归。""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OfficialSolution: def build_tree(self, preorder: List[int], inorder: List[int]) -> TreeNode: """递归。""" idx = {element: i for i, element in enumerate(inorder)} def build(preorder_left, preorder_right, inorder_left, inorder_right: int) -> TreeNode: """递归构造树。""" i...
the_stack_v2_python_sparse
0105_construct-binary-tree-from-preorder-and-inorder-traversal.py
Nigirimeshi/leetcode
train
0
8cd43400e78b46ffa3a79e55e717553345d60e3e
[ "super(ListGroupConfigTest, cls).setUpClass()\ngc_name = rand_name('t_sg')\ncls.gc_name = gc_name\ncls.gc_max_entities = 10\ncls.gc_metadata = {'gc_meta_key_1': 'gc_meta_value_1', 'gc_meta_key_2': 'gc_meta_value_2'}\ncreate_resp = cls.autoscale_behaviors.create_scaling_group_given(gc_name=cls.gc_name, gc_max_entiti...
<|body_start_0|> super(ListGroupConfigTest, cls).setUpClass() gc_name = rand_name('t_sg') cls.gc_name = gc_name cls.gc_max_entities = 10 cls.gc_metadata = {'gc_meta_key_1': 'gc_meta_value_1', 'gc_meta_key_2': 'gc_meta_value_2'} create_resp = cls.autoscale_behaviors.create...
Verify list group config.
ListGroupConfigTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ListGroupConfigTest: """Verify list group config.""" def setUpClass(cls): """Create a scaling group with given data.""" <|body_0|> def test_list_group_config_response(self): """Verify the list group config for response code 200, headers and data""" <|body...
stack_v2_sparse_classes_36k_train_009319
2,842
permissive
[ { "docstring": "Create a scaling group with given data.", "name": "setUpClass", "signature": "def setUpClass(cls)" }, { "docstring": "Verify the list group config for response code 200, headers and data", "name": "test_list_group_config_response", "signature": "def test_list_group_config...
2
null
Implement the Python class `ListGroupConfigTest` described below. Class description: Verify list group config. Method signatures and docstrings: - def setUpClass(cls): Create a scaling group with given data. - def test_list_group_config_response(self): Verify the list group config for response code 200, headers and d...
Implement the Python class `ListGroupConfigTest` described below. Class description: Verify list group config. Method signatures and docstrings: - def setUpClass(cls): Create a scaling group with given data. - def test_list_group_config_response(self): Verify the list group config for response code 200, headers and d...
7199cdd67255fe116dbcbedea660c13453671134
<|skeleton|> class ListGroupConfigTest: """Verify list group config.""" def setUpClass(cls): """Create a scaling group with given data.""" <|body_0|> def test_list_group_config_response(self): """Verify the list group config for response code 200, headers and data""" <|body...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ListGroupConfigTest: """Verify list group config.""" def setUpClass(cls): """Create a scaling group with given data.""" super(ListGroupConfigTest, cls).setUpClass() gc_name = rand_name('t_sg') cls.gc_name = gc_name cls.gc_max_entities = 10 cls.gc_metadata =...
the_stack_v2_python_sparse
autoscale_cloudroast/test_repo/autoscale/functional/scaling_group/test_list_group_config.py
rackerlabs/otter
train
20
bb92a5de04c7aed4e2d94ac334c4478d328a9290
[ "def dfs(pos: int, isLimit: bool, pre1: int, pre2: int):\n if pos == n:\n if not isLimit:\n yield path\n return\n lower = ords[pos] if isLimit else 97\n for cur in range(lower, 97 + k):\n if cur == pre1 or cur == pre2:\n continue\n path.append(cur)\n ...
<|body_start_0|> def dfs(pos: int, isLimit: bool, pre1: int, pre2: int): if pos == n: if not isLimit: yield path return lower = ords[pos] if isLimit else 97 for cur in range(lower, 97 + k): if cur == pre1 or ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def smallestBeautifulString1(self, s: str, k: int) -> str: """生成器dfs返回路径.""" <|body_0|> def smallestBeautifulString2(self, s: str, k: int) -> str: """!返回bool的dfs返回路径.""" <|body_1|> <|end_skeleton|> <|body_start_0|> def dfs(pos: int, isLimi...
stack_v2_sparse_classes_36k_train_009320
1,921
no_license
[ { "docstring": "生成器dfs返回路径.", "name": "smallestBeautifulString1", "signature": "def smallestBeautifulString1(self, s: str, k: int) -> str" }, { "docstring": "!返回bool的dfs返回路径.", "name": "smallestBeautifulString2", "signature": "def smallestBeautifulString2(self, s: str, k: int) -> str" ...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def smallestBeautifulString1(self, s: str, k: int) -> str: 生成器dfs返回路径. - def smallestBeautifulString2(self, s: str, k: int) -> str: !返回bool的dfs返回路径.
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def smallestBeautifulString1(self, s: str, k: int) -> str: 生成器dfs返回路径. - def smallestBeautifulString2(self, s: str, k: int) -> str: !返回bool的dfs返回路径. <|skeleton|> class Solution:...
7e79e26bb8f641868561b186e34c1127ed63c9e0
<|skeleton|> class Solution: def smallestBeautifulString1(self, s: str, k: int) -> str: """生成器dfs返回路径.""" <|body_0|> def smallestBeautifulString2(self, s: str, k: int) -> str: """!返回bool的dfs返回路径.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def smallestBeautifulString1(self, s: str, k: int) -> str: """生成器dfs返回路径.""" def dfs(pos: int, isLimit: bool, pre1: int, pre2: int): if pos == n: if not isLimit: yield path return lower = ords[pos] if isLimit...
the_stack_v2_python_sparse
7_graph/dfs/yield与返回bool的dfs.py
981377660LMT/algorithm-study
train
225
f93d2d62001fe3b076cf0568b99d910a5cfd5f1f
[ "super().__init__(apply_sd, apply_ls, apply_svls, apply_mask, class_weights, edge_weight)\nself.alpha = alpha\nself.beta = beta\nself.eps = 1e-08", "num_classes = yhat.shape[1]\ntarget_one_hot = tensor_one_hot(target, n_classes=num_classes)\nyhat_soft = F.softmax(yhat, dim=1)\nassert target_one_hot.shape == yhat....
<|body_start_0|> super().__init__(apply_sd, apply_ls, apply_svls, apply_mask, class_weights, edge_weight) self.alpha = alpha self.beta = beta self.eps = 1e-08 <|end_body_0|> <|body_start_1|> num_classes = yhat.shape[1] target_one_hot = tensor_one_hot(target, n_classes=nu...
TverskyLoss
[ "MIT", "Apache-2.0", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TverskyLoss: def __init__(self, alpha: float=0.7, beta: float=0.3, apply_sd: bool=False, apply_ls: bool=False, apply_svls: bool=False, apply_mask: bool=False, edge_weight: float=None, class_weights: torch.Tensor=None, **kwargs) -> None: """Tversky loss. https://arxiv.org/abs/1706.05721 P...
stack_v2_sparse_classes_36k_train_009321
3,889
permissive
[ { "docstring": "Tversky loss. https://arxiv.org/abs/1706.05721 Parameters ---------- alpha : float, default=0.7 False positive dice coefficient. beta : float, default=0.3 False negative tanimoto coefficient. apply_sd : bool, default=False If True, Spectral decoupling regularization will be applied to the loss m...
2
null
Implement the Python class `TverskyLoss` described below. Class description: Implement the TverskyLoss class. Method signatures and docstrings: - def __init__(self, alpha: float=0.7, beta: float=0.3, apply_sd: bool=False, apply_ls: bool=False, apply_svls: bool=False, apply_mask: bool=False, edge_weight: float=None, c...
Implement the Python class `TverskyLoss` described below. Class description: Implement the TverskyLoss class. Method signatures and docstrings: - def __init__(self, alpha: float=0.7, beta: float=0.3, apply_sd: bool=False, apply_ls: bool=False, apply_svls: bool=False, apply_mask: bool=False, edge_weight: float=None, c...
7f79405012eb934b419bbdba8de23f35e840ca85
<|skeleton|> class TverskyLoss: def __init__(self, alpha: float=0.7, beta: float=0.3, apply_sd: bool=False, apply_ls: bool=False, apply_svls: bool=False, apply_mask: bool=False, edge_weight: float=None, class_weights: torch.Tensor=None, **kwargs) -> None: """Tversky loss. https://arxiv.org/abs/1706.05721 P...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TverskyLoss: def __init__(self, alpha: float=0.7, beta: float=0.3, apply_sd: bool=False, apply_ls: bool=False, apply_svls: bool=False, apply_mask: bool=False, edge_weight: float=None, class_weights: torch.Tensor=None, **kwargs) -> None: """Tversky loss. https://arxiv.org/abs/1706.05721 Parameters ----...
the_stack_v2_python_sparse
cellseg_models_pytorch/losses/criterions/tversky.py
okunator/cellseg_models.pytorch
train
43
047e4b34e9fae618860b4f3cd3a0abca271a8852
[ "if sort:\n self.ls = sorted(ls)\nelse:\n self.ls = ls", "_verification(max_length)\ntotal = []\nwhile len(line) > 0:\n word = line[-max_length:]\n while not binary_search(self.ls, word):\n if len(word) == 1:\n break\n else:\n word = word[1:]\n total.append(word)...
<|body_start_0|> if sort: self.ls = sorted(ls) else: self.ls = ls <|end_body_0|> <|body_start_1|> _verification(max_length) total = [] while len(line) > 0: word = line[-max_length:] while not binary_search(self.ls, word): ...
RMMA(Reverse Maximum Matching Algorithms)逆向最大匹配算法 >>> r = RMMA(ls=['我们', '野生', '动物园', '在野'], sort=True) >>> print(r.cut('我们在野生动物园玩', 3)) >>> # ['我们', '在', '野生', '动物园', '玩']
RMMA
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RMMA: """RMMA(Reverse Maximum Matching Algorithms)逆向最大匹配算法 >>> r = RMMA(ls=['我们', '野生', '动物园', '在野'], sort=True) >>> print(r.cut('我们在野生动物园玩', 3)) >>> # ['我们', '在', '野生', '动物园', '玩']""" def __init__(self, ls, sort=False): """逆向最大匹配算法、匹配的词典 :param ls: 词典 :param sort: 是否要排序""" <...
stack_v2_sparse_classes_36k_train_009322
4,714
permissive
[ { "docstring": "逆向最大匹配算法、匹配的词典 :param ls: 词典 :param sort: 是否要排序", "name": "__init__", "signature": "def __init__(self, ls, sort=False)" }, { "docstring": "输入一行字符串,最大按照max_length拆分", "name": "cut", "signature": "def cut(self, line, max_length)" } ]
2
null
Implement the Python class `RMMA` described below. Class description: RMMA(Reverse Maximum Matching Algorithms)逆向最大匹配算法 >>> r = RMMA(ls=['我们', '野生', '动物园', '在野'], sort=True) >>> print(r.cut('我们在野生动物园玩', 3)) >>> # ['我们', '在', '野生', '动物园', '玩'] Method signatures and docstrings: - def __init__(self, ls, sort=False): 逆向最...
Implement the Python class `RMMA` described below. Class description: RMMA(Reverse Maximum Matching Algorithms)逆向最大匹配算法 >>> r = RMMA(ls=['我们', '野生', '动物园', '在野'], sort=True) >>> print(r.cut('我们在野生动物园玩', 3)) >>> # ['我们', '在', '野生', '动物园', '玩'] Method signatures and docstrings: - def __init__(self, ls, sort=False): 逆向最...
5a584cbf12d644b6c4fb13167d8841a383afbbac
<|skeleton|> class RMMA: """RMMA(Reverse Maximum Matching Algorithms)逆向最大匹配算法 >>> r = RMMA(ls=['我们', '野生', '动物园', '在野'], sort=True) >>> print(r.cut('我们在野生动物园玩', 3)) >>> # ['我们', '在', '野生', '动物园', '玩']""" def __init__(self, ls, sort=False): """逆向最大匹配算法、匹配的词典 :param ls: 词典 :param sort: 是否要排序""" <...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RMMA: """RMMA(Reverse Maximum Matching Algorithms)逆向最大匹配算法 >>> r = RMMA(ls=['我们', '野生', '动物园', '在野'], sort=True) >>> print(r.cut('我们在野生动物园玩', 3)) >>> # ['我们', '在', '野生', '动物园', '玩']""" def __init__(self, ls, sort=False): """逆向最大匹配算法、匹配的词典 :param ls: 词典 :param sort: 是否要排序""" if sort: ...
the_stack_v2_python_sparse
jtyoui/algorithm/MatchingAlgorithm.py
liangxioa/Jtyoui
train
1
f9b176409c00bb8ca3ffbd7bacc04d90a5ffcee8
[ "super(Powerup, self).__init__()\nself.image = powerup_img\nself.rect = self.image.get_rect()\nself.rect.center = pos\nself.is_targeted = False\nself.boost = 2", "enemy.max_health *= self.boost\nenemy.health = enemy.max_health\nenemy.speed *= self.boost * 0.7\nenemy.width = int(enemy.width * 1.5)\nenemy.height = ...
<|body_start_0|> super(Powerup, self).__init__() self.image = powerup_img self.rect = self.image.get_rect() self.rect.center = pos self.is_targeted = False self.boost = 2 <|end_body_0|> <|body_start_1|> enemy.max_health *= self.boost enemy.health = enemy....
Powerup
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Powerup: def __init__(self, pos): """:param pos: position.""" <|body_0|> def power_up(self, enemy): """Increases attributes :return: none""" <|body_1|> <|end_skeleton|> <|body_start_0|> super(Powerup, self).__init__() self.image = powerup_im...
stack_v2_sparse_classes_36k_train_009323
1,094
no_license
[ { "docstring": ":param pos: position.", "name": "__init__", "signature": "def __init__(self, pos)" }, { "docstring": "Increases attributes :return: none", "name": "power_up", "signature": "def power_up(self, enemy)" } ]
2
stack_v2_sparse_classes_30k_train_017940
Implement the Python class `Powerup` described below. Class description: Implement the Powerup class. Method signatures and docstrings: - def __init__(self, pos): :param pos: position. - def power_up(self, enemy): Increases attributes :return: none
Implement the Python class `Powerup` described below. Class description: Implement the Powerup class. Method signatures and docstrings: - def __init__(self, pos): :param pos: position. - def power_up(self, enemy): Increases attributes :return: none <|skeleton|> class Powerup: def __init__(self, pos): ""...
4f31b24565ac817ae95c5ca4ccb247a9ae18044e
<|skeleton|> class Powerup: def __init__(self, pos): """:param pos: position.""" <|body_0|> def power_up(self, enemy): """Increases attributes :return: none""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Powerup: def __init__(self, pos): """:param pos: position.""" super(Powerup, self).__init__() self.image = powerup_img self.rect = self.image.get_rect() self.rect.center = pos self.is_targeted = False self.boost = 2 def power_up(self, enemy): ...
the_stack_v2_python_sparse
enemies/powerboost.py
marikb/Tower-Defense
train
0
d6028db352bbaef9708738b26faeb7faec8a9523
[ "argument_group.add_argument('--analysis', metavar='PLUGIN_LIST', dest='analysis_plugins', default='', action='store', type=str, help='A comma separated list of analysis plugin names to be loaded or \"--analysis list\" to see a list of available plugins.')\narguments = sys.argv[1:]\nargument_index = 0\nif '--analys...
<|body_start_0|> argument_group.add_argument('--analysis', metavar='PLUGIN_LIST', dest='analysis_plugins', default='', action='store', type=str, help='A comma separated list of analysis plugin names to be loaded or "--analysis list" to see a list of available plugins.') arguments = sys.argv[1:] ...
Analysis plugins CLI arguments helper.
AnalysisPluginsArgumentsHelper
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AnalysisPluginsArgumentsHelper: """Analysis plugins CLI arguments helper.""" def AddArguments(cls, argument_group): """Adds command line arguments to an argument group. This function takes an argument parser or an argument group object and adds to it all the command line arguments th...
stack_v2_sparse_classes_36k_train_009324
2,915
permissive
[ { "docstring": "Adds command line arguments to an argument group. This function takes an argument parser or an argument group object and adds to it all the command line arguments this helper supports. Args: argument_group (argparse._ArgumentGroup|argparse.ArgumentParser): argparse group.", "name": "AddArgum...
2
null
Implement the Python class `AnalysisPluginsArgumentsHelper` described below. Class description: Analysis plugins CLI arguments helper. Method signatures and docstrings: - def AddArguments(cls, argument_group): Adds command line arguments to an argument group. This function takes an argument parser or an argument grou...
Implement the Python class `AnalysisPluginsArgumentsHelper` described below. Class description: Analysis plugins CLI arguments helper. Method signatures and docstrings: - def AddArguments(cls, argument_group): Adds command line arguments to an argument group. This function takes an argument parser or an argument grou...
d6022f8cfebfddf2d08ab2d300a41b61f3349933
<|skeleton|> class AnalysisPluginsArgumentsHelper: """Analysis plugins CLI arguments helper.""" def AddArguments(cls, argument_group): """Adds command line arguments to an argument group. This function takes an argument parser or an argument group object and adds to it all the command line arguments th...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AnalysisPluginsArgumentsHelper: """Analysis plugins CLI arguments helper.""" def AddArguments(cls, argument_group): """Adds command line arguments to an argument group. This function takes an argument parser or an argument group object and adds to it all the command line arguments this helper sup...
the_stack_v2_python_sparse
plaso/cli/helpers/analysis_plugins.py
log2timeline/plaso
train
1,506
b39acc61a426fa92e15cd14488f9e111d19ac575
[ "self.i = i\nself.neighbours = neighbours\nself.weights = weights\nself.dimension = dimension\nself.draw = draw_function", "xyz = []\nfor i in range(self.dimension):\n xyz.append(index % length)\n index = index // length\nreturn xyz", "for i in range(len(xyz)):\n if xyz[i] - nxyz[i] == length - 1:\n ...
<|body_start_0|> self.i = i self.neighbours = neighbours self.weights = weights self.dimension = dimension self.draw = draw_function <|end_body_0|> <|body_start_1|> xyz = [] for i in range(self.dimension): xyz.append(index % length) index ...
Site in a nD lattice
Site
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Site: """Site in a nD lattice""" def __init__(self, i, neighbours, weights, dimension=3, draw_function=None): """Create neighbours and links""" <|body_0|> def convert_to_xyz(self, index, length): """Convert index to [x, y, z] coordinates :index: Int :length: Int ...
stack_v2_sparse_classes_36k_train_009325
3,698
no_license
[ { "docstring": "Create neighbours and links", "name": "__init__", "signature": "def __init__(self, i, neighbours, weights, dimension=3, draw_function=None)" }, { "docstring": "Convert index to [x, y, z] coordinates :index: Int :length: Int - system size :returns: 1xd array of ints", "name": ...
5
stack_v2_sparse_classes_30k_train_016320
Implement the Python class `Site` described below. Class description: Site in a nD lattice Method signatures and docstrings: - def __init__(self, i, neighbours, weights, dimension=3, draw_function=None): Create neighbours and links - def convert_to_xyz(self, index, length): Convert index to [x, y, z] coordinates :ind...
Implement the Python class `Site` described below. Class description: Site in a nD lattice Method signatures and docstrings: - def __init__(self, i, neighbours, weights, dimension=3, draw_function=None): Create neighbours and links - def convert_to_xyz(self, index, length): Convert index to [x, y, z] coordinates :ind...
56f41e405226e69512067ad2e55409ff644b25d9
<|skeleton|> class Site: """Site in a nD lattice""" def __init__(self, i, neighbours, weights, dimension=3, draw_function=None): """Create neighbours and links""" <|body_0|> def convert_to_xyz(self, index, length): """Convert index to [x, y, z] coordinates :index: Int :length: Int ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Site: """Site in a nD lattice""" def __init__(self, i, neighbours, weights, dimension=3, draw_function=None): """Create neighbours and links""" self.i = i self.neighbours = neighbours self.weights = weights self.dimension = dimension self.draw = draw_functi...
the_stack_v2_python_sparse
cpp/pyplot/helpers/site.py
srydell/thesis
train
0
200f93291966cf9ba8d037ad0ca377c1088525ab
[ "self.card_game = []\nfor i in range(2, 15):\n for j in range(0, 4):\n self.card_game.append((i, j))\n j += 1\n i += 1", "name_dict = {11: 'Jack', 12: 'Lady', 13: 'King', 14: 'Ace'}\nname = name_dict.get(card[0], card[0])\ncolor_dict = {0: 'Spades', 1: 'Clover', 2: 'Diamond', 3: 'Heart'}\ncolo...
<|body_start_0|> self.card_game = [] for i in range(2, 15): for j in range(0, 4): self.card_game.append((i, j)) j += 1 i += 1 <|end_body_0|> <|body_start_1|> name_dict = {11: 'Jack', 12: 'Lady', 13: 'King', 14: 'Ace'} name = name_d...
Definition of the Cardgame class with the following methods: constructor, card_name, shuffle, choose_card, choose_card_randomly
Cardgame
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Cardgame: """Definition of the Cardgame class with the following methods: constructor, card_name, shuffle, choose_card, choose_card_randomly""" def __init__(self): """Creates a list of 52 tuples, each tuples represent a card of the game (height & color)""" <|body_0|> def...
stack_v2_sparse_classes_36k_train_009326
4,269
no_license
[ { "docstring": "Creates a list of 52 tuples, each tuples represent a card of the game (height & color)", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Receive a tuple descriptor (for instance (14, 3)) & displays the card name: its heigth and color ('Ace of Spades' here...
5
null
Implement the Python class `Cardgame` described below. Class description: Definition of the Cardgame class with the following methods: constructor, card_name, shuffle, choose_card, choose_card_randomly Method signatures and docstrings: - def __init__(self): Creates a list of 52 tuples, each tuples represent a card of...
Implement the Python class `Cardgame` described below. Class description: Definition of the Cardgame class with the following methods: constructor, card_name, shuffle, choose_card, choose_card_randomly Method signatures and docstrings: - def __init__(self): Creates a list of 52 tuples, each tuples represent a card of...
e858542dd20a7454db462854ba736c4dfca2b267
<|skeleton|> class Cardgame: """Definition of the Cardgame class with the following methods: constructor, card_name, shuffle, choose_card, choose_card_randomly""" def __init__(self): """Creates a list of 52 tuples, each tuples represent a card of the game (height & color)""" <|body_0|> def...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Cardgame: """Definition of the Cardgame class with the following methods: constructor, card_name, shuffle, choose_card, choose_card_randomly""" def __init__(self): """Creates a list of 52 tuples, each tuples represent a card of the game (height & color)""" self.card_game = [] for ...
the_stack_v2_python_sparse
12.07.card_game.py
obrunet/Apprendre-a-programmer-Python3
train
0
761d059bc51ee29c9b235411e3002479972c7202
[ "adm = ProjectAdministration()\nproj = adm.get_project_by_id(project_id)\nreturn proj", "adm = ProjectAdministration()\nproj = adm.get_project_by_id(project_id)\nif proj is not None:\n adm.delete_project(proj)\n return ('gelöscht', 200)\nelse:\n return ('', 500)" ]
<|body_start_0|> adm = ProjectAdministration() proj = adm.get_project_by_id(project_id) return proj <|end_body_0|> <|body_start_1|> adm = ProjectAdministration() proj = adm.get_project_by_id(project_id) if proj is not None: adm.delete_project(proj) ...
ProjectOperations
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProjectOperations: def get(self, project_id): """Auslesen eines bestimmten Project-Objektes, welches durch die project_id in dem URI bestimmt wird.""" <|body_0|> def delete(self, project_id): """Löschen eines bestimmten Project-Objektes, welches durch die project_id ...
stack_v2_sparse_classes_36k_train_009327
44,493
no_license
[ { "docstring": "Auslesen eines bestimmten Project-Objektes, welches durch die project_id in dem URI bestimmt wird.", "name": "get", "signature": "def get(self, project_id)" }, { "docstring": "Löschen eines bestimmten Project-Objektes, welches durch die project_id in dem URI bestimmt wird.", ...
2
stack_v2_sparse_classes_30k_train_005264
Implement the Python class `ProjectOperations` described below. Class description: Implement the ProjectOperations class. Method signatures and docstrings: - def get(self, project_id): Auslesen eines bestimmten Project-Objektes, welches durch die project_id in dem URI bestimmt wird. - def delete(self, project_id): Lö...
Implement the Python class `ProjectOperations` described below. Class description: Implement the ProjectOperations class. Method signatures and docstrings: - def get(self, project_id): Auslesen eines bestimmten Project-Objektes, welches durch die project_id in dem URI bestimmt wird. - def delete(self, project_id): Lö...
4b2826225525ae855e15e1174f5cf90466097021
<|skeleton|> class ProjectOperations: def get(self, project_id): """Auslesen eines bestimmten Project-Objektes, welches durch die project_id in dem URI bestimmt wird.""" <|body_0|> def delete(self, project_id): """Löschen eines bestimmten Project-Objektes, welches durch die project_id ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProjectOperations: def get(self, project_id): """Auslesen eines bestimmten Project-Objektes, welches durch die project_id in dem URI bestimmt wird.""" adm = ProjectAdministration() proj = adm.get_project_by_id(project_id) return proj def delete(self, project_id): "...
the_stack_v2_python_sparse
src/main.py
KieserChristian/SW_Praktikum_Gruppe1
train
0
22abae91d16e40cd4140cba7d96af09ef99d678e
[ "self.session = session\nself.auto_commit = auto_commit\nself.readonly = readonly", "if self.readonly:\n stub_out_flush_operation(self.session)\nreturn self.session", "try:\n if traceback is None and self.auto_commit:\n self.session.commit()\nfinally:\n if not self.readonly:\n self.sessio...
<|body_start_0|> self.session = session self.auto_commit = auto_commit self.readonly = readonly <|end_body_0|> <|body_start_1|> if self.readonly: stub_out_flush_operation(self.session) return self.session <|end_body_1|> <|body_start_2|> try: if t...
A scoped session is automatically released.
ScopedSession
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ScopedSession: """A scoped session is automatically released.""" def __init__(self, session, auto_commit=False, readonly=False): """Constructor. Args: session (object): Database session to use scope. auto_commit (bool): Set to true, of commit should automatically happen upon close. r...
stack_v2_sparse_classes_36k_train_009328
4,807
permissive
[ { "docstring": "Constructor. Args: session (object): Database session to use scope. auto_commit (bool): Set to true, of commit should automatically happen upon close. readonly (bool): whether or not the session is read only.", "name": "__init__", "signature": "def __init__(self, session, auto_commit=Fal...
3
stack_v2_sparse_classes_30k_train_016878
Implement the Python class `ScopedSession` described below. Class description: A scoped session is automatically released. Method signatures and docstrings: - def __init__(self, session, auto_commit=False, readonly=False): Constructor. Args: session (object): Database session to use scope. auto_commit (bool): Set to ...
Implement the Python class `ScopedSession` described below. Class description: A scoped session is automatically released. Method signatures and docstrings: - def __init__(self, session, auto_commit=False, readonly=False): Constructor. Args: session (object): Database session to use scope. auto_commit (bool): Set to ...
d4421afa50a17ed47cbebe942044ebab3720e0f5
<|skeleton|> class ScopedSession: """A scoped session is automatically released.""" def __init__(self, session, auto_commit=False, readonly=False): """Constructor. Args: session (object): Database session to use scope. auto_commit (bool): Set to true, of commit should automatically happen upon close. r...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ScopedSession: """A scoped session is automatically released.""" def __init__(self, session, auto_commit=False, readonly=False): """Constructor. Args: session (object): Database session to use scope. auto_commit (bool): Set to true, of commit should automatically happen upon close. readonly (bool...
the_stack_v2_python_sparse
google/cloud/forseti/services/db.py
kevensen/forseti-security
train
1
ae2097b26203423e585052b988fdade692125acd
[ "usePrivateKey = True\nfor prop in self.required_props1:\n if prop not in list(self.properties.keys()):\n usePrivateKey = False\n break\nusePassword = True\nfor prop in self.required_props2:\n if prop not in list(self.properties.keys()):\n usePassword = False\n break\nif not usePri...
<|body_start_0|> usePrivateKey = True for prop in self.required_props1: if prop not in list(self.properties.keys()): usePrivateKey = False break usePassword = True for prop in self.required_props2: if prop not in list(self.propertie...
Class for sending and deleting files and directories via SSH.
SecureSender
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SecureSender: """Class for sending and deleting files and directories via SSH.""" def connect(self): """Initiate an ssh connection with properties passed to constructor. :returns: Instance of the paramiko SSHClient class.""" <|body_0|> def send(self): """Send any...
stack_v2_sparse_classes_36k_train_009329
3,806
permissive
[ { "docstring": "Initiate an ssh connection with properties passed to constructor. :returns: Instance of the paramiko SSHClient class.", "name": "connect", "signature": "def connect(self)" }, { "docstring": "Send any files or folders that have been passed to constructor. :returns: Number of files...
3
stack_v2_sparse_classes_30k_train_003870
Implement the Python class `SecureSender` described below. Class description: Class for sending and deleting files and directories via SSH. Method signatures and docstrings: - def connect(self): Initiate an ssh connection with properties passed to constructor. :returns: Instance of the paramiko SSHClient class. - def...
Implement the Python class `SecureSender` described below. Class description: Class for sending and deleting files and directories via SSH. Method signatures and docstrings: - def connect(self): Initiate an ssh connection with properties passed to constructor. :returns: Instance of the paramiko SSHClient class. - def...
a55f488bbe19c45c6375c7102160dbc0a353d661
<|skeleton|> class SecureSender: """Class for sending and deleting files and directories via SSH.""" def connect(self): """Initiate an ssh connection with properties passed to constructor. :returns: Instance of the paramiko SSHClient class.""" <|body_0|> def send(self): """Send any...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SecureSender: """Class for sending and deleting files and directories via SSH.""" def connect(self): """Initiate an ssh connection with properties passed to constructor. :returns: Instance of the paramiko SSHClient class.""" usePrivateKey = True for prop in self.required_props1: ...
the_stack_v2_python_sparse
shakemap/transfer/securesender.py
kallstadt-usgs/shakemap
train
0
2b7f590ab015531e8afe0c03e8b51a1a512ba500
[ "self.shared_key = shared_key\nself.session_key = session_key\nself.crypto = MessageCrypto(session_key)\nself.auth = MessageAuthenticator(shared_key)", "signed = self.auth.sign(plaintext)\nencrypted = self.crypto.encrypt(signed)\nreturn self.auth.sign(encrypted)", "if self.auth.verify(ciphertext):\n decrypte...
<|body_start_0|> self.shared_key = shared_key self.session_key = session_key self.crypto = MessageCrypto(session_key) self.auth = MessageAuthenticator(shared_key) <|end_body_0|> <|body_start_1|> signed = self.auth.sign(plaintext) encrypted = self.crypto.encrypt(signed) ...
MessageCryptoSystem
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MessageCryptoSystem: def __init__(self, session_key, shared_key): """" Initialize the Message cryptosystem with a 128 byte session key (16 Chars) and a shared key""" <|body_0|> def wrap_message(self, plaintext): """Prepares signed, encrypted, and signed message""" ...
stack_v2_sparse_classes_36k_train_009330
1,027
no_license
[ { "docstring": "\" Initialize the Message cryptosystem with a 128 byte session key (16 Chars) and a shared key", "name": "__init__", "signature": "def __init__(self, session_key, shared_key)" }, { "docstring": "Prepares signed, encrypted, and signed message", "name": "wrap_message", "sig...
3
stack_v2_sparse_classes_30k_train_020042
Implement the Python class `MessageCryptoSystem` described below. Class description: Implement the MessageCryptoSystem class. Method signatures and docstrings: - def __init__(self, session_key, shared_key): " Initialize the Message cryptosystem with a 128 byte session key (16 Chars) and a shared key - def wrap_messag...
Implement the Python class `MessageCryptoSystem` described below. Class description: Implement the MessageCryptoSystem class. Method signatures and docstrings: - def __init__(self, session_key, shared_key): " Initialize the Message cryptosystem with a 128 byte session key (16 Chars) and a shared key - def wrap_messag...
ca31e06e94f4325045f7066f78a4af57b00acab1
<|skeleton|> class MessageCryptoSystem: def __init__(self, session_key, shared_key): """" Initialize the Message cryptosystem with a 128 byte session key (16 Chars) and a shared key""" <|body_0|> def wrap_message(self, plaintext): """Prepares signed, encrypted, and signed message""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MessageCryptoSystem: def __init__(self, session_key, shared_key): """" Initialize the Message cryptosystem with a 128 byte session key (16 Chars) and a shared key""" self.shared_key = shared_key self.session_key = session_key self.crypto = MessageCrypto(session_key) sel...
the_stack_v2_python_sparse
assignment3/MessageCryptoSystem.py
tsiemens/eece-412-group
train
0
761d059bc51ee29c9b235411e3002479972c7202
[ "adm = ProjectAdministration()\nstud = adm.get_student_by_id(student_id)\nreturn stud", "adm = ProjectAdministration()\nstud = adm.get_student_by_id(student_id)\nif stud is not None:\n adm.delete_student(stud)\n return ('gelöscht', 200)\nelse:\n return ('There was no student object with this id', 500)" ]
<|body_start_0|> adm = ProjectAdministration() stud = adm.get_student_by_id(student_id) return stud <|end_body_0|> <|body_start_1|> adm = ProjectAdministration() stud = adm.get_student_by_id(student_id) if stud is not None: adm.delete_student(stud) ...
StudentOperations
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StudentOperations: def get(self, student_id): """Auslesen eines bestimmten Student-Objekts, welches durch die student_id in dem URI bestimmt wird.""" <|body_0|> def delete(self, student_id): """Löschen eines bestimmten Student-Objekts, welches durch die student_id in...
stack_v2_sparse_classes_36k_train_009331
44,493
no_license
[ { "docstring": "Auslesen eines bestimmten Student-Objekts, welches durch die student_id in dem URI bestimmt wird.", "name": "get", "signature": "def get(self, student_id)" }, { "docstring": "Löschen eines bestimmten Student-Objekts, welches durch die student_id in dem URI bestimmt wird.", "n...
2
stack_v2_sparse_classes_30k_train_008220
Implement the Python class `StudentOperations` described below. Class description: Implement the StudentOperations class. Method signatures and docstrings: - def get(self, student_id): Auslesen eines bestimmten Student-Objekts, welches durch die student_id in dem URI bestimmt wird. - def delete(self, student_id): Lös...
Implement the Python class `StudentOperations` described below. Class description: Implement the StudentOperations class. Method signatures and docstrings: - def get(self, student_id): Auslesen eines bestimmten Student-Objekts, welches durch die student_id in dem URI bestimmt wird. - def delete(self, student_id): Lös...
4b2826225525ae855e15e1174f5cf90466097021
<|skeleton|> class StudentOperations: def get(self, student_id): """Auslesen eines bestimmten Student-Objekts, welches durch die student_id in dem URI bestimmt wird.""" <|body_0|> def delete(self, student_id): """Löschen eines bestimmten Student-Objekts, welches durch die student_id in...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StudentOperations: def get(self, student_id): """Auslesen eines bestimmten Student-Objekts, welches durch die student_id in dem URI bestimmt wird.""" adm = ProjectAdministration() stud = adm.get_student_by_id(student_id) return stud def delete(self, student_id): ""...
the_stack_v2_python_sparse
src/main.py
KieserChristian/SW_Praktikum_Gruppe1
train
0
488451854a3c0df8eaf4c34fbf79defc064719fc
[ "self.scorer = UniEvaluator(model_name_or_path='MingZhong/unieval-fact' if model_name_or_path == '' else model_name_or_path, max_length=max_length, device=device, cache_dir=cache_dir)\nself.task = 'fact'\nself.dim = 'consistency'", "n_data = len(data)\neval_scores = [{} for _ in range(n_data)]\nsrc_list, output_l...
<|body_start_0|> self.scorer = UniEvaluator(model_name_or_path='MingZhong/unieval-fact' if model_name_or_path == '' else model_name_or_path, max_length=max_length, device=device, cache_dir=cache_dir) self.task = 'fact' self.dim = 'consistency' <|end_body_0|> <|body_start_1|> n_data = le...
FactEvaluator
[ "BSD-3-Clause", "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0", "BSD-2-Clause", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FactEvaluator: def __init__(self, model_name_or_path, max_length=1024, device='cuda:0', cache_dir=None): """Set up evaluator for factual consistency detection""" <|body_0|> def evaluate(self, data, category): """Get the factual consistency score (only 1 dimension for...
stack_v2_sparse_classes_36k_train_009332
14,573
permissive
[ { "docstring": "Set up evaluator for factual consistency detection", "name": "__init__", "signature": "def __init__(self, model_name_or_path, max_length=1024, device='cuda:0', cache_dir=None)" }, { "docstring": "Get the factual consistency score (only 1 dimension for this task) category: The cat...
2
stack_v2_sparse_classes_30k_train_001530
Implement the Python class `FactEvaluator` described below. Class description: Implement the FactEvaluator class. Method signatures and docstrings: - def __init__(self, model_name_or_path, max_length=1024, device='cuda:0', cache_dir=None): Set up evaluator for factual consistency detection - def evaluate(self, data, ...
Implement the Python class `FactEvaluator` described below. Class description: Implement the FactEvaluator class. Method signatures and docstrings: - def __init__(self, model_name_or_path, max_length=1024, device='cuda:0', cache_dir=None): Set up evaluator for factual consistency detection - def evaluate(self, data, ...
c7b60f75470f067d1342705708810a660eabd684
<|skeleton|> class FactEvaluator: def __init__(self, model_name_or_path, max_length=1024, device='cuda:0', cache_dir=None): """Set up evaluator for factual consistency detection""" <|body_0|> def evaluate(self, data, category): """Get the factual consistency score (only 1 dimension for...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FactEvaluator: def __init__(self, model_name_or_path, max_length=1024, device='cuda:0', cache_dir=None): """Set up evaluator for factual consistency detection""" self.scorer = UniEvaluator(model_name_or_path='MingZhong/unieval-fact' if model_name_or_path == '' else model_name_or_path, max_leng...
the_stack_v2_python_sparse
applications/Chat/evaluate/unieval/evaluator.py
hpcaitech/ColossalAI
train
32,044
a1d398944dcb5b864a09fa55eaa411cafc18b9dc
[ "self.root = root\nself.proc = Popen(cmd, stdout=PIPE, stderr=STDOUT)\nself.root.createfilehandler(self.proc.stdout, tk.READABLE, self.read_output)\nself._var = tk.StringVar()\ntk.Label(root, textvariable=self._var).pack()\ntk.Button(root, text='Stop subprocess', command=self.stop).pack()", "data = os.read(pipe.f...
<|body_start_0|> self.root = root self.proc = Popen(cmd, stdout=PIPE, stderr=STDOUT) self.root.createfilehandler(self.proc.stdout, tk.READABLE, self.read_output) self._var = tk.StringVar() tk.Label(root, textvariable=self._var).pack() tk.Button(root, text='Stop subprocess...
ShowProcessOutputDemo
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ShowProcessOutputDemo: def __init__(self, root): """Start subprocess, make GUI widgets.""" <|body_0|> def read_output(self, pipe, mask): """Read subprocess' output, pass it to the GUI.""" <|body_1|> def stop(self, stopping=[]): """Stop subprocess...
stack_v2_sparse_classes_36k_train_009333
2,778
permissive
[ { "docstring": "Start subprocess, make GUI widgets.", "name": "__init__", "signature": "def __init__(self, root)" }, { "docstring": "Read subprocess' output, pass it to the GUI.", "name": "read_output", "signature": "def read_output(self, pipe, mask)" }, { "docstring": "Stop subp...
3
null
Implement the Python class `ShowProcessOutputDemo` described below. Class description: Implement the ShowProcessOutputDemo class. Method signatures and docstrings: - def __init__(self, root): Start subprocess, make GUI widgets. - def read_output(self, pipe, mask): Read subprocess' output, pass it to the GUI. - def st...
Implement the Python class `ShowProcessOutputDemo` described below. Class description: Implement the ShowProcessOutputDemo class. Method signatures and docstrings: - def __init__(self, root): Start subprocess, make GUI widgets. - def read_output(self, pipe, mask): Read subprocess' output, pass it to the GUI. - def st...
665d39a2bd82543d5196555f0801ef8fd4a3ee48
<|skeleton|> class ShowProcessOutputDemo: def __init__(self, root): """Start subprocess, make GUI widgets.""" <|body_0|> def read_output(self, pipe, mask): """Read subprocess' output, pass it to the GUI.""" <|body_1|> def stop(self, stopping=[]): """Stop subprocess...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ShowProcessOutputDemo: def __init__(self, root): """Start subprocess, make GUI widgets.""" self.root = root self.proc = Popen(cmd, stdout=PIPE, stderr=STDOUT) self.root.createfilehandler(self.proc.stdout, tk.READABLE, self.read_output) self._var = tk.StringVar() ...
the_stack_v2_python_sparse
all-gists/9294978/snippet.py
gistable/gistable
train
76
0affaf83be401729d5f1d3b236cee14e140eb565
[ "project_dir = Path(__file__).resolve().parents[2]\nself._trainset_path = str(project_dir) + '/data/raw/train_set.csv'\nself._testset_path = str(project_dir) + '/data/raw/test_set.csv'\nself._trainset = None\nself._testset = None", "if self._trainset is None:\n self._trainset = self.read_dataset(self._trainset...
<|body_start_0|> project_dir = Path(__file__).resolve().parents[2] self._trainset_path = str(project_dir) + '/data/raw/train_set.csv' self._testset_path = str(project_dir) + '/data/raw/test_set.csv' self._trainset = None self._testset = None <|end_body_0|> <|body_start_1|> ...
Utility class to easily load the datasets for training, development and testing.
Dataset
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Dataset: """Utility class to easily load the datasets for training, development and testing.""" def __init__(self, in_notebook=False): """Defines the basic properties of the dataset reader. Args: language: The language of the dataset. dataset_name: The name of the dataset (all files ...
stack_v2_sparse_classes_36k_train_009334
2,265
no_license
[ { "docstring": "Defines the basic properties of the dataset reader. Args: language: The language of the dataset. dataset_name: The name of the dataset (all files should have it).", "name": "__init__", "signature": "def __init__(self, in_notebook=False)" }, { "docstring": "list. Getter method for...
4
stack_v2_sparse_classes_30k_train_002151
Implement the Python class `Dataset` described below. Class description: Utility class to easily load the datasets for training, development and testing. Method signatures and docstrings: - def __init__(self, in_notebook=False): Defines the basic properties of the dataset reader. Args: language: The language of the d...
Implement the Python class `Dataset` described below. Class description: Utility class to easily load the datasets for training, development and testing. Method signatures and docstrings: - def __init__(self, in_notebook=False): Defines the basic properties of the dataset reader. Args: language: The language of the d...
437d952d3c27d44319b5834d6a467e08d9ccad4c
<|skeleton|> class Dataset: """Utility class to easily load the datasets for training, development and testing.""" def __init__(self, in_notebook=False): """Defines the basic properties of the dataset reader. Args: language: The language of the dataset. dataset_name: The name of the dataset (all files ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Dataset: """Utility class to easily load the datasets for training, development and testing.""" def __init__(self, in_notebook=False): """Defines the basic properties of the dataset reader. Args: language: The language of the dataset. dataset_name: The name of the dataset (all files should have i...
the_stack_v2_python_sparse
src/data/dataset.py
willferreira/Brexit-Corpus-Stance-Classification-Project
train
0
8e554176a3e8736c450e0e4eab0d85346423d7b3
[ "logger.info('Overriding class: Corpus -> SentenceCorpus.')\nsuper(SentenceCorpus, self).__init__(min_frequency=min_frequency)\nif not tokens:\n sentences = loader.load_txt(from_file).splitlines()\n pipe = self._create_tokenizer(corpus_type)\n self.tokens = [pipe(sentence) for sentence in sentences]\nelse:...
<|body_start_0|> logger.info('Overriding class: Corpus -> SentenceCorpus.') super(SentenceCorpus, self).__init__(min_frequency=min_frequency) if not tokens: sentences = loader.load_txt(from_file).splitlines() pipe = self._create_tokenizer(corpus_type) self.tok...
A SentenceCorpus class is used to defined the first step of the workflow. It serves to load the raw sentences, pre-process them and create their tokens and vocabulary.
SentenceCorpus
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SentenceCorpus: """A SentenceCorpus class is used to defined the first step of the workflow. It serves to load the raw sentences, pre-process them and create their tokens and vocabulary.""" def __init__(self, tokens: Optional[List[str]]=None, from_file: Optional[str]=None, corpus_type: Optio...
stack_v2_sparse_classes_36k_train_009335
3,757
permissive
[ { "docstring": "Initialization method. Args: tokens: A list of tokens. from_file: An input file to load the sentences. corpus_type: The desired type to tokenize the sentences. Should be `char` or `word`. min_frequency: Minimum frequency of individual tokens. max_pad_length: Maximum length to pad the tokens. sos...
4
stack_v2_sparse_classes_30k_train_021443
Implement the Python class `SentenceCorpus` described below. Class description: A SentenceCorpus class is used to defined the first step of the workflow. It serves to load the raw sentences, pre-process them and create their tokens and vocabulary. Method signatures and docstrings: - def __init__(self, tokens: Optiona...
Implement the Python class `SentenceCorpus` described below. Class description: A SentenceCorpus class is used to defined the first step of the workflow. It serves to load the raw sentences, pre-process them and create their tokens and vocabulary. Method signatures and docstrings: - def __init__(self, tokens: Optiona...
4b7e7c1b1a304a5b37b21a972c50668e60b7bd7f
<|skeleton|> class SentenceCorpus: """A SentenceCorpus class is used to defined the first step of the workflow. It serves to load the raw sentences, pre-process them and create their tokens and vocabulary.""" def __init__(self, tokens: Optional[List[str]]=None, from_file: Optional[str]=None, corpus_type: Optio...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SentenceCorpus: """A SentenceCorpus class is used to defined the first step of the workflow. It serves to load the raw sentences, pre-process them and create their tokens and vocabulary.""" def __init__(self, tokens: Optional[List[str]]=None, from_file: Optional[str]=None, corpus_type: Optional[str]='cha...
the_stack_v2_python_sparse
nalp/corpus/sentence.py
gugarosa/nalp
train
25
b4aa4e115fe9d3e316c1a8679e0f0cb22ba82cf0
[ "if self.listener.listener_kind == ListenerKind.TEMPERATURE:\n if not self.coordinator.data.user_preferences:\n return None\n if self.coordinator.data.user_preferences.celsius_enabled:\n return UnitOfTemperature.CELSIUS\n return UnitOfTemperature.FAHRENHEIT\nreturn None", "if not self.liste...
<|body_start_0|> if self.listener.listener_kind == ListenerKind.TEMPERATURE: if not self.coordinator.data.user_preferences: return None if self.coordinator.data.user_preferences.celsius_enabled: return UnitOfTemperature.CELSIUS return UnitOfTem...
Define a Notion sensor.
NotionSensor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NotionSensor: """Define a Notion sensor.""" def native_unit_of_measurement(self) -> str | None: """Return the unit of measurement of the sensor.""" <|body_0|> def native_value(self) -> str | None: """Return the value reported by the sensor.""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_009336
3,068
permissive
[ { "docstring": "Return the unit of measurement of the sensor.", "name": "native_unit_of_measurement", "signature": "def native_unit_of_measurement(self) -> str | None" }, { "docstring": "Return the value reported by the sensor.", "name": "native_value", "signature": "def native_value(sel...
2
null
Implement the Python class `NotionSensor` described below. Class description: Define a Notion sensor. Method signatures and docstrings: - def native_unit_of_measurement(self) -> str | None: Return the unit of measurement of the sensor. - def native_value(self) -> str | None: Return the value reported by the sensor.
Implement the Python class `NotionSensor` described below. Class description: Define a Notion sensor. Method signatures and docstrings: - def native_unit_of_measurement(self) -> str | None: Return the unit of measurement of the sensor. - def native_value(self) -> str | None: Return the value reported by the sensor. ...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class NotionSensor: """Define a Notion sensor.""" def native_unit_of_measurement(self) -> str | None: """Return the unit of measurement of the sensor.""" <|body_0|> def native_value(self) -> str | None: """Return the value reported by the sensor.""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NotionSensor: """Define a Notion sensor.""" def native_unit_of_measurement(self) -> str | None: """Return the unit of measurement of the sensor.""" if self.listener.listener_kind == ListenerKind.TEMPERATURE: if not self.coordinator.data.user_preferences: return...
the_stack_v2_python_sparse
homeassistant/components/notion/sensor.py
home-assistant/core
train
35,501
c38fd6ce2c3d7cb7414613c5b16789f4fe2d8031
[ "if len(nums) < 2:\n return len(nums)\n_nums, cnt, result = (sorted(nums), 1, 0)\nfor i in xrange(1, len(_nums)):\n if _nums[i] - _nums[i - 1] == 1:\n cnt += 1\n else:\n result = max(cnt, result)\n cnt = 1\nreturn max(result, cnt)", "nums = set(nums)\nif len(nums) < 2:\n return le...
<|body_start_0|> if len(nums) < 2: return len(nums) _nums, cnt, result = (sorted(nums), 1, 0) for i in xrange(1, len(_nums)): if _nums[i] - _nums[i - 1] == 1: cnt += 1 else: result = max(cnt, result) cnt = 1 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestConsecutive1(self, nums): """:type nums: List[int] :rtype: int 明显超时(NlogN)""" <|body_0|> def longestConsecutive2(self, nums): """:type nums: List[int] :rtype: int unionfind(N)""" <|body_1|> def longestConsecutive(self, nums): ...
stack_v2_sparse_classes_36k_train_009337
2,676
no_license
[ { "docstring": ":type nums: List[int] :rtype: int 明显超时(NlogN)", "name": "longestConsecutive1", "signature": "def longestConsecutive1(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int unionfind(N)", "name": "longestConsecutive2", "signature": "def longestConsecutive2(self,...
3
stack_v2_sparse_classes_30k_train_017973
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestConsecutive1(self, nums): :type nums: List[int] :rtype: int 明显超时(NlogN) - def longestConsecutive2(self, nums): :type nums: List[int] :rtype: int unionfind(N) - def lon...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestConsecutive1(self, nums): :type nums: List[int] :rtype: int 明显超时(NlogN) - def longestConsecutive2(self, nums): :type nums: List[int] :rtype: int unionfind(N) - def lon...
9687f8e743a8b6396fff192f22b5256d1025f86b
<|skeleton|> class Solution: def longestConsecutive1(self, nums): """:type nums: List[int] :rtype: int 明显超时(NlogN)""" <|body_0|> def longestConsecutive2(self, nums): """:type nums: List[int] :rtype: int unionfind(N)""" <|body_1|> def longestConsecutive(self, nums): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def longestConsecutive1(self, nums): """:type nums: List[int] :rtype: int 明显超时(NlogN)""" if len(nums) < 2: return len(nums) _nums, cnt, result = (sorted(nums), 1, 0) for i in xrange(1, len(_nums)): if _nums[i] - _nums[i - 1] == 1: ...
the_stack_v2_python_sparse
2017/array/Longest_Consecutive_Sequence.py
buhuipao/LeetCode
train
5
ed411b57209fc233dd0fa1f6c7e03911fba9efef
[ "if request.args.get('pass_id'):\n data = db.session.query(Staff).get(request.args.get('pass_id'))\n return marshal(data, staff_struct) if data else 'No such staff!'\nelif not request.args:\n data = db.session.query(Staff).all()\n return marshal(data, staff_struct)\nelse:\n return 'Unknown query'", ...
<|body_start_0|> if request.args.get('pass_id'): data = db.session.query(Staff).get(request.args.get('pass_id')) return marshal(data, staff_struct) if data else 'No such staff!' elif not request.args: data = db.session.query(Staff).all() return marshal(dat...
StaffRes
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StaffRes: def get(self): """Get particular staff by pass_id if '?pass_id=' specified or get all staff if not. :return:""" <|body_0|> def post(self): """Add new staff to DB. :return:""" <|body_1|> def delete(self): """Delete staff by pass_id :retu...
stack_v2_sparse_classes_36k_train_009338
2,573
no_license
[ { "docstring": "Get particular staff by pass_id if '?pass_id=' specified or get all staff if not. :return:", "name": "get", "signature": "def get(self)" }, { "docstring": "Add new staff to DB. :return:", "name": "post", "signature": "def post(self)" }, { "docstring": "Delete staf...
4
stack_v2_sparse_classes_30k_train_019637
Implement the Python class `StaffRes` described below. Class description: Implement the StaffRes class. Method signatures and docstrings: - def get(self): Get particular staff by pass_id if '?pass_id=' specified or get all staff if not. :return: - def post(self): Add new staff to DB. :return: - def delete(self): Dele...
Implement the Python class `StaffRes` described below. Class description: Implement the StaffRes class. Method signatures and docstrings: - def get(self): Get particular staff by pass_id if '?pass_id=' specified or get all staff if not. :return: - def post(self): Add new staff to DB. :return: - def delete(self): Dele...
d3759f773f9abc0e917e75c174c28feb7d4a0692
<|skeleton|> class StaffRes: def get(self): """Get particular staff by pass_id if '?pass_id=' specified or get all staff if not. :return:""" <|body_0|> def post(self): """Add new staff to DB. :return:""" <|body_1|> def delete(self): """Delete staff by pass_id :retu...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StaffRes: def get(self): """Get particular staff by pass_id if '?pass_id=' specified or get all staff if not. :return:""" if request.args.get('pass_id'): data = db.session.query(Staff).get(request.args.get('pass_id')) return marshal(data, staff_struct) if data else 'No ...
the_stack_v2_python_sparse
rest_alchemy/staff/routes.py
serhiihoriaiev/common
train
0
1dc26503f6554d6c0d719cfdff42f34119dcb0a6
[ "VapiInterface.__init__(self, config, _CsrStub)\nself._VAPI_OPERATION_IDS = {}\nself._VAPI_OPERATION_IDS.update({'create_task': 'create$task'})\nself._VAPI_OPERATION_IDS.update({'get_task': 'get$task'})", "task_id = self._invoke('create$task', {'cluster': cluster, 'provider': provider})\ntask_svc = Tasks(self._co...
<|body_start_0|> VapiInterface.__init__(self, config, _CsrStub) self._VAPI_OPERATION_IDS = {} self._VAPI_OPERATION_IDS.update({'create_task': 'create$task'}) self._VAPI_OPERATION_IDS.update({'get_task': 'get$task'}) <|end_body_0|> <|body_start_1|> task_id = self._invoke('create$...
The ``Csr`` interface provides methods to create a certificate signing request(CSR). This class was added in vSphere API 7.0.0.
Csr
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Csr: """The ``Csr`` interface provides methods to create a certificate signing request(CSR). This class was added in vSphere API 7.0.0.""" def __init__(self, config): """:type config: :class:`vmware.vapi.bindings.stub.StubConfiguration` :param config: Configuration to be used for cre...
stack_v2_sparse_classes_36k_train_009339
11,504
permissive
[ { "docstring": ":type config: :class:`vmware.vapi.bindings.stub.StubConfiguration` :param config: Configuration to be used for creating the stub.", "name": "__init__", "signature": "def __init__(self, config)" }, { "docstring": "Generate a certificate signing request (CSR) for the client certifi...
3
null
Implement the Python class `Csr` described below. Class description: The ``Csr`` interface provides methods to create a certificate signing request(CSR). This class was added in vSphere API 7.0.0. Method signatures and docstrings: - def __init__(self, config): :type config: :class:`vmware.vapi.bindings.stub.StubConfi...
Implement the Python class `Csr` described below. Class description: The ``Csr`` interface provides methods to create a certificate signing request(CSR). This class was added in vSphere API 7.0.0. Method signatures and docstrings: - def __init__(self, config): :type config: :class:`vmware.vapi.bindings.stub.StubConfi...
c07e1be98615201139b26c28db3aa584c4254b66
<|skeleton|> class Csr: """The ``Csr`` interface provides methods to create a certificate signing request(CSR). This class was added in vSphere API 7.0.0.""" def __init__(self, config): """:type config: :class:`vmware.vapi.bindings.stub.StubConfiguration` :param config: Configuration to be used for cre...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Csr: """The ``Csr`` interface provides methods to create a certificate signing request(CSR). This class was added in vSphere API 7.0.0.""" def __init__(self, config): """:type config: :class:`vmware.vapi.bindings.stub.StubConfiguration` :param config: Configuration to be used for creating the stu...
the_stack_v2_python_sparse
com/vmware/vcenter/trusted_infrastructure/trust_authority_clusters/kms/providers/client_certificate_client.py
adammillerio/vsphere-automation-sdk-python
train
0
5234a2e733c2b76f6f965f4182d2c06044eb665e
[ "super(InvertedResidualSE, self).__init__()\nself.identity = stride == 1 and inp == oup\nself.ir_block = Sequential(ops.Conv2d(inp, hidden_dim, 1, 1, 0, bias=False), ops.BatchNorm2d(hidden_dim, momentum=momentum), ops.Hswish() if use_hs else ops.Relu(inplace=True), ops.Conv2d(hidden_dim, hidden_dim, kernel_size, st...
<|body_start_0|> super(InvertedResidualSE, self).__init__() self.identity = stride == 1 and inp == oup self.ir_block = Sequential(ops.Conv2d(inp, hidden_dim, 1, 1, 0, bias=False), ops.BatchNorm2d(hidden_dim, momentum=momentum), ops.Hswish() if use_hs else ops.Relu(inplace=True), ops.Conv2d(hidde...
This is the class of InvertedResidual with SELayer for MobileNetV3.
InvertedResidualSE
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InvertedResidualSE: """This is the class of InvertedResidual with SELayer for MobileNetV3.""" def __init__(self, inp, hidden_dim, oup, kernel_size, stride, use_se=False, use_hs=False, momentum=0.1): """Init InvertedResidualSE.""" <|body_0|> def __call__(self, x): ...
stack_v2_sparse_classes_36k_train_009340
9,288
permissive
[ { "docstring": "Init InvertedResidualSE.", "name": "__init__", "signature": "def __init__(self, inp, hidden_dim, oup, kernel_size, stride, use_se=False, use_hs=False, momentum=0.1)" }, { "docstring": "Forward compute of InvertedResidualSE.", "name": "__call__", "signature": "def __call__...
2
null
Implement the Python class `InvertedResidualSE` described below. Class description: This is the class of InvertedResidual with SELayer for MobileNetV3. Method signatures and docstrings: - def __init__(self, inp, hidden_dim, oup, kernel_size, stride, use_se=False, use_hs=False, momentum=0.1): Init InvertedResidualSE. ...
Implement the Python class `InvertedResidualSE` described below. Class description: This is the class of InvertedResidual with SELayer for MobileNetV3. Method signatures and docstrings: - def __init__(self, inp, hidden_dim, oup, kernel_size, stride, use_se=False, use_hs=False, momentum=0.1): Init InvertedResidualSE. ...
e4ef3a1c92d19d1d08c3ef0e2156b6fecefdbe04
<|skeleton|> class InvertedResidualSE: """This is the class of InvertedResidual with SELayer for MobileNetV3.""" def __init__(self, inp, hidden_dim, oup, kernel_size, stride, use_se=False, use_hs=False, momentum=0.1): """Init InvertedResidualSE.""" <|body_0|> def __call__(self, x): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InvertedResidualSE: """This is the class of InvertedResidual with SELayer for MobileNetV3.""" def __init__(self, inp, hidden_dim, oup, kernel_size, stride, use_se=False, use_hs=False, momentum=0.1): """Init InvertedResidualSE.""" super(InvertedResidualSE, self).__init__() self.ide...
the_stack_v2_python_sparse
zeus/networks/mobilenetv3.py
huawei-noah/xingtian
train
308
e125a49c19f46b57ecb8d88813ebb87df024a35a
[ "if request.version != 'v1':\n return Response(status=status.HTTP_505_HTTP_VERSION_NOT_SUPPORTED)\nserializer = AccountNotRequiredSerializer(data={}, context={'request': request})\nserializer.is_valid(raise_exception=True)\nreturn Response(data=serializer.data, status=status.HTTP_200_OK)", "if request.version ...
<|body_start_0|> if request.version != 'v1': return Response(status=status.HTTP_505_HTTP_VERSION_NOT_SUPPORTED) serializer = AccountNotRequiredSerializer(data={}, context={'request': request}) serializer.is_valid(raise_exception=True) return Response(data=serializer.data, sta...
Account view.
AccountView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AccountView: """Account view.""" def get(self, request, *args, **kwargs): """GET request.""" <|body_0|> def patch(self, request, *args, **kwargs): """PATCH request.""" <|body_1|> def delete(self, request, *args, **kwargs): """DELETE request."...
stack_v2_sparse_classes_36k_train_009341
6,798
no_license
[ { "docstring": "GET request.", "name": "get", "signature": "def get(self, request, *args, **kwargs)" }, { "docstring": "PATCH request.", "name": "patch", "signature": "def patch(self, request, *args, **kwargs)" }, { "docstring": "DELETE request.", "name": "delete", "signa...
3
stack_v2_sparse_classes_30k_val_001180
Implement the Python class `AccountView` described below. Class description: Account view. Method signatures and docstrings: - def get(self, request, *args, **kwargs): GET request. - def patch(self, request, *args, **kwargs): PATCH request. - def delete(self, request, *args, **kwargs): DELETE request.
Implement the Python class `AccountView` described below. Class description: Account view. Method signatures and docstrings: - def get(self, request, *args, **kwargs): GET request. - def patch(self, request, *args, **kwargs): PATCH request. - def delete(self, request, *args, **kwargs): DELETE request. <|skeleton|> c...
cd8767b5eeaef3a09d77c936781b4126fd8591de
<|skeleton|> class AccountView: """Account view.""" def get(self, request, *args, **kwargs): """GET request.""" <|body_0|> def patch(self, request, *args, **kwargs): """PATCH request.""" <|body_1|> def delete(self, request, *args, **kwargs): """DELETE request."...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AccountView: """Account view.""" def get(self, request, *args, **kwargs): """GET request.""" if request.version != 'v1': return Response(status=status.HTTP_505_HTTP_VERSION_NOT_SUPPORTED) serializer = AccountNotRequiredSerializer(data={}, context={'request': request}) ...
the_stack_v2_python_sparse
api/auths/views.py
ignite7/backproject
train
0
a26659093be29bf01d959ebb83c840f44e33725a
[ "super().__init__()\nself.conditional = conditional\nif self.conditional:\n layer_sizes[0] += num_labels\nself.MLP = nn.Sequential()\nfor i, (in_size, out_size) in enumerate(zip(layer_sizes[:-1], layer_sizes[1:])):\n self.MLP.add_module(name='L{:d}'.format(i), module=nn.Linear(in_size, out_size))\n self.ML...
<|body_start_0|> super().__init__() self.conditional = conditional if self.conditional: layer_sizes[0] += num_labels self.MLP = nn.Sequential() for i, (in_size, out_size) in enumerate(zip(layer_sizes[:-1], layer_sizes[1:])): self.MLP.add_module(name='L{:d}...
Encoder class for CVAE
Encoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Encoder: """Encoder class for CVAE""" def __init__(self, layer_sizes, latent_size, conditional, num_labels): """Initialization""" <|body_0|> def forward(self, x, c=None): """Forward process""" <|body_1|> <|end_skeleton|> <|body_start_0|> super()...
stack_v2_sparse_classes_36k_train_009342
4,298
no_license
[ { "docstring": "Initialization", "name": "__init__", "signature": "def __init__(self, layer_sizes, latent_size, conditional, num_labels)" }, { "docstring": "Forward process", "name": "forward", "signature": "def forward(self, x, c=None)" } ]
2
stack_v2_sparse_classes_30k_train_011442
Implement the Python class `Encoder` described below. Class description: Encoder class for CVAE Method signatures and docstrings: - def __init__(self, layer_sizes, latent_size, conditional, num_labels): Initialization - def forward(self, x, c=None): Forward process
Implement the Python class `Encoder` described below. Class description: Encoder class for CVAE Method signatures and docstrings: - def __init__(self, layer_sizes, latent_size, conditional, num_labels): Initialization - def forward(self, x, c=None): Forward process <|skeleton|> class Encoder: """Encoder class fo...
21c0bf459388bd616a64afc1a34441123b1f41fe
<|skeleton|> class Encoder: """Encoder class for CVAE""" def __init__(self, layer_sizes, latent_size, conditional, num_labels): """Initialization""" <|body_0|> def forward(self, x, c=None): """Forward process""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Encoder: """Encoder class for CVAE""" def __init__(self, layer_sizes, latent_size, conditional, num_labels): """Initialization""" super().__init__() self.conditional = conditional if self.conditional: layer_sizes[0] += num_labels self.MLP = nn.Sequentia...
the_stack_v2_python_sparse
Reconstruction/models/CVAE.py
CHOcho-quan/CS385ML
train
1
c4234a0419a44ee60309840f3ab593a506829a8c
[ "self.k = k\nself.heap = []\nfor n in nums:\n if self.k > 0:\n heappush(self.heap, n)\n self.k -= 1\n else:\n heappushpop(self.heap, n)", "if self.k > 0:\n heappush(self.heap, val)\n self.k -= 1\nelse:\n heappushpop(self.heap, val)\nreturn self.heap[0]" ]
<|body_start_0|> self.k = k self.heap = [] for n in nums: if self.k > 0: heappush(self.heap, n) self.k -= 1 else: heappushpop(self.heap, n) <|end_body_0|> <|body_start_1|> if self.k > 0: heappush(self.he...
KthLargest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" <|body_0|> def add(self, val): """:type val: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.k = k self.heap = [] for n in nums: ...
stack_v2_sparse_classes_36k_train_009343
3,175
no_license
[ { "docstring": ":type k: int :type nums: List[int]", "name": "__init__", "signature": "def __init__(self, k, nums)" }, { "docstring": ":type val: int :rtype: int", "name": "add", "signature": "def add(self, val)" } ]
2
null
Implement the Python class `KthLargest` described below. Class description: Implement the KthLargest class. Method signatures and docstrings: - def __init__(self, k, nums): :type k: int :type nums: List[int] - def add(self, val): :type val: int :rtype: int
Implement the Python class `KthLargest` described below. Class description: Implement the KthLargest class. Method signatures and docstrings: - def __init__(self, k, nums): :type k: int :type nums: List[int] - def add(self, val): :type val: int :rtype: int <|skeleton|> class KthLargest: def __init__(self, k, nu...
b1764cd62e1c8cb062869992d9eaa8b2d2fdf9c2
<|skeleton|> class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" <|body_0|> def add(self, val): """:type val: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" self.k = k self.heap = [] for n in nums: if self.k > 0: heappush(self.heap, n) self.k -= 1 else: heappushpop(self.heap, n) ...
the_stack_v2_python_sparse
leetcode/heap/easy/703. Kth Largest Element in a Stream.py
Hk4Fun/algorithm_offer
train
1
0dc767eede6d702c292036ba8f68b6b17fd85c1a
[ "uid = request._request.uid\ns = LabelCreateSerializer(data=request.data)\ns.is_valid()\nif s.errors:\n return self.error(errorcode.MSG_INVALID_DATA, errorcode.INVALID_DATA)\ntry:\n instance = s.create(s.validated_data)\nexcept:\n return self.error(errorcode.MSG_DB_ERROR, errorcode.DB_ERROR)\ns = LabelCrea...
<|body_start_0|> uid = request._request.uid s = LabelCreateSerializer(data=request.data) s.is_valid() if s.errors: return self.error(errorcode.MSG_INVALID_DATA, errorcode.INVALID_DATA) try: instance = s.create(s.validated_data) except: ...
LabelView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LabelView: def post(self, request): """新建标签""" <|body_0|> def get(self, request): """获取所有顶级标签""" <|body_1|> def delete(self, request): """删除标签,同时删除它与其他标签、文章、问答等的关系""" <|body_2|> def put(self, request): """修改标签""" <|bo...
stack_v2_sparse_classes_36k_train_009344
9,306
no_license
[ { "docstring": "新建标签", "name": "post", "signature": "def post(self, request)" }, { "docstring": "获取所有顶级标签", "name": "get", "signature": "def get(self, request)" }, { "docstring": "删除标签,同时删除它与其他标签、文章、问答等的关系", "name": "delete", "signature": "def delete(self, request)" }, ...
4
stack_v2_sparse_classes_30k_train_008477
Implement the Python class `LabelView` described below. Class description: Implement the LabelView class. Method signatures and docstrings: - def post(self, request): 新建标签 - def get(self, request): 获取所有顶级标签 - def delete(self, request): 删除标签,同时删除它与其他标签、文章、问答等的关系 - def put(self, request): 修改标签
Implement the Python class `LabelView` described below. Class description: Implement the LabelView class. Method signatures and docstrings: - def post(self, request): 新建标签 - def get(self, request): 获取所有顶级标签 - def delete(self, request): 删除标签,同时删除它与其他标签、文章、问答等的关系 - def put(self, request): 修改标签 <|skeleton|> class Label...
6a68fb207f43e5ed65299cc08535b35d5e934ead
<|skeleton|> class LabelView: def post(self, request): """新建标签""" <|body_0|> def get(self, request): """获取所有顶级标签""" <|body_1|> def delete(self, request): """删除标签,同时删除它与其他标签、文章、问答等的关系""" <|body_2|> def put(self, request): """修改标签""" <|bo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LabelView: def post(self, request): """新建标签""" uid = request._request.uid s = LabelCreateSerializer(data=request.data) s.is_valid() if s.errors: return self.error(errorcode.MSG_INVALID_DATA, errorcode.INVALID_DATA) try: instance = s.creat...
the_stack_v2_python_sparse
apps/labels/views.py
Slowhalfframe/fanyijiang-API
train
0
d932241abdb58e727d4f45ecceb80d2e968bbe02
[ "try:\n wish_word = Wish_Word.objects.get(pk=pk)\n serializer = WishWordsSerializer(wish_word, context={'request': request})\n return Response(serializer.data)\nexcept Exception as ex:\n return HttpResponseServerError(ex)", "word_values = self.request.query_params.get('word_values')\nif word_values:\n...
<|body_start_0|> try: wish_word = Wish_Word.objects.get(pk=pk) serializer = WishWordsSerializer(wish_word, context={'request': request}) return Response(serializer.data) except Exception as ex: return HttpResponseServerError(ex) <|end_body_0|> <|body_star...
Wish_Words
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Wish_Words: def retrieve(self, request, pk=None): """Handle GET requests for single word Returns: Response -- JSON serialized word instance""" <|body_0|> def list(self, request): """Handle GET requests to words resource Returns: Response -- JSON serialized list of wo...
stack_v2_sparse_classes_36k_train_009345
2,724
no_license
[ { "docstring": "Handle GET requests for single word Returns: Response -- JSON serialized word instance", "name": "retrieve", "signature": "def retrieve(self, request, pk=None)" }, { "docstring": "Handle GET requests to words resource Returns: Response -- JSON serialized list of words", "name...
3
stack_v2_sparse_classes_30k_train_014675
Implement the Python class `Wish_Words` described below. Class description: Implement the Wish_Words class. Method signatures and docstrings: - def retrieve(self, request, pk=None): Handle GET requests for single word Returns: Response -- JSON serialized word instance - def list(self, request): Handle GET requests to...
Implement the Python class `Wish_Words` described below. Class description: Implement the Wish_Words class. Method signatures and docstrings: - def retrieve(self, request, pk=None): Handle GET requests for single word Returns: Response -- JSON serialized word instance - def list(self, request): Handle GET requests to...
582048dafa7e354fffdc0478ec68088e8bbf42b1
<|skeleton|> class Wish_Words: def retrieve(self, request, pk=None): """Handle GET requests for single word Returns: Response -- JSON serialized word instance""" <|body_0|> def list(self, request): """Handle GET requests to words resource Returns: Response -- JSON serialized list of wo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Wish_Words: def retrieve(self, request, pk=None): """Handle GET requests for single word Returns: Response -- JSON serialized word instance""" try: wish_word = Wish_Word.objects.get(pk=pk) serializer = WishWordsSerializer(wish_word, context={'request': request}) ...
the_stack_v2_python_sparse
genieioapp/views/wish_words.py
cherkesky/GenieIO
train
1
279f0192a9e44244a6febbfa5127f5e402a48c00
[ "self.folder_id = folder_id\nself.public_folder_item_id_list = public_folder_item_id_list\nself.restore_entire_folder = restore_entire_folder", "if dictionary is None:\n return None\nfolder_id = dictionary.get('folderId')\npublic_folder_item_id_list = dictionary.get('publicFolderItemIdList')\nrestore_entire_fo...
<|body_start_0|> self.folder_id = folder_id self.public_folder_item_id_list = public_folder_item_id_list self.restore_entire_folder = restore_entire_folder <|end_body_0|> <|body_start_1|> if dictionary is None: return None folder_id = dictionary.get('folderId') ...
Implementation of the 'PublicFolder' model. Specifies the O365 PublicFolder details. Attributes: folder_id (string): Specifies the unique ID of the folder. public_folder_item_id_list (list of string): Specifies the PublicFolder items within the folder to be restored incase the user wishes not to restore the entire fold...
PublicFolder
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PublicFolder: """Implementation of the 'PublicFolder' model. Specifies the O365 PublicFolder details. Attributes: folder_id (string): Specifies the unique ID of the folder. public_folder_item_id_list (list of string): Specifies the PublicFolder items within the folder to be restored incase the us...
stack_v2_sparse_classes_36k_train_009346
2,185
permissive
[ { "docstring": "Constructor for the PublicFolder class", "name": "__init__", "signature": "def __init__(self, folder_id=None, public_folder_item_id_list=None, restore_entire_folder=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dict...
2
stack_v2_sparse_classes_30k_train_003895
Implement the Python class `PublicFolder` described below. Class description: Implementation of the 'PublicFolder' model. Specifies the O365 PublicFolder details. Attributes: folder_id (string): Specifies the unique ID of the folder. public_folder_item_id_list (list of string): Specifies the PublicFolder items within ...
Implement the Python class `PublicFolder` described below. Class description: Implementation of the 'PublicFolder' model. Specifies the O365 PublicFolder details. Attributes: folder_id (string): Specifies the unique ID of the folder. public_folder_item_id_list (list of string): Specifies the PublicFolder items within ...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class PublicFolder: """Implementation of the 'PublicFolder' model. Specifies the O365 PublicFolder details. Attributes: folder_id (string): Specifies the unique ID of the folder. public_folder_item_id_list (list of string): Specifies the PublicFolder items within the folder to be restored incase the us...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PublicFolder: """Implementation of the 'PublicFolder' model. Specifies the O365 PublicFolder details. Attributes: folder_id (string): Specifies the unique ID of the folder. public_folder_item_id_list (list of string): Specifies the PublicFolder items within the folder to be restored incase the user wishes not...
the_stack_v2_python_sparse
cohesity_management_sdk/models/public_folder.py
cohesity/management-sdk-python
train
24
c7fec254c6fa3a109f6b2b603bca9e8848ce56b5
[ "super().__init__()\nself._img_shape = img_shape\nself.model = torch.nn.Sequential(torch.nn.Linear(latent_dim, 512), torch.nn.LeakyReLU(0.2, inplace=True), torch.nn.Linear(512, 512), torch.nn.BatchNorm1d(512), torch.nn.LeakyReLU(0.2, inplace=True), torch.nn.Linear(512, int(reduce(mul, img_shape, 1))), torch.nn.Tanh...
<|body_start_0|> super().__init__() self._img_shape = img_shape self.model = torch.nn.Sequential(torch.nn.Linear(latent_dim, 512), torch.nn.LeakyReLU(0.2, inplace=True), torch.nn.Linear(512, 512), torch.nn.BatchNorm1d(512), torch.nn.LeakyReLU(0.2, inplace=True), torch.nn.Linear(512, int(reduce(m...
Decodes an already encoded image signal
Decoder
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Decoder: """Decodes an already encoded image signal""" def __init__(self, latent_dim, img_shape): """Parameters ---------- latent_dim : int the size of the latent dimension img_shape : tuple the shape of the input image""" <|body_0|> def forward(self, z): """Feed...
stack_v2_sparse_classes_36k_train_009347
5,204
permissive
[ { "docstring": "Parameters ---------- latent_dim : int the size of the latent dimension img_shape : tuple the shape of the input image", "name": "__init__", "signature": "def __init__(self, latent_dim, img_shape)" }, { "docstring": "Feeds an encoded signal through the network for decoding Parame...
2
stack_v2_sparse_classes_30k_train_015564
Implement the Python class `Decoder` described below. Class description: Decodes an already encoded image signal Method signatures and docstrings: - def __init__(self, latent_dim, img_shape): Parameters ---------- latent_dim : int the size of the latent dimension img_shape : tuple the shape of the input image - def f...
Implement the Python class `Decoder` described below. Class description: Decodes an already encoded image signal Method signatures and docstrings: - def __init__(self, latent_dim, img_shape): Parameters ---------- latent_dim : int the size of the latent dimension img_shape : tuple the shape of the input image - def f...
1078f5030b8aac2bf022daf5fa14d66f74c3c893
<|skeleton|> class Decoder: """Decodes an already encoded image signal""" def __init__(self, latent_dim, img_shape): """Parameters ---------- latent_dim : int the size of the latent dimension img_shape : tuple the shape of the input image""" <|body_0|> def forward(self, z): """Feed...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Decoder: """Decodes an already encoded image signal""" def __init__(self, latent_dim, img_shape): """Parameters ---------- latent_dim : int the size of the latent dimension img_shape : tuple the shape of the input image""" super().__init__() self._img_shape = img_shape sel...
the_stack_v2_python_sparse
dlutils/models/gans/adversarial_autoencoder/models.py
justusschock/dl-utils
train
15
6d7a2eb11cf2f14d3092f0d9a0d0d4afd66740c3
[ "super().__init__()\npadding = int((kSize - 1) / 2)\nself.conv = nn.Conv2d(nIn, nOut, (kSize, kSize), stride=stride, padding=(padding, padding), bias=False)\nself.bn = nn.BatchNorm2d(nOut, eps=0.001)", "output = self.conv(input)\noutput = self.bn(output)\nreturn output" ]
<|body_start_0|> super().__init__() padding = int((kSize - 1) / 2) self.conv = nn.Conv2d(nIn, nOut, (kSize, kSize), stride=stride, padding=(padding, padding), bias=False) self.bn = nn.BatchNorm2d(nOut, eps=0.001) <|end_body_0|> <|body_start_1|> output = self.conv(input) ...
This class groups the convolution and batch normalization
CB
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CB: """This class groups the convolution and batch normalization""" def __init__(self, nIn, nOut, kSize, stride=1): """:param nIn: number of input channels :param nOut: number of output channels :param kSize: kernel size :param stride: optinal stide for down-sampling""" <|bod...
stack_v2_sparse_classes_36k_train_009348
15,567
permissive
[ { "docstring": ":param nIn: number of input channels :param nOut: number of output channels :param kSize: kernel size :param stride: optinal stide for down-sampling", "name": "__init__", "signature": "def __init__(self, nIn, nOut, kSize, stride=1)" }, { "docstring": ":param input: input feature ...
2
null
Implement the Python class `CB` described below. Class description: This class groups the convolution and batch normalization Method signatures and docstrings: - def __init__(self, nIn, nOut, kSize, stride=1): :param nIn: number of input channels :param nOut: number of output channels :param kSize: kernel size :param...
Implement the Python class `CB` described below. Class description: This class groups the convolution and batch normalization Method signatures and docstrings: - def __init__(self, nIn, nOut, kSize, stride=1): :param nIn: number of input channels :param nOut: number of output channels :param kSize: kernel size :param...
f2993d3ce73a2f7ddba05da3891defb08547d504
<|skeleton|> class CB: """This class groups the convolution and batch normalization""" def __init__(self, nIn, nOut, kSize, stride=1): """:param nIn: number of input channels :param nOut: number of output channels :param kSize: kernel size :param stride: optinal stide for down-sampling""" <|bod...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CB: """This class groups the convolution and batch normalization""" def __init__(self, nIn, nOut, kSize, stride=1): """:param nIn: number of input channels :param nOut: number of output channels :param kSize: kernel size :param stride: optinal stide for down-sampling""" super().__init__()...
the_stack_v2_python_sparse
pytorch/pytorchcv/models/others/oth_espnet.py
osmr/imgclsmob
train
3,017
03dbe21f557017fe3259d0a4dbc62745d4e68736
[ "if not root:\n return str([])\nqueue = deque()\nresult = []\nqueue.append(root)\nwhile queue:\n r = queue.popleft()\n if not r:\n result.append(None)\n continue\n result.append(r.val)\n queue.append(r.left)\n queue.append(r.right)\nreturn str(result)", "data = deque(eval(data))\ni...
<|body_start_0|> if not root: return str([]) queue = deque() result = [] queue.append(root) while queue: r = queue.popleft() if not r: result.append(None) continue result.append(r.val) que...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_009349
1,773
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_train_015957
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
8e338ee7a5c9f124e897491d6a1f4bcd1d1a6270
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" if not root: return str([]) queue = deque() result = [] queue.append(root) while queue: r = queue.popleft() if not r: ...
the_stack_v2_python_sparse
src/297.二叉树的序列化与反序列化.py
hysapphire/leetcode-python
train
0
63ac9559230b26bd798ba9dc965582b176cb69ef
[ "nums = sorted(nums)\nL = len(nums)\nr = float('inf')\nif L < 3:\n return sum(nums)\nfor i in range(L - 2):\n j = i + 1\n k = L - 1\n while j < k:\n Sum = nums[i] + nums[j] + nums[k]\n if abs(r - target) > abs(Sum - target):\n r = Sum\n if Sum == target:\n retu...
<|body_start_0|> nums = sorted(nums) L = len(nums) r = float('inf') if L < 3: return sum(nums) for i in range(L - 2): j = i + 1 k = L - 1 while j < k: Sum = nums[i] + nums[j] + nums[k] if abs(r - targ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def threeSumClosest(self, nums, target): """:type nums: List[int] :type target: int :rtype: int Runtime: 132 ms, faster than 34.04% of Python online submissions for 3Sum Closest. Memory Usage: 11.9 MB, less than 9.68% of Python online submissions for 3Sum Closest.""" <|...
stack_v2_sparse_classes_36k_train_009350
3,378
no_license
[ { "docstring": ":type nums: List[int] :type target: int :rtype: int Runtime: 132 ms, faster than 34.04% of Python online submissions for 3Sum Closest. Memory Usage: 11.9 MB, less than 9.68% of Python online submissions for 3Sum Closest.", "name": "threeSumClosest", "signature": "def threeSumClosest(self...
3
stack_v2_sparse_classes_30k_train_011580
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def threeSumClosest(self, nums, target): :type nums: List[int] :type target: int :rtype: int Runtime: 132 ms, faster than 34.04% of Python online submissions for 3Sum Closest. Me...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def threeSumClosest(self, nums, target): :type nums: List[int] :type target: int :rtype: int Runtime: 132 ms, faster than 34.04% of Python online submissions for 3Sum Closest. Me...
bad06f681d8d3f2b841cb3c8a969198b8643f864
<|skeleton|> class Solution: def threeSumClosest(self, nums, target): """:type nums: List[int] :type target: int :rtype: int Runtime: 132 ms, faster than 34.04% of Python online submissions for 3Sum Closest. Memory Usage: 11.9 MB, less than 9.68% of Python online submissions for 3Sum Closest.""" <|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def threeSumClosest(self, nums, target): """:type nums: List[int] :type target: int :rtype: int Runtime: 132 ms, faster than 34.04% of Python online submissions for 3Sum Closest. Memory Usage: 11.9 MB, less than 9.68% of Python online submissions for 3Sum Closest.""" nums = sorted(nu...
the_stack_v2_python_sparse
16_3sum_closest.py
subicWang/leetcode_aotang
train
0
441a13a3359174644eab0deca73e2743880ee24e
[ "self._caffe = kwargs.pop('caffe')\nkwargs.setdefault('label_suffix', '')\nsuper(CompanyForm, self).__init__(*args, **kwargs)\nself.fields['name'].label = 'Nazwa'", "name = self.cleaned_data['name']\nquery = Company.objects.filter(name=name, caffe=self._caffe)\nif query.exists():\n raise ValidationError(_('Naz...
<|body_start_0|> self._caffe = kwargs.pop('caffe') kwargs.setdefault('label_suffix', '') super(CompanyForm, self).__init__(*args, **kwargs) self.fields['name'].label = 'Nazwa' <|end_body_0|> <|body_start_1|> name = self.cleaned_data['name'] query = Company.objects.filter...
Responsible for creating a Company.
CompanyForm
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CompanyForm: """Responsible for creating a Company.""" def __init__(self, *args, **kwargs): """Initialize all Company's fields.""" <|body_0|> def clean_name(self): """Check name field.""" <|body_1|> def save(self, commit=True): """Override of...
stack_v2_sparse_classes_36k_train_009351
4,623
permissive
[ { "docstring": "Initialize all Company's fields.", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Check name field.", "name": "clean_name", "signature": "def clean_name(self)" }, { "docstring": "Override of save method, to add Caffe rela...
3
stack_v2_sparse_classes_30k_train_010051
Implement the Python class `CompanyForm` described below. Class description: Responsible for creating a Company. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Initialize all Company's fields. - def clean_name(self): Check name field. - def save(self, commit=True): Override of save method, t...
Implement the Python class `CompanyForm` described below. Class description: Responsible for creating a Company. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Initialize all Company's fields. - def clean_name(self): Check name field. - def save(self, commit=True): Override of save method, t...
cdb7f5edb29255c7e874eaa6231621063210a8b0
<|skeleton|> class CompanyForm: """Responsible for creating a Company.""" def __init__(self, *args, **kwargs): """Initialize all Company's fields.""" <|body_0|> def clean_name(self): """Check name field.""" <|body_1|> def save(self, commit=True): """Override of...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CompanyForm: """Responsible for creating a Company.""" def __init__(self, *args, **kwargs): """Initialize all Company's fields.""" self._caffe = kwargs.pop('caffe') kwargs.setdefault('label_suffix', '') super(CompanyForm, self).__init__(*args, **kwargs) self.fields...
the_stack_v2_python_sparse
caffe/cash/forms.py
VirrageS/io-kawiarnie
train
3
4806eadc7770d7b6c0a4479286b27987541156dc
[ "left, right, width, res = (0, len(height) - 1, len(height) - 1, 0)\nfor w in range(width, 0, -1):\n if height[left] < height[right]:\n res, left = (max(res, height[left] * w), left + 1)\n else:\n res, right = (max(res, height[right] * w), right - 1)\nreturn res", "left = 0\nright = len(height...
<|body_start_0|> left, right, width, res = (0, len(height) - 1, len(height) - 1, 0) for w in range(width, 0, -1): if height[left] < height[right]: res, left = (max(res, height[left] * w), left + 1) else: res, right = (max(res, height[right] * w), r...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxArea(self, height): """:type height: List[int] :rtype: int the largest width is from start to end later heights can compete only with larger heights, so move smaller between left and right heights beats 97.39%""" <|body_0|> def maxArea1(self, height): ...
stack_v2_sparse_classes_36k_train_009352
2,053
no_license
[ { "docstring": ":type height: List[int] :rtype: int the largest width is from start to end later heights can compete only with larger heights, so move smaller between left and right heights beats 97.39%", "name": "maxArea", "signature": "def maxArea(self, height)" }, { "docstring": ":param heigh...
3
stack_v2_sparse_classes_30k_train_004438
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxArea(self, height): :type height: List[int] :rtype: int the largest width is from start to end later heights can compete only with larger heights, so move smaller between ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxArea(self, height): :type height: List[int] :rtype: int the largest width is from start to end later heights can compete only with larger heights, so move smaller between ...
7e0e917c15d3e35f49da3a00ef395bd5ff180d79
<|skeleton|> class Solution: def maxArea(self, height): """:type height: List[int] :rtype: int the largest width is from start to end later heights can compete only with larger heights, so move smaller between left and right heights beats 97.39%""" <|body_0|> def maxArea1(self, height): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxArea(self, height): """:type height: List[int] :rtype: int the largest width is from start to end later heights can compete only with larger heights, so move smaller between left and right heights beats 97.39%""" left, right, width, res = (0, len(height) - 1, len(height) - 1, ...
the_stack_v2_python_sparse
LeetCode/011_container_with_most_water.py
yao23/Machine_Learning_Playground
train
12
d3d0422bbd5eb2937afc6c090eab49d4c8170f69
[ "item = super().transform_record(pid, record, links_factory=links_factory, **kwargs)\nfilter_circulation(item)\nreturn item", "hit = super().transform_search_hit(pid, record_hit, links_factory=links_factory, **kwargs)\nfilter_circulation(hit)\nreturn hit" ]
<|body_start_0|> item = super().transform_record(pid, record, links_factory=links_factory, **kwargs) filter_circulation(item) return item <|end_body_0|> <|body_start_1|> hit = super().transform_search_hit(pid, record_hit, links_factory=links_factory, **kwargs) filter_circulation...
Serialize and filter item circulation status.
ItemJSONSerializer
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ItemJSONSerializer: """Serialize and filter item circulation status.""" def transform_record(self, pid, record, links_factory=None, **kwargs): """Transform record into an intermediate representation.""" <|body_0|> def transform_search_hit(self, pid, record_hit, links_fac...
stack_v2_sparse_classes_36k_train_009353
2,583
permissive
[ { "docstring": "Transform record into an intermediate representation.", "name": "transform_record", "signature": "def transform_record(self, pid, record, links_factory=None, **kwargs)" }, { "docstring": "Transform search result hit into an intermediate representation.", "name": "transform_se...
2
null
Implement the Python class `ItemJSONSerializer` described below. Class description: Serialize and filter item circulation status. Method signatures and docstrings: - def transform_record(self, pid, record, links_factory=None, **kwargs): Transform record into an intermediate representation. - def transform_search_hit(...
Implement the Python class `ItemJSONSerializer` described below. Class description: Serialize and filter item circulation status. Method signatures and docstrings: - def transform_record(self, pid, record, links_factory=None, **kwargs): Transform record into an intermediate representation. - def transform_search_hit(...
1c36526e85510100c5f64059518d1b716d87ac10
<|skeleton|> class ItemJSONSerializer: """Serialize and filter item circulation status.""" def transform_record(self, pid, record, links_factory=None, **kwargs): """Transform record into an intermediate representation.""" <|body_0|> def transform_search_hit(self, pid, record_hit, links_fac...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ItemJSONSerializer: """Serialize and filter item circulation status.""" def transform_record(self, pid, record, links_factory=None, **kwargs): """Transform record into an intermediate representation.""" item = super().transform_record(pid, record, links_factory=links_factory, **kwargs) ...
the_stack_v2_python_sparse
invenio_app_ils/items/serializers/item.py
inveniosoftware/invenio-app-ils
train
64
0fc3a2ed33206875f71dde5dac974fd2acdbe63d
[ "@lru_cache(None)\ndef dfs(n):\n if n == 1:\n return 0\n ans = 0\n if n & 1:\n ans += 1 + min(dfs(n + 1), dfs(n - 1))\n else:\n ans += 1 + dfs(n // 2)\n return ans\nreturn dfs(n)", "def dfs(n):\n if n in memo:\n return memo[n]\n ans = 0\n if n & 1:\n ans ...
<|body_start_0|> @lru_cache(None) def dfs(n): if n == 1: return 0 ans = 0 if n & 1: ans += 1 + min(dfs(n + 1), dfs(n - 1)) else: ans += 1 + dfs(n // 2) return ans return dfs(n) <|end_body_...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def integerReplacement1(self, n: int) -> int: """思路:记忆化递归-标准库 @param n: @return:""" <|body_0|> def integerReplacement2(self, n: int) -> int: """思路:记忆化递归-备忘录 @param n: @return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> @lru_cache(None...
stack_v2_sparse_classes_36k_train_009354
1,555
no_license
[ { "docstring": "思路:记忆化递归-标准库 @param n: @return:", "name": "integerReplacement1", "signature": "def integerReplacement1(self, n: int) -> int" }, { "docstring": "思路:记忆化递归-备忘录 @param n: @return:", "name": "integerReplacement2", "signature": "def integerReplacement2(self, n: int) -> int" }...
2
stack_v2_sparse_classes_30k_train_005206
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def integerReplacement1(self, n: int) -> int: 思路:记忆化递归-标准库 @param n: @return: - def integerReplacement2(self, n: int) -> int: 思路:记忆化递归-备忘录 @param n: @return:
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def integerReplacement1(self, n: int) -> int: 思路:记忆化递归-标准库 @param n: @return: - def integerReplacement2(self, n: int) -> int: 思路:记忆化递归-备忘录 @param n: @return: <|skeleton|> class ...
e43ee86c5a8cdb808da09b4b6138e10275abadb5
<|skeleton|> class Solution: def integerReplacement1(self, n: int) -> int: """思路:记忆化递归-标准库 @param n: @return:""" <|body_0|> def integerReplacement2(self, n: int) -> int: """思路:记忆化递归-备忘录 @param n: @return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def integerReplacement1(self, n: int) -> int: """思路:记忆化递归-标准库 @param n: @return:""" @lru_cache(None) def dfs(n): if n == 1: return 0 ans = 0 if n & 1: ans += 1 + min(dfs(n + 1), dfs(n - 1)) else: ...
the_stack_v2_python_sparse
LeetCode/记忆化/397. 整数替换.py
yiming1012/MyLeetCode
train
2
5d755d25a57408a713ea354bad709ec6e61f0c12
[ "super(Discriminator, self).__init__()\nself.conv_dim = conv_dim\nself.conv1 = conv(3, conv_dim, 4, batch_norm=False)\nself.conv2 = conv(conv_dim, conv_dim * 2, 4)\nself.conv3 = conv(conv_dim * 2, conv_dim * 4, 4)\nself.fc = nn.Linear(conv_dim * 4 * 4 * 4, 1)", "x = F.leaky_relu(self.conv1(x), 0.2)\nx = F.leaky_r...
<|body_start_0|> super(Discriminator, self).__init__() self.conv_dim = conv_dim self.conv1 = conv(3, conv_dim, 4, batch_norm=False) self.conv2 = conv(conv_dim, conv_dim * 2, 4) self.conv3 = conv(conv_dim * 2, conv_dim * 4, 4) self.fc = nn.Linear(conv_dim * 4 * 4 * 4, 1) <...
Discriminator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Discriminator: def __init__(self, conv_dim=32): """Initialize the Discriminator Module :param conv_dim: The depth of the first convolutional layer""" <|body_0|> def forward(self, x): """Forward propagation of the neural network :param x: The input to the neural netwo...
stack_v2_sparse_classes_36k_train_009355
12,896
permissive
[ { "docstring": "Initialize the Discriminator Module :param conv_dim: The depth of the first convolutional layer", "name": "__init__", "signature": "def __init__(self, conv_dim=32)" }, { "docstring": "Forward propagation of the neural network :param x: The input to the neural network :return: Dis...
2
stack_v2_sparse_classes_30k_train_021075
Implement the Python class `Discriminator` described below. Class description: Implement the Discriminator class. Method signatures and docstrings: - def __init__(self, conv_dim=32): Initialize the Discriminator Module :param conv_dim: The depth of the first convolutional layer - def forward(self, x): Forward propaga...
Implement the Python class `Discriminator` described below. Class description: Implement the Discriminator class. Method signatures and docstrings: - def __init__(self, conv_dim=32): Initialize the Discriminator Module :param conv_dim: The depth of the first convolutional layer - def forward(self, x): Forward propaga...
b9b54564f94aadfc3c71ff513da0f05ef85d22a8
<|skeleton|> class Discriminator: def __init__(self, conv_dim=32): """Initialize the Discriminator Module :param conv_dim: The depth of the first convolutional layer""" <|body_0|> def forward(self, x): """Forward propagation of the neural network :param x: The input to the neural netwo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Discriminator: def __init__(self, conv_dim=32): """Initialize the Discriminator Module :param conv_dim: The depth of the first convolutional layer""" super(Discriminator, self).__init__() self.conv_dim = conv_dim self.conv1 = conv(3, conv_dim, 4, batch_norm=False) self....
the_stack_v2_python_sparse
dl/pytorch/gan/face_gan.py
xta0/Python-Playground
train
0
44d160bd335180af752386c8ffa6662bacf81c5c
[ "self._dbg = debug\nself._log = get_logger(self.__class__.__name__, self._dbg)\nself._log.debug('midi_file=%s, channel=%s', midi_file, channel)\nself._log.debug('dst=%s', dst)\nself._log.debug('note_origin=%s', note_origin)\nself._log.debug('no_note_offset_flag=%s', no_note_offset_flag)\nself._log.debug('wav_mode=%...
<|body_start_0|> self._dbg = debug self._log = get_logger(self.__class__.__name__, self._dbg) self._log.debug('midi_file=%s, channel=%s', midi_file, channel) self._log.debug('dst=%s', dst) self._log.debug('note_origin=%s', note_origin) self._log.debug('no_note_offset_flag...
MidiApp
MidiApp
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MidiApp: """MidiApp""" def __init__(self, midi_file, dst=(), channel=[], note_origin=-1, no_note_offset_flag=False, wav_mode=0, debug=False) -> None: """Constructor Parameters ---------- midi_file: str dst: str channel: list of int note_origin: int no_note_offset_flag: bool wav_mode:...
stack_v2_sparse_classes_36k_train_009356
25,197
no_license
[ { "docstring": "Constructor Parameters ---------- midi_file: str dst: str channel: list of int note_origin: int no_note_offset_flag: bool wav_mode: int", "name": "__init__", "signature": "def __init__(self, midi_file, dst=(), channel=[], note_origin=-1, no_note_offset_flag=False, wav_mode=0, debug=False...
2
stack_v2_sparse_classes_30k_train_015522
Implement the Python class `MidiApp` described below. Class description: MidiApp Method signatures and docstrings: - def __init__(self, midi_file, dst=(), channel=[], note_origin=-1, no_note_offset_flag=False, wav_mode=0, debug=False) -> None: Constructor Parameters ---------- midi_file: str dst: str channel: list of...
Implement the Python class `MidiApp` described below. Class description: MidiApp Method signatures and docstrings: - def __init__(self, midi_file, dst=(), channel=[], note_origin=-1, no_note_offset_flag=False, wav_mode=0, debug=False) -> None: Constructor Parameters ---------- midi_file: str dst: str channel: list of...
b8264118d19c7f6c6be9b11f18c890c598eb1295
<|skeleton|> class MidiApp: """MidiApp""" def __init__(self, midi_file, dst=(), channel=[], note_origin=-1, no_note_offset_flag=False, wav_mode=0, debug=False) -> None: """Constructor Parameters ---------- midi_file: str dst: str channel: list of int note_origin: int no_note_offset_flag: bool wav_mode:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MidiApp: """MidiApp""" def __init__(self, midi_file, dst=(), channel=[], note_origin=-1, no_note_offset_flag=False, wav_mode=0, debug=False) -> None: """Constructor Parameters ---------- midi_file: str dst: str channel: list of int note_origin: int no_note_offset_flag: bool wav_mode: int""" ...
the_stack_v2_python_sparse
musicbox/__main__.py
ytani01/MusicBox
train
1
9cfa265a1dbfe5f394575eb74dc3fca408a743a5
[ "sigma_rules = []\nall_sigma_rules = SigmaRule.query.all()\nfor rule in all_sigma_rules:\n sigma_rules.append(ts_sigma_lib.enrich_sigma_rule_object(rule=rule, parse_yaml=False))\nmeta = {'rules_count': len(sigma_rules)}\nreturn jsonify({'objects': sigma_rules, 'meta': meta})", "rule_yaml = request.json.get('ru...
<|body_start_0|> sigma_rules = [] all_sigma_rules = SigmaRule.query.all() for rule in all_sigma_rules: sigma_rules.append(ts_sigma_lib.enrich_sigma_rule_object(rule=rule, parse_yaml=False)) meta = {'rules_count': len(sigma_rules)} return jsonify({'objects': sigma_rule...
Resource to get list of all SigmaRules.
SigmaRuleListResource
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SigmaRuleListResource: """Resource to get list of all SigmaRules.""" def get(self): """Fetches Sigma rules from the database. Fetches all Sigma rules stored in the database on the system and returns a list of JSON representations of the rules. Returns: List of sigma rules represented...
stack_v2_sparse_classes_36k_train_009357
12,205
permissive
[ { "docstring": "Fetches Sigma rules from the database. Fetches all Sigma rules stored in the database on the system and returns a list of JSON representations of the rules. Returns: List of sigma rules represented in JSON e.g. {\"objects\": [sigma_rules], \"meta\": {\"rules_count\": 42}.", "name": "get", ...
2
stack_v2_sparse_classes_30k_train_018385
Implement the Python class `SigmaRuleListResource` described below. Class description: Resource to get list of all SigmaRules. Method signatures and docstrings: - def get(self): Fetches Sigma rules from the database. Fetches all Sigma rules stored in the database on the system and returns a list of JSON representatio...
Implement the Python class `SigmaRuleListResource` described below. Class description: Resource to get list of all SigmaRules. Method signatures and docstrings: - def get(self): Fetches Sigma rules from the database. Fetches all Sigma rules stored in the database on the system and returns a list of JSON representatio...
24f471b58ca4a87cb053961b5f05c07a544ca7b8
<|skeleton|> class SigmaRuleListResource: """Resource to get list of all SigmaRules.""" def get(self): """Fetches Sigma rules from the database. Fetches all Sigma rules stored in the database on the system and returns a list of JSON representations of the rules. Returns: List of sigma rules represented...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SigmaRuleListResource: """Resource to get list of all SigmaRules.""" def get(self): """Fetches Sigma rules from the database. Fetches all Sigma rules stored in the database on the system and returns a list of JSON representations of the rules. Returns: List of sigma rules represented in JSON e.g....
the_stack_v2_python_sparse
timesketch/api/v1/resources/sigma.py
google/timesketch
train
2,263
2393814dd49e482eca8fe96263f8bd409df4b7c4
[ "visited = {}\nwhile head is not None:\n if head in visited:\n return True\n visited[head] = 1\n head = head.next\nreturn False", "faster = slow = head\nwhile faster != None and faster.next != None:\n faster = faster.next.next\n slow = slow.next\n if faster == slow:\n return True\n...
<|body_start_0|> visited = {} while head is not None: if head in visited: return True visited[head] = 1 head = head.next return False <|end_body_0|> <|body_start_1|> faster = slow = head while faster != None and faster.next != ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def naive_hasCycle(self, head): """:type head: ListNode :rtype: bool O(n) space complexity""" <|body_0|> def hasCycle(self, head): """:type head: ListNode :rtype: bool proof: https://stackoverflow.com/questions/3952805/proof-of-detecting-the-start-of-cycle-...
stack_v2_sparse_classes_36k_train_009358
837
no_license
[ { "docstring": ":type head: ListNode :rtype: bool O(n) space complexity", "name": "naive_hasCycle", "signature": "def naive_hasCycle(self, head)" }, { "docstring": ":type head: ListNode :rtype: bool proof: https://stackoverflow.com/questions/3952805/proof-of-detecting-the-start-of-cycle-in-linke...
2
stack_v2_sparse_classes_30k_train_003772
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def naive_hasCycle(self, head): :type head: ListNode :rtype: bool O(n) space complexity - def hasCycle(self, head): :type head: ListNode :rtype: bool proof: https://stackoverflow...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def naive_hasCycle(self, head): :type head: ListNode :rtype: bool O(n) space complexity - def hasCycle(self, head): :type head: ListNode :rtype: bool proof: https://stackoverflow...
9746205998338fb4d7fd51300a21149c4181fc8f
<|skeleton|> class Solution: def naive_hasCycle(self, head): """:type head: ListNode :rtype: bool O(n) space complexity""" <|body_0|> def hasCycle(self, head): """:type head: ListNode :rtype: bool proof: https://stackoverflow.com/questions/3952805/proof-of-detecting-the-start-of-cycle-...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def naive_hasCycle(self, head): """:type head: ListNode :rtype: bool O(n) space complexity""" visited = {} while head is not None: if head in visited: return True visited[head] = 1 head = head.next return False ...
the_stack_v2_python_sparse
leetcode/linkedList/4_linked_list_cycle.py
RuizhenMai/academic-blog
train
0
ac27729641320ff682f79f4bc86bd665046dbdbc
[ "self.archival_target = archival_target\nself.attempt_number = attempt_number\nself.cloud_deploy_target = cloud_deploy_target\nself.job_run_id = job_run_id\nself.job_uid = job_uid\nself.parent_source = parent_source\nself.restore_time_usecs = restore_time_usecs\nself.snapshot_relative_dir_path = snapshot_relative_d...
<|body_start_0|> self.archival_target = archival_target self.attempt_number = attempt_number self.cloud_deploy_target = cloud_deploy_target self.job_run_id = job_run_id self.job_uid = job_uid self.parent_source = parent_source self.restore_time_usecs = restore_tim...
Implementation of the 'RestoreInfo' model. Specifies the info regarding a full SQL snapshot. Attributes: archival_target (ArchivalExternalTarget): Specifies the info related to the archival target. attempt_number (int): Specifies the attempt number. cloud_deploy_target (CloudDeployTargetDetails): Specifies the info rel...
RestoreInfo
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RestoreInfo: """Implementation of the 'RestoreInfo' model. Specifies the info regarding a full SQL snapshot. Attributes: archival_target (ArchivalExternalTarget): Specifies the info related to the archival target. attempt_number (int): Specifies the attempt number. cloud_deploy_target (CloudDeplo...
stack_v2_sparse_classes_36k_train_009359
5,776
permissive
[ { "docstring": "Constructor for the RestoreInfo class", "name": "__init__", "signature": "def __init__(self, archival_target=None, attempt_number=None, cloud_deploy_target=None, job_run_id=None, job_uid=None, parent_source=None, restore_time_usecs=None, snapshot_relative_dir_path=None, source=None, star...
2
stack_v2_sparse_classes_30k_train_015258
Implement the Python class `RestoreInfo` described below. Class description: Implementation of the 'RestoreInfo' model. Specifies the info regarding a full SQL snapshot. Attributes: archival_target (ArchivalExternalTarget): Specifies the info related to the archival target. attempt_number (int): Specifies the attempt ...
Implement the Python class `RestoreInfo` described below. Class description: Implementation of the 'RestoreInfo' model. Specifies the info regarding a full SQL snapshot. Attributes: archival_target (ArchivalExternalTarget): Specifies the info related to the archival target. attempt_number (int): Specifies the attempt ...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class RestoreInfo: """Implementation of the 'RestoreInfo' model. Specifies the info regarding a full SQL snapshot. Attributes: archival_target (ArchivalExternalTarget): Specifies the info related to the archival target. attempt_number (int): Specifies the attempt number. cloud_deploy_target (CloudDeplo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RestoreInfo: """Implementation of the 'RestoreInfo' model. Specifies the info regarding a full SQL snapshot. Attributes: archival_target (ArchivalExternalTarget): Specifies the info related to the archival target. attempt_number (int): Specifies the attempt number. cloud_deploy_target (CloudDeployTargetDetail...
the_stack_v2_python_sparse
cohesity_management_sdk/models/restore_info.py
cohesity/management-sdk-python
train
24
1c9c233b175fe713ecfa3d98ad640f9291151b73
[ "self.generator = random_number_generator\nself.length = length\nself.num_generated_numbers = None", "if self.num_generated_numbers is not None:\n raise RuntimeError\nself.num_generated_numbers = 0\nreturn self", "if self.num_generated_numbers is None:\n raise RuntimeError('Cannot call \"next\" before Ran...
<|body_start_0|> self.generator = random_number_generator self.length = length self.num_generated_numbers = None <|end_body_0|> <|body_start_1|> if self.num_generated_numbers is not None: raise RuntimeError self.num_generated_numbers = 0 return self <|end_bod...
RandIter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RandIter: def __init__(self, random_number_generator, length): """Arguments --------- random_number_generator : A random number generator with a ``rand`` method that takes no arguments and returns a random number. length : int The number of random numbers to generate""" <|body_0|...
stack_v2_sparse_classes_36k_train_009360
3,027
no_license
[ { "docstring": "Arguments --------- random_number_generator : A random number generator with a ``rand`` method that takes no arguments and returns a random number. length : int The number of random numbers to generate", "name": "__init__", "signature": "def __init__(self, random_number_generator, length...
3
stack_v2_sparse_classes_30k_train_018137
Implement the Python class `RandIter` described below. Class description: Implement the RandIter class. Method signatures and docstrings: - def __init__(self, random_number_generator, length): Arguments --------- random_number_generator : A random number generator with a ``rand`` method that takes no arguments and re...
Implement the Python class `RandIter` described below. Class description: Implement the RandIter class. Method signatures and docstrings: - def __init__(self, random_number_generator, length): Arguments --------- random_number_generator : A random number generator with a ``rand`` method that takes no arguments and re...
527f908422b559e6afc1ec025c04336d7a13828d
<|skeleton|> class RandIter: def __init__(self, random_number_generator, length): """Arguments --------- random_number_generator : A random number generator with a ``rand`` method that takes no arguments and returns a random number. length : int The number of random numbers to generate""" <|body_0|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RandIter: def __init__(self, random_number_generator, length): """Arguments --------- random_number_generator : A random number generator with a ``rand`` method that takes no arguments and returns a random number. length : int The number of random numbers to generate""" self.generator = random...
the_stack_v2_python_sparse
src/nicolai_munsterhjelm_ex/ex05/myrand.py
Nicomunster/INF200-2019-Exercises
train
0
143877f20d97a019cee8058b5a95313fc362d974
[ "tests = set()\nfunctions = filter(lambda f: not f.properties.get('presence_tested', False), Database().get_functions())\nfor func in functions:\n test = self.generate_test(func)\n tests.add(test)\nreturn tests", "logging.info('function presence generating test for %s', function.name)\ntest = Test(f'functio...
<|body_start_0|> tests = set() functions = filter(lambda f: not f.properties.get('presence_tested', False), Database().get_functions()) for func in functions: test = self.generate_test(func) tests.add(test) return tests <|end_body_0|> <|body_start_1|> log...
FunctionPresenceGenerator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FunctionPresenceGenerator: def generate(self) -> Set[Test]: """Generates all presence test objects for all functions in the database.""" <|body_0|> def generate_test(self, function: Function) -> Test: """Generates a Test object containing a valid main block and a fun...
stack_v2_sparse_classes_36k_train_009361
2,662
permissive
[ { "docstring": "Generates all presence test objects for all functions in the database.", "name": "generate", "signature": "def generate(self) -> Set[Test]" }, { "docstring": "Generates a Test object containing a valid main block and a function call without check or print statements.", "name"...
2
stack_v2_sparse_classes_30k_train_012245
Implement the Python class `FunctionPresenceGenerator` described below. Class description: Implement the FunctionPresenceGenerator class. Method signatures and docstrings: - def generate(self) -> Set[Test]: Generates all presence test objects for all functions in the database. - def generate_test(self, function: Func...
Implement the Python class `FunctionPresenceGenerator` described below. Class description: Implement the FunctionPresenceGenerator class. Method signatures and docstrings: - def generate(self) -> Set[Test]: Generates all presence test objects for all functions in the database. - def generate_test(self, function: Func...
4e24759aded6536bbb3cdcc311e5eaf72d52c4e3
<|skeleton|> class FunctionPresenceGenerator: def generate(self) -> Set[Test]: """Generates all presence test objects for all functions in the database.""" <|body_0|> def generate_test(self, function: Function) -> Test: """Generates a Test object containing a valid main block and a fun...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FunctionPresenceGenerator: def generate(self) -> Set[Test]: """Generates all presence test objects for all functions in the database.""" tests = set() functions = filter(lambda f: not f.properties.get('presence_tested', False), Database().get_functions()) for func in functions:...
the_stack_v2_python_sparse
lemonspotter/generators/functionpresence.py
martinruefenacht/lemonspotter
train
0
d50b9ec43ce411c27531f7a4e837e90aacff257b
[ "memo = dict()\n\ndef dfs(nums, index, total, target):\n if index == len(nums):\n return 1 if total == target else 0\n if (index, total) in memo.keys():\n return memo[index, total]\n else:\n memo[index, total] = dfs(nums, index + 1, total + nums[index], target) + dfs(nums, index + 1, t...
<|body_start_0|> memo = dict() def dfs(nums, index, total, target): if index == len(nums): return 1 if total == target else 0 if (index, total) in memo.keys(): return memo[index, total] else: memo[index, total] = dfs(nu...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findTargetSumWays1(self, nums: List[int], S: int) -> int: """简单的dfs会超时,需要进行优化。 以[1,1,1] 为例: 0 / -1 1 / \\ / -2 0 0 2 # 当所在层数相同且sum相同时,则后面dfs的结果也是相同的,不用重复计算 /\\ /\\ /\\ / -3 -1 -1 1 -1 1 1 3 将当前层数及sum值存到dict,后面计算时遇到相同key直接取vaule即可(这里需要理解,dfs是自底向上返回值,所以从dict中取到的value,是当前key从底...
stack_v2_sparse_classes_36k_train_009362
3,042
no_license
[ { "docstring": "简单的dfs会超时,需要进行优化。 以[1,1,1] 为例: 0 / -1 1 / \\\\ / -2 0 0 2 # 当所在层数相同且sum相同时,则后面dfs的结果也是相同的,不用重复计算 /\\\\ /\\\\ /\\\\ / -3 -1 -1 1 -1 1 1 3 将当前层数及sum值存到dict,后面计算时遇到相同key直接取vaule即可(这里需要理解,dfs是自底向上返回值,所以从dict中取到的value,是当前key从底往上的返回值,即所有结果)", "name": "findTargetSumWays1", "signature": "def fin...
2
stack_v2_sparse_classes_30k_train_016947
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findTargetSumWays1(self, nums: List[int], S: int) -> int: 简单的dfs会超时,需要进行优化。 以[1,1,1] 为例: 0 / -1 1 / \\ / -2 0 0 2 # 当所在层数相同且sum相同时,则后面dfs的结果也是相同的,不用重复计算 /\\ /\\ /\\ / -3 -1 -...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findTargetSumWays1(self, nums: List[int], S: int) -> int: 简单的dfs会超时,需要进行优化。 以[1,1,1] 为例: 0 / -1 1 / \\ / -2 0 0 2 # 当所在层数相同且sum相同时,则后面dfs的结果也是相同的,不用重复计算 /\\ /\\ /\\ / -3 -1 -...
2bbb1640589aab34f2bc42489283033cc11fb885
<|skeleton|> class Solution: def findTargetSumWays1(self, nums: List[int], S: int) -> int: """简单的dfs会超时,需要进行优化。 以[1,1,1] 为例: 0 / -1 1 / \\ / -2 0 0 2 # 当所在层数相同且sum相同时,则后面dfs的结果也是相同的,不用重复计算 /\\ /\\ /\\ / -3 -1 -1 1 -1 1 1 3 将当前层数及sum值存到dict,后面计算时遇到相同key直接取vaule即可(这里需要理解,dfs是自底向上返回值,所以从dict中取到的value,是当前key从底...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findTargetSumWays1(self, nums: List[int], S: int) -> int: """简单的dfs会超时,需要进行优化。 以[1,1,1] 为例: 0 / -1 1 / \\ / -2 0 0 2 # 当所在层数相同且sum相同时,则后面dfs的结果也是相同的,不用重复计算 /\\ /\\ /\\ / -3 -1 -1 1 -1 1 1 3 将当前层数及sum值存到dict,后面计算时遇到相同key直接取vaule即可(这里需要理解,dfs是自底向上返回值,所以从dict中取到的value,是当前key从底往上的返回值,即所有结果)"...
the_stack_v2_python_sparse
494_target-sum.py
helloocc/algorithm
train
1
3d36bdb873ad1f95ad1d742f11b18fa1027e862f
[ "chair = Part.objects.get(pk=10000)\nself.assertEqual(chair.stock_entries(include_variants=False).count(), 0)\nself.assertEqual(chair.stock_entries().count(), 12)\ngreen = Part.objects.get(pk=10003)\nself.assertEqual(green.stock_entries(include_variants=False).count(), 0)\nself.assertEqual(green.stock_entries().cou...
<|body_start_0|> chair = Part.objects.get(pk=10000) self.assertEqual(chair.stock_entries(include_variants=False).count(), 0) self.assertEqual(chair.stock_entries().count(), 12) green = Part.objects.get(pk=10003) self.assertEqual(green.stock_entries(include_variants=False).count()...
Tests for calculation stock counts against templates / variants.
VariantTest
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VariantTest: """Tests for calculation stock counts against templates / variants.""" def test_variant_stock(self): """Test variant functions.""" <|body_0|> def test_serial_numbers(self): """Test serial number functionality for variant / template parts.""" ...
stack_v2_sparse_classes_36k_train_009363
40,181
permissive
[ { "docstring": "Test variant functions.", "name": "test_variant_stock", "signature": "def test_variant_stock(self)" }, { "docstring": "Test serial number functionality for variant / template parts.", "name": "test_serial_numbers", "signature": "def test_serial_numbers(self)" } ]
2
null
Implement the Python class `VariantTest` described below. Class description: Tests for calculation stock counts against templates / variants. Method signatures and docstrings: - def test_variant_stock(self): Test variant functions. - def test_serial_numbers(self): Test serial number functionality for variant / templa...
Implement the Python class `VariantTest` described below. Class description: Tests for calculation stock counts against templates / variants. Method signatures and docstrings: - def test_variant_stock(self): Test variant functions. - def test_serial_numbers(self): Test serial number functionality for variant / templa...
e88a8e99a5f0b201c67a95cba097c729f090d5e2
<|skeleton|> class VariantTest: """Tests for calculation stock counts against templates / variants.""" def test_variant_stock(self): """Test variant functions.""" <|body_0|> def test_serial_numbers(self): """Test serial number functionality for variant / template parts.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VariantTest: """Tests for calculation stock counts against templates / variants.""" def test_variant_stock(self): """Test variant functions.""" chair = Part.objects.get(pk=10000) self.assertEqual(chair.stock_entries(include_variants=False).count(), 0) self.assertEqual(chai...
the_stack_v2_python_sparse
InvenTree/stock/tests.py
inventree/InvenTree
train
3,077
435f48322403ca8e571f3bccfe8cc3a0a1677b7e
[ "super().__init__()\ncheck_boundaries(boundaries)\nself.boundaries = boundaries\nself.frequencies = frequencies", "self.randomize(None)\nself.magnitude = self.R.uniform(low=self.boundaries[0], high=self.boundaries[1])\nself.freqs = self.R.uniform(low=self.frequencies[0], high=self.frequencies[1])\nlength = signal...
<|body_start_0|> super().__init__() check_boundaries(boundaries) self.boundaries = boundaries self.frequencies = frequencies <|end_body_0|> <|body_start_1|> self.randomize(None) self.magnitude = self.R.uniform(low=self.boundaries[0], high=self.boundaries[1]) self...
Add a random sinusoidal signal to the input signal
SignalRandAddSine
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SignalRandAddSine: """Add a random sinusoidal signal to the input signal""" def __init__(self, boundaries: Sequence[float]=(0.1, 0.3), frequencies: Sequence[float]=(0.001, 0.02)) -> None: """Args: boundaries: list defining lower and upper boundaries for the sinusoidal magnitude, lowe...
stack_v2_sparse_classes_36k_train_009364
16,322
permissive
[ { "docstring": "Args: boundaries: list defining lower and upper boundaries for the sinusoidal magnitude, lower and upper values need to be positive ,default : ``[0.1, 0.3]`` frequencies: list defining lower and upper frequencies for sinusoidal signal generation ,default : ``[0.001, 0.02]``", "name": "__init...
2
stack_v2_sparse_classes_30k_train_017063
Implement the Python class `SignalRandAddSine` described below. Class description: Add a random sinusoidal signal to the input signal Method signatures and docstrings: - def __init__(self, boundaries: Sequence[float]=(0.1, 0.3), frequencies: Sequence[float]=(0.001, 0.02)) -> None: Args: boundaries: list defining lowe...
Implement the Python class `SignalRandAddSine` described below. Class description: Add a random sinusoidal signal to the input signal Method signatures and docstrings: - def __init__(self, boundaries: Sequence[float]=(0.1, 0.3), frequencies: Sequence[float]=(0.001, 0.02)) -> None: Args: boundaries: list defining lowe...
e48c3e2c741fa3fc705c4425d17ac4a5afac6c47
<|skeleton|> class SignalRandAddSine: """Add a random sinusoidal signal to the input signal""" def __init__(self, boundaries: Sequence[float]=(0.1, 0.3), frequencies: Sequence[float]=(0.001, 0.02)) -> None: """Args: boundaries: list defining lower and upper boundaries for the sinusoidal magnitude, lowe...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SignalRandAddSine: """Add a random sinusoidal signal to the input signal""" def __init__(self, boundaries: Sequence[float]=(0.1, 0.3), frequencies: Sequence[float]=(0.001, 0.02)) -> None: """Args: boundaries: list defining lower and upper boundaries for the sinusoidal magnitude, lower and upper v...
the_stack_v2_python_sparse
monai/transforms/signal/array.py
Project-MONAI/MONAI
train
4,805
234bf63c9005d3e1e95d4239536d7a91edf01da3
[ "if not root:\n print('serialize: ', '')\n return ''\nqueue = collections.deque([root])\nstringArr = []\nstring = ''\nlayer = 1\nnum_in_layer = 2 ** (layer - 1)\nwhile queue:\n level = []\n for _ in range(len(queue)):\n node = queue.popleft()\n if node:\n queue.append(node.left)...
<|body_start_0|> if not root: print('serialize: ', '') return '' queue = collections.deque([root]) stringArr = [] string = '' layer = 1 num_in_layer = 2 ** (layer - 1) while queue: level = [] for _ in range(len(queue...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_009365
6,668
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
ca95110b77152258573b6f1d43e39a316cdcb459
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" if not root: print('serialize: ', '') return '' queue = collections.deque([root]) stringArr = [] string = '' layer = 1 num...
the_stack_v2_python_sparse
algo/tree/_0297_SerializeAndDeserializeBinaryTree.py
ianlai/Note-Python
train
0
e67e4e412d280ff36b1a73f4eb01962d5d0f7c81
[ "super(SelectBox, self).__init__(parent)\nself._leftBrushColor = QColor()\nself._rightBrushColor = QColor()\nself._leftPenColor = QColor()\nself._rightPenColor = QColor()\nself._alpha = 255\nself._dirBrush = QBrush()\nself._leftBrush = QBrush()\nself._rightBrush = QBrush()\nself._dirPen = QPen()\nself._leftPen = QP...
<|body_start_0|> super(SelectBox, self).__init__(parent) self._leftBrushColor = QColor() self._rightBrushColor = QColor() self._leftPenColor = QColor() self._rightPenColor = QColor() self._alpha = 255 self._dirBrush = QBrush() self._leftBrush = QBrush() ...
Subclass of `QRubberBand`_ TOWRITE
SelectBox
[ "Zlib", "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SelectBox: """Subclass of `QRubberBand`_ TOWRITE""" def __init__(self, s, parent=None): """Default class constructor. :param `s`: TOWRITE :type `s`: QRubberBand.Shape :param `parent`: Pointer to a parent widget instance. :type `parent`: `QWidget`_""" <|body_0|> def setDi...
stack_v2_sparse_classes_36k_train_009366
4,928
permissive
[ { "docstring": "Default class constructor. :param `s`: TOWRITE :type `s`: QRubberBand.Shape :param `parent`: Pointer to a parent widget instance. :type `parent`: `QWidget`_", "name": "__init__", "signature": "def __init__(self, s, parent=None)" }, { "docstring": "TOWRITE :param `dir`: TOWRITE :t...
5
stack_v2_sparse_classes_30k_train_020041
Implement the Python class `SelectBox` described below. Class description: Subclass of `QRubberBand`_ TOWRITE Method signatures and docstrings: - def __init__(self, s, parent=None): Default class constructor. :param `s`: TOWRITE :type `s`: QRubberBand.Shape :param `parent`: Pointer to a parent widget instance. :type ...
Implement the Python class `SelectBox` described below. Class description: Subclass of `QRubberBand`_ TOWRITE Method signatures and docstrings: - def __init__(self, s, parent=None): Default class constructor. :param `s`: TOWRITE :type `s`: QRubberBand.Shape :param `parent`: Pointer to a parent widget instance. :type ...
9c5c2baea3bf3897470495e2a50eb70ee1363637
<|skeleton|> class SelectBox: """Subclass of `QRubberBand`_ TOWRITE""" def __init__(self, s, parent=None): """Default class constructor. :param `s`: TOWRITE :type `s`: QRubberBand.Shape :param `parent`: Pointer to a parent widget instance. :type `parent`: `QWidget`_""" <|body_0|> def setDi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SelectBox: """Subclass of `QRubberBand`_ TOWRITE""" def __init__(self, s, parent=None): """Default class constructor. :param `s`: TOWRITE :type `s`: QRubberBand.Shape :param `parent`: Pointer to a parent widget instance. :type `parent`: `QWidget`_""" super(SelectBox, self).__init__(parent...
the_stack_v2_python_sparse
experimental/python/gui/selectbox.py
Fran89/Embroidermodder
train
1
8ca995af99324163d5c136f25b82c3a7314852ca
[ "conv = nn.Conv2d(in_channels=in_channels, out_channels=out_channels * upscale_factor ** 2, kernel_size=1, padding=0)\nself.initialize_conv(conv, in_channels, out_channels, upscale_factor)\nlayers = [conv, activation(), normalization(num_features=out_channels * upscale_factor ** 2), nn.PixelShuffle(upscale_factor)]...
<|body_start_0|> conv = nn.Conv2d(in_channels=in_channels, out_channels=out_channels * upscale_factor ** 2, kernel_size=1, padding=0) self.initialize_conv(conv, in_channels, out_channels, upscale_factor) layers = [conv, activation(), normalization(num_features=out_channels * upscale_factor ** 2)...
Upsample the image using normal convolution follow by pixel shuffling References: https://arxiv.org/pdf/1609.05158.pdf https://arxiv.org/pdf/1806.02658.pdf (additional blurring at the end)
PixelShuffleConvolutionLayer
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PixelShuffleConvolutionLayer: """Upsample the image using normal convolution follow by pixel shuffling References: https://arxiv.org/pdf/1609.05158.pdf https://arxiv.org/pdf/1806.02658.pdf (additional blurring at the end)""" def __init__(self, in_channels: int, out_channels: int, upscale_fac...
stack_v2_sparse_classes_36k_train_009367
3,091
permissive
[ { "docstring": ":param in_channels: input channels :param out_channels: output channels :param upscale_factor: factor to increase spatial resolution by :param activation: activation function :param normalization: normalization function :param: whether to blur at the end to remove checkerboard artifact", "na...
2
null
Implement the Python class `PixelShuffleConvolutionLayer` described below. Class description: Upsample the image using normal convolution follow by pixel shuffling References: https://arxiv.org/pdf/1609.05158.pdf https://arxiv.org/pdf/1806.02658.pdf (additional blurring at the end) Method signatures and docstrings: -...
Implement the Python class `PixelShuffleConvolutionLayer` described below. Class description: Upsample the image using normal convolution follow by pixel shuffling References: https://arxiv.org/pdf/1609.05158.pdf https://arxiv.org/pdf/1806.02658.pdf (additional blurring at the end) Method signatures and docstrings: -...
689b9924d3c88a433f8f350b89c13a878ac7d7c3
<|skeleton|> class PixelShuffleConvolutionLayer: """Upsample the image using normal convolution follow by pixel shuffling References: https://arxiv.org/pdf/1609.05158.pdf https://arxiv.org/pdf/1806.02658.pdf (additional blurring at the end)""" def __init__(self, in_channels: int, out_channels: int, upscale_fac...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PixelShuffleConvolutionLayer: """Upsample the image using normal convolution follow by pixel shuffling References: https://arxiv.org/pdf/1609.05158.pdf https://arxiv.org/pdf/1806.02658.pdf (additional blurring at the end)""" def __init__(self, in_channels: int, out_channels: int, upscale_factor: int, act...
the_stack_v2_python_sparse
nntoolbox/vision/components/upsample.py
nhatsmrt/nn-toolbox
train
19
fb8f07ce47cd5e35911bc23911a20393a1d01004
[ "def helper(root):\n res = [0, 0]\n if not root:\n return res\n left, right = (helper(root.left), helper(root.right))\n res[0] = max(left) + max(right)\n res[1] = root.val + left[0] + right[0]\n return res\nreturn max(helper(root))", "def helper(root, mem):\n if not root:\n retu...
<|body_start_0|> def helper(root): res = [0, 0] if not root: return res left, right = (helper(root.left), helper(root.right)) res[0] = max(left) + max(right) res[1] = root.val + left[0] + right[0] return res return m...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def rob(self, root): """:type root: TreeNode :rtype: int""" <|body_0|> def rob2(self, root): """:type root: TreeNode :rtype: int""" <|body_1|> def rob3(self, root): """:type root: TreeNode :rtype: int""" <|body_2|> <|end_skelet...
stack_v2_sparse_classes_36k_train_009368
3,633
no_license
[ { "docstring": ":type root: TreeNode :rtype: int", "name": "rob", "signature": "def rob(self, root)" }, { "docstring": ":type root: TreeNode :rtype: int", "name": "rob2", "signature": "def rob2(self, root)" }, { "docstring": ":type root: TreeNode :rtype: int", "name": "rob3",...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rob(self, root): :type root: TreeNode :rtype: int - def rob2(self, root): :type root: TreeNode :rtype: int - def rob3(self, root): :type root: TreeNode :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rob(self, root): :type root: TreeNode :rtype: int - def rob2(self, root): :type root: TreeNode :rtype: int - def rob3(self, root): :type root: TreeNode :rtype: int <|skeleto...
635af6e22aa8eef8e7920a585d43a45a891a8157
<|skeleton|> class Solution: def rob(self, root): """:type root: TreeNode :rtype: int""" <|body_0|> def rob2(self, root): """:type root: TreeNode :rtype: int""" <|body_1|> def rob3(self, root): """:type root: TreeNode :rtype: int""" <|body_2|> <|end_skelet...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def rob(self, root): """:type root: TreeNode :rtype: int""" def helper(root): res = [0, 0] if not root: return res left, right = (helper(root.left), helper(root.right)) res[0] = max(left) + max(right) res[1] ...
the_stack_v2_python_sparse
code337HouseRobberIII.py
cybelewang/leetcode-python
train
0
32375c144ac9769a1fdd8a7233902032f042ba3e
[ "def compare(x, y):\n \"\"\" 比较函数,从大到小排序 \"\"\"\n if y + x > x + y:\n return 1\n return -1\nnums = sorted(map(str, nums), key=cmp_to_key(compare))\nif nums[0] == '0':\n return '0'\nreturn ''.join(nums)", "def func(x):\n if not x:\n return 0\n n = int(math.log10(x)) + 1\n return ...
<|body_start_0|> def compare(x, y): """ 比较函数,从大到小排序 """ if y + x > x + y: return 1 return -1 nums = sorted(map(str, nums), key=cmp_to_key(compare)) if nums[0] == '0': return '0' return ''.join(nums) <|end_body_0|> <|body_st...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def largestNumber(self, nums: List[int]) -> str: """比较""" <|body_0|> def largestNumberMath(self, nums: List[int]) -> str: """数学""" <|body_1|> <|end_skeleton|> <|body_start_0|> def compare(x, y): """ 比较函数,从大到小排序 """ ...
stack_v2_sparse_classes_36k_train_009369
1,302
no_license
[ { "docstring": "比较", "name": "largestNumber", "signature": "def largestNumber(self, nums: List[int]) -> str" }, { "docstring": "数学", "name": "largestNumberMath", "signature": "def largestNumberMath(self, nums: List[int]) -> str" } ]
2
stack_v2_sparse_classes_30k_train_008733
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def largestNumber(self, nums: List[int]) -> str: 比较 - def largestNumberMath(self, nums: List[int]) -> str: 数学
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def largestNumber(self, nums: List[int]) -> str: 比较 - def largestNumberMath(self, nums: List[int]) -> str: 数学 <|skeleton|> class Solution: def largestNumber(self, nums: Lis...
52756b30e9d51794591aca030bc918e707f473f1
<|skeleton|> class Solution: def largestNumber(self, nums: List[int]) -> str: """比较""" <|body_0|> def largestNumberMath(self, nums: List[int]) -> str: """数学""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def largestNumber(self, nums: List[int]) -> str: """比较""" def compare(x, y): """ 比较函数,从大到小排序 """ if y + x > x + y: return 1 return -1 nums = sorted(map(str, nums), key=cmp_to_key(compare)) if nums[0] == '0': ...
the_stack_v2_python_sparse
179.最大数/solution.py
QtTao/daily_leetcode
train
0
69806b954a1de8eb08071a7774aacb5b8fe74dd8
[ "dval = {}\nmodel = type(self)\nmapper = inspect(model)\nfor col in mapper.attrs:\n col_key = col.key\n dval[col_key] = str(getattr(self, col_key))\nreturn dval", "model_dict = self.to_dict()\njson_str = json.dumps(model_dict, indent=indent)\nreturn json_str" ]
<|body_start_0|> dval = {} model = type(self) mapper = inspect(model) for col in mapper.attrs: col_key = col.key dval[col_key] = str(getattr(self, col_key)) return dval <|end_body_0|> <|body_start_1|> model_dict = self.to_dict() json_str =...
Mixin style class that adds serialization to data model objects.
SerializableModel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SerializableModel: """Mixin style class that adds serialization to data model objects.""" def to_dict(self): """Iterates the formal data attributes of a model and outputs a dictionary with the data based on the model.""" <|body_0|> def to_json(self, indent=4): ""...
stack_v2_sparse_classes_36k_train_009370
6,583
no_license
[ { "docstring": "Iterates the formal data attributes of a model and outputs a dictionary with the data based on the model.", "name": "to_dict", "signature": "def to_dict(self)" }, { "docstring": "Iterates the formal data attributes of a model and creates a dictionary with the data based on the mo...
2
stack_v2_sparse_classes_30k_train_015669
Implement the Python class `SerializableModel` described below. Class description: Mixin style class that adds serialization to data model objects. Method signatures and docstrings: - def to_dict(self): Iterates the formal data attributes of a model and outputs a dictionary with the data based on the model. - def to_...
Implement the Python class `SerializableModel` described below. Class description: Mixin style class that adds serialization to data model objects. Method signatures and docstrings: - def to_dict(self): Iterates the formal data attributes of a model and outputs a dictionary with the data based on the model. - def to_...
530ea184f29add6f42bee1465343f6ddb51a1e51
<|skeleton|> class SerializableModel: """Mixin style class that adds serialization to data model objects.""" def to_dict(self): """Iterates the formal data attributes of a model and outputs a dictionary with the data based on the model.""" <|body_0|> def to_json(self, indent=4): ""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SerializableModel: """Mixin style class that adds serialization to data model objects.""" def to_dict(self): """Iterates the formal data attributes of a model and outputs a dictionary with the data based on the model.""" dval = {} model = type(self) mapper = inspect(model)...
the_stack_v2_python_sparse
packages/akit/datum/orm.py
TrendingTechnology/automationkit
train
0
5df7507e614c1a2ef8a1bd1716481c4ef702b4e3
[ "if not root:\n return ''\nq = [root]\ncoded = [root.val]\nwhile q:\n n = len(q)\n for _ in range(n):\n node = q.pop(0)\n if not node:\n continue\n q.append(node.left)\n q.append(node.right)\n coded += [node.val if node else 'N' for node in q]\nreturn coded", "if...
<|body_start_0|> if not root: return '' q = [root] coded = [root.val] while q: n = len(q) for _ in range(n): node = q.pop(0) if not node: continue q.append(node.left) q...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_009371
2,617
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_train_017630
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
0127190b27862ec7e7f4f2fcce5ce958d480cdac
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" if not root: return '' q = [root] coded = [root.val] while q: n = len(q) for _ in range(n): node = q.pop(0) ...
the_stack_v2_python_sparse
449.serialize-and-deserialize-bst.py
Iverance/leetcode
train
0
6a0a0783428edc8dca7a1a5f1b7346a6c8d1cfe9
[ "self.sums = []\nfor weight in w:\n if not self.sums:\n self.sums.append(weight)\n else:\n self.sums.append(weight + self.sums[-1])", "import bisect\npick = random.uniform(0, self.sums[-1])\nreturn bisect.bisect_left(self.sums, pick)" ]
<|body_start_0|> self.sums = [] for weight in w: if not self.sums: self.sums.append(weight) else: self.sums.append(weight + self.sums[-1]) <|end_body_0|> <|body_start_1|> import bisect pick = random.uniform(0, self.sums[-1]) ...
Solution_1
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution_1: def __init__(self, w): """:type w: List[int] 176ms""" <|body_0|> def pickIndex(self): """:rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.sums = [] for weight in w: if not self.sums: se...
stack_v2_sparse_classes_36k_train_009372
1,901
no_license
[ { "docstring": ":type w: List[int] 176ms", "name": "__init__", "signature": "def __init__(self, w)" }, { "docstring": ":rtype: int", "name": "pickIndex", "signature": "def pickIndex(self)" } ]
2
stack_v2_sparse_classes_30k_train_016824
Implement the Python class `Solution_1` described below. Class description: Implement the Solution_1 class. Method signatures and docstrings: - def __init__(self, w): :type w: List[int] 176ms - def pickIndex(self): :rtype: int
Implement the Python class `Solution_1` described below. Class description: Implement the Solution_1 class. Method signatures and docstrings: - def __init__(self, w): :type w: List[int] 176ms - def pickIndex(self): :rtype: int <|skeleton|> class Solution_1: def __init__(self, w): """:type w: List[int] 1...
679a2b246b8b6bb7fc55ed1c8096d3047d6d4461
<|skeleton|> class Solution_1: def __init__(self, w): """:type w: List[int] 176ms""" <|body_0|> def pickIndex(self): """:rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution_1: def __init__(self, w): """:type w: List[int] 176ms""" self.sums = [] for weight in w: if not self.sums: self.sums.append(weight) else: self.sums.append(weight + self.sums[-1]) def pickIndex(self): """:rtyp...
the_stack_v2_python_sparse
RandomPickWithWeight_MID_880.py
953250587/leetcode-python
train
2
d0c34a3185e2333a46fa0f7369266aa4e10b1685
[ "super(ConditionalAutoencoder, self).__init__()\nn_enc_blks = len(enc_channels) - 1\nn_dec_blks = len(dec_channels) - 1\nassert n_enc_blks > 0\nassert n_dec_blks > 0\nself.n_enc_blks = n_enc_blks\nself.n_dec_blks = n_dec_blks\nself.bottom_width = 4\nself.nonlinearity = nn.ReLU()\nresblk_cls = ConditionalResidualBlo...
<|body_start_0|> super(ConditionalAutoencoder, self).__init__() n_enc_blks = len(enc_channels) - 1 n_dec_blks = len(dec_channels) - 1 assert n_enc_blks > 0 assert n_dec_blks > 0 self.n_enc_blks = n_enc_blks self.n_dec_blks = n_dec_blks self.bottom_width = ...
ConditionalAutoencoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConditionalAutoencoder: def __init__(self, enc_channels, dec_channels, num_classes, dim_z=128, im_channels=3): """enc_channels [64, 128, 256, 256] c1 c2 c3 dec_channels [256, 128, 64, 64] c1 c2 c3 num_classes if not None, use conditional batchnorm""" <|body_0|> def forward(s...
stack_v2_sparse_classes_36k_train_009373
18,748
no_license
[ { "docstring": "enc_channels [64, 128, 256, 256] c1 c2 c3 dec_channels [256, 128, 64, 64] c1 c2 c3 num_classes if not None, use conditional batchnorm", "name": "__init__", "signature": "def __init__(self, enc_channels, dec_channels, num_classes, dim_z=128, im_channels=3)" }, { "docstring": "x ba...
2
stack_v2_sparse_classes_30k_test_001183
Implement the Python class `ConditionalAutoencoder` described below. Class description: Implement the ConditionalAutoencoder class. Method signatures and docstrings: - def __init__(self, enc_channels, dec_channels, num_classes, dim_z=128, im_channels=3): enc_channels [64, 128, 256, 256] c1 c2 c3 dec_channels [256, 12...
Implement the Python class `ConditionalAutoencoder` described below. Class description: Implement the ConditionalAutoencoder class. Method signatures and docstrings: - def __init__(self, enc_channels, dec_channels, num_classes, dim_z=128, im_channels=3): enc_channels [64, 128, 256, 256] c1 c2 c3 dec_channels [256, 12...
0a6653a66f1fb2590df9d6697e4cd69d32a2baaa
<|skeleton|> class ConditionalAutoencoder: def __init__(self, enc_channels, dec_channels, num_classes, dim_z=128, im_channels=3): """enc_channels [64, 128, 256, 256] c1 c2 c3 dec_channels [256, 128, 64, 64] c1 c2 c3 num_classes if not None, use conditional batchnorm""" <|body_0|> def forward(s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ConditionalAutoencoder: def __init__(self, enc_channels, dec_channels, num_classes, dim_z=128, im_channels=3): """enc_channels [64, 128, 256, 256] c1 c2 c3 dec_channels [256, 128, 64, 64] c1 c2 c3 num_classes if not None, use conditional batchnorm""" super(ConditionalAutoencoder, self).__init_...
the_stack_v2_python_sparse
pe/models_cgan.py
tt6746690/misc_impl
train
0
767d9c3833c0818432748ddbfc8a00274ae2ac76
[ "super().__init__(**kwargs)\nself._sublayers = []\nfor num_units in units[:-1]:\n self._sublayers.append(tf.keras.layers.Dense(num_units, activation=activation, use_bias=use_bias))\nself._sublayers.append(tf.keras.layers.Dense(units[-1], activation=final_activation, use_bias=use_bias))", "for layer in self._su...
<|body_start_0|> super().__init__(**kwargs) self._sublayers = [] for num_units in units[:-1]: self._sublayers.append(tf.keras.layers.Dense(num_units, activation=activation, use_bias=use_bias)) self._sublayers.append(tf.keras.layers.Dense(units[-1], activation=final_activation...
Sequential multi-layer perceptron (MLP) block.
MLP
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MLP: """Sequential multi-layer perceptron (MLP) block.""" def __init__(self, units: List[int], use_bias: bool=True, activation: Optional[types.Activation]='relu', final_activation: Optional[types.Activation]=None, **kwargs) -> None: """Initializes the MLP layer. Args: units: Sequenti...
stack_v2_sparse_classes_36k_train_009374
1,936
permissive
[ { "docstring": "Initializes the MLP layer. Args: units: Sequential list of layer sizes. use_bias: Whether to include a bias term. activation: Type of activation to use on all except the last layer. final_activation: Type of activation to use on last layer. **kwargs: Extra args passed to the Keras Layer base cla...
2
stack_v2_sparse_classes_30k_train_003744
Implement the Python class `MLP` described below. Class description: Sequential multi-layer perceptron (MLP) block. Method signatures and docstrings: - def __init__(self, units: List[int], use_bias: bool=True, activation: Optional[types.Activation]='relu', final_activation: Optional[types.Activation]=None, **kwargs) ...
Implement the Python class `MLP` described below. Class description: Sequential multi-layer perceptron (MLP) block. Method signatures and docstrings: - def __init__(self, units: List[int], use_bias: bool=True, activation: Optional[types.Activation]='relu', final_activation: Optional[types.Activation]=None, **kwargs) ...
f4f42c1a183a262539e21f5ab8d25f0dc3e5621d
<|skeleton|> class MLP: """Sequential multi-layer perceptron (MLP) block.""" def __init__(self, units: List[int], use_bias: bool=True, activation: Optional[types.Activation]='relu', final_activation: Optional[types.Activation]=None, **kwargs) -> None: """Initializes the MLP layer. Args: units: Sequenti...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MLP: """Sequential multi-layer perceptron (MLP) block.""" def __init__(self, units: List[int], use_bias: bool=True, activation: Optional[types.Activation]='relu', final_activation: Optional[types.Activation]=None, **kwargs) -> None: """Initializes the MLP layer. Args: units: Sequential list of la...
the_stack_v2_python_sparse
tensorflow_recommenders/layers/blocks.py
tensorflow/recommenders
train
1,666
e4ac9fff359d5afdd054b10d08f4f85a321d86cc
[ "if not usernames and (not addresses):\n return 0\nselection = models.Q()\nif usernames:\n selection |= models.Q(username__in=set(usernames))\nif addresses:\n selection |= models.Q(source_address__in=set(addresses))\nreturn self.get_queryset().filter(selection, lockout=True).update(lockout=False)", "sele...
<|body_start_0|> if not usernames and (not addresses): return 0 selection = models.Q() if usernames: selection |= models.Q(username__in=set(usernames)) if addresses: selection |= models.Q(source_address__in=set(addresses)) return self.get_query...
Manager to handle Logins.
LoginAttemptManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LoginAttemptManager: """Manager to handle Logins.""" def unlock(self, usernames=[], addresses=[]): """To Unlock given usernames and IP addresses. Returns the number of attempts that have been unlocked.""" <|body_0|> def unlock_queryset(self, queryset): """To unlo...
stack_v2_sparse_classes_36k_train_009375
10,201
no_license
[ { "docstring": "To Unlock given usernames and IP addresses. Returns the number of attempts that have been unlocked.", "name": "unlock", "signature": "def unlock(self, usernames=[], addresses=[])" }, { "docstring": "To unlock all usernames and IP addresses found in ``queryset``. Returns the numbe...
2
stack_v2_sparse_classes_30k_train_015637
Implement the Python class `LoginAttemptManager` described below. Class description: Manager to handle Logins. Method signatures and docstrings: - def unlock(self, usernames=[], addresses=[]): To Unlock given usernames and IP addresses. Returns the number of attempts that have been unlocked. - def unlock_queryset(sel...
Implement the Python class `LoginAttemptManager` described below. Class description: Manager to handle Logins. Method signatures and docstrings: - def unlock(self, usernames=[], addresses=[]): To Unlock given usernames and IP addresses. Returns the number of attempts that have been unlocked. - def unlock_queryset(sel...
cb392be0402543acf074425fcaf8edf054269012
<|skeleton|> class LoginAttemptManager: """Manager to handle Logins.""" def unlock(self, usernames=[], addresses=[]): """To Unlock given usernames and IP addresses. Returns the number of attempts that have been unlocked.""" <|body_0|> def unlock_queryset(self, queryset): """To unlo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LoginAttemptManager: """Manager to handle Logins.""" def unlock(self, usernames=[], addresses=[]): """To Unlock given usernames and IP addresses. Returns the number of attempts that have been unlocked.""" if not usernames and (not addresses): return 0 selection = model...
the_stack_v2_python_sparse
cpovc_access/models.py
uonafya/cpims-2.3beta
train
4
892cbc07a1524f47caaf9eddeb1e1485bb79c915
[ "data = form.cleaned_data\nself.success_url = reverse('tokens', kwargs={'level': int(data['level']), 'semester': int(data['semester']), 'course': int(data['course'].id)})\nreturn super().form_valid(form)", "context = super().get_context_data(**kwargs)\ncontext['title_text'] = 'Choose Course To View The Tokens'\nc...
<|body_start_0|> data = form.cleaned_data self.success_url = reverse('tokens', kwargs={'level': int(data['level']), 'semester': int(data['semester']), 'course': int(data['course'].id)}) return super().form_valid(form) <|end_body_0|> <|body_start_1|> context = super().get_context_data(**...
View for choosing course tokens that will be displayed. Check that the user's account is still active. Redirects to tokens view on form valid.
ShowTokensView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ShowTokensView: """View for choosing course tokens that will be displayed. Check that the user's account is still active. Redirects to tokens view on form valid.""" def form_valid(self, form): """Compute the success URL and call super.form_valid()""" <|body_0|> def get_c...
stack_v2_sparse_classes_36k_train_009376
29,759
no_license
[ { "docstring": "Compute the success URL and call super.form_valid()", "name": "form_valid", "signature": "def form_valid(self, form)" }, { "docstring": "Return the data used in the templates rendering.", "name": "get_context_data", "signature": "def get_context_data(self, **kwargs)" } ...
2
stack_v2_sparse_classes_30k_val_000439
Implement the Python class `ShowTokensView` described below. Class description: View for choosing course tokens that will be displayed. Check that the user's account is still active. Redirects to tokens view on form valid. Method signatures and docstrings: - def form_valid(self, form): Compute the success URL and cal...
Implement the Python class `ShowTokensView` described below. Class description: View for choosing course tokens that will be displayed. Check that the user's account is still active. Redirects to tokens view on form valid. Method signatures and docstrings: - def form_valid(self, form): Compute the success URL and cal...
06bc577d01d3dbf6c425e03dcb903977a38e377c
<|skeleton|> class ShowTokensView: """View for choosing course tokens that will be displayed. Check that the user's account is still active. Redirects to tokens view on form valid.""" def form_valid(self, form): """Compute the success URL and call super.form_valid()""" <|body_0|> def get_c...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ShowTokensView: """View for choosing course tokens that will be displayed. Check that the user's account is still active. Redirects to tokens view on form valid.""" def form_valid(self, form): """Compute the success URL and call super.form_valid()""" data = form.cleaned_data self....
the_stack_v2_python_sparse
cbt/views.py
Festusali/CBTest
train
6
c296f2751865c7f5f948a68ae90e26f5e00985b4
[ "self.max_read_iops = max_read_iops\nself.max_write_iops = max_write_iops\nself.read_iops_samples = read_iops_samples\nself.write_iops_samples = write_iops_samples", "if dictionary is None:\n return None\nmax_read_iops = dictionary.get('maxReadIops')\nmax_write_iops = dictionary.get('maxWriteIops')\nread_iops_...
<|body_start_0|> self.max_read_iops = max_read_iops self.max_write_iops = max_write_iops self.read_iops_samples = read_iops_samples self.write_iops_samples = write_iops_samples <|end_body_0|> <|body_start_1|> if dictionary is None: return None max_read_iops =...
Implementation of the 'IopsTile' model. IOPs information for dashboard. Attributes: max_read_iops (long|int): Maximum Read IOs per second in last 24 hours. max_write_iops (long|int): Maximum number of Write IOs per second in last 24 hours. read_iops_samples (list of Sample): Read IOs per second samples taken for the pa...
IopsTile
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IopsTile: """Implementation of the 'IopsTile' model. IOPs information for dashboard. Attributes: max_read_iops (long|int): Maximum Read IOs per second in last 24 hours. max_write_iops (long|int): Maximum number of Write IOs per second in last 24 hours. read_iops_samples (list of Sample): Read IOs...
stack_v2_sparse_classes_36k_train_009377
3,022
permissive
[ { "docstring": "Constructor for the IopsTile class", "name": "__init__", "signature": "def __init__(self, max_read_iops=None, max_write_iops=None, read_iops_samples=None, write_iops_samples=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary...
2
stack_v2_sparse_classes_30k_train_006975
Implement the Python class `IopsTile` described below. Class description: Implementation of the 'IopsTile' model. IOPs information for dashboard. Attributes: max_read_iops (long|int): Maximum Read IOs per second in last 24 hours. max_write_iops (long|int): Maximum number of Write IOs per second in last 24 hours. read_...
Implement the Python class `IopsTile` described below. Class description: Implementation of the 'IopsTile' model. IOPs information for dashboard. Attributes: max_read_iops (long|int): Maximum Read IOs per second in last 24 hours. max_write_iops (long|int): Maximum number of Write IOs per second in last 24 hours. read_...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class IopsTile: """Implementation of the 'IopsTile' model. IOPs information for dashboard. Attributes: max_read_iops (long|int): Maximum Read IOs per second in last 24 hours. max_write_iops (long|int): Maximum number of Write IOs per second in last 24 hours. read_iops_samples (list of Sample): Read IOs...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IopsTile: """Implementation of the 'IopsTile' model. IOPs information for dashboard. Attributes: max_read_iops (long|int): Maximum Read IOs per second in last 24 hours. max_write_iops (long|int): Maximum number of Write IOs per second in last 24 hours. read_iops_samples (list of Sample): Read IOs per second s...
the_stack_v2_python_sparse
cohesity_management_sdk/models/iops_tile.py
cohesity/management-sdk-python
train
24
8b3aaf3bd64ee5974784f01d2050272f652f9b50
[ "archive = models.Entry.objects.filter(is_published=True).order_by('-pub_date')\nif not archive:\n return {'list': archive, 'display_year': None, 'display_month': None}\nif display_year is None and display_month is None:\n display_year, display_month = (archive[0].pub_date.year, archive[0].pub_date.month)\nel...
<|body_start_0|> archive = models.Entry.objects.filter(is_published=True).order_by('-pub_date') if not archive: return {'list': archive, 'display_year': None, 'display_month': None} if display_year is None and display_month is None: display_year, display_month = (archive[...
BlogMixin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BlogMixin: def get_archive(request, display_year=None, display_month=None): """Generate a query set which list which provides a calendarised archive :param request : The WSGI request which triggers this archive display, used to identify if draft documents should be displayed. :param disp...
stack_v2_sparse_classes_36k_train_009378
7,485
no_license
[ { "docstring": "Generate a query set which list which provides a calendarised archive :param request : The WSGI request which triggers this archive display, used to identify if draft documents should be displayed. :param display_year : The year (integer or None) which should be opened by default when this archi...
3
stack_v2_sparse_classes_30k_train_013449
Implement the Python class `BlogMixin` described below. Class description: Implement the BlogMixin class. Method signatures and docstrings: - def get_archive(request, display_year=None, display_month=None): Generate a query set which list which provides a calendarised archive :param request : The WSGI request which t...
Implement the Python class `BlogMixin` described below. Class description: Implement the BlogMixin class. Method signatures and docstrings: - def get_archive(request, display_year=None, display_month=None): Generate a query set which list which provides a calendarised archive :param request : The WSGI request which t...
3379c5d5f2105a2cefc63ca6a5bf2bc3b995a8a3
<|skeleton|> class BlogMixin: def get_archive(request, display_year=None, display_month=None): """Generate a query set which list which provides a calendarised archive :param request : The WSGI request which triggers this archive display, used to identify if draft documents should be displayed. :param disp...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BlogMixin: def get_archive(request, display_year=None, display_month=None): """Generate a query set which list which provides a calendarised archive :param request : The WSGI request which triggers this archive display, used to identify if draft documents should be displayed. :param display_year : The...
the_stack_v2_python_sparse
blog/views.py
TonyFlury/SuffolkCycleDjango
train
0
df1ef78c6479f5da68addb41e3f82c2f3815efa1
[ "if not v:\n raise InvalidOrderData(order_id='order_id is required')\nif type(v) != int:\n raise InvalidOrderData(order_id='order_id must be integer')\nif v < 0 or v > 9223372036854775807:\n raise InvalidOrderData(order_id='order_id out of allowed range')\nreturn v", "if not v:\n raise InvalidOrderDat...
<|body_start_0|> if not v: raise InvalidOrderData(order_id='order_id is required') if type(v) != int: raise InvalidOrderData(order_id='order_id must be integer') if v < 0 or v > 9223372036854775807: raise InvalidOrderData(order_id='order_id out of allowed rang...
Структура данных, описывающая заказ
OrderDataModel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OrderDataModel: """Структура данных, описывающая заказ""" def validate_order_id(cls, v: int) -> int: """Валидирует order_id заказа""" <|body_0|> def validate_region(cls, v): """Валидирует регион заказа""" <|body_1|> def validate_weight(cls, v): ...
stack_v2_sparse_classes_36k_train_009379
8,762
no_license
[ { "docstring": "Валидирует order_id заказа", "name": "validate_order_id", "signature": "def validate_order_id(cls, v: int) -> int" }, { "docstring": "Валидирует регион заказа", "name": "validate_region", "signature": "def validate_region(cls, v)" }, { "docstring": "Валидирует вес...
5
stack_v2_sparse_classes_30k_train_016108
Implement the Python class `OrderDataModel` described below. Class description: Структура данных, описывающая заказ Method signatures and docstrings: - def validate_order_id(cls, v: int) -> int: Валидирует order_id заказа - def validate_region(cls, v): Валидирует регион заказа - def validate_weight(cls, v): Валидируе...
Implement the Python class `OrderDataModel` described below. Class description: Структура данных, описывающая заказ Method signatures and docstrings: - def validate_order_id(cls, v: int) -> int: Валидирует order_id заказа - def validate_region(cls, v): Валидирует регион заказа - def validate_weight(cls, v): Валидируе...
f1a908e5d6b30b826c38d24c52a721764f056fde
<|skeleton|> class OrderDataModel: """Структура данных, описывающая заказ""" def validate_order_id(cls, v: int) -> int: """Валидирует order_id заказа""" <|body_0|> def validate_region(cls, v): """Валидирует регион заказа""" <|body_1|> def validate_weight(cls, v): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OrderDataModel: """Структура данных, описывающая заказ""" def validate_order_id(cls, v: int) -> int: """Валидирует order_id заказа""" if not v: raise InvalidOrderData(order_id='order_id is required') if type(v) != int: raise InvalidOrderData(order_id='order...
the_stack_v2_python_sparse
candyapi/orders/validators.py
IntAlgambra/candyapi
train
0
de6e762640a323ce1881869d5afa307dc0c3eeb5
[ "self.keymap = {}\nself.freqmap = defaultdict(OrderedDict)\nself.cap = capacity\nself.minfreq = 1", "if key not in self.keymap:\n return -1\nval, freq = self.keymap[key]\ndel self.freqmap[freq][key]\nself.keymap[key] = (val, freq + 1)\nself.freqmap[freq + 1][key] = 0\nif not self.freqmap[self.minfreq]:\n se...
<|body_start_0|> self.keymap = {} self.freqmap = defaultdict(OrderedDict) self.cap = capacity self.minfreq = 1 <|end_body_0|> <|body_start_1|> if key not in self.keymap: return -1 val, freq = self.keymap[key] del self.freqmap[freq][key] self.k...
LFUCache2
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LFUCache2: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, val): """:type key: int :type value: int :rtype: void""" <|body_2|> <|end_sk...
stack_v2_sparse_classes_36k_train_009380
4,619
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 `LFUCache2` described below. Class description: Implement the LFUCache2 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, val): :type key: int :type value: int :rtype: void
Implement the Python class `LFUCache2` described below. Class description: Implement the LFUCache2 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, val): :type key: int :type value: int :rtype: void <|sk...
b1764cd62e1c8cb062869992d9eaa8b2d2fdf9c2
<|skeleton|> class LFUCache2: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, val): """:type key: int :type value: int :rtype: void""" <|body_2|> <|end_sk...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LFUCache2: def __init__(self, capacity): """:type capacity: int""" self.keymap = {} self.freqmap = defaultdict(OrderedDict) self.cap = capacity self.minfreq = 1 def get(self, key): """:type key: int :rtype: int""" if key not in self.keymap: ...
the_stack_v2_python_sparse
leetcode/design/hard/460. LFU Cache.py
Hk4Fun/algorithm_offer
train
1
bfb353d20936944ba22ac4c21d6befdc24ba3eff
[ "self.sequence = rnaSequence\nself.pairedBases = {}\nself.computationMatrix = [[]]", "self.computationMatrix = [[0 for i in range(len(self.sequence) + 1)] for j in range(len(self.sequence))]\ni = 2\nwhile i <= len(self.sequence):\n k = i\n j = 0\n while j <= len(self.sequence) - 2 and k <= len(self.seque...
<|body_start_0|> self.sequence = rnaSequence self.pairedBases = {} self.computationMatrix = [[]] <|end_body_0|> <|body_start_1|> self.computationMatrix = [[0 for i in range(len(self.sequence) + 1)] for j in range(len(self.sequence))] i = 2 while i <= len(self.sequence): ...
The algorithm of Nussinov is a RNA secondary structure folding algorithm. It was developed by Ruth Nussinov et al. and was published in 1978: Nussinov, Ruth, et al. "Algorithms for loop matchings." SIAM Journal on Applied mathematics 35.1 (1978): 68-82. http://rci.rutgers.edu/~piecze/GriggsNussinovKleitmanPieczenik.pdf
Nussinov
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Nussinov: """The algorithm of Nussinov is a RNA secondary structure folding algorithm. It was developed by Ruth Nussinov et al. and was published in 1978: Nussinov, Ruth, et al. "Algorithms for loop matchings." SIAM Journal on Applied mathematics 35.1 (1978): 68-82. http://rci.rutgers.edu/~piecze...
stack_v2_sparse_classes_36k_train_009381
4,360
no_license
[ { "docstring": "rnaSequence: The RNA sequence for which the folding should be computed.", "name": "__init__", "signature": "def __init__(self, rnaSequence)" }, { "docstring": "This function computes the matrix which the Nussinov-algorithm is based on.", "name": "computeMatrix", "signatur...
6
null
Implement the Python class `Nussinov` described below. Class description: The algorithm of Nussinov is a RNA secondary structure folding algorithm. It was developed by Ruth Nussinov et al. and was published in 1978: Nussinov, Ruth, et al. "Algorithms for loop matchings." SIAM Journal on Applied mathematics 35.1 (1978)...
Implement the Python class `Nussinov` described below. Class description: The algorithm of Nussinov is a RNA secondary structure folding algorithm. It was developed by Ruth Nussinov et al. and was published in 1978: Nussinov, Ruth, et al. "Algorithms for loop matchings." SIAM Journal on Applied mathematics 35.1 (1978)...
20d8df6172906337f81583dabb841d66b8f31857
<|skeleton|> class Nussinov: """The algorithm of Nussinov is a RNA secondary structure folding algorithm. It was developed by Ruth Nussinov et al. and was published in 1978: Nussinov, Ruth, et al. "Algorithms for loop matchings." SIAM Journal on Applied mathematics 35.1 (1978): 68-82. http://rci.rutgers.edu/~piecze...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Nussinov: """The algorithm of Nussinov is a RNA secondary structure folding algorithm. It was developed by Ruth Nussinov et al. and was published in 1978: Nussinov, Ruth, et al. "Algorithms for loop matchings." SIAM Journal on Applied mathematics 35.1 (1978): 68-82. http://rci.rutgers.edu/~piecze/GriggsNussin...
the_stack_v2_python_sparse
new_algs/Sequence+algorithms/Needleman-Wunsch+algorithm/nussinov.py
coolsnake/JupyterNotebook
train
0
00bc4d8f7226100738131c6b2696c0838e227e72
[ "self.__hazard_func = hazard_func\nself.__likelihood_func = likelihood_func\nself.__eps = eps\nself.__R_prev = np.ones(1)\nself.__run_length = 0", "predprobs = self.__likelihood_func.pdf(x)\nself.__run_length = len(self.__R_prev)\nH = self.__hazard_func(self.__run_length)\nR = np.zeros(self.__run_length + 1)\nR[1...
<|body_start_0|> self.__hazard_func = hazard_func self.__likelihood_func = likelihood_func self.__eps = eps self.__R_prev = np.ones(1) self.__run_length = 0 <|end_body_0|> <|body_start_1|> predprobs = self.__likelihood_func.pdf(x) self.__run_length = len(self.__R...
BOCPD (Prospective)
Prospective
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Prospective: """BOCPD (Prospective)""" def __init__(self, hazard_func, likelihood_func, eps=0.0001): """Args: hazard_func: hazard function likelihood_func: likelihood function""" <|body_0|> def update(self, x): """calculate the score of the input datum Args: x: i...
stack_v2_sparse_classes_36k_train_009382
5,419
permissive
[ { "docstring": "Args: hazard_func: hazard function likelihood_func: likelihood function", "name": "__init__", "signature": "def __init__(self, hazard_func, likelihood_func, eps=0.0001)" }, { "docstring": "calculate the score of the input datum Args: x: input datum Returns: float: score of the in...
2
stack_v2_sparse_classes_30k_test_000569
Implement the Python class `Prospective` described below. Class description: BOCPD (Prospective) Method signatures and docstrings: - def __init__(self, hazard_func, likelihood_func, eps=0.0001): Args: hazard_func: hazard function likelihood_func: likelihood function - def update(self, x): calculate the score of the i...
Implement the Python class `Prospective` described below. Class description: BOCPD (Prospective) Method signatures and docstrings: - def __init__(self, hazard_func, likelihood_func, eps=0.0001): Args: hazard_func: hazard function likelihood_func: likelihood function - def update(self, x): calculate the score of the i...
7faf99f36ac012799602f32b359dcda089bcd119
<|skeleton|> class Prospective: """BOCPD (Prospective)""" def __init__(self, hazard_func, likelihood_func, eps=0.0001): """Args: hazard_func: hazard function likelihood_func: likelihood function""" <|body_0|> def update(self, x): """calculate the score of the input datum Args: x: i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Prospective: """BOCPD (Prospective)""" def __init__(self, hazard_func, likelihood_func, eps=0.0001): """Args: hazard_func: hazard function likelihood_func: likelihood function""" self.__hazard_func = hazard_func self.__likelihood_func = likelihood_func self.__eps = eps ...
the_stack_v2_python_sparse
bocpd/bocpd.py
IbarakikenYukishi/two-stage-MDL
train
4
d73db0d469c9ef6549e05e9f8e33365764b552e0
[ "mode = 'r'\nif byte:\n mode += 'b'\ntry:\n with open(src, mode) as file:\n content = file.read()\n file.close()\n return content\nexcept FileNotFoundError:\n return None", "with open(src, 'w') as file:\n file.write(content)\n file.close()" ]
<|body_start_0|> mode = 'r' if byte: mode += 'b' try: with open(src, mode) as file: content = file.read() file.close() return content except FileNotFoundError: return None <|end_body_0|> <|body_start_1|>...
Class to handle file opening and saving in operating system.
FileRepository
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FileRepository: """Class to handle file opening and saving in operating system.""" def open_file(self, src, byte=False): """open_file handles opening files for importing memos as markdown files and importing images to database. Handles interaction with OS. Args: src: location for fil...
stack_v2_sparse_classes_36k_train_009383
1,312
no_license
[ { "docstring": "open_file handles opening files for importing memos as markdown files and importing images to database. Handles interaction with OS. Args: src: location for file to be opened byte: optional, used to read images as bytes to be coverted to base64-string. If True, function will add byte indicator i...
2
stack_v2_sparse_classes_30k_train_011607
Implement the Python class `FileRepository` described below. Class description: Class to handle file opening and saving in operating system. Method signatures and docstrings: - def open_file(self, src, byte=False): open_file handles opening files for importing memos as markdown files and importing images to database....
Implement the Python class `FileRepository` described below. Class description: Class to handle file opening and saving in operating system. Method signatures and docstrings: - def open_file(self, src, byte=False): open_file handles opening files for importing memos as markdown files and importing images to database....
816990c4432d4e9db0818f6747a9ee482bb9f192
<|skeleton|> class FileRepository: """Class to handle file opening and saving in operating system.""" def open_file(self, src, byte=False): """open_file handles opening files for importing memos as markdown files and importing images to database. Handles interaction with OS. Args: src: location for fil...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FileRepository: """Class to handle file opening and saving in operating system.""" def open_file(self, src, byte=False): """open_file handles opening files for importing memos as markdown files and importing images to database. Handles interaction with OS. Args: src: location for file to be opene...
the_stack_v2_python_sparse
src/repositories/file_repository.py
FinThunderstorm/ohte
train
0
1a3f2350e08643506ab97436b3bac296f297cd0e
[ "body = eval(response_self.request.body)\nuser_id = str(body['userId'])\ndata = str(body['data'])\nif judgeIfPermiss(user_id=user_id, mode=1, page='systemUserTeam') == False:\n return {'status': 0, 'errorInfo': '用户没有权限设置'}\nelse:\n return self.insertInMysql(data)", "try:\n data = eval(data)\nexcept:\n ...
<|body_start_0|> body = eval(response_self.request.body) user_id = str(body['userId']) data = str(body['data']) if judgeIfPermiss(user_id=user_id, mode=1, page='systemUserTeam') == False: return {'status': 0, 'errorInfo': '用户没有权限设置'} else: return self.inse...
添加一个用户,前端发送来的信息为: "userId": "admin", "data": { "name": "用户组三", "description": "巴拉巴拉", } 本函数接收该信息,判断userId用户是否拥有该权限并根据结果将其添加入库,返回: { "status": 1, #1表示成功,0表示失败 "errorInfo": "用户没有权限设置", #status为0时,前端展示errorinfo }
AddOneUserTeam
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AddOneUserTeam: """添加一个用户,前端发送来的信息为: "userId": "admin", "data": { "name": "用户组三", "description": "巴拉巴拉", } 本函数接收该信息,判断userId用户是否拥有该权限并根据结果将其添加入库,返回: { "status": 1, #1表示成功,0表示失败 "errorInfo": "用户没有权限设置", #status为0时,前端展示errorinfo }""" def entry(self, response_self): """response为tornado下...
stack_v2_sparse_classes_36k_train_009384
2,571
no_license
[ { "docstring": "response为tornado下get函数接收到前端数据后的self", "name": "entry", "signature": "def entry(self, response_self)" }, { "docstring": "对前端发来的data进行校验", "name": "judgePara", "signature": "def judgePara(self, data)" }, { "docstring": "将data中用户组信息入库", "name": "insertInMysql", ...
3
stack_v2_sparse_classes_30k_train_020998
Implement the Python class `AddOneUserTeam` described below. Class description: 添加一个用户,前端发送来的信息为: "userId": "admin", "data": { "name": "用户组三", "description": "巴拉巴拉", } 本函数接收该信息,判断userId用户是否拥有该权限并根据结果将其添加入库,返回: { "status": 1, #1表示成功,0表示失败 "errorInfo": "用户没有权限设置", #status为0时,前端展示errorinfo } Method signatures and docstr...
Implement the Python class `AddOneUserTeam` described below. Class description: 添加一个用户,前端发送来的信息为: "userId": "admin", "data": { "name": "用户组三", "description": "巴拉巴拉", } 本函数接收该信息,判断userId用户是否拥有该权限并根据结果将其添加入库,返回: { "status": 1, #1表示成功,0表示失败 "errorInfo": "用户没有权限设置", #status为0时,前端展示errorinfo } Method signatures and docstr...
a31364869894c72349e3587944ecb4fda018e020
<|skeleton|> class AddOneUserTeam: """添加一个用户,前端发送来的信息为: "userId": "admin", "data": { "name": "用户组三", "description": "巴拉巴拉", } 本函数接收该信息,判断userId用户是否拥有该权限并根据结果将其添加入库,返回: { "status": 1, #1表示成功,0表示失败 "errorInfo": "用户没有权限设置", #status为0时,前端展示errorinfo }""" def entry(self, response_self): """response为tornado下...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AddOneUserTeam: """添加一个用户,前端发送来的信息为: "userId": "admin", "data": { "name": "用户组三", "description": "巴拉巴拉", } 本函数接收该信息,判断userId用户是否拥有该权限并根据结果将其添加入库,返回: { "status": 1, #1表示成功,0表示失败 "errorInfo": "用户没有权限设置", #status为0时,前端展示errorinfo }""" def entry(self, response_self): """response为tornado下get函数接收到前端数据后...
the_stack_v2_python_sparse
tornado/system/add_one_user_team.py
fxrc/care-system
train
1
ed0e5486a930eac5e46f41a6091d2fb40fd24738
[ "for key, value in son.items():\n if isinstance(value, api.CachedValue):\n son[key] = value.payload\n son['meta'] = value.metadata\n elif isinstance(value, dict):\n son[key] = self.transform_incoming(value, collection)\nreturn son", "metadata = None\nif isinstance(son, dict) and all((k ...
<|body_start_0|> for key, value in son.items(): if isinstance(value, api.CachedValue): son[key] = value.payload son['meta'] = value.metadata elif isinstance(value, dict): son[key] = self.transform_incoming(value, collection) return ...
Base transformation class to store and read dogpile cached data from MongoDB. This is needed as dogpile internally stores data as a custom class i.e. dogpile.cache.api.CachedValue Note: Custom manipulator needs to always override ``transform_incoming`` and ``transform_outgoing`` methods. MongoDB manipulator logic speci...
BaseTransform
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseTransform: """Base transformation class to store and read dogpile cached data from MongoDB. This is needed as dogpile internally stores data as a custom class i.e. dogpile.cache.api.CachedValue Note: Custom manipulator needs to always override ``transform_incoming`` and ``transform_outgoing``...
stack_v2_sparse_classes_36k_train_009385
23,527
permissive
[ { "docstring": "Used while saving data to MongoDB.", "name": "transform_incoming", "signature": "def transform_incoming(self, son, collection)" }, { "docstring": "Used while reading data from MongoDB.", "name": "transform_outgoing", "signature": "def transform_outgoing(self, son, collect...
2
stack_v2_sparse_classes_30k_train_002476
Implement the Python class `BaseTransform` described below. Class description: Base transformation class to store and read dogpile cached data from MongoDB. This is needed as dogpile internally stores data as a custom class i.e. dogpile.cache.api.CachedValue Note: Custom manipulator needs to always override ``transfor...
Implement the Python class `BaseTransform` described below. Class description: Base transformation class to store and read dogpile cached data from MongoDB. This is needed as dogpile internally stores data as a custom class i.e. dogpile.cache.api.CachedValue Note: Custom manipulator needs to always override ``transfor...
0dfdfcfbc239d55d0669cd32e92b93487939ef84
<|skeleton|> class BaseTransform: """Base transformation class to store and read dogpile cached data from MongoDB. This is needed as dogpile internally stores data as a custom class i.e. dogpile.cache.api.CachedValue Note: Custom manipulator needs to always override ``transform_incoming`` and ``transform_outgoing``...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BaseTransform: """Base transformation class to store and read dogpile cached data from MongoDB. This is needed as dogpile internally stores data as a custom class i.e. dogpile.cache.api.CachedValue Note: Custom manipulator needs to always override ``transform_incoming`` and ``transform_outgoing`` methods. Mon...
the_stack_v2_python_sparse
keystone/common/cache/backends/mongo.py
ging/keystone
train
4
345280c6c4b3d63a3e64f006a2960838ac3c0c5c
[ "self.templdirs = [os.path.dirname(__file__)]\nif dirs:\n self.templdirs.extend(dirs)\nself._charset = charset\ndu = False\nif self._charset.lower() != 'utf-8':\n du = True\nself.tlookup = TemplateLookup(directories=self.templdirs, disable_unicode=du, input_encoding=self._charset, output_encoding=self._charse...
<|body_start_0|> self.templdirs = [os.path.dirname(__file__)] if dirs: self.templdirs.extend(dirs) self._charset = charset du = False if self._charset.lower() != 'utf-8': du = True self.tlookup = TemplateLookup(directories=self.templdirs, disable_u...
A TemplateEngine class for Mako template.
MakoTemplateEngine
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MakoTemplateEngine: """A TemplateEngine class for Mako template.""" def __init__(self, extension=DEFAULT_EXTENSION, dirs=[], charset='utf-8'): """Initialization method""" <|body_0|> def get_template(self, path='', string='', tid=''): """A method to obtain templat...
stack_v2_sparse_classes_36k_train_009386
8,943
permissive
[ { "docstring": "Initialization method", "name": "__init__", "signature": "def __init__(self, extension=DEFAULT_EXTENSION, dirs=[], charset='utf-8')" }, { "docstring": "A method to obtain template object, by using given path or string. When argment path is given, method produce template string vi...
3
stack_v2_sparse_classes_30k_train_012372
Implement the Python class `MakoTemplateEngine` described below. Class description: A TemplateEngine class for Mako template. Method signatures and docstrings: - def __init__(self, extension=DEFAULT_EXTENSION, dirs=[], charset='utf-8'): Initialization method - def get_template(self, path='', string='', tid=''): A met...
Implement the Python class `MakoTemplateEngine` described below. Class description: A TemplateEngine class for Mako template. Method signatures and docstrings: - def __init__(self, extension=DEFAULT_EXTENSION, dirs=[], charset='utf-8'): Initialization method - def get_template(self, path='', string='', tid=''): A met...
e1209f7d44d1c59ff9d373b7d89d414f31a9c28b
<|skeleton|> class MakoTemplateEngine: """A TemplateEngine class for Mako template.""" def __init__(self, extension=DEFAULT_EXTENSION, dirs=[], charset='utf-8'): """Initialization method""" <|body_0|> def get_template(self, path='', string='', tid=''): """A method to obtain templat...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MakoTemplateEngine: """A TemplateEngine class for Mako template.""" def __init__(self, extension=DEFAULT_EXTENSION, dirs=[], charset='utf-8'): """Initialization method""" self.templdirs = [os.path.dirname(__file__)] if dirs: self.templdirs.extend(dirs) self._ch...
the_stack_v2_python_sparse
aha/widget/handler.py
Letractively/aha-gae
train
0
5f9dd74edaf1bd7e7a8605ccd8aa461770078303
[ "ArgsUtils.addIfMissing('yLabel', 'Frequency', kwargs)\nsuper(BarPlot, self).__init__(**kwargs)\nself.color = kwargs.get('color', 'b')\nself.strokeColor = kwargs.get('strokeColor', 'none')\nself.data = kwargs.get('data', [])\nself.isLog = kwargs.get('isLog', False)", "if not self.xLimits or not len(self.xLimits) ...
<|body_start_0|> ArgsUtils.addIfMissing('yLabel', 'Frequency', kwargs) super(BarPlot, self).__init__(**kwargs) self.color = kwargs.get('color', 'b') self.strokeColor = kwargs.get('strokeColor', 'none') self.data = kwargs.get('data', []) self.isLog = kwargs.get('isLog', Fa...
A class for...
BarPlot
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BarPlot: """A class for...""" def __init__(self, **kwargs): """Creates a new instance of BarPlot.""" <|body_0|> def shaveDataToXLimits(self): """shaveData doc...""" <|body_1|> def _plot(self): """_plot doc...""" <|body_2|> def _d...
stack_v2_sparse_classes_36k_train_009387
3,328
no_license
[ { "docstring": "Creates a new instance of BarPlot.", "name": "__init__", "signature": "def __init__(self, **kwargs)" }, { "docstring": "shaveData doc...", "name": "shaveDataToXLimits", "signature": "def shaveDataToXLimits(self)" }, { "docstring": "_plot doc...", "name": "_plo...
4
null
Implement the Python class `BarPlot` described below. Class description: A class for... Method signatures and docstrings: - def __init__(self, **kwargs): Creates a new instance of BarPlot. - def shaveDataToXLimits(self): shaveData doc... - def _plot(self): _plot doc... - def _dataItemToValue(cls, value): _dataItemToV...
Implement the Python class `BarPlot` described below. Class description: A class for... Method signatures and docstrings: - def __init__(self, **kwargs): Creates a new instance of BarPlot. - def shaveDataToXLimits(self): shaveData doc... - def _plot(self): _plot doc... - def _dataItemToValue(cls, value): _dataItemToV...
bcd0d80077c68cf4bb515d643e51f62dd6c4caaa
<|skeleton|> class BarPlot: """A class for...""" def __init__(self, **kwargs): """Creates a new instance of BarPlot.""" <|body_0|> def shaveDataToXLimits(self): """shaveData doc...""" <|body_1|> def _plot(self): """_plot doc...""" <|body_2|> def _d...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BarPlot: """A class for...""" def __init__(self, **kwargs): """Creates a new instance of BarPlot.""" ArgsUtils.addIfMissing('yLabel', 'Frequency', kwargs) super(BarPlot, self).__init__(**kwargs) self.color = kwargs.get('color', 'b') self.strokeColor = kwargs.get('s...
the_stack_v2_python_sparse
src/cadence/analysis/shared/plotting/BarPlot.py
sernst/Cadence
train
2
8e174c9f68a2282c3ff7ef48282a2251f300468b
[ "self.episodes = []\nself.buffer_size = buffer_size\nself.timesteps = 0\nself.rollout_length = rollout_length\nself.batch_size = batch_size\nself.learning_starts = learning_starts", "self.timesteps += batch.count\nepisodes = batch.split_by_episode()\nfor i, e in enumerate(episodes):\n episodes[i] = self.prepro...
<|body_start_0|> self.episodes = [] self.buffer_size = buffer_size self.timesteps = 0 self.rollout_length = rollout_length self.batch_size = batch_size self.learning_starts = learning_starts <|end_body_0|> <|body_start_1|> self.timesteps += batch.count ep...
EpisodicBuffer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EpisodicBuffer: def __init__(self, buffer_size: int=1000, rollout_length: int=50, batch_size: int=50, learning_starts: int=1000): """Data structure that stores episodes and samples chunks of size length from episodes Args: max_length: Maximum episodes it can store length: Episode chunkin...
stack_v2_sparse_classes_36k_train_009388
9,345
no_license
[ { "docstring": "Data structure that stores episodes and samples chunks of size length from episodes Args: max_length: Maximum episodes it can store length: Episode chunking lengh in sample()", "name": "__init__", "signature": "def __init__(self, buffer_size: int=1000, rollout_length: int=50, batch_size:...
4
null
Implement the Python class `EpisodicBuffer` described below. Class description: Implement the EpisodicBuffer class. Method signatures and docstrings: - def __init__(self, buffer_size: int=1000, rollout_length: int=50, batch_size: int=50, learning_starts: int=1000): Data structure that stores episodes and samples chun...
Implement the Python class `EpisodicBuffer` described below. Class description: Implement the EpisodicBuffer class. Method signatures and docstrings: - def __init__(self, buffer_size: int=1000, rollout_length: int=50, batch_size: int=50, learning_starts: int=1000): Data structure that stores episodes and samples chun...
b96284768a5bd7e5d7f407b28ca1a905a7575c93
<|skeleton|> class EpisodicBuffer: def __init__(self, buffer_size: int=1000, rollout_length: int=50, batch_size: int=50, learning_starts: int=1000): """Data structure that stores episodes and samples chunks of size length from episodes Args: max_length: Maximum episodes it can store length: Episode chunkin...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EpisodicBuffer: def __init__(self, buffer_size: int=1000, rollout_length: int=50, batch_size: int=50, learning_starts: int=1000): """Data structure that stores episodes and samples chunks of size length from episodes Args: max_length: Maximum episodes it can store length: Episode chunking lengh in sam...
the_stack_v2_python_sparse
agents/dreamer/dreamer.py
zizai/notebooks
train
3
3bc73e5bad6d23843d9e5538e1a24e56462adc64
[ "use_base_name = base_name\nif use_base_name is None:\n use_base_name = self.get_base_name(candidate_id, generation)\nuse_dir = experiment_dir\nif generation is not None:\n filer = GenerationFiler(experiment_dir, generation)\n use_dir = filer.get_generation_dir()\ndictionary_converter = CandidateDictionary...
<|body_start_0|> use_base_name = base_name if use_base_name is None: use_base_name = self.get_base_name(candidate_id, generation) use_dir = experiment_dir if generation is not None: filer = GenerationFiler(experiment_dir, generation) use_dir = filer.ge...
A class which knows how to persist a candidate dict to/from file(s). A candidate contains a few major fields: * id - the string id of the candidate unique to at least the experiment * identity - a dictionary containing information about the birth circumstances of the candidate * interpretation - which contains a digest...
CandidatePersistence
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CandidatePersistence: """A class which knows how to persist a candidate dict to/from file(s). A candidate contains a few major fields: * id - the string id of the candidate unique to at least the experiment * identity - a dictionary containing information about the birth circumstances of the cand...
stack_v2_sparse_classes_36k_train_009389
2,857
no_license
[ { "docstring": "Constructor. :param experiment_dir: the directory where experiment results go :param candidate_id: the id of the candidate :param generation: the generation number for the candidate :param base_name: a full base name to use (minus extension) :param logger: The logger to use for messaging", "...
2
null
Implement the Python class `CandidatePersistence` described below. Class description: A class which knows how to persist a candidate dict to/from file(s). A candidate contains a few major fields: * id - the string id of the candidate unique to at least the experiment * identity - a dictionary containing information ab...
Implement the Python class `CandidatePersistence` described below. Class description: A class which knows how to persist a candidate dict to/from file(s). A candidate contains a few major fields: * id - the string id of the candidate unique to at least the experiment * identity - a dictionary containing information ab...
99c2f401d6c4b203ee439ed607985a918d0c3c7e
<|skeleton|> class CandidatePersistence: """A class which knows how to persist a candidate dict to/from file(s). A candidate contains a few major fields: * id - the string id of the candidate unique to at least the experiment * identity - a dictionary containing information about the birth circumstances of the cand...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CandidatePersistence: """A class which knows how to persist a candidate dict to/from file(s). A candidate contains a few major fields: * id - the string id of the candidate unique to at least the experiment * identity - a dictionary containing information about the birth circumstances of the candidate * inter...
the_stack_v2_python_sparse
framework/persistence/candidate_persistence.py
Cognizant-CDB-AIA-BAI-AI-OI/LEAF-ENN-Training-V2
train
0
76dfa2d0dbb2711c5c98fefe831a2e84e4733d1e
[ "now_sum = cnt = max_num = 0\nfor i, v in enumerate(light):\n now_sum += 1\n max_num = max(v, max_num)\n if max_num == now_sum:\n cnt += 1\nreturn cnt", "answer = 0\nmax_num = 0\nfor index_i, i in enumerate(light):\n if max_num < i:\n max_num = i\n if index_i + 1 == max_num:\n ...
<|body_start_0|> now_sum = cnt = max_num = 0 for i, v in enumerate(light): now_sum += 1 max_num = max(v, max_num) if max_num == now_sum: cnt += 1 return cnt <|end_body_0|> <|body_start_1|> answer = 0 max_num = 0 for ind...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def numTimesAllBlue(self, light): """:type light: List[int] :rtype: int""" <|body_0|> def numTimesAllBlue(self, light): """:type light: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> now_sum = cnt = max_num = 0 ...
stack_v2_sparse_classes_36k_train_009390
875
no_license
[ { "docstring": ":type light: List[int] :rtype: int", "name": "numTimesAllBlue", "signature": "def numTimesAllBlue(self, light)" }, { "docstring": ":type light: List[int] :rtype: int", "name": "numTimesAllBlue", "signature": "def numTimesAllBlue(self, light)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numTimesAllBlue(self, light): :type light: List[int] :rtype: int - def numTimesAllBlue(self, light): :type light: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numTimesAllBlue(self, light): :type light: List[int] :rtype: int - def numTimesAllBlue(self, light): :type light: List[int] :rtype: int <|skeleton|> class Solution: def...
a509b383a42f54313970168d9faa11f088f18708
<|skeleton|> class Solution: def numTimesAllBlue(self, light): """:type light: List[int] :rtype: int""" <|body_0|> def numTimesAllBlue(self, light): """:type light: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def numTimesAllBlue(self, light): """:type light: List[int] :rtype: int""" now_sum = cnt = max_num = 0 for i, v in enumerate(light): now_sum += 1 max_num = max(v, max_num) if max_num == now_sum: cnt += 1 return cnt ...
the_stack_v2_python_sparse
1375_Bulb_Switcher_III.py
bingli8802/leetcode
train
0
ab5fcb81574a38223b9c2e5f54c6b8cc599c6491
[ "session = self.login()\nitems = session.query(NavbarItems)\nresponse = [row2dict(item) for item in items]\nself.logout(session)\nreturn response", "session = self.login()\nitems = session.query(JqlLinks)\nresponse = [row2dict(item) for item in items]\nself.logout(session)\nreturn response", "session = self.log...
<|body_start_0|> session = self.login() items = session.query(NavbarItems) response = [row2dict(item) for item in items] self.logout(session) return response <|end_body_0|> <|body_start_1|> session = self.login() items = session.query(JqlLinks) response =...
Actions for navbar in the DB.
SQLNavBar
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SQLNavBar: """Actions for navbar in the DB.""" def get_navbar_items(self): """Gets all navbar items from DB.""" <|body_0|> def get_jql_links(self): """Gets all JQL links for the DB.""" <|body_1|> def set_navbar_item(self, item): """Sets a nav...
stack_v2_sparse_classes_36k_train_009391
1,226
no_license
[ { "docstring": "Gets all navbar items from DB.", "name": "get_navbar_items", "signature": "def get_navbar_items(self)" }, { "docstring": "Gets all JQL links for the DB.", "name": "get_jql_links", "signature": "def get_jql_links(self)" }, { "docstring": "Sets a navbar item's data....
3
stack_v2_sparse_classes_30k_val_000126
Implement the Python class `SQLNavBar` described below. Class description: Actions for navbar in the DB. Method signatures and docstrings: - def get_navbar_items(self): Gets all navbar items from DB. - def get_jql_links(self): Gets all JQL links for the DB. - def set_navbar_item(self, item): Sets a navbar item's data...
Implement the Python class `SQLNavBar` described below. Class description: Actions for navbar in the DB. Method signatures and docstrings: - def get_navbar_items(self): Gets all navbar items from DB. - def get_jql_links(self): Gets all JQL links for the DB. - def set_navbar_item(self, item): Sets a navbar item's data...
52ba4eecd727c200f8ad82652434d171655c5f0a
<|skeleton|> class SQLNavBar: """Actions for navbar in the DB.""" def get_navbar_items(self): """Gets all navbar items from DB.""" <|body_0|> def get_jql_links(self): """Gets all JQL links for the DB.""" <|body_1|> def set_navbar_item(self, item): """Sets a nav...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SQLNavBar: """Actions for navbar in the DB.""" def get_navbar_items(self): """Gets all navbar items from DB.""" session = self.login() items = session.query(NavbarItems) response = [row2dict(item) for item in items] self.logout(session) return response ...
the_stack_v2_python_sparse
devcenter/sql/navbar.py
ljmerza/devCenter
train
0
01757b69845e10b6b1e6169254f76a7e45bb57a3
[ "super(ServerXMLRPCLog, self).parse_content(content)\nself.last = None\nmsg_info = {}\nfor l in reversed(self.lines):\n msg_info = self._parse_line(l)\n if 'client_ip' in msg_info:\n break\nself.last = msg_info", "msg_info = dict()\nmsg_info['raw_message'] = line\nmatch = self._LINE_RE.search(line)\n...
<|body_start_0|> super(ServerXMLRPCLog, self).parse_content(content) self.last = None msg_info = {} for l in reversed(self.lines): msg_info = self._parse_line(l) if 'client_ip' in msg_info: break self.last = msg_info <|end_body_0|> <|body_...
Class for parsing the ``rhn_server_xmlrpc.log`` file. Sample log line:: 2016/04/11 05:52:01 -04:00 23630 10.4.4.17: xmlrpc/registration.welcome_message('lang: None',) Attributes: lines (list): All lines captured in this file. last (dict): Dict of the last log line. Examples: >>> log = shared[ServerXMLRPCLog] >>> log.fi...
ServerXMLRPCLog
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ServerXMLRPCLog: """Class for parsing the ``rhn_server_xmlrpc.log`` file. Sample log line:: 2016/04/11 05:52:01 -04:00 23630 10.4.4.17: xmlrpc/registration.welcome_message('lang: None',) Attributes: lines (list): All lines captured in this file. last (dict): Dict of the last log line. Examples: >...
stack_v2_sparse_classes_36k_train_009392
7,383
permissive
[ { "docstring": "Parse the logs as its super class LogFileOutput. And get the last complete log. If the last line is not complete, then get from its previous line.", "name": "parse_content", "signature": "def parse_content(self, content)" }, { "docstring": "Parse a log line using the XMLRPC regul...
2
null
Implement the Python class `ServerXMLRPCLog` described below. Class description: Class for parsing the ``rhn_server_xmlrpc.log`` file. Sample log line:: 2016/04/11 05:52:01 -04:00 23630 10.4.4.17: xmlrpc/registration.welcome_message('lang: None',) Attributes: lines (list): All lines captured in this file. last (dict):...
Implement the Python class `ServerXMLRPCLog` described below. Class description: Class for parsing the ``rhn_server_xmlrpc.log`` file. Sample log line:: 2016/04/11 05:52:01 -04:00 23630 10.4.4.17: xmlrpc/registration.welcome_message('lang: None',) Attributes: lines (list): All lines captured in this file. last (dict):...
b0ea07fc3f4dd8801b505fe70e9b36e628152c4a
<|skeleton|> class ServerXMLRPCLog: """Class for parsing the ``rhn_server_xmlrpc.log`` file. Sample log line:: 2016/04/11 05:52:01 -04:00 23630 10.4.4.17: xmlrpc/registration.welcome_message('lang: None',) Attributes: lines (list): All lines captured in this file. last (dict): Dict of the last log line. Examples: >...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ServerXMLRPCLog: """Class for parsing the ``rhn_server_xmlrpc.log`` file. Sample log line:: 2016/04/11 05:52:01 -04:00 23630 10.4.4.17: xmlrpc/registration.welcome_message('lang: None',) Attributes: lines (list): All lines captured in this file. last (dict): Dict of the last log line. Examples: >>> log = shar...
the_stack_v2_python_sparse
insights/parsers/rhn_logs.py
RedHatInsights/insights-core
train
144
e85e146b6da17ff5b9efeb4c044d6b3c5e360557
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn UserExperienceAnalyticsBaseline()", "from .entity import Entity\nfrom .user_experience_analytics_category import UserExperienceAnalyticsCategory\nfrom .entity import Entity\nfrom .user_experience_analytics_category import UserExperienc...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return UserExperienceAnalyticsBaseline() <|end_body_0|> <|body_start_1|> from .entity import Entity from .user_experience_analytics_category import UserExperienceAnalyticsCategory from ...
The user experience analytics baseline entity contains baseline values against which to compare the user experience analytics scores.
UserExperienceAnalyticsBaseline
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserExperienceAnalyticsBaseline: """The user experience analytics baseline entity contains baseline values against which to compare the user experience analytics scores.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserExperienceAnalyticsBaseline: "...
stack_v2_sparse_classes_36k_train_009393
6,064
permissive
[ { "docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: UserExperienceAnalyticsBaseline", "name": "create_from_discriminator_value", "signature": "def create_from_d...
3
stack_v2_sparse_classes_30k_train_015180
Implement the Python class `UserExperienceAnalyticsBaseline` described below. Class description: The user experience analytics baseline entity contains baseline values against which to compare the user experience analytics scores. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Opt...
Implement the Python class `UserExperienceAnalyticsBaseline` described below. Class description: The user experience analytics baseline entity contains baseline values against which to compare the user experience analytics scores. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Opt...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class UserExperienceAnalyticsBaseline: """The user experience analytics baseline entity contains baseline values against which to compare the user experience analytics scores.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserExperienceAnalyticsBaseline: "...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserExperienceAnalyticsBaseline: """The user experience analytics baseline entity contains baseline values against which to compare the user experience analytics scores.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserExperienceAnalyticsBaseline: """Creates a n...
the_stack_v2_python_sparse
msgraph/generated/models/user_experience_analytics_baseline.py
microsoftgraph/msgraph-sdk-python
train
135
582f5f7cc2cbdc26dc47ba28039f489fab195fb4
[ "self.output_path = output_path\nself.max_concurrent_invocations_per_instance = max_concurrent_invocations_per_instance\nself.kms_key_id = kms_key_id\nself.notification_config = notification_config\nself.failure_path = failure_path", "request_dict = {'OutputConfig': {'S3OutputPath': self.output_path, 'S3FailurePa...
<|body_start_0|> self.output_path = output_path self.max_concurrent_invocations_per_instance = max_concurrent_invocations_per_instance self.kms_key_id = kms_key_id self.notification_config = notification_config self.failure_path = failure_path <|end_body_0|> <|body_start_1|> ...
Configuration object passed in when deploying models to Amazon SageMaker Endpoints. This object specifies configuration related to async endpoint. Use this configuration when trying to create async endpoint and make async inference
AsyncInferenceConfig
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AsyncInferenceConfig: """Configuration object passed in when deploying models to Amazon SageMaker Endpoints. This object specifies configuration related to async endpoint. Use this configuration when trying to create async endpoint and make async inference""" def __init__(self, output_path=N...
stack_v2_sparse_classes_36k_train_009394
4,694
permissive
[ { "docstring": "Initialize an AsyncInferenceConfig object for async inference configuration. Args: output_path (str): Optional. The Amazon S3 location that endpoints upload inference responses to. If no value is provided, Amazon SageMaker will use default Amazon S3 Async Inference output path. (Default: None) m...
2
stack_v2_sparse_classes_30k_train_007890
Implement the Python class `AsyncInferenceConfig` described below. Class description: Configuration object passed in when deploying models to Amazon SageMaker Endpoints. This object specifies configuration related to async endpoint. Use this configuration when trying to create async endpoint and make async inference ...
Implement the Python class `AsyncInferenceConfig` described below. Class description: Configuration object passed in when deploying models to Amazon SageMaker Endpoints. This object specifies configuration related to async endpoint. Use this configuration when trying to create async endpoint and make async inference ...
8d5d7fd8ae1a917ed3e2b988d5e533bce244fd85
<|skeleton|> class AsyncInferenceConfig: """Configuration object passed in when deploying models to Amazon SageMaker Endpoints. This object specifies configuration related to async endpoint. Use this configuration when trying to create async endpoint and make async inference""" def __init__(self, output_path=N...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AsyncInferenceConfig: """Configuration object passed in when deploying models to Amazon SageMaker Endpoints. This object specifies configuration related to async endpoint. Use this configuration when trying to create async endpoint and make async inference""" def __init__(self, output_path=None, max_conc...
the_stack_v2_python_sparse
src/sagemaker/async_inference/async_inference_config.py
aws/sagemaker-python-sdk
train
2,050
e4be228ce98ccdb2030d79c2cae1b6d44268ee6f
[ "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...
A set of methods for managing ClickHouse Database resources. NOTE: these methods are available only if database management through SQL is disabled.
DatabaseServiceServicer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DatabaseServiceServicer: """A set of methods for managing ClickHouse Database resources. NOTE: these methods are available only if database management through SQL is disabled.""" def Get(self, request, context): """Returns the specified ClickHouse Database resource. To get the list o...
stack_v2_sparse_classes_36k_train_009395
9,134
permissive
[ { "docstring": "Returns the specified ClickHouse Database resource. To get the list of available ClickHouse Database resources, make a [List] request.", "name": "Get", "signature": "def Get(self, request, context)" }, { "docstring": "Retrieves the list of ClickHouse Database resources in the spe...
4
null
Implement the Python class `DatabaseServiceServicer` described below. Class description: A set of methods for managing ClickHouse Database resources. NOTE: these methods are available only if database management through SQL is disabled. Method signatures and docstrings: - def Get(self, request, context): Returns the ...
Implement the Python class `DatabaseServiceServicer` described below. Class description: A set of methods for managing ClickHouse Database resources. NOTE: these methods are available only if database management through SQL is disabled. Method signatures and docstrings: - def Get(self, request, context): Returns the ...
b906a014dd893e2697864e1e48e814a8d9fbc48c
<|skeleton|> class DatabaseServiceServicer: """A set of methods for managing ClickHouse Database resources. NOTE: these methods are available only if database management through SQL is disabled.""" def Get(self, request, context): """Returns the specified ClickHouse Database resource. To get the list o...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DatabaseServiceServicer: """A set of methods for managing ClickHouse Database resources. NOTE: these methods are available only if database management through SQL is disabled.""" def Get(self, request, context): """Returns the specified ClickHouse Database resource. To get the list of available C...
the_stack_v2_python_sparse
yandex/cloud/mdb/clickhouse/v1/database_service_pb2_grpc.py
yandex-cloud/python-sdk
train
63
0fbb2829d370ad36e4ee4d5a5ff212c23e4a335a
[ "super(GaussianDist, self).__init__(configs=configs, hidden_activation=hidden_activation, use_output_layer=False)\nself.mu_activation = mu_activation\nself.log_std_min = log_std_min\nself.log_std_max = log_std_max\nin_size = configs.hidden_sizes[-1]\nself.fixed_logstd = configs.fixed_logstd\nif self.fixed_logstd:\n...
<|body_start_0|> super(GaussianDist, self).__init__(configs=configs, hidden_activation=hidden_activation, use_output_layer=False) self.mu_activation = mu_activation self.log_std_min = log_std_min self.log_std_max = log_std_max in_size = configs.hidden_sizes[-1] self.fixed...
Multilayer perceptron with Gaussian distribution output. Attributes: mu_activation (function): bounding function for mean log_std_min (float): lower bound of log std log_std_max (float): upper bound of log std mu_layer (nn.Linear): output layer for mean log_std_layer (nn.Linear): output layer for log std
GaussianDist
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GaussianDist: """Multilayer perceptron with Gaussian distribution output. Attributes: mu_activation (function): bounding function for mean log_std_min (float): lower bound of log std log_std_max (float): upper bound of log std mu_layer (nn.Linear): output layer for mean log_std_layer (nn.Linear):...
stack_v2_sparse_classes_36k_train_009396
7,663
permissive
[ { "docstring": "Initialize.", "name": "__init__", "signature": "def __init__(self, configs: ConfigDict, hidden_activation: Callable=F.relu, mu_activation: Callable=torch.tanh, log_std_min: float=-20, log_std_max: float=2, init_fn: Callable=init_layer_uniform)" }, { "docstring": "Return gausian d...
3
stack_v2_sparse_classes_30k_train_012899
Implement the Python class `GaussianDist` described below. Class description: Multilayer perceptron with Gaussian distribution output. Attributes: mu_activation (function): bounding function for mean log_std_min (float): lower bound of log std log_std_max (float): upper bound of log std mu_layer (nn.Linear): output la...
Implement the Python class `GaussianDist` described below. Class description: Multilayer perceptron with Gaussian distribution output. Attributes: mu_activation (function): bounding function for mean log_std_min (float): lower bound of log std log_std_max (float): upper bound of log std mu_layer (nn.Linear): output la...
fdfac4e7056ee5a9d5b48b7b9653ce844a03ca22
<|skeleton|> class GaussianDist: """Multilayer perceptron with Gaussian distribution output. Attributes: mu_activation (function): bounding function for mean log_std_min (float): lower bound of log std log_std_max (float): upper bound of log std mu_layer (nn.Linear): output layer for mean log_std_layer (nn.Linear):...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GaussianDist: """Multilayer perceptron with Gaussian distribution output. Attributes: mu_activation (function): bounding function for mean log_std_min (float): lower bound of log std log_std_max (float): upper bound of log std mu_layer (nn.Linear): output layer for mean log_std_layer (nn.Linear): output layer...
the_stack_v2_python_sparse
rl_algorithms/common/networks/heads.py
medipixel/rl_algorithms
train
525
74740fad7b96eeb46118e5d97bf81abef5df8f6e
[ "super().__init__(coordinator, device, 'extra', 'Extra meter', f'extra_{dev_type}')\nself._type = dev_type\nself._attr_name = f'Extra {dev_type}'", "if self.coordinator.data.extra_meter is None:\n return None\nreturn getattr(self.coordinator.data.extra_meter, f'_{self._type}', None)" ]
<|body_start_0|> super().__init__(coordinator, device, 'extra', 'Extra meter', f'extra_{dev_type}') self._type = dev_type self._attr_name = f'Extra {dev_type}' <|end_body_0|> <|body_start_1|> if self.coordinator.data.extra_meter is None: return None return getattr(se...
The Youless extra meter power value sensor (s0).
ExtraMeterPowerSensor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExtraMeterPowerSensor: """The Youless extra meter power value sensor (s0).""" def __init__(self, coordinator: DataUpdateCoordinator[YoulessAPI], device: str, dev_type: str) -> None: """Instantiate an extra meter power sensor.""" <|body_0|> def get_sensor(self) -> Youless...
stack_v2_sparse_classes_36k_train_009397
11,812
permissive
[ { "docstring": "Instantiate an extra meter power sensor.", "name": "__init__", "signature": "def __init__(self, coordinator: DataUpdateCoordinator[YoulessAPI], device: str, dev_type: str) -> None" }, { "docstring": "Get the sensor for providing the value.", "name": "get_sensor", "signatu...
2
null
Implement the Python class `ExtraMeterPowerSensor` described below. Class description: The Youless extra meter power value sensor (s0). Method signatures and docstrings: - def __init__(self, coordinator: DataUpdateCoordinator[YoulessAPI], device: str, dev_type: str) -> None: Instantiate an extra meter power sensor. -...
Implement the Python class `ExtraMeterPowerSensor` described below. Class description: The Youless extra meter power value sensor (s0). Method signatures and docstrings: - def __init__(self, coordinator: DataUpdateCoordinator[YoulessAPI], device: str, dev_type: str) -> None: Instantiate an extra meter power sensor. -...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class ExtraMeterPowerSensor: """The Youless extra meter power value sensor (s0).""" def __init__(self, coordinator: DataUpdateCoordinator[YoulessAPI], device: str, dev_type: str) -> None: """Instantiate an extra meter power sensor.""" <|body_0|> def get_sensor(self) -> Youless...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ExtraMeterPowerSensor: """The Youless extra meter power value sensor (s0).""" def __init__(self, coordinator: DataUpdateCoordinator[YoulessAPI], device: str, dev_type: str) -> None: """Instantiate an extra meter power sensor.""" super().__init__(coordinator, device, 'extra', 'Extra meter'...
the_stack_v2_python_sparse
homeassistant/components/youless/sensor.py
home-assistant/core
train
35,501
25ea46673f5cd6641610961618d119b9f708fb5a
[ "test_response = self.client.get('/posts/fixture-post')\nself.assertEqual(test_response.status_code, 200)\nself.assertTemplateUsed(test_response, 'post_detail.html')\nself.assertTemplateUsed(test_response, 'base.html')\nself.assertTemplateUsed(test_response, 'disqus_snippet.html')\nself.assertTemplateUsed(test_resp...
<|body_start_0|> test_response = self.client.get('/posts/fixture-post') self.assertEqual(test_response.status_code, 200) self.assertTemplateUsed(test_response, 'post_detail.html') self.assertTemplateUsed(test_response, 'base.html') self.assertTemplateUsed(test_response, 'disqus_s...
These test the views associated with post objects.
PostViewTests
[ "CC0-1.0", "LicenseRef-scancode-unknown-license-reference", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PostViewTests: """These test the views associated with post objects.""" def test_post_details_view(self): """This tests the post-details view, ensuring that templates are loaded correctly. This view uses a user with superuser permissions so does not test the permission levels for thi...
stack_v2_sparse_classes_36k_train_009398
14,526
permissive
[ { "docstring": "This tests the post-details view, ensuring that templates are loaded correctly. This view uses a user with superuser permissions so does not test the permission levels for this view.", "name": "test_post_details_view", "signature": "def test_post_details_view(self)" }, { "docstri...
5
stack_v2_sparse_classes_30k_train_007312
Implement the Python class `PostViewTests` described below. Class description: These test the views associated with post objects. Method signatures and docstrings: - def test_post_details_view(self): This tests the post-details view, ensuring that templates are loaded correctly. This view uses a user with superuser p...
Implement the Python class `PostViewTests` described below. Class description: These test the views associated with post objects. Method signatures and docstrings: - def test_post_details_view(self): This tests the post-details view, ensuring that templates are loaded correctly. This view uses a user with superuser p...
d6f6c9c068bbf668c253e5943d9514947023e66d
<|skeleton|> class PostViewTests: """These test the views associated with post objects.""" def test_post_details_view(self): """This tests the post-details view, ensuring that templates are loaded correctly. This view uses a user with superuser permissions so does not test the permission levels for thi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PostViewTests: """These test the views associated with post objects.""" def test_post_details_view(self): """This tests the post-details view, ensuring that templates are loaded correctly. This view uses a user with superuser permissions so does not test the permission levels for this view.""" ...
the_stack_v2_python_sparse
communication/tests.py
BridgesLab/Lab-Website
train
0
9b41c29c1f36dc3cba691d01f18252f53a53f8fc
[ "if not is_MPolynomialRing(domain):\n raise ValueError('domain should be a multivariate polynomial ring')\nif not is_PolynomialRing(codomain) and (not is_MPolynomialRing(codomain)):\n raise ValueError('codomain should be a polynomial ring')\nring = codomain\nintermediate_rings = []\nwhile is_PolynomialRing(ri...
<|body_start_0|> if not is_MPolynomialRing(domain): raise ValueError('domain should be a multivariate polynomial ring') if not is_PolynomialRing(codomain) and (not is_MPolynomialRing(codomain)): raise ValueError('codomain should be a polynomial ring') ring = codomain ...
Inverses for :class:`FlatteningMorphism` EXAMPLES:: sage: R = QQ['c','x','y','z'] sage: S = QQ['c']['x','y','z'] sage: from sage.rings.polynomial.flatten import UnflatteningMorphism sage: f = UnflatteningMorphism(R, S) sage: g = f(R('x^2 + c*y^2 - z^2'));g x^2 + c*y^2 - z^2 sage: g.parent() Multivariate Polynomial Ring...
UnflatteningMorphism
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UnflatteningMorphism: """Inverses for :class:`FlatteningMorphism` EXAMPLES:: sage: R = QQ['c','x','y','z'] sage: S = QQ['c']['x','y','z'] sage: from sage.rings.polynomial.flatten import UnflatteningMorphism sage: f = UnflatteningMorphism(R, S) sage: g = f(R('x^2 + c*y^2 - z^2'));g x^2 + c*y^2 - z...
stack_v2_sparse_classes_36k_train_009399
12,176
no_license
[ { "docstring": "The Python constructor EXAMPLES:: sage: R = QQ['x']['y']['s','t']['X'] sage: p = R.random_element() sage: from sage.rings.polynomial.flatten import FlatteningMorphism sage: f = FlatteningMorphism(R) sage: g = f.section() sage: g(f(p)) == p True :: sage: R = QQ['a','b','x','y'] sage: S = ZZ['a','...
2
null
Implement the Python class `UnflatteningMorphism` described below. Class description: Inverses for :class:`FlatteningMorphism` EXAMPLES:: sage: R = QQ['c','x','y','z'] sage: S = QQ['c']['x','y','z'] sage: from sage.rings.polynomial.flatten import UnflatteningMorphism sage: f = UnflatteningMorphism(R, S) sage: g = f(R(...
Implement the Python class `UnflatteningMorphism` described below. Class description: Inverses for :class:`FlatteningMorphism` EXAMPLES:: sage: R = QQ['c','x','y','z'] sage: S = QQ['c']['x','y','z'] sage: from sage.rings.polynomial.flatten import UnflatteningMorphism sage: f = UnflatteningMorphism(R, S) sage: g = f(R(...
0d9eacbf74e2acffefde93e39f8bcbec745cdaba
<|skeleton|> class UnflatteningMorphism: """Inverses for :class:`FlatteningMorphism` EXAMPLES:: sage: R = QQ['c','x','y','z'] sage: S = QQ['c']['x','y','z'] sage: from sage.rings.polynomial.flatten import UnflatteningMorphism sage: f = UnflatteningMorphism(R, S) sage: g = f(R('x^2 + c*y^2 - z^2'));g x^2 + c*y^2 - z...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UnflatteningMorphism: """Inverses for :class:`FlatteningMorphism` EXAMPLES:: sage: R = QQ['c','x','y','z'] sage: S = QQ['c']['x','y','z'] sage: from sage.rings.polynomial.flatten import UnflatteningMorphism sage: f = UnflatteningMorphism(R, S) sage: g = f(R('x^2 + c*y^2 - z^2'));g x^2 + c*y^2 - z^2 sage: g.pa...
the_stack_v2_python_sparse
sage/src/sage/rings/polynomial/flatten.py
bopopescu/geosci
train
0