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
99a87cf4dd8dec1c60589536347e0d301d593081
[ "super().__init__()\nself._num_samples = num_samples\nself._seed = seed", "if self._seed is not None:\n np.random.seed(self._seed)\nfor _ in range(self._num_samples):\n sample = []\n for name, meta in design_vars.items():\n size = meta['size']\n lower = meta['lower']\n if not isinsta...
<|body_start_0|> super().__init__() self._num_samples = num_samples self._seed = seed <|end_body_0|> <|body_start_1|> if self._seed is not None: np.random.seed(self._seed) for _ in range(self._num_samples): sample = [] for name, meta in design...
DOE case generator implementing the Uniform method. Attributes ---------- _num_samples : int The number of samples in the DOE. _seed : int or None Random seed.
UniformGenerator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UniformGenerator: """DOE case generator implementing the Uniform method. Attributes ---------- _num_samples : int The number of samples in the DOE. _seed : int or None Random seed.""" def __init__(self, num_samples=1, seed=None): """Initialize the UniformGenerator. Parameters -------...
stack_v2_sparse_classes_36k_train_015500
21,019
no_license
[ { "docstring": "Initialize the UniformGenerator. Parameters ---------- num_samples : int, optional The number of samples to run. Defaults to 1. seed : int or None, optional Seed for random number generator.", "name": "__init__", "signature": "def __init__(self, num_samples=1, seed=None)" }, { "d...
2
stack_v2_sparse_classes_30k_train_004654
Implement the Python class `UniformGenerator` described below. Class description: DOE case generator implementing the Uniform method. Attributes ---------- _num_samples : int The number of samples in the DOE. _seed : int or None Random seed. Method signatures and docstrings: - def __init__(self, num_samples=1, seed=N...
Implement the Python class `UniformGenerator` described below. Class description: DOE case generator implementing the Uniform method. Attributes ---------- _num_samples : int The number of samples in the DOE. _seed : int or None Random seed. Method signatures and docstrings: - def __init__(self, num_samples=1, seed=N...
d9e89fe017f1131d554599c248247f73bb9b534d
<|skeleton|> class UniformGenerator: """DOE case generator implementing the Uniform method. Attributes ---------- _num_samples : int The number of samples in the DOE. _seed : int or None Random seed.""" def __init__(self, num_samples=1, seed=None): """Initialize the UniformGenerator. Parameters -------...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UniformGenerator: """DOE case generator implementing the Uniform method. Attributes ---------- _num_samples : int The number of samples in the DOE. _seed : int or None Random seed.""" def __init__(self, num_samples=1, seed=None): """Initialize the UniformGenerator. Parameters ---------- num_sampl...
the_stack_v2_python_sparse
venv/Lib/site-packages/openmdao/drivers/doe_generators.py
ManojDjs/Heart-rate-estimation
train
1
6e74b52cf581a457afde5b0dfa12a4504a2d7600
[ "self.serverConfig = ServerConfig()\nself.serverConfig.load()\nself.getLoginState = None\ntasking.WatchDog.start(tasking.SHORT_WATCH_DOG)", "if self.getLoginState is None:\n from server.user import User\n self.getLoginState = User.getLoginState\nlogin = self.getLoginState()\nif login is not None:\n from ...
<|body_start_0|> self.serverConfig = ServerConfig() self.serverConfig.load() self.getLoginState = None tasking.WatchDog.start(tasking.SHORT_WATCH_DOG) <|end_body_0|> <|body_start_1|> if self.getLoginState is None: from server.user import User self.getLogi...
Class to manage periodic task
Periodic
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Periodic: """Class to manage periodic task""" def __init__(self): """Constructor""" <|body_0|> async def checkLogin(self): """Inform that login detected""" <|body_1|> async def task(self): """Periodic task method""" <|body_2|> <|end_...
stack_v2_sparse_classes_36k_train_015501
1,795
permissive
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Inform that login detected", "name": "checkLogin", "signature": "async def checkLogin(self)" }, { "docstring": "Periodic task method", "name": "task", "signature": "asyn...
3
stack_v2_sparse_classes_30k_train_021598
Implement the Python class `Periodic` described below. Class description: Class to manage periodic task Method signatures and docstrings: - def __init__(self): Constructor - async def checkLogin(self): Inform that login detected - async def task(self): Periodic task method
Implement the Python class `Periodic` described below. Class description: Class to manage periodic task Method signatures and docstrings: - def __init__(self): Constructor - async def checkLogin(self): Inform that login detected - async def task(self): Periodic task method <|skeleton|> class Periodic: """Class t...
d86814625a7cd2f7e5fa01b8e1652efc811cef3a
<|skeleton|> class Periodic: """Class to manage periodic task""" def __init__(self): """Constructor""" <|body_0|> async def checkLogin(self): """Inform that login detected""" <|body_1|> async def task(self): """Periodic task method""" <|body_2|> <|end_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Periodic: """Class to manage periodic task""" def __init__(self): """Constructor""" self.serverConfig = ServerConfig() self.serverConfig.load() self.getLoginState = None tasking.WatchDog.start(tasking.SHORT_WATCH_DOG) async def checkLogin(self): """Inf...
the_stack_v2_python_sparse
modules/lib/server/periodic.py
antiquefu/pycameresp
train
0
b500036557786ca3a224a107f9ec956d475a2027
[ "low = 0\nhigh = numbers.__len__() - 1\nwhile low < high:\n total = numbers[low] + numbers[high]\n if total == target:\n return [low + 1, high + 1]\n if total < target:\n low += 1\n else:\n high -= 1", "hash_map = {}\nfor i in range(numbers.__len__()):\n buf = target - numbers[...
<|body_start_0|> low = 0 high = numbers.__len__() - 1 while low < high: total = numbers[low] + numbers[high] if total == target: return [low + 1, high + 1] if total < target: low += 1 else: high -= 1 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def twoSum(self, numbers, target): """:type numbers: List[int] :type target: int :rtype: List[int]""" <|body_0|> def twoSum1(self, numbers, target): """:type numbers: List[int] :type target: int :rtype: List[int]""" <|body_1|> <|end_skeleton|> <|b...
stack_v2_sparse_classes_36k_train_015502
1,080
no_license
[ { "docstring": ":type numbers: List[int] :type target: int :rtype: List[int]", "name": "twoSum", "signature": "def twoSum(self, numbers, target)" }, { "docstring": ":type numbers: List[int] :type target: int :rtype: List[int]", "name": "twoSum1", "signature": "def twoSum1(self, numbers, ...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def twoSum(self, numbers, target): :type numbers: List[int] :type target: int :rtype: List[int] - def twoSum1(self, numbers, target): :type numbers: List[int] :type target: int :...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def twoSum(self, numbers, target): :type numbers: List[int] :type target: int :rtype: List[int] - def twoSum1(self, numbers, target): :type numbers: List[int] :type target: int :...
472f780c3214aab5c713612812d834ccbe589434
<|skeleton|> class Solution: def twoSum(self, numbers, target): """:type numbers: List[int] :type target: int :rtype: List[int]""" <|body_0|> def twoSum1(self, numbers, target): """:type numbers: List[int] :type target: int :rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def twoSum(self, numbers, target): """:type numbers: List[int] :type target: int :rtype: List[int]""" low = 0 high = numbers.__len__() - 1 while low < high: total = numbers[low] + numbers[high] if total == target: return [low + ...
the_stack_v2_python_sparse
3/167-Two_Sum_II-Input_array_is_sorted.py
ChangXiaodong/Leetcode-solutions
train
4
2ccc503f8a9efd4aa08f95ef77e3b4988adb1420
[ "comments = CommentsVideos.query.order_by(asc(CommentsVideos.VideoID), asc(CommentsVideos.Created)).all()\ncontents = jsonify({'comments': [{'commentID': comment.CommentID, 'videoID': comment.VideoID, 'userID': comment.UserID, 'name': get_username(comment.UserID), 'comment': comment.Comment, 'createdAt': get_iso_fo...
<|body_start_0|> comments = CommentsVideos.query.order_by(asc(CommentsVideos.VideoID), asc(CommentsVideos.Created)).all() contents = jsonify({'comments': [{'commentID': comment.CommentID, 'videoID': comment.VideoID, 'userID': comment.UserID, 'name': get_username(comment.UserID), 'comment': comment.Comme...
VideoCommentsView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VideoCommentsView: def index(self): """Return all comments for all videos.""" <|body_0|> def get(self, video_id): """Return the comments for a specific video.""" <|body_1|> def post(self): """Add a comment to a video specified in the payload.""" ...
stack_v2_sparse_classes_36k_train_015503
26,847
permissive
[ { "docstring": "Return all comments for all videos.", "name": "index", "signature": "def index(self)" }, { "docstring": "Return the comments for a specific video.", "name": "get", "signature": "def get(self, video_id)" }, { "docstring": "Add a comment to a video specified in the ...
5
stack_v2_sparse_classes_30k_train_021358
Implement the Python class `VideoCommentsView` described below. Class description: Implement the VideoCommentsView class. Method signatures and docstrings: - def index(self): Return all comments for all videos. - def get(self, video_id): Return the comments for a specific video. - def post(self): Add a comment to a v...
Implement the Python class `VideoCommentsView` described below. Class description: Implement the VideoCommentsView class. Method signatures and docstrings: - def index(self): Return all comments for all videos. - def get(self, video_id): Return the comments for a specific video. - def post(self): Add a comment to a v...
62f8e8e904e379541193f0cbb91a8434b47f538f
<|skeleton|> class VideoCommentsView: def index(self): """Return all comments for all videos.""" <|body_0|> def get(self, video_id): """Return the comments for a specific video.""" <|body_1|> def post(self): """Add a comment to a video specified in the payload.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VideoCommentsView: def index(self): """Return all comments for all videos.""" comments = CommentsVideos.query.order_by(asc(CommentsVideos.VideoID), asc(CommentsVideos.Created)).all() contents = jsonify({'comments': [{'commentID': comment.CommentID, 'videoID': comment.VideoID, 'userID':...
the_stack_v2_python_sparse
apps/comments/views.py
Torniojaws/vortech-backend
train
0
b6bb10d0683f712f08b752814456a7f71e0237a6
[ "for chunk in self.retrieve_data(s3path, f'extract-{self.job_board}'):\n data = [{k: v for k, v in row.items() if k not in self.exclude_fields} for row in chunk if row['id'] is not None]\n for row in data:\n row['created'] = parse_date(row['created'], dayfirst=True)\n yield data", "mftask_kwargs =...
<|body_start_0|> for chunk in self.retrieve_data(s3path, f'extract-{self.job_board}'): data = [{k: v for k, v in row.items() if k not in self.exclude_fields} for row in chunk if row['id'] is not None] for row in data: row['created'] = parse_date(row['created'], dayfirst=T...
A generic task for curation. Pass in a job board, and extract the data accordingly.
JobCurateTask
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JobCurateTask: """A generic task for curation. Pass in a job board, and extract the data accordingly.""" def curate_data(self, s3path): """Fairly standard implementation of the abstract curate_data method""" <|body_0|> def requires(self): """Curate ┬─────────────...
stack_v2_sparse_classes_36k_train_015504
7,618
permissive
[ { "docstring": "Fairly standard implementation of the abstract curate_data method", "name": "curate_data", "signature": "def curate_data(self, s3path)" }, { "docstring": "Curate ┬──────────────> Metaflow(extract) └─> PrepareDB Override the base CurateTask.requires method so that we can yield Pre...
3
null
Implement the Python class `JobCurateTask` described below. Class description: A generic task for curation. Pass in a job board, and extract the data accordingly. Method signatures and docstrings: - def curate_data(self, s3path): Fairly standard implementation of the abstract curate_data method - def requires(self): ...
Implement the Python class `JobCurateTask` described below. Class description: A generic task for curation. Pass in a job board, and extract the data accordingly. Method signatures and docstrings: - def curate_data(self, s3path): Fairly standard implementation of the abstract curate_data method - def requires(self): ...
0aff8fe3b1017249eb536abe8596703296c24669
<|skeleton|> class JobCurateTask: """A generic task for curation. Pass in a job board, and extract the data accordingly.""" def curate_data(self, s3path): """Fairly standard implementation of the abstract curate_data method""" <|body_0|> def requires(self): """Curate ┬─────────────...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class JobCurateTask: """A generic task for curation. Pass in a job board, and extract the data accordingly.""" def curate_data(self, s3path): """Fairly standard implementation of the abstract curate_data method""" for chunk in self.retrieve_data(s3path, f'extract-{self.job_board}'): ...
the_stack_v2_python_sparse
ojd_daps/tasks/extract.py
Liyubov/ojo_daps_mirror
train
0
cfa910cbfe75fddba9f3619dd7ba5fd9b71fa631
[ "super(ConvTTLSTMCell, self).__init__()\nself.input_channels = input_channels\nself.hidden_channels = hidden_channels\nself.steps = steps\nself.order = order\nself.lags = steps - order + 1\nkernel_size = utils._pair(kernel_size)\npadding = (kernel_size[0] // 2, kernel_size[1] // 2)\nConv2d = lambda in_channels, out...
<|body_start_0|> super(ConvTTLSTMCell, self).__init__() self.input_channels = input_channels self.hidden_channels = hidden_channels self.steps = steps self.order = order self.lags = steps - order + 1 kernel_size = utils._pair(kernel_size) padding = (kernel...
ConvTTLSTMCell
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConvTTLSTMCell: def __init__(self, input_channels, hidden_channels, order=3, steps=3, ranks=8, kernel_size=5, bias=True): """Initialization of convolutional tensor-train LSTM cell. Arguments: ---------- (Hyper-parameters of the input/output channels) input_channels: int Number of input c...
stack_v2_sparse_classes_36k_train_015505
9,867
permissive
[ { "docstring": "Initialization of convolutional tensor-train LSTM cell. Arguments: ---------- (Hyper-parameters of the input/output channels) input_channels: int Number of input channels of the input tensor. hidden_channels: int Number of hidden/output channels of the output tensor. Note: the number of hidden_c...
3
null
Implement the Python class `ConvTTLSTMCell` described below. Class description: Implement the ConvTTLSTMCell class. Method signatures and docstrings: - def __init__(self, input_channels, hidden_channels, order=3, steps=3, ranks=8, kernel_size=5, bias=True): Initialization of convolutional tensor-train LSTM cell. Argu...
Implement the Python class `ConvTTLSTMCell` described below. Class description: Implement the ConvTTLSTMCell class. Method signatures and docstrings: - def __init__(self, input_channels, hidden_channels, order=3, steps=3, ranks=8, kernel_size=5, bias=True): Initialization of convolutional tensor-train LSTM cell. Argu...
baa19ee4e9f3422a052794e50791495632290b36
<|skeleton|> class ConvTTLSTMCell: def __init__(self, input_channels, hidden_channels, order=3, steps=3, ranks=8, kernel_size=5, bias=True): """Initialization of convolutional tensor-train LSTM cell. Arguments: ---------- (Hyper-parameters of the input/output channels) input_channels: int Number of input c...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ConvTTLSTMCell: def __init__(self, input_channels, hidden_channels, order=3, steps=3, ranks=8, kernel_size=5, bias=True): """Initialization of convolutional tensor-train LSTM cell. Arguments: ---------- (Hyper-parameters of the input/output channels) input_channels: int Number of input channels of the...
the_stack_v2_python_sparse
conv-tt-lstm/code/convlstmcell.py
usangbong/Data-Visualization-Lab-RND
train
7
62411eff9a6f0c5f43ac6b41a126fd027a076ecc
[ "url_parts = request.META.get('PATH_INFO').split('/')\ntry:\n given_uuid = str(UUID(url_parts[url_parts.index('cost-models') + 1]))\nexcept ValueError:\n given_uuid = None\nreturn given_uuid", "if settings.ENHANCED_ORG_ADMIN and request.user.admin:\n return True\nif not request.user.access:\n return F...
<|body_start_0|> url_parts = request.META.get('PATH_INFO').split('/') try: given_uuid = str(UUID(url_parts[url_parts.index('cost-models') + 1])) except ValueError: given_uuid = None return given_uuid <|end_body_0|> <|body_start_1|> if settings.ENHANCED_OR...
Determines if a user has access to Cost Model APIs.
CostModelsAccessPermission
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CostModelsAccessPermission: """Determines if a user has access to Cost Model APIs.""" def get_uuid_from_url(self, request): """Get the uuid from the request url.""" <|body_0|> def has_permission(self, request, view): """Check permission based on the defined acces...
stack_v2_sparse_classes_36k_train_015506
1,396
permissive
[ { "docstring": "Get the uuid from the request url.", "name": "get_uuid_from_url", "signature": "def get_uuid_from_url(self, request)" }, { "docstring": "Check permission based on the defined access.", "name": "has_permission", "signature": "def has_permission(self, request, view)" } ]
2
stack_v2_sparse_classes_30k_train_018963
Implement the Python class `CostModelsAccessPermission` described below. Class description: Determines if a user has access to Cost Model APIs. Method signatures and docstrings: - def get_uuid_from_url(self, request): Get the uuid from the request url. - def has_permission(self, request, view): Check permission based...
Implement the Python class `CostModelsAccessPermission` described below. Class description: Determines if a user has access to Cost Model APIs. Method signatures and docstrings: - def get_uuid_from_url(self, request): Get the uuid from the request url. - def has_permission(self, request, view): Check permission based...
0416e5216eb1ec4b41c8dd4999adde218b1ab2e1
<|skeleton|> class CostModelsAccessPermission: """Determines if a user has access to Cost Model APIs.""" def get_uuid_from_url(self, request): """Get the uuid from the request url.""" <|body_0|> def has_permission(self, request, view): """Check permission based on the defined acces...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CostModelsAccessPermission: """Determines if a user has access to Cost Model APIs.""" def get_uuid_from_url(self, request): """Get the uuid from the request url.""" url_parts = request.META.get('PATH_INFO').split('/') try: given_uuid = str(UUID(url_parts[url_parts.inde...
the_stack_v2_python_sparse
koku/api/common/permissions/cost_models_access.py
project-koku/koku
train
225
c2ffe7cb25dec3c27b0316f2a158247b842104b9
[ "self.bucket_base = bucket_base\nself.key_base = key_base\nself.must_exist = must_exist\nself.object_type = object_type\nself.fallback = PersistenceMechanisms.NULL\nself.logger = logger", "use_must_exist = must_exist\nif must_exist is None:\n use_must_exist = self.must_exist\nuse_persistence_mechanism = self._...
<|body_start_0|> self.bucket_base = bucket_base self.key_base = key_base self.must_exist = must_exist self.object_type = object_type self.fallback = PersistenceMechanisms.NULL self.logger = logger <|end_body_0|> <|body_start_1|> use_must_exist = must_exist ...
Factory class for PersistenceMechanisms. Given: 1. a string specifying persistence mechanism type 2. a "folder" passed from the caller 3. a "base_name" passed from the caller (i.e. file name without ".<extension>") ... the create_persistence_mechanism() method will dish out the correct PersistenceMechanism implementati...
PersistenceMechanismFactory
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PersistenceMechanismFactory: """Factory class for PersistenceMechanisms. Given: 1. a string specifying persistence mechanism type 2. a "folder" passed from the caller 3. a "base_name" passed from the caller (i.e. file name without ".<extension>") ... the create_persistence_mechanism() method will...
stack_v2_sparse_classes_36k_train_015507
5,826
no_license
[ { "docstring": "Constructor. :param bucket_base: The bucket base for S3 storage :param key_base: The key (folder) base for S3 storage :param must_exist: Default True. When False, if the file does not exist upon restore() no exception is raised. When True, an exception is raised. :param object_type: A string des...
4
null
Implement the Python class `PersistenceMechanismFactory` described below. Class description: Factory class for PersistenceMechanisms. Given: 1. a string specifying persistence mechanism type 2. a "folder" passed from the caller 3. a "base_name" passed from the caller (i.e. file name without ".<extension>") ... the cre...
Implement the Python class `PersistenceMechanismFactory` described below. Class description: Factory class for PersistenceMechanisms. Given: 1. a string specifying persistence mechanism type 2. a "folder" passed from the caller 3. a "base_name" passed from the caller (i.e. file name without ".<extension>") ... the cre...
99c2f401d6c4b203ee439ed607985a918d0c3c7e
<|skeleton|> class PersistenceMechanismFactory: """Factory class for PersistenceMechanisms. Given: 1. a string specifying persistence mechanism type 2. a "folder" passed from the caller 3. a "base_name" passed from the caller (i.e. file name without ".<extension>") ... the create_persistence_mechanism() method will...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PersistenceMechanismFactory: """Factory class for PersistenceMechanisms. Given: 1. a string specifying persistence mechanism type 2. a "folder" passed from the caller 3. a "base_name" passed from the caller (i.e. file name without ".<extension>") ... the create_persistence_mechanism() method will dish out the...
the_stack_v2_python_sparse
servicecommon/persistence/mechanism/persistence_mechanism_factory.py
Cognizant-CDB-AIA-BAI-AI-OI/LEAF-ENN-Training-V2
train
0
a0870471a8c93a8950f5d9e05257b8ddd59ea88d
[ "question = 'What language did you first learn to speak?'\nmy_survey = AnonymousSurvey(question)\nmy_survey.store_response('Chinese')\nself.assertIn('Chinese', my_survey.responses)", "question = 'What language did you first learn to speak?'\nmy_survey = AnonymousSurvey(question)\nresponses = ['Chinese', 'Japanese...
<|body_start_0|> question = 'What language did you first learn to speak?' my_survey = AnonymousSurvey(question) my_survey.store_response('Chinese') self.assertIn('Chinese', my_survey.responses) <|end_body_0|> <|body_start_1|> question = 'What language did you first learn to spea...
对 AnonymousSurvey 类的测试
TestAnonymousSurveyCast
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestAnonymousSurveyCast: """对 AnonymousSurvey 类的测试""" def test_store_single_response(self): """测试单个答案是否能妥善的保存""" <|body_0|> def test_store_three_responses(self): """测试单个答案是否能妥善的保存""" <|body_1|> <|end_skeleton|> <|body_start_0|> question = 'What ...
stack_v2_sparse_classes_36k_train_015508
928
no_license
[ { "docstring": "测试单个答案是否能妥善的保存", "name": "test_store_single_response", "signature": "def test_store_single_response(self)" }, { "docstring": "测试单个答案是否能妥善的保存", "name": "test_store_three_responses", "signature": "def test_store_three_responses(self)" } ]
2
stack_v2_sparse_classes_30k_train_000721
Implement the Python class `TestAnonymousSurveyCast` described below. Class description: 对 AnonymousSurvey 类的测试 Method signatures and docstrings: - def test_store_single_response(self): 测试单个答案是否能妥善的保存 - def test_store_three_responses(self): 测试单个答案是否能妥善的保存
Implement the Python class `TestAnonymousSurveyCast` described below. Class description: 对 AnonymousSurvey 类的测试 Method signatures and docstrings: - def test_store_single_response(self): 测试单个答案是否能妥善的保存 - def test_store_three_responses(self): 测试单个答案是否能妥善的保存 <|skeleton|> class TestAnonymousSurveyCast: """对 Anonymou...
c1f2bfaf53703c36f1c4c45308b11b49ec09b917
<|skeleton|> class TestAnonymousSurveyCast: """对 AnonymousSurvey 类的测试""" def test_store_single_response(self): """测试单个答案是否能妥善的保存""" <|body_0|> def test_store_three_responses(self): """测试单个答案是否能妥善的保存""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestAnonymousSurveyCast: """对 AnonymousSurvey 类的测试""" def test_store_single_response(self): """测试单个答案是否能妥善的保存""" question = 'What language did you first learn to speak?' my_survey = AnonymousSurvey(question) my_survey.store_response('Chinese') self.assertIn('Chines...
the_stack_v2_python_sparse
python_tutorial/com/python/chapter11/test_survey.py
kamaihamaiha/Tutorial
train
0
d289e5547441ca375772b60e966cb0cf439913fb
[ "super().__init__()\nself.layer_norm = nn.LayerNorm(size, eps=1e-06)\nself.src_src_att = MultiHeadedAttention(num_heads, size, dropout=dropout)\nself.feed_forward = PositionwiseFeedForward(size, ff_size=ff_size, dropout=dropout, alpha=alpha, layer_norm=layer_norm, activation=activation)\nself.dropout = nn.Dropout(d...
<|body_start_0|> super().__init__() self.layer_norm = nn.LayerNorm(size, eps=1e-06) self.src_src_att = MultiHeadedAttention(num_heads, size, dropout=dropout) self.feed_forward = PositionwiseFeedForward(size, ff_size=ff_size, dropout=dropout, alpha=alpha, layer_norm=layer_norm, activation...
One Transformer encoder layer has a Multi-head attention layer plus a position-wise feed-forward layer.
TransformerEncoderLayer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TransformerEncoderLayer: """One Transformer encoder layer has a Multi-head attention layer plus a position-wise feed-forward layer.""" def __init__(self, size: int=0, ff_size: int=0, num_heads: int=0, dropout: float=0.1, alpha: float=1.0, layer_norm: str='post', activation: str='relu') -> No...
stack_v2_sparse_classes_36k_train_015509
13,169
permissive
[ { "docstring": "A single Transformer encoder layer. Note: don't change the name or the order of members! otherwise pretrained models cannot be loaded correctly. :param size: model dimensionality :param ff_size: size of the feed-forward intermediate layer :param num_heads: number of heads :param dropout: dropout...
2
stack_v2_sparse_classes_30k_train_006998
Implement the Python class `TransformerEncoderLayer` described below. Class description: One Transformer encoder layer has a Multi-head attention layer plus a position-wise feed-forward layer. Method signatures and docstrings: - def __init__(self, size: int=0, ff_size: int=0, num_heads: int=0, dropout: float=0.1, alp...
Implement the Python class `TransformerEncoderLayer` described below. Class description: One Transformer encoder layer has a Multi-head attention layer plus a position-wise feed-forward layer. Method signatures and docstrings: - def __init__(self, size: int=0, ff_size: int=0, num_heads: int=0, dropout: float=0.1, alp...
0968187ac0968007cabebed5e5cb6587c08dff78
<|skeleton|> class TransformerEncoderLayer: """One Transformer encoder layer has a Multi-head attention layer plus a position-wise feed-forward layer.""" def __init__(self, size: int=0, ff_size: int=0, num_heads: int=0, dropout: float=0.1, alpha: float=1.0, layer_norm: str='post', activation: str='relu') -> No...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TransformerEncoderLayer: """One Transformer encoder layer has a Multi-head attention layer plus a position-wise feed-forward layer.""" def __init__(self, size: int=0, ff_size: int=0, num_heads: int=0, dropout: float=0.1, alpha: float=1.0, layer_norm: str='post', activation: str='relu') -> None: "...
the_stack_v2_python_sparse
joeynmt/transformer_layers.py
joeynmt/joeynmt
train
668
532567743785ac0a8dc4bb239079169e2a1f2c31
[ "try:\n return import_module('nis')\nexcept ImportError:\n logger.error('The nis module is not available on your version of Python.')\n return None", "if not username or not password:\n logger.error('Attempted to authenticate NIS user without supplying either a username or password parameter! This may...
<|body_start_0|> try: return import_module('nis') except ImportError: logger.error('The nis module is not available on your version of Python.') return None <|end_body_0|> <|body_start_1|> if not username or not password: logger.error('Attempted t...
Authenticate against a user on an NIS server.
NISBackend
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NISBackend: """Authenticate against a user on an NIS server.""" def nis(self) -> Optional[ModuleType]: """The nis module, used for interacting with NIS. On first access, this will check if NIS is available, logging an error if missing. This safeguards against Python environments with...
stack_v2_sparse_classes_36k_train_015510
6,661
permissive
[ { "docstring": "The nis module, used for interacting with NIS. On first access, this will check if NIS is available, logging an error if missing. This safeguards against Python environments without NIS, and against versions of Python >= 3.13. Type: module", "name": "nis", "signature": "def nis(self) -> ...
4
stack_v2_sparse_classes_30k_train_005809
Implement the Python class `NISBackend` described below. Class description: Authenticate against a user on an NIS server. Method signatures and docstrings: - def nis(self) -> Optional[ModuleType]: The nis module, used for interacting with NIS. On first access, this will check if NIS is available, logging an error if ...
Implement the Python class `NISBackend` described below. Class description: Authenticate against a user on an NIS server. Method signatures and docstrings: - def nis(self) -> Optional[ModuleType]: The nis module, used for interacting with NIS. On first access, this will check if NIS is available, logging an error if ...
c3a991f1e9d7682239a1ab0e8661cee6da01d537
<|skeleton|> class NISBackend: """Authenticate against a user on an NIS server.""" def nis(self) -> Optional[ModuleType]: """The nis module, used for interacting with NIS. On first access, this will check if NIS is available, logging an error if missing. This safeguards against Python environments with...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NISBackend: """Authenticate against a user on an NIS server.""" def nis(self) -> Optional[ModuleType]: """The nis module, used for interacting with NIS. On first access, this will check if NIS is available, logging an error if missing. This safeguards against Python environments without NIS, and ...
the_stack_v2_python_sparse
reviewboard/accounts/backends/nis.py
reviewboard/reviewboard
train
1,141
475a6962b06771ae2aa84b58ed3df32c6db3d0ca
[ "if not db_dict:\n ValueError('Database definition required to open database is empty. Data base may not be defined in config file.')\ntry:\n connection = MySQLConnection(host=db_dict['host'], database=db_dict['database'], user=db_dict['user'], password=db_dict['password'])\n if connection.is_connected():...
<|body_start_0|> if not db_dict: ValueError('Database definition required to open database is empty. Data base may not be defined in config file.') try: connection = MySQLConnection(host=db_dict['host'], database=db_dict['database'], user=db_dict['user'], password=db_dict['passw...
Provides some common methods to mixin in with the MySQL...Tables classes Returns Raises: ValueError if defintion not valid or database cannot be opened.
MySQLDBMixin
[ "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MySQLDBMixin: """Provides some common methods to mixin in with the MySQL...Tables classes Returns Raises: ValueError if defintion not valid or database cannot be opened.""" def connectdb(self, db_dict, verbose): """Connect the db""" <|body_0|> def _load_table(self): ...
stack_v2_sparse_classes_36k_train_015511
3,038
permissive
[ { "docstring": "Connect the db", "name": "connectdb", "signature": "def connectdb(self, db_dict, verbose)" }, { "docstring": "Load the internal dictionary from the database based on the fields definition", "name": "_load_table", "signature": "def _load_table(self)" } ]
2
stack_v2_sparse_classes_30k_train_001843
Implement the Python class `MySQLDBMixin` described below. Class description: Provides some common methods to mixin in with the MySQL...Tables classes Returns Raises: ValueError if defintion not valid or database cannot be opened. Method signatures and docstrings: - def connectdb(self, db_dict, verbose): Connect the ...
Implement the Python class `MySQLDBMixin` described below. Class description: Provides some common methods to mixin in with the MySQL...Tables classes Returns Raises: ValueError if defintion not valid or database cannot be opened. Method signatures and docstrings: - def connectdb(self, db_dict, verbose): Connect the ...
9c60b3489f02592bd9099b8719ca23ae43a9eaa5
<|skeleton|> class MySQLDBMixin: """Provides some common methods to mixin in with the MySQL...Tables classes Returns Raises: ValueError if defintion not valid or database cannot be opened.""" def connectdb(self, db_dict, verbose): """Connect the db""" <|body_0|> def _load_table(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MySQLDBMixin: """Provides some common methods to mixin in with the MySQL...Tables classes Returns Raises: ValueError if defintion not valid or database cannot be opened.""" def connectdb(self, db_dict, verbose): """Connect the db""" if not db_dict: ValueError('Database definit...
the_stack_v2_python_sparse
smipyping/_mysqldbmixin.py
KSchopmeyer/smipyping
train
0
0d39505d764ef2db2de46b5a1c68261771d11340
[ "dp = [0] * len(nums)\ndp[0] = 1\nfor index in range(1, len(nums)):\n dp[index] = 1\n for i in range(index):\n if nums[index] > nums[i]:\n dp[index] = max(dp[index], dp[i] + 1)\nreturn max(dp)", "dp = [[0, 0] for _ in range(len(nums))]\ndp[0][0] = 0\ndp[0][1] = 1\nfor index in range(1, len...
<|body_start_0|> dp = [0] * len(nums) dp[0] = 1 for index in range(1, len(nums)): dp[index] = 1 for i in range(index): if nums[index] > nums[i]: dp[index] = max(dp[index], dp[i] + 1) return max(dp) <|end_body_0|> <|body_start_1...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def lengthOfLIS(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def lengthOfLIS1(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> dp = [0] * len(nums) dp[0] = 1 ...
stack_v2_sparse_classes_36k_train_015512
974
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "lengthOfLIS", "signature": "def lengthOfLIS(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "lengthOfLIS1", "signature": "def lengthOfLIS1(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_015543
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lengthOfLIS(self, nums): :type nums: List[int] :rtype: int - def lengthOfLIS1(self, nums): :type nums: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lengthOfLIS(self, nums): :type nums: List[int] :rtype: int - def lengthOfLIS1(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution: def lengthOfLI...
9d394cd2862703cfb7a7b505b35deda7450a692e
<|skeleton|> class Solution: def lengthOfLIS(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def lengthOfLIS1(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def lengthOfLIS(self, nums): """:type nums: List[int] :rtype: int""" dp = [0] * len(nums) dp[0] = 1 for index in range(1, len(nums)): dp[index] = 1 for i in range(index): if nums[index] > nums[i]: dp[index] =...
the_stack_v2_python_sparse
300.最长递增子序列.py
Ezi4Zy/leetcode
train
0
e585add2b6b489f0b1d0062685687c732aad4ea8
[ "if not root:\n return 0\nleftDepth = self.minDepth(root.left)\nrightDepth = self.minDepth(root.right)\nif leftDepth and rightDepth:\n return 1 + min(leftDepth, rightDepth)\nelif leftDepth == 0 and rightDepth != 0:\n return 1 + rightDepth\nelif rightDepth == 0 and leftDepth != 0:\n return 1 + leftDepth\...
<|body_start_0|> if not root: return 0 leftDepth = self.minDepth(root.left) rightDepth = self.minDepth(root.right) if leftDepth and rightDepth: return 1 + min(leftDepth, rightDepth) elif leftDepth == 0 and rightDepth != 0: return 1 + rightDepth...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minDepth(self, root: TreeNode) -> int: """递归法(自底向上)""" <|body_0|> def minDepth_1(self, root: TreeNode) -> int: """BFS 由于BFS是一层一层往下遍历,所以当到达叶子节点可以直接返回深度 BFS用队列实现,先左子树再右子树""" <|body_1|> def minDepth_2(self, root: TreeNode) -> int: """D...
stack_v2_sparse_classes_36k_train_015513
2,791
no_license
[ { "docstring": "递归法(自底向上)", "name": "minDepth", "signature": "def minDepth(self, root: TreeNode) -> int" }, { "docstring": "BFS 由于BFS是一层一层往下遍历,所以当到达叶子节点可以直接返回深度 BFS用队列实现,先左子树再右子树", "name": "minDepth_1", "signature": "def minDepth_1(self, root: TreeNode) -> int" }, { "docstring": ...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minDepth(self, root: TreeNode) -> int: 递归法(自底向上) - def minDepth_1(self, root: TreeNode) -> int: BFS 由于BFS是一层一层往下遍历,所以当到达叶子节点可以直接返回深度 BFS用队列实现,先左子树再右子树 - def minDepth_2(self, ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minDepth(self, root: TreeNode) -> int: 递归法(自底向上) - def minDepth_1(self, root: TreeNode) -> int: BFS 由于BFS是一层一层往下遍历,所以当到达叶子节点可以直接返回深度 BFS用队列实现,先左子树再右子树 - def minDepth_2(self, ...
3508e1ce089131b19603c3206aab4cf43023bb19
<|skeleton|> class Solution: def minDepth(self, root: TreeNode) -> int: """递归法(自底向上)""" <|body_0|> def minDepth_1(self, root: TreeNode) -> int: """BFS 由于BFS是一层一层往下遍历,所以当到达叶子节点可以直接返回深度 BFS用队列实现,先左子树再右子树""" <|body_1|> def minDepth_2(self, root: TreeNode) -> int: """D...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def minDepth(self, root: TreeNode) -> int: """递归法(自底向上)""" if not root: return 0 leftDepth = self.minDepth(root.left) rightDepth = self.minDepth(root.right) if leftDepth and rightDepth: return 1 + min(leftDepth, rightDepth) elif...
the_stack_v2_python_sparse
algorithm/leetcode/tree/08-二叉树的最小深度.py
lxconfig/UbuntuCode_bak
train
0
dc0e33c24e855446b034ce3b70cdb3f9c8871f24
[ "paymentSession = request.session.get(PAYMENT_VALIDATION_STR, {})\nself.invoiceID = paymentSession.get('invoiceID')\nself.amount = paymentSession.get('amount', 0)\nself.success_url = paymentSession.get('success_url', reverse('registration'))\ntry:\n i = Invoice.objects.get(id=self.invoiceID)\nexcept ObjectDoesNo...
<|body_start_0|> paymentSession = request.session.get(PAYMENT_VALIDATION_STR, {}) self.invoiceID = paymentSession.get('invoiceID') self.amount = paymentSession.get('amount', 0) self.success_url = paymentSession.get('success_url', reverse('registration')) try: i = Invo...
GiftCertificateCustomizeView
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GiftCertificateCustomizeView: def dispatch(self, request, *args, **kwargs): """Check that a valid Invoice ID has been passed in session data, and that said invoice is marked as paid.""" <|body_0|> def form_valid(self, form): """Create the gift certificate voucher wit...
stack_v2_sparse_classes_36k_train_015514
9,456
permissive
[ { "docstring": "Check that a valid Invoice ID has been passed in session data, and that said invoice is marked as paid.", "name": "dispatch", "signature": "def dispatch(self, request, *args, **kwargs)" }, { "docstring": "Create the gift certificate voucher with the indicated information and send...
2
null
Implement the Python class `GiftCertificateCustomizeView` described below. Class description: Implement the GiftCertificateCustomizeView class. Method signatures and docstrings: - def dispatch(self, request, *args, **kwargs): Check that a valid Invoice ID has been passed in session data, and that said invoice is mark...
Implement the Python class `GiftCertificateCustomizeView` described below. Class description: Implement the GiftCertificateCustomizeView class. Method signatures and docstrings: - def dispatch(self, request, *args, **kwargs): Check that a valid Invoice ID has been passed in session data, and that said invoice is mark...
19db3e83e76ea2002ee841989410d12d1e601023
<|skeleton|> class GiftCertificateCustomizeView: def dispatch(self, request, *args, **kwargs): """Check that a valid Invoice ID has been passed in session data, and that said invoice is marked as paid.""" <|body_0|> def form_valid(self, form): """Create the gift certificate voucher wit...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GiftCertificateCustomizeView: def dispatch(self, request, *args, **kwargs): """Check that a valid Invoice ID has been passed in session data, and that said invoice is marked as paid.""" paymentSession = request.session.get(PAYMENT_VALIDATION_STR, {}) self.invoiceID = paymentSession.get...
the_stack_v2_python_sparse
danceschool/vouchers/views.py
django-danceschool/django-danceschool
train
40
c85f49c356efc3312bbd3f6a8e570a627804dbc1
[ "count = 0\ns = s.rstrip(' ')\nn = len(s)\nfor i in range(n - 1, -1, -1):\n if s[i] != ' ':\n count += 1\n else:\n break\nreturn count", "s = s.rstrip(' ')\nif len(s) != 0:\n return len(s.split()[-1])\nelse:\n return 0" ]
<|body_start_0|> count = 0 s = s.rstrip(' ') n = len(s) for i in range(n - 1, -1, -1): if s[i] != ' ': count += 1 else: break return count <|end_body_0|> <|body_start_1|> s = s.rstrip(' ') if len(s) != 0: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def lengthOfLastWord(self, s): """常规版本""" <|body_0|> def lengthOfLastWord2(self, s): """四行代码版本""" <|body_1|> <|end_skeleton|> <|body_start_0|> count = 0 s = s.rstrip(' ') n = len(s) for i in range(n - 1, -1, -1): ...
stack_v2_sparse_classes_36k_train_015515
574
no_license
[ { "docstring": "常规版本", "name": "lengthOfLastWord", "signature": "def lengthOfLastWord(self, s)" }, { "docstring": "四行代码版本", "name": "lengthOfLastWord2", "signature": "def lengthOfLastWord2(self, s)" } ]
2
stack_v2_sparse_classes_30k_train_001448
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lengthOfLastWord(self, s): 常规版本 - def lengthOfLastWord2(self, s): 四行代码版本
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lengthOfLastWord(self, s): 常规版本 - def lengthOfLastWord2(self, s): 四行代码版本 <|skeleton|> class Solution: def lengthOfLastWord(self, s): """常规版本""" <|body_0...
04810f2603ef6e4e5627ab64a5d4cd8678d429ac
<|skeleton|> class Solution: def lengthOfLastWord(self, s): """常规版本""" <|body_0|> def lengthOfLastWord2(self, s): """四行代码版本""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def lengthOfLastWord(self, s): """常规版本""" count = 0 s = s.rstrip(' ') n = len(s) for i in range(n - 1, -1, -1): if s[i] != ' ': count += 1 else: break return count def lengthOfLastWord2(self,...
the_stack_v2_python_sparse
leetcode/58_最后一个单词的长度.py
Rsj-Python/project
train
0
70c32a23905fe2bffa162ba3e8569f6f4d63b656
[ "super().__init__()\nself.delay = self._get_constant(rst_delay)\nself.lvl = HDLExpression(rst_lvl)", "for i in range(self.delay.value):\n yield bool(self.lvl)\nfor x in iter(int, 1):\n yield bool(not self.lvl)" ]
<|body_start_0|> super().__init__() self.delay = self._get_constant(rst_delay) self.lvl = HDLExpression(rst_lvl) <|end_body_0|> <|body_start_1|> for i in range(self.delay.value): yield bool(self.lvl) for x in iter(int, 1): yield bool(not self.lvl) <|end_b...
Reset generator.
HDLSimulationReset
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HDLSimulationReset: """Reset generator.""" def __init__(self, rst_delay, rst_lvl=1): """Initialize.""" <|body_0|> def next(self): """Generate value.""" <|body_1|> <|end_skeleton|> <|body_start_0|> super().__init__() self.delay = self._ge...
stack_v2_sparse_classes_36k_train_015516
1,593
permissive
[ { "docstring": "Initialize.", "name": "__init__", "signature": "def __init__(self, rst_delay, rst_lvl=1)" }, { "docstring": "Generate value.", "name": "next", "signature": "def next(self)" } ]
2
stack_v2_sparse_classes_30k_train_012951
Implement the Python class `HDLSimulationReset` described below. Class description: Reset generator. Method signatures and docstrings: - def __init__(self, rst_delay, rst_lvl=1): Initialize. - def next(self): Generate value.
Implement the Python class `HDLSimulationReset` described below. Class description: Reset generator. Method signatures and docstrings: - def __init__(self, rst_delay, rst_lvl=1): Initialize. - def next(self): Generate value. <|skeleton|> class HDLSimulationReset: """Reset generator.""" def __init__(self, rs...
463412cf6a72456acc8cb99569e7dc9c9d472f6d
<|skeleton|> class HDLSimulationReset: """Reset generator.""" def __init__(self, rst_delay, rst_lvl=1): """Initialize.""" <|body_0|> def next(self): """Generate value.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HDLSimulationReset: """Reset generator.""" def __init__(self, rst_delay, rst_lvl=1): """Initialize.""" super().__init__() self.delay = self._get_constant(rst_delay) self.lvl = HDLExpression(rst_lvl) def next(self): """Generate value.""" for i in range(...
the_stack_v2_python_sparse
hdltools/hdllib/sim.py
brunosmmm/hdltools
train
2
a61766b279b1a04bb02900ac0da3db1c1ea20529
[ "def get_height(node):\n if not node:\n return 0\n left_height = get_height(node.left)\n right_height = get_height(node.right)\n if left_height < 0 or right_height < 0 or abs(left_height - right_height) > 1:\n return -1\n return max(left_height, right_height) + 1\nreturn get_height(root...
<|body_start_0|> def get_height(node): if not node: return 0 left_height = get_height(node.left) right_height = get_height(node.right) if left_height < 0 or right_height < 0 or abs(left_height - right_height) > 1: return -1 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isBalanced(self, root): """:type root: TreeNode :rtype: bool""" <|body_0|> def isBalanced_redundant(self, root): """:type root: TreeNode :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> def get_height(node): if ...
stack_v2_sparse_classes_36k_train_015517
2,520
no_license
[ { "docstring": ":type root: TreeNode :rtype: bool", "name": "isBalanced", "signature": "def isBalanced(self, root)" }, { "docstring": ":type root: TreeNode :rtype: bool", "name": "isBalanced_redundant", "signature": "def isBalanced_redundant(self, root)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isBalanced(self, root): :type root: TreeNode :rtype: bool - def isBalanced_redundant(self, root): :type root: TreeNode :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isBalanced(self, root): :type root: TreeNode :rtype: bool - def isBalanced_redundant(self, root): :type root: TreeNode :rtype: bool <|skeleton|> class Solution: def isB...
e60ba45fe2f2e5e3b3abfecec3db76f5ce1fde59
<|skeleton|> class Solution: def isBalanced(self, root): """:type root: TreeNode :rtype: bool""" <|body_0|> def isBalanced_redundant(self, root): """:type root: TreeNode :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isBalanced(self, root): """:type root: TreeNode :rtype: bool""" def get_height(node): if not node: return 0 left_height = get_height(node.left) right_height = get_height(node.right) if left_height < 0 or right_height...
the_stack_v2_python_sparse
src/lt_110.py
oxhead/CodingYourWay
train
0
b30e52c39672c8c520c71d0e4f39bf9ad27ea887
[ "n = nums[0]\nm = len(nums)\nif m == 1:\n return [[n]]\nnew_perm = []\nperms = self.permute(nums[1:])\nfor perm in perms:\n for i in range(m):\n new_perm.append(perm[:i] + [n] + perm[i:])\nreturn new_perm", "n = nums[0]\nm = len(nums)\nif m == 1:\n return [[n]]\nnew_perm = []\nperms = self.permute...
<|body_start_0|> n = nums[0] m = len(nums) if m == 1: return [[n]] new_perm = [] perms = self.permute(nums[1:]) for perm in perms: for i in range(m): new_perm.append(perm[:i] + [n] + perm[i:]) return new_perm <|end_body_0|> ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def permute(self, nums): """distinct numbers""" <|body_0|> def permuteUnique(self, nums): """might contain duplicates""" <|body_1|> def nextPermutation(self, nums): """next dict permutation""" <|body_2|> <|end_skeleton|> <|bod...
stack_v2_sparse_classes_36k_train_015518
1,609
no_license
[ { "docstring": "distinct numbers", "name": "permute", "signature": "def permute(self, nums)" }, { "docstring": "might contain duplicates", "name": "permuteUnique", "signature": "def permuteUnique(self, nums)" }, { "docstring": "next dict permutation", "name": "nextPermutation...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def permute(self, nums): distinct numbers - def permuteUnique(self, nums): might contain duplicates - def nextPermutation(self, nums): next dict permutation
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def permute(self, nums): distinct numbers - def permuteUnique(self, nums): might contain duplicates - def nextPermutation(self, nums): next dict permutation <|skeleton|> class S...
c9fb0b623501b3746444b05da55405e3a6c42bbf
<|skeleton|> class Solution: def permute(self, nums): """distinct numbers""" <|body_0|> def permuteUnique(self, nums): """might contain duplicates""" <|body_1|> def nextPermutation(self, nums): """next dict permutation""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def permute(self, nums): """distinct numbers""" n = nums[0] m = len(nums) if m == 1: return [[n]] new_perm = [] perms = self.permute(nums[1:]) for perm in perms: for i in range(m): new_perm.append(perm[:i...
the_stack_v2_python_sparse
Archive-1/Permutations.py
smsxgz/my-leetcode
train
0
b05c89fdba66c10dbccbcac279ac924066219267
[ "args = self.get_args.parse_args()\nnum_rows = args.get('rows') or 100\nquery = g.db.query(Match)\nif args.get('server_id'):\n query = query.filter(Match.server_id == args.get('server_id'))\nquery = query.order_by(-Match.match_id)\nquery = query.limit(num_rows)\nrows = query.all()\nret = []\nfor row in rows:\n ...
<|body_start_0|> args = self.get_args.parse_args() num_rows = args.get('rows') or 100 query = g.db.query(Match) if args.get('server_id'): query = query.filter(Match.server_id == args.get('server_id')) query = query.order_by(-Match.match_id) query = query.limit...
UE4 match
MatchesAPI
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MatchesAPI: """UE4 match""" def get(self): """This endpoint used by services and clients to fetch recent matches. Dump the DB rows out as json""" <|body_0|> def post(self): """Register a new battle on the passed in match server. Each match server should always ha...
stack_v2_sparse_classes_36k_train_015519
24,829
permissive
[ { "docstring": "This endpoint used by services and clients to fetch recent matches. Dump the DB rows out as json", "name": "get", "signature": "def get(self)" }, { "docstring": "Register a new battle on the passed in match server. Each match server should always have a single battle. A match ser...
2
null
Implement the Python class `MatchesAPI` described below. Class description: UE4 match Method signatures and docstrings: - def get(self): This endpoint used by services and clients to fetch recent matches. Dump the DB rows out as json - def post(self): Register a new battle on the passed in match server. Each match se...
Implement the Python class `MatchesAPI` described below. Class description: UE4 match Method signatures and docstrings: - def get(self): This endpoint used by services and clients to fetch recent matches. Dump the DB rows out as json - def post(self): Register a new battle on the passed in match server. Each match se...
9825cb22b26b577b715f2ce95453363bf90ecc7e
<|skeleton|> class MatchesAPI: """UE4 match""" def get(self): """This endpoint used by services and clients to fetch recent matches. Dump the DB rows out as json""" <|body_0|> def post(self): """Register a new battle on the passed in match server. Each match server should always ha...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MatchesAPI: """UE4 match""" def get(self): """This endpoint used by services and clients to fetch recent matches. Dump the DB rows out as json""" args = self.get_args.parse_args() num_rows = args.get('rows') or 100 query = g.db.query(Match) if args.get('server_id')...
the_stack_v2_python_sparse
driftbase/api/matches.py
dgnorth/drift-base
train
1
3881ec7a9aa8e8b88a1518f7663a807e5b4798da
[ "super().__init__(name=name, trainable=trainable)\nself._reverb_length = reverb_length\nself._add_dry = add_dry", "if len(ir.shape) == 1:\n ir = ir[tf.newaxis, :]\nif len(ir.shape) == 3:\n ir = ir[:, :, 0]\ndry_mask = tf.zeros([int(ir.shape[0]), 1], tf.float32)\nreturn tf.concat([dry_mask, ir[:, 1:]], axis=...
<|body_start_0|> super().__init__(name=name, trainable=trainable) self._reverb_length = reverb_length self._add_dry = add_dry <|end_body_0|> <|body_start_1|> if len(ir.shape) == 1: ir = ir[tf.newaxis, :] if len(ir.shape) == 3: ir = ir[:, :, 0] dry...
Convolutional (FIR) reverb.
Reverb
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Reverb: """Convolutional (FIR) reverb.""" def __init__(self, trainable=False, reverb_length=48000, add_dry=True, name='reverb'): """Takes neural network outputs directly as the impulse response. Args: trainable: Learn the impulse_response as a single variable for the entire dataset. ...
stack_v2_sparse_classes_36k_train_015520
13,484
permissive
[ { "docstring": "Takes neural network outputs directly as the impulse response. Args: trainable: Learn the impulse_response as a single variable for the entire dataset. reverb_length: Length of the impulse response. Only used if trainable=True. add_dry: Add dry signal to reverberated signal on output. name: Name...
6
null
Implement the Python class `Reverb` described below. Class description: Convolutional (FIR) reverb. Method signatures and docstrings: - def __init__(self, trainable=False, reverb_length=48000, add_dry=True, name='reverb'): Takes neural network outputs directly as the impulse response. Args: trainable: Learn the impul...
Implement the Python class `Reverb` described below. Class description: Convolutional (FIR) reverb. Method signatures and docstrings: - def __init__(self, trainable=False, reverb_length=48000, add_dry=True, name='reverb'): Takes neural network outputs directly as the impulse response. Args: trainable: Learn the impul...
7e0a39420f3bd87d9efd54cf0d36f4e258311340
<|skeleton|> class Reverb: """Convolutional (FIR) reverb.""" def __init__(self, trainable=False, reverb_length=48000, add_dry=True, name='reverb'): """Takes neural network outputs directly as the impulse response. Args: trainable: Learn the impulse_response as a single variable for the entire dataset. ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Reverb: """Convolutional (FIR) reverb.""" def __init__(self, trainable=False, reverb_length=48000, add_dry=True, name='reverb'): """Takes neural network outputs directly as the impulse response. Args: trainable: Learn the impulse_response as a single variable for the entire dataset. reverb_length...
the_stack_v2_python_sparse
ddsp/effects.py
magenta/ddsp
train
2,666
79520dd1c0269e93c8b08f3ca4df9f0e1159b012
[ "super(Attachable, self).__init__()\nself.menu.addAction('Restart', self.restart)\nself.menu.addAction('Stop', self.terminate)\nself.shell = None", "name = self.getName()\ncommand = ''\nwindow_name = str(self.getProperty('Name'))\nif self.getName() != window_name:\n window_name += ' (' + self.getName() + ')'\n...
<|body_start_0|> super(Attachable, self).__init__() self.menu.addAction('Restart', self.restart) self.menu.addAction('Stop', self.terminate) self.shell = None <|end_body_0|> <|body_start_1|> name = self.getName() command = '' window_name = str(self.getProperty('N...
Attachable
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Attachable: def __init__(self): """Create a device that can be attached to.""" <|body_0|> def attach(self): """Attach to corresponding device on backend.""" <|body_1|> <|end_skeleton|> <|body_start_0|> super(Attachable, self).__init__() self...
stack_v2_sparse_classes_36k_train_015521
3,012
permissive
[ { "docstring": "Create a device that can be attached to.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Attach to corresponding device on backend.", "name": "attach", "signature": "def attach(self)" } ]
2
null
Implement the Python class `Attachable` described below. Class description: Implement the Attachable class. Method signatures and docstrings: - def __init__(self): Create a device that can be attached to. - def attach(self): Attach to corresponding device on backend.
Implement the Python class `Attachable` described below. Class description: Implement the Attachable class. Method signatures and docstrings: - def __init__(self): Create a device that can be attached to. - def attach(self): Attach to corresponding device on backend. <|skeleton|> class Attachable: def __init__(...
d095076113c1e84c33f52ef46a3df1f8bc8ffa43
<|skeleton|> class Attachable: def __init__(self): """Create a device that can be attached to.""" <|body_0|> def attach(self): """Attach to corresponding device on backend.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Attachable: def __init__(self): """Create a device that can be attached to.""" super(Attachable, self).__init__() self.menu.addAction('Restart', self.restart) self.menu.addAction('Stop', self.terminate) self.shell = None def attach(self): """Attach to corre...
the_stack_v2_python_sparse
frontend/src/gbuilder/Core/Attachable.py
citelab/gini5
train
12
01c02917335c9cfed3c9583083b605dd412389bb
[ "super(SelfAttention, self).__init__()\nself.in_channel = in_channel\nif out_channel is not None:\n self.out_channel = out_channel\nelse:\n self.out_channel = in_channel\nself.temperature = self.out_channel ** 0.5\nself.q_map = nn.Conv1d(in_channel, self.out_channel, 1, bias=False)\nself.k_map = nn.Conv1d(in_...
<|body_start_0|> super(SelfAttention, self).__init__() self.in_channel = in_channel if out_channel is not None: self.out_channel = out_channel else: self.out_channel = in_channel self.temperature = self.out_channel ** 0.5 self.q_map = nn.Conv1d(in_...
SelfAttention
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SelfAttention: def __init__(self, in_channel, out_channel=None, attn_dropout=0.1): """:param in_channel: previous layer's output feature dimension :param out_channel: size of output vector, defaults to in_channel""" <|body_0|> def forward(self, x): """:param x: the f...
stack_v2_sparse_classes_36k_train_015522
25,448
no_license
[ { "docstring": ":param in_channel: previous layer's output feature dimension :param out_channel: size of output vector, defaults to in_channel", "name": "__init__", "signature": "def __init__(self, in_channel, out_channel=None, attn_dropout=0.1)" }, { "docstring": ":param x: the feature maps fro...
2
stack_v2_sparse_classes_30k_train_016613
Implement the Python class `SelfAttention` described below. Class description: Implement the SelfAttention class. Method signatures and docstrings: - def __init__(self, in_channel, out_channel=None, attn_dropout=0.1): :param in_channel: previous layer's output feature dimension :param out_channel: size of output vect...
Implement the Python class `SelfAttention` described below. Class description: Implement the SelfAttention class. Method signatures and docstrings: - def __init__(self, in_channel, out_channel=None, attn_dropout=0.1): :param in_channel: previous layer's output feature dimension :param out_channel: size of output vect...
7e55a422588c1d1e00f35a3d3a3ff896cce59e18
<|skeleton|> class SelfAttention: def __init__(self, in_channel, out_channel=None, attn_dropout=0.1): """:param in_channel: previous layer's output feature dimension :param out_channel: size of output vector, defaults to in_channel""" <|body_0|> def forward(self, x): """:param x: the f...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SelfAttention: def __init__(self, in_channel, out_channel=None, attn_dropout=0.1): """:param in_channel: previous layer's output feature dimension :param out_channel: size of output vector, defaults to in_channel""" super(SelfAttention, self).__init__() self.in_channel = in_channel ...
the_stack_v2_python_sparse
generated/test_Na_Z_attMPTI.py
jansel/pytorch-jit-paritybench
train
35
02856c25f3deacfedcf12e02e5259933e4d31432
[ "super(Site, self).__init__(url=url, gis=portaladmin._gis)\ninitialize = kwargs.pop('initialize', False)\nself._url = url\nself._pa = portaladmin\nself._gis = portaladmin._gis\nself._con = portaladmin._con\nif initialize:\n self._init()", "url = '%s/createNewSite' % url\nparams = {'f': 'json', 'username': user...
<|body_start_0|> super(Site, self).__init__(url=url, gis=portaladmin._gis) initialize = kwargs.pop('initialize', False) self._url = url self._pa = portaladmin self._gis = portaladmin._gis self._con = portaladmin._con if initialize: self._init() <|end_b...
Site is the root resources used after a local GIS is installed. Here administrators can create, export, import, and join sites.
Site
[ "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Site: """Site is the root resources used after a local GIS is installed. Here administrators can create, export, import, and join sites.""" def __init__(self, url, portaladmin, **kwargs): """Constructor""" <|body_0|> def create(con, url, username, password, full_name, em...
stack_v2_sparse_classes_36k_train_015523
13,171
permissive
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, url, portaladmin, **kwargs)" }, { "docstring": "The create site operation initializes and configures Portal for ArcGIS for use. It must be the first operation invoked after installation. Creating a new site involv...
5
null
Implement the Python class `Site` described below. Class description: Site is the root resources used after a local GIS is installed. Here administrators can create, export, import, and join sites. Method signatures and docstrings: - def __init__(self, url, portaladmin, **kwargs): Constructor - def create(con, url, u...
Implement the Python class `Site` described below. Class description: Site is the root resources used after a local GIS is installed. Here administrators can create, export, import, and join sites. Method signatures and docstrings: - def __init__(self, url, portaladmin, **kwargs): Constructor - def create(con, url, u...
a874fe7e5c95196e4de68db2da0e2a05eb70e5d8
<|skeleton|> class Site: """Site is the root resources used after a local GIS is installed. Here administrators can create, export, import, and join sites.""" def __init__(self, url, portaladmin, **kwargs): """Constructor""" <|body_0|> def create(con, url, username, password, full_name, em...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Site: """Site is the root resources used after a local GIS is installed. Here administrators can create, export, import, and join sites.""" def __init__(self, url, portaladmin, **kwargs): """Constructor""" super(Site, self).__init__(url=url, gis=portaladmin._gis) initialize = kwar...
the_stack_v2_python_sparse
arcpyenv/arcgispro-py3-clone/Lib/site-packages/arcgis/gis/admin/_site.py
SherbazHashmi/HackathonServer
train
3
57608d4a96bd940bb5afbbc8e641aaa28ee58ce0
[ "self._source = source\nself._time_provider = time_provider\nself._storage_engine = storage_engine", "if chore.archived:\n return\nasync with self._storage_engine.get_unit_of_work() as uow:\n chore_collection = await uow.chore_collection_repository.load_by_id(chore.chore_collection_ref_id)\n inbox_task_c...
<|body_start_0|> self._source = source self._time_provider = time_provider self._storage_engine = storage_engine <|end_body_0|> <|body_start_1|> if chore.archived: return async with self._storage_engine.get_unit_of_work() as uow: chore_collection = await ...
Shared service for archiving a chore.
ChoreArchiveService
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ChoreArchiveService: """Shared service for archiving a chore.""" def __init__(self, source: EventSource, time_provider: TimeProvider, storage_engine: DomainStorageEngine) -> None: """Constructor.""" <|body_0|> async def do_it(self, progress_reporter: ProgressReporter, ch...
stack_v2_sparse_classes_36k_train_015524
2,357
permissive
[ { "docstring": "Constructor.", "name": "__init__", "signature": "def __init__(self, source: EventSource, time_provider: TimeProvider, storage_engine: DomainStorageEngine) -> None" }, { "docstring": "Execute the service's action.", "name": "do_it", "signature": "async def do_it(self, prog...
2
null
Implement the Python class `ChoreArchiveService` described below. Class description: Shared service for archiving a chore. Method signatures and docstrings: - def __init__(self, source: EventSource, time_provider: TimeProvider, storage_engine: DomainStorageEngine) -> None: Constructor. - async def do_it(self, progres...
Implement the Python class `ChoreArchiveService` described below. Class description: Shared service for archiving a chore. Method signatures and docstrings: - def __init__(self, source: EventSource, time_provider: TimeProvider, storage_engine: DomainStorageEngine) -> None: Constructor. - async def do_it(self, progres...
911ecd560142a9b4e57498f2b090f9469a0718a1
<|skeleton|> class ChoreArchiveService: """Shared service for archiving a chore.""" def __init__(self, source: EventSource, time_provider: TimeProvider, storage_engine: DomainStorageEngine) -> None: """Constructor.""" <|body_0|> async def do_it(self, progress_reporter: ProgressReporter, ch...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ChoreArchiveService: """Shared service for archiving a chore.""" def __init__(self, source: EventSource, time_provider: TimeProvider, storage_engine: DomainStorageEngine) -> None: """Constructor.""" self._source = source self._time_provider = time_provider self._storage_en...
the_stack_v2_python_sparse
src/core/jupiter/core/domain/chores/service/archive_service.py
horia141/jupiter
train
16
f481ba089e8c18dc7f52dd65a48ce43984550a78
[ "us_state_abbrev = {'alabama': 'AL', 'alaska': 'AK', 'arizona': 'AZ', 'arkansas': 'AR', 'california': 'CA', 'colorado': 'CO', 'connecticut': 'CT', 'delaware': 'DE', 'florida': 'FL', 'georgia': 'GA', 'hawaii': 'HI', 'idaho': 'ID', 'illinois': 'IL', 'indiana': 'IN', 'iowa': 'IA', 'kansas': 'KS', 'kentucky': 'KY', 'lo...
<|body_start_0|> us_state_abbrev = {'alabama': 'AL', 'alaska': 'AK', 'arizona': 'AZ', 'arkansas': 'AR', 'california': 'CA', 'colorado': 'CO', 'connecticut': 'CT', 'delaware': 'DE', 'florida': 'FL', 'georgia': 'GA', 'hawaii': 'HI', 'idaho': 'ID', 'illinois': 'IL', 'indiana': 'IN', 'iowa': 'IA', 'kansas': 'KS', '...
WeatherManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WeatherManager: def retrieve_weather_object(self, city, state): """Returns a weather object based on a city and state pair from the database. If it does not exist, creates it. Returns None if no weather object could be created. args city - a string representing a city name state - a stri...
stack_v2_sparse_classes_36k_train_015525
21,243
no_license
[ { "docstring": "Returns a weather object based on a city and state pair from the database. If it does not exist, creates it. Returns None if no weather object could be created. args city - a string representing a city name state - a string representing the state abbreviation", "name": "retrieve_weather_obje...
2
stack_v2_sparse_classes_30k_train_004376
Implement the Python class `WeatherManager` described below. Class description: Implement the WeatherManager class. Method signatures and docstrings: - def retrieve_weather_object(self, city, state): Returns a weather object based on a city and state pair from the database. If it does not exist, creates it. Returns N...
Implement the Python class `WeatherManager` described below. Class description: Implement the WeatherManager class. Method signatures and docstrings: - def retrieve_weather_object(self, city, state): Returns a weather object based on a city and state pair from the database. If it does not exist, creates it. Returns N...
00db9c77c725c9f0a02d9120296c70313d02bfdd
<|skeleton|> class WeatherManager: def retrieve_weather_object(self, city, state): """Returns a weather object based on a city and state pair from the database. If it does not exist, creates it. Returns None if no weather object could be created. args city - a string representing a city name state - a stri...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WeatherManager: def retrieve_weather_object(self, city, state): """Returns a weather object based on a city and state pair from the database. If it does not exist, creates it. Returns None if no weather object could be created. args city - a string representing a city name state - a string representin...
the_stack_v2_python_sparse
weather_service/models.py
jitesh-cloudmaaya/cloudmaaya
train
0
b5ffdfebf7c16ef42e1fb06252fa572b36e4daa7
[ "super(CNN6layer, self).__init__()\nself.flattened_shape = [-1, 128, *np.ceil(np.array(input_size)[1:] / 2 ** 5)]\nself.features = nn.Sequential(nn.Conv3d(input_size[0], 8, 3, padding=1), nn.BatchNorm3d(8), nn.ReLU(), PadMaxPool3d(2, 2), nn.Conv3d(8, 16, 3, padding=1), nn.BatchNorm3d(16), nn.ReLU(), PadMaxPool3d(2,...
<|body_start_0|> super(CNN6layer, self).__init__() self.flattened_shape = [-1, 128, *np.ceil(np.array(input_size)[1:] / 2 ** 5)] self.features = nn.Sequential(nn.Conv3d(input_size[0], 8, 3, padding=1), nn.BatchNorm3d(8), nn.ReLU(), PadMaxPool3d(2, 2), nn.Conv3d(8, 16, 3, padding=1), nn.BatchNorm...
Classifier for a multi-class classification task
CNN6layer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CNN6layer: """Classifier for a multi-class classification task""" def __init__(self, input_size, dropout=0, **kwargs): """Construct a network using as entries of fc layers demographical values""" <|body_0|> def forward(self, x, covars=None): """:param x: (FloatTe...
stack_v2_sparse_classes_36k_train_015526
1,655
permissive
[ { "docstring": "Construct a network using as entries of fc layers demographical values", "name": "__init__", "signature": "def __init__(self, input_size, dropout=0, **kwargs)" }, { "docstring": ":param x: (FloatTensor) 5D image of size (bs, 1, 121, 145, 121) :return: the scores for each class", ...
2
stack_v2_sparse_classes_30k_train_000819
Implement the Python class `CNN6layer` described below. Class description: Classifier for a multi-class classification task Method signatures and docstrings: - def __init__(self, input_size, dropout=0, **kwargs): Construct a network using as entries of fc layers demographical values - def forward(self, x, covars=None...
Implement the Python class `CNN6layer` described below. Class description: Classifier for a multi-class classification task Method signatures and docstrings: - def __init__(self, input_size, dropout=0, **kwargs): Construct a network using as entries of fc layers demographical values - def forward(self, x, covars=None...
200681eb0441baa69a386ef1ac8cf6f0d2ab01e0
<|skeleton|> class CNN6layer: """Classifier for a multi-class classification task""" def __init__(self, input_size, dropout=0, **kwargs): """Construct a network using as entries of fc layers demographical values""" <|body_0|> def forward(self, x, covars=None): """:param x: (FloatTe...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CNN6layer: """Classifier for a multi-class classification task""" def __init__(self, input_size, dropout=0, **kwargs): """Construct a network using as entries of fc layers demographical values""" super(CNN6layer, self).__init__() self.flattened_shape = [-1, 128, *np.ceil(np.array(...
the_stack_v2_python_sparse
src/deep/models/cnn_6layer.py
podismine/pac2019
train
0
f386c58831c8f01372a0ec07320f3ad336888dc3
[ "cache.delete(f'latest_read_through-{self.user_id}-{self.book_id}')\nself.user.update_active_date()\nif self.finish_date or self.stopped_date:\n self.is_active = False\nsuper().save(*args, **kwargs)", "if self.progress:\n return self.progressupdate_set.create(user=self.user, progress=self.progress, mode=sel...
<|body_start_0|> cache.delete(f'latest_read_through-{self.user_id}-{self.book_id}') self.user.update_active_date() if self.finish_date or self.stopped_date: self.is_active = False super().save(*args, **kwargs) <|end_body_0|> <|body_start_1|> if self.progress: ...
Store a read through a book in the database.
ReadThrough
[ "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReadThrough: """Store a read through a book in the database.""" def save(self, *args, **kwargs): """update user active time""" <|body_0|> def create_update(self): """add update to the readthrough""" <|body_1|> <|end_skeleton|> <|body_start_0|> c...
stack_v2_sparse_classes_36k_train_015527
2,532
no_license
[ { "docstring": "update user active time", "name": "save", "signature": "def save(self, *args, **kwargs)" }, { "docstring": "add update to the readthrough", "name": "create_update", "signature": "def create_update(self)" } ]
2
null
Implement the Python class `ReadThrough` described below. Class description: Store a read through a book in the database. Method signatures and docstrings: - def save(self, *args, **kwargs): update user active time - def create_update(self): add update to the readthrough
Implement the Python class `ReadThrough` described below. Class description: Store a read through a book in the database. Method signatures and docstrings: - def save(self, *args, **kwargs): update user active time - def create_update(self): add update to the readthrough <|skeleton|> class ReadThrough: """Store ...
0f8da5b738047f3c34d60d93f59bdedd8f797224
<|skeleton|> class ReadThrough: """Store a read through a book in the database.""" def save(self, *args, **kwargs): """update user active time""" <|body_0|> def create_update(self): """add update to the readthrough""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ReadThrough: """Store a read through a book in the database.""" def save(self, *args, **kwargs): """update user active time""" cache.delete(f'latest_read_through-{self.user_id}-{self.book_id}') self.user.update_active_date() if self.finish_date or self.stopped_date: ...
the_stack_v2_python_sparse
bookwyrm/models/readthrough.py
bookwyrm-social/bookwyrm
train
1,398
ca46f1f046cc1644899a6929cf0829185b1bef34
[ "_, [ax1, ax2] = plt.subplots(nrows=1, ncols=2, figsize=(8, 5))\nloc, scale = (series.mean(), series.std())\n_ = stats.probplot(series, sparams=(loc, scale), plot=ax1)\nsns.distplot(series, fit=stats.norm, hist_kws={'edgecolor': 'k'}, ax=ax2)\nax2.legend(ax1.lines, ['kde', 'norm'])", "_, [ax1, ax2] = plt.subplots...
<|body_start_0|> _, [ax1, ax2] = plt.subplots(nrows=1, ncols=2, figsize=(8, 5)) loc, scale = (series.mean(), series.std()) _ = stats.probplot(series, sparams=(loc, scale), plot=ax1) sns.distplot(series, fit=stats.norm, hist_kws={'edgecolor': 'k'}, ax=ax2) ax2.legend(ax1.lines, ['...
NumTransform
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumTransform: def qqplot(self, series): """绘制QQ图,查看序列是否符合正态分布""" <|body_0|> def yeojohnson(self, series): """Yeojohnson变换""" <|body_1|> def boxcox(self, series): """Box-Cox变换""" <|body_2|> <|end_skeleton|> <|body_start_0|> _, [a...
stack_v2_sparse_classes_36k_train_015528
8,243
no_license
[ { "docstring": "绘制QQ图,查看序列是否符合正态分布", "name": "qqplot", "signature": "def qqplot(self, series)" }, { "docstring": "Yeojohnson变换", "name": "yeojohnson", "signature": "def yeojohnson(self, series)" }, { "docstring": "Box-Cox变换", "name": "boxcox", "signature": "def boxcox(sel...
3
stack_v2_sparse_classes_30k_val_001069
Implement the Python class `NumTransform` described below. Class description: Implement the NumTransform class. Method signatures and docstrings: - def qqplot(self, series): 绘制QQ图,查看序列是否符合正态分布 - def yeojohnson(self, series): Yeojohnson变换 - def boxcox(self, series): Box-Cox变换
Implement the Python class `NumTransform` described below. Class description: Implement the NumTransform class. Method signatures and docstrings: - def qqplot(self, series): 绘制QQ图,查看序列是否符合正态分布 - def yeojohnson(self, series): Yeojohnson变换 - def boxcox(self, series): Box-Cox变换 <|skeleton|> class NumTransform: def...
823184005a3a2ed70a32b37c0afc2066e6e8907a
<|skeleton|> class NumTransform: def qqplot(self, series): """绘制QQ图,查看序列是否符合正态分布""" <|body_0|> def yeojohnson(self, series): """Yeojohnson变换""" <|body_1|> def boxcox(self, series): """Box-Cox变换""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NumTransform: def qqplot(self, series): """绘制QQ图,查看序列是否符合正态分布""" _, [ax1, ax2] = plt.subplots(nrows=1, ncols=2, figsize=(8, 5)) loc, scale = (series.mean(), series.std()) _ = stats.probplot(series, sparams=(loc, scale), plot=ax1) sns.distplot(series, fit=stats.norm, his...
the_stack_v2_python_sparse
WorkCode/Models/ModelFunc/Exploratory/Numerical.py
johngolt/gitln
train
1
bcf8b6b3a3cc98593e6f17235dcce8f897947673
[ "self._name = name or 'floating_rate_note'\nif holiday_calendar is None:\n holiday_calendar = dates.create_holiday_calendar(weekend_mask=dates.WeekendMask.SATURDAY_SUNDAY)\nwith tf.name_scope(self._name):\n self._dtype = dtype\n self._settlement_date = dates.convert_to_date_tensor(settlement_date)\n sel...
<|body_start_0|> self._name = name or 'floating_rate_note' if holiday_calendar is None: holiday_calendar = dates.create_holiday_calendar(weekend_mask=dates.WeekendMask.SATURDAY_SUNDAY) with tf.name_scope(self._name): self._dtype = dtype self._settlement_date =...
Represents a batch of floating rate notes. Floating rate notes are bond securities where the value of the coupon is not fixed at the time of issuance but is rather reset for every coupon period typically based on a benchmark index such as LIBOR rate [1]. For example, consider a floating rate note with settlement date T...
FloatingRateNote
[ "Apache-2.0", "LicenseRef-scancode-generic-cla", "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FloatingRateNote: """Represents a batch of floating rate notes. Floating rate notes are bond securities where the value of the coupon is not fixed at the time of issuance but is rather reset for every coupon period typically based on a benchmark index such as LIBOR rate [1]. For example, consider...
stack_v2_sparse_classes_36k_train_015529
7,997
permissive
[ { "docstring": "Initialize a batch of floating rate notes (FRNs). Args: settlement_date: A rank 1 `DateTensor` specifying the settlement date of the FRNs. maturity_date: A rank 1 `DateTensor` specifying the maturity dates of the FRNs. The shape of the input should be the same as that of `settlement_date`. coupo...
3
null
Implement the Python class `FloatingRateNote` described below. Class description: Represents a batch of floating rate notes. Floating rate notes are bond securities where the value of the coupon is not fixed at the time of issuance but is rather reset for every coupon period typically based on a benchmark index such a...
Implement the Python class `FloatingRateNote` described below. Class description: Represents a batch of floating rate notes. Floating rate notes are bond securities where the value of the coupon is not fixed at the time of issuance but is rather reset for every coupon period typically based on a benchmark index such a...
0d3a2193c0f2d320b65e602cf01d7a617da484df
<|skeleton|> class FloatingRateNote: """Represents a batch of floating rate notes. Floating rate notes are bond securities where the value of the coupon is not fixed at the time of issuance but is rather reset for every coupon period typically based on a benchmark index such as LIBOR rate [1]. For example, consider...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FloatingRateNote: """Represents a batch of floating rate notes. Floating rate notes are bond securities where the value of the coupon is not fixed at the time of issuance but is rather reset for every coupon period typically based on a benchmark index such as LIBOR rate [1]. For example, consider a floating r...
the_stack_v2_python_sparse
tf_quant_finance/experimental/instruments/floating_rate_note.py
google/tf-quant-finance
train
4,165
559a8a3ec249c7894192047d07500497d54775af
[ "msg_widget = urwid.Padding(urwid.Text(msg), 'center', width - 4)\nbutton_widgets = []\nfor button in buttons:\n button_widgets.append(urwid.AttrWrap(urwid.Button(button, self._action), attr[1], attr[2]))\nbutton_grid = urwid.GridFlow(button_widgets, 12, 2, 1, 'center')\nif edit == 'Text':\n self._edit_widget...
<|body_start_0|> msg_widget = urwid.Padding(urwid.Text(msg), 'center', width - 4) button_widgets = [] for button in buttons: button_widgets.append(urwid.AttrWrap(urwid.Button(button, self._action), attr[1], attr[2])) button_grid = urwid.GridFlow(button_widgets, 12, 2, 1, 'cen...
Creates a BoxWidget that displays a message, an edit field (optionally) and some buttons on top of another BoxWidget. Attributes: b_pressed -- Contains the label of the last button pressed or None if no button has been pressed. edit_text -- After a button is pressed, this contains the text the user has entered in the e...
Dialog
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Dialog: """Creates a BoxWidget that displays a message, an edit field (optionally) and some buttons on top of another BoxWidget. Attributes: b_pressed -- Contains the label of the last button pressed or None if no button has been pressed. edit_text -- After a button is pressed, this contains the ...
stack_v2_sparse_classes_36k_train_015530
6,844
no_license
[ { "docstring": "msg -- content of the message widget, one of: plain string -- string is displayed (attr, markup2) -- markup2 is given attribute attr [markupA, markupB, ... ] -- list items joined together buttons -- a list of strings with the button labels attr -- a tuple (background, button, active_button) of a...
2
stack_v2_sparse_classes_30k_train_013892
Implement the Python class `Dialog` described below. Class description: Creates a BoxWidget that displays a message, an edit field (optionally) and some buttons on top of another BoxWidget. Attributes: b_pressed -- Contains the label of the last button pressed or None if no button has been pressed. edit_text -- After ...
Implement the Python class `Dialog` described below. Class description: Creates a BoxWidget that displays a message, an edit field (optionally) and some buttons on top of another BoxWidget. Attributes: b_pressed -- Contains the label of the last button pressed or None if no button has been pressed. edit_text -- After ...
b2aa42e2cd8b601c1fb63d79632c7b8606ea04e7
<|skeleton|> class Dialog: """Creates a BoxWidget that displays a message, an edit field (optionally) and some buttons on top of another BoxWidget. Attributes: b_pressed -- Contains the label of the last button pressed or None if no button has been pressed. edit_text -- After a button is pressed, this contains the ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Dialog: """Creates a BoxWidget that displays a message, an edit field (optionally) and some buttons on top of another BoxWidget. Attributes: b_pressed -- Contains the label of the last button pressed or None if no button has been pressed. edit_text -- After a button is pressed, this contains the text the user...
the_stack_v2_python_sparse
tarara/widget.py
sparcs-kaist/arara
train
1
bf244c8d59f7592201f06cb1c6b38b4b540dd931
[ "if not request.user.has_perm('Users.user_exists'):\n return HttpResponseForbidden()\nif user_backend.exists(username=name):\n return HttpResponseNoContent()\nelse:\n raise UserNotFound(name)", "if not request.user.has_perm('Users.user_verify_password'):\n return HttpResponseForbidden()\npassword = se...
<|body_start_0|> if not request.user.has_perm('Users.user_exists'): return HttpResponseForbidden() if user_backend.exists(username=name): return HttpResponseNoContent() else: raise UserNotFound(name) <|end_body_0|> <|body_start_1|> if not request.user...
Handle requests to ``/users/<user>/``.
UserHandlerView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserHandlerView: """Handle requests to ``/users/<user>/``.""" def get(self, request, largs, name): """Verify that a user exists.""" <|body_0|> def post(self, request, largs, name): """Verify a users password.""" <|body_1|> def put(self, request, larg...
stack_v2_sparse_classes_36k_train_015531
9,743
no_license
[ { "docstring": "Verify that a user exists.", "name": "get", "signature": "def get(self, request, largs, name)" }, { "docstring": "Verify a users password.", "name": "post", "signature": "def post(self, request, largs, name)" }, { "docstring": "Change a users password.", "name...
4
stack_v2_sparse_classes_30k_train_016080
Implement the Python class `UserHandlerView` described below. Class description: Handle requests to ``/users/<user>/``. Method signatures and docstrings: - def get(self, request, largs, name): Verify that a user exists. - def post(self, request, largs, name): Verify a users password. - def put(self, request, largs, n...
Implement the Python class `UserHandlerView` described below. Class description: Handle requests to ``/users/<user>/``. Method signatures and docstrings: - def get(self, request, largs, name): Verify that a user exists. - def post(self, request, largs, name): Verify a users password. - def put(self, request, largs, n...
60769f6b4965836b2220878cfa2e1bc403d8f8a3
<|skeleton|> class UserHandlerView: """Handle requests to ``/users/<user>/``.""" def get(self, request, largs, name): """Verify that a user exists.""" <|body_0|> def post(self, request, largs, name): """Verify a users password.""" <|body_1|> def put(self, request, larg...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserHandlerView: """Handle requests to ``/users/<user>/``.""" def get(self, request, largs, name): """Verify that a user exists.""" if not request.user.has_perm('Users.user_exists'): return HttpResponseForbidden() if user_backend.exists(username=name): retu...
the_stack_v2_python_sparse
env/lib/python3.6/site-packages/RestAuth/Users/views.py
sachinlokesh05/login-registration-forgotpassword-and-resetpassword-using-django-rest-framework-
train
3
7524de699b009fd91f7aaadb4a8bb3bdbfa2d3bf
[ "curs.execute('DROP TABLE jotd_emails')\nconn.commit()\ncurs.execute(TBLDEF)\nconn.commit()\nclient.run()", "curs.execute('SELECT * FROM jotd_emails')\nobserved = len(curs.fetchall())\nexpected = DAYCOUNT * len(RECIPIENTS)\nself.assertEqual(observed, expected)", "curs.execute('SELECT msgDate FROM jotd_emails')\...
<|body_start_0|> curs.execute('DROP TABLE jotd_emails') conn.commit() curs.execute(TBLDEF) conn.commit() client.run() <|end_body_0|> <|body_start_1|> curs.execute('SELECT * FROM jotd_emails') observed = len(curs.fetchall()) expected = DAYCOUNT * len(RECIP...
test_client
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class test_client: def setUp(self): """Provides each test with a freshly populated table""" <|body_0|> def test_table(self): """Tests that the appropriate number of emails have been created and stored""" <|body_1|> def test_date(self): """Tests if each...
stack_v2_sparse_classes_36k_train_015532
1,628
no_license
[ { "docstring": "Provides each test with a freshly populated table", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Tests that the appropriate number of emails have been created and stored", "name": "test_table", "signature": "def test_table(self)" }, { "docstr...
3
stack_v2_sparse_classes_30k_train_010981
Implement the Python class `test_client` described below. Class description: Implement the test_client class. Method signatures and docstrings: - def setUp(self): Provides each test with a freshly populated table - def test_table(self): Tests that the appropriate number of emails have been created and stored - def te...
Implement the Python class `test_client` described below. Class description: Implement the test_client class. Method signatures and docstrings: - def setUp(self): Provides each test with a freshly populated table - def test_table(self): Tests that the appropriate number of emails have been created and stored - def te...
ecc38ddc4bb6719bf3a02d04b760722772e20413
<|skeleton|> class test_client: def setUp(self): """Provides each test with a freshly populated table""" <|body_0|> def test_table(self): """Tests that the appropriate number of emails have been created and stored""" <|body_1|> def test_date(self): """Tests if each...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class test_client: def setUp(self): """Provides each test with a freshly populated table""" curs.execute('DROP TABLE jotd_emails') conn.commit() curs.execute(TBLDEF) conn.commit() client.run() def test_table(self): """Tests that the appropriate number of ...
the_stack_v2_python_sparse
emailclient_test.py
aborgo/Certification_Work
train
0
62da1c75cfc3b08a5c306e4bee070e1e3de30cf2
[ "self.food = deque(food)\nself.width = width\nself.height = height\nself.bodyQueue = deque([(0, 0)])\nself.hashSet = set([(0, 0)])\nself.score = 0\nself.moveOps = {'U': (-1, 0), 'D': (1, 0), 'L': (0, -1), 'R': (0, 1)}", "s = self.hashSet\nq = self.bodyQueue\nops = self.moveOps\nwidth = self.width\nheight = self.h...
<|body_start_0|> self.food = deque(food) self.width = width self.height = height self.bodyQueue = deque([(0, 0)]) self.hashSet = set([(0, 0)]) self.score = 0 self.moveOps = {'U': (-1, 0), 'D': (1, 0), 'L': (0, -1), 'R': (0, 1)} <|end_body_0|> <|body_start_1|> ...
SnakeGame
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SnakeGame: def __init__(self, width, height, food): """Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [1,0]. :typ...
stack_v2_sparse_classes_36k_train_015533
15,245
no_license
[ { "docstring": "Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [1,0]. :type width: int :type height: int :type food: List[List[int]]", ...
2
stack_v2_sparse_classes_30k_train_015454
Implement the Python class `SnakeGame` described below. Class description: Implement the SnakeGame class. Method signatures and docstrings: - def __init__(self, width, height, food): Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E...
Implement the Python class `SnakeGame` described below. Class description: Implement the SnakeGame class. Method signatures and docstrings: - def __init__(self, width, height, food): Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E...
035ef08434fa1ca781a6fb2f9eed3538b7d20c02
<|skeleton|> class SnakeGame: def __init__(self, width, height, food): """Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [1,0]. :typ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SnakeGame: def __init__(self, width, height, food): """Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [1,0]. :type width: int :...
the_stack_v2_python_sparse
leetcode_python/Design/design-snake-game.py
yennanliu/CS_basics
train
64
722a6b24f7f2413d065aab7a7262ebb74acb5cac
[ "from heron import app\nparams = dict()\nparams['wx_app_id'] = app.config.get('WX_APP_ID', '')\nparams['wx_mch_id'] = app.config.get('WX_MCH_ID', '')\nparams['wx_mch_key'] = app.config.get('WX_MCH_KEY', '')\nparams['wx_notify_url'] = PaymentOrderModel.wx_notify_url\nparams['ali_app_id'] = app.config.get('ALI_APP_ID...
<|body_start_0|> from heron import app params = dict() params['wx_app_id'] = app.config.get('WX_APP_ID', '') params['wx_mch_id'] = app.config.get('WX_MCH_ID', '') params['wx_mch_key'] = app.config.get('WX_MCH_KEY', '') params['wx_notify_url'] = PaymentOrderModel.wx_notify...
PaymentOrderModel
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PaymentOrderModel: def load_config_params(): """加载配置项参数""" <|body_0|> def generate_wx_order(params): """微信下订单 :param params: :return:""" <|body_1|> def generate_ali_order(params): """支付宝下单 :param params: 订单参数""" <|body_2|> def verify...
stack_v2_sparse_classes_36k_train_015534
3,970
permissive
[ { "docstring": "加载配置项参数", "name": "load_config_params", "signature": "def load_config_params()" }, { "docstring": "微信下订单 :param params: :return:", "name": "generate_wx_order", "signature": "def generate_wx_order(params)" }, { "docstring": "支付宝下单 :param params: 订单参数", "name": ...
4
stack_v2_sparse_classes_30k_val_000992
Implement the Python class `PaymentOrderModel` described below. Class description: Implement the PaymentOrderModel class. Method signatures and docstrings: - def load_config_params(): 加载配置项参数 - def generate_wx_order(params): 微信下订单 :param params: :return: - def generate_ali_order(params): 支付宝下单 :param params: 订单参数 - d...
Implement the Python class `PaymentOrderModel` described below. Class description: Implement the PaymentOrderModel class. Method signatures and docstrings: - def load_config_params(): 加载配置项参数 - def generate_wx_order(params): 微信下订单 :param params: :return: - def generate_ali_order(params): 支付宝下单 :param params: 订单参数 - d...
646eeaacea77e293c6eccc6dad82a04ece9294a3
<|skeleton|> class PaymentOrderModel: def load_config_params(): """加载配置项参数""" <|body_0|> def generate_wx_order(params): """微信下订单 :param params: :return:""" <|body_1|> def generate_ali_order(params): """支付宝下单 :param params: 订单参数""" <|body_2|> def verify...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PaymentOrderModel: def load_config_params(): """加载配置项参数""" from heron import app params = dict() params['wx_app_id'] = app.config.get('WX_APP_ID', '') params['wx_mch_id'] = app.config.get('WX_MCH_ID', '') params['wx_mch_key'] = app.config.get('WX_MCH_KEY', '') ...
the_stack_v2_python_sparse
app/models/comment/payment_order.py
Eastwu5788/heron
train
7
cc184d78b732642df6af729d4a11c2033e90ee08
[ "DatabaseModule = get_db_class(db_type)\nif db_type == 'memory':\n db_instance = DatabaseModule.get_or_create(**kwargs)\nelse:\n db_instance = DatabaseModule(**kwargs)\nreturn db_instance", "if not isinstance(db_name, str) or 'test' not in db_name:\n raise ValueError(f'permanently_erase_database() called...
<|body_start_0|> DatabaseModule = get_db_class(db_type) if db_type == 'memory': db_instance = DatabaseModule.get_or_create(**kwargs) else: db_instance = DatabaseModule(**kwargs) return db_instance <|end_body_0|> <|body_start_1|> if not isinstance(db_name,...
Simple class to load the appropriate DB type based on the config. We don't actually create instances of this class, but instead create an instance of the 'correct' type of db. .. doctest: >>> from panoptes.utils.database import PanDB >>> type(PanDB(db_type='file')) <class 'panoptes.utils.database.file.PanFileDB'> >>> t...
PanDB
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PanDB: """Simple class to load the appropriate DB type based on the config. We don't actually create instances of this class, but instead create an instance of the 'correct' type of db. .. doctest: >>> from panoptes.utils.database import PanDB >>> type(PanDB(db_type='file')) <class 'panoptes.util...
stack_v2_sparse_classes_36k_train_015535
6,702
permissive
[ { "docstring": "Create an instance based on db_type.", "name": "__new__", "signature": "def __new__(cls, db_type='memory', db_name=None, *args, **kwargs)" }, { "docstring": "Permanently delete the contents of the identified database.", "name": "permanently_erase_database", "signature": "...
2
stack_v2_sparse_classes_30k_train_006424
Implement the Python class `PanDB` described below. Class description: Simple class to load the appropriate DB type based on the config. We don't actually create instances of this class, but instead create an instance of the 'correct' type of db. .. doctest: >>> from panoptes.utils.database import PanDB >>> type(PanDB...
Implement the Python class `PanDB` described below. Class description: Simple class to load the appropriate DB type based on the config. We don't actually create instances of this class, but instead create an instance of the 'correct' type of db. .. doctest: >>> from panoptes.utils.database import PanDB >>> type(PanDB...
0cc7240d6bf1bf01d0d65a4000a60056aa31713c
<|skeleton|> class PanDB: """Simple class to load the appropriate DB type based on the config. We don't actually create instances of this class, but instead create an instance of the 'correct' type of db. .. doctest: >>> from panoptes.utils.database import PanDB >>> type(PanDB(db_type='file')) <class 'panoptes.util...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PanDB: """Simple class to load the appropriate DB type based on the config. We don't actually create instances of this class, but instead create an instance of the 'correct' type of db. .. doctest: >>> from panoptes.utils.database import PanDB >>> type(PanDB(db_type='file')) <class 'panoptes.utils.database.fi...
the_stack_v2_python_sparse
src/panoptes/utils/database/base.py
panoptes/panoptes-utils
train
3
0f79a08401fbbb123d217ea5079991f678bcfd56
[ "self.sequence = []\n\ndef inorder(root):\n if root:\n inorder(root.left)\n self.sequence.append(root.val)\n inorder(root.right)\ninorder(root)\nmini = self.sequence[1] - self.sequence[0]\nfor i in range(1, len(self.sequence) - 1):\n if self.sequence[i + 1] - self.sequence[i] < mini:\n ...
<|body_start_0|> self.sequence = [] def inorder(root): if root: inorder(root.left) self.sequence.append(root.val) inorder(root.right) inorder(root) mini = self.sequence[1] - self.sequence[0] for i in range(1, len(self.s...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def getMinimumDifference(self, root): """:type root: TreeNode :rtype: int Solution with O(n) time and O(n) space""" <|body_0|> def getMinimumDifference2(self, root): """Solution with O(n) time and O(1) space""" <|body_1|> <|end_skeleton|> <|body_s...
stack_v2_sparse_classes_36k_train_015536
2,279
no_license
[ { "docstring": ":type root: TreeNode :rtype: int Solution with O(n) time and O(n) space", "name": "getMinimumDifference", "signature": "def getMinimumDifference(self, root)" }, { "docstring": "Solution with O(n) time and O(1) space", "name": "getMinimumDifference2", "signature": "def get...
2
stack_v2_sparse_classes_30k_train_012323
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getMinimumDifference(self, root): :type root: TreeNode :rtype: int Solution with O(n) time and O(n) space - def getMinimumDifference2(self, root): Solution with O(n) time and...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getMinimumDifference(self, root): :type root: TreeNode :rtype: int Solution with O(n) time and O(n) space - def getMinimumDifference2(self, root): Solution with O(n) time and...
b7e92f9a7c4d6652d4901b189f51063ce5520653
<|skeleton|> class Solution: def getMinimumDifference(self, root): """:type root: TreeNode :rtype: int Solution with O(n) time and O(n) space""" <|body_0|> def getMinimumDifference2(self, root): """Solution with O(n) time and O(1) space""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def getMinimumDifference(self, root): """:type root: TreeNode :rtype: int Solution with O(n) time and O(n) space""" self.sequence = [] def inorder(root): if root: inorder(root.left) self.sequence.append(root.val) in...
the_stack_v2_python_sparse
leetcode/easy/min_abs_diff.py
abkunal/Data-Structures-and-Algorithms
train
2
3f413bbeb286c9b706c14a7b706281439189d82c
[ "self._trie = dict()\nfor word in words:\n for start in range(0, len(word) - 1):\n current_dict = self._trie\n for letter in word[start:]:\n current_dict = current_dict.setdefault(letter, {})\n if not current_dict.get(_end):\n current_dict[_end] = []\n current_di...
<|body_start_0|> self._trie = dict() for word in words: for start in range(0, len(word) - 1): current_dict = self._trie for letter in word[start:]: current_dict = current_dict.setdefault(letter, {}) if not current_dict.get(_...
SubstringTrie
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SubstringTrie: def __init__(self, words): """This little fucker needs to know about the substring's original words, so instead of _END: _END let's put _END: [original word]""" <|body_0|> def fetch(self, substring): """Return words that contain `substring`""" ...
stack_v2_sparse_classes_36k_train_015537
3,437
no_license
[ { "docstring": "This little fucker needs to know about the substring's original words, so instead of _END: _END let's put _END: [original word]", "name": "__init__", "signature": "def __init__(self, words)" }, { "docstring": "Return words that contain `substring`", "name": "fetch", "sign...
2
stack_v2_sparse_classes_30k_train_011898
Implement the Python class `SubstringTrie` described below. Class description: Implement the SubstringTrie class. Method signatures and docstrings: - def __init__(self, words): This little fucker needs to know about the substring's original words, so instead of _END: _END let's put _END: [original word] - def fetch(s...
Implement the Python class `SubstringTrie` described below. Class description: Implement the SubstringTrie class. Method signatures and docstrings: - def __init__(self, words): This little fucker needs to know about the substring's original words, so instead of _END: _END let's put _END: [original word] - def fetch(s...
60b0700156b893b95a1f30e6a45fb8cd0fb4bd32
<|skeleton|> class SubstringTrie: def __init__(self, words): """This little fucker needs to know about the substring's original words, so instead of _END: _END let's put _END: [original word]""" <|body_0|> def fetch(self, substring): """Return words that contain `substring`""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SubstringTrie: def __init__(self, words): """This little fucker needs to know about the substring's original words, so instead of _END: _END let's put _END: [original word]""" self._trie = dict() for word in words: for start in range(0, len(word) - 1): curre...
the_stack_v2_python_sparse
portmanteaux/trie.py
rfong/shittynlp
train
2
842b6b5c5c401e95d0971abd1803580cfb115c83
[ "n = int(len(s) // 2)\nfor i in range(n):\n s[i], s[-i - 1] = (s[-i - 1], s[i])\nreturn s", "i, j = (0, len(s) - 1)\nwhile i < j:\n s[i], s[j] = (s[j], s[i])\n i += 1\n j -= 1\nreturn s" ]
<|body_start_0|> n = int(len(s) // 2) for i in range(n): s[i], s[-i - 1] = (s[-i - 1], s[i]) return s <|end_body_0|> <|body_start_1|> i, j = (0, len(s) - 1) while i < j: s[i], s[j] = (s[j], s[i]) i += 1 j -= 1 return s <|en...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reverseStringd(self, s): """95 percentile runtime""" <|body_0|> def reverseString(self, s): """95 percentile runtime""" <|body_1|> <|end_skeleton|> <|body_start_0|> n = int(len(s) // 2) for i in range(n): s[i], s[-i...
stack_v2_sparse_classes_36k_train_015538
1,621
no_license
[ { "docstring": "95 percentile runtime", "name": "reverseStringd", "signature": "def reverseStringd(self, s)" }, { "docstring": "95 percentile runtime", "name": "reverseString", "signature": "def reverseString(self, s)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseStringd(self, s): 95 percentile runtime - def reverseString(self, s): 95 percentile runtime
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseStringd(self, s): 95 percentile runtime - def reverseString(self, s): 95 percentile runtime <|skeleton|> class Solution: def reverseStringd(self, s): """...
39b0f81342c53c55cb9e79873462df9b657f9628
<|skeleton|> class Solution: def reverseStringd(self, s): """95 percentile runtime""" <|body_0|> def reverseString(self, s): """95 percentile runtime""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def reverseStringd(self, s): """95 percentile runtime""" n = int(len(s) // 2) for i in range(n): s[i], s[-i - 1] = (s[-i - 1], s[i]) return s def reverseString(self, s): """95 percentile runtime""" i, j = (0, len(s) - 1) while ...
the_stack_v2_python_sparse
reverse-string/main.py
Milstein-Corp/exercises
train
0
e3db980a49dc734b3621e34c61623571603a55eb
[ "hosts_config = ConfigLoader.load(path, displayed_title='hosts')\nresult = {}\nfor section in hosts_config.sections():\n if section == 'proxy_tunneling':\n continue\n hostname = section\n result[hostname] = {'user': hosts_config.get(hostname, 'user'), 'port': hosts_config.getint(hostname, 'port', fa...
<|body_start_0|> hosts_config = ConfigLoader.load(path, displayed_title='hosts') result = {} for section in hosts_config.sections(): if section == 'proxy_tunneling': continue hostname = section result[hostname] = {'user': hosts_config.get(hostn...
SSH
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SSH: def hosts_config_to_dict(path: str) -> Dict: """Parses sections containing hostnames""" <|body_0|> def proxy_config_to_dict(path: str) -> Optional[Dict]: """Parses [proxy_tunneling] section""" <|body_1|> <|end_skeleton|> <|body_start_0|> hosts_...
stack_v2_sparse_classes_36k_train_015539
12,921
permissive
[ { "docstring": "Parses sections containing hostnames", "name": "hosts_config_to_dict", "signature": "def hosts_config_to_dict(path: str) -> Dict" }, { "docstring": "Parses [proxy_tunneling] section", "name": "proxy_config_to_dict", "signature": "def proxy_config_to_dict(path: str) -> Opt...
2
null
Implement the Python class `SSH` described below. Class description: Implement the SSH class. Method signatures and docstrings: - def hosts_config_to_dict(path: str) -> Dict: Parses sections containing hostnames - def proxy_config_to_dict(path: str) -> Optional[Dict]: Parses [proxy_tunneling] section
Implement the Python class `SSH` described below. Class description: Implement the SSH class. Method signatures and docstrings: - def hosts_config_to_dict(path: str) -> Dict: Parses sections containing hostnames - def proxy_config_to_dict(path: str) -> Optional[Dict]: Parses [proxy_tunneling] section <|skeleton|> cl...
5b50245d285618044a9a71c06ea5361a48ad4acb
<|skeleton|> class SSH: def hosts_config_to_dict(path: str) -> Dict: """Parses sections containing hostnames""" <|body_0|> def proxy_config_to_dict(path: str) -> Optional[Dict]: """Parses [proxy_tunneling] section""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SSH: def hosts_config_to_dict(path: str) -> Dict: """Parses sections containing hostnames""" hosts_config = ConfigLoader.load(path, displayed_title='hosts') result = {} for section in hosts_config.sections(): if section == 'proxy_tunneling': continue...
the_stack_v2_python_sparse
tensorhive/config.py
roscisz/TensorHive
train
153
d316d79d360196d13ed68a0d32ae64f209bf5f0d
[ "if maxNumbers > 0:\n self.current = linkedlist(0)\n self.head = linkedlist(-1)\n self.head.next = self.current\n for i in range(1, maxNumbers):\n self.current.next = linkedlist(i)\n self.current = self.current.next\nself.available = {num for num in range(maxNumbers)}", "if self.head.nex...
<|body_start_0|> if maxNumbers > 0: self.current = linkedlist(0) self.head = linkedlist(-1) self.head.next = self.current for i in range(1, maxNumbers): self.current.next = linkedlist(i) self.current = self.current.next self...
PhoneDirectory
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PhoneDirectory: def __init__(self, maxNumbers: int): """Initialize your data structure here @param maxNumbers - The maximum numbers that can be stored in the phone directory.""" <|body_0|> def get(self): """Provide a number which is not assigned to anyone. @return - ...
stack_v2_sparse_classes_36k_train_015540
2,076
permissive
[ { "docstring": "Initialize your data structure here @param maxNumbers - The maximum numbers that can be stored in the phone directory.", "name": "__init__", "signature": "def __init__(self, maxNumbers: int)" }, { "docstring": "Provide a number which is not assigned to anyone. @return - Return an...
4
null
Implement the Python class `PhoneDirectory` described below. Class description: Implement the PhoneDirectory class. Method signatures and docstrings: - def __init__(self, maxNumbers: int): Initialize your data structure here @param maxNumbers - The maximum numbers that can be stored in the phone directory. - def get(...
Implement the Python class `PhoneDirectory` described below. Class description: Implement the PhoneDirectory class. Method signatures and docstrings: - def __init__(self, maxNumbers: int): Initialize your data structure here @param maxNumbers - The maximum numbers that can be stored in the phone directory. - def get(...
3fd33092f53de25e8014c05af4ac3e6754f54e23
<|skeleton|> class PhoneDirectory: def __init__(self, maxNumbers: int): """Initialize your data structure here @param maxNumbers - The maximum numbers that can be stored in the phone directory.""" <|body_0|> def get(self): """Provide a number which is not assigned to anyone. @return - ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PhoneDirectory: def __init__(self, maxNumbers: int): """Initialize your data structure here @param maxNumbers - The maximum numbers that can be stored in the phone directory.""" if maxNumbers > 0: self.current = linkedlist(0) self.head = linkedlist(-1) self....
the_stack_v2_python_sparse
Python3/379.design-phone-directory.py
610yilingliu/leetcode
train
2
c97fdb45784e33af0557f4c96f8d3d0c53fdfcad
[ "trace_id = None\nspan_id = None\ntrace_options = None\nfor key in carrier:\n key = key.lower()\n if key == _TRACE_ID_KEY:\n trace_id = carrier[key]\n if key == _SPAN_ID_KEY:\n span_id = carrier[key]\n if key == _TRACE_OPTIONS_KEY:\n trace_options = bool(carrier[key])\nif trace_opti...
<|body_start_0|> trace_id = None span_id = None trace_options = None for key in carrier: key = key.lower() if key == _TRACE_ID_KEY: trace_id = carrier[key] if key == _SPAN_ID_KEY: span_id = carrier[key] if ke...
This class provides the basic utilities for extracting the trace information from a carrier which is a dict to form a SpanContext. And generating a dict using the provided SpanContext.
TextFormatPropagator
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TextFormatPropagator: """This class provides the basic utilities for extracting the trace information from a carrier which is a dict to form a SpanContext. And generating a dict using the provided SpanContext.""" def from_carrier(self, carrier): """Generate a SpanContext object using...
stack_v2_sparse_classes_36k_train_015541
3,089
permissive
[ { "docstring": "Generate a SpanContext object using the information in the carrier. :type carrier: dict :param carrier: The carrier which has the trace_id, span_id, options information for creating a SpanContext. :rtype: :class:`~opencensus.trace.span_context.SpanContext` :returns: SpanContext generated from th...
2
null
Implement the Python class `TextFormatPropagator` described below. Class description: This class provides the basic utilities for extracting the trace information from a carrier which is a dict to form a SpanContext. And generating a dict using the provided SpanContext. Method signatures and docstrings: - def from_ca...
Implement the Python class `TextFormatPropagator` described below. Class description: This class provides the basic utilities for extracting the trace information from a carrier which is a dict to form a SpanContext. And generating a dict using the provided SpanContext. Method signatures and docstrings: - def from_ca...
3a2d8dfe1db4e0129dc691c35901a0d12127afc1
<|skeleton|> class TextFormatPropagator: """This class provides the basic utilities for extracting the trace information from a carrier which is a dict to form a SpanContext. And generating a dict using the provided SpanContext.""" def from_carrier(self, carrier): """Generate a SpanContext object using...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TextFormatPropagator: """This class provides the basic utilities for extracting the trace information from a carrier which is a dict to form a SpanContext. And generating a dict using the provided SpanContext.""" def from_carrier(self, carrier): """Generate a SpanContext object using the informat...
the_stack_v2_python_sparse
opencensus/trace/propagation/text_format.py
census-instrumentation/opencensus-python
train
701
aa8fded917e26f6486feac67b827a708c8948959
[ "self.queue_declare(queue='q')\nself.session.exchange_bind(queue='q', exchange=ex, binding_key='k')\ntry:\n self.assertPublishConsume(exchange=ex, queue='q', routing_key='k')\n try:\n self.assertPublishConsume(exchange=ex, queue='q', routing_key='kk')\n self.fail('Expected Empty exception')\n ...
<|body_start_0|> self.queue_declare(queue='q') self.session.exchange_bind(queue='q', exchange=ex, binding_key='k') try: self.assertPublishConsume(exchange=ex, queue='q', routing_key='k') try: self.assertPublishConsume(exchange=ex, queue='q', routing_key='k...
Verifies standard exchange behavior. Used as base class for classes that test standard exchanges.
StandardExchangeVerifier
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StandardExchangeVerifier: """Verifies standard exchange behavior. Used as base class for classes that test standard exchanges.""" def verifyDirectExchange(self, ex, unbind=False): """Verify that ex behaves like a direct exchange.""" <|body_0|> def verifyFanOutExchange(se...
stack_v2_sparse_classes_36k_train_015542
22,700
permissive
[ { "docstring": "Verify that ex behaves like a direct exchange.", "name": "verifyDirectExchange", "signature": "def verifyDirectExchange(self, ex, unbind=False)" }, { "docstring": "Verify that ex behaves like a fanout exchange.", "name": "verifyFanOutExchange", "signature": "def verifyFan...
4
stack_v2_sparse_classes_30k_train_009169
Implement the Python class `StandardExchangeVerifier` described below. Class description: Verifies standard exchange behavior. Used as base class for classes that test standard exchanges. Method signatures and docstrings: - def verifyDirectExchange(self, ex, unbind=False): Verify that ex behaves like a direct exchang...
Implement the Python class `StandardExchangeVerifier` described below. Class description: Verifies standard exchange behavior. Used as base class for classes that test standard exchanges. Method signatures and docstrings: - def verifyDirectExchange(self, ex, unbind=False): Verify that ex behaves like a direct exchang...
b81faca08ef0b83161157fbe2652cfcc9dba2334
<|skeleton|> class StandardExchangeVerifier: """Verifies standard exchange behavior. Used as base class for classes that test standard exchanges.""" def verifyDirectExchange(self, ex, unbind=False): """Verify that ex behaves like a direct exchange.""" <|body_0|> def verifyFanOutExchange(se...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StandardExchangeVerifier: """Verifies standard exchange behavior. Used as base class for classes that test standard exchanges.""" def verifyDirectExchange(self, ex, unbind=False): """Verify that ex behaves like a direct exchange.""" self.queue_declare(queue='q') self.session.excha...
the_stack_v2_python_sparse
qpid_tests/broker_0_10/exchange.py
apache/qpid-python
train
18
ed7c41fc23722fe01cadd4e8f5c2db00dfaa878f
[ "result = self.device.brightness\ntry:\n brightness_value = int(result)\nexcept ValueError:\n _LOGGER.debug(\"VeSync - received unexpected 'brightness' value from pyvesync api: %s\", result)\n return 0\nreturn round(max(1, brightness_value) / 100 * 255)", "attribute_adjustment_only = False\nif self.color...
<|body_start_0|> result = self.device.brightness try: brightness_value = int(result) except ValueError: _LOGGER.debug("VeSync - received unexpected 'brightness' value from pyvesync api: %s", result) return 0 return round(max(1, brightness_value) / 100 ...
Base class for VeSync Light Devices Representations.
VeSyncBaseLight
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VeSyncBaseLight: """Base class for VeSync Light Devices Representations.""" def brightness(self) -> int: """Get light brightness.""" <|body_0|> def turn_on(self, **kwargs: Any) -> None: """Turn the device on.""" <|body_1|> <|end_skeleton|> <|body_start_...
stack_v2_sparse_classes_36k_train_015543
6,590
permissive
[ { "docstring": "Get light brightness.", "name": "brightness", "signature": "def brightness(self) -> int" }, { "docstring": "Turn the device on.", "name": "turn_on", "signature": "def turn_on(self, **kwargs: Any) -> None" } ]
2
stack_v2_sparse_classes_30k_train_006938
Implement the Python class `VeSyncBaseLight` described below. Class description: Base class for VeSync Light Devices Representations. Method signatures and docstrings: - def brightness(self) -> int: Get light brightness. - def turn_on(self, **kwargs: Any) -> None: Turn the device on.
Implement the Python class `VeSyncBaseLight` described below. Class description: Base class for VeSync Light Devices Representations. Method signatures and docstrings: - def brightness(self) -> int: Get light brightness. - def turn_on(self, **kwargs: Any) -> None: Turn the device on. <|skeleton|> class VeSyncBaseLig...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class VeSyncBaseLight: """Base class for VeSync Light Devices Representations.""" def brightness(self) -> int: """Get light brightness.""" <|body_0|> def turn_on(self, **kwargs: Any) -> None: """Turn the device on.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VeSyncBaseLight: """Base class for VeSync Light Devices Representations.""" def brightness(self) -> int: """Get light brightness.""" result = self.device.brightness try: brightness_value = int(result) except ValueError: _LOGGER.debug("VeSync - recei...
the_stack_v2_python_sparse
homeassistant/components/vesync/light.py
home-assistant/core
train
35,501
02b435b71f152337db30b6fc6253d7152eaa245e
[ "self.data = data_input\nself.lr = lambda t: lt * np.exp(-t / lr)\nself.nr = lambda t: nt * np.exp(-t / nr)\nself.iterations = iterations\nxx, yy = np.meshgrid(np.linspace(0, 0.5, 10), np.linspace(0, 0.5, 10))\nself.w = np.stack((xx, yy), 2)\nself.initial_w = np.copy(self.w)\nself.neighborhood = lambda sigma: self....
<|body_start_0|> self.data = data_input self.lr = lambda t: lt * np.exp(-t / lr) self.nr = lambda t: nt * np.exp(-t / nr) self.iterations = iterations xx, yy = np.meshgrid(np.linspace(0, 0.5, 10), np.linspace(0, 0.5, 10)) self.w = np.stack((xx, yy), 2) self.initia...
A self organizing map
SOM
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SOM: """A self organizing map""" def __init__(self, data_input, lr=300, lt=4, nr=300, nt=4, iterations=2000): """Initialization""" <|body_0|> def train(self): """Train the SOM""" <|body_1|> def gkern(sig, n): """creates gaussian kernel look u...
stack_v2_sparse_classes_36k_train_015544
8,324
no_license
[ { "docstring": "Initialization", "name": "__init__", "signature": "def __init__(self, data_input, lr=300, lt=4, nr=300, nt=4, iterations=2000)" }, { "docstring": "Train the SOM", "name": "train", "signature": "def train(self)" }, { "docstring": "creates gaussian kernel look up ta...
3
stack_v2_sparse_classes_30k_train_010984
Implement the Python class `SOM` described below. Class description: A self organizing map Method signatures and docstrings: - def __init__(self, data_input, lr=300, lt=4, nr=300, nt=4, iterations=2000): Initialization - def train(self): Train the SOM - def gkern(sig, n): creates gaussian kernel look up table
Implement the Python class `SOM` described below. Class description: A self organizing map Method signatures and docstrings: - def __init__(self, data_input, lr=300, lt=4, nr=300, nt=4, iterations=2000): Initialization - def train(self): Train the SOM - def gkern(sig, n): creates gaussian kernel look up table <|skel...
afb0bac438cccc7e759ec9961f240745b48da664
<|skeleton|> class SOM: """A self organizing map""" def __init__(self, data_input, lr=300, lt=4, nr=300, nt=4, iterations=2000): """Initialization""" <|body_0|> def train(self): """Train the SOM""" <|body_1|> def gkern(sig, n): """creates gaussian kernel look u...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SOM: """A self organizing map""" def __init__(self, data_input, lr=300, lt=4, nr=300, nt=4, iterations=2000): """Initialization""" self.data = data_input self.lr = lambda t: lt * np.exp(-t / lr) self.nr = lambda t: nt * np.exp(-t / nr) self.iterations = iterations ...
the_stack_v2_python_sparse
HW2/code/Problem3.py
vanandrew/BME572
train
0
f46a428c438bca96e78c2aef9441925848f2b7d0
[ "root.val = 0\nstack = list()\nstack.append(root)\nwhile stack:\n node = stack.pop()\n if node.left:\n node.left.val = 2 * node.val + 1\n stack.append(node.left)\n if node.right:\n node.right.val = 2 * node.val + 2\n stack.append(node.right)\nself.root = root", "num = list()\n...
<|body_start_0|> root.val = 0 stack = list() stack.append(root) while stack: node = stack.pop() if node.left: node.left.val = 2 * node.val + 1 stack.append(node.left) if node.right: node.right.val = 2 * n...
FindElements
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FindElements: def __init__(self, root): """:type root: TreeNode""" <|body_0|> def find(self, target): """:type target: int :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> root.val = 0 stack = list() stack.append(root) ...
stack_v2_sparse_classes_36k_train_015545
1,544
no_license
[ { "docstring": ":type root: TreeNode", "name": "__init__", "signature": "def __init__(self, root)" }, { "docstring": ":type target: int :rtype: bool", "name": "find", "signature": "def find(self, target)" } ]
2
stack_v2_sparse_classes_30k_train_009828
Implement the Python class `FindElements` described below. Class description: Implement the FindElements class. Method signatures and docstrings: - def __init__(self, root): :type root: TreeNode - def find(self, target): :type target: int :rtype: bool
Implement the Python class `FindElements` described below. Class description: Implement the FindElements class. Method signatures and docstrings: - def __init__(self, root): :type root: TreeNode - def find(self, target): :type target: int :rtype: bool <|skeleton|> class FindElements: def __init__(self, root): ...
039f2df9d0e0a1be0b401a4c63d6e5c81b79eec9
<|skeleton|> class FindElements: def __init__(self, root): """:type root: TreeNode""" <|body_0|> def find(self, target): """:type target: int :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FindElements: def __init__(self, root): """:type root: TreeNode""" root.val = 0 stack = list() stack.append(root) while stack: node = stack.pop() if node.left: node.left.val = 2 * node.val + 1 stack.append(node.lef...
the_stack_v2_python_sparse
weekly/163/2.py
SnoopySYF/leetcode
train
1
3b729d42e3ec9b7c9ef4d5dae046314139869071
[ "if self.request.user.is_authenticated:\n return self.request.user.is_manager\nelse:\n False", "manger_form = form.save(commit=False)\nmanger_form.manager = self.request.user\nmanger_form.save()\nreturn super(InteractionCreateView, self).form_valid(form)" ]
<|body_start_0|> if self.request.user.is_authenticated: return self.request.user.is_manager else: False <|end_body_0|> <|body_start_1|> manger_form = form.save(commit=False) manger_form.manager = self.request.user manger_form.save() return super(I...
Класс для создания взаимодействия
InteractionCreateView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InteractionCreateView: """Класс для создания взаимодействия""" def test_func(self): """Отклоняет реквест с 403 ошибкой,если метод возвращает False""" <|body_0|> def form_valid(self, form): """Вызывается, если форма валидна и добавляет к взаимодействию менеджера,к...
stack_v2_sparse_classes_36k_train_015546
17,093
no_license
[ { "docstring": "Отклоняет реквест с 403 ошибкой,если метод возвращает False", "name": "test_func", "signature": "def test_func(self)" }, { "docstring": "Вызывается, если форма валидна и добавляет к взаимодействию менеджера,которым оно было создано", "name": "form_valid", "signature": "de...
2
stack_v2_sparse_classes_30k_train_002709
Implement the Python class `InteractionCreateView` described below. Class description: Класс для создания взаимодействия Method signatures and docstrings: - def test_func(self): Отклоняет реквест с 403 ошибкой,если метод возвращает False - def form_valid(self, form): Вызывается, если форма валидна и добавляет к взаим...
Implement the Python class `InteractionCreateView` described below. Class description: Класс для создания взаимодействия Method signatures and docstrings: - def test_func(self): Отклоняет реквест с 403 ошибкой,если метод возвращает False - def form_valid(self, form): Вызывается, если форма валидна и добавляет к взаим...
e987577ebf0fe153029ec4c0312d2132f43e2180
<|skeleton|> class InteractionCreateView: """Класс для создания взаимодействия""" def test_func(self): """Отклоняет реквест с 403 ошибкой,если метод возвращает False""" <|body_0|> def form_valid(self, form): """Вызывается, если форма валидна и добавляет к взаимодействию менеджера,к...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InteractionCreateView: """Класс для создания взаимодействия""" def test_func(self): """Отклоняет реквест с 403 ошибкой,если метод возвращает False""" if self.request.user.is_authenticated: return self.request.user.is_manager else: False def form_valid(...
the_stack_v2_python_sparse
crmapp/crm/views.py
vova55151/2342343243
train
0
896f12c4ebce5364058372856784e381ffcd1d59
[ "nums.sort()\nans = [[]]\nlast = [[]]\nfor i, n in enumerate(nums):\n pickFrom = ans\n if i != 0 and nums[i - 1] == n:\n pickFrom = last\n last = [a + [n] for a in pickFrom]\n ans += last\nreturn ans", "lst = [[]]\nnums = sorted(nums)\n\ndef func(nums):\n if nums is None:\n return\n ...
<|body_start_0|> nums.sort() ans = [[]] last = [[]] for i, n in enumerate(nums): pickFrom = ans if i != 0 and nums[i - 1] == n: pickFrom = last last = [a + [n] for a in pickFrom] ans += last return ans <|end_body_0|>...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def subsetsWithDup(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_0|> def subsetsWithDup2(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|> <|body_start_0|> nums.sort() ...
stack_v2_sparse_classes_36k_train_015547
1,007
no_license
[ { "docstring": ":type nums: List[int] :rtype: List[List[int]]", "name": "subsetsWithDup", "signature": "def subsetsWithDup(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: List[List[int]]", "name": "subsetsWithDup2", "signature": "def subsetsWithDup2(self, nums)" } ]
2
stack_v2_sparse_classes_30k_val_001189
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def subsetsWithDup(self, nums): :type nums: List[int] :rtype: List[List[int]] - def subsetsWithDup2(self, nums): :type nums: List[int] :rtype: List[List[int]]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def subsetsWithDup(self, nums): :type nums: List[int] :rtype: List[List[int]] - def subsetsWithDup2(self, nums): :type nums: List[int] :rtype: List[List[int]] <|skeleton|> class...
93cbb01487a61e37159e8bdd4bf40f623e131c19
<|skeleton|> class Solution: def subsetsWithDup(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_0|> def subsetsWithDup2(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def subsetsWithDup(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" nums.sort() ans = [[]] last = [[]] for i, n in enumerate(nums): pickFrom = ans if i != 0 and nums[i - 1] == n: pickFrom = last ...
the_stack_v2_python_sparse
Leetcode_medium/backtracking/90.py
HenryBalthier/Python-Learning
train
0
53faa61b67caddd7fa702a906c09694956a62207
[ "if not self.id:\n self.created_at = timezone.now()\nself.updated_at = timezone.now()\nreturn super().save(*args, **kwargs)", "if self.building:\n raise ValueError('The building is already set')\nelse:\n self.company_name = company\n self.save()", "if building.company_name == self.company_name:\n ...
<|body_start_0|> if not self.id: self.created_at = timezone.now() self.updated_at = timezone.now() return super().save(*args, **kwargs) <|end_body_0|> <|body_start_1|> if self.building: raise ValueError('The building is already set') else: sel...
AgentCustomer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AgentCustomer: def save(self, *args, **kwargs): """Save the object to the database""" <|body_0|> def work_for(self, company: str, *args, **kwargs) -> None: """Set the company that this agent will work for""" <|body_1|> def work_at(self, building: Buildin...
stack_v2_sparse_classes_36k_train_015548
2,769
permissive
[ { "docstring": "Save the object to the database", "name": "save", "signature": "def save(self, *args, **kwargs)" }, { "docstring": "Set the company that this agent will work for", "name": "work_for", "signature": "def work_for(self, company: str, *args, **kwargs) -> None" }, { "d...
3
null
Implement the Python class `AgentCustomer` described below. Class description: Implement the AgentCustomer class. Method signatures and docstrings: - def save(self, *args, **kwargs): Save the object to the database - def work_for(self, company: str, *args, **kwargs) -> None: Set the company that this agent will work ...
Implement the Python class `AgentCustomer` described below. Class description: Implement the AgentCustomer class. Method signatures and docstrings: - def save(self, *args, **kwargs): Save the object to the database - def work_for(self, company: str, *args, **kwargs) -> None: Set the company that this agent will work ...
142c623da4722f7443d76fc8bef0e56c0aa3d48e
<|skeleton|> class AgentCustomer: def save(self, *args, **kwargs): """Save the object to the database""" <|body_0|> def work_for(self, company: str, *args, **kwargs) -> None: """Set the company that this agent will work for""" <|body_1|> def work_at(self, building: Buildin...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AgentCustomer: def save(self, *args, **kwargs): """Save the object to the database""" if not self.id: self.created_at = timezone.now() self.updated_at = timezone.now() return super().save(*args, **kwargs) def work_for(self, company: str, *args, **kwargs) -> Non...
the_stack_v2_python_sparse
app/models/core/agent/agent.py
polowis/virtComp
train
0
d20a2d818796ff592f18993d822b0b2e4f379736
[ "o = OperatorCharStar()\nself.assertEqual(o.m_str, 'OperatorCharStar')\nself.assertIn('OperatorCharStar', repr(o))\no = OperatorConstCharStar()\nself.assertEqual(o.m_str, 'OperatorConstCharStar')\nself.assertIn('OperatorConstCharStar', repr(o))\no = OperatorInt()\no.m_int = -13\nself.assertEqual(o.m_int, -13)\nself...
<|body_start_0|> o = OperatorCharStar() self.assertEqual(o.m_str, 'OperatorCharStar') self.assertIn('OperatorCharStar', repr(o)) o = OperatorConstCharStar() self.assertEqual(o.m_str, 'OperatorConstCharStar') self.assertIn('OperatorConstCharStar', repr(o)) o = Oper...
Cpp2ConverterOperatorsTestCase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Cpp2ConverterOperatorsTestCase: def test1ExactTypes(self): """Test converter operators of exact types""" <|body_0|> def test2ApproximateTypes(self): """Test converter operators of approximate types""" <|body_1|> <|end_skeleton|> <|body_start_0|> o =...
stack_v2_sparse_classes_36k_train_015549
5,582
no_license
[ { "docstring": "Test converter operators of exact types", "name": "test1ExactTypes", "signature": "def test1ExactTypes(self)" }, { "docstring": "Test converter operators of approximate types", "name": "test2ApproximateTypes", "signature": "def test2ApproximateTypes(self)" } ]
2
stack_v2_sparse_classes_30k_train_009673
Implement the Python class `Cpp2ConverterOperatorsTestCase` described below. Class description: Implement the Cpp2ConverterOperatorsTestCase class. Method signatures and docstrings: - def test1ExactTypes(self): Test converter operators of exact types - def test2ApproximateTypes(self): Test converter operators of appr...
Implement the Python class `Cpp2ConverterOperatorsTestCase` described below. Class description: Implement the Cpp2ConverterOperatorsTestCase class. Method signatures and docstrings: - def test1ExactTypes(self): Test converter operators of exact types - def test2ApproximateTypes(self): Test converter operators of appr...
134508460915282a5d82d6cbbb6e6afa14653413
<|skeleton|> class Cpp2ConverterOperatorsTestCase: def test1ExactTypes(self): """Test converter operators of exact types""" <|body_0|> def test2ApproximateTypes(self): """Test converter operators of approximate types""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Cpp2ConverterOperatorsTestCase: def test1ExactTypes(self): """Test converter operators of exact types""" o = OperatorCharStar() self.assertEqual(o.m_str, 'OperatorCharStar') self.assertIn('OperatorCharStar', repr(o)) o = OperatorConstCharStar() self.assertEqual(...
the_stack_v2_python_sparse
python/basic/PyROOT_operatortests.py
root-project/roottest
train
41
a98c901ab776273d9592e319c5825b465b714825
[ "self.to_email = to_email\nself.from_email = from_email\nself._email_send_threshold = email_send_threshold\nself._email_last_sent_time = datetime(1970, 1, 1)", "if datetime.now() - self._email_last_sent_time < self._email_send_threshold:\n if logger:\n logger.info('did not send email: %s' % message)\n ...
<|body_start_0|> self.to_email = to_email self.from_email = from_email self._email_send_threshold = email_send_threshold self._email_last_sent_time = datetime(1970, 1, 1) <|end_body_0|> <|body_start_1|> if datetime.now() - self._email_last_sent_time < self._email_send_threshold:...
Send alert emails. Throttle the sending to allow at most one message every self._email_send_threshold
ThrottledMailer
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ThrottledMailer: """Send alert emails. Throttle the sending to allow at most one message every self._email_send_threshold""" def __init__(self, to_email, from_email, email_send_threshold): """Args: email_send_threshold: timedelta""" <|body_0|> def send_email(self, messag...
stack_v2_sparse_classes_36k_train_015550
1,374
permissive
[ { "docstring": "Args: email_send_threshold: timedelta", "name": "__init__", "signature": "def __init__(self, to_email, from_email, email_send_threshold)" }, { "docstring": "send an alert email if one hasn't been sent recently Args: message (string): the email body logger [optional] (logger objec...
2
null
Implement the Python class `ThrottledMailer` described below. Class description: Send alert emails. Throttle the sending to allow at most one message every self._email_send_threshold Method signatures and docstrings: - def __init__(self, to_email, from_email, email_send_threshold): Args: email_send_threshold: timedel...
Implement the Python class `ThrottledMailer` described below. Class description: Send alert emails. Throttle the sending to allow at most one message every self._email_send_threshold Method signatures and docstrings: - def __init__(self, to_email, from_email, email_send_threshold): Args: email_send_threshold: timedel...
70280110ec342a6f6db1c102e96756fcc3c3c01b
<|skeleton|> class ThrottledMailer: """Send alert emails. Throttle the sending to allow at most one message every self._email_send_threshold""" def __init__(self, to_email, from_email, email_send_threshold): """Args: email_send_threshold: timedelta""" <|body_0|> def send_email(self, messag...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ThrottledMailer: """Send alert emails. Throttle the sending to allow at most one message every self._email_send_threshold""" def __init__(self, to_email, from_email, email_send_threshold): """Args: email_send_threshold: timedelta""" self.to_email = to_email self.from_email = from_...
the_stack_v2_python_sparse
pylib/net/mailer.py
room77/py77
train
0
4a4b8bb7bca3a9b12813867772ecd2c75ef60468
[ "for scenario_id, (scenario_probabilities, scenario_trajectories) in self.predictions.items():\n for track_id, track_trajectories in scenario_trajectories.items():\n if track_trajectories[0].shape[-2:] != EXPECTED_PREDICTION_SHAPE:\n raise ValueError(f'Prediction for track {track_id} in {scenar...
<|body_start_0|> for scenario_id, (scenario_probabilities, scenario_trajectories) in self.predictions.items(): for track_id, track_trajectories in scenario_trajectories.items(): if track_trajectories[0].shape[-2:] != EXPECTED_PREDICTION_SHAPE: raise ValueError(f'P...
Representation used to build submission for the AV2 motion forecasting challenge. Args: predictions: Container for all predictions to score - mapping from scenario ID to scenario-level predictions.
ChallengeSubmission
[ "MIT", "CC-BY-NC-SA-4.0", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ChallengeSubmission: """Representation used to build submission for the AV2 motion forecasting challenge. Args: predictions: Container for all predictions to score - mapping from scenario ID to scenario-level predictions.""" def __post_init__(self) -> None: """Validate that each of t...
stack_v2_sparse_classes_36k_train_015551
6,712
permissive
[ { "docstring": "Validate that each of the submitted predictions has the appropriate shape and normalized probabilities. Raises: ValueError: If predictions for at least one track are not of shape (*, AV2_SCENARIO_PRED_TIMESTEPS, 2). ValueError: If for any track, number of probabilities doesn't match the number o...
3
null
Implement the Python class `ChallengeSubmission` described below. Class description: Representation used to build submission for the AV2 motion forecasting challenge. Args: predictions: Container for all predictions to score - mapping from scenario ID to scenario-level predictions. Method signatures and docstrings: -...
Implement the Python class `ChallengeSubmission` described below. Class description: Representation used to build submission for the AV2 motion forecasting challenge. Args: predictions: Container for all predictions to score - mapping from scenario ID to scenario-level predictions. Method signatures and docstrings: -...
ae85f69b0e9303487d118e429b703abb0593eaf3
<|skeleton|> class ChallengeSubmission: """Representation used to build submission for the AV2 motion forecasting challenge. Args: predictions: Container for all predictions to score - mapping from scenario ID to scenario-level predictions.""" def __post_init__(self) -> None: """Validate that each of t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ChallengeSubmission: """Representation used to build submission for the AV2 motion forecasting challenge. Args: predictions: Container for all predictions to score - mapping from scenario ID to scenario-level predictions.""" def __post_init__(self) -> None: """Validate that each of the submitted ...
the_stack_v2_python_sparse
src/av2/datasets/motion_forecasting/eval/submission.py
argoverse/av2-api
train
86
2309190c4f5e0fa139b10ed7a0d76c461bd5a1a8
[ "self.sensor = Sensor('127.0.0.1', '1111')\nself.pump = Pump('127.0.0.1', '2222')\nself.decider = Decider(100, 0.05)\nself.controller = Controller(self.sensor, self.pump, self.decider)\nself.actions = {'PUMP_IN': self.pump.PUMP_IN, 'PUMP_OUT': self.pump.PUMP_OUT, 'PUMP_OFF': self.pump.PUMP_OFF}", "cur_height = 50...
<|body_start_0|> self.sensor = Sensor('127.0.0.1', '1111') self.pump = Pump('127.0.0.1', '2222') self.decider = Decider(100, 0.05) self.controller = Controller(self.sensor, self.pump, self.decider) self.actions = {'PUMP_IN': self.pump.PUMP_IN, 'PUMP_OUT': self.pump.PUMP_OUT, 'PUM...
Module tests for the water-regulation module
ModuleTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ModuleTests: """Module tests for the water-regulation module""" def setUp(self): """Create Dummy instance""" <|body_0|> def test_module(self): """Basic integration test for waterregulation module""" <|body_1|> <|end_skeleton|> <|body_start_0|> s...
stack_v2_sparse_classes_36k_train_015552
1,354
no_license
[ { "docstring": "Create Dummy instance", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Basic integration test for waterregulation module", "name": "test_module", "signature": "def test_module(self)" } ]
2
stack_v2_sparse_classes_30k_train_021041
Implement the Python class `ModuleTests` described below. Class description: Module tests for the water-regulation module Method signatures and docstrings: - def setUp(self): Create Dummy instance - def test_module(self): Basic integration test for waterregulation module
Implement the Python class `ModuleTests` described below. Class description: Module tests for the water-regulation module Method signatures and docstrings: - def setUp(self): Create Dummy instance - def test_module(self): Basic integration test for waterregulation module <|skeleton|> class ModuleTests: """Module...
b1fea0309b3495b3e1dc167d7029bc9e4b6f00f1
<|skeleton|> class ModuleTests: """Module tests for the water-regulation module""" def setUp(self): """Create Dummy instance""" <|body_0|> def test_module(self): """Basic integration test for waterregulation module""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ModuleTests: """Module tests for the water-regulation module""" def setUp(self): """Create Dummy instance""" self.sensor = Sensor('127.0.0.1', '1111') self.pump = Pump('127.0.0.1', '2222') self.decider = Decider(100, 0.05) self.controller = Controller(self.sensor, ...
the_stack_v2_python_sparse
students/tbrackney/Lesson6/water-regulation/waterregulation/integrationtest.py
UWPCE-PythonCert-ClassRepos/SP_Online_Course2_2018
train
4
2a0f4c5cb475a8861c8564158531d8a211415176
[ "paginator = client.get_paginator('describe_load_balancers')\nload_balancers = {}\nfor resp in paginator.paginate():\n for lb in resp.get('LoadBalancers', []):\n resource_arn = lb['LoadBalancerArn']\n try:\n lb_attrs = cls.get_lb_attrs(client, resource_arn)\n lb.update(lb_attr...
<|body_start_0|> paginator = client.get_paginator('describe_load_balancers') load_balancers = {} for resp in paginator.paginate(): for lb in resp.get('LoadBalancers', []): resource_arn = lb['LoadBalancerArn'] try: lb_attrs = cls.get...
Resource for load balancer
LoadBalancerResourceSpec
[ "MIT", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LoadBalancerResourceSpec: """Resource for load balancer""" def list_from_aws(cls: Type['LoadBalancerResourceSpec'], client: BaseClient, account_id: str, region: str) -> ListFromAWSResult: """Return a dict of dicts of the format: {'lb_1_arn': {lb_1_dict}, 'lb_2_arn': {lb_2_dict}, ...}...
stack_v2_sparse_classes_36k_train_015553
4,379
permissive
[ { "docstring": "Return a dict of dicts of the format: {'lb_1_arn': {lb_1_dict}, 'lb_2_arn': {lb_2_dict}, ...} Where the dicts represent results from describe_load_balancers.", "name": "list_from_aws", "signature": "def list_from_aws(cls: Type['LoadBalancerResourceSpec'], client: BaseClient, account_id: ...
2
stack_v2_sparse_classes_30k_train_014597
Implement the Python class `LoadBalancerResourceSpec` described below. Class description: Resource for load balancer Method signatures and docstrings: - def list_from_aws(cls: Type['LoadBalancerResourceSpec'], client: BaseClient, account_id: str, region: str) -> ListFromAWSResult: Return a dict of dicts of the format...
Implement the Python class `LoadBalancerResourceSpec` described below. Class description: Resource for load balancer Method signatures and docstrings: - def list_from_aws(cls: Type['LoadBalancerResourceSpec'], client: BaseClient, account_id: str, region: str) -> ListFromAWSResult: Return a dict of dicts of the format...
eb7d5d18f3d177973c4105c21be9d251250ca8d6
<|skeleton|> class LoadBalancerResourceSpec: """Resource for load balancer""" def list_from_aws(cls: Type['LoadBalancerResourceSpec'], client: BaseClient, account_id: str, region: str) -> ListFromAWSResult: """Return a dict of dicts of the format: {'lb_1_arn': {lb_1_dict}, 'lb_2_arn': {lb_2_dict}, ...}...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LoadBalancerResourceSpec: """Resource for load balancer""" def list_from_aws(cls: Type['LoadBalancerResourceSpec'], client: BaseClient, account_id: str, region: str) -> ListFromAWSResult: """Return a dict of dicts of the format: {'lb_1_arn': {lb_1_dict}, 'lb_2_arn': {lb_2_dict}, ...} Where the di...
the_stack_v2_python_sparse
altimeter/aws/resource/elbv2/load_balancer.py
tableau/altimeter
train
75
d7a48299debfed85d2acbb5960a27728862e8269
[ "expected_0 = (np.array([0.0, 0.25, 0.5, 0.75, 1.0]), np.array([0.0, 0.0, 0.25, 0.5, 0.75]))\nexpected_1 = (np.array([0.0, 0.25, 0.5, 0.75, 1.0]), np.array([0.25, 0.5, 0.75, 1.0, 1.0]))\nplugin = Plugin()\nthreshold_0 = plugin._calculate_reliability_probabilities(self.reliability_cube[0])\nthreshold_1 = plugin._cal...
<|body_start_0|> expected_0 = (np.array([0.0, 0.25, 0.5, 0.75, 1.0]), np.array([0.0, 0.0, 0.25, 0.5, 0.75])) expected_1 = (np.array([0.0, 0.25, 0.5, 0.75, 1.0]), np.array([0.25, 0.5, 0.75, 1.0, 1.0])) plugin = Plugin() threshold_0 = plugin._calculate_reliability_probabilities(self.reliab...
Test the _calculate_reliability_probabilities method.
Test__calculate_reliability_probabilities
[ "BSD-3-Clause", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test__calculate_reliability_probabilities: """Test the _calculate_reliability_probabilities method.""" def test_values(self): """Test expected values are returned when two or more bins are available for interpolation.""" <|body_0|> def test_fewer_than_two_bins(self): ...
stack_v2_sparse_classes_36k_train_015554
24,150
permissive
[ { "docstring": "Test expected values are returned when two or more bins are available for interpolation.", "name": "test_values", "signature": "def test_values(self)" }, { "docstring": "Test that if fewer than two probability bins are provided, no calibration is applied.", "name": "test_fewe...
2
null
Implement the Python class `Test__calculate_reliability_probabilities` described below. Class description: Test the _calculate_reliability_probabilities method. Method signatures and docstrings: - def test_values(self): Test expected values are returned when two or more bins are available for interpolation. - def tes...
Implement the Python class `Test__calculate_reliability_probabilities` described below. Class description: Test the _calculate_reliability_probabilities method. Method signatures and docstrings: - def test_values(self): Test expected values are returned when two or more bins are available for interpolation. - def tes...
cd2c9019944345df1e703bf8f625db537ad9f559
<|skeleton|> class Test__calculate_reliability_probabilities: """Test the _calculate_reliability_probabilities method.""" def test_values(self): """Test expected values are returned when two or more bins are available for interpolation.""" <|body_0|> def test_fewer_than_two_bins(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Test__calculate_reliability_probabilities: """Test the _calculate_reliability_probabilities method.""" def test_values(self): """Test expected values are returned when two or more bins are available for interpolation.""" expected_0 = (np.array([0.0, 0.25, 0.5, 0.75, 1.0]), np.array([0.0, ...
the_stack_v2_python_sparse
improver_tests/calibration/reliability_calibration/test_ApplyReliabilityCalibration.py
metoppv/improver
train
101
7bdf0c3776321a08e861a08541909e2f2a3e12d0
[ "self.expires_at = APIHelper.RFC3339DateTime(expires_at) if expires_at else None\nself.expires_in = expires_in\nself.additional_information = additional_information", "if dictionary is None:\n return None\nexpires_at = APIHelper.RFC3339DateTime.from_value(dictionary.get('expires_at')).datetime if dictionary.ge...
<|body_start_0|> self.expires_at = APIHelper.RFC3339DateTime(expires_at) if expires_at else None self.expires_in = expires_in self.additional_information = additional_information <|end_body_0|> <|body_start_1|> if dictionary is None: return None expires_at = APIHelpe...
Implementation of the 'Pix' model. TODO: type model description here. Attributes: expires_at (datetime): Datetime when pix payment will expire expires_in (int): Seconds until pix payment expires additional_information (list of PixAdditionalInformation): Pix additional information
Pix
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Pix: """Implementation of the 'Pix' model. TODO: type model description here. Attributes: expires_at (datetime): Datetime when pix payment will expire expires_in (int): Seconds until pix payment expires additional_information (list of PixAdditionalInformation): Pix additional information""" ...
stack_v2_sparse_classes_36k_train_015555
2,571
permissive
[ { "docstring": "Constructor for the Pix class", "name": "__init__", "signature": "def __init__(self, expires_at=None, expires_in=None, additional_information=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary representation o...
2
null
Implement the Python class `Pix` described below. Class description: Implementation of the 'Pix' model. TODO: type model description here. Attributes: expires_at (datetime): Datetime when pix payment will expire expires_in (int): Seconds until pix payment expires additional_information (list of PixAdditionalInformatio...
Implement the Python class `Pix` described below. Class description: Implementation of the 'Pix' model. TODO: type model description here. Attributes: expires_at (datetime): Datetime when pix payment will expire expires_in (int): Seconds until pix payment expires additional_information (list of PixAdditionalInformatio...
95c80c35dd57bb2a238faeaf30d1e3b4544d2298
<|skeleton|> class Pix: """Implementation of the 'Pix' model. TODO: type model description here. Attributes: expires_at (datetime): Datetime when pix payment will expire expires_in (int): Seconds until pix payment expires additional_information (list of PixAdditionalInformation): Pix additional information""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Pix: """Implementation of the 'Pix' model. TODO: type model description here. Attributes: expires_at (datetime): Datetime when pix payment will expire expires_in (int): Seconds until pix payment expires additional_information (list of PixAdditionalInformation): Pix additional information""" def __init__(...
the_stack_v2_python_sparse
mundiapi/models/pix.py
mundipagg/MundiAPI-PYTHON
train
10
6ae271287cd6168f6b9f6f6c87bdac24ceededbd
[ "from renku.core.commands.save import repo_sync\nif self.project_path is None:\n raise RenkuException('unable to sync with remote since no operation has been executed')\n_, remote_branch = repo_sync(Repo(self.project_path), remote=remote)\nreturn remote_branch", "self.is_write = True\nresult = self.execute_op(...
<|body_start_0|> from renku.core.commands.save import repo_sync if self.project_path is None: raise RenkuException('unable to sync with remote since no operation has been executed') _, remote_branch = repo_sync(Repo(self.project_path), remote=remote) return remote_branch <|en...
Sync operation mixin. Extension of `RenkuOperationMixin` responsible for syncing all write operation with the remote. In case sync fails, it will create a new branch and push newly created branch to the remote and return the branch name to the client.
RenkuOpSyncMixin
[ "Apache-2.0", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RenkuOpSyncMixin: """Sync operation mixin. Extension of `RenkuOperationMixin` responsible for syncing all write operation with the remote. In case sync fails, it will create a new branch and push newly created branch to the remote and return the branch name to the client.""" def sync(self, r...
stack_v2_sparse_classes_36k_train_015556
14,650
permissive
[ { "docstring": "Sync with remote.", "name": "sync", "signature": "def sync(self, remote='origin')" }, { "docstring": "Execute operation which controller implements and sync with the remote.", "name": "execute_and_sync", "signature": "def execute_and_sync(self, remote='origin')" } ]
2
null
Implement the Python class `RenkuOpSyncMixin` described below. Class description: Sync operation mixin. Extension of `RenkuOperationMixin` responsible for syncing all write operation with the remote. In case sync fails, it will create a new branch and push newly created branch to the remote and return the branch name ...
Implement the Python class `RenkuOpSyncMixin` described below. Class description: Sync operation mixin. Extension of `RenkuOperationMixin` responsible for syncing all write operation with the remote. In case sync fails, it will create a new branch and push newly created branch to the remote and return the branch name ...
449ec7bca1cc435e5a8ceb278e49a422b953bb09
<|skeleton|> class RenkuOpSyncMixin: """Sync operation mixin. Extension of `RenkuOperationMixin` responsible for syncing all write operation with the remote. In case sync fails, it will create a new branch and push newly created branch to the remote and return the branch name to the client.""" def sync(self, r...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RenkuOpSyncMixin: """Sync operation mixin. Extension of `RenkuOperationMixin` responsible for syncing all write operation with the remote. In case sync fails, it will create a new branch and push newly created branch to the remote and return the branch name to the client.""" def sync(self, remote='origin...
the_stack_v2_python_sparse
renku/service/controllers/api/mixins.py
code-inflation/renku-python
train
0
57eea8ce88b12e209fb632289b94d1194435d637
[ "self.Whf = np.random.normal(size=(h + i, h))\nself.Whb = np.random.normal(size=(h + i, h))\nself.Wy = np.random.normal(size=(h + h, o))\nself.bhf = np.zeros(shape=(1, h))\nself.bhb = np.zeros(shape=(1, h))\nself.by = np.zeros(shape=(1, o))", "x = np.concatenate((h_prev, x_t), axis=1)\nh_t = np.tanh(np.dot(x, sel...
<|body_start_0|> self.Whf = np.random.normal(size=(h + i, h)) self.Whb = np.random.normal(size=(h + i, h)) self.Wy = np.random.normal(size=(h + h, o)) self.bhf = np.zeros(shape=(1, h)) self.bhb = np.zeros(shape=(1, h)) self.by = np.zeros(shape=(1, o)) <|end_body_0|> <|bo...
class BidirectionalCell that represents a bidirectional cell of an RNN
BidirectionalCell
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BidirectionalCell: """class BidirectionalCell that represents a bidirectional cell of an RNN""" def __init__(self, i, h, o): """Constructor Args: i: i is the dimensionality of the data h: is the dimensionality of the hidden state o: is the dimensionality of the outputs Attributes tha...
stack_v2_sparse_classes_36k_train_015557
4,725
no_license
[ { "docstring": "Constructor Args: i: i is the dimensionality of the data h: is the dimensionality of the hidden state o: is the dimensionality of the outputs Attributes that represent the weights and biases of the cell: Whf: weights for the hidden states in the forward direction Whb: weights for the hidden stat...
4
null
Implement the Python class `BidirectionalCell` described below. Class description: class BidirectionalCell that represents a bidirectional cell of an RNN Method signatures and docstrings: - def __init__(self, i, h, o): Constructor Args: i: i is the dimensionality of the data h: is the dimensionality of the hidden sta...
Implement the Python class `BidirectionalCell` described below. Class description: class BidirectionalCell that represents a bidirectional cell of an RNN Method signatures and docstrings: - def __init__(self, i, h, o): Constructor Args: i: i is the dimensionality of the data h: is the dimensionality of the hidden sta...
eb47cd4d12e2f0627bb5e5af28cc0802ff13d0d9
<|skeleton|> class BidirectionalCell: """class BidirectionalCell that represents a bidirectional cell of an RNN""" def __init__(self, i, h, o): """Constructor Args: i: i is the dimensionality of the data h: is the dimensionality of the hidden state o: is the dimensionality of the outputs Attributes tha...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BidirectionalCell: """class BidirectionalCell that represents a bidirectional cell of an RNN""" def __init__(self, i, h, o): """Constructor Args: i: i is the dimensionality of the data h: is the dimensionality of the hidden state o: is the dimensionality of the outputs Attributes that represent t...
the_stack_v2_python_sparse
supervised_learning/0x0D. RNNs/7-bi_output.py
rodrigocruz13/holbertonschool-machine_learning
train
4
404849ce3df3bdc0f609c7709918fdbfe530a794
[ "with allure.step('点击第一条客户,进入客户详情'):\n self.steps('../page/signlist.yaml')\nreturn CustomerDetail(self._driver)", "with allure.step('点击第一条客户,拨打电话'):\n self.steps('../page/signlist.yaml')\nreturn self", "with allure.step('点击第一条客户,“+”添加报备楼盘按钮'):\n self.steps('../page/signlist.yaml')\nreturn SignHouse(sel...
<|body_start_0|> with allure.step('点击第一条客户,进入客户详情'): self.steps('../page/signlist.yaml') return CustomerDetail(self._driver) <|end_body_0|> <|body_start_1|> with allure.step('点击第一条客户,拨打电话'): self.steps('../page/signlist.yaml') return self <|end_body_1|> <|body_s...
报备列表 页面
SignList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SignList: """报备列表 页面""" def goto_customer_detail(self): """点击第一条客户,进入客户详情 :return: CustomerDetail(self._driver)""" <|body_0|> def click_phone(self): """点击第一条客户的拨打电话按钮 :return: self""" <|body_1|> def add_sign_house(self): """点击第一条客户的,“+”添加报备楼盘...
stack_v2_sparse_classes_36k_train_015558
2,148
no_license
[ { "docstring": "点击第一条客户,进入客户详情 :return: CustomerDetail(self._driver)", "name": "goto_customer_detail", "signature": "def goto_customer_detail(self)" }, { "docstring": "点击第一条客户的拨打电话按钮 :return: self", "name": "click_phone", "signature": "def click_phone(self)" }, { "docstring": "点击...
6
stack_v2_sparse_classes_30k_train_010944
Implement the Python class `SignList` described below. Class description: 报备列表 页面 Method signatures and docstrings: - def goto_customer_detail(self): 点击第一条客户,进入客户详情 :return: CustomerDetail(self._driver) - def click_phone(self): 点击第一条客户的拨打电话按钮 :return: self - def add_sign_house(self): 点击第一条客户的,“+”添加报备楼盘按钮 :return: Sig...
Implement the Python class `SignList` described below. Class description: 报备列表 页面 Method signatures and docstrings: - def goto_customer_detail(self): 点击第一条客户,进入客户详情 :return: CustomerDetail(self._driver) - def click_phone(self): 点击第一条客户的拨打电话按钮 :return: self - def add_sign_house(self): 点击第一条客户的,“+”添加报备楼盘按钮 :return: Sig...
7f1d9323ea6c7defa3714467e3c121a7ffc44c62
<|skeleton|> class SignList: """报备列表 页面""" def goto_customer_detail(self): """点击第一条客户,进入客户详情 :return: CustomerDetail(self._driver)""" <|body_0|> def click_phone(self): """点击第一条客户的拨打电话按钮 :return: self""" <|body_1|> def add_sign_house(self): """点击第一条客户的,“+”添加报备楼盘...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SignList: """报备列表 页面""" def goto_customer_detail(self): """点击第一条客户,进入客户详情 :return: CustomerDetail(self._driver)""" with allure.step('点击第一条客户,进入客户详情'): self.steps('../page/signlist.yaml') return CustomerDetail(self._driver) def click_phone(self): """点击第一条客户...
the_stack_v2_python_sparse
page/signlist.py
gzsyr/testcase-III-pytest-allure
train
0
6557d7e008ae5d79eceaa9e50ad6589898b1847e
[ "self.normal_max_repeat = normal_max_repeat\nself.normal_sleep_time = normal_sleep_time\nself.critical_max_repeat = critical_max_repeat\nself.critical_sleep_time = critical_sleep_time\nreturn", "headers = {'User-Agent': make_random_useragent(), 'Accept-Encoding': 'gzip'}\nresponse = requests.get(url, params=None,...
<|body_start_0|> self.normal_max_repeat = normal_max_repeat self.normal_sleep_time = normal_sleep_time self.critical_max_repeat = critical_max_repeat self.critical_sleep_time = critical_sleep_time return <|end_body_0|> <|body_start_1|> headers = {'User-Agent': make_rando...
class of Fetcher, must include function url_fetch()
Fetcher
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Fetcher: """class of Fetcher, must include function url_fetch()""" def __init__(self, normal_max_repeat=3, normal_sleep_time=3, critical_max_repeat=10, critical_sleep_time=10): """constructor""" <|body_0|> def url_fetch(self, url, keys, critical, fetch_repeat): "...
stack_v2_sparse_classes_36k_train_015559
2,971
no_license
[ { "docstring": "constructor", "name": "__init__", "signature": "def __init__(self, normal_max_repeat=3, normal_sleep_time=3, critical_max_repeat=10, critical_sleep_time=10)" }, { "docstring": "fetch the content of a url, function can be rewrite, parameters and return refer to self.working()", ...
3
stack_v2_sparse_classes_30k_val_001041
Implement the Python class `Fetcher` described below. Class description: class of Fetcher, must include function url_fetch() Method signatures and docstrings: - def __init__(self, normal_max_repeat=3, normal_sleep_time=3, critical_max_repeat=10, critical_sleep_time=10): constructor - def url_fetch(self, url, keys, cr...
Implement the Python class `Fetcher` described below. Class description: class of Fetcher, must include function url_fetch() Method signatures and docstrings: - def __init__(self, normal_max_repeat=3, normal_sleep_time=3, critical_max_repeat=10, critical_sleep_time=10): constructor - def url_fetch(self, url, keys, cr...
dd8f9066c3546b582b65158ea02fb7be7934d388
<|skeleton|> class Fetcher: """class of Fetcher, must include function url_fetch()""" def __init__(self, normal_max_repeat=3, normal_sleep_time=3, critical_max_repeat=10, critical_sleep_time=10): """constructor""" <|body_0|> def url_fetch(self, url, keys, critical, fetch_repeat): "...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Fetcher: """class of Fetcher, must include function url_fetch()""" def __init__(self, normal_max_repeat=3, normal_sleep_time=3, critical_max_repeat=10, critical_sleep_time=10): """constructor""" self.normal_max_repeat = normal_max_repeat self.normal_sleep_time = normal_sleep_time ...
the_stack_v2_python_sparse
processor/pro_fetch.py
hsssgdtc/SHREPA
train
0
1c4e2fd34033973c51d13e82d5ea3f5609ce3716
[ "try:\n return EnvironmentInstance.objects.get(pk=pk)\nexcept EnvironmentInstance.DoesNotExist:\n raise Http404", "env_instance = self.get_object(pk)\nserializer = EnvironmentInstanceSerializer(env_instance)\nreturn Response(serializer.data)", "env_instance = self.get_object(pk)\nserializer = EnvironmentI...
<|body_start_0|> try: return EnvironmentInstance.objects.get(pk=pk) except EnvironmentInstance.DoesNotExist: raise Http404 <|end_body_0|> <|body_start_1|> env_instance = self.get_object(pk) serializer = EnvironmentInstanceSerializer(env_instance) return R...
Retrieve, update or delete a EnvironmentInstance instance.
EnvironmentInstanceDetails
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EnvironmentInstanceDetails: """Retrieve, update or delete a EnvironmentInstance instance.""" def get_object(self, pk): """Get the particular row from the table.""" <|body_0|> def get(self, request, pk, format=None): """We are going to add the contact info content...
stack_v2_sparse_classes_36k_train_015560
15,222
permissive
[ { "docstring": "Get the particular row from the table.", "name": "get_object", "signature": "def get_object(self, pk)" }, { "docstring": "We are going to add the contact info content along with this pull request", "name": "get", "signature": "def get(self, request, pk, format=None)" },...
4
stack_v2_sparse_classes_30k_train_012527
Implement the Python class `EnvironmentInstanceDetails` described below. Class description: Retrieve, update or delete a EnvironmentInstance instance. Method signatures and docstrings: - def get_object(self, pk): Get the particular row from the table. - def get(self, request, pk, format=None): We are going to add the...
Implement the Python class `EnvironmentInstanceDetails` described below. Class description: Retrieve, update or delete a EnvironmentInstance instance. Method signatures and docstrings: - def get_object(self, pk): Get the particular row from the table. - def get(self, request, pk, format=None): We are going to add the...
b0635e72338e14dad24f1ee0329212cd60a3e83a
<|skeleton|> class EnvironmentInstanceDetails: """Retrieve, update or delete a EnvironmentInstance instance.""" def get_object(self, pk): """Get the particular row from the table.""" <|body_0|> def get(self, request, pk, format=None): """We are going to add the contact info content...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EnvironmentInstanceDetails: """Retrieve, update or delete a EnvironmentInstance instance.""" def get_object(self, pk): """Get the particular row from the table.""" try: return EnvironmentInstance.objects.get(pk=pk) except EnvironmentInstance.DoesNotExist: r...
the_stack_v2_python_sparse
environment/views.py
faisaltheparttimecoder/carelogBackend
train
1
d5c23848ed1c82e5906b30d63a3fd6ffda4361b1
[ "self.vars = vars\nself.annot_body_code = annot_body_code\nself.indent = indent\nself.language = 'f'\npass", "s = ''\nraise NotImplementedError('%s: Fortran code generation not implemented yet for align module')\nreturn s" ]
<|body_start_0|> self.vars = vars self.annot_body_code = annot_body_code self.indent = indent self.language = 'f' pass <|end_body_0|> <|body_start_1|> s = '' raise NotImplementedError('%s: Fortran code generation not implemented yet for align module') ret...
The code generator for the Blue Gene's memory alignment optimizer
CodeGen_F
[ "MIT", "LicenseRef-scancode-warranty-disclaimer", "LicenseRef-scancode-other-permissive" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CodeGen_F: """The code generator for the Blue Gene's memory alignment optimizer""" def __init__(self, vars, annot_body_code, indent): """To instantiate a code generator instance""" <|body_0|> def generate(self): """To generate the memory-alignment checking code""...
stack_v2_sparse_classes_36k_train_015561
3,849
permissive
[ { "docstring": "To instantiate a code generator instance", "name": "__init__", "signature": "def __init__(self, vars, annot_body_code, indent)" }, { "docstring": "To generate the memory-alignment checking code", "name": "generate", "signature": "def generate(self)" } ]
2
null
Implement the Python class `CodeGen_F` described below. Class description: The code generator for the Blue Gene's memory alignment optimizer Method signatures and docstrings: - def __init__(self, vars, annot_body_code, indent): To instantiate a code generator instance - def generate(self): To generate the memory-alig...
Implement the Python class `CodeGen_F` described below. Class description: The code generator for the Blue Gene's memory alignment optimizer Method signatures and docstrings: - def __init__(self, vars, annot_body_code, indent): To instantiate a code generator instance - def generate(self): To generate the memory-alig...
934ba192301cb4e23d98b9f79e91799152bf76b1
<|skeleton|> class CodeGen_F: """The code generator for the Blue Gene's memory alignment optimizer""" def __init__(self, vars, annot_body_code, indent): """To instantiate a code generator instance""" <|body_0|> def generate(self): """To generate the memory-alignment checking code""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CodeGen_F: """The code generator for the Blue Gene's memory alignment optimizer""" def __init__(self, vars, annot_body_code, indent): """To instantiate a code generator instance""" self.vars = vars self.annot_body_code = annot_body_code self.indent = indent self.la...
the_stack_v2_python_sparse
orio/module/align/codegen.py
phrb/orio_experiments
train
1
97ba2c8dbb90199871ebead20570ddb79ccca4d5
[ "try:\n movie = db.get_movie_by_id(list_id=list_id, movie_id=movie_id, session=session)\nexcept NoResultFound:\n raise NotFoundError('could not find movie with id %d in list %d' % (movie_id, list_id))\nreturn jsonify(movie.to_dict())", "try:\n movie = db.get_movie_by_id(list_id=list_id, movie_id=movie_id...
<|body_start_0|> try: movie = db.get_movie_by_id(list_id=list_id, movie_id=movie_id, session=session) except NoResultFound: raise NotFoundError('could not find movie with id %d in list %d' % (movie_id, list_id)) return jsonify(movie.to_dict()) <|end_body_0|> <|body_start...
MovieListMovieAPI
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MovieListMovieAPI: def get(self, list_id, movie_id, session=None): """Get a movie by list ID and movie ID""" <|body_0|> def delete(self, list_id, movie_id, session=None): """Delete a movie by list ID and movie ID""" <|body_1|> def put(self, list_id, movi...
stack_v2_sparse_classes_36k_train_015562
12,846
permissive
[ { "docstring": "Get a movie by list ID and movie ID", "name": "get", "signature": "def get(self, list_id, movie_id, session=None)" }, { "docstring": "Delete a movie by list ID and movie ID", "name": "delete", "signature": "def delete(self, list_id, movie_id, session=None)" }, { "...
3
stack_v2_sparse_classes_30k_train_006606
Implement the Python class `MovieListMovieAPI` described below. Class description: Implement the MovieListMovieAPI class. Method signatures and docstrings: - def get(self, list_id, movie_id, session=None): Get a movie by list ID and movie ID - def delete(self, list_id, movie_id, session=None): Delete a movie by list ...
Implement the Python class `MovieListMovieAPI` described below. Class description: Implement the MovieListMovieAPI class. Method signatures and docstrings: - def get(self, list_id, movie_id, session=None): Get a movie by list ID and movie ID - def delete(self, list_id, movie_id, session=None): Delete a movie by list ...
ea95ff60041beaea9aacbc2d93549e3a6b981dc5
<|skeleton|> class MovieListMovieAPI: def get(self, list_id, movie_id, session=None): """Get a movie by list ID and movie ID""" <|body_0|> def delete(self, list_id, movie_id, session=None): """Delete a movie by list ID and movie ID""" <|body_1|> def put(self, list_id, movi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MovieListMovieAPI: def get(self, list_id, movie_id, session=None): """Get a movie by list ID and movie ID""" try: movie = db.get_movie_by_id(list_id=list_id, movie_id=movie_id, session=session) except NoResultFound: raise NotFoundError('could not find movie with...
the_stack_v2_python_sparse
flexget/components/managed_lists/lists/movie_list/api.py
BrutuZ/Flexget
train
1
cab1175a1f05b916f942b1f7256aeebfa52af0fa
[ "super(IPAMAddressPool, self).__init__()\nself.schema_class = 'ipam_address_pool_schema.IPAMAddressPoolSchema'\nself.set_connection(vsm.get_connection())\nself.set_create_endpoint('/services/ipam/pools/scope/globalroot-0')\nself.set_read_endpoint('/services/ipam/pools')\nself.set_delete_endpoint('/services/ipam/poo...
<|body_start_0|> super(IPAMAddressPool, self).__init__() self.schema_class = 'ipam_address_pool_schema.IPAMAddressPoolSchema' self.set_connection(vsm.get_connection()) self.set_create_endpoint('/services/ipam/pools/scope/globalroot-0') self.set_read_endpoint('/services/ipam/pools...
IPAMAddressPool
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IPAMAddressPool: def __init__(self, vsm): """Constructor to create IPAMAddressPool managed object @param vsm object on which IPAM address pool has to be configured""" <|body_0|> def delete(self, schema_object=None, url_parameters=None): """When delete ippool, the sch...
stack_v2_sparse_classes_36k_train_015563
2,254
no_license
[ { "docstring": "Constructor to create IPAMAddressPool managed object @param vsm object on which IPAM address pool has to be configured", "name": "__init__", "signature": "def __init__(self, vsm)" }, { "docstring": "When delete ippool, the scheam_obj should be set None.", "name": "delete", ...
2
stack_v2_sparse_classes_30k_train_009759
Implement the Python class `IPAMAddressPool` described below. Class description: Implement the IPAMAddressPool class. Method signatures and docstrings: - def __init__(self, vsm): Constructor to create IPAMAddressPool managed object @param vsm object on which IPAM address pool has to be configured - def delete(self, s...
Implement the Python class `IPAMAddressPool` described below. Class description: Implement the IPAMAddressPool class. Method signatures and docstrings: - def __init__(self, vsm): Constructor to create IPAMAddressPool managed object @param vsm object on which IPAM address pool has to be configured - def delete(self, s...
5b55817c050b637e2747084290f6206d2e622938
<|skeleton|> class IPAMAddressPool: def __init__(self, vsm): """Constructor to create IPAMAddressPool managed object @param vsm object on which IPAM address pool has to be configured""" <|body_0|> def delete(self, schema_object=None, url_parameters=None): """When delete ippool, the sch...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IPAMAddressPool: def __init__(self, vsm): """Constructor to create IPAMAddressPool managed object @param vsm object on which IPAM address pool has to be configured""" super(IPAMAddressPool, self).__init__() self.schema_class = 'ipam_address_pool_schema.IPAMAddressPoolSchema' se...
the_stack_v2_python_sparse
SystemTesting/pylib/nsx/vsm/ipam_address_pool/ipam_address_pool.py
Cloudxtreme/MyProject
train
0
82a2d959aa78216949865257d71413ef388f9888
[ "l_light_name = p_schedule_obj.Sched.Name\nl_type = p_schedule_obj.Sched.Type\nl_lighting_objs = p_pyhouse_obj.House.Lighting\nif l_type == 'Light':\n l_obj = l_lighting_objs.Lights\nelif l_type == 'Outlet':\n l_obj = l_lighting_objs.Outlets\nelse:\n LOG.error('Schedule type is invalid \"{}\"'.format(l_typ...
<|body_start_0|> l_light_name = p_schedule_obj.Sched.Name l_type = p_schedule_obj.Sched.Type l_lighting_objs = p_pyhouse_obj.House.Lighting if l_type == 'Light': l_obj = l_lighting_objs.Lights elif l_type == 'Outlet': l_obj = l_lighting_objs.Outlets ...
Api
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Api: def DoSchedule(self, p_pyhouse_obj, p_schedule_obj): """A schedule action has been called for on a Lighting device @param p_pyhouse_obj: The entire data set. @param p_schedule_obj: the schedule event being executed. ==> ScheduleInformation()""" <|body_0|> def ControlLig...
stack_v2_sparse_classes_36k_train_015564
3,481
permissive
[ { "docstring": "A schedule action has been called for on a Lighting device @param p_pyhouse_obj: The entire data set. @param p_schedule_obj: the schedule event being executed. ==> ScheduleInformation()", "name": "DoSchedule", "signature": "def DoSchedule(self, p_pyhouse_obj, p_schedule_obj)" }, { ...
2
null
Implement the Python class `Api` described below. Class description: Implement the Api class. Method signatures and docstrings: - def DoSchedule(self, p_pyhouse_obj, p_schedule_obj): A schedule action has been called for on a Lighting device @param p_pyhouse_obj: The entire data set. @param p_schedule_obj: the schedu...
Implement the Python class `Api` described below. Class description: Implement the Api class. Method signatures and docstrings: - def DoSchedule(self, p_pyhouse_obj, p_schedule_obj): A schedule action has been called for on a Lighting device @param p_pyhouse_obj: The entire data set. @param p_schedule_obj: the schedu...
a100fc67761a22ae47ed6f21f3c9464e2de5d54f
<|skeleton|> class Api: def DoSchedule(self, p_pyhouse_obj, p_schedule_obj): """A schedule action has been called for on a Lighting device @param p_pyhouse_obj: The entire data set. @param p_schedule_obj: the schedule event being executed. ==> ScheduleInformation()""" <|body_0|> def ControlLig...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Api: def DoSchedule(self, p_pyhouse_obj, p_schedule_obj): """A schedule action has been called for on a Lighting device @param p_pyhouse_obj: The entire data set. @param p_schedule_obj: the schedule event being executed. ==> ScheduleInformation()""" l_light_name = p_schedule_obj.Sched.Name ...
the_stack_v2_python_sparse
Project/src/Modules/House/Lighting/actions.py
DBrianKimmel/PyHouse
train
3
628b8ccc9697d4a9dd7657337a6070163d70b8b7
[ "Simulator.__init__(self, opt)\nself.type = type_\nself.fullscreen = opt['fullscreen'] if 'fullscreen' in opt else False", "if self.type in self.ALIASES:\n self.args = [self.simulator_path + self.ALIASES[self.type]]\n eval('self.start_' + self.ALIASES[self.type] + '()')\nelse:\n self.create_pop()\nSimula...
<|body_start_0|> Simulator.__init__(self, opt) self.type = type_ self.fullscreen = opt['fullscreen'] if 'fullscreen' in opt else False <|end_body_0|> <|body_start_1|> if self.type in self.ALIASES: self.args = [self.simulator_path + self.ALIASES[self.type]] eval('...
Blender Class provides functions to call different blender simulations Usage: # Instantiate Blender Class blender = Blender(opt, type_="BLENDER") # Start blender simulation blender.launch_simulation()
Blender
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Blender: """Blender Class provides functions to call different blender simulations Usage: # Instantiate Blender Class blender = Blender(opt, type_="BLENDER") # Start blender simulation blender.launch_simulation()""" def __init__(self, opt, type_='BLENDERPLAYER'): """Class initializat...
stack_v2_sparse_classes_36k_train_015565
3,402
no_license
[ { "docstring": "Class initialization :param opt: Dictionary containing simulation parameters :param type_: String type of simulation", "name": "__init__", "signature": "def __init__(self, opt, type_='BLENDERPLAYER')" }, { "docstring": "Launch a Blender simulation depending on the type variable. ...
5
stack_v2_sparse_classes_30k_train_019884
Implement the Python class `Blender` described below. Class description: Blender Class provides functions to call different blender simulations Usage: # Instantiate Blender Class blender = Blender(opt, type_="BLENDER") # Start blender simulation blender.launch_simulation() Method signatures and docstrings: - def __in...
Implement the Python class `Blender` described below. Class description: Blender Class provides functions to call different blender simulations Usage: # Instantiate Blender Class blender = Blender(opt, type_="BLENDER") # Start blender simulation blender.launch_simulation() Method signatures and docstrings: - def __in...
f4f212a7533a63d1148068bacf1cc13d3f64db49
<|skeleton|> class Blender: """Blender Class provides functions to call different blender simulations Usage: # Instantiate Blender Class blender = Blender(opt, type_="BLENDER") # Start blender simulation blender.launch_simulation()""" def __init__(self, opt, type_='BLENDERPLAYER'): """Class initializat...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Blender: """Blender Class provides functions to call different blender simulations Usage: # Instantiate Blender Class blender = Blender(opt, type_="BLENDER") # Start blender simulation blender.launch_simulation()""" def __init__(self, opt, type_='BLENDERPLAYER'): """Class initialization :param op...
the_stack_v2_python_sparse
src/simulators/blender/blender.py
mahedjaved/mouse_locomotion
train
0
0534426acceece05f0de504ea1c6d65813e12171
[ "super(CNN_ARC_II, self).__init__()\nself.dictionary = dictionary\nself.embedding_index = embedding_index\nself.config = args\nself.embedding = EmbeddingLayer(len(self.dictionary), self.config)\nself.conv1 = nn.Conv2d(self.config.emsize * 2, self.config.nfilters, (3, 3))\nself.pool1 = nn.MaxPool2d((2, 2))\nself.con...
<|body_start_0|> super(CNN_ARC_II, self).__init__() self.dictionary = dictionary self.embedding_index = embedding_index self.config = args self.embedding = EmbeddingLayer(len(self.dictionary), self.config) self.conv1 = nn.Conv2d(self.config.emsize * 2, self.config.nfilter...
Implementation of the convolutional matching model (ARC-II).
CNN_ARC_II
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CNN_ARC_II: """Implementation of the convolutional matching model (ARC-II).""" def __init__(self, dictionary, embedding_index, args): """"Constructor of the class.""" <|body_0|> def forward(self, batch_queries, batch_docs): """Forward function of the match tensor...
stack_v2_sparse_classes_36k_train_015566
3,176
permissive
[ { "docstring": "\"Constructor of the class.", "name": "__init__", "signature": "def __init__(self, dictionary, embedding_index, args)" }, { "docstring": "Forward function of the match tensor model. Return average loss for a batch of sessions. :param batch_queries: 2d tensor [batch_size x max_que...
2
stack_v2_sparse_classes_30k_train_021679
Implement the Python class `CNN_ARC_II` described below. Class description: Implementation of the convolutional matching model (ARC-II). Method signatures and docstrings: - def __init__(self, dictionary, embedding_index, args): "Constructor of the class. - def forward(self, batch_queries, batch_docs): Forward functio...
Implement the Python class `CNN_ARC_II` described below. Class description: Implementation of the convolutional matching model (ARC-II). Method signatures and docstrings: - def __init__(self, dictionary, embedding_index, args): "Constructor of the class. - def forward(self, batch_queries, batch_docs): Forward functio...
5bd241fb49f08fa4937539991e12e5a502d5a072
<|skeleton|> class CNN_ARC_II: """Implementation of the convolutional matching model (ARC-II).""" def __init__(self, dictionary, embedding_index, args): """"Constructor of the class.""" <|body_0|> def forward(self, batch_queries, batch_docs): """Forward function of the match tensor...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CNN_ARC_II: """Implementation of the convolutional matching model (ARC-II).""" def __init__(self, dictionary, embedding_index, args): """"Constructor of the class.""" super(CNN_ARC_II, self).__init__() self.dictionary = dictionary self.embedding_index = embedding_index ...
the_stack_v2_python_sparse
ranking_baselines/ARCII/model.py
polaris79/mnsrf_ranking_suggestion
train
0
683859b8ebbb5d83222e3e406b7333fa266a277e
[ "t1 = [0.6, 0.1, 0.6]\nt2 = np.array([0.1, 0.2, 0.3])\nt3 = onp.array([5.0, 8.0, 101.0])\nres = fn.stack([t1, t2, t3])\nassert isinstance(res, np.ndarray)\nassert np.all(res == np.stack([t1, t2, t3]))", "t1 = onp.array([0.6, 0.1, 0.6])\nt2 = jnp.array([0.1, 0.2, 0.3])\nt3 = jnp.array([5.0, 8.0, 101.0])\nres = fn....
<|body_start_0|> t1 = [0.6, 0.1, 0.6] t2 = np.array([0.1, 0.2, 0.3]) t3 = onp.array([5.0, 8.0, 101.0]) res = fn.stack([t1, t2, t3]) assert isinstance(res, np.ndarray) assert np.all(res == np.stack([t1, t2, t3])) <|end_body_0|> <|body_start_1|> t1 = onp.array([0.6...
Tests for the stack function
TestStack
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestStack: """Tests for the stack function""" def test_stack_array(self): """Test that stack, called without the axis arguments, stacks vertically""" <|body_0|> def test_stack_array_jax(self): """Test that stack, called without the axis arguments, stacks vertical...
stack_v2_sparse_classes_36k_train_015567
47,600
permissive
[ { "docstring": "Test that stack, called without the axis arguments, stacks vertically", "name": "test_stack_array", "signature": "def test_stack_array(self)" }, { "docstring": "Test that stack, called without the axis arguments, stacks vertically", "name": "test_stack_array_jax", "signat...
5
null
Implement the Python class `TestStack` described below. Class description: Tests for the stack function Method signatures and docstrings: - def test_stack_array(self): Test that stack, called without the axis arguments, stacks vertically - def test_stack_array_jax(self): Test that stack, called without the axis argum...
Implement the Python class `TestStack` described below. Class description: Tests for the stack function Method signatures and docstrings: - def test_stack_array(self): Test that stack, called without the axis arguments, stacks vertically - def test_stack_array_jax(self): Test that stack, called without the axis argum...
0c1c805fd5dfce465a8955ee3faf81037023a23e
<|skeleton|> class TestStack: """Tests for the stack function""" def test_stack_array(self): """Test that stack, called without the axis arguments, stacks vertically""" <|body_0|> def test_stack_array_jax(self): """Test that stack, called without the axis arguments, stacks vertical...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestStack: """Tests for the stack function""" def test_stack_array(self): """Test that stack, called without the axis arguments, stacks vertically""" t1 = [0.6, 0.1, 0.6] t2 = np.array([0.1, 0.2, 0.3]) t3 = onp.array([5.0, 8.0, 101.0]) res = fn.stack([t1, t2, t3]) ...
the_stack_v2_python_sparse
artifacts/old_dataset_versions/original_commits_backup/pennylane/pennylane#1081/before/test_functions.py
MattePalte/Bugs-Quantum-Computing-Platforms
train
4
74c4f261916842c22dbd1d0c29017adafdd4aeee
[ "self.forecaster = forecaster\nself.observed_rain = observed_rain\nself.time_array = None\nself.loss_all_array = None\nself.loss_segment_array = None", "self.time_array = []\nself.loss_all_array = []\nself.loss_segment_array = []\nfor Loss in LOSS_CLASSES:\n self.loss_all_array.append(Loss(self.forecaster.n_si...
<|body_start_0|> self.forecaster = forecaster self.observed_rain = observed_rain self.time_array = None self.loss_all_array = None self.loss_segment_array = None <|end_body_0|> <|body_start_1|> self.time_array = [] self.loss_all_array = [] self.loss_segme...
Attributes: forecaster: forecast.time_series.Forecaster object observed_rain: numpy array of observed rain time_array: array of dates for each segmentation loss_all_array: array of loss objects when combining the segmentations, each element for each Loss in LOSS_CLASSES loss_segment_array: array of arrays of Loss objec...
TimeSeries
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TimeSeries: """Attributes: forecaster: forecast.time_series.Forecaster object observed_rain: numpy array of observed rain time_array: array of dates for each segmentation loss_all_array: array of loss objects when combining the segmentations, each element for each Loss in LOSS_CLASSES loss_segmen...
stack_v2_sparse_classes_36k_train_015568
7,771
permissive
[ { "docstring": "Args: forecaster: forecast.time_series.Forecaster object observed_rain: numpy array of observed rain", "name": "__init__", "signature": "def __init__(self, forecaster, observed_rain)" }, { "docstring": "Evaluate the loss for a given time_segmentator and update the member variable...
6
stack_v2_sparse_classes_30k_train_003095
Implement the Python class `TimeSeries` described below. Class description: Attributes: forecaster: forecast.time_series.Forecaster object observed_rain: numpy array of observed rain time_array: array of dates for each segmentation loss_all_array: array of loss objects when combining the segmentations, each element fo...
Implement the Python class `TimeSeries` described below. Class description: Attributes: forecaster: forecast.time_series.Forecaster object observed_rain: numpy array of observed rain time_array: array of dates for each segmentation loss_all_array: array of loss objects when combining the segmentations, each element fo...
2a847ac15f7ea4925896c2a7baec78e8717e63f4
<|skeleton|> class TimeSeries: """Attributes: forecaster: forecast.time_series.Forecaster object observed_rain: numpy array of observed rain time_array: array of dates for each segmentation loss_all_array: array of loss objects when combining the segmentations, each element for each Loss in LOSS_CLASSES loss_segmen...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TimeSeries: """Attributes: forecaster: forecast.time_series.Forecaster object observed_rain: numpy array of observed rain time_array: array of dates for each segmentation loss_all_array: array of loss objects when combining the segmentations, each element for each Loss in LOSS_CLASSES loss_segment_array: arra...
the_stack_v2_python_sparse
compound_poisson/forecast/loss_segmentation.py
shermanlo77/cptimeseries
train
3
6dbe092dd86d1549195b81ea7e7e24d4b8ac13d4
[ "for attribute in self.__dict__:\n if attribute.lower() in py_dict:\n if type(getattr(self, attribute)) in [str, int, bool, type(None)]:\n value = py_dict[attribute.lower()]\n setattr(self, attribute, value)\n elif type(getattr(self, attribute)) in [list]:\n new_ite...
<|body_start_0|> for attribute in self.__dict__: if attribute.lower() in py_dict: if type(getattr(self, attribute)) in [str, int, bool, type(None)]: value = py_dict[attribute.lower()] setattr(self, attribute, value) elif type(ge...
BaseSchema
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseSchema: def get_object_from_py_dict(self, py_dict): """Method to fill the current schema object with values from a py_dict @param py_dict dict object to get values from @return: a schema object that fill in by py_dict""" <|body_0|> def get_py_dict_from_object(self): ...
stack_v2_sparse_classes_36k_train_015569
3,098
no_license
[ { "docstring": "Method to fill the current schema object with values from a py_dict @param py_dict dict object to get values from @return: a schema object that fill in by py_dict", "name": "get_object_from_py_dict", "signature": "def get_object_from_py_dict(self, py_dict)" }, { "docstring": "Ret...
2
null
Implement the Python class `BaseSchema` described below. Class description: Implement the BaseSchema class. Method signatures and docstrings: - def get_object_from_py_dict(self, py_dict): Method to fill the current schema object with values from a py_dict @param py_dict dict object to get values from @return: a schem...
Implement the Python class `BaseSchema` described below. Class description: Implement the BaseSchema class. Method signatures and docstrings: - def get_object_from_py_dict(self, py_dict): Method to fill the current schema object with values from a py_dict @param py_dict dict object to get values from @return: a schem...
5b55817c050b637e2747084290f6206d2e622938
<|skeleton|> class BaseSchema: def get_object_from_py_dict(self, py_dict): """Method to fill the current schema object with values from a py_dict @param py_dict dict object to get values from @return: a schema object that fill in by py_dict""" <|body_0|> def get_py_dict_from_object(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BaseSchema: def get_object_from_py_dict(self, py_dict): """Method to fill the current schema object with values from a py_dict @param py_dict dict object to get values from @return: a schema object that fill in by py_dict""" for attribute in self.__dict__: if attribute.lower() in p...
the_stack_v2_python_sparse
SystemTesting/pylib/vmware/common/base_schema.py
Cloudxtreme/MyProject
train
0
781d0537e28db3f44b970542d59d45053ead096a
[ "recorder = ChartDataRecorder('benchmark')\nresult = recorder.get_chart_data()\nself.assertEquals({'format_version': '1.0', 'benchmark_name': 'benchmark', 'charts': {}}, result)", "recorder = ChartDataRecorder('benchmark')\nrecorder.record_scalar('chart', 'val1', 'ms', 1)\nrecorder.record_scalar('chart', 'val2', ...
<|body_start_0|> recorder = ChartDataRecorder('benchmark') result = recorder.get_chart_data() self.assertEquals({'format_version': '1.0', 'benchmark_name': 'benchmark', 'charts': {}}, result) <|end_body_0|> <|body_start_1|> recorder = ChartDataRecorder('benchmark') recorder.reco...
Tests the chart data recorder.
ChartDataRecorderTest
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ChartDataRecorderTest: """Tests the chart data recorder.""" def test_empty(self): """Tests chart data with no charts.""" <|body_0|> def test_one_chart(self): """Tests chart data with two samples in one chart.""" <|body_1|> def test_two_charts(self): ...
stack_v2_sparse_classes_36k_train_015570
3,252
permissive
[ { "docstring": "Tests chart data with no charts.", "name": "test_empty", "signature": "def test_empty(self)" }, { "docstring": "Tests chart data with two samples in one chart.", "name": "test_one_chart", "signature": "def test_one_chart(self)" }, { "docstring": "Tests chart data ...
4
stack_v2_sparse_classes_30k_train_002946
Implement the Python class `ChartDataRecorderTest` described below. Class description: Tests the chart data recorder. Method signatures and docstrings: - def test_empty(self): Tests chart data with no charts. - def test_one_chart(self): Tests chart data with two samples in one chart. - def test_two_charts(self): Test...
Implement the Python class `ChartDataRecorderTest` described below. Class description: Tests the chart data recorder. Method signatures and docstrings: - def test_empty(self): Tests chart data with no charts. - def test_one_chart(self): Tests chart data with two samples in one chart. - def test_two_charts(self): Test...
89a278ec589d98bcbc7e57e0b80d055667cca62f
<|skeleton|> class ChartDataRecorderTest: """Tests the chart data recorder.""" def test_empty(self): """Tests chart data with no charts.""" <|body_0|> def test_one_chart(self): """Tests chart data with two samples in one chart.""" <|body_1|> def test_two_charts(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ChartDataRecorderTest: """Tests the chart data recorder.""" def test_empty(self): """Tests chart data with no charts.""" recorder = ChartDataRecorder('benchmark') result = recorder.get_chart_data() self.assertEquals({'format_version': '1.0', 'benchmark_name': 'benchmark', ...
the_stack_v2_python_sparse
src/mojo/devtools/common/devtoolslib/perf_dashboard_unittest.py
amplab/ray-core
train
4
833d81a482d47135e45ff8e2016166896f6f5383
[ "if not s:\n return ''\nn, left, length = (len(s), 0, 1)\ndp = [[False] * n for _ in range(n)]\nfor i in range(n):\n dp[i][i] = True\nfor i in range(n - 1, 0, -1):\n if s[i] == s[i - 1]:\n dp[i - 1][i] = True\n length = 2\n left = i - 1\nfor k in range(3, n + 1):\n for i in range(0,...
<|body_start_0|> if not s: return '' n, left, length = (len(s), 0, 1) dp = [[False] * n for _ in range(n)] for i in range(n): dp[i][i] = True for i in range(n - 1, 0, -1): if s[i] == s[i - 1]: dp[i - 1][i] = True ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestPalindrome(self, s): """:type s: str :rtype: str""" <|body_0|> def longestPalindrome2(self, s): """:type s: str :rtype: str""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not s: return '' n, left, length ...
stack_v2_sparse_classes_36k_train_015571
1,533
no_license
[ { "docstring": ":type s: str :rtype: str", "name": "longestPalindrome", "signature": "def longestPalindrome(self, s)" }, { "docstring": ":type s: str :rtype: str", "name": "longestPalindrome2", "signature": "def longestPalindrome2(self, s)" } ]
2
stack_v2_sparse_classes_30k_train_013805
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestPalindrome(self, s): :type s: str :rtype: str - def longestPalindrome2(self, s): :type s: str :rtype: str
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestPalindrome(self, s): :type s: str :rtype: str - def longestPalindrome2(self, s): :type s: str :rtype: str <|skeleton|> class Solution: def longestPalindrome(self...
75aef2f6c42aeb51261b9450a24099957a084d51
<|skeleton|> class Solution: def longestPalindrome(self, s): """:type s: str :rtype: str""" <|body_0|> def longestPalindrome2(self, s): """:type s: str :rtype: str""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def longestPalindrome(self, s): """:type s: str :rtype: str""" if not s: return '' n, left, length = (len(s), 0, 1) dp = [[False] * n for _ in range(n)] for i in range(n): dp[i][i] = True for i in range(n - 1, 0, -1): ...
the_stack_v2_python_sparse
Python/0005_LongestPalindromicSubstring/longestPalindrome.py
mtmmy/Leetcode
train
3
179f017d5a75a6d62fc213e151213d21b84a85c9
[ "multiprocessing.Process.__init__(self)\nself.task_queue = task_queue\nself.result_queue = result_queue", "while True:\n next_task = self.task_queue.get()\n if next_task is None:\n self.task_queue.task_done()\n break\n answer = next_task()\n self.task_queue.task_done()\n self.result_q...
<|body_start_0|> multiprocessing.Process.__init__(self) self.task_queue = task_queue self.result_queue = result_queue <|end_body_0|> <|body_start_1|> while True: next_task = self.task_queue.get() if next_task is None: self.task_queue.task_done() ...
Consumer for performin a specific task.
Consumer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Consumer: """Consumer for performin a specific task.""" def __init__(self, task_queue, result_queue): """Initialize consumer, it has a task and result queues.""" <|body_0|> def run(self): """Actual run of the consumer.""" <|body_1|> <|end_skeleton|> <|b...
stack_v2_sparse_classes_36k_train_015572
4,983
no_license
[ { "docstring": "Initialize consumer, it has a task and result queues.", "name": "__init__", "signature": "def __init__(self, task_queue, result_queue)" }, { "docstring": "Actual run of the consumer.", "name": "run", "signature": "def run(self)" } ]
2
stack_v2_sparse_classes_30k_train_013579
Implement the Python class `Consumer` described below. Class description: Consumer for performin a specific task. Method signatures and docstrings: - def __init__(self, task_queue, result_queue): Initialize consumer, it has a task and result queues. - def run(self): Actual run of the consumer.
Implement the Python class `Consumer` described below. Class description: Consumer for performin a specific task. Method signatures and docstrings: - def __init__(self, task_queue, result_queue): Initialize consumer, it has a task and result queues. - def run(self): Actual run of the consumer. <|skeleton|> class Con...
a3c86b10755a18367c32bb98e7907cbc07aaaf27
<|skeleton|> class Consumer: """Consumer for performin a specific task.""" def __init__(self, task_queue, result_queue): """Initialize consumer, it has a task and result queues.""" <|body_0|> def run(self): """Actual run of the consumer.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Consumer: """Consumer for performin a specific task.""" def __init__(self, task_queue, result_queue): """Initialize consumer, it has a task and result queues.""" multiprocessing.Process.__init__(self) self.task_queue = task_queue self.result_queue = result_queue def r...
the_stack_v2_python_sparse
solution/lib/kaggle.py
Dammi87/tgs_keras
train
0
09f1e142e13f6e5dc4c5c74c89d715695adbe134
[ "self.queue_to_watch = queue_to_watch\nself.running = True\nTealThread.__init__(self)\nreturn", "try:\n try:\n msg = None\n while self.running:\n msg = self.queue_to_watch.get()\n self.queue_to_watch.notify_listeners(msg)\n if isinstance(msg, ControlMsg) and msg.m...
<|body_start_0|> self.queue_to_watch = queue_to_watch self.running = True TealThread.__init__(self) return <|end_body_0|> <|body_start_1|> try: try: msg = None while self.running: msg = self.queue_to_watch.get() ...
Class to watch the queue and call back when an item is added
ListenableQueueWatcher
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ListenableQueueWatcher: """Class to watch the queue and call back when an item is added""" def __init__(self, queue_to_watch): """Constructor""" <|body_0|> def run(self): """Wait for something to come into queue and then call the queue to notify the listeners""" ...
stack_v2_sparse_classes_36k_train_015573
8,765
no_license
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, queue_to_watch)" }, { "docstring": "Wait for something to come into queue and then call the queue to notify the listeners", "name": "run", "signature": "def run(self)" }, { "docstring": "Prepare to...
3
stack_v2_sparse_classes_30k_train_001535
Implement the Python class `ListenableQueueWatcher` described below. Class description: Class to watch the queue and call back when an item is added Method signatures and docstrings: - def __init__(self, queue_to_watch): Constructor - def run(self): Wait for something to come into queue and then call the queue to not...
Implement the Python class `ListenableQueueWatcher` described below. Class description: Class to watch the queue and call back when an item is added Method signatures and docstrings: - def __init__(self, queue_to_watch): Constructor - def run(self): Wait for something to come into queue and then call the queue to not...
eba6c1489b503fdcf040a126942643b355867bcd
<|skeleton|> class ListenableQueueWatcher: """Class to watch the queue and call back when an item is added""" def __init__(self, queue_to_watch): """Constructor""" <|body_0|> def run(self): """Wait for something to come into queue and then call the queue to notify the listeners""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ListenableQueueWatcher: """Class to watch the queue and call back when an item is added""" def __init__(self, queue_to_watch): """Constructor""" self.queue_to_watch = queue_to_watch self.running = True TealThread.__init__(self) return def run(self): ""...
the_stack_v2_python_sparse
src/ibm/teal/util/listenable_queue.py
ppjsand/pyteal
train
1
dfd297a27102517121096cd92e507ee07dea1a04
[ "self.dict = {}\nself.labels = {}\nself.labels_reverse = {}\nself.load_dict_label(dict_file, label_file)\nlen_dict = len(self.dict)\nlen_label = len(self.labels)\nconf = parse_config(train_conf, 'dict_len=' + str(len_dict) + ',label_len=' + str(len_label) + ',is_predict=True')\nself.network = swig_paddle.GradientMa...
<|body_start_0|> self.dict = {} self.labels = {} self.labels_reverse = {} self.load_dict_label(dict_file, label_file) len_dict = len(self.dict) len_label = len(self.labels) conf = parse_config(train_conf, 'dict_len=' + str(len_dict) + ',label_len=' + str(len_label...
Prediction
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Prediction: def __init__(self, train_conf, dict_file, model_dir, label_file): """train_conf: trainer configure. dict_file: word dictionary file name. model_dir: directory of model.""" <|body_0|> def load_dict_label(self, dict_file, label_file): """Load dictionary fro...
stack_v2_sparse_classes_36k_train_015574
5,398
permissive
[ { "docstring": "train_conf: trainer configure. dict_file: word dictionary file name. model_dir: directory of model.", "name": "__init__", "signature": "def __init__(self, train_conf, dict_file, model_dir, label_file)" }, { "docstring": "Load dictionary from self.dict_file.", "name": "load_di...
4
null
Implement the Python class `Prediction` described below. Class description: Implement the Prediction class. Method signatures and docstrings: - def __init__(self, train_conf, dict_file, model_dir, label_file): train_conf: trainer configure. dict_file: word dictionary file name. model_dir: directory of model. - def lo...
Implement the Python class `Prediction` described below. Class description: Implement the Prediction class. Method signatures and docstrings: - def __init__(self, train_conf, dict_file, model_dir, label_file): train_conf: trainer configure. dict_file: word dictionary file name. model_dir: directory of model. - def lo...
5eccdd8631f8bad78eb88bb89144972dbabc109c
<|skeleton|> class Prediction: def __init__(self, train_conf, dict_file, model_dir, label_file): """train_conf: trainer configure. dict_file: word dictionary file name. model_dir: directory of model.""" <|body_0|> def load_dict_label(self, dict_file, label_file): """Load dictionary fro...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Prediction: def __init__(self, train_conf, dict_file, model_dir, label_file): """train_conf: trainer configure. dict_file: word dictionary file name. model_dir: directory of model.""" self.dict = {} self.labels = {} self.labels_reverse = {} self.load_dict_label(dict_fil...
the_stack_v2_python_sparse
baidu/Paddle/demo/semantic_role_labeling/predict.py
xenron/sandbox-github-clone
train
5
dccd75b57feb9a6082ade486a431ef4eed47e3e2
[ "with test_app.test_request_context('/_ah/mail/other@example.com'):\n actual = sendemail.handle_incoming_mail('other@example.com')\nself.assertEqual({'message': 'Wrong address'}, actual)", "data = b'x' * sendemail.MAX_BODY_SIZE + b' is too big'\nwith test_app.test_request_context('/_ah/mail/%s' % settings.INBO...
<|body_start_0|> with test_app.test_request_context('/_ah/mail/other@example.com'): actual = sendemail.handle_incoming_mail('other@example.com') self.assertEqual({'message': 'Wrong address'}, actual) <|end_body_0|> <|body_start_1|> data = b'x' * sendemail.MAX_BODY_SIZE + b' is too b...
InboundEmailHandlerTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InboundEmailHandlerTest: def test_handle_incoming_mail__wrong_to_addr(self): """Reject the email if the app was not on the To: line.""" <|body_0|> def test_handle_incoming_mail__too_big(self): """Reject the incoming email if it is huge.""" <|body_1|> def...
stack_v2_sparse_classes_36k_train_015575
12,362
permissive
[ { "docstring": "Reject the email if the app was not on the To: line.", "name": "test_handle_incoming_mail__wrong_to_addr", "signature": "def test_handle_incoming_mail__wrong_to_addr(self)" }, { "docstring": "Reject the incoming email if it is huge.", "name": "test_handle_incoming_mail__too_b...
6
null
Implement the Python class `InboundEmailHandlerTest` described below. Class description: Implement the InboundEmailHandlerTest class. Method signatures and docstrings: - def test_handle_incoming_mail__wrong_to_addr(self): Reject the email if the app was not on the To: line. - def test_handle_incoming_mail__too_big(se...
Implement the Python class `InboundEmailHandlerTest` described below. Class description: Implement the InboundEmailHandlerTest class. Method signatures and docstrings: - def test_handle_incoming_mail__wrong_to_addr(self): Reject the email if the app was not on the To: line. - def test_handle_incoming_mail__too_big(se...
17f9886d064da5bda84006d5866077727646fff2
<|skeleton|> class InboundEmailHandlerTest: def test_handle_incoming_mail__wrong_to_addr(self): """Reject the email if the app was not on the To: line.""" <|body_0|> def test_handle_incoming_mail__too_big(self): """Reject the incoming email if it is huge.""" <|body_1|> def...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InboundEmailHandlerTest: def test_handle_incoming_mail__wrong_to_addr(self): """Reject the email if the app was not on the To: line.""" with test_app.test_request_context('/_ah/mail/other@example.com'): actual = sendemail.handle_incoming_mail('other@example.com') self.asser...
the_stack_v2_python_sparse
framework/sendemail_test.py
GoogleChrome/chromium-dashboard
train
574
638f555a601eee3b590f8aca01350c63e376805b
[ "self._num_masks = num_masks\nself._mask_height = mask_height\nself._mask_width = mask_width\nself._num_conv_layers = num_conv_layers\nself._depths = depths\nself._conv_hyperparams_fn = conv_hyperparams_fn", "with slim.arg_scope(self._conv_hyperparams_fn()):\n upsampled_features = tf.image.resize_bilinear(feat...
<|body_start_0|> self._num_masks = num_masks self._mask_height = mask_height self._mask_width = mask_width self._num_conv_layers = num_conv_layers self._depths = depths self._conv_hyperparams_fn = conv_hyperparams_fn <|end_body_0|> <|body_start_1|> with slim.arg_...
RCNN Mask Predictor. Generates mask predictions for the mask branch in a Mask RCNN network. It takes as input a feature map of shape [batch_num_proposals, height, width, channels], where the slice [i, :, :, :] holds the features of the ith proposal from the RPN, and outputs mask predictions tensor of shape [batch_num_p...
RcnnMaskPredictor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RcnnMaskPredictor: """RCNN Mask Predictor. Generates mask predictions for the mask branch in a Mask RCNN network. It takes as input a feature map of shape [batch_num_proposals, height, width, channels], where the slice [i, :, :, :] holds the features of the ith proposal from the RPN, and outputs ...
stack_v2_sparse_classes_36k_train_015576
4,726
no_license
[ { "docstring": "Constructor. Args: conv_hyperparams_fn: a callable that, when called, creates a dict holding arguments to `slim.arg_scope`. num_masks: int scalar, num of masks to be predicted per feature map. Typically set to `num_classes` or 1. mask_height: int scalar, mask height. mask_width: int scalar, mask...
2
stack_v2_sparse_classes_30k_train_005246
Implement the Python class `RcnnMaskPredictor` described below. Class description: RCNN Mask Predictor. Generates mask predictions for the mask branch in a Mask RCNN network. It takes as input a feature map of shape [batch_num_proposals, height, width, channels], where the slice [i, :, :, :] holds the features of the ...
Implement the Python class `RcnnMaskPredictor` described below. Class description: RCNN Mask Predictor. Generates mask predictions for the mask branch in a Mask RCNN network. It takes as input a feature map of shape [batch_num_proposals, height, width, channels], where the slice [i, :, :, :] holds the features of the ...
5a53e02c690632bcf140d1b17327959609aab395
<|skeleton|> class RcnnMaskPredictor: """RCNN Mask Predictor. Generates mask predictions for the mask branch in a Mask RCNN network. It takes as input a feature map of shape [batch_num_proposals, height, width, channels], where the slice [i, :, :, :] holds the features of the ith proposal from the RPN, and outputs ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RcnnMaskPredictor: """RCNN Mask Predictor. Generates mask predictions for the mask branch in a Mask RCNN network. It takes as input a feature map of shape [batch_num_proposals, height, width, channels], where the slice [i, :, :, :] holds the features of the ith proposal from the RPN, and outputs mask predicti...
the_stack_v2_python_sparse
core/mask_predictors.py
chao-ji/tf-detection
train
2
0b82686225fbfbf8c0dbbc5df0a483ef01332cc4
[ "self.url = url\nself.overwrite = overwrite\nif dst is None:\n self.destination = os.path.basename(self.url)\nelse:\n self.destination = dst", "if not os.path.exists(self.destination) or self.overwrite:\n try:\n remote_file = urllib2.urlopen(self.url, timeout=timeout)\n with open(self.desti...
<|body_start_0|> self.url = url self.overwrite = overwrite if dst is None: self.destination = os.path.basename(self.url) else: self.destination = dst <|end_body_0|> <|body_start_1|> if not os.path.exists(self.destination) or self.overwrite: tr...
Simple wrapper to urllib2 to retrieve a remote file. Defaults to not overwriting destination file if found.
FetchFile
[ "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FetchFile: """Simple wrapper to urllib2 to retrieve a remote file. Defaults to not overwriting destination file if found.""" def __init__(self, url, overwrite=False, dst=None): """Fetches the remote file url, writing to dst (defaults to the basename of the url file, e.g. index.html)....
stack_v2_sparse_classes_36k_train_015577
1,630
no_license
[ { "docstring": "Fetches the remote file url, writing to dst (defaults to the basename of the url file, e.g. index.html). If overwrite is False (default), if the local file exists it won't be overwritten.", "name": "__init__", "signature": "def __init__(self, url, overwrite=False, dst=None)" }, { ...
2
stack_v2_sparse_classes_30k_train_007771
Implement the Python class `FetchFile` described below. Class description: Simple wrapper to urllib2 to retrieve a remote file. Defaults to not overwriting destination file if found. Method signatures and docstrings: - def __init__(self, url, overwrite=False, dst=None): Fetches the remote file url, writing to dst (de...
Implement the Python class `FetchFile` described below. Class description: Simple wrapper to urllib2 to retrieve a remote file. Defaults to not overwriting destination file if found. Method signatures and docstrings: - def __init__(self, url, overwrite=False, dst=None): Fetches the remote file url, writing to dst (de...
98a0333aa024e69c403fd8f8326935ed75f378b0
<|skeleton|> class FetchFile: """Simple wrapper to urllib2 to retrieve a remote file. Defaults to not overwriting destination file if found.""" def __init__(self, url, overwrite=False, dst=None): """Fetches the remote file url, writing to dst (defaults to the basename of the url file, e.g. index.html)....
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FetchFile: """Simple wrapper to urllib2 to retrieve a remote file. Defaults to not overwriting destination file if found.""" def __init__(self, url, overwrite=False, dst=None): """Fetches the remote file url, writing to dst (defaults to the basename of the url file, e.g. index.html). If overwrite...
the_stack_v2_python_sparse
platform/FetchFile.py
ccoughlin/SkinDepth
train
0
7b17739a8ef79c19e0e2e4e0a5f8b5ee02f5b313
[ "mes = {'message': 'success'}\ndoc = dict(creator=user_id, last_user=user_id, app_name=app_name, desc=desc)\ntry:\n sql = cls.insert(**doc)\n app_id = sql.execute()\nexcept IntegrityError as e:\n logger.exception(e)\n print(e)\n s = e.args[1]\n if 'Duplicate entry' in s and 'app_name' in s:\n ...
<|body_start_0|> mes = {'message': 'success'} doc = dict(creator=user_id, last_user=user_id, app_name=app_name, desc=desc) try: sql = cls.insert(**doc) app_id = sql.execute() except IntegrityError as e: logger.exception(e) print(e) ...
app模块信息
AppTemplate
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AppTemplate: """app模块信息""" def add_app(cls, user_id: int, app_name: str, desc: str='') -> dict: """添加模块 :param user_id: :param app_name: :param desc: :return:""" <|body_0|> def update_app(cls, user_id: int, app_id: int, app_name: str, status: int, desc: str='') -> dict: ...
stack_v2_sparse_classes_36k_train_015578
25,579
no_license
[ { "docstring": "添加模块 :param user_id: :param app_name: :param desc: :return:", "name": "add_app", "signature": "def add_app(cls, user_id: int, app_name: str, desc: str='') -> dict" }, { "docstring": "修改模块 :param user_id: :param app_id: :param app_name: :param status: :param desc: :return:", "...
3
stack_v2_sparse_classes_30k_train_006861
Implement the Python class `AppTemplate` described below. Class description: app模块信息 Method signatures and docstrings: - def add_app(cls, user_id: int, app_name: str, desc: str='') -> dict: 添加模块 :param user_id: :param app_name: :param desc: :return: - def update_app(cls, user_id: int, app_id: int, app_name: str, stat...
Implement the Python class `AppTemplate` described below. Class description: app模块信息 Method signatures and docstrings: - def add_app(cls, user_id: int, app_name: str, desc: str='') -> dict: 添加模块 :param user_id: :param app_name: :param desc: :return: - def update_app(cls, user_id: int, app_id: int, app_name: str, stat...
3a2bdfd1598bfcdfe56386ec0c46fcede772cbfe
<|skeleton|> class AppTemplate: """app模块信息""" def add_app(cls, user_id: int, app_name: str, desc: str='') -> dict: """添加模块 :param user_id: :param app_name: :param desc: :return:""" <|body_0|> def update_app(cls, user_id: int, app_id: int, app_name: str, status: int, desc: str='') -> dict: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AppTemplate: """app模块信息""" def add_app(cls, user_id: int, app_name: str, desc: str='') -> dict: """添加模块 :param user_id: :param app_name: :param desc: :return:""" mes = {'message': 'success'} doc = dict(creator=user_id, last_user=user_id, app_name=app_name, desc=desc) try: ...
the_stack_v2_python_sparse
NewISpider/authorization_package/permission_module.py
SYYDSN/py_projects
train
0
9f266255e1c50b648cfa6d78fe24d41fda4cd497
[ "delta_lat = size / 1000.0 / _EARTH_RADIUS_IN_KM * (180.0 / math.pi)\ndelta_lng = delta_lat / math.cos(math.pi * lat / 180.0)\nself._horizontal_stroke = _Polyline([lat, lat], [lng - delta_lng, lng + delta_lng], precision, **kwargs)\nself._vertical_stroke = _Polyline([lat - delta_lat, lat + delta_lat], [lng, lng], p...
<|body_start_0|> delta_lat = size / 1000.0 / _EARTH_RADIUS_IN_KM * (180.0 / math.pi) delta_lng = delta_lat / math.cos(math.pi * lat / 180.0) self._horizontal_stroke = _Polyline([lat, lat], [lng - delta_lng, lng + delta_lng], precision, **kwargs) self._vertical_stroke = _Polyline([lat - d...
_Plus
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _Plus: def __init__(self, lat, lng, size, precision, **kwargs): """Args: lat (float): Latitude of the center of the '+'. lng (float): Longitude of the center of the '+'. size (int): Size of the '+', in meters. precision (int): Number of digits after the decimal to round to for lat/lng va...
stack_v2_sparse_classes_36k_train_015579
1,509
permissive
[ { "docstring": "Args: lat (float): Latitude of the center of the '+'. lng (float): Longitude of the center of the '+'. size (int): Size of the '+', in meters. precision (int): Number of digits after the decimal to round to for lat/lng values. Optional: Args: color (str): Color of the '+'. Can be hex ('#00FFFF')...
2
stack_v2_sparse_classes_30k_train_021507
Implement the Python class `_Plus` described below. Class description: Implement the _Plus class. Method signatures and docstrings: - def __init__(self, lat, lng, size, precision, **kwargs): Args: lat (float): Latitude of the center of the '+'. lng (float): Longitude of the center of the '+'. size (int): Size of the ...
Implement the Python class `_Plus` described below. Class description: Implement the _Plus class. Method signatures and docstrings: - def __init__(self, lat, lng, size, precision, **kwargs): Args: lat (float): Latitude of the center of the '+'. lng (float): Longitude of the center of the '+'. size (int): Size of the ...
8654a5a370b5ec309e1282c457eaf375c3dcb4bb
<|skeleton|> class _Plus: def __init__(self, lat, lng, size, precision, **kwargs): """Args: lat (float): Latitude of the center of the '+'. lng (float): Longitude of the center of the '+'. size (int): Size of the '+', in meters. precision (int): Number of digits after the decimal to round to for lat/lng va...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class _Plus: def __init__(self, lat, lng, size, precision, **kwargs): """Args: lat (float): Latitude of the center of the '+'. lng (float): Longitude of the center of the '+'. size (int): Size of the '+', in meters. precision (int): Number of digits after the decimal to round to for lat/lng values. Optional...
the_stack_v2_python_sparse
gmplot/drawables/symbols/plus.py
fishke22/gmplot
train
0
b4c98f58c36847eada6994cfde804c40fada427b
[ "self.name = name\nself.my_direct_orbiters = []\nself.num_ancestors = num_ancestors", "new_orbiter = Orbiter(name, num_ancestors=self.num_ancestors + 1)\nself.my_direct_orbiters.append(new_orbiter)\nreturn new_orbiter.num_ancestors", "if parent == self.name:\n x = self.add_direct_orbiter(name)\nelse:\n x ...
<|body_start_0|> self.name = name self.my_direct_orbiters = [] self.num_ancestors = num_ancestors <|end_body_0|> <|body_start_1|> new_orbiter = Orbiter(name, num_ancestors=self.num_ancestors + 1) self.my_direct_orbiters.append(new_orbiter) return new_orbiter.num_ancestor...
Orbiter
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Orbiter: def __init__(self, name: str, num_ancestors: int): """Create a new space object with parm name.""" <|body_0|> def add_direct_orbiter(self, name: str): """Add a new space object with parm name as a direct orbiter of this space object.""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_015580
4,579
permissive
[ { "docstring": "Create a new space object with parm name.", "name": "__init__", "signature": "def __init__(self, name: str, num_ancestors: int)" }, { "docstring": "Add a new space object with parm name as a direct orbiter of this space object.", "name": "add_direct_orbiter", "signature":...
3
stack_v2_sparse_classes_30k_train_008848
Implement the Python class `Orbiter` described below. Class description: Implement the Orbiter class. Method signatures and docstrings: - def __init__(self, name: str, num_ancestors: int): Create a new space object with parm name. - def add_direct_orbiter(self, name: str): Add a new space object with parm name as a d...
Implement the Python class `Orbiter` described below. Class description: Implement the Orbiter class. Method signatures and docstrings: - def __init__(self, name: str, num_ancestors: int): Create a new space object with parm name. - def add_direct_orbiter(self, name: str): Add a new space object with parm name as a d...
09537d9887398e2ea9c9021ed87f0425846d4600
<|skeleton|> class Orbiter: def __init__(self, name: str, num_ancestors: int): """Create a new space object with parm name.""" <|body_0|> def add_direct_orbiter(self, name: str): """Add a new space object with parm name as a direct orbiter of this space object.""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Orbiter: def __init__(self, name: str, num_ancestors: int): """Create a new space object with parm name.""" self.name = name self.my_direct_orbiters = [] self.num_ancestors = num_ancestors def add_direct_orbiter(self, name: str): """Add a new space object with parm...
the_stack_v2_python_sparse
06-universal-orbit-map/orbit_map.py
johntelforduk/advent-of-code-2019
train
1
4233974e2ab6706479a2105d5218ab58343b866e
[ "self.settings = None\nself.options = None\nself._sLabel = 'SETTINGS'\nself._oLabel = 'OPTIONS'\nself.set(settings, options)", "config = ConfigParser()\nconfig.read(iniFile, encoding='utf-8')\nif config.has_section(self._sLabel):\n section = config[self._sLabel]\n for setting in self.settings:\n fall...
<|body_start_0|> self.settings = None self.options = None self._sLabel = 'SETTINGS' self._oLabel = 'OPTIONS' self.set(settings, options) <|end_body_0|> <|body_start_1|> config = ConfigParser() config.read(iniFile, encoding='utf-8') if config.has_section(s...
Application configuration, representing an INI file. INI file sections: <self._sLabel> - Strings <self._oLabel> - Boolean values Public methods: read(iniFile) -- read a configuration file. set(settings={}, options={}) -- set the entire configuration without writing the INI file. write(iniFile) -- save the configuration...
Configuration
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Configuration: """Application configuration, representing an INI file. INI file sections: <self._sLabel> - Strings <self._oLabel> - Boolean values Public methods: read(iniFile) -- read a configuration file. set(settings={}, options={}) -- set the entire configuration without writing the INI file....
stack_v2_sparse_classes_36k_train_015581
3,445
permissive
[ { "docstring": "Initalize attribute variables. Optional arguments: settings -- default settings (dictionary of strings) options -- default options (dictionary of boolean values)", "name": "__init__", "signature": "def __init__(self, settings={}, options={})" }, { "docstring": "Read a configurati...
4
null
Implement the Python class `Configuration` described below. Class description: Application configuration, representing an INI file. INI file sections: <self._sLabel> - Strings <self._oLabel> - Boolean values Public methods: read(iniFile) -- read a configuration file. set(settings={}, options={}) -- set the entire conf...
Implement the Python class `Configuration` described below. Class description: Application configuration, representing an INI file. INI file sections: <self._sLabel> - Strings <self._oLabel> - Boolean values Public methods: read(iniFile) -- read a configuration file. set(settings={}, options={}) -- set the entire conf...
33a868daed653c3371f5991d243a034668a80884
<|skeleton|> class Configuration: """Application configuration, representing an INI file. INI file sections: <self._sLabel> - Strings <self._oLabel> - Boolean values Public methods: read(iniFile) -- read a configuration file. set(settings={}, options={}) -- set the entire configuration without writing the INI file....
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Configuration: """Application configuration, representing an INI file. INI file sections: <self._sLabel> - Strings <self._oLabel> - Boolean values Public methods: read(iniFile) -- read a configuration file. set(settings={}, options={}) -- set the entire configuration without writing the INI file. write(iniFil...
the_stack_v2_python_sparse
src/pywriter/config/configuration.py
peter88213/PyWriter
train
3
29761cda128fdbd7b5356874746292c2e808a43e
[ "pkt_characs = packet_op | (packet_type & 15) << 4\nif pkt_characs not in PacketRegistry.registry:\n PacketRegistry.registry[pkt_characs] = packet_class", "pkt_characs = packet.operation | (packet.flags & 15) << 4\nif pkt_characs in PacketRegistry.registry:\n return PacketRegistry.registry[pkt_characs].from...
<|body_start_0|> pkt_characs = packet_op | (packet_type & 15) << 4 if pkt_characs not in PacketRegistry.registry: PacketRegistry.registry[pkt_characs] = packet_class <|end_body_0|> <|body_start_1|> pkt_characs = packet.operation | (packet.flags & 15) << 4 if pkt_characs in P...
Packet registry. This class acts as a registry and provide a static method to decode raw packets into the corresponding classes.
PacketRegistry
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PacketRegistry: """Packet registry. This class acts as a registry and provide a static method to decode raw packets into the corresponding classes.""" def register(packet_op, packet_type, packet_class): """Associate a packet class with its characteristics.""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_015582
24,942
permissive
[ { "docstring": "Associate a packet class with its characteristics.", "name": "register", "signature": "def register(packet_op, packet_type, packet_class)" }, { "docstring": "Decode packet into corresponding class instance.", "name": "decode", "signature": "def decode(packet)" } ]
2
stack_v2_sparse_classes_30k_train_016083
Implement the Python class `PacketRegistry` described below. Class description: Packet registry. This class acts as a registry and provide a static method to decode raw packets into the corresponding classes. Method signatures and docstrings: - def register(packet_op, packet_type, packet_class): Associate a packet cl...
Implement the Python class `PacketRegistry` described below. Class description: Packet registry. This class acts as a registry and provide a static method to decode raw packets into the corresponding classes. Method signatures and docstrings: - def register(packet_op, packet_type, packet_class): Associate a packet cl...
d0dd2dfe98841e0ad16c9737987b87fbef020782
<|skeleton|> class PacketRegistry: """Packet registry. This class acts as a registry and provide a static method to decode raw packets into the corresponding classes.""" def register(packet_op, packet_type, packet_class): """Associate a packet class with its characteristics.""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PacketRegistry: """Packet registry. This class acts as a registry and provide a static method to decode raw packets into the corresponding classes.""" def register(packet_op, packet_type, packet_class): """Associate a packet class with its characteristics.""" pkt_characs = packet_op | (pa...
the_stack_v2_python_sparse
btlejack/packets.py
virtualabs/btlejack
train
1,739
7929cb392d3a2560ea379de94457a84675b9151f
[ "if name != None and p_obj.Name == name:\n return p_obj\nelif key != None and p_obj.Key == key:\n return p_obj\nelif UUID != None and p_obj.UUID == UUID:\n return p_obj\nelif UUID != None and p_obj.UUID == UUID:\n return p_obj\nreturn None", "for l_obj in p_objs.values():\n l_ret = self._test_objec...
<|body_start_0|> if name != None and p_obj.Name == name: return p_obj elif key != None and p_obj.Key == key: return p_obj elif UUID != None and p_obj.UUID == UUID: return p_obj elif UUID != None and p_obj.UUID == UUID: return p_obj ...
lightingUtility
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class lightingUtility: def _test_object_by_id(self, p_obj, name=None, key=None, UUID=None): """Return the device object for a house using the given value. A name, key or UUID may be used to identify the device. @return: the Device object found or None.""" <|body_0|> def get_object...
stack_v2_sparse_classes_36k_train_015583
4,060
permissive
[ { "docstring": "Return the device object for a house using the given value. A name, key or UUID may be used to identify the device. @return: the Device object found or None.", "name": "_test_object_by_id", "signature": "def _test_object_by_id(self, p_obj, name=None, key=None, UUID=None)" }, { "d...
4
null
Implement the Python class `lightingUtility` described below. Class description: Implement the lightingUtility class. Method signatures and docstrings: - def _test_object_by_id(self, p_obj, name=None, key=None, UUID=None): Return the device object for a house using the given value. A name, key or UUID may be used to ...
Implement the Python class `lightingUtility` described below. Class description: Implement the lightingUtility class. Method signatures and docstrings: - def _test_object_by_id(self, p_obj, name=None, key=None, UUID=None): Return the device object for a house using the given value. A name, key or UUID may be used to ...
a100fc67761a22ae47ed6f21f3c9464e2de5d54f
<|skeleton|> class lightingUtility: def _test_object_by_id(self, p_obj, name=None, key=None, UUID=None): """Return the device object for a house using the given value. A name, key or UUID may be used to identify the device. @return: the Device object found or None.""" <|body_0|> def get_object...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class lightingUtility: def _test_object_by_id(self, p_obj, name=None, key=None, UUID=None): """Return the device object for a house using the given value. A name, key or UUID may be used to identify the device. @return: the Device object found or None.""" if name != None and p_obj.Name == name: ...
the_stack_v2_python_sparse
Project/src/Modules/House/Lighting/utility.py
DBrianKimmel/PyHouse
train
3
d296a1ea66a4eaab7d9eec12b97a91f75d8c1b8b
[ "super(VoipMsClient, self).__init__()\nself.base_url = 'https://voip.ms/api/v1/rest.php?api_username={}&api_password={}&'.format(voip_user, voip_api_password)\nself.post_url = 'https://voip.ms/api/v1/rest.php'\nself.voip_user = voip_user\nself.voip_api_password = voip_api_password", "if status in ERROR_CODES:\n ...
<|body_start_0|> super(VoipMsClient, self).__init__() self.base_url = 'https://voip.ms/api/v1/rest.php?api_username={}&api_password={}&'.format(voip_user, voip_api_password) self.post_url = 'https://voip.ms/api/v1/rest.php' self.voip_user = voip_user self.voip_api_password = voip...
Voip.ms class to communicate with the v1 REST API
VoipMsClient
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VoipMsClient: """Voip.ms class to communicate with the v1 REST API""" def __init__(self, voip_user, voip_api_password): """Initialize the class with you voip_user and voip_api_password. :param voip_user: voip.ms user id (email) :type voip_user: :py:class:`str` :param voip_api_passwor...
stack_v2_sparse_classes_36k_train_015584
3,509
permissive
[ { "docstring": "Initialize the class with you voip_user and voip_api_password. :param voip_user: voip.ms user id (email) :type voip_user: :py:class:`str` :param voip_api_password: voip.ms API Password :type voip_api_password: :py:class:`str`", "name": "__init__", "signature": "def __init__(self, voip_us...
4
stack_v2_sparse_classes_30k_train_001011
Implement the Python class `VoipMsClient` described below. Class description: Voip.ms class to communicate with the v1 REST API Method signatures and docstrings: - def __init__(self, voip_user, voip_api_password): Initialize the class with you voip_user and voip_api_password. :param voip_user: voip.ms user id (email)...
Implement the Python class `VoipMsClient` described below. Class description: Voip.ms class to communicate with the v1 REST API Method signatures and docstrings: - def __init__(self, voip_user, voip_api_password): Initialize the class with you voip_user and voip_api_password. :param voip_user: voip.ms user id (email)...
e5a86a7c201579510971e310d25a6d43ec640982
<|skeleton|> class VoipMsClient: """Voip.ms class to communicate with the v1 REST API""" def __init__(self, voip_user, voip_api_password): """Initialize the class with you voip_user and voip_api_password. :param voip_user: voip.ms user id (email) :type voip_user: :py:class:`str` :param voip_api_passwor...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VoipMsClient: """Voip.ms class to communicate with the v1 REST API""" def __init__(self, voip_user, voip_api_password): """Initialize the class with you voip_user and voip_api_password. :param voip_user: voip.ms user id (email) :type voip_user: :py:class:`str` :param voip_api_password: voip.ms AP...
the_stack_v2_python_sparse
voipms/voipmsclient.py
4doom4/python-voipms
train
16
4996d4375aaba3b23d2e35e09ef611ea85a1061d
[ "try:\n company = Company.objects.get(id=view.kwargs.get('company_pk'))\n role = request.user.get_role_for_company(company)\nexcept Company.DoesNotExist:\n company = None\n role = None\nif view.action == 'list':\n return role.has_permission(RECEIVE_INTERVIEW)\nelif view.action == 'create':\n retur...
<|body_start_0|> try: company = Company.objects.get(id=view.kwargs.get('company_pk')) role = request.user.get_role_for_company(company) except Company.DoesNotExist: company = None role = None if view.action == 'list': return role.has_pe...
Permission class for InterviewViewSet class.
InterviewPermission
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InterviewPermission: """Permission class for InterviewViewSet class.""" def has_permission(self, request, view): """Permission for the whole entity.""" <|body_0|> def has_object_permission(self, request, view, obj): """Permission for the particular instance.""" ...
stack_v2_sparse_classes_36k_train_015585
1,848
no_license
[ { "docstring": "Permission for the whole entity.", "name": "has_permission", "signature": "def has_permission(self, request, view)" }, { "docstring": "Permission for the particular instance.", "name": "has_object_permission", "signature": "def has_object_permission(self, request, view, o...
2
null
Implement the Python class `InterviewPermission` described below. Class description: Permission class for InterviewViewSet class. Method signatures and docstrings: - def has_permission(self, request, view): Permission for the whole entity. - def has_object_permission(self, request, view, obj): Permission for the part...
Implement the Python class `InterviewPermission` described below. Class description: Permission class for InterviewViewSet class. Method signatures and docstrings: - def has_permission(self, request, view): Permission for the whole entity. - def has_object_permission(self, request, view, obj): Permission for the part...
252b0ebd77eefbcc945a0efc3068cc3421f46d5f
<|skeleton|> class InterviewPermission: """Permission class for InterviewViewSet class.""" def has_permission(self, request, view): """Permission for the whole entity.""" <|body_0|> def has_object_permission(self, request, view, obj): """Permission for the particular instance.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InterviewPermission: """Permission class for InterviewViewSet class.""" def has_permission(self, request, view): """Permission for the whole entity.""" try: company = Company.objects.get(id=view.kwargs.get('company_pk')) role = request.user.get_role_for_company(com...
the_stack_v2_python_sparse
app/interviews/permissions.py
vsokoltsov/Interview360Server
train
2
3eb37672c5c2aaecd1414adafbd63b921e597b4f
[ "self.radius = radius\nself.x_center = x_center\nself.y_center = y_center", "radius = self.radius * sqrt(random())\ntheta = 2 * pi * random()\nreturn (self.x_center + radius * cos(theta), self.y_center + radius * sin(theta))" ]
<|body_start_0|> self.radius = radius self.x_center = x_center self.y_center = y_center <|end_body_0|> <|body_start_1|> radius = self.radius * sqrt(random()) theta = 2 * pi * random() return (self.x_center + radius * cos(theta), self.y_center + radius * sin(theta)) <|end...
Solution
[ "CC0-1.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def __init__(self, radius: float, x_center: float, y_center: float): """self.r, self.x, self.y = radius, x_center, y_center""" <|body_0|> def randPoint(self) -> List[float]: """theta = uniform(0, 2 * pi) R = self.r * sqrt(uniform(0, 1)) return [self.x + R *...
stack_v2_sparse_classes_36k_train_015586
2,229
permissive
[ { "docstring": "self.r, self.x, self.y = radius, x_center, y_center", "name": "__init__", "signature": "def __init__(self, radius: float, x_center: float, y_center: float)" }, { "docstring": "theta = uniform(0, 2 * pi) R = self.r * sqrt(uniform(0, 1)) return [self.x + R * cos(theta), self.y + R ...
2
stack_v2_sparse_classes_30k_train_008832
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, radius: float, x_center: float, y_center: float): self.r, self.x, self.y = radius, x_center, y_center - def randPoint(self) -> List[float]: theta = uniform(0, ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, radius: float, x_center: float, y_center: float): self.r, self.x, self.y = radius, x_center, y_center - def randPoint(self) -> List[float]: theta = uniform(0, ...
4ea4c1579c28308455be4dfa02bd45ebd88b2d0a
<|skeleton|> class Solution: def __init__(self, radius: float, x_center: float, y_center: float): """self.r, self.x, self.y = radius, x_center, y_center""" <|body_0|> def randPoint(self) -> List[float]: """theta = uniform(0, 2 * pi) R = self.r * sqrt(uniform(0, 1)) return [self.x + R *...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def __init__(self, radius: float, x_center: float, y_center: float): """self.r, self.x, self.y = radius, x_center, y_center""" self.radius = radius self.x_center = x_center self.y_center = y_center def randPoint(self) -> List[float]: """theta = uniform(0,...
the_stack_v2_python_sparse
src/arrays/randPoint.py
way2arun/datastructures_algorithms
train
1
b82da62ef2a4adabe08768968bccc35a830d5d0d
[ "graph = [[] for _ in range(numCourses)]\nfor b, a in prerequisites:\n graph[a].append(b)\nnode_state = [0] * numCourses\nresult = []\n\ndef dfs(node):\n \"\"\"store node into result by dfs end time, and return False if there is a cycle\"\"\"\n node_state[node] = 1\n for adj in graph[node]:\n if ...
<|body_start_0|> graph = [[] for _ in range(numCourses)] for b, a in prerequisites: graph[a].append(b) node_state = [0] * numCourses result = [] def dfs(node): """store node into result by dfs end time, and return False if there is a cycle""" ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findOrder(self, numCourses: int, prerequisites: List[List[int]]) -> List[int]: """Topological sort by dfs, Time: O(V+E), Space: O(V)""" <|body_0|> def findOrder(self, numCourses: int, prerequisites: List[List[int]]) -> List[int]: """Topological sort by ...
stack_v2_sparse_classes_36k_train_015587
3,322
no_license
[ { "docstring": "Topological sort by dfs, Time: O(V+E), Space: O(V)", "name": "findOrder", "signature": "def findOrder(self, numCourses: int, prerequisites: List[List[int]]) -> List[int]" }, { "docstring": "Topological sort by bfs, Time: O(V+E), Space: O(V)", "name": "findOrder", "signatu...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findOrder(self, numCourses: int, prerequisites: List[List[int]]) -> List[int]: Topological sort by dfs, Time: O(V+E), Space: O(V) - def findOrder(self, numCourses: int, prere...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findOrder(self, numCourses: int, prerequisites: List[List[int]]) -> List[int]: Topological sort by dfs, Time: O(V+E), Space: O(V) - def findOrder(self, numCourses: int, prere...
72136e3487d239f5b37e2d6393e034262a6bf599
<|skeleton|> class Solution: def findOrder(self, numCourses: int, prerequisites: List[List[int]]) -> List[int]: """Topological sort by dfs, Time: O(V+E), Space: O(V)""" <|body_0|> def findOrder(self, numCourses: int, prerequisites: List[List[int]]) -> List[int]: """Topological sort by ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findOrder(self, numCourses: int, prerequisites: List[List[int]]) -> List[int]: """Topological sort by dfs, Time: O(V+E), Space: O(V)""" graph = [[] for _ in range(numCourses)] for b, a in prerequisites: graph[a].append(b) node_state = [0] * numCourses ...
the_stack_v2_python_sparse
python/210-Course Schedule II.py
cwza/leetcode
train
0
291f2d1dab6e3fdecae130539129633bd21d14d2
[ "def helper(root):\n if not root:\n return [None]\n else:\n return [root.val] + helper(root.left) + helper(root.right)\nreturn str(helper(root))", "data = eval(data)\nt = TreeNode(None)\n\ndef helper(data, t1):\n if not data:\n return\n a = data.pop(0)\n if a == None:\n ...
<|body_start_0|> def helper(root): if not root: return [None] else: return [root.val] + helper(root.left) + helper(root.right) return str(helper(root)) <|end_body_0|> <|body_start_1|> data = eval(data) t = TreeNode(None) d...
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_015588
2,086
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:...
b7d9238d692b1b2f5ab8f73a76d02228a71a4d15
<|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""" def helper(root): if not root: return [None] else: return [root.val] + helper(root.left) + helper(root.right) return str(h...
the_stack_v2_python_sparse
297-Serialize-and-Deserialize-Binary-Tree.py
liuspencersjtu/MyLeetCode
train
0
b1f45937f3fa972e6614442dfed390ede2752dab
[ "context = super(TriStateCheckboxSelectMultiple, self).get_context(name, value, attrs)\nchoices = dict(it.chain(self.choices, choices))\nif value is None:\n value = dict.fromkeys(choices, False)\nelse:\n value = dict(dict.fromkeys(choices, False).items() + value.items())\ncontext['values'] = [(choice, label, ...
<|body_start_0|> context = super(TriStateCheckboxSelectMultiple, self).get_context(name, value, attrs) choices = dict(it.chain(self.choices, choices)) if value is None: value = dict.fromkeys(choices, False) else: value = dict(dict.fromkeys(choices, False).items() ...
Renders tri-state multi-selectable checkbox. .. note:: Subclassed from ``CheckboxSelectMultiple`` and not from ``SelectMultiple`` only to make ``horizon.templatetags.form_helpers.is_checkbox`` able to recognize this widget. Otherwise template ``horizon/common/_form_field.html`` would render this widget slightly incorre...
TriStateCheckboxSelectMultiple
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TriStateCheckboxSelectMultiple: """Renders tri-state multi-selectable checkbox. .. note:: Subclassed from ``CheckboxSelectMultiple`` and not from ``SelectMultiple`` only to make ``horizon.templatetags.form_helpers.is_checkbox`` able to recognize this widget. Otherwise template ``horizon/common/_f...
stack_v2_sparse_classes_36k_train_015589
6,229
permissive
[ { "docstring": "Renders html and JavaScript. :param value: Dictionary of form Choice => Value (Checked|Uncheckec|Indeterminate) :type value: dict", "name": "get_context", "signature": "def get_context(self, name, value, attrs=None, choices=())" }, { "docstring": "Converts encoded string with val...
3
stack_v2_sparse_classes_30k_train_016209
Implement the Python class `TriStateCheckboxSelectMultiple` described below. Class description: Renders tri-state multi-selectable checkbox. .. note:: Subclassed from ``CheckboxSelectMultiple`` and not from ``SelectMultiple`` only to make ``horizon.templatetags.form_helpers.is_checkbox`` able to recognize this widget....
Implement the Python class `TriStateCheckboxSelectMultiple` described below. Class description: Renders tri-state multi-selectable checkbox. .. note:: Subclassed from ``CheckboxSelectMultiple`` and not from ``SelectMultiple`` only to make ``horizon.templatetags.form_helpers.is_checkbox`` able to recognize this widget....
54e2ea8a71385b1c7624b3d2c8056bd8a2c2e2f7
<|skeleton|> class TriStateCheckboxSelectMultiple: """Renders tri-state multi-selectable checkbox. .. note:: Subclassed from ``CheckboxSelectMultiple`` and not from ``SelectMultiple`` only to make ``horizon.templatetags.form_helpers.is_checkbox`` able to recognize this widget. Otherwise template ``horizon/common/_f...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TriStateCheckboxSelectMultiple: """Renders tri-state multi-selectable checkbox. .. note:: Subclassed from ``CheckboxSelectMultiple`` and not from ``SelectMultiple`` only to make ``horizon.templatetags.form_helpers.is_checkbox`` able to recognize this widget. Otherwise template ``horizon/common/_form_field.htm...
the_stack_v2_python_sparse
muranodashboard/common/widgets.py
openstack/murano-dashboard
train
38
7444b5029f2d1205696058eceaf2a7ba9aafa096
[ "self.received_packets = []\nself.sent_packets = []\nself.acked_packets = []\nself.rtts = []\nself.loss_rates = []\nself.if_counts = []\nself.if_lists = []\nif raw:\n self._parse(raw)", "data = Raw(raw, 'Serialized SCION stats', self.FIXED_DATA_LEN, True)\nwhile len(data):\n values = data.pop(self.FIXED_DAT...
<|body_start_0|> self.received_packets = [] self.sent_packets = [] self.acked_packets = [] self.rtts = [] self.loss_rates = [] self.if_counts = [] self.if_lists = [] if raw: self._parse(raw) <|end_body_0|> <|body_start_1|> data = Raw(r...
Python class containing SCION socket traffic data. This class should ONLY be instantiated by the get_stats call in ScionBaseSocket.
ScionStats
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ScionStats: """Python class containing SCION socket traffic data. This class should ONLY be instantiated by the get_stats call in ScionBaseSocket.""" def __init__(self, raw=None): """Python representation of SCION traffic data obtained from getStats() call. Allows Python wrapper user...
stack_v2_sparse_classes_36k_train_015590
19,489
permissive
[ { "docstring": "Python representation of SCION traffic data obtained from getStats() call. Allows Python wrapper user to not worry about dereferencing pointers or freeing memory. :param stats: Struct returned by ScionBaseSocket.get_stats() :type: C_SCIONStats", "name": "__init__", "signature": "def __in...
5
null
Implement the Python class `ScionStats` described below. Class description: Python class containing SCION socket traffic data. This class should ONLY be instantiated by the get_stats call in ScionBaseSocket. Method signatures and docstrings: - def __init__(self, raw=None): Python representation of SCION traffic data ...
Implement the Python class `ScionStats` described below. Class description: Python class containing SCION socket traffic data. This class should ONLY be instantiated by the get_stats call in ScionBaseSocket. Method signatures and docstrings: - def __init__(self, raw=None): Python representation of SCION traffic data ...
06f3f0b82dc8a535ce8b0a128282af00a8425a06
<|skeleton|> class ScionStats: """Python class containing SCION socket traffic data. This class should ONLY be instantiated by the get_stats call in ScionBaseSocket.""" def __init__(self, raw=None): """Python representation of SCION traffic data obtained from getStats() call. Allows Python wrapper user...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ScionStats: """Python class containing SCION socket traffic data. This class should ONLY be instantiated by the get_stats call in ScionBaseSocket.""" def __init__(self, raw=None): """Python representation of SCION traffic data obtained from getStats() call. Allows Python wrapper user to not worry...
the_stack_v2_python_sparse
endhost/scion_socket.py
marcoeilers/scion
train
1
0867f78d4ce33206b6ab3b792a286315e69e4051
[ "if n < 2:\n return n\nreturn self.fib(n - 1) + self.fib(n - 2)", "def fib_tail(n, a, b):\n if n < 2:\n return n\n if n == 2:\n return a + b\n else:\n return fib_tail(n - 1, b, a + b)\nreturn fib_tail(n, 0, 1)", "def fibonacci(n, memo):\n if n < 2:\n return n\n if m...
<|body_start_0|> if n < 2: return n return self.fib(n - 1) + self.fib(n - 2) <|end_body_0|> <|body_start_1|> def fib_tail(n, a, b): if n < 2: return n if n == 2: return a + b else: return fib_tail(n ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def fib(self, n: int) -> int: """0、1、1、2、3、5、8、13、21...""" <|body_0|> def fib0(self, n: int) -> int: """递归超时,尾递归""" <|body_1|> def fib1(self, n: int) -> int: """递归超时,记忆化递归实现(数组/哈希表)""" <|body_2|> def fib2(self, n: int) -> i...
stack_v2_sparse_classes_36k_train_015591
3,131
permissive
[ { "docstring": "0、1、1、2、3、5、8、13、21...", "name": "fib", "signature": "def fib(self, n: int) -> int" }, { "docstring": "递归超时,尾递归", "name": "fib0", "signature": "def fib0(self, n: int) -> int" }, { "docstring": "递归超时,记忆化递归实现(数组/哈希表)", "name": "fib1", "signature": "def fib1(...
6
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def fib(self, n: int) -> int: 0、1、1、2、3、5、8、13、21... - def fib0(self, n: int) -> int: 递归超时,尾递归 - def fib1(self, n: int) -> int: 递归超时,记忆化递归实现(数组/哈希表) - def fib2(self, n: int) -> i...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def fib(self, n: int) -> int: 0、1、1、2、3、5、8、13、21... - def fib0(self, n: int) -> int: 递归超时,尾递归 - def fib1(self, n: int) -> int: 递归超时,记忆化递归实现(数组/哈希表) - def fib2(self, n: int) -> i...
e8a1c6cae6547cbcb6e8494be6df685f3e7c837c
<|skeleton|> class Solution: def fib(self, n: int) -> int: """0、1、1、2、3、5、8、13、21...""" <|body_0|> def fib0(self, n: int) -> int: """递归超时,尾递归""" <|body_1|> def fib1(self, n: int) -> int: """递归超时,记忆化递归实现(数组/哈希表)""" <|body_2|> def fib2(self, n: int) -> i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def fib(self, n: int) -> int: """0、1、1、2、3、5、8、13、21...""" if n < 2: return n return self.fib(n - 1) + self.fib(n - 2) def fib0(self, n: int) -> int: """递归超时,尾递归""" def fib_tail(n, a, b): if n < 2: return n ...
the_stack_v2_python_sparse
lcof/10-fei-bo-na-qi-shu-lie-lcof.py
yuenliou/leetcode
train
0
c9c7b23c11063f7608a7a00286c7583ddf2fe6e3
[ "if not heights:\n return 0\nn = len(heights)\narea = []\nfor i in range(n):\n min_h = heights[i]\n for j in range(i, n):\n min_h = min([min_h, heights[j]])\n area.append(min_h * (j - i + 1))\nreturn max(area)", "if not heights:\n return 0\nn = len(heights)\narea = []" ]
<|body_start_0|> if not heights: return 0 n = len(heights) area = [] for i in range(n): min_h = heights[i] for j in range(i, n): min_h = min([min_h, heights[j]]) area.append(min_h * (j - i + 1)) return max(area) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def largestRectangleArea(self, heights: List[int]) -> int: """brute force""" <|body_0|> def largestRectangleArea(self, heights: List[int]) -> int: """optimize""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not heights: retu...
stack_v2_sparse_classes_36k_train_015592
595
no_license
[ { "docstring": "brute force", "name": "largestRectangleArea", "signature": "def largestRectangleArea(self, heights: List[int]) -> int" }, { "docstring": "optimize", "name": "largestRectangleArea", "signature": "def largestRectangleArea(self, heights: List[int]) -> int" } ]
2
stack_v2_sparse_classes_30k_train_007214
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def largestRectangleArea(self, heights: List[int]) -> int: brute force - def largestRectangleArea(self, heights: List[int]) -> int: optimize
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def largestRectangleArea(self, heights: List[int]) -> int: brute force - def largestRectangleArea(self, heights: List[int]) -> int: optimize <|skeleton|> class Solution: de...
08d624956878b9896778c20f397321d4b3312313
<|skeleton|> class Solution: def largestRectangleArea(self, heights: List[int]) -> int: """brute force""" <|body_0|> def largestRectangleArea(self, heights: List[int]) -> int: """optimize""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def largestRectangleArea(self, heights: List[int]) -> int: """brute force""" if not heights: return 0 n = len(heights) area = [] for i in range(n): min_h = heights[i] for j in range(i, n): min_h = min([min_h,...
the_stack_v2_python_sparse
84. Largest Rectangle in Histogram/my_solution.py
Tracyee/Leetcode-Games-python
train
0
5f11963732eff697c3a3c5b3e4f2447ae08fd887
[ "request_message = self.MODULE.PlatformWLTMonitoringRequest(expected_address=expected_address, wallet_id=wallet_id, wallet_address=wallet_address, expected_currency=expected_currency, expected_amount=str(expected_amount), uuid=str(uuid))\nwith grpc.insecure_channel(self.GW_ADDRESS) as channel:\n client = self.Se...
<|body_start_0|> request_message = self.MODULE.PlatformWLTMonitoringRequest(expected_address=expected_address, wallet_id=wallet_id, wallet_address=wallet_address, expected_currency=expected_currency, expected_amount=str(expected_amount), uuid=str(uuid)) with grpc.insecure_channel(self.GW_ADDRESS) as cha...
Hold logic for interacting with remote wallets service.
WalletsServiceGateway
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WalletsServiceGateway: """Hold logic for interacting with remote wallets service.""" def put_on_monitoring(self, *, wallet_id: int=None, wallet_address: str=None, expected_currency: str=None, expected_address: str=None, expected_amount: str=None, uuid: str=None) -> typing.Union[dict, typing....
stack_v2_sparse_classes_36k_train_015593
3,572
no_license
[ { "docstring": "Method that send request to service wallet to start monitoring current wallet for incoming transaction from expected_address :param wallet_id: wallet id from database :param wallet_address: wallet address from blockchain :param expected_amount: amount of transaction :param expected_currency: cur...
2
stack_v2_sparse_classes_30k_train_009356
Implement the Python class `WalletsServiceGateway` described below. Class description: Hold logic for interacting with remote wallets service. Method signatures and docstrings: - def put_on_monitoring(self, *, wallet_id: int=None, wallet_address: str=None, expected_currency: str=None, expected_address: str=None, expe...
Implement the Python class `WalletsServiceGateway` described below. Class description: Hold logic for interacting with remote wallets service. Method signatures and docstrings: - def put_on_monitoring(self, *, wallet_id: int=None, wallet_address: str=None, expected_currency: str=None, expected_address: str=None, expe...
abd38ab4bf4d6387325afd09375c6f9ce1fa1ad5
<|skeleton|> class WalletsServiceGateway: """Hold logic for interacting with remote wallets service.""" def put_on_monitoring(self, *, wallet_id: int=None, wallet_address: str=None, expected_currency: str=None, expected_address: str=None, expected_amount: str=None, uuid: str=None) -> typing.Union[dict, typing....
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WalletsServiceGateway: """Hold logic for interacting with remote wallets service.""" def put_on_monitoring(self, *, wallet_id: int=None, wallet_address: str=None, expected_currency: str=None, expected_address: str=None, expected_amount: str=None, uuid: str=None) -> typing.Union[dict, typing.Any]: ...
the_stack_v2_python_sparse
exchanger/wallets_gateway/gateway.py
healfy/exchanger
train
0
9a1724ed1fba89e9562266e03a08ff0c7b704a49
[ "self.number_of_archival_runs = number_of_archival_runs\nself.number_of_protection_runs = number_of_protection_runs\nself.number_of_replication_runs = number_of_replication_runs\nself.number_of_successful_archival_runs = number_of_successful_archival_runs\nself.number_of_successful_protection_runs = number_of_succe...
<|body_start_0|> self.number_of_archival_runs = number_of_archival_runs self.number_of_protection_runs = number_of_protection_runs self.number_of_replication_runs = number_of_replication_runs self.number_of_successful_archival_runs = number_of_successful_archival_runs self.number...
Implementation of the 'ProtectionRunsSummary' model. ProtectionRunsSummary is the summary of the all the Protection Runs for the Protection Jobs using the Specified Protection Policy. Attributes: number_of_archival_runs (long|int): Specifies the total number of Archival Runs using the current Protection Policy. number_...
ProtectionRunsSummary
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProtectionRunsSummary: """Implementation of the 'ProtectionRunsSummary' model. ProtectionRunsSummary is the summary of the all the Protection Runs for the Protection Jobs using the Specified Protection Policy. Attributes: number_of_archival_runs (long|int): Specifies the total number of Archival ...
stack_v2_sparse_classes_36k_train_015594
4,115
permissive
[ { "docstring": "Constructor for the ProtectionRunsSummary class", "name": "__init__", "signature": "def __init__(self, number_of_archival_runs=None, number_of_protection_runs=None, number_of_replication_runs=None, number_of_successful_archival_runs=None, number_of_successful_protection_runs=None, number...
2
null
Implement the Python class `ProtectionRunsSummary` described below. Class description: Implementation of the 'ProtectionRunsSummary' model. ProtectionRunsSummary is the summary of the all the Protection Runs for the Protection Jobs using the Specified Protection Policy. Attributes: number_of_archival_runs (long|int): ...
Implement the Python class `ProtectionRunsSummary` described below. Class description: Implementation of the 'ProtectionRunsSummary' model. ProtectionRunsSummary is the summary of the all the Protection Runs for the Protection Jobs using the Specified Protection Policy. Attributes: number_of_archival_runs (long|int): ...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class ProtectionRunsSummary: """Implementation of the 'ProtectionRunsSummary' model. ProtectionRunsSummary is the summary of the all the Protection Runs for the Protection Jobs using the Specified Protection Policy. Attributes: number_of_archival_runs (long|int): Specifies the total number of Archival ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProtectionRunsSummary: """Implementation of the 'ProtectionRunsSummary' model. ProtectionRunsSummary is the summary of the all the Protection Runs for the Protection Jobs using the Specified Protection Policy. Attributes: number_of_archival_runs (long|int): Specifies the total number of Archival Runs using th...
the_stack_v2_python_sparse
cohesity_management_sdk/models/protection_runs_summary.py
cohesity/management-sdk-python
train
24
e50c8a57edf736b2ca0a59d501a8c27f9e50638c
[ "user_name = request.GET.get('user_name', None)\ntry:\n user = BigfishUser.objects.get(username=user_name)\nexcept:\n return Response(rsp_msg_400('该用户不存在'), status=status.HTTP_200_OK)\nversion = Version.objects.all().order_by('-version_code').first()\ntry:\n identity_version = IdentityVersion.objects.get(i...
<|body_start_0|> user_name = request.GET.get('user_name', None) try: user = BigfishUser.objects.get(username=user_name) except: return Response(rsp_msg_400('该用户不存在'), status=status.HTTP_200_OK) version = Version.objects.all().order_by('-version_code').first() ...
VersionViews
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VersionViews: def update_version(self, request): """更新版本 :param request: { "user_name": "10720001" } :return: { "data": { "version_name": "1.2.7", "apk_size": 30140, "message": "1231qweqw", "apk_code": 20, "version_code": 1, "folder_name": "http://127.0.0.1:8000/media/version/1.2.7/Super...
stack_v2_sparse_classes_36k_train_015595
7,575
no_license
[ { "docstring": "更新版本 :param request: { \"user_name\": \"10720001\" } :return: { \"data\": { \"version_name\": \"1.2.7\", \"apk_size\": 30140, \"message\": \"1231qweqw\", \"apk_code\": 20, \"version_code\": 1, \"folder_name\": \"http://127.0.0.1:8000/media/version/1.2.7/SuperFishTeacher.apk\" }, \"message\": \"s...
3
stack_v2_sparse_classes_30k_test_001190
Implement the Python class `VersionViews` described below. Class description: Implement the VersionViews class. Method signatures and docstrings: - def update_version(self, request): 更新版本 :param request: { "user_name": "10720001" } :return: { "data": { "version_name": "1.2.7", "apk_size": 30140, "message": "1231qweqw...
Implement the Python class `VersionViews` described below. Class description: Implement the VersionViews class. Method signatures and docstrings: - def update_version(self, request): 更新版本 :param request: { "user_name": "10720001" } :return: { "data": { "version_name": "1.2.7", "apk_size": 30140, "message": "1231qweqw...
4189fdcacc20795a4778b53c9d47d6fdd3e71811
<|skeleton|> class VersionViews: def update_version(self, request): """更新版本 :param request: { "user_name": "10720001" } :return: { "data": { "version_name": "1.2.7", "apk_size": 30140, "message": "1231qweqw", "apk_code": 20, "version_code": 1, "folder_name": "http://127.0.0.1:8000/media/version/1.2.7/Super...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VersionViews: def update_version(self, request): """更新版本 :param request: { "user_name": "10720001" } :return: { "data": { "version_name": "1.2.7", "apk_size": 30140, "message": "1231qweqw", "apk_code": 20, "version_code": 1, "folder_name": "http://127.0.0.1:8000/media/version/1.2.7/SuperFishTeacher.ap...
the_stack_v2_python_sparse
bigfish/apps/versionupdate/views.py
hyu9999/bigfish
train
0
cb6359664c03e9b44aca3ee7499eb37161f2acda
[ "category_id = len(CATEGORIES) + 1\nself.id = category_id\nself.items = items\nself.name = name\nCATEGORIES[category_id] = self", "repr_parts = ['<', self.__class__.__name__]\nrepr_parts.append(', name = ')\nrepr_parts.append(repr(self.name))\nrepr_parts.append(', item = ')\nrepr_parts.append(repr(self.items))\nr...
<|body_start_0|> category_id = len(CATEGORIES) + 1 self.id = category_id self.items = items self.name = name CATEGORIES[category_id] = self <|end_body_0|> <|body_start_1|> repr_parts = ['<', self.__class__.__name__] repr_parts.append(', name = ') repr_par...
Represents a trivia category. Attributes ---------- id : `int` The category's identifier. items : `tuple` of ``TriviaItem`` Possibilities suggested to the user. The 0th is always the correct one.
TriviaCategory
[ "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TriviaCategory: """Represents a trivia category. Attributes ---------- id : `int` The category's identifier. items : `tuple` of ``TriviaItem`` Possibilities suggested to the user. The 0th is always the correct one.""" def __init__(self, name, items): """Creates a new trivia item with...
stack_v2_sparse_classes_36k_train_015596
1,335
no_license
[ { "docstring": "Creates a new trivia item with the given options. Parameters ---------- name : `str` The name of the category. items : `tuple` of ``TriviaItem`` Items under the category.", "name": "__init__", "signature": "def __init__(self, name, items)" }, { "docstring": "Returns the trivia it...
2
null
Implement the Python class `TriviaCategory` described below. Class description: Represents a trivia category. Attributes ---------- id : `int` The category's identifier. items : `tuple` of ``TriviaItem`` Possibilities suggested to the user. The 0th is always the correct one. Method signatures and docstrings: - def __...
Implement the Python class `TriviaCategory` described below. Class description: Represents a trivia category. Attributes ---------- id : `int` The category's identifier. items : `tuple` of ``TriviaItem`` Possibilities suggested to the user. The 0th is always the correct one. Method signatures and docstrings: - def __...
74f92b598e86606ea3a269311316cddd84a5215f
<|skeleton|> class TriviaCategory: """Represents a trivia category. Attributes ---------- id : `int` The category's identifier. items : `tuple` of ``TriviaItem`` Possibilities suggested to the user. The 0th is always the correct one.""" def __init__(self, name, items): """Creates a new trivia item with...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TriviaCategory: """Represents a trivia category. Attributes ---------- id : `int` The category's identifier. items : `tuple` of ``TriviaItem`` Possibilities suggested to the user. The 0th is always the correct one.""" def __init__(self, name, items): """Creates a new trivia item with the given op...
the_stack_v2_python_sparse
koishi/plugins/trivia/category.py
HuyaneMatsu/Koishi
train
17
6d2369093cf5fd4bc817c248d96f4d84f3aedbf8
[ "self.path = path\nself.hostname = hostname\nself.port = port\nThread.__init__(self)", "Handler = RootedHTTPRequestHandler\nHandler.int_path = self.path\nself.base_path = os.path.join(os.getcwd(), self.path)\nself.server = HTTPServer((self.hostname, int(self.port)), Handler)\nself.server.serve_forever()" ]
<|body_start_0|> self.path = path self.hostname = hostname self.port = port Thread.__init__(self) <|end_body_0|> <|body_start_1|> Handler = RootedHTTPRequestHandler Handler.int_path = self.path self.base_path = os.path.join(os.getcwd(), self.path) self.se...
PM4PyHTTPServer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PM4PyHTTPServer: def __init__(self, path, hostname, port): """Initialize simple HTTP server (separate thread) :param path: Current path :param hostname: Hostname :param port: Port""" <|body_0|> def run(self): """Execute thread :return:""" <|body_1|> <|end_sk...
stack_v2_sparse_classes_36k_train_015597
1,097
permissive
[ { "docstring": "Initialize simple HTTP server (separate thread) :param path: Current path :param hostname: Hostname :param port: Port", "name": "__init__", "signature": "def __init__(self, path, hostname, port)" }, { "docstring": "Execute thread :return:", "name": "run", "signature": "de...
2
stack_v2_sparse_classes_30k_train_008407
Implement the Python class `PM4PyHTTPServer` described below. Class description: Implement the PM4PyHTTPServer class. Method signatures and docstrings: - def __init__(self, path, hostname, port): Initialize simple HTTP server (separate thread) :param path: Current path :param hostname: Hostname :param port: Port - de...
Implement the Python class `PM4PyHTTPServer` described below. Class description: Implement the PM4PyHTTPServer class. Method signatures and docstrings: - def __init__(self, path, hostname, port): Initialize simple HTTP server (separate thread) :param path: Current path :param hostname: Hostname :param port: Port - de...
b5ae5ea40799155d6540692f94be0444c16fd9d3
<|skeleton|> class PM4PyHTTPServer: def __init__(self, path, hostname, port): """Initialize simple HTTP server (separate thread) :param path: Current path :param hostname: Hostname :param port: Port""" <|body_0|> def run(self): """Execute thread :return:""" <|body_1|> <|end_sk...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PM4PyHTTPServer: def __init__(self, path, hostname, port): """Initialize simple HTTP server (separate thread) :param path: Current path :param hostname: Hostname :param port: Port""" self.path = path self.hostname = hostname self.port = port Thread.__init__(self) d...
the_stack_v2_python_sparse
pm4py/services/http_server.py
jiseungshin/pm4py-source
train
0
dc85cc6c28b06b297d5dd71a65852af96830a754
[ "N, C, H, W = features.shape\nfeatures_c = torch.reshape(features, (N, C, H * W))\nfeatures_c_tp = torch.transpose(features_c, 1, 2)\ngram = torch.bmm(features_c, features_c_tp)\nif normalize:\n gram = gram / (H * W * C)\nreturn gram", "for i in range(len(style_layers)):\n source_gram = style_targets[i]\n ...
<|body_start_0|> N, C, H, W = features.shape features_c = torch.reshape(features, (N, C, H * W)) features_c_tp = torch.transpose(features_c, 1, 2) gram = torch.bmm(features_c, features_c_tp) if normalize: gram = gram / (H * W * C) return gram <|end_body_0|> <...
StyleLoss
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StyleLoss: def gram_matrix(self, features, normalize=True): """Compute the Gram matrix from features. Inputs: - features: PyTorch Variable of shape (N, C, H, W) giving features for a batch of N images. - normalize: optional, whether to normalize the Gram matrix If True, divide the Gram m...
stack_v2_sparse_classes_36k_train_015598
4,905
permissive
[ { "docstring": "Compute the Gram matrix from features. Inputs: - features: PyTorch Variable of shape (N, C, H, W) giving features for a batch of N images. - normalize: optional, whether to normalize the Gram matrix If True, divide the Gram matrix by the number of neurons (H * W * C) Returns: - gram: PyTorch Var...
2
null
Implement the Python class `StyleLoss` described below. Class description: Implement the StyleLoss class. Method signatures and docstrings: - def gram_matrix(self, features, normalize=True): Compute the Gram matrix from features. Inputs: - features: PyTorch Variable of shape (N, C, H, W) giving features for a batch o...
Implement the Python class `StyleLoss` described below. Class description: Implement the StyleLoss class. Method signatures and docstrings: - def gram_matrix(self, features, normalize=True): Compute the Gram matrix from features. Inputs: - features: PyTorch Variable of shape (N, C, H, W) giving features for a batch o...
86980338208c702b6bfcbcfffdb18498e389a56b
<|skeleton|> class StyleLoss: def gram_matrix(self, features, normalize=True): """Compute the Gram matrix from features. Inputs: - features: PyTorch Variable of shape (N, C, H, W) giving features for a batch of N images. - normalize: optional, whether to normalize the Gram matrix If True, divide the Gram m...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StyleLoss: def gram_matrix(self, features, normalize=True): """Compute the Gram matrix from features. Inputs: - features: PyTorch Variable of shape (N, C, H, W) giving features for a batch of N images. - normalize: optional, whether to normalize the Gram matrix If True, divide the Gram matrix by the n...
the_stack_v2_python_sparse
Pytorch/Visualization/style_modules/style_loss.py
Kuga23/Deep-Learning
train
1
6f5789fc1afc8f280a81adefc1eee623bda2d679
[ "errors = []\nif len(player.getNume()) == 0:\n errors.append('Numele nu poate fi vid')\nif len(player.getPrenume()) == 0:\n errors.append('Prenumele nu poate fi vid')\nif self.__isInt(player.getInaltime()):\n if int(player.getInaltime()) <= 0:\n errors.append('Inaltimea trebuie sa fie un numar pozit...
<|body_start_0|> errors = [] if len(player.getNume()) == 0: errors.append('Numele nu poate fi vid') if len(player.getPrenume()) == 0: errors.append('Prenumele nu poate fi vid') if self.__isInt(player.getInaltime()): if int(player.getInaltime()) <= 0: ...
Validator Class
Validator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Validator: """Validator Class""" def validateJucator(self, player): """Valideaza un jucator astfel : - numele si prenumele sa nu fie vide - inaltimea sa fie un numar pozitiv - postul sa fie unul din urmatoarele : Fundas, Pivot, Extrema Daca exista exceptii se vor arunca :param player...
stack_v2_sparse_classes_36k_train_015599
1,386
no_license
[ { "docstring": "Valideaza un jucator astfel : - numele si prenumele sa nu fie vide - inaltimea sa fie un numar pozitiv - postul sa fie unul din urmatoarele : Fundas, Pivot, Extrema Daca exista exceptii se vor arunca :param player: :return: None", "name": "validateJucator", "signature": "def validateJuca...
2
stack_v2_sparse_classes_30k_val_000406
Implement the Python class `Validator` described below. Class description: Validator Class Method signatures and docstrings: - def validateJucator(self, player): Valideaza un jucator astfel : - numele si prenumele sa nu fie vide - inaltimea sa fie un numar pozitiv - postul sa fie unul din urmatoarele : Fundas, Pivot,...
Implement the Python class `Validator` described below. Class description: Validator Class Method signatures and docstrings: - def validateJucator(self, player): Valideaza un jucator astfel : - numele si prenumele sa nu fie vide - inaltimea sa fie un numar pozitiv - postul sa fie unul din urmatoarele : Fundas, Pivot,...
57c96f9c9c83a63c57f6c2d003ac0409dd8f068f
<|skeleton|> class Validator: """Validator Class""" def validateJucator(self, player): """Valideaza un jucator astfel : - numele si prenumele sa nu fie vide - inaltimea sa fie un numar pozitiv - postul sa fie unul din urmatoarele : Fundas, Pivot, Extrema Daca exista exceptii se vor arunca :param player...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Validator: """Validator Class""" def validateJucator(self, player): """Valideaza un jucator astfel : - numele si prenumele sa nu fie vide - inaltimea sa fie un numar pozitiv - postul sa fie unul din urmatoarele : Fundas, Pivot, Extrema Daca exista exceptii se vor arunca :param player: :return: No...
the_stack_v2_python_sparse
Examen Fp/Domain/Validator.py
alexvasiu/FP-Labs
train
0