blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
7.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
467
8.64k
id
stringlengths
40
40
length_bytes
int64
515
49.7k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
160
3.93k
prompted_full_text
stringlengths
681
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.09k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
331
8.3k
source
stringclasses
1 value
source_path
stringlengths
5
177
source_repo
stringlengths
6
88
split
stringclasses
1 value
star_events_count
int64
0
209k
091df8021a7aefc4e82ee59844e89e232a859dac
[ "if k <= 1:\n return 0\nprod = 1\nans = left = 0\nfor right, val in enumerate(nums):\n prod *= val\n while prod >= k:\n prod /= nums[left]\n left += 1\n ans += right - left + 1\nreturn ans", "count = 0\nlast = 0\nfor i in range(len(nums)):\n if nums[i] >= k:\n last = i\n ...
<|body_start_0|> if k <= 1: return 0 prod = 1 ans = left = 0 for right, val in enumerate(nums): prod *= val while prod >= k: prod /= nums[left] left += 1 ans += right - left + 1 return ans <|end_body_...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def numSubarrayProductLessThanK(self, nums, k): """:type nums: List[int] :type k: int :rtype: int""" <|body_0|> def numSubarrayProductLessThanK0(self, nums, k): """:type nums: List[int] :type k: int :rtype: int""" <|body_1|> <|end_skeleton|> <|bod...
stack_v2_sparse_classes_10k_train_004300
1,743
no_license
[ { "docstring": ":type nums: List[int] :type k: int :rtype: int", "name": "numSubarrayProductLessThanK", "signature": "def numSubarrayProductLessThanK(self, nums, k)" }, { "docstring": ":type nums: List[int] :type k: int :rtype: int", "name": "numSubarrayProductLessThanK0", "signature": "...
2
stack_v2_sparse_classes_30k_train_003497
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numSubarrayProductLessThanK(self, nums, k): :type nums: List[int] :type k: int :rtype: int - def numSubarrayProductLessThanK0(self, nums, k): :type nums: List[int] :type k: i...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numSubarrayProductLessThanK(self, nums, k): :type nums: List[int] :type k: int :rtype: int - def numSubarrayProductLessThanK0(self, nums, k): :type nums: List[int] :type k: i...
6e18c5d257840489cc3fb1079ae3804c743982a4
<|skeleton|> class Solution: def numSubarrayProductLessThanK(self, nums, k): """:type nums: List[int] :type k: int :rtype: int""" <|body_0|> def numSubarrayProductLessThanK0(self, nums, k): """:type nums: List[int] :type k: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def numSubarrayProductLessThanK(self, nums, k): """:type nums: List[int] :type k: int :rtype: int""" if k <= 1: return 0 prod = 1 ans = left = 0 for right, val in enumerate(nums): prod *= val while prod >= k: ...
the_stack_v2_python_sparse
剑指 Offer II 009. 乘积小于 K 的子数组.py
yangyuxiang1996/leetcode
train
0
c0786cd138ea47293d63911108d026d7a16b37c7
[ "test_graph = class_dependency.JavaClassDependencyGraph()\ntest_graph.add_edge_if_new(self.CLASS_1, self.CLASS_2)\ntest_graph.add_edge_if_new(self.CLASS_1, self.CLASS_3)\ntest_graph.add_edge_if_new(self.CLASS_2, self.CLASS_3)\ntest_graph.get_node_by_key(self.CLASS_1).add_nested_class(self.CLASS_1_NESTED_1)\ntest_gr...
<|body_start_0|> test_graph = class_dependency.JavaClassDependencyGraph() test_graph.add_edge_if_new(self.CLASS_1, self.CLASS_2) test_graph.add_edge_if_new(self.CLASS_1, self.CLASS_3) test_graph.add_edge_if_new(self.CLASS_2, self.CLASS_3) test_graph.get_node_by_key(self.CLASS_1)....
Unit tests for various de/serialization functions.
TestSerialization
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestSerialization: """Unit tests for various de/serialization functions.""" def test_class_serialization(self): """Tests JSON serialization of a class dependency graph.""" <|body_0|> def test_package_serialization(self): """Tests JSON serialization of a package d...
stack_v2_sparse_classes_10k_train_004301
7,187
permissive
[ { "docstring": "Tests JSON serialization of a class dependency graph.", "name": "test_class_serialization", "signature": "def test_class_serialization(self)" }, { "docstring": "Tests JSON serialization of a package dependency graph.", "name": "test_package_serialization", "signature": "d...
3
null
Implement the Python class `TestSerialization` described below. Class description: Unit tests for various de/serialization functions. Method signatures and docstrings: - def test_class_serialization(self): Tests JSON serialization of a class dependency graph. - def test_package_serialization(self): Tests JSON seriali...
Implement the Python class `TestSerialization` described below. Class description: Unit tests for various de/serialization functions. Method signatures and docstrings: - def test_class_serialization(self): Tests JSON serialization of a class dependency graph. - def test_package_serialization(self): Tests JSON seriali...
a401d6cf4f7bf0e2d2e964c512ebb923c3d8832c
<|skeleton|> class TestSerialization: """Unit tests for various de/serialization functions.""" def test_class_serialization(self): """Tests JSON serialization of a class dependency graph.""" <|body_0|> def test_package_serialization(self): """Tests JSON serialization of a package d...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestSerialization: """Unit tests for various de/serialization functions.""" def test_class_serialization(self): """Tests JSON serialization of a class dependency graph.""" test_graph = class_dependency.JavaClassDependencyGraph() test_graph.add_edge_if_new(self.CLASS_1, self.CLASS_...
the_stack_v2_python_sparse
tools/android/dependency_analysis/serialization_unittest.py
chromium/chromium
train
17,408
f69d4851f1b9bcf927a08eeea912151e6891a696
[ "self.word_dict = defaultdict(list)\nfor i, w in enumerate(words):\n self.word_dict[w].append(i)", "mini = sys.maxint\nfor i in self.word_dict[word1]:\n idx = bisect_left(self.word_dict[word2], i)\n for nei in (-1, 0):\n if 0 <= idx + nei < len(self.word_dict[word2]):\n mini = min(mini,...
<|body_start_0|> self.word_dict = defaultdict(list) for i, w in enumerate(words): self.word_dict[w].append(i) <|end_body_0|> <|body_start_1|> mini = sys.maxint for i in self.word_dict[word1]: idx = bisect_left(self.word_dict[word2], i) for nei in (-1,...
WordDistance
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WordDistance: def __init__(self, words): """initialize your data structure here. :type words: list[str]""" <|body_0|> def shortest(self, word1, word2): """:type word1: str :type word2: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_10k_train_004302
857
permissive
[ { "docstring": "initialize your data structure here. :type words: list[str]", "name": "__init__", "signature": "def __init__(self, words)" }, { "docstring": ":type word1: str :type word2: str :rtype: int", "name": "shortest", "signature": "def shortest(self, word1, word2)" } ]
2
null
Implement the Python class `WordDistance` described below. Class description: Implement the WordDistance class. Method signatures and docstrings: - def __init__(self, words): initialize your data structure here. :type words: list[str] - def shortest(self, word1, word2): :type word1: str :type word2: str :rtype: int
Implement the Python class `WordDistance` described below. Class description: Implement the WordDistance class. Method signatures and docstrings: - def __init__(self, words): initialize your data structure here. :type words: list[str] - def shortest(self, word1, word2): :type word1: str :type word2: str :rtype: int ...
cbbd4a67ab342ada2421e13f82d660b1d47d4d20
<|skeleton|> class WordDistance: def __init__(self, words): """initialize your data structure here. :type words: list[str]""" <|body_0|> def shortest(self, word1, word2): """:type word1: str :type word2: str :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class WordDistance: def __init__(self, words): """initialize your data structure here. :type words: list[str]""" self.word_dict = defaultdict(list) for i, w in enumerate(words): self.word_dict[w].append(i) def shortest(self, word1, word2): """:type word1: str :type w...
the_stack_v2_python_sparse
244 Shortest Word Distance II.py
Aminaba123/LeetCode
train
1
63720050e77782b857fd001ea0985f1da416b840
[ "self.numIslands = 0\nif not grid:\n return 0\nnumRows = len(grid)\nnumCols = len(grid[0])\n\ndef isValid(grid, row, col):\n return row >= 0 and col >= 0 and (row < numRows) and (col < numCols) and (grid[row][col] == '1')\n\ndef bfs(grid, row, col):\n self.numIslands += 1\n stack = [(row, col)]\n whi...
<|body_start_0|> self.numIslands = 0 if not grid: return 0 numRows = len(grid) numCols = len(grid[0]) def isValid(grid, row, col): return row >= 0 and col >= 0 and (row < numRows) and (col < numCols) and (grid[row][col] == '1') def bfs(grid, row,...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def numIslands(self, grid): """:type grid: List[List[str]] :rtype: int""" <|body_0|> def numIslandsDFS(self, grid): """:type grid: List[List[str]] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.numIslands = 0 if n...
stack_v2_sparse_classes_10k_train_004303
4,234
no_license
[ { "docstring": ":type grid: List[List[str]] :rtype: int", "name": "numIslands", "signature": "def numIslands(self, grid)" }, { "docstring": ":type grid: List[List[str]] :rtype: int", "name": "numIslandsDFS", "signature": "def numIslandsDFS(self, grid)" } ]
2
stack_v2_sparse_classes_30k_train_000620
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numIslands(self, grid): :type grid: List[List[str]] :rtype: int - def numIslandsDFS(self, grid): :type grid: List[List[str]] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numIslands(self, grid): :type grid: List[List[str]] :rtype: int - def numIslandsDFS(self, grid): :type grid: List[List[str]] :rtype: int <|skeleton|> class Solution: de...
28219fbc5e2e96f59e9d2b9d1da18f05187898c8
<|skeleton|> class Solution: def numIslands(self, grid): """:type grid: List[List[str]] :rtype: int""" <|body_0|> def numIslandsDFS(self, grid): """:type grid: List[List[str]] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def numIslands(self, grid): """:type grid: List[List[str]] :rtype: int""" self.numIslands = 0 if not grid: return 0 numRows = len(grid) numCols = len(grid[0]) def isValid(grid, row, col): return row >= 0 and col >= 0 and (row <...
the_stack_v2_python_sparse
2018/200-number-of-islands.py
the-potato-man/lc
train
0
002c469bd1ed9c15918a9194cb968ec187203d0b
[ "self.check_file(infile, need_seek)\nself.infile = infile\nself.closed = self.infile_closed = None\nself.inbuf = ''\nself.outbuf = array.array('c')\nself.eof = self.infile_eof = None", "if not hasattr(file, 'read'):\n raise TypeError('Basis file must have a read() method')\nif not hasattr(file, 'close'):\n ...
<|body_start_0|> self.check_file(infile, need_seek) self.infile = infile self.closed = self.infile_closed = None self.inbuf = '' self.outbuf = array.array('c') self.eof = self.infile_eof = None <|end_body_0|> <|body_start_1|> if not hasattr(file, 'read'): ...
File-like object used by SigFile, DeltaFile, and PatchFile
LikeFile
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LikeFile: """File-like object used by SigFile, DeltaFile, and PatchFile""" def __init__(self, infile, need_seek=None): """LikeFile initializer - zero buffers, set eofs off""" <|body_0|> def check_file(self, file, need_seek=None): """Raise type error if file doesn...
stack_v2_sparse_classes_10k_train_004304
8,383
no_license
[ { "docstring": "LikeFile initializer - zero buffers, set eofs off", "name": "__init__", "signature": "def __init__(self, infile, need_seek=None)" }, { "docstring": "Raise type error if file doesn't have necessary attributes", "name": "check_file", "signature": "def check_file(self, file,...
6
stack_v2_sparse_classes_30k_train_003825
Implement the Python class `LikeFile` described below. Class description: File-like object used by SigFile, DeltaFile, and PatchFile Method signatures and docstrings: - def __init__(self, infile, need_seek=None): LikeFile initializer - zero buffers, set eofs off - def check_file(self, file, need_seek=None): Raise typ...
Implement the Python class `LikeFile` described below. Class description: File-like object used by SigFile, DeltaFile, and PatchFile Method signatures and docstrings: - def __init__(self, infile, need_seek=None): LikeFile initializer - zero buffers, set eofs off - def check_file(self, file, need_seek=None): Raise typ...
ef6d0f4bdff52be379784325e504de22cfe149de
<|skeleton|> class LikeFile: """File-like object used by SigFile, DeltaFile, and PatchFile""" def __init__(self, infile, need_seek=None): """LikeFile initializer - zero buffers, set eofs off""" <|body_0|> def check_file(self, file, need_seek=None): """Raise type error if file doesn...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LikeFile: """File-like object used by SigFile, DeltaFile, and PatchFile""" def __init__(self, infile, need_seek=None): """LikeFile initializer - zero buffers, set eofs off""" self.check_file(infile, need_seek) self.infile = infile self.closed = self.infile_closed = None ...
the_stack_v2_python_sparse
duplicity/librsync.py
henrysher/duplicity
train
90
77ea59edc75bc37bbb84ebc9e8b4a6a458150b94
[ "items = []\ncount = read_fmt('I', fp)[0]\nfor _ in range(count):\n key = OSType(fp.read(4))\n kls = TYPES.get(key)\n value = kls.read(fp)\n items.append(value)\nreturn cls(items)", "written = write_fmt(fp, 'I', len(self))\nfor item in self:\n written += write_bytes(fp, item.ostype.value)\n writ...
<|body_start_0|> items = [] count = read_fmt('I', fp)[0] for _ in range(count): key = OSType(fp.read(4)) kls = TYPES.get(key) value = kls.read(fp) items.append(value) return cls(items) <|end_body_0|> <|body_start_1|> written = writ...
List structure. .. py:attribute:: items
List
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class List: """List structure. .. py:attribute:: items""" def read(cls, fp): """Read the element from a file-like object. :param fp: file-like object""" <|body_0|> def write(self, fp): """Write the element to a file-like object. :param fp: file-like object""" <...
stack_v2_sparse_classes_10k_train_004305
19,890
permissive
[ { "docstring": "Read the element from a file-like object. :param fp: file-like object", "name": "read", "signature": "def read(cls, fp)" }, { "docstring": "Write the element to a file-like object. :param fp: file-like object", "name": "write", "signature": "def write(self, fp)" } ]
2
stack_v2_sparse_classes_30k_train_006587
Implement the Python class `List` described below. Class description: List structure. .. py:attribute:: items Method signatures and docstrings: - def read(cls, fp): Read the element from a file-like object. :param fp: file-like object - def write(self, fp): Write the element to a file-like object. :param fp: file-lik...
Implement the Python class `List` described below. Class description: List structure. .. py:attribute:: items Method signatures and docstrings: - def read(cls, fp): Read the element from a file-like object. :param fp: file-like object - def write(self, fp): Write the element to a file-like object. :param fp: file-lik...
0e3ac5b64061c7eb87c6eeacce4b9792d1f479b5
<|skeleton|> class List: """List structure. .. py:attribute:: items""" def read(cls, fp): """Read the element from a file-like object. :param fp: file-like object""" <|body_0|> def write(self, fp): """Write the element to a file-like object. :param fp: file-like object""" <...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class List: """List structure. .. py:attribute:: items""" def read(cls, fp): """Read the element from a file-like object. :param fp: file-like object""" items = [] count = read_fmt('I', fp)[0] for _ in range(count): key = OSType(fp.read(4)) kls = TYPES.ge...
the_stack_v2_python_sparse
psd_tools/psd/descriptor.py
sfneal/psd-tools3
train
30
e40ff04e83b425bb0e4116a2b3307c82727f2117
[ "super(TransformerDecoder, self).__init__()\nself._hidden_size = opts.hidden_size\nself._output_size = opts.embedding_dim\nself.layers = nn.ModuleList([TransformerDecoderLayer(opts, size=opts.hidden_size, ff_size=opts.ff_size, num_heads=opts.num_heads, dropout=opts.dropout) for _ in range(opts.num_layers)])\nself.p...
<|body_start_0|> super(TransformerDecoder, self).__init__() self._hidden_size = opts.hidden_size self._output_size = opts.embedding_dim self.layers = nn.ModuleList([TransformerDecoderLayer(opts, size=opts.hidden_size, ff_size=opts.ff_size, num_heads=opts.num_heads, dropout=opts.dropout) ...
A transformer decoder with N masked layers. Decoder layers are masked so that an attention head cannot see the future.
TransformerDecoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TransformerDecoder: """A transformer decoder with N masked layers. Decoder layers are masked so that an attention head cannot see the future.""" def __init__(self, opts, freeze: bool=False, **kwargs): """Initialize a Transformer decoder. :param num_layers: number of Transformer layer...
stack_v2_sparse_classes_10k_train_004306
4,320
no_license
[ { "docstring": "Initialize a Transformer decoder. :param num_layers: number of Transformer layers :param num_heads: number of heads for each layer :param hidden_size: hidden size :param ff_size: position-wise feed-forward size :param dropout: dropout probability (1-keep) :param emb_dropout: dropout probability ...
2
stack_v2_sparse_classes_30k_train_005510
Implement the Python class `TransformerDecoder` described below. Class description: A transformer decoder with N masked layers. Decoder layers are masked so that an attention head cannot see the future. Method signatures and docstrings: - def __init__(self, opts, freeze: bool=False, **kwargs): Initialize a Transforme...
Implement the Python class `TransformerDecoder` described below. Class description: A transformer decoder with N masked layers. Decoder layers are masked so that an attention head cannot see the future. Method signatures and docstrings: - def __init__(self, opts, freeze: bool=False, **kwargs): Initialize a Transforme...
e213665be8d3820fa2fc0aa9afe9949fd2e3d488
<|skeleton|> class TransformerDecoder: """A transformer decoder with N masked layers. Decoder layers are masked so that an attention head cannot see the future.""" def __init__(self, opts, freeze: bool=False, **kwargs): """Initialize a Transformer decoder. :param num_layers: number of Transformer layer...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TransformerDecoder: """A transformer decoder with N masked layers. Decoder layers are masked so that an attention head cannot see the future.""" def __init__(self, opts, freeze: bool=False, **kwargs): """Initialize a Transformer decoder. :param num_layers: number of Transformer layers :param num_...
the_stack_v2_python_sparse
modules/transformer_decoder.py
zqp111/transformer_ar
train
1
02147fa3790e806bacbb50431c4ae4eb587cdd51
[ "if hasattr(cls, '_default_tags'):\n tags = cls._default_tags()\nelse:\n tags = deepcopy(_default_tags)\nfor cl in reversed(inspect.getmro(cls)):\n if hasattr(cl, '_more_static_tags'):\n more_tags = cl._more_static_tags()\n tags.update(more_tags)\nreturn tags", "if hasattr(self, '_default_t...
<|body_start_0|> if hasattr(cls, '_default_tags'): tags = cls._default_tags() else: tags = deepcopy(_default_tags) for cl in reversed(inspect.getmro(cls)): if hasattr(cl, '_more_static_tags'): more_tags = cl._more_static_tags() ...
TagsMixin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TagsMixin: def _get_tags(cls): """Method that collects all the static tags associated to any inheritting class. The Base class for cuML's estimators already uses this mixin, so most estimators don't need to use this Mixin directly. - Tags usage: In general, inheriting classes can use the...
stack_v2_sparse_classes_10k_train_004307
10,726
permissive
[ { "docstring": "Method that collects all the static tags associated to any inheritting class. The Base class for cuML's estimators already uses this mixin, so most estimators don't need to use this Mixin directly. - Tags usage: In general, inheriting classes can use the appropriate Mixins defined in this file. ...
2
stack_v2_sparse_classes_30k_train_001509
Implement the Python class `TagsMixin` described below. Class description: Implement the TagsMixin class. Method signatures and docstrings: - def _get_tags(cls): Method that collects all the static tags associated to any inheritting class. The Base class for cuML's estimators already uses this mixin, so most estimato...
Implement the Python class `TagsMixin` described below. Class description: Implement the TagsMixin class. Method signatures and docstrings: - def _get_tags(cls): Method that collects all the static tags associated to any inheritting class. The Base class for cuML's estimators already uses this mixin, so most estimato...
7d86042b8de06bc8acce632230fe5821bd36c17d
<|skeleton|> class TagsMixin: def _get_tags(cls): """Method that collects all the static tags associated to any inheritting class. The Base class for cuML's estimators already uses this mixin, so most estimators don't need to use this Mixin directly. - Tags usage: In general, inheriting classes can use the...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TagsMixin: def _get_tags(cls): """Method that collects all the static tags associated to any inheritting class. The Base class for cuML's estimators already uses this mixin, so most estimators don't need to use this Mixin directly. - Tags usage: In general, inheriting classes can use the appropriate M...
the_stack_v2_python_sparse
python/cuml/internals/mixins.py
rapidsai/cuml
train
3,615
55dc1ccf0a009ba7c6302577b9e058650eb2c233
[ "from django.core.exceptions import ObjectDoesNotExist\nresult = super(UserSerializer, self).to_representation(value)\nif result['tenant_admin'] and result['tenant']:\n try:\n row = Tenant.objects.get(pk=result['tenant'])\n except ObjectDoesNotExist:\n logger.warning('Tenant_admin without a tena...
<|body_start_0|> from django.core.exceptions import ObjectDoesNotExist result = super(UserSerializer, self).to_representation(value) if result['tenant_admin'] and result['tenant']: try: row = Tenant.objects.get(pk=result['tenant']) except ObjectDoesNotExis...
Expose a subset of the available User fields, treat some as read-only, and allow tenant_adminds to read/write their Cloud row. This presently handles at most one Goldstone tenant per user, and at most one OpenStack cloud per tenant.
UserSerializer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserSerializer: """Expose a subset of the available User fields, treat some as read-only, and allow tenant_adminds to read/write their Cloud row. This presently handles at most one Goldstone tenant per user, and at most one OpenStack cloud per tenant.""" def to_representation(self, value): ...
stack_v2_sparse_classes_10k_train_004308
5,786
permissive
[ { "docstring": "Include Goldstone tenant and cloud information if the user is a tenant_admin.", "name": "to_representation", "signature": "def to_representation(self, value)" }, { "docstring": "Update the corresponding Cloud row for this User, if she is a tenant_admin AND changed any Cloud field...
2
stack_v2_sparse_classes_30k_test_000214
Implement the Python class `UserSerializer` described below. Class description: Expose a subset of the available User fields, treat some as read-only, and allow tenant_adminds to read/write their Cloud row. This presently handles at most one Goldstone tenant per user, and at most one OpenStack cloud per tenant. Metho...
Implement the Python class `UserSerializer` described below. Class description: Expose a subset of the available User fields, treat some as read-only, and allow tenant_adminds to read/write their Cloud row. This presently handles at most one Goldstone tenant per user, and at most one OpenStack cloud per tenant. Metho...
d7f1f1f1ff926148d2aa541d0bd4758173aa76d5
<|skeleton|> class UserSerializer: """Expose a subset of the available User fields, treat some as read-only, and allow tenant_adminds to read/write their Cloud row. This presently handles at most one Goldstone tenant per user, and at most one OpenStack cloud per tenant.""" def to_representation(self, value): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UserSerializer: """Expose a subset of the available User fields, treat some as read-only, and allow tenant_adminds to read/write their Cloud row. This presently handles at most one Goldstone tenant per user, and at most one OpenStack cloud per tenant.""" def to_representation(self, value): """Inc...
the_stack_v2_python_sparse
goldstone/user/views.py
leftees/goldstone-server
train
0
7990368a530c83377c1c11cb43a1fa37ff7ad768
[ "self.debug = False\nself.name = 'featurizer'\nself.epsilon = 1e-08\nself.max_num_inputs = max_num_inputs\nif max_num_features is None:\n self.max_num_bundles = 3 * self.max_num_inputs\n self.max_num_features = self.max_num_inputs + self.max_num_bundles\nelse:\n self.max_num_features = max_num_features\n ...
<|body_start_0|> self.debug = False self.name = 'featurizer' self.epsilon = 1e-08 self.max_num_inputs = max_num_inputs if max_num_features is None: self.max_num_bundles = 3 * self.max_num_inputs self.max_num_features = self.max_num_inputs + self.max_num_bu...
Convert inputs to bundles and learn new bundles. Inputs are transformed into bundles, sets of inputs that tend to co-occur.
Featurizer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Featurizer: """Convert inputs to bundles and learn new bundles. Inputs are transformed into bundles, sets of inputs that tend to co-occur.""" def __init__(self, max_num_inputs, max_num_features=None): """Configure the featurizer. Parameters --------- max_num_inputs : int See Featuriz...
stack_v2_sparse_classes_10k_train_004309
8,848
permissive
[ { "docstring": "Configure the featurizer. Parameters --------- max_num_inputs : int See Featurizer.max_num_inputs. max_num_features : int See Featurizer.max_num_features.", "name": "__init__", "signature": "def __init__(self, max_num_inputs, max_num_features=None)" }, { "docstring": "Learn bundl...
5
stack_v2_sparse_classes_30k_train_005015
Implement the Python class `Featurizer` described below. Class description: Convert inputs to bundles and learn new bundles. Inputs are transformed into bundles, sets of inputs that tend to co-occur. Method signatures and docstrings: - def __init__(self, max_num_inputs, max_num_features=None): Configure the featurize...
Implement the Python class `Featurizer` described below. Class description: Convert inputs to bundles and learn new bundles. Inputs are transformed into bundles, sets of inputs that tend to co-occur. Method signatures and docstrings: - def __init__(self, max_num_inputs, max_num_features=None): Configure the featurize...
85ee5f530717518b1b43ba9a310e4f0d70b290a4
<|skeleton|> class Featurizer: """Convert inputs to bundles and learn new bundles. Inputs are transformed into bundles, sets of inputs that tend to co-occur.""" def __init__(self, max_num_inputs, max_num_features=None): """Configure the featurizer. Parameters --------- max_num_inputs : int See Featuriz...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Featurizer: """Convert inputs to bundles and learn new bundles. Inputs are transformed into bundles, sets of inputs that tend to co-occur.""" def __init__(self, max_num_inputs, max_num_features=None): """Configure the featurizer. Parameters --------- max_num_inputs : int See Featurizer.max_num_in...
the_stack_v2_python_sparse
becca/featurizer.py
microgold/Becca35
train
1
1a1a1961fd6805a8d208a63e22b447c6fa2da7da
[ "self._sizes = sizes\nself._opts = opts\nself._X = X\nself._Y = Y\nself.w_list = []\nself.b_list = []\ninput_size = X.shape[1]\nfor size in self._sizes + [Y.shape[1]]:\n max_range = 4 * math.sqrt(6.0 / (input_size + size))\n self.w_list.append(np.random.uniform(-max_range, max_range, [input_size, size]).astyp...
<|body_start_0|> self._sizes = sizes self._opts = opts self._X = X self._Y = Y self.w_list = [] self.b_list = [] input_size = X.shape[1] for size in self._sizes + [Y.shape[1]]: max_range = 4 * math.sqrt(6.0 / (input_size + size)) se...
Docstring for NN.
NN
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NN: """Docstring for NN.""" def __init__(self, sizes, opts, X, Y): """TODO: to be defined1. :sizes: TODO :opts: TODO :X: TODO""" <|body_0|> def load_from_dbn(self, dbn): """TODO: Docstring for load_from_dbn. :dbn: TODO :returns: TODO""" <|body_1|> de...
stack_v2_sparse_classes_10k_train_004310
4,462
permissive
[ { "docstring": "TODO: to be defined1. :sizes: TODO :opts: TODO :X: TODO", "name": "__init__", "signature": "def __init__(self, sizes, opts, X, Y)" }, { "docstring": "TODO: Docstring for load_from_dbn. :dbn: TODO :returns: TODO", "name": "load_from_dbn", "signature": "def load_from_dbn(se...
4
stack_v2_sparse_classes_30k_train_003079
Implement the Python class `NN` described below. Class description: Docstring for NN. Method signatures and docstrings: - def __init__(self, sizes, opts, X, Y): TODO: to be defined1. :sizes: TODO :opts: TODO :X: TODO - def load_from_dbn(self, dbn): TODO: Docstring for load_from_dbn. :dbn: TODO :returns: TODO - def tr...
Implement the Python class `NN` described below. Class description: Docstring for NN. Method signatures and docstrings: - def __init__(self, sizes, opts, X, Y): TODO: to be defined1. :sizes: TODO :opts: TODO :X: TODO - def load_from_dbn(self, dbn): TODO: Docstring for load_from_dbn. :dbn: TODO :returns: TODO - def tr...
289f230a609554db32552670c300f992a3fe068f
<|skeleton|> class NN: """Docstring for NN.""" def __init__(self, sizes, opts, X, Y): """TODO: to be defined1. :sizes: TODO :opts: TODO :X: TODO""" <|body_0|> def load_from_dbn(self, dbn): """TODO: Docstring for load_from_dbn. :dbn: TODO :returns: TODO""" <|body_1|> de...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class NN: """Docstring for NN.""" def __init__(self, sizes, opts, X, Y): """TODO: to be defined1. :sizes: TODO :opts: TODO :X: TODO""" self._sizes = sizes self._opts = opts self._X = X self._Y = Y self.w_list = [] self.b_list = [] input_size = X.s...
the_stack_v2_python_sparse
bagging-svm/nn_tf.py
ishidaira233/TX-Credit-Assessement
train
0
c947f0277a106e692da2ec18fa03cc0049c88267
[ "self.output_filename = output_filename\nself.onet_source = onet_source\nself.hash_function = hash_function\nself.ksa_types = ksa_types or KSA_TYPE_CONFIG.keys()", "logging.info('Converting ONET %s to pandas', filename)\nwith self.onet_source.ensure_file(filename) as fullpath:\n with open(fullpath) as f:\n ...
<|body_start_0|> self.output_filename = output_filename self.onet_source = onet_source self.hash_function = hash_function self.ksa_types = ksa_types or KSA_TYPE_CONFIG.keys() <|end_body_0|> <|body_start_1|> logging.info('Converting ONET %s to pandas', filename) with self...
An object that creates a skills CSV based on ONET data Originally written by Kwame Porter Robinson
OnetSkillListProcessor
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OnetSkillListProcessor: """An object that creates a skills CSV based on ONET data Originally written by Kwame Porter Robinson""" def __init__(self, onet_source, output_filename, hash_function, ksa_types=None): """Args: output_filename: A filename to write the final dataset onet_sourc...
stack_v2_sparse_classes_10k_train_004311
4,463
permissive
[ { "docstring": "Args: output_filename: A filename to write the final dataset onet_source: An object that is able to fetch ONET files by name hash_function: A function that can hash a given string ksa_types: A list of onet skill types to include. All strings must be keys in KSA_TYPE_CONFIG. Defaults to all keys ...
3
stack_v2_sparse_classes_30k_train_001064
Implement the Python class `OnetSkillListProcessor` described below. Class description: An object that creates a skills CSV based on ONET data Originally written by Kwame Porter Robinson Method signatures and docstrings: - def __init__(self, onet_source, output_filename, hash_function, ksa_types=None): Args: output_f...
Implement the Python class `OnetSkillListProcessor` described below. Class description: An object that creates a skills CSV based on ONET data Originally written by Kwame Porter Robinson Method signatures and docstrings: - def __init__(self, onet_source, output_filename, hash_function, ksa_types=None): Args: output_f...
feffead90815ccdecf24bf1a995f79683442b046
<|skeleton|> class OnetSkillListProcessor: """An object that creates a skills CSV based on ONET data Originally written by Kwame Porter Robinson""" def __init__(self, onet_source, output_filename, hash_function, ksa_types=None): """Args: output_filename: A filename to write the final dataset onet_sourc...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class OnetSkillListProcessor: """An object that creates a skills CSV based on ONET data Originally written by Kwame Porter Robinson""" def __init__(self, onet_source, output_filename, hash_function, ksa_types=None): """Args: output_filename: A filename to write the final dataset onet_source: An object ...
the_stack_v2_python_sparse
skills_ml/datasets/skills/onet_ksat.py
workforce-data-initiative/skills-ml
train
164
cf451ca487aad058e094699c4823c50274f84efb
[ "self._context = context or google.datalab.Context.default()\nself._client = _utils.make_client(self._context)\nself._group_dict = None", "if self._group_dict is None:\n self._group_dict = collections.OrderedDict(((group.name, group) for group in self._client.list_groups()))\nreturn [group for group in self._g...
<|body_start_0|> self._context = context or google.datalab.Context.default() self._client = _utils.make_client(self._context) self._group_dict = None <|end_body_0|> <|body_start_1|> if self._group_dict is None: self._group_dict = collections.OrderedDict(((group.name, group) ...
Represents a list of Stackdriver groups for a project.
Groups
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Groups: """Represents a list of Stackdriver groups for a project.""" def __init__(self, context=None): """Initializes the Groups for a Stackdriver project. Args: context: An optional Context object to use instead of the global default.""" <|body_0|> def list(self, patter...
stack_v2_sparse_classes_10k_train_004312
2,940
permissive
[ { "docstring": "Initializes the Groups for a Stackdriver project. Args: context: An optional Context object to use instead of the global default.", "name": "__init__", "signature": "def __init__(self, context=None)" }, { "docstring": "Returns a list of groups that match the filters. Args: patter...
3
stack_v2_sparse_classes_30k_train_000707
Implement the Python class `Groups` described below. Class description: Represents a list of Stackdriver groups for a project. Method signatures and docstrings: - def __init__(self, context=None): Initializes the Groups for a Stackdriver project. Args: context: An optional Context object to use instead of the global ...
Implement the Python class `Groups` described below. Class description: Represents a list of Stackdriver groups for a project. Method signatures and docstrings: - def __init__(self, context=None): Initializes the Groups for a Stackdriver project. Args: context: An optional Context object to use instead of the global ...
8bf007da3e43096aa3a3dca158fc56b286ba6f5c
<|skeleton|> class Groups: """Represents a list of Stackdriver groups for a project.""" def __init__(self, context=None): """Initializes the Groups for a Stackdriver project. Args: context: An optional Context object to use instead of the global default.""" <|body_0|> def list(self, patter...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Groups: """Represents a list of Stackdriver groups for a project.""" def __init__(self, context=None): """Initializes the Groups for a Stackdriver project. Args: context: An optional Context object to use instead of the global default.""" self._context = context or google.datalab.Context....
the_stack_v2_python_sparse
google/datalab/stackdriver/monitoring/_group.py
googledatalab/pydatalab
train
200
270667c8344007bf1c748b61cd25b1bf35adcbe9
[ "has_class_permission = super(EntryAdmin, self).has_change_permission(request, obj)\nif not has_class_permission:\n return False\nif obj is not None and (not request.user.is_superuser) and (request.user.id != obj.author.id):\n return False\nreturn True", "if request.user.is_superuser:\n return Entry.obje...
<|body_start_0|> has_class_permission = super(EntryAdmin, self).has_change_permission(request, obj) if not has_class_permission: return False if obj is not None and (not request.user.is_superuser) and (request.user.id != obj.author.id): return False return True <|...
EntryAdmin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EntryAdmin: def has_change_permission(self, request, obj=None): """Called from the individual object editing page, to ensure the user is allowed to edit that object. Returns ``True`` if the user has permission for change the entry, otherwise returns ``False``.""" <|body_0|> ...
stack_v2_sparse_classes_10k_train_004313
2,721
no_license
[ { "docstring": "Called from the individual object editing page, to ensure the user is allowed to edit that object. Returns ``True`` if the user has permission for change the entry, otherwise returns ``False``.", "name": "has_change_permission", "signature": "def has_change_permission(self, request, obj=...
3
stack_v2_sparse_classes_30k_train_005884
Implement the Python class `EntryAdmin` described below. Class description: Implement the EntryAdmin class. Method signatures and docstrings: - def has_change_permission(self, request, obj=None): Called from the individual object editing page, to ensure the user is allowed to edit that object. Returns ``True`` if the...
Implement the Python class `EntryAdmin` described below. Class description: Implement the EntryAdmin class. Method signatures and docstrings: - def has_change_permission(self, request, obj=None): Called from the individual object editing page, to ensure the user is allowed to edit that object. Returns ``True`` if the...
a835b4e2de6e961e46ec68d3edda98530cbcf4c6
<|skeleton|> class EntryAdmin: def has_change_permission(self, request, obj=None): """Called from the individual object editing page, to ensure the user is allowed to edit that object. Returns ``True`` if the user has permission for change the entry, otherwise returns ``False``.""" <|body_0|> ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class EntryAdmin: def has_change_permission(self, request, obj=None): """Called from the individual object editing page, to ensure the user is allowed to edit that object. Returns ``True`` if the user has permission for change the entry, otherwise returns ``False``.""" has_class_permission = super(E...
the_stack_v2_python_sparse
diario/admin.py
sahwar/souschef
train
0
93fd211999fd389e3097dc54c6ea30cc368477e3
[ "cell = csv_readline(line)\nif cell[0] == 'V':\n yield (cell[4], 1)", "total = 0\ntotal = sum((i for i in visit_counts))\nyield (customer, total)" ]
<|body_start_0|> cell = csv_readline(line) if cell[0] == 'V': yield (cell[4], 1) <|end_body_0|> <|body_start_1|> total = 0 total = sum((i for i in visit_counts)) yield (customer, total) <|end_body_1|>
CustomerVisit
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CustomerVisit: def mapper(self, line_no, line): """Extracts the Customer that visit a page""" <|body_0|> def reducer(self, customer, visit_counts): """Sumarizes the visit counts by adding them together.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_10k_train_004314
1,020
no_license
[ { "docstring": "Extracts the Customer that visit a page", "name": "mapper", "signature": "def mapper(self, line_no, line)" }, { "docstring": "Sumarizes the visit counts by adding them together.", "name": "reducer", "signature": "def reducer(self, customer, visit_counts)" } ]
2
stack_v2_sparse_classes_30k_train_000997
Implement the Python class `CustomerVisit` described below. Class description: Implement the CustomerVisit class. Method signatures and docstrings: - def mapper(self, line_no, line): Extracts the Customer that visit a page - def reducer(self, customer, visit_counts): Sumarizes the visit counts by adding them together...
Implement the Python class `CustomerVisit` described below. Class description: Implement the CustomerVisit class. Method signatures and docstrings: - def mapper(self, line_no, line): Extracts the Customer that visit a page - def reducer(self, customer, visit_counts): Sumarizes the visit counts by adding them together...
dc1b55b1ca0b989ff65df04fc96df2afc102ee0d
<|skeleton|> class CustomerVisit: def mapper(self, line_no, line): """Extracts the Customer that visit a page""" <|body_0|> def reducer(self, customer, visit_counts): """Sumarizes the visit counts by adding them together.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CustomerVisit: def mapper(self, line_no, line): """Extracts the Customer that visit a page""" cell = csv_readline(line) if cell[0] == 'V': yield (cell[4], 1) def reducer(self, customer, visit_counts): """Sumarizes the visit counts by adding them together.""" ...
the_stack_v2_python_sparse
week4/visits_per_customer_solution.py
hchandaria/UCB_MIDS_W261
train
0
00daafeb4e8f16d5acde7ff5459533b177935bea
[ "res = []\nstack = []\nwhile root or stack:\n while root:\n stack.append(root)\n root = root.left\n root = stack.pop()\n res.append(root.val)\n root = root.right\nreturn res", "def getSuccessor(root: TreeNode) -> TreeNode:\n succ = root.left\n while succ.right and succ.right != roo...
<|body_start_0|> res = [] stack = [] while root or stack: while root: stack.append(root) root = root.left root = stack.pop() res.append(root.val) root = root.right return res <|end_body_0|> <|body_start_1|> ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def inorderTraversal_MK1(self, root: Optional[TreeNode]) -> List[int]: """Iterating method using Stack Time complexity: O(n) Space complexity: O(n)""" <|body_0|> def inorderTraversal_MK2(self, root: Optional[TreeNode]) -> List[int]: """Morris Traversal Time...
stack_v2_sparse_classes_10k_train_004315
1,513
no_license
[ { "docstring": "Iterating method using Stack Time complexity: O(n) Space complexity: O(n)", "name": "inorderTraversal_MK1", "signature": "def inorderTraversal_MK1(self, root: Optional[TreeNode]) -> List[int]" }, { "docstring": "Morris Traversal Time complexity: O(n) Space complexity: O(1)", ...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def inorderTraversal_MK1(self, root: Optional[TreeNode]) -> List[int]: Iterating method using Stack Time complexity: O(n) Space complexity: O(n) - def inorderTraversal_MK2(self, ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def inorderTraversal_MK1(self, root: Optional[TreeNode]) -> List[int]: Iterating method using Stack Time complexity: O(n) Space complexity: O(n) - def inorderTraversal_MK2(self, ...
d7ba416d22becfa8f2a2ae4eee04c86617cd9332
<|skeleton|> class Solution: def inorderTraversal_MK1(self, root: Optional[TreeNode]) -> List[int]: """Iterating method using Stack Time complexity: O(n) Space complexity: O(n)""" <|body_0|> def inorderTraversal_MK2(self, root: Optional[TreeNode]) -> List[int]: """Morris Traversal Time...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def inorderTraversal_MK1(self, root: Optional[TreeNode]) -> List[int]: """Iterating method using Stack Time complexity: O(n) Space complexity: O(n)""" res = [] stack = [] while root or stack: while root: stack.append(root) r...
the_stack_v2_python_sparse
0094. Binary Tree Inorder Traversal/Solution.py
faterazer/LeetCode
train
4
19d9f9b11a6aed5c2e6d70303378a9655551e521
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "conte...
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
Interface exported by the server.
TrainingCoordinatorServicer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TrainingCoordinatorServicer: """Interface exported by the server.""" def Train(self, request, context): """Train a model""" <|body_0|> def GetStatus(self, request, context): """Get status of training job""" <|body_1|> def GetEvaluations(self, request...
stack_v2_sparse_classes_10k_train_004316
10,496
no_license
[ { "docstring": "Train a model", "name": "Train", "signature": "def Train(self, request, context)" }, { "docstring": "Get status of training job", "name": "GetStatus", "signature": "def GetStatus(self, request, context)" }, { "docstring": "Get evaluation metrics for the training j...
6
stack_v2_sparse_classes_30k_val_000037
Implement the Python class `TrainingCoordinatorServicer` described below. Class description: Interface exported by the server. Method signatures and docstrings: - def Train(self, request, context): Train a model - def GetStatus(self, request, context): Get status of training job - def GetEvaluations(self, request, co...
Implement the Python class `TrainingCoordinatorServicer` described below. Class description: Interface exported by the server. Method signatures and docstrings: - def Train(self, request, context): Train a model - def GetStatus(self, request, context): Get status of training job - def GetEvaluations(self, request, co...
49dc92036e71ca758cc35e8851a803b89d76ef52
<|skeleton|> class TrainingCoordinatorServicer: """Interface exported by the server.""" def Train(self, request, context): """Train a model""" <|body_0|> def GetStatus(self, request, context): """Get status of training job""" <|body_1|> def GetEvaluations(self, request...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TrainingCoordinatorServicer: """Interface exported by the server.""" def Train(self, request, context): """Train a model""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') ...
the_stack_v2_python_sparse
proto/trainer/trainer_pb2_grpc.py
selwynClarifai/video-manager
train
2
d85516d4ba096d42f025f84bf5a5b90a5ba73204
[ "\"\"\"\n [1,1,3,4,5,7,7,9]\n \"\"\"\nnums.sort()\nlo, hi = (0, nums[-1] - nums[0])\nself.count(nums, 4)\nwhile lo < hi:\n mid = (hi + lo) / 2\n if self.count(nums, mid) >= k:\n hi = mid\n else:\n lo = mid + 1\nreturn lo", "count = right = 0\nfor left, n in enumerate(nums):\n ...
<|body_start_0|> """ [1,1,3,4,5,7,7,9] """ nums.sort() lo, hi = (0, nums[-1] - nums[0]) self.count(nums, 4) while lo < hi: mid = (hi + lo) / 2 if self.count(nums, mid) >= k: hi = mid else: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def smallestDistancePair(self, nums, k): """:type nums: List[int] :type k: int :rtype: int""" <|body_0|> def count(self, nums, val): """Count the total number of pair distance which is smaller than val""" <|body_1|> <|end_skeleton|> <|body_start_0...
stack_v2_sparse_classes_10k_train_004317
1,574
no_license
[ { "docstring": ":type nums: List[int] :type k: int :rtype: int", "name": "smallestDistancePair", "signature": "def smallestDistancePair(self, nums, k)" }, { "docstring": "Count the total number of pair distance which is smaller than val", "name": "count", "signature": "def count(self, nu...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def smallestDistancePair(self, nums, k): :type nums: List[int] :type k: int :rtype: int - def count(self, nums, val): Count the total number of pair distance which is smaller tha...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def smallestDistancePair(self, nums, k): :type nums: List[int] :type k: int :rtype: int - def count(self, nums, val): Count the total number of pair distance which is smaller tha...
0127190b27862ec7e7f4f2fcce5ce958d480cdac
<|skeleton|> class Solution: def smallestDistancePair(self, nums, k): """:type nums: List[int] :type k: int :rtype: int""" <|body_0|> def count(self, nums, val): """Count the total number of pair distance which is smaller than val""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def smallestDistancePair(self, nums, k): """:type nums: List[int] :type k: int :rtype: int""" """ [1,1,3,4,5,7,7,9] """ nums.sort() lo, hi = (0, nums[-1] - nums[0]) self.count(nums, 4) while lo < hi: mid = (h...
the_stack_v2_python_sparse
719.find-k-th-smallest-pair-distance.py
Iverance/leetcode
train
0
ece7029545ec3110ba2e0536cf1fb5f2897efe67
[ "file_dir = os.path.dirname(__file__)\nfilename = 'data_items.csv'\nabsolute_file_path = os.path.join(file_dir, filename)\nwith open(absolute_file_path, 'r') as csv_file:\n csv_reader = csv.reader(csv_file)\n inventory = []\n for row in csv_reader:\n inventory.append({'name': row[0], 'sell_in': int(...
<|body_start_0|> file_dir = os.path.dirname(__file__) filename = 'data_items.csv' absolute_file_path = os.path.join(file_dir, filename) with open(absolute_file_path, 'r') as csv_file: csv_reader = csv.reader(csv_file) inventory = [] for row in csv_read...
Factory
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Factory: def loadInventory(): """Let us get the data of some Items from "data_items.csv" file which contains some basic items to insert them into database in other functions Returns: (list): Returns a List where each element it's a Dictionary which contains the item""" <|body_0|>...
stack_v2_sparse_classes_10k_train_004318
2,875
permissive
[ { "docstring": "Let us get the data of some Items from \"data_items.csv\" file which contains some basic items to insert them into database in other functions Returns: (list): Returns a List where each element it's a Dictionary which contains the item", "name": "loadInventory", "signature": "def loadInv...
2
stack_v2_sparse_classes_30k_train_006541
Implement the Python class `Factory` described below. Class description: Implement the Factory class. Method signatures and docstrings: - def loadInventory(): Let us get the data of some Items from "data_items.csv" file which contains some basic items to insert them into database in other functions Returns: (list): R...
Implement the Python class `Factory` described below. Class description: Implement the Factory class. Method signatures and docstrings: - def loadInventory(): Let us get the data of some Items from "data_items.csv" file which contains some basic items to insert them into database in other functions Returns: (list): R...
0f9f2589b567c57bd56a8a4161de3043d5639a8b
<|skeleton|> class Factory: def loadInventory(): """Let us get the data of some Items from "data_items.csv" file which contains some basic items to insert them into database in other functions Returns: (list): Returns a List where each element it's a Dictionary which contains the item""" <|body_0|>...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Factory: def loadInventory(): """Let us get the data of some Items from "data_items.csv" file which contains some basic items to insert them into database in other functions Returns: (list): Returns a List where each element it's a Dictionary which contains the item""" file_dir = os.path.dirna...
the_stack_v2_python_sparse
repository/repository_sql/repo.py
cifpfbmoll/ollivanders-in-a-docker-pau13-loop
train
0
58d3221be982627f8f28b3f01ecd59f961cf2b64
[ "i = 0\nwhile i != row:\n if borad[i][col] == 'Q':\n return False\n i += 1\ni, j = (row - 1, col - 1)\nwhile i >= 0 and j >= 0:\n if borad[i][j] == 'Q':\n return False\n i -= 1\n j -= 1\ni, j = (row - 1, col + 1)\nwhile i >= 0 and j < n:\n if borad[i][j] == 'Q':\n return False...
<|body_start_0|> i = 0 while i != row: if borad[i][col] == 'Q': return False i += 1 i, j = (row - 1, col - 1) while i >= 0 and j >= 0: if borad[i][j] == 'Q': return False i -= 1 j -= 1 i, ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def checkvalid(self, borad, row, col, n): """set board[row][col]=='Q' check whether it's valid result""" <|body_0|> def solveNQueens(self, n): """:type n: int :rtype: List[List[str]]""" <|body_1|> <|end_skeleton|> <|body_start_0|> i = 0 ...
stack_v2_sparse_classes_10k_train_004319
1,288
permissive
[ { "docstring": "set board[row][col]=='Q' check whether it's valid result", "name": "checkvalid", "signature": "def checkvalid(self, borad, row, col, n)" }, { "docstring": ":type n: int :rtype: List[List[str]]", "name": "solveNQueens", "signature": "def solveNQueens(self, n)" } ]
2
stack_v2_sparse_classes_30k_train_000278
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def checkvalid(self, borad, row, col, n): set board[row][col]=='Q' check whether it's valid result - def solveNQueens(self, n): :type n: int :rtype: List[List[str]]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def checkvalid(self, borad, row, col, n): set board[row][col]=='Q' check whether it's valid result - def solveNQueens(self, n): :type n: int :rtype: List[List[str]] <|skeleton|>...
86f1cb98de801f58c39d9a48ce9de12df7303d20
<|skeleton|> class Solution: def checkvalid(self, borad, row, col, n): """set board[row][col]=='Q' check whether it's valid result""" <|body_0|> def solveNQueens(self, n): """:type n: int :rtype: List[List[str]]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def checkvalid(self, borad, row, col, n): """set board[row][col]=='Q' check whether it's valid result""" i = 0 while i != row: if borad[i][col] == 'Q': return False i += 1 i, j = (row - 1, col - 1) while i >= 0 and j >= ...
the_stack_v2_python_sparse
51-N-Queens/solution.py
Tanych/CodeTracking
train
0
b7c9d0a622882f42d91684702fba4df6979b3b9e
[ "security_group = self.os_conn.create_sec_group_for_ssh()\nself.instance_keypair = self.os_conn.create_key(key_name='instancekey')\nself.os_conn.nova.security_group_rules.create(security_group.id, ip_protocol='tcp', from_port=1, to_port=65535, cidr='0.0.0.0/0')\nnet, subnet = self.create_internal_network_with_subne...
<|body_start_0|> security_group = self.os_conn.create_sec_group_for_ssh() self.instance_keypair = self.os_conn.create_key(key_name='instancekey') self.os_conn.nova.security_group_rules.create(security_group.id, ip_protocol='tcp', from_port=1, to_port=65535, cidr='0.0.0.0/0') net, subnet ...
Check association and disassociation floating ip
TestFloatingIP
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestFloatingIP: """Check association and disassociation floating ip""" def prepare_openstack(self): """Prepare OpenStack for scenarios run Steps: 1. Create network net01, subnet net01__subnet with CIDR 10.1.1.0/24 2. Create new security group sec_group1 3. Add Ingress rule for TCP pr...
stack_v2_sparse_classes_10k_train_004320
5,007
no_license
[ { "docstring": "Prepare OpenStack for scenarios run Steps: 1. Create network net01, subnet net01__subnet with CIDR 10.1.1.0/24 2. Create new security group sec_group1 3. Add Ingress rule for TCP protocol to sec_group1 4. Boot vm1 net01 with sec_group1", "name": "prepare_openstack", "signature": "def pre...
2
stack_v2_sparse_classes_30k_train_001581
Implement the Python class `TestFloatingIP` described below. Class description: Check association and disassociation floating ip Method signatures and docstrings: - def prepare_openstack(self): Prepare OpenStack for scenarios run Steps: 1. Create network net01, subnet net01__subnet with CIDR 10.1.1.0/24 2. Create new...
Implement the Python class `TestFloatingIP` described below. Class description: Check association and disassociation floating ip Method signatures and docstrings: - def prepare_openstack(self): Prepare OpenStack for scenarios run Steps: 1. Create network net01, subnet net01__subnet with CIDR 10.1.1.0/24 2. Create new...
8aced2855b78b5f123195d188c80e27b43888a2e
<|skeleton|> class TestFloatingIP: """Check association and disassociation floating ip""" def prepare_openstack(self): """Prepare OpenStack for scenarios run Steps: 1. Create network net01, subnet net01__subnet with CIDR 10.1.1.0/24 2. Create new security group sec_group1 3. Add Ingress rule for TCP pr...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestFloatingIP: """Check association and disassociation floating ip""" def prepare_openstack(self): """Prepare OpenStack for scenarios run Steps: 1. Create network net01, subnet net01__subnet with CIDR 10.1.1.0/24 2. Create new security group sec_group1 3. Add Ingress rule for TCP protocol to sec...
the_stack_v2_python_sparse
mos_tests/neutron/python_tests/test_floating_ip.py
Mirantis/mos-integration-tests
train
16
46e9bccabda90b55a81ca1b8dae84645425c2c53
[ "self.entry = entry\nself.id = entry.id\nself.title = entry.title\nself.date = entry.date\nself.time_spent = entry.time_spent\nself.learned = entry.learned\n_resources = self.entry.get_resources()\n_tags = self.entry.get_tags()\nself.resources = [(resource.id, resource.title) for resource in list(_resources)]\nself...
<|body_start_0|> self.entry = entry self.id = entry.id self.title = entry.title self.date = entry.date self.time_spent = entry.time_spent self.learned = entry.learned _resources = self.entry.get_resources() _tags = self.entry.get_tags() self.resour...
helper class that is not stored in the database it is used to update an entry along with its tags and resources
EntryWithResourcesandTags
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EntryWithResourcesandTags: """helper class that is not stored in the database it is used to update an entry along with its tags and resources""" def __init__(self, entry): """the combined record is initilized in the way it exists before the update""" <|body_0|> def updat...
stack_v2_sparse_classes_10k_train_004321
10,083
no_license
[ { "docstring": "the combined record is initilized in the way it exists before the update", "name": "__init__", "signature": "def __init__(self, entry)" }, { "docstring": "the update is performed", "name": "update", "signature": "def update(self, form)" } ]
2
stack_v2_sparse_classes_30k_train_006531
Implement the Python class `EntryWithResourcesandTags` described below. Class description: helper class that is not stored in the database it is used to update an entry along with its tags and resources Method signatures and docstrings: - def __init__(self, entry): the combined record is initilized in the way it exis...
Implement the Python class `EntryWithResourcesandTags` described below. Class description: helper class that is not stored in the database it is used to update an entry along with its tags and resources Method signatures and docstrings: - def __init__(self, entry): the combined record is initilized in the way it exis...
8bfbba09132b405f7c68cbfd9a0e7596223c3a53
<|skeleton|> class EntryWithResourcesandTags: """helper class that is not stored in the database it is used to update an entry along with its tags and resources""" def __init__(self, entry): """the combined record is initilized in the way it exists before the update""" <|body_0|> def updat...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class EntryWithResourcesandTags: """helper class that is not stored in the database it is used to update an entry along with its tags and resources""" def __init__(self, entry): """the combined record is initilized in the way it exists before the update""" self.entry = entry self.id = e...
the_stack_v2_python_sparse
project05_flask_learningjournal/learning_journal/models.py
sabinem/treehouse-python-techdegree
train
3
2f822b306f083dd100852e90bd0ce7b8022ac1b5
[ "if '_read' not in data and '_seen' not in data:\n raise ValidationError('Please provide at least one field to update. Valid fields to update are: read, seen')\nreturn data", "unwanted_fields = ['resource_type']\nfor field in unwanted_fields:\n if field in data:\n data.pop(field)\nreturn data" ]
<|body_start_0|> if '_read' not in data and '_seen' not in data: raise ValidationError('Please provide at least one field to update. Valid fields to update are: read, seen') return data <|end_body_0|> <|body_start_1|> unwanted_fields = ['resource_type'] for field in unwanted...
Class to serialize and deserialize notification models.
NotificationSchema
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NotificationSchema: """Class to serialize and deserialize notification models.""" def validate_read_and_seen(self, data, **kwargs): """Raise a ValidationError if both read and seen aren't present in the data on load.""" <|body_0|> def strip_unwanted_fields(self, data, ma...
stack_v2_sparse_classes_10k_train_004322
1,963
no_license
[ { "docstring": "Raise a ValidationError if both read and seen aren't present in the data on load.", "name": "validate_read_and_seen", "signature": "def validate_read_and_seen(self, data, **kwargs)" }, { "docstring": "Remove unwanted fields from the input data before deserialization.", "name"...
2
stack_v2_sparse_classes_30k_val_000281
Implement the Python class `NotificationSchema` described below. Class description: Class to serialize and deserialize notification models. Method signatures and docstrings: - def validate_read_and_seen(self, data, **kwargs): Raise a ValidationError if both read and seen aren't present in the data on load. - def stri...
Implement the Python class `NotificationSchema` described below. Class description: Class to serialize and deserialize notification models. Method signatures and docstrings: - def validate_read_and_seen(self, data, **kwargs): Raise a ValidationError if both read and seen aren't present in the data on load. - def stri...
55ce20945bea8a6348bea64726aaf209936723c2
<|skeleton|> class NotificationSchema: """Class to serialize and deserialize notification models.""" def validate_read_and_seen(self, data, **kwargs): """Raise a ValidationError if both read and seen aren't present in the data on load.""" <|body_0|> def strip_unwanted_fields(self, data, ma...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class NotificationSchema: """Class to serialize and deserialize notification models.""" def validate_read_and_seen(self, data, **kwargs): """Raise a ValidationError if both read and seen aren't present in the data on load.""" if '_read' not in data and '_seen' not in data: raise Val...
the_stack_v2_python_sparse
api/app/schemas/notification.py
EricMontague/Flask-Chat-Server
train
0
a4a17d12b3aa4a8266b98c4e28f4cbf48e0014d5
[ "self.format = format\nself.trigmode = tmod\nself.atwa = [None] * 4\nself.atwb = [None] * 4\nself.atwd = [None] * 8\nself.fadc = []\nif format & 1:\n self.atwa[0] = self.atwd[0] = struct.unpack('128h', zbuf.read(256))\nif format & 2:\n self.atwa[1] = self.atwd[1] = struct.unpack('128h', zbuf.read(256))\nif fo...
<|body_start_0|> self.format = format self.trigmode = tmod self.atwa = [None] * 4 self.atwb = [None] * 4 self.atwd = [None] * 8 self.fadc = [] if format & 1: self.atwa[0] = self.atwd[0] = struct.unpack('128h', zbuf.read(256)) if format & 2: ...
Waveform hit class. This class contains data members that hold information about a 'hit' or waveform capture in the ATWD and/or FADC. There are also slots for the DOM clock information. - hit.atwa[i][j] : holds j-th sample of ATWD-A channel i - hit.atwb[i][j] : ibid. but for ATWD-B - hit.fadc[j] : only one FADC - hit.c...
hit
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class hit: """Waveform hit class. This class contains data members that hold information about a 'hit' or waveform capture in the ATWD and/or FADC. There are also slots for the DOM clock information. - hit.atwa[i][j] : holds j-th sample of ATWD-A channel i - hit.atwb[i][j] : ibid. but for ATWD-B - hit....
stack_v2_sparse_classes_10k_train_004323
21,290
no_license
[ { "docstring": "Unpack from acqX memory dump", "name": "__init__", "signature": "def __init__(self, zbuf, format, tmod)" }, { "docstring": "Write self out as engineering event", "name": "toeng", "signature": "def toeng(self)" } ]
2
stack_v2_sparse_classes_30k_train_006186
Implement the Python class `hit` described below. Class description: Waveform hit class. This class contains data members that hold information about a 'hit' or waveform capture in the ATWD and/or FADC. There are also slots for the DOM clock information. - hit.atwa[i][j] : holds j-th sample of ATWD-A channel i - hit.a...
Implement the Python class `hit` described below. Class description: Waveform hit class. This class contains data members that hold information about a 'hit' or waveform capture in the ATWD and/or FADC. There are also slots for the DOM clock information. - hit.atwa[i][j] : holds j-th sample of ATWD-A channel i - hit.a...
13cb63ba2390bbd49facb2d9093da528ae52cd91
<|skeleton|> class hit: """Waveform hit class. This class contains data members that hold information about a 'hit' or waveform capture in the ATWD and/or FADC. There are also slots for the DOM clock information. - hit.atwa[i][j] : holds j-th sample of ATWD-A channel i - hit.atwb[i][j] : ibid. but for ATWD-B - hit....
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class hit: """Waveform hit class. This class contains data members that hold information about a 'hit' or waveform capture in the ATWD and/or FADC. There are also slots for the DOM clock information. - hit.atwa[i][j] : holds j-th sample of ATWD-A channel i - hit.atwb[i][j] : ibid. but for ATWD-B - hit.fadc[j] : onl...
the_stack_v2_python_sparse
icecube/domtest/ibidaq.py
dglo/PyDOM
train
0
f9d3c7f1e9ffe1e3c38cee5eeafd17c93abe2304
[ "self.alphabet = alphabet\nself.initial_population = 500\nself.min_generations = 10\nself._set_up_genetic_algorithm()", "self.motif_generator = RandomMotifGenerator(self.alphabet)\nself.mutator = SinglePositionMutation(mutation_rate=0.1)\nself.crossover = SinglePointCrossover(crossover_prob=0.25)\nself.repair = A...
<|body_start_0|> self.alphabet = alphabet self.initial_population = 500 self.min_generations = 10 self._set_up_genetic_algorithm() <|end_body_0|> <|body_start_1|> self.motif_generator = RandomMotifGenerator(self.alphabet) self.mutator = SinglePositionMutation(mutation_ra...
Find schemas using a genetic algorithm approach. This approach to finding schema uses Genetic Algorithms to evolve a set of schema and find the best schema for a specific set of records. The 'default' finder searches for ambiguous DNA elements. This can be overridden easily by creating a GeneticAlgorithmFinder with a d...
GeneticAlgorithmFinder
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GeneticAlgorithmFinder: """Find schemas using a genetic algorithm approach. This approach to finding schema uses Genetic Algorithms to evolve a set of schema and find the best schema for a specific set of records. The 'default' finder searches for ambiguous DNA elements. This can be overridden ea...
stack_v2_sparse_classes_10k_train_004324
26,199
permissive
[ { "docstring": "Initialize a finder to get schemas using Genetic Algorithms. Arguments: o alphabet -- The alphabet which specifies the contents of the schemas we'll be generating. This alphabet must contain the attribute 'alphabet_matches', which is a dictionary specifying the potential ambiguities of each lett...
3
stack_v2_sparse_classes_30k_train_004779
Implement the Python class `GeneticAlgorithmFinder` described below. Class description: Find schemas using a genetic algorithm approach. This approach to finding schema uses Genetic Algorithms to evolve a set of schema and find the best schema for a specific set of records. The 'default' finder searches for ambiguous ...
Implement the Python class `GeneticAlgorithmFinder` described below. Class description: Find schemas using a genetic algorithm approach. This approach to finding schema uses Genetic Algorithms to evolve a set of schema and find the best schema for a specific set of records. The 'default' finder searches for ambiguous ...
1d9a8e84a8572809ee3260ede44290e14de3bdd1
<|skeleton|> class GeneticAlgorithmFinder: """Find schemas using a genetic algorithm approach. This approach to finding schema uses Genetic Algorithms to evolve a set of schema and find the best schema for a specific set of records. The 'default' finder searches for ambiguous DNA elements. This can be overridden ea...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class GeneticAlgorithmFinder: """Find schemas using a genetic algorithm approach. This approach to finding schema uses Genetic Algorithms to evolve a set of schema and find the best schema for a specific set of records. The 'default' finder searches for ambiguous DNA elements. This can be overridden easily by creat...
the_stack_v2_python_sparse
bin/last_wrapper/Bio/NeuralNetwork/Gene/Schema.py
LyonsLab/coge
train
41
96a19ae28090fb7340b0bbe18b3a13d0bb1c170d
[ "user = request.user\ncheck_user_status(user)\nuser_id = user.id\nrestaurant_owner = RestaurantOwner.get_by_user_id(user_id=user_id)\nreturn JsonResponse(model_to_json(restaurant_owner))", "user = request.user\ncheck_user_status(user)\nuser_id = user.id\nvalidate(instance=request.data, schema=schemas.restaurant_o...
<|body_start_0|> user = request.user check_user_status(user) user_id = user.id restaurant_owner = RestaurantOwner.get_by_user_id(user_id=user_id) return JsonResponse(model_to_json(restaurant_owner)) <|end_body_0|> <|body_start_1|> user = request.user check_user_s...
Restaurant Owner view
RestaurantOwnerView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RestaurantOwnerView: """Restaurant Owner view""" def get(self, request): """Retrieves a restaurant owner profile""" <|body_0|> def put(self, request): """Updates a restaurant owner profile""" <|body_1|> <|end_skeleton|> <|body_start_0|> user = r...
stack_v2_sparse_classes_10k_train_004325
3,080
no_license
[ { "docstring": "Retrieves a restaurant owner profile", "name": "get", "signature": "def get(self, request)" }, { "docstring": "Updates a restaurant owner profile", "name": "put", "signature": "def put(self, request)" } ]
2
stack_v2_sparse_classes_30k_test_000368
Implement the Python class `RestaurantOwnerView` described below. Class description: Restaurant Owner view Method signatures and docstrings: - def get(self, request): Retrieves a restaurant owner profile - def put(self, request): Updates a restaurant owner profile
Implement the Python class `RestaurantOwnerView` described below. Class description: Restaurant Owner view Method signatures and docstrings: - def get(self, request): Retrieves a restaurant owner profile - def put(self, request): Updates a restaurant owner profile <|skeleton|> class RestaurantOwnerView: """Resta...
2707062c9a9a8bb4baca955e8a60ba08cc9f8953
<|skeleton|> class RestaurantOwnerView: """Restaurant Owner view""" def get(self, request): """Retrieves a restaurant owner profile""" <|body_0|> def put(self, request): """Updates a restaurant owner profile""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RestaurantOwnerView: """Restaurant Owner view""" def get(self, request): """Retrieves a restaurant owner profile""" user = request.user check_user_status(user) user_id = user.id restaurant_owner = RestaurantOwner.get_by_user_id(user_id=user_id) return JsonR...
the_stack_v2_python_sparse
backend/restaurant_owner/views.py
MochiTarts/Find-Dining-The-Bridge
train
1
ed18dc549cac4a8f59c8cd89083adb4c5b6b1866
[ "login_url = 'http://uat-c2b.taoche.com/basegate/work/order/statistics'\nheaders = {'Content-Type': 'application/json;charset=UTF-8', 'Authorization': GetToken().token()}\nresponse_data = requests.get(login_url, headers=headers).json()\nself.assertEqual(response_data['message'], 'SUCCESS')", "login_url = 'http://...
<|body_start_0|> login_url = 'http://uat-c2b.taoche.com/basegate/work/order/statistics' headers = {'Content-Type': 'application/json;charset=UTF-8', 'Authorization': GetToken().token()} response_data = requests.get(login_url, headers=headers).json() self.assertEqual(response_data['messag...
TestGongDan
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestGongDan: def test1_gongzt(self): """工作台,工单统计接口,正常登录后请求""" <|body_0|> def test2_gongzt_notoken(self): """工作台,工单统计接口,不登录直接请求""" <|body_1|> <|end_skeleton|> <|body_start_0|> login_url = 'http://uat-c2b.taoche.com/basegate/work/order/statistics' ...
stack_v2_sparse_classes_10k_train_004326
1,541
no_license
[ { "docstring": "工作台,工单统计接口,正常登录后请求", "name": "test1_gongzt", "signature": "def test1_gongzt(self)" }, { "docstring": "工作台,工单统计接口,不登录直接请求", "name": "test2_gongzt_notoken", "signature": "def test2_gongzt_notoken(self)" } ]
2
stack_v2_sparse_classes_30k_train_005685
Implement the Python class `TestGongDan` described below. Class description: Implement the TestGongDan class. Method signatures and docstrings: - def test1_gongzt(self): 工作台,工单统计接口,正常登录后请求 - def test2_gongzt_notoken(self): 工作台,工单统计接口,不登录直接请求
Implement the Python class `TestGongDan` described below. Class description: Implement the TestGongDan class. Method signatures and docstrings: - def test1_gongzt(self): 工作台,工单统计接口,正常登录后请求 - def test2_gongzt_notoken(self): 工作台,工单统计接口,不登录直接请求 <|skeleton|> class TestGongDan: def test1_gongzt(self): """工作台...
204856bd33c06d25f2970eba13799db75d4fd4fe
<|skeleton|> class TestGongDan: def test1_gongzt(self): """工作台,工单统计接口,正常登录后请求""" <|body_0|> def test2_gongzt_notoken(self): """工作台,工单统计接口,不登录直接请求""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestGongDan: def test1_gongzt(self): """工作台,工单统计接口,正常登录后请求""" login_url = 'http://uat-c2b.taoche.com/basegate/work/order/statistics' headers = {'Content-Type': 'application/json;charset=UTF-8', 'Authorization': GetToken().token()} response_data = requests.get(login_url, headers...
the_stack_v2_python_sparse
mc/xmdCW/testcase/test_gongzuotai.py
boeai/mc
train
0
865522c4fbc8a9b0cc486b75c0b8347c18ea0a34
[ "self.base_url = 'http://weatherstation.wunderground.com/' + 'weatherstation/updateweatherstation.php'\nself.url_items = {}\nself.valid_keys = ('action', 'ID', 'PASSWORD', 'dateutc', 'winddir', 'windspeedmph', 'windgustmph', 'windgustdir', 'windspdmph_avg2m', 'winddir_avg2m', 'windgustmph_10m', 'windgustdir_10m', '...
<|body_start_0|> self.base_url = 'http://weatherstation.wunderground.com/' + 'weatherstation/updateweatherstation.php' self.url_items = {} self.valid_keys = ('action', 'ID', 'PASSWORD', 'dateutc', 'winddir', 'windspeedmph', 'windgustmph', 'windgustdir', 'windspdmph_avg2m', 'winddir_avg2m', 'wind...
this class represents a weather under ground upload url
WUURL
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WUURL: """this class represents a weather under ground upload url""" def __init__(self): """initialize a url""" <|body_0|> def __str__(self): """converst url to string""" <|body_1|> def add_item(self, key, value): """adds an item to url argum...
stack_v2_sparse_classes_10k_train_004327
7,715
no_license
[ { "docstring": "initialize a url", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "converst url to string", "name": "__str__", "signature": "def __str__(self)" }, { "docstring": "adds an item to url arguments: key: (string) value: (string)", "name": "...
4
stack_v2_sparse_classes_30k_train_004964
Implement the Python class `WUURL` described below. Class description: this class represents a weather under ground upload url Method signatures and docstrings: - def __init__(self): initialize a url - def __str__(self): converst url to string - def add_item(self, key, value): adds an item to url arguments: key: (str...
Implement the Python class `WUURL` described below. Class description: this class represents a weather under ground upload url Method signatures and docstrings: - def __init__(self): initialize a url - def __str__(self): converst url to string - def add_item(self, key, value): adds an item to url arguments: key: (str...
95d0c102d649c5b028d262f5254106f997a7c77a
<|skeleton|> class WUURL: """this class represents a weather under ground upload url""" def __init__(self): """initialize a url""" <|body_0|> def __str__(self): """converst url to string""" <|body_1|> def add_item(self, key, value): """adds an item to url argum...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class WUURL: """this class represents a weather under ground upload url""" def __init__(self): """initialize a url""" self.base_url = 'http://weatherstation.wunderground.com/' + 'weatherstation/updateweatherstation.php' self.url_items = {} self.valid_keys = ('action', 'ID', 'PAS...
the_stack_v2_python_sparse
wunder_formatter.py
rwspicer/csv_utilities
train
1
546a0bbe47034f3443306888432d8e84a792c4e7
[ "low, high = (0, len(nums) - 1)\nwhile low <= high:\n mid = low + (high - low) // 2\n if nums[mid] == target:\n return mid\n if nums[mid] < target:\n low = mid + 1\n else:\n high = mid - 1\nif high >= 0 and nums[high] > target:\n return high\nreturn low", "start = 0\nend = len(...
<|body_start_0|> low, high = (0, len(nums) - 1) while low <= high: mid = low + (high - low) // 2 if nums[mid] == target: return mid if nums[mid] < target: low = mid + 1 else: high = mid - 1 if high >=...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def searchInsert2(self, nums: List[int], target: int) -> int: """20210824 do it again Runtime: 63 ms, faster than 22.19% Memory Usage: 15 MB, less than 56.94% :param nums: :param target: :return:""" <|body_0|> def searchInsert(self, nums, target): """:type ...
stack_v2_sparse_classes_10k_train_004328
2,922
permissive
[ { "docstring": "20210824 do it again Runtime: 63 ms, faster than 22.19% Memory Usage: 15 MB, less than 56.94% :param nums: :param target: :return:", "name": "searchInsert2", "signature": "def searchInsert2(self, nums: List[int], target: int) -> int" }, { "docstring": ":type nums: List[int] :type...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def searchInsert2(self, nums: List[int], target: int) -> int: 20210824 do it again Runtime: 63 ms, faster than 22.19% Memory Usage: 15 MB, less than 56.94% :param nums: :param ta...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def searchInsert2(self, nums: List[int], target: int) -> int: 20210824 do it again Runtime: 63 ms, faster than 22.19% Memory Usage: 15 MB, less than 56.94% :param nums: :param ta...
4dd1e54d8d08f7e6590bc76abd08ecaacaf775e5
<|skeleton|> class Solution: def searchInsert2(self, nums: List[int], target: int) -> int: """20210824 do it again Runtime: 63 ms, faster than 22.19% Memory Usage: 15 MB, less than 56.94% :param nums: :param target: :return:""" <|body_0|> def searchInsert(self, nums, target): """:type ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def searchInsert2(self, nums: List[int], target: int) -> int: """20210824 do it again Runtime: 63 ms, faster than 22.19% Memory Usage: 15 MB, less than 56.94% :param nums: :param target: :return:""" low, high = (0, len(nums) - 1) while low <= high: mid = low + (hi...
the_stack_v2_python_sparse
src/35-SearchInsertPosition.py
Jiezhi/myleetcode
train
1
a8333756ca8a2856aefe89a4af6986e9dc3f0845
[ "super().__init__(config)\nself.kg_start_idx = kg_start_idx\nself.prot_start_idx = prot_start_idx\nself.text_decoder = nn.Linear(config.hidden_size, config.lm_vocab_size, bias=False)\nself.entity_decoder = nn.Linear(config.hidden_size, config.kg_vocab_size, bias=False)\nself.prot_decoder = nn.Linear(config.hidden_s...
<|body_start_0|> super().__init__(config) self.kg_start_idx = kg_start_idx self.prot_start_idx = prot_start_idx self.text_decoder = nn.Linear(config.hidden_size, config.lm_vocab_size, bias=False) self.entity_decoder = nn.Linear(config.hidden_size, config.kg_vocab_size, bias=False...
Custom masked protein, entity and language modeling (PELM) head for proteins, entities and text tokens.
ProtSTonKGsPELMPredictionHead
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProtSTonKGsPELMPredictionHead: """Custom masked protein, entity and language modeling (PELM) head for proteins, entities and text tokens.""" def __init__(self, config, kg_start_idx: int=768, prot_start_idx: int=1024): """Initialize the ELM head based on the (hyper)parameters in the p...
stack_v2_sparse_classes_10k_train_004329
17,026
permissive
[ { "docstring": "Initialize the ELM head based on the (hyper)parameters in the provided BertConfig.", "name": "__init__", "signature": "def __init__(self, config, kg_start_idx: int=768, prot_start_idx: int=1024)" }, { "docstring": "Map hidden states to values for the text (1st part), kg (2nd part...
2
stack_v2_sparse_classes_30k_train_005593
Implement the Python class `ProtSTonKGsPELMPredictionHead` described below. Class description: Custom masked protein, entity and language modeling (PELM) head for proteins, entities and text tokens. Method signatures and docstrings: - def __init__(self, config, kg_start_idx: int=768, prot_start_idx: int=1024): Initia...
Implement the Python class `ProtSTonKGsPELMPredictionHead` described below. Class description: Custom masked protein, entity and language modeling (PELM) head for proteins, entities and text tokens. Method signatures and docstrings: - def __init__(self, config, kg_start_idx: int=768, prot_start_idx: int=1024): Initia...
2810353739a785ab9aee75ec15ffc738470bc288
<|skeleton|> class ProtSTonKGsPELMPredictionHead: """Custom masked protein, entity and language modeling (PELM) head for proteins, entities and text tokens.""" def __init__(self, config, kg_start_idx: int=768, prot_start_idx: int=1024): """Initialize the ELM head based on the (hyper)parameters in the p...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ProtSTonKGsPELMPredictionHead: """Custom masked protein, entity and language modeling (PELM) head for proteins, entities and text tokens.""" def __init__(self, config, kg_start_idx: int=768, prot_start_idx: int=1024): """Initialize the ELM head based on the (hyper)parameters in the provided BertC...
the_stack_v2_python_sparse
src/stonkgs/models/protstonkgs_model.py
stonkgs/stonkgs
train
30
6d8964c999013cf9977488687b806acf9a02c107
[ "shots = 100\ncircuits = ref_unitary_gate.unitary_gate_circuits_deterministic(final_measure=True)\ntargets = ref_unitary_gate.unitary_gate_counts_deterministic(shots)\nresult = execute(circuits, self.SIMULATOR, shots=shots).result()\nself.assertTrue(getattr(result, 'success', False))\nself.compare_counts(result, ci...
<|body_start_0|> shots = 100 circuits = ref_unitary_gate.unitary_gate_circuits_deterministic(final_measure=True) targets = ref_unitary_gate.unitary_gate_counts_deterministic(shots) result = execute(circuits, self.SIMULATOR, shots=shots).result() self.assertTrue(getattr(result, 's...
QasmSimulator additional tests.
QasmUnitaryGateTests
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QasmUnitaryGateTests: """QasmSimulator additional tests.""" def test_unitary_gate(self): """Test simulation with unitary gate circuit instructions.""" <|body_0|> def test_random_unitary_gate(self): """Test simulation with random unitary gate circuit instructions....
stack_v2_sparse_classes_10k_train_004330
3,511
permissive
[ { "docstring": "Test simulation with unitary gate circuit instructions.", "name": "test_unitary_gate", "signature": "def test_unitary_gate(self)" }, { "docstring": "Test simulation with random unitary gate circuit instructions.", "name": "test_random_unitary_gate", "signature": "def test...
2
stack_v2_sparse_classes_30k_train_005589
Implement the Python class `QasmUnitaryGateTests` described below. Class description: QasmSimulator additional tests. Method signatures and docstrings: - def test_unitary_gate(self): Test simulation with unitary gate circuit instructions. - def test_random_unitary_gate(self): Test simulation with random unitary gate ...
Implement the Python class `QasmUnitaryGateTests` described below. Class description: QasmSimulator additional tests. Method signatures and docstrings: - def test_unitary_gate(self): Test simulation with unitary gate circuit instructions. - def test_random_unitary_gate(self): Test simulation with random unitary gate ...
0c1c805fd5dfce465a8955ee3faf81037023a23e
<|skeleton|> class QasmUnitaryGateTests: """QasmSimulator additional tests.""" def test_unitary_gate(self): """Test simulation with unitary gate circuit instructions.""" <|body_0|> def test_random_unitary_gate(self): """Test simulation with random unitary gate circuit instructions....
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class QasmUnitaryGateTests: """QasmSimulator additional tests.""" def test_unitary_gate(self): """Test simulation with unitary gate circuit instructions.""" shots = 100 circuits = ref_unitary_gate.unitary_gate_circuits_deterministic(final_measure=True) targets = ref_unitary_gate...
the_stack_v2_python_sparse
artifacts/old_dataset_versions/original_commits/qiskit-aer/qiskit-aer#707/before/qasm_unitary_gate.py
MattePalte/Bugs-Quantum-Computing-Platforms
train
4
591292c85b964332f06cc0d06447f267977ac71f
[ "super().__init__()\nself.cost_class = cost_class\nself.cost_bbox = cost_bbox\nself.cost_giou = cost_giou\nassert cost_class != 0 or cost_bbox != 0 or cost_giou != 0, 'all costs cant be 0'", "with torch.no_grad():\n targets = [targets[1]]\n out_bbox = outputs['pred_boxes'].flatten(0, 1)\n out_bbox = out_...
<|body_start_0|> super().__init__() self.cost_class = cost_class self.cost_bbox = cost_bbox self.cost_giou = cost_giou assert cost_class != 0 or cost_bbox != 0 or cost_giou != 0, 'all costs cant be 0' <|end_body_0|> <|body_start_1|> with torch.no_grad(): targ...
SimpleMatcher
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SimpleMatcher: def __init__(self, cost_class: float=1, cost_bbox: float=1, cost_giou: float=1): """Creates the matcher Params: cost_class: This is the relative weight of the classification error in the matching cost cost_bbox: This is the relative weight of the L1 error of the bounding b...
stack_v2_sparse_classes_10k_train_004331
2,835
no_license
[ { "docstring": "Creates the matcher Params: cost_class: This is the relative weight of the classification error in the matching cost cost_bbox: This is the relative weight of the L1 error of the bounding box coordinates in the matching cost cost_giou: This is the relative weight of the giou loss of the bounding...
2
stack_v2_sparse_classes_30k_train_000556
Implement the Python class `SimpleMatcher` described below. Class description: Implement the SimpleMatcher class. Method signatures and docstrings: - def __init__(self, cost_class: float=1, cost_bbox: float=1, cost_giou: float=1): Creates the matcher Params: cost_class: This is the relative weight of the classificati...
Implement the Python class `SimpleMatcher` described below. Class description: Implement the SimpleMatcher class. Method signatures and docstrings: - def __init__(self, cost_class: float=1, cost_bbox: float=1, cost_giou: float=1): Creates the matcher Params: cost_class: This is the relative weight of the classificati...
24e1f80b24fb786039932603232b4c5801de1e37
<|skeleton|> class SimpleMatcher: def __init__(self, cost_class: float=1, cost_bbox: float=1, cost_giou: float=1): """Creates the matcher Params: cost_class: This is the relative weight of the classification error in the matching cost cost_bbox: This is the relative weight of the L1 error of the bounding b...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SimpleMatcher: def __init__(self, cost_class: float=1, cost_bbox: float=1, cost_giou: float=1): """Creates the matcher Params: cost_class: This is the relative weight of the classification error in the matching cost cost_bbox: This is the relative weight of the L1 error of the bounding box coordinates...
the_stack_v2_python_sparse
utils/simple_matcher.py
ZYWZ/rltracking
train
1
f8e035b9b474e6fe48f26bd751f494f141c91db0
[ "if obstacleGrid[0][0]:\n return 0\nrow = len(obstacleGrid)\ncol = len(obstacleGrid[0])\nres = [[0 for _ in range(col)] for _ in range(row)]\nfor i in range(row):\n if not obstacleGrid[i][0]:\n res[i][0] = 1\n else:\n break\nfor i in range(col):\n if not obstacleGrid[0][i]:\n res[0]...
<|body_start_0|> if obstacleGrid[0][0]: return 0 row = len(obstacleGrid) col = len(obstacleGrid[0]) res = [[0 for _ in range(col)] for _ in range(row)] for i in range(row): if not obstacleGrid[i][0]: res[i][0] = 1 else: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def uniquePathsWithObstacles(self, obstacleGrid): """:type obstacleGrid: List[List[int]] :rtype: int res[i][j] = res[i-1][j]+res[i][j-1]""" <|body_0|> def uniquePathsWithObstacles2(self, obstacleGrid): """:type obstacleGrid: List[List[int]] :rtype: int""" ...
stack_v2_sparse_classes_10k_train_004332
2,225
no_license
[ { "docstring": ":type obstacleGrid: List[List[int]] :rtype: int res[i][j] = res[i-1][j]+res[i][j-1]", "name": "uniquePathsWithObstacles", "signature": "def uniquePathsWithObstacles(self, obstacleGrid)" }, { "docstring": ":type obstacleGrid: List[List[int]] :rtype: int", "name": "uniquePathsW...
2
stack_v2_sparse_classes_30k_val_000098
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def uniquePathsWithObstacles(self, obstacleGrid): :type obstacleGrid: List[List[int]] :rtype: int res[i][j] = res[i-1][j]+res[i][j-1] - def uniquePathsWithObstacles2(self, obstac...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def uniquePathsWithObstacles(self, obstacleGrid): :type obstacleGrid: List[List[int]] :rtype: int res[i][j] = res[i-1][j]+res[i][j-1] - def uniquePathsWithObstacles2(self, obstac...
013f6f222c6c2a617787b258f8a37003a9f51526
<|skeleton|> class Solution: def uniquePathsWithObstacles(self, obstacleGrid): """:type obstacleGrid: List[List[int]] :rtype: int res[i][j] = res[i-1][j]+res[i][j-1]""" <|body_0|> def uniquePathsWithObstacles2(self, obstacleGrid): """:type obstacleGrid: List[List[int]] :rtype: int""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def uniquePathsWithObstacles(self, obstacleGrid): """:type obstacleGrid: List[List[int]] :rtype: int res[i][j] = res[i-1][j]+res[i][j-1]""" if obstacleGrid[0][0]: return 0 row = len(obstacleGrid) col = len(obstacleGrid[0]) res = [[0 for _ in range(...
the_stack_v2_python_sparse
dp/unique_paths_withobstacles.py
terrifyzhao/leetcode
train
0
828dbb37ef0e139c616567fbff25f6d9e0e420af
[ "try:\n send_health_message(KAFKA_SERVER, HEALTHTOPIC, SERVICENAME)\nexcept Exception as error:\n LogMessage(str(error), LogMessage.LogTyp.ERROR, SERVICENAME).log()", "try:\n report = json.loads(report.value.decode('UTF-8'))\n misp_connection = PyMISP(MISP_SERVER, MISP_TOKEN, MISP_CERT_VERIFY)\n ha...
<|body_start_0|> try: send_health_message(KAFKA_SERVER, HEALTHTOPIC, SERVICENAME) except Exception as error: LogMessage(str(error), LogMessage.LogTyp.ERROR, SERVICENAME).log() <|end_body_0|> <|body_start_1|> try: report = json.loads(report.value.decode('UTF-8...
Reporter will be a class representing the reporter-service.
Reporter
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Reporter: """Reporter will be a class representing the reporter-service.""" def healthpush(): """healthpush will send a health message to KAFKA.""" <|body_0|> def push_misp_report(report): """push_misp_report will send the misp report to the misp-platfrom.""" ...
stack_v2_sparse_classes_10k_train_004333
3,082
permissive
[ { "docstring": "healthpush will send a health message to KAFKA.", "name": "healthpush", "signature": "def healthpush()" }, { "docstring": "push_misp_report will send the misp report to the misp-platfrom.", "name": "push_misp_report", "signature": "def push_misp_report(report)" }, { ...
4
stack_v2_sparse_classes_30k_train_005630
Implement the Python class `Reporter` described below. Class description: Reporter will be a class representing the reporter-service. Method signatures and docstrings: - def healthpush(): healthpush will send a health message to KAFKA. - def push_misp_report(report): push_misp_report will send the misp report to the ...
Implement the Python class `Reporter` described below. Class description: Reporter will be a class representing the reporter-service. Method signatures and docstrings: - def healthpush(): healthpush will send a health message to KAFKA. - def push_misp_report(report): push_misp_report will send the misp report to the ...
cdad9966ab2aef495d0dca51a06cf567dd38a315
<|skeleton|> class Reporter: """Reporter will be a class representing the reporter-service.""" def healthpush(): """healthpush will send a health message to KAFKA.""" <|body_0|> def push_misp_report(report): """push_misp_report will send the misp report to the misp-platfrom.""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Reporter: """Reporter will be a class representing the reporter-service.""" def healthpush(): """healthpush will send a health message to KAFKA.""" try: send_health_message(KAFKA_SERVER, HEALTHTOPIC, SERVICENAME) except Exception as error: LogMessage(str(er...
the_stack_v2_python_sparse
iocreporter/core/server.py
hm-seclab/YAFRA
train
32
aa688f8d1c0b68b516e455eec4b6c191291e4b51
[ "self.newLines = self.__newCreateLines(quasimode)\nself.__newSmoothRags()\nself.__newRoundCorners()\nself.__setBackgroundColors()", "lines = []\nsuggestionList = quasimode.getSuggestionList()\ndescription = suggestionList.getDescription()\ndescription = escape_xml(description)\nsuggestions = suggestionList.getSug...
<|body_start_0|> self.newLines = self.__newCreateLines(quasimode) self.__newSmoothRags() self.__newRoundCorners() self.__setBackgroundColors() <|end_body_0|> <|body_start_1|> lines = [] suggestionList = quasimode.getSuggestionList() description = suggestionList.g...
Class for calculating and storing layout metrics of the quasimode window.
QuasimodeLayout
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QuasimodeLayout: """Class for calculating and storing layout metrics of the quasimode window.""" def __init__(self, quasimode): """Computes and stores the layout metrics for the quasimode.""" <|body_0|> def __newCreateLines(self, quasimode): """LONGTERM TODO: Doc...
stack_v2_sparse_classes_10k_train_004334
14,287
permissive
[ { "docstring": "Computes and stores the layout metrics for the quasimode.", "name": "__init__", "signature": "def __init__(self, quasimode)" }, { "docstring": "LONGTERM TODO: Document this.", "name": "__newCreateLines", "signature": "def __newCreateLines(self, quasimode)" }, { "d...
5
stack_v2_sparse_classes_30k_train_002566
Implement the Python class `QuasimodeLayout` described below. Class description: Class for calculating and storing layout metrics of the quasimode window. Method signatures and docstrings: - def __init__(self, quasimode): Computes and stores the layout metrics for the quasimode. - def __newCreateLines(self, quasimode...
Implement the Python class `QuasimodeLayout` described below. Class description: Class for calculating and storing layout metrics of the quasimode window. Method signatures and docstrings: - def __init__(self, quasimode): Computes and stores the layout metrics for the quasimode. - def __newCreateLines(self, quasimode...
61351f52f01367439e8810d2c482a9c9897545d8
<|skeleton|> class QuasimodeLayout: """Class for calculating and storing layout metrics of the quasimode window.""" def __init__(self, quasimode): """Computes and stores the layout metrics for the quasimode.""" <|body_0|> def __newCreateLines(self, quasimode): """LONGTERM TODO: Doc...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class QuasimodeLayout: """Class for calculating and storing layout metrics of the quasimode window.""" def __init__(self, quasimode): """Computes and stores the layout metrics for the quasimode.""" self.newLines = self.__newCreateLines(quasimode) self.__newSmoothRags() self.__ne...
the_stack_v2_python_sparse
enso/enso/quasimode/layout.py
GChristensen/enso-portable
train
144
45f5ef3cc47674d3c2b7e9a7d6bc6d700dc24d0d
[ "fleet_veh = self.pool.get('fleet.vehicle')\nrangs = fleet_veh._selection_year(self, cr, uid)\nlist_year = []\nfor years in rangs[1:len(rangs)]:\n list_year.append(years)\nreturn list_year", "data = self.read(cr, uid, ids, [], context=context)[0]\ndatas = {'ids': [], 'model': 'fleet.vehicle.log.contract', 'for...
<|body_start_0|> fleet_veh = self.pool.get('fleet.vehicle') rangs = fleet_veh._selection_year(self, cr, uid) list_year = [] for years in rangs[1:len(rangs)]: list_year.append(years) return list_year <|end_body_0|> <|body_start_1|> data = self.read(cr, uid, id...
To manage rented cars reports
rented_cars_wiz
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class rented_cars_wiz: """To manage rented cars reports""" def _year(self, cr, uid, context=None): """Select cars manufacturing years between 1970 and Current year. @return: list of years""" <|body_0|> def print_report(self, cr, uid, ids, context=None): """Print report...
stack_v2_sparse_classes_10k_train_004335
2,273
no_license
[ { "docstring": "Select cars manufacturing years between 1970 and Current year. @return: list of years", "name": "_year", "signature": "def _year(self, cr, uid, context=None)" }, { "docstring": "Print report. @return: Dictionary of print attributes", "name": "print_report", "signature": "...
2
null
Implement the Python class `rented_cars_wiz` described below. Class description: To manage rented cars reports Method signatures and docstrings: - def _year(self, cr, uid, context=None): Select cars manufacturing years between 1970 and Current year. @return: list of years - def print_report(self, cr, uid, ids, contex...
Implement the Python class `rented_cars_wiz` described below. Class description: To manage rented cars reports Method signatures and docstrings: - def _year(self, cr, uid, context=None): Select cars manufacturing years between 1970 and Current year. @return: list of years - def print_report(self, cr, uid, ids, contex...
0b997095c260d58b026440967fea3a202bef7efb
<|skeleton|> class rented_cars_wiz: """To manage rented cars reports""" def _year(self, cr, uid, context=None): """Select cars manufacturing years between 1970 and Current year. @return: list of years""" <|body_0|> def print_report(self, cr, uid, ids, context=None): """Print report...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class rented_cars_wiz: """To manage rented cars reports""" def _year(self, cr, uid, context=None): """Select cars manufacturing years between 1970 and Current year. @return: list of years""" fleet_veh = self.pool.get('fleet.vehicle') rangs = fleet_veh._selection_year(self, cr, uid) ...
the_stack_v2_python_sparse
v_7/Dongola/admin_affairs/service/wizard/rented_cars.py
musabahmed/baba
train
0
c8c00c2f7e6dd27cdb5ca5748ee9b011b527e0f2
[ "body = dict(request.data)\norg_id = self.get_organization(request)\nproperty_view_ids = body.get('property_view_ids')\ntaxlot_view_ids = body.get('taxlot_view_ids')\nif property_view_ids:\n property_views = PropertyView.objects.filter(id__in=property_view_ids, cycle__organization_id=org_id)\n properties = Pr...
<|body_start_0|> body = dict(request.data) org_id = self.get_organization(request) property_view_ids = body.get('property_view_ids') taxlot_view_ids = body.get('taxlot_view_ids') if property_view_ids: property_views = PropertyView.objects.filter(id__in=property_view_i...
GeocodeViewSet
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GeocodeViewSet: def geocode_by_ids(self, request): """Submit a request to geocode property and tax lot records.""" <|body_0|> def confidence_summary(self, request): """Generate a summary of geocoding confidence values for property and tax lot records.""" <|bo...
stack_v2_sparse_classes_10k_train_004336
6,094
permissive
[ { "docstring": "Submit a request to geocode property and tax lot records.", "name": "geocode_by_ids", "signature": "def geocode_by_ids(self, request)" }, { "docstring": "Generate a summary of geocoding confidence values for property and tax lot records.", "name": "confidence_summary", "s...
2
stack_v2_sparse_classes_30k_train_005324
Implement the Python class `GeocodeViewSet` described below. Class description: Implement the GeocodeViewSet class. Method signatures and docstrings: - def geocode_by_ids(self, request): Submit a request to geocode property and tax lot records. - def confidence_summary(self, request): Generate a summary of geocoding ...
Implement the Python class `GeocodeViewSet` described below. Class description: Implement the GeocodeViewSet class. Method signatures and docstrings: - def geocode_by_ids(self, request): Submit a request to geocode property and tax lot records. - def confidence_summary(self, request): Generate a summary of geocoding ...
680b6a2b45f3c568d779d8ac86553a0b08c384c8
<|skeleton|> class GeocodeViewSet: def geocode_by_ids(self, request): """Submit a request to geocode property and tax lot records.""" <|body_0|> def confidence_summary(self, request): """Generate a summary of geocoding confidence values for property and tax lot records.""" <|bo...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class GeocodeViewSet: def geocode_by_ids(self, request): """Submit a request to geocode property and tax lot records.""" body = dict(request.data) org_id = self.get_organization(request) property_view_ids = body.get('property_view_ids') taxlot_view_ids = body.get('taxlot_view...
the_stack_v2_python_sparse
seed/views/v3/geocode.py
SEED-platform/seed
train
108
3332f40223004e1be18d1012f79910850736edf9
[ "defined_fields = self.form.used_field_names\nrequired_fields = self.form.get_required_field_names()\nmissing_fields = []\nfor field in required_fields:\n if field not in defined_fields:\n missing_fields.append(field)\nif len(missing_fields) > 0:\n raise ValidationError('The save instance handler can o...
<|body_start_0|> defined_fields = self.form.used_field_names required_fields = self.form.get_required_field_names() missing_fields = [] for field in required_fields: if field not in defined_fields: missing_fields.append(field) if len(missing_fields) > ...
Handler for saving the form instance
OmniFormSaveInstanceHandler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OmniFormSaveInstanceHandler: """Handler for saving the form instance""" def assert_has_all_required_fields(self): """Property that determines whether or not the associated form defines all of the required fields :raises: ValidationError""" <|body_0|> def clean(self): ...
stack_v2_sparse_classes_10k_train_004337
47,532
permissive
[ { "docstring": "Property that determines whether or not the associated form defines all of the required fields :raises: ValidationError", "name": "assert_has_all_required_fields", "signature": "def assert_has_all_required_fields(self)" }, { "docstring": "Cleans the handler for saving a model ins...
3
stack_v2_sparse_classes_30k_train_004259
Implement the Python class `OmniFormSaveInstanceHandler` described below. Class description: Handler for saving the form instance Method signatures and docstrings: - def assert_has_all_required_fields(self): Property that determines whether or not the associated form defines all of the required fields :raises: Valida...
Implement the Python class `OmniFormSaveInstanceHandler` described below. Class description: Handler for saving the form instance Method signatures and docstrings: - def assert_has_all_required_fields(self): Property that determines whether or not the associated form defines all of the required fields :raises: Valida...
0c96162445f8b5ddf7f326f6b0a2e6ec239c4bd5
<|skeleton|> class OmniFormSaveInstanceHandler: """Handler for saving the form instance""" def assert_has_all_required_fields(self): """Property that determines whether or not the associated form defines all of the required fields :raises: ValidationError""" <|body_0|> def clean(self): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class OmniFormSaveInstanceHandler: """Handler for saving the form instance""" def assert_has_all_required_fields(self): """Property that determines whether or not the associated form defines all of the required fields :raises: ValidationError""" defined_fields = self.form.used_field_names ...
the_stack_v2_python_sparse
omniforms/models.py
omni-digital/omni-forms
train
6
8c2fd26e0624f01504a6e1e2fdd6d2b363a3d6ab
[ "response = self.client.get('/shopping_bag/')\nself.assertEqual(response.status_code, 200)\nself.assertTemplateUsed(response, 'shopping_bag/bag.html')", "user = User.objects.create(username='test')\nimage = Image.objects.create(img_title='test', base_price=0, user_id=user)\nbag = {image.id: 1}\nresponse = self.cl...
<|body_start_0|> response = self.client.get('/shopping_bag/') self.assertEqual(response.status_code, 200) self.assertTemplateUsed(response, 'shopping_bag/bag.html') <|end_body_0|> <|body_start_1|> user = User.objects.create(username='test') image = Image.objects.create(img_title...
test shpopping bag views
TestShoppingBagViews
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestShoppingBagViews: """test shpopping bag views""" def test_show_bag(self): """test show bag view""" <|body_0|> def test_add_to_bag(self): """test add to bag view""" <|body_1|> <|end_skeleton|> <|body_start_0|> response = self.client.get('/sho...
stack_v2_sparse_classes_10k_train_004338
799
no_license
[ { "docstring": "test show bag view", "name": "test_show_bag", "signature": "def test_show_bag(self)" }, { "docstring": "test add to bag view", "name": "test_add_to_bag", "signature": "def test_add_to_bag(self)" } ]
2
stack_v2_sparse_classes_30k_train_001596
Implement the Python class `TestShoppingBagViews` described below. Class description: test shpopping bag views Method signatures and docstrings: - def test_show_bag(self): test show bag view - def test_add_to_bag(self): test add to bag view
Implement the Python class `TestShoppingBagViews` described below. Class description: test shpopping bag views Method signatures and docstrings: - def test_show_bag(self): test show bag view - def test_add_to_bag(self): test add to bag view <|skeleton|> class TestShoppingBagViews: """test shpopping bag views""" ...
3b12c46beb5b04a506ef6c9fe252d1c891cdd49f
<|skeleton|> class TestShoppingBagViews: """test shpopping bag views""" def test_show_bag(self): """test show bag view""" <|body_0|> def test_add_to_bag(self): """test add to bag view""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestShoppingBagViews: """test shpopping bag views""" def test_show_bag(self): """test show bag view""" response = self.client.get('/shopping_bag/') self.assertEqual(response.status_code, 200) self.assertTemplateUsed(response, 'shopping_bag/bag.html') def test_add_to_b...
the_stack_v2_python_sparse
shopping_bag/test_shopping_bag_views.py
Code-Institute-Submissions/Final_Milestone_Project
train
0
afbf0983e90d9efac98652276eec985fadbb9700
[ "super(RelativePosition, self).__init__()\nself.num_units = num_units\nself.device = device\nself.max_relative_position = max_relative_position\nself.embeddings_table = nn.Parameter(torch.Tensor(max_relative_position * 2 + 1, num_units))\nnn.init.xavier_uniform_(self.embeddings_table)", "range_vec_q = torch.arang...
<|body_start_0|> super(RelativePosition, self).__init__() self.num_units = num_units self.device = device self.max_relative_position = max_relative_position self.embeddings_table = nn.Parameter(torch.Tensor(max_relative_position * 2 + 1, num_units)) nn.init.xavier_uniform...
RelativePosition
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RelativePosition: def __init__(self, num_units, max_relative_position, device=None): """:param num_units: d_a :param max_relative_position: k""" <|body_0|> def forward(self, length_q, length_k): """for self-att: length_q == length_k == length_x return: embeddings: le...
stack_v2_sparse_classes_10k_train_004339
1,268
no_license
[ { "docstring": ":param num_units: d_a :param max_relative_position: k", "name": "__init__", "signature": "def __init__(self, num_units, max_relative_position, device=None)" }, { "docstring": "for self-att: length_q == length_k == length_x return: embeddings: length_q x length_k x d_a", "name...
2
stack_v2_sparse_classes_30k_train_001980
Implement the Python class `RelativePosition` described below. Class description: Implement the RelativePosition class. Method signatures and docstrings: - def __init__(self, num_units, max_relative_position, device=None): :param num_units: d_a :param max_relative_position: k - def forward(self, length_q, length_k): ...
Implement the Python class `RelativePosition` described below. Class description: Implement the RelativePosition class. Method signatures and docstrings: - def __init__(self, num_units, max_relative_position, device=None): :param num_units: d_a :param max_relative_position: k - def forward(self, length_q, length_k): ...
1bfff12c6b03f64f57d118b435c0040431befcdf
<|skeleton|> class RelativePosition: def __init__(self, num_units, max_relative_position, device=None): """:param num_units: d_a :param max_relative_position: k""" <|body_0|> def forward(self, length_q, length_k): """for self-att: length_q == length_k == length_x return: embeddings: le...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RelativePosition: def __init__(self, num_units, max_relative_position, device=None): """:param num_units: d_a :param max_relative_position: k""" super(RelativePosition, self).__init__() self.num_units = num_units self.device = device self.max_relative_position = max_rel...
the_stack_v2_python_sparse
nag/modules/relative_position.py
liu-hz18/Non-Autoregressive-Neural-Dialogue-Generation
train
0
b62173335183be65b5f41cc1779a5b84b3e2cbfb
[ "super(DRQN, self).__init__()\nobs_shape, action_shape = (squeeze(obs_shape), squeeze(action_shape))\nif head_hidden_size is None:\n head_hidden_size = encoder_hidden_size_list[-1]\nif isinstance(obs_shape, int) or len(obs_shape) == 1:\n self.encoder = FCEncoder(obs_shape, encoder_hidden_size_list, activation...
<|body_start_0|> super(DRQN, self).__init__() obs_shape, action_shape = (squeeze(obs_shape), squeeze(action_shape)) if head_hidden_size is None: head_hidden_size = encoder_hidden_size_list[-1] if isinstance(obs_shape, int) or len(obs_shape) == 1: self.encoder = FC...
Overview: DQN + RNN = DRQN
DRQN
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DRQN: """Overview: DQN + RNN = DRQN""" def __init__(self, obs_shape: Union[int, SequenceType], action_shape: Union[int, SequenceType], encoder_hidden_size_list: SequenceType=[128, 128, 64], dueling: bool=True, head_hidden_size: Optional[int]=None, head_layer_num: int=1, lstm_type: Optional[s...
stack_v2_sparse_classes_10k_train_004340
30,380
permissive
[ { "docstring": "Overview: Init the DRQN Model according to arguments. Arguments: - obs_shape (:obj:`Union[int, SequenceType]`): Observation's space. - action_shape (:obj:`Union[int, SequenceType]`): Action's space. - encoder_hidden_size_list (:obj:`SequenceType`): Collection of ``hidden_size`` to pass to ``Enco...
2
null
Implement the Python class `DRQN` described below. Class description: Overview: DQN + RNN = DRQN Method signatures and docstrings: - def __init__(self, obs_shape: Union[int, SequenceType], action_shape: Union[int, SequenceType], encoder_hidden_size_list: SequenceType=[128, 128, 64], dueling: bool=True, head_hidden_si...
Implement the Python class `DRQN` described below. Class description: Overview: DQN + RNN = DRQN Method signatures and docstrings: - def __init__(self, obs_shape: Union[int, SequenceType], action_shape: Union[int, SequenceType], encoder_hidden_size_list: SequenceType=[128, 128, 64], dueling: bool=True, head_hidden_si...
eb483fa6e46602d58c8e7d2ca1e566adca28e703
<|skeleton|> class DRQN: """Overview: DQN + RNN = DRQN""" def __init__(self, obs_shape: Union[int, SequenceType], action_shape: Union[int, SequenceType], encoder_hidden_size_list: SequenceType=[128, 128, 64], dueling: bool=True, head_hidden_size: Optional[int]=None, head_layer_num: int=1, lstm_type: Optional[s...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DRQN: """Overview: DQN + RNN = DRQN""" def __init__(self, obs_shape: Union[int, SequenceType], action_shape: Union[int, SequenceType], encoder_hidden_size_list: SequenceType=[128, 128, 64], dueling: bool=True, head_hidden_size: Optional[int]=None, head_layer_num: int=1, lstm_type: Optional[str]='normal',...
the_stack_v2_python_sparse
ding/model/template/q_learning.py
shengxuesun/DI-engine
train
1
c8c69eeb76a952a5d513aaf6b8cabbfe5803e075
[ "QUiLoader.__init__(self, baseinstance)\nself.baseinstance = baseinstance\nif customWidgets is None:\n self.customWidgets = {}\nelse:\n self.customWidgets = customWidgets", "if parent is None and self.baseinstance:\n return self.baseinstance\nelse:\n if class_name in self.availableWidgets() or class_n...
<|body_start_0|> QUiLoader.__init__(self, baseinstance) self.baseinstance = baseinstance if customWidgets is None: self.customWidgets = {} else: self.customWidgets = customWidgets <|end_body_0|> <|body_start_1|> if parent is None and self.baseinstance: ...
Subclass of :class:`~PySide.QtUiTools.QUiLoader` to create the user interface in a base instance. Unlike :class:`~PySide.QtUiTools.QUiLoader` itself this class does not create a new instance of the top-level widget, but creates the user interface in an existing instance of the top-level class if needed. This mimics the...
UiLoader
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UiLoader: """Subclass of :class:`~PySide.QtUiTools.QUiLoader` to create the user interface in a base instance. Unlike :class:`~PySide.QtUiTools.QUiLoader` itself this class does not create a new instance of the top-level widget, but creates the user interface in an existing instance of the top-le...
stack_v2_sparse_classes_10k_train_004341
11,582
permissive
[ { "docstring": "Create a loader for the given ``baseinstance``. The user interface is created in ``baseinstance``, which must be an instance of the top-level class in the user interface to load, or a subclass thereof. ``customWidgets`` is a dictionary mapping from class name to class object for custom widgets. ...
2
stack_v2_sparse_classes_30k_train_003204
Implement the Python class `UiLoader` described below. Class description: Subclass of :class:`~PySide.QtUiTools.QUiLoader` to create the user interface in a base instance. Unlike :class:`~PySide.QtUiTools.QUiLoader` itself this class does not create a new instance of the top-level widget, but creates the user interfac...
Implement the Python class `UiLoader` described below. Class description: Subclass of :class:`~PySide.QtUiTools.QUiLoader` to create the user interface in a base instance. Unlike :class:`~PySide.QtUiTools.QUiLoader` itself this class does not create a new instance of the top-level widget, but creates the user interfac...
323c6fef4100220a84daf964ed0b78058862bc29
<|skeleton|> class UiLoader: """Subclass of :class:`~PySide.QtUiTools.QUiLoader` to create the user interface in a base instance. Unlike :class:`~PySide.QtUiTools.QUiLoader` itself this class does not create a new instance of the top-level widget, but creates the user interface in an existing instance of the top-le...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UiLoader: """Subclass of :class:`~PySide.QtUiTools.QUiLoader` to create the user interface in a base instance. Unlike :class:`~PySide.QtUiTools.QUiLoader` itself this class does not create a new instance of the top-level widget, but creates the user interface in an existing instance of the top-level class if ...
the_stack_v2_python_sparse
winpython/_vendor/qtpy/uic.py
winpython/winpython
train
1,796
5bf508a5d1476c83e97a645f47e391f00f0ca9da
[ "res = []\nif not root:\n return res\nres.append(root.val)\nfrontier = deque([root])\nwhile frontier:\n expand = frontier.popleft()\n for kid in (expand.left, expand.right):\n if kid is None:\n res.append(None)\n else:\n res.append(kid.val)\n frontier.append(k...
<|body_start_0|> res = [] if not root: return res res.append(root.val) frontier = deque([root]) while frontier: expand = frontier.popleft() for kid in (expand.left, expand.right): if kid is None: res.append(N...
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_10k_train_004342
2,351
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:...
11d6bf2ba7b50c07e048df37c4e05c8f46b92241
<|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_10k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" res = [] if not root: return res res.append(root.val) frontier = deque([root]) while frontier: expand = frontier.popleft() ...
the_stack_v2_python_sparse
LeetCodes/facebook/Serialize and Deserialize Binary Tree.py
chutianwen/LeetCodes
train
0
4d794a4365ba31422de5927118c4608dfeb53c46
[ "super(EncodedTextReader, self).__init__()\nself._buffer = ''\nself._buffer_size = buffer_size\nself._current_offset = 0\nself._encoding = encoding\nself.lines = ''", "if len(self._buffer) < self._buffer_size:\n content = file_object.read(self._buffer_size)\n content = content.decode(self._encoding)\n se...
<|body_start_0|> super(EncodedTextReader, self).__init__() self._buffer = '' self._buffer_size = buffer_size self._current_offset = 0 self._encoding = encoding self.lines = '' <|end_body_0|> <|body_start_1|> if len(self._buffer) < self._buffer_size: c...
Encoded text reader.
EncodedTextReader
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EncodedTextReader: """Encoded text reader.""" def __init__(self, encoding, buffer_size=2048): """Initializes the encoded text reader object. Args: encoding (str): encoding. buffer_size (Optional[int]): buffer size.""" <|body_0|> def _ReadLine(self, file_object): ...
stack_v2_sparse_classes_10k_train_004343
24,154
permissive
[ { "docstring": "Initializes the encoded text reader object. Args: encoding (str): encoding. buffer_size (Optional[int]): buffer size.", "name": "__init__", "signature": "def __init__(self, encoding, buffer_size=2048)" }, { "docstring": "Reads a line from the file object. Args: file_object (dfvfs...
6
stack_v2_sparse_classes_30k_train_000805
Implement the Python class `EncodedTextReader` described below. Class description: Encoded text reader. Method signatures and docstrings: - def __init__(self, encoding, buffer_size=2048): Initializes the encoded text reader object. Args: encoding (str): encoding. buffer_size (Optional[int]): buffer size. - def _ReadL...
Implement the Python class `EncodedTextReader` described below. Class description: Encoded text reader. Method signatures and docstrings: - def __init__(self, encoding, buffer_size=2048): Initializes the encoded text reader object. Args: encoding (str): encoding. buffer_size (Optional[int]): buffer size. - def _ReadL...
c69b2952b608cfce47ff8fd0d1409d856be35cb1
<|skeleton|> class EncodedTextReader: """Encoded text reader.""" def __init__(self, encoding, buffer_size=2048): """Initializes the encoded text reader object. Args: encoding (str): encoding. buffer_size (Optional[int]): buffer size.""" <|body_0|> def _ReadLine(self, file_object): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class EncodedTextReader: """Encoded text reader.""" def __init__(self, encoding, buffer_size=2048): """Initializes the encoded text reader object. Args: encoding (str): encoding. buffer_size (Optional[int]): buffer size.""" super(EncodedTextReader, self).__init__() self._buffer = '' ...
the_stack_v2_python_sparse
plaso/parsers/text_parser.py
cyb3rfox/plaso
train
3
c570b89332ebcfa5b6aee651c4b0a0c773dac507
[ "super().__init__(self.PROBLEM_NAME)\nself.root_node = root_node\nself.label1 = label1\nself.label2 = label2", "print('Solving {} problem ...'.format(self.PROBLEM_NAME))\npath1 = []\nself.path_to_node(self.root_node, path1, self.label1)\npath2 = []\nself.path_to_node(self.root_node, path2, self.label2)\ni = 0\nwh...
<|body_start_0|> super().__init__(self.PROBLEM_NAME) self.root_node = root_node self.label1 = label1 self.label2 = label2 <|end_body_0|> <|body_start_1|> print('Solving {} problem ...'.format(self.PROBLEM_NAME)) path1 = [] self.path_to_node(self.root_node, path1,...
Find Distance Between Two Nodes
FindDistanceBetweenTwoNodes
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FindDistanceBetweenTwoNodes: """Find Distance Between Two Nodes""" def __init__(self, root_node, label1, label2): """Find Distance Between Two Nodes Args: root_node: node of the tree label1: First node's label label2: Second node's label Returns: None Raises: None""" <|body_0...
stack_v2_sparse_classes_10k_train_004344
2,695
no_license
[ { "docstring": "Find Distance Between Two Nodes Args: root_node: node of the tree label1: First node's label label2: Second node's label Returns: None Raises: None", "name": "__init__", "signature": "def __init__(self, root_node, label1, label2)" }, { "docstring": "Solve the problem Note: O(n) (...
3
stack_v2_sparse_classes_30k_train_006747
Implement the Python class `FindDistanceBetweenTwoNodes` described below. Class description: Find Distance Between Two Nodes Method signatures and docstrings: - def __init__(self, root_node, label1, label2): Find Distance Between Two Nodes Args: root_node: node of the tree label1: First node's label label2: Second no...
Implement the Python class `FindDistanceBetweenTwoNodes` described below. Class description: Find Distance Between Two Nodes Method signatures and docstrings: - def __init__(self, root_node, label1, label2): Find Distance Between Two Nodes Args: root_node: node of the tree label1: First node's label label2: Second no...
11f4d25cb211740514c119a60962d075a0817abd
<|skeleton|> class FindDistanceBetweenTwoNodes: """Find Distance Between Two Nodes""" def __init__(self, root_node, label1, label2): """Find Distance Between Two Nodes Args: root_node: node of the tree label1: First node's label label2: Second node's label Returns: None Raises: None""" <|body_0...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FindDistanceBetweenTwoNodes: """Find Distance Between Two Nodes""" def __init__(self, root_node, label1, label2): """Find Distance Between Two Nodes Args: root_node: node of the tree label1: First node's label label2: Second node's label Returns: None Raises: None""" super().__init__(self...
the_stack_v2_python_sparse
python/problems/binary_tree/find_distance_between_two_nodes.py
santhosh-kumar/AlgorithmsAndDataStructures
train
2
79205759e44904843ef5999daeaeaf4fb8e02563
[ "s = sum(nums)\nif s % k != 0:\n return False\ntarget = s // k\nvisited = [False for _ in nums]\nreturn self.dfs(nums, None, target, visited, k)", "if k == 0:\n return True\nif cur_sum and cur_sum == target_sum:\n return self.dfs(nums, None, target_sum, visited, k - 1)\nfor i in range(len(nums)):\n if...
<|body_start_0|> s = sum(nums) if s % k != 0: return False target = s // k visited = [False for _ in nums] return self.dfs(nums, None, target, visited, k) <|end_body_0|> <|body_start_1|> if k == 0: return True if cur_sum and cur_sum == tar...
Solution_TLE
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution_TLE: def canPartitionKSubsets(self, nums: List[int], k: int) -> bool: """resurive search""" <|body_0|> def dfs(self, nums, cur_sum, target_sum, visited, k): """some corner cases: 1. target_sum default at 0: sum or empty array is 0? 2. nxt_sum = (cur_sum or 0...
stack_v2_sparse_classes_10k_train_004345
3,307
no_license
[ { "docstring": "resurive search", "name": "canPartitionKSubsets", "signature": "def canPartitionKSubsets(self, nums: List[int], k: int) -> bool" }, { "docstring": "some corner cases: 1. target_sum default at 0: sum or empty array is 0? 2. nxt_sum = (cur_sum or 0) + nums[i] rather than cur_sum or...
2
stack_v2_sparse_classes_30k_train_002214
Implement the Python class `Solution_TLE` described below. Class description: Implement the Solution_TLE class. Method signatures and docstrings: - def canPartitionKSubsets(self, nums: List[int], k: int) -> bool: resurive search - def dfs(self, nums, cur_sum, target_sum, visited, k): some corner cases: 1. target_sum ...
Implement the Python class `Solution_TLE` described below. Class description: Implement the Solution_TLE class. Method signatures and docstrings: - def canPartitionKSubsets(self, nums: List[int], k: int) -> bool: resurive search - def dfs(self, nums, cur_sum, target_sum, visited, k): some corner cases: 1. target_sum ...
929dde1723fb2f54870c8a9badc80fc23e8400d3
<|skeleton|> class Solution_TLE: def canPartitionKSubsets(self, nums: List[int], k: int) -> bool: """resurive search""" <|body_0|> def dfs(self, nums, cur_sum, target_sum, visited, k): """some corner cases: 1. target_sum default at 0: sum or empty array is 0? 2. nxt_sum = (cur_sum or 0...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution_TLE: def canPartitionKSubsets(self, nums: List[int], k: int) -> bool: """resurive search""" s = sum(nums) if s % k != 0: return False target = s // k visited = [False for _ in nums] return self.dfs(nums, None, target, visited, k) def df...
the_stack_v2_python_sparse
_algorithms_challenges/leetcode/LeetCode/698 Partition to K Equal Sum Subsets.py
syurskyi/Algorithms_and_Data_Structure
train
4
c1aa2c79ec02ea2569d041088936be373b090142
[ "s.dingding = dingding\ns.subscription_dictionary = d\ns.match_pattern = d['MatchPattern']\ns.xmlrpc_recv_url = d['XmlRpcRecvUrl']\ns.recv_password = d.get('RecvPassword', None)\ns.subscription_passwords = d.get('SubscriptionPasswords', [])\ns.who_can_see_this = d.get('WhoCanSeeThis', s.dingding.options.get_default...
<|body_start_0|> s.dingding = dingding s.subscription_dictionary = d s.match_pattern = d['MatchPattern'] s.xmlrpc_recv_url = d['XmlRpcRecvUrl'] s.recv_password = d.get('RecvPassword', None) s.subscription_passwords = d.get('SubscriptionPasswords', []) s.who_can_se...
Subscription - augment a subscription dictionary
Subscription
[ "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Subscription: """Subscription - augment a subscription dictionary""" def __init__(s, d, dingding): """subscription dictionary: * MatchPattern (*REQUIRED* - pattern of data matching out) * XmlRpcRecvUrl (REQUIRED) - XML-RPC URL for receiving Notify messages * RecvPassword (OPTIONAL - ...
stack_v2_sparse_classes_10k_train_004346
25,098
permissive
[ { "docstring": "subscription dictionary: * MatchPattern (*REQUIRED* - pattern of data matching out) * XmlRpcRecvUrl (REQUIRED) - XML-RPC URL for receiving Notify messages * RecvPassword (OPTIONAL - used when posting a NOTIFY, also a legitimizing recipient password) * SubscriptionPasswords (OPTIONAL - group pass...
2
stack_v2_sparse_classes_30k_train_002744
Implement the Python class `Subscription` described below. Class description: Subscription - augment a subscription dictionary Method signatures and docstrings: - def __init__(s, d, dingding): subscription dictionary: * MatchPattern (*REQUIRED* - pattern of data matching out) * XmlRpcRecvUrl (REQUIRED) - XML-RPC URL ...
Implement the Python class `Subscription` described below. Class description: Subscription - augment a subscription dictionary Method signatures and docstrings: - def __init__(s, d, dingding): subscription dictionary: * MatchPattern (*REQUIRED* - pattern of data matching out) * XmlRpcRecvUrl (REQUIRED) - XML-RPC URL ...
da65d948b346d3f455e79168a8753b2b16d8fc5f
<|skeleton|> class Subscription: """Subscription - augment a subscription dictionary""" def __init__(s, d, dingding): """subscription dictionary: * MatchPattern (*REQUIRED* - pattern of data matching out) * XmlRpcRecvUrl (REQUIRED) - XML-RPC URL for receiving Notify messages * RecvPassword (OPTIONAL - ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Subscription: """Subscription - augment a subscription dictionary""" def __init__(s, d, dingding): """subscription dictionary: * MatchPattern (*REQUIRED* - pattern of data matching out) * XmlRpcRecvUrl (REQUIRED) - XML-RPC URL for receiving Notify messages * RecvPassword (OPTIONAL - used when pos...
the_stack_v2_python_sparse
ancient/src/dingding/dingding.py
BackupTheBerlios/onebigsoup-svn
train
0
910897d88113ab288cdb465e40036e3a92f90c45
[ "coord_name = 'air_temperature status_flag'\ntry:\n coord = cube.coord(coord_name)\nexcept CoordinateNotFoundError:\n coord = None\nif coord:\n if coord.attributes != {'flag_meanings': 'above_surface_pressure below_surface_pressure', 'flag_values': np.array([0, 1], dtype='int8')}:\n raise ValueError...
<|body_start_0|> coord_name = 'air_temperature status_flag' try: coord = cube.coord(coord_name) except CoordinateNotFoundError: coord = None if coord: if coord.attributes != {'flag_meanings': 'above_surface_pressure below_surface_pressure', 'flag_value...
Plugin to standardise cube metadata
StandardiseMetadata
[ "BSD-3-Clause", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StandardiseMetadata: """Plugin to standardise cube metadata""" def _rm_air_temperature_status_flag(cube: Cube) -> Cube: """Remove air_temperature status_flag coord by applying as NaN to cube data. See https://github.com/metoppv/improver/pull/1839 for further details.""" <|bod...
stack_v2_sparse_classes_10k_train_004347
8,621
permissive
[ { "docstring": "Remove air_temperature status_flag coord by applying as NaN to cube data. See https://github.com/metoppv/improver/pull/1839 for further details.", "name": "_rm_air_temperature_status_flag", "signature": "def _rm_air_temperature_status_flag(cube: Cube) -> Cube" }, { "docstring": "...
6
stack_v2_sparse_classes_30k_train_004657
Implement the Python class `StandardiseMetadata` described below. Class description: Plugin to standardise cube metadata Method signatures and docstrings: - def _rm_air_temperature_status_flag(cube: Cube) -> Cube: Remove air_temperature status_flag coord by applying as NaN to cube data. See https://github.com/metoppv...
Implement the Python class `StandardiseMetadata` described below. Class description: Plugin to standardise cube metadata Method signatures and docstrings: - def _rm_air_temperature_status_flag(cube: Cube) -> Cube: Remove air_temperature status_flag coord by applying as NaN to cube data. See https://github.com/metoppv...
cd2c9019944345df1e703bf8f625db537ad9f559
<|skeleton|> class StandardiseMetadata: """Plugin to standardise cube metadata""" def _rm_air_temperature_status_flag(cube: Cube) -> Cube: """Remove air_temperature status_flag coord by applying as NaN to cube data. See https://github.com/metoppv/improver/pull/1839 for further details.""" <|bod...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class StandardiseMetadata: """Plugin to standardise cube metadata""" def _rm_air_temperature_status_flag(cube: Cube) -> Cube: """Remove air_temperature status_flag coord by applying as NaN to cube data. See https://github.com/metoppv/improver/pull/1839 for further details.""" coord_name = 'air_...
the_stack_v2_python_sparse
improver/standardise.py
metoppv/improver
train
101
e06f0aecbc9c0f40b7bea990f1e68d6d37df31ad
[ "if not isinstance(loader, SAMLMetadataLoader):\n raise ValueError(\"Argument 'loader' must be an instance of {0} class\".format(SAMLMetadataLoader))\nif not isinstance(validator, SAMLFederatedMetadataValidator):\n raise ValueError(\"Argument 'validator' must be an instance of {0} class\".format(SAMLFederated...
<|body_start_0|> if not isinstance(loader, SAMLMetadataLoader): raise ValueError("Argument 'loader' must be an instance of {0} class".format(SAMLMetadataLoader)) if not isinstance(validator, SAMLFederatedMetadataValidator): raise ValueError("Argument 'validator' must be an instan...
Loads metadata of federated IdPs from the specified metadata service.
SAMLFederatedIdentityProviderLoader
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SAMLFederatedIdentityProviderLoader: """Loads metadata of federated IdPs from the specified metadata service.""" def __init__(self, loader, validator, parser): """Initialize a new instance of SAMLFederatedIdentityProviderLoader class. :param loader: SAML metadata loader :type loader:...
stack_v2_sparse_classes_10k_train_004348
6,037
permissive
[ { "docstring": "Initialize a new instance of SAMLFederatedIdentityProviderLoader class. :param loader: SAML metadata loader :type loader: api.saml.metadata.federations.loader.SAMLMetadataLoader :param validator: SAML metadata validator :type validator: api.saml.metadata.federations.validator.SAMLFederatedMetada...
3
stack_v2_sparse_classes_30k_train_003537
Implement the Python class `SAMLFederatedIdentityProviderLoader` described below. Class description: Loads metadata of federated IdPs from the specified metadata service. Method signatures and docstrings: - def __init__(self, loader, validator, parser): Initialize a new instance of SAMLFederatedIdentityProviderLoader...
Implement the Python class `SAMLFederatedIdentityProviderLoader` described below. Class description: Loads metadata of federated IdPs from the specified metadata service. Method signatures and docstrings: - def __init__(self, loader, validator, parser): Initialize a new instance of SAMLFederatedIdentityProviderLoader...
662cc7e0721d0153857c8c17a37e2a6df86f8ce6
<|skeleton|> class SAMLFederatedIdentityProviderLoader: """Loads metadata of federated IdPs from the specified metadata service.""" def __init__(self, loader, validator, parser): """Initialize a new instance of SAMLFederatedIdentityProviderLoader class. :param loader: SAML metadata loader :type loader:...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SAMLFederatedIdentityProviderLoader: """Loads metadata of federated IdPs from the specified metadata service.""" def __init__(self, loader, validator, parser): """Initialize a new instance of SAMLFederatedIdentityProviderLoader class. :param loader: SAML metadata loader :type loader: api.saml.met...
the_stack_v2_python_sparse
api/saml/metadata/federations/loader.py
NYPL-Simplified/circulation
train
20
27438849b800c9fa65cba43b03818eb13c7d7d86
[ "self._vectorizer = TfidfVectorizer(ngram_range=ngram_range, min_df=min_df, max_df=max_df, analyzer=analyzer.value)\nself._documents = documents\nself._index = self._vectorizer.fit_transform(map(text_getter, self._documents))", "query_vector = self._vectorizer.transform([query])\nscores = zip(self._documents, sel...
<|body_start_0|> self._vectorizer = TfidfVectorizer(ngram_range=ngram_range, min_df=min_df, max_df=max_df, analyzer=analyzer.value) self._documents = documents self._index = self._vectorizer.fit_transform(map(text_getter, self._documents)) <|end_body_0|> <|body_start_1|> query_vector = ...
A simple text index from a corpus of text using tf-idf similarity.
TextIndex
[ "Apache-2.0", "LicenseRef-scancode-generic-cla" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TextIndex: """A simple text index from a corpus of text using tf-idf similarity.""" def __init__(self, documents, text_getter, ngram_range=(1, 2), analyzer=Analyzer.WORD, min_df=1, max_df=0.9): """Init parameters for TextIndex. Args: documents: Corpus of documents to be indexed and r...
stack_v2_sparse_classes_10k_train_004349
4,223
permissive
[ { "docstring": "Init parameters for TextIndex. Args: documents: Corpus of documents to be indexed and retrieved. text_getter: Function to extract text from documents. ngram_range: tuple (min_n, max_n), default=(1, 2) The lower and upper boundary of the range of n-values for different n-grams to be extracted. Al...
2
stack_v2_sparse_classes_30k_train_005983
Implement the Python class `TextIndex` described below. Class description: A simple text index from a corpus of text using tf-idf similarity. Method signatures and docstrings: - def __init__(self, documents, text_getter, ngram_range=(1, 2), analyzer=Analyzer.WORD, min_df=1, max_df=0.9): Init parameters for TextIndex....
Implement the Python class `TextIndex` described below. Class description: A simple text index from a corpus of text using tf-idf similarity. Method signatures and docstrings: - def __init__(self, documents, text_getter, ngram_range=(1, 2), analyzer=Analyzer.WORD, min_df=1, max_df=0.9): Init parameters for TextIndex....
569a3c31451d941165bd10783f73f494406b3906
<|skeleton|> class TextIndex: """A simple text index from a corpus of text using tf-idf similarity.""" def __init__(self, documents, text_getter, ngram_range=(1, 2), analyzer=Analyzer.WORD, min_df=1, max_df=0.9): """Init parameters for TextIndex. Args: documents: Corpus of documents to be indexed and r...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TextIndex: """A simple text index from a corpus of text using tf-idf similarity.""" def __init__(self, documents, text_getter, ngram_range=(1, 2), analyzer=Analyzer.WORD, min_df=1, max_df=0.9): """Init parameters for TextIndex. Args: documents: Corpus of documents to be indexed and retrieved. tex...
the_stack_v2_python_sparse
tapas/utils/text_index.py
google-research/tapas
train
1,043
5976a2dd80d24ba694dad84da69c4cae4b9f5dd8
[ "super(ESPNETMultiHeadedAttention, self).__init__()\nassert n_feat % n_head == 0\nself.d_k = n_feat // n_head\nself.h = n_head\nself.linear_q = nn.Linear(n_feat, n_feat)\nself.linear_k = nn.Linear(n_feat, n_feat)\nself.linear_v = nn.Linear(n_feat, n_feat)\nself.linear_out = nn.Linear(n_feat, n_feat)\nself.attn = No...
<|body_start_0|> super(ESPNETMultiHeadedAttention, self).__init__() assert n_feat % n_head == 0 self.d_k = n_feat // n_head self.h = n_head self.linear_q = nn.Linear(n_feat, n_feat) self.linear_k = nn.Linear(n_feat, n_feat) self.linear_v = nn.Linear(n_feat, n_feat...
Multi-Head Attention layer. Args: n_head: The number of heads. n_feat: The number of features. dropout: Dropout rate.
ESPNETMultiHeadedAttention
[ "LicenseRef-scancode-unknown-license-reference", "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-free-unknown", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ESPNETMultiHeadedAttention: """Multi-Head Attention layer. Args: n_head: The number of heads. n_feat: The number of features. dropout: Dropout rate.""" def __init__(self, n_feat, n_head, dropout): """Construct an MultiHeadedAttention object.""" <|body_0|> def forward_qkv...
stack_v2_sparse_classes_10k_train_004350
9,673
permissive
[ { "docstring": "Construct an MultiHeadedAttention object.", "name": "__init__", "signature": "def __init__(self, n_feat, n_head, dropout)" }, { "docstring": "Transform query, key and value. Args: query: Query tensor B X T1 X C key: Key tensor B X T2 X C value: Value tensor B X T2 X C Returns: to...
4
null
Implement the Python class `ESPNETMultiHeadedAttention` described below. Class description: Multi-Head Attention layer. Args: n_head: The number of heads. n_feat: The number of features. dropout: Dropout rate. Method signatures and docstrings: - def __init__(self, n_feat, n_head, dropout): Construct an MultiHeadedAtt...
Implement the Python class `ESPNETMultiHeadedAttention` described below. Class description: Multi-Head Attention layer. Args: n_head: The number of heads. n_feat: The number of features. dropout: Dropout rate. Method signatures and docstrings: - def __init__(self, n_feat, n_head, dropout): Construct an MultiHeadedAtt...
b60c741f746877293bb85eed6806736fc8fa0ffd
<|skeleton|> class ESPNETMultiHeadedAttention: """Multi-Head Attention layer. Args: n_head: The number of heads. n_feat: The number of features. dropout: Dropout rate.""" def __init__(self, n_feat, n_head, dropout): """Construct an MultiHeadedAttention object.""" <|body_0|> def forward_qkv...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ESPNETMultiHeadedAttention: """Multi-Head Attention layer. Args: n_head: The number of heads. n_feat: The number of features. dropout: Dropout rate.""" def __init__(self, n_feat, n_head, dropout): """Construct an MultiHeadedAttention object.""" super(ESPNETMultiHeadedAttention, self).__in...
the_stack_v2_python_sparse
kosmos-2/fairseq/fairseq/modules/espnet_multihead_attention.py
microsoft/unilm
train
15,313
ff9bb67685cdcbc507f54655b035fbf5e76aacdd
[ "if len(nums) == 1:\n return nums[0]\nelse:\n return max(self.rob1(nums[1:]), self.rob1(nums[:-1]))", "n = len(nums)\nif n == 0:\n return 0\nif n == 1:\n return nums[0]\nsum = [0] * n\nsum[0] = nums[0]\nsum[1] = max(nums[0], nums[1])\nfor i in range(2, n):\n sum[i] = max(sum[i - 2] + nums[i], sum[i...
<|body_start_0|> if len(nums) == 1: return nums[0] else: return max(self.rob1(nums[1:]), self.rob1(nums[:-1])) <|end_body_0|> <|body_start_1|> n = len(nums) if n == 0: return 0 if n == 1: return nums[0] sum = [0] * n ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def rob(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def rob1(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if len(nums) == 1: return nums[0] else: ...
stack_v2_sparse_classes_10k_train_004351
1,314
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "rob", "signature": "def rob(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "rob1", "signature": "def rob1(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_000336
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rob(self, nums): :type nums: List[int] :rtype: int - def rob1(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 rob(self, nums): :type nums: List[int] :rtype: int - def rob1(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution: def rob(self, nums): "...
ba58ac60b32e261e43482d7e71b32587700e3719
<|skeleton|> class Solution: def rob(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def rob1(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def rob(self, nums): """:type nums: List[int] :rtype: int""" if len(nums) == 1: return nums[0] else: return max(self.rob1(nums[1:]), self.rob1(nums[:-1])) def rob1(self, nums): """:type nums: List[int] :rtype: int""" n = len(nums) ...
the_stack_v2_python_sparse
python/213_house_robber_II.py
lingng/Leetcode
train
0
1473b6557152218e4e3470963ac60018f9d30532
[ "s = '#' + s\np = '#' + p\nm, n = (len(s), len(p))\ndp = [[False] * m for _ in range(n)]\ndp[0][0] = True\nfor i in range(2, n):\n dp[i][0] = dp[i - 2][0] and p[i] == '*'\nfor j in range(m):\n for i in range(1, n):\n if p[i] != '*':\n dp[i][j] = p[i] in (s[j], '.') and dp[i - 1][j - 1]\n ...
<|body_start_0|> s = '#' + s p = '#' + p m, n = (len(s), len(p)) dp = [[False] * m for _ in range(n)] dp[0][0] = True for i in range(2, n): dp[i][0] = dp[i - 2][0] and p[i] == '*' for j in range(m): for i in range(1, n): if ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isMatch(self, s: str, p: str) -> bool: """没搞定!!!!!!!""" <|body_0|> def isMatch1(self, s, p): """别人的正解!!!!""" <|body_1|> <|end_skeleton|> <|body_start_0|> s = '#' + s p = '#' + p m, n = (len(s), len(p)) dp = [[Fa...
stack_v2_sparse_classes_10k_train_004352
3,699
no_license
[ { "docstring": "没搞定!!!!!!!", "name": "isMatch", "signature": "def isMatch(self, s: str, p: str) -> bool" }, { "docstring": "别人的正解!!!!", "name": "isMatch1", "signature": "def isMatch1(self, s, p)" } ]
2
stack_v2_sparse_classes_30k_train_004343
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isMatch(self, s: str, p: str) -> bool: 没搞定!!!!!!! - def isMatch1(self, s, p): 别人的正解!!!!
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isMatch(self, s: str, p: str) -> bool: 没搞定!!!!!!! - def isMatch1(self, s, p): 别人的正解!!!! <|skeleton|> class Solution: def isMatch(self, s: str, p: str) -> bool: ...
bc895124817aa1341d15ac85e1c6d670a9420dec
<|skeleton|> class Solution: def isMatch(self, s: str, p: str) -> bool: """没搞定!!!!!!!""" <|body_0|> def isMatch1(self, s, p): """别人的正解!!!!""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def isMatch(self, s: str, p: str) -> bool: """没搞定!!!!!!!""" s = '#' + s p = '#' + p m, n = (len(s), len(p)) dp = [[False] * m for _ in range(n)] dp[0][0] = True for i in range(2, n): dp[i][0] = dp[i - 2][0] and p[i] == '*' f...
the_stack_v2_python_sparse
leetcode/10RegularExpressionMatching.py
qilaidi/leetcode_problems
train
0
1bef05abcb184ab3359113381af031fe1e35c270
[ "super(SimpleCNN, self).__init__()\ncnn = []\nfor i in range(n_hidden_layers):\n cnn.append(torch.nn.Conv2d(in_channels=n_in_channels, out_channels=n_kernels, kernel_size=kernel_size, bias=True, padding=int(kernel_size / 2)))\n cnn.append(torch.nn.ReLU())\n n_in_channels = n_kernels\nself.hidden_layers = t...
<|body_start_0|> super(SimpleCNN, self).__init__() cnn = [] for i in range(n_hidden_layers): cnn.append(torch.nn.Conv2d(in_channels=n_in_channels, out_channels=n_kernels, kernel_size=kernel_size, bias=True, padding=int(kernel_size / 2))) cnn.append(torch.nn.ReLU()) ...
SimpleCNN
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SimpleCNN: def __init__(self, n_in_channels: int=1, n_hidden_layers: int=3, n_kernels: int=32, kernel_size: int=7): """Simple CNN with `n_hidden_layers`, `n_kernels`, and `kernel_size` as hyperparameters""" <|body_0|> def forward(self, x): """Apply CNN to input `x` o...
stack_v2_sparse_classes_10k_train_004353
2,028
no_license
[ { "docstring": "Simple CNN with `n_hidden_layers`, `n_kernels`, and `kernel_size` as hyperparameters", "name": "__init__", "signature": "def __init__(self, n_in_channels: int=1, n_hidden_layers: int=3, n_kernels: int=32, kernel_size: int=7)" }, { "docstring": "Apply CNN to input `x` of shape (N,...
2
stack_v2_sparse_classes_30k_train_005787
Implement the Python class `SimpleCNN` described below. Class description: Implement the SimpleCNN class. Method signatures and docstrings: - def __init__(self, n_in_channels: int=1, n_hidden_layers: int=3, n_kernels: int=32, kernel_size: int=7): Simple CNN with `n_hidden_layers`, `n_kernels`, and `kernel_size` as hy...
Implement the Python class `SimpleCNN` described below. Class description: Implement the SimpleCNN class. Method signatures and docstrings: - def __init__(self, n_in_channels: int=1, n_hidden_layers: int=3, n_kernels: int=32, kernel_size: int=7): Simple CNN with `n_hidden_layers`, `n_kernels`, and `kernel_size` as hy...
26ea3306ff989de94414d50708ae30171f48ef53
<|skeleton|> class SimpleCNN: def __init__(self, n_in_channels: int=1, n_hidden_layers: int=3, n_kernels: int=32, kernel_size: int=7): """Simple CNN with `n_hidden_layers`, `n_kernels`, and `kernel_size` as hyperparameters""" <|body_0|> def forward(self, x): """Apply CNN to input `x` o...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SimpleCNN: def __init__(self, n_in_channels: int=1, n_hidden_layers: int=3, n_kernels: int=32, kernel_size: int=7): """Simple CNN with `n_hidden_layers`, `n_kernels`, and `kernel_size` as hyperparameters""" super(SimpleCNN, self).__init__() cnn = [] for i in range(n_hidden_laye...
the_stack_v2_python_sparse
Programming-in-Python-II/example_project/architectures.py
diabeticwizard10/programming-in-python
train
0
82e51e82ada853c5ccca92ef79246a9abd7920ba
[ "norep = [num for num, _ in groupby(nums)]\ntriples = zip(norep, norep[1:], norep[2:])\nreturn sum(((b > a) == (b > c) for a, b, c in triples)) + len(norep[:2])", "norep = [num for num, _ in groupby(nums)]\nif len(norep) < 2:\n return len(norep)\ntriples = zip(norep, norep[1:], norep[2:])\nreturn 2 + sum((a < ...
<|body_start_0|> norep = [num for num, _ in groupby(nums)] triples = zip(norep, norep[1:], norep[2:]) return sum(((b > a) == (b > c) for a, b, c in triples)) + len(norep[:2]) <|end_body_0|> <|body_start_1|> norep = [num for num, _ in groupby(nums)] if len(norep) < 2: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def wiggleMaxLength(self, nums): """:type nums: List[int] :rtype: int beats 44.44%""" <|body_0|> def wiggleMaxLength1(self, nums): """:param nums: :return: beats 97.22%""" <|body_1|> <|end_skeleton|> <|body_start_0|> norep = [num for num, ...
stack_v2_sparse_classes_10k_train_004354
704
no_license
[ { "docstring": ":type nums: List[int] :rtype: int beats 44.44%", "name": "wiggleMaxLength", "signature": "def wiggleMaxLength(self, nums)" }, { "docstring": ":param nums: :return: beats 97.22%", "name": "wiggleMaxLength1", "signature": "def wiggleMaxLength1(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_003129
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def wiggleMaxLength(self, nums): :type nums: List[int] :rtype: int beats 44.44% - def wiggleMaxLength1(self, nums): :param nums: :return: beats 97.22%
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def wiggleMaxLength(self, nums): :type nums: List[int] :rtype: int beats 44.44% - def wiggleMaxLength1(self, nums): :param nums: :return: beats 97.22% <|skeleton|> class Solutio...
7e0e917c15d3e35f49da3a00ef395bd5ff180d79
<|skeleton|> class Solution: def wiggleMaxLength(self, nums): """:type nums: List[int] :rtype: int beats 44.44%""" <|body_0|> def wiggleMaxLength1(self, nums): """:param nums: :return: beats 97.22%""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def wiggleMaxLength(self, nums): """:type nums: List[int] :rtype: int beats 44.44%""" norep = [num for num, _ in groupby(nums)] triples = zip(norep, norep[1:], norep[2:]) return sum(((b > a) == (b > c) for a, b, c in triples)) + len(norep[:2]) def wiggleMaxLength...
the_stack_v2_python_sparse
LeetCode/376_wiggle_subsequence.py
yao23/Machine_Learning_Playground
train
12
c60b5913ef4ddf2664966045fbe0baed96323909
[ "result = ''\ntext = wikiText\nwhile True:\n startIdx = text.find('{{')\n if startIdx >= 0:\n result += text[:startIdx]\n endIdx = text.find('}}', startIdx)\n if endIdx >= 0:\n handled = False\n templateText = text[startIdx + 2:endIdx]\n if handler is not ...
<|body_start_0|> result = '' text = wikiText while True: startIdx = text.find('{{') if startIdx >= 0: result += text[:startIdx] endIdx = text.find('}}', startIdx) if endIdx >= 0: handled = False ...
Static helper class for parsing wiki markup text that contains templates. The template parser identifies templates in the given wiki text and replaces them as specified by a :@link ITemplateHandler.
TemplateParser
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TemplateParser: """Static helper class for parsing wiki markup text that contains templates. The template parser identifies templates in the given wiki text and replaces them as specified by a :@link ITemplateHandler.""" def parse(cls, wikiText, handler): """Parse the given wiki text...
stack_v2_sparse_classes_10k_train_004355
6,755
no_license
[ { "docstring": "Parse the given wiki text and substitute each template in the text using the specified template handler.", "name": "parse", "signature": "def parse(cls, wikiText, handler)" }, { "docstring": "Creates a :@link Template from the given text. That is, the template's name and paramete...
2
stack_v2_sparse_classes_30k_train_006677
Implement the Python class `TemplateParser` described below. Class description: Static helper class for parsing wiki markup text that contains templates. The template parser identifies templates in the given wiki text and replaces them as specified by a :@link ITemplateHandler. Method signatures and docstrings: - def...
Implement the Python class `TemplateParser` described below. Class description: Static helper class for parsing wiki markup text that contains templates. The template parser identifies templates in the given wiki text and replaces them as specified by a :@link ITemplateHandler. Method signatures and docstrings: - def...
58e12957dee8b4b18127df9daeb8825d8ada7923
<|skeleton|> class TemplateParser: """Static helper class for parsing wiki markup text that contains templates. The template parser identifies templates in the given wiki text and replaces them as specified by a :@link ITemplateHandler.""" def parse(cls, wikiText, handler): """Parse the given wiki text...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TemplateParser: """Static helper class for parsing wiki markup text that contains templates. The template parser identifies templates in the given wiki text and replaces them as specified by a :@link ITemplateHandler.""" def parse(cls, wikiText, handler): """Parse the given wiki text and substitu...
the_stack_v2_python_sparse
api/util/TemplateParser.py
oldeucryptoboi/wiktionary-parser
train
0
5d7122dd24dd83aff2cba2f915cb76683e8e0927
[ "d = {c: [-1, -1] for c in string.ascii_uppercase}\nres = 0\nfor i, c in enumerate(s):\n i0, i1 = d[c]\n res += (i - i1) * (i1 - i0)\n d[c] = [d[c][1], i]\nfor i0, i1 in d.values():\n res += (len(s) - i1) * (i1 - i0)\nreturn res", "visited = set()\n\ndef dfs(i: int, j: int, d: Dict[str, int], u: int) ...
<|body_start_0|> d = {c: [-1, -1] for c in string.ascii_uppercase} res = 0 for i, c in enumerate(s): i0, i1 = d[c] res += (i - i1) * (i1 - i0) d[c] = [d[c][1], i] for i0, i1 in d.values(): res += (len(s) - i1) * (i1 - i0) return res...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def uniqueLetterString(self, s: str) -> int: """O(N) 혹은 O(NlogN) 으로 줄일 수 있는 방법? 각 자리의 문자별로 생각해보자. 양 옆으로 동일한 문자가 또 나오기 전까지 확장할 수 있음. O(N) / O(1)""" <|body_0|> def uniqueLetterString(self, s: str) -> int: """DFS로 모든 케이스를 다 돌면서 계산하면 되긴함. O(N^2) / O(N^2) (S : s...
stack_v2_sparse_classes_10k_train_004356
1,871
no_license
[ { "docstring": "O(N) 혹은 O(NlogN) 으로 줄일 수 있는 방법? 각 자리의 문자별로 생각해보자. 양 옆으로 동일한 문자가 또 나오기 전까지 확장할 수 있음. O(N) / O(1)", "name": "uniqueLetterString", "signature": "def uniqueLetterString(self, s: str) -> int" }, { "docstring": "DFS로 모든 케이스를 다 돌면서 계산하면 되긴함. O(N^2) / O(N^2) (S : s 내 문자수) Time Limit Exce...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def uniqueLetterString(self, s: str) -> int: O(N) 혹은 O(NlogN) 으로 줄일 수 있는 방법? 각 자리의 문자별로 생각해보자. 양 옆으로 동일한 문자가 또 나오기 전까지 확장할 수 있음. O(N) / O(1) - def uniqueLetterString(self, s: str...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def uniqueLetterString(self, s: str) -> int: O(N) 혹은 O(NlogN) 으로 줄일 수 있는 방법? 각 자리의 문자별로 생각해보자. 양 옆으로 동일한 문자가 또 나오기 전까지 확장할 수 있음. O(N) / O(1) - def uniqueLetterString(self, s: str...
c26aef2a59e5cc2d9b0658b9c7386a43267ff8a1
<|skeleton|> class Solution: def uniqueLetterString(self, s: str) -> int: """O(N) 혹은 O(NlogN) 으로 줄일 수 있는 방법? 각 자리의 문자별로 생각해보자. 양 옆으로 동일한 문자가 또 나오기 전까지 확장할 수 있음. O(N) / O(1)""" <|body_0|> def uniqueLetterString(self, s: str) -> int: """DFS로 모든 케이스를 다 돌면서 계산하면 되긴함. O(N^2) / O(N^2) (S : s...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def uniqueLetterString(self, s: str) -> int: """O(N) 혹은 O(NlogN) 으로 줄일 수 있는 방법? 각 자리의 문자별로 생각해보자. 양 옆으로 동일한 문자가 또 나오기 전까지 확장할 수 있음. O(N) / O(1)""" d = {c: [-1, -1] for c in string.ascii_uppercase} res = 0 for i, c in enumerate(s): i0, i1 = d[c] ...
the_stack_v2_python_sparse
Leetcode/828.py
hanwgyu/algorithm_problem_solving
train
5
63bb73a8defaccea5b30bc05794977232b553b6a
[ "if self.search is None:\n return\nself.view.set_viewport_position(self.viewport)\nself.search.reset()\nmatches = self.search.find(text, self.autocorrect)\nself.search.add_matches(matches)\nrelevant_matches = self.search.forwards(update_cursors=False, viewport=self.visible_region, next_only=self.jump_only)\nif s...
<|body_start_0|> if self.search is None: return self.view.set_viewport_position(self.viewport) self.search.reset() matches = self.search.find(text, self.autocorrect) self.search.add_matches(matches) relevant_matches = self.search.forwards(update_cursors=False,...
Creates the Search Input Panel VisualMode: This would stretch each cursor to the matched word Doesn't perform highlighting MultiSelect: This shows only the relevant words (ones cursors could go to) Doesn't perform highlighting = args append: reset highlights first? or add to them jump_only: doesn't mess with highlighti...
HighlightPanelCommand
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HighlightPanelCommand: """Creates the Search Input Panel VisualMode: This would stretch each cursor to the matched word Doesn't perform highlighting MultiSelect: This shows only the relevant words (ones cursors could go to) Doesn't perform highlighting = args append: reset highlights first? or ad...
stack_v2_sparse_classes_10k_train_004357
31,297
permissive
[ { "docstring": "Event: User typing", "name": "_on_change", "signature": "def _on_change(self, text)" }, { "docstring": "Event: user Input", "name": "_on_done", "signature": "def _on_done(self, text)" }, { "docstring": "Event: user abort", "name": "_on_cancel", "signature"...
4
stack_v2_sparse_classes_30k_train_000097
Implement the Python class `HighlightPanelCommand` described below. Class description: Creates the Search Input Panel VisualMode: This would stretch each cursor to the matched word Doesn't perform highlighting MultiSelect: This shows only the relevant words (ones cursors could go to) Doesn't perform highlighting = arg...
Implement the Python class `HighlightPanelCommand` described below. Class description: Creates the Search Input Panel VisualMode: This would stretch each cursor to the matched word Doesn't perform highlighting MultiSelect: This shows only the relevant words (ones cursors could go to) Doesn't perform highlighting = arg...
91417d02554b89cd322d16940f59d0dd781c8001
<|skeleton|> class HighlightPanelCommand: """Creates the Search Input Panel VisualMode: This would stretch each cursor to the matched word Doesn't perform highlighting MultiSelect: This shows only the relevant words (ones cursors could go to) Doesn't perform highlighting = args append: reset highlights first? or ad...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class HighlightPanelCommand: """Creates the Search Input Panel VisualMode: This would stretch each cursor to the matched word Doesn't perform highlighting MultiSelect: This shows only the relevant words (ones cursors could go to) Doesn't perform highlighting = args append: reset highlights first? or add to them jum...
the_stack_v2_python_sparse
highlight.py
Saevon/config-sublime
train
0
e148eb9adb8ce29dbc9be62fee7af8f627ec8b18
[ "super().__init__()\nself.N = N\nself.dm = dm\nself.embedding = tf.keras.layers.Embedding(input_dim=target_vocab, output_dim=dm)\nself.positional_encoding = positional_encoding(max_seq_len, dm)\nself.blocks = [DecoderBlock(dm, h, hidden, drop_rate) for _ in range(N)]\nself.dropout = tf.keras.layers.Dropout(rate=dro...
<|body_start_0|> super().__init__() self.N = N self.dm = dm self.embedding = tf.keras.layers.Embedding(input_dim=target_vocab, output_dim=dm) self.positional_encoding = positional_encoding(max_seq_len, dm) self.blocks = [DecoderBlock(dm, h, hidden, drop_rate) for _ in ran...
Creates the decoder for a transformer
Decoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Decoder: """Creates the decoder for a transformer""" def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1): """Class constructor""" <|body_0|> def call(self, x, encoder_output, training, look_ahead_mask, padding_mask): """Returns: a tenso...
stack_v2_sparse_classes_10k_train_004358
2,240
no_license
[ { "docstring": "Class constructor", "name": "__init__", "signature": "def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1)" }, { "docstring": "Returns: a tensor of shape (batch, target_seq_len, dm) containing the decoder output", "name": "call", "signature": "de...
2
stack_v2_sparse_classes_30k_train_006702
Implement the Python class `Decoder` described below. Class description: Creates the decoder for a transformer Method signatures and docstrings: - def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1): Class constructor - def call(self, x, encoder_output, training, look_ahead_mask, padding_ma...
Implement the Python class `Decoder` described below. Class description: Creates the decoder for a transformer Method signatures and docstrings: - def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1): Class constructor - def call(self, x, encoder_output, training, look_ahead_mask, padding_ma...
161e33b23d398d7d01ad0d7740b78dda3f27e787
<|skeleton|> class Decoder: """Creates the decoder for a transformer""" def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1): """Class constructor""" <|body_0|> def call(self, x, encoder_output, training, look_ahead_mask, padding_mask): """Returns: a tenso...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Decoder: """Creates the decoder for a transformer""" def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1): """Class constructor""" super().__init__() self.N = N self.dm = dm self.embedding = tf.keras.layers.Embedding(input_dim=target_vocab...
the_stack_v2_python_sparse
supervised_learning/0x11-attention/10-transformer_decoder.py
felipeserna/holbertonschool-machine_learning
train
0
000cf5339989b406fa2b55b1a9e9aefe22dfdb95
[ "valid, message = json_validate(drange, {'type': 'object', 'properties': {'lower': {'$ref': '#/pScheduler/Duration'}, 'upper': {'$ref': '#/pScheduler/Duration'}}, 'additionalProperties': False, 'required': ['lower', 'upper']})\nif not valid:\n raise ValueError('Invalid duration range: %s' % message)\nself.lower_...
<|body_start_0|> valid, message = json_validate(drange, {'type': 'object', 'properties': {'lower': {'$ref': '#/pScheduler/Duration'}, 'upper': {'$ref': '#/pScheduler/Duration'}}, 'additionalProperties': False, 'required': ['lower', 'upper']}) if not valid: raise ValueError('Invalid duration ...
Range of durations
DurationRange
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DurationRange: """Range of durations""" def __init__(self, drange): """Construct a range from a JSON DurationRange.""" <|body_0|> def __contains__(self, duration): """See if the range contains the specified duration, which can be a timedelta or ISO8601 string."""...
stack_v2_sparse_classes_10k_train_004359
2,808
permissive
[ { "docstring": "Construct a range from a JSON DurationRange.", "name": "__init__", "signature": "def __init__(self, drange)" }, { "docstring": "See if the range contains the specified duration, which can be a timedelta or ISO8601 string.", "name": "__contains__", "signature": "def __cont...
3
stack_v2_sparse_classes_30k_train_006610
Implement the Python class `DurationRange` described below. Class description: Range of durations Method signatures and docstrings: - def __init__(self, drange): Construct a range from a JSON DurationRange. - def __contains__(self, duration): See if the range contains the specified duration, which can be a timedelta ...
Implement the Python class `DurationRange` described below. Class description: Range of durations Method signatures and docstrings: - def __init__(self, drange): Construct a range from a JSON DurationRange. - def __contains__(self, duration): See if the range contains the specified duration, which can be a timedelta ...
f6d04c0455e5be4d490df16ec1acb377f9025d9f
<|skeleton|> class DurationRange: """Range of durations""" def __init__(self, drange): """Construct a range from a JSON DurationRange.""" <|body_0|> def __contains__(self, duration): """See if the range contains the specified duration, which can be a timedelta or ISO8601 string."""...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DurationRange: """Range of durations""" def __init__(self, drange): """Construct a range from a JSON DurationRange.""" valid, message = json_validate(drange, {'type': 'object', 'properties': {'lower': {'$ref': '#/pScheduler/Duration'}, 'upper': {'$ref': '#/pScheduler/Duration'}}, 'additio...
the_stack_v2_python_sparse
python-pscheduler/pscheduler/pscheduler/durationrange.py
perfsonar/pscheduler
train
53
8b085fff21261152e2cd43b3d0704ed56eb23550
[ "parkDict = self.getDictBykey(Index(self.Session).getParkingBaseDataTree().json(), 'name', parkName)\nself.url = '/mgr/park/park_redlist/add.do'\ndata = {'redlistParam': carNum, 'parkIds': parkDict['value']}\nre = self.post(self.api, data=data, headers=form_headers)\nreturn re.json()", "WhilelistDict = self.getDi...
<|body_start_0|> parkDict = self.getDictBykey(Index(self.Session).getParkingBaseDataTree().json(), 'name', parkName) self.url = '/mgr/park/park_redlist/add.do' data = {'redlistParam': carNum, 'parkIds': parkDict['value']} re = self.post(self.api, data=data, headers=form_headers) ...
白名单
ParkWhitelist
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ParkWhitelist: """白名单""" def addWhitelist(self, parkName, carNum): """录入白名单""" <|body_0|> def delWhilelist(self, carNum): """删除白名单规则""" <|body_1|> def getWhilelistRuleList(self): """获取白名单规则列表""" <|body_2|> <|end_skeleton|> <|body_st...
stack_v2_sparse_classes_10k_train_004360
13,467
no_license
[ { "docstring": "录入白名单", "name": "addWhitelist", "signature": "def addWhitelist(self, parkName, carNum)" }, { "docstring": "删除白名单规则", "name": "delWhilelist", "signature": "def delWhilelist(self, carNum)" }, { "docstring": "获取白名单规则列表", "name": "getWhilelistRuleList", "signa...
3
stack_v2_sparse_classes_30k_train_005037
Implement the Python class `ParkWhitelist` described below. Class description: 白名单 Method signatures and docstrings: - def addWhitelist(self, parkName, carNum): 录入白名单 - def delWhilelist(self, carNum): 删除白名单规则 - def getWhilelistRuleList(self): 获取白名单规则列表
Implement the Python class `ParkWhitelist` described below. Class description: 白名单 Method signatures and docstrings: - def addWhitelist(self, parkName, carNum): 录入白名单 - def delWhilelist(self, carNum): 删除白名单规则 - def getWhilelistRuleList(self): 获取白名单规则列表 <|skeleton|> class ParkWhitelist: """白名单""" def addWhit...
34c368c109867da26d9256bca85f872b0fac2ea7
<|skeleton|> class ParkWhitelist: """白名单""" def addWhitelist(self, parkName, carNum): """录入白名单""" <|body_0|> def delWhilelist(self, carNum): """删除白名单规则""" <|body_1|> def getWhilelistRuleList(self): """获取白名单规则列表""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ParkWhitelist: """白名单""" def addWhitelist(self, parkName, carNum): """录入白名单""" parkDict = self.getDictBykey(Index(self.Session).getParkingBaseDataTree().json(), 'name', parkName) self.url = '/mgr/park/park_redlist/add.do' data = {'redlistParam': carNum, 'parkIds': parkDict...
the_stack_v2_python_sparse
Api/parkingManage_service/carTypeManage_service/carTypeConfig.py
oyebino/pomp_api
train
1
52f8ab59a6c17c6fdd3c26f46e564645874801f2
[ "try:\n applet = Applet().load(id=applet, force=True)\nexcept:\n raise ValidationException(message='Invalid Applet ID', field='applet')\nassignmentsCollection = Collection().findOne({'name': 'Assignments'})\nif not assignmentsCollection:\n Collection().createCollection('Assignments')\ntry:\n assignment ...
<|body_start_0|> try: applet = Applet().load(id=applet, force=True) except: raise ValidationException(message='Invalid Applet ID', field='applet') assignmentsCollection = Collection().findOne({'name': 'Assignments'}) if not assignmentsCollection: Colle...
Assignments are access-controlled Folders, each of which contains managerially-controlled Applet Folders.
Assignment
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Assignment: """Assignments are access-controlled Folders, each of which contains managerially-controlled Applet Folders.""" def create(self, applet, user): """Create an Assignment for a given Applet, returning an existing Assignment if one or more exists. :param applet: The ID of the...
stack_v2_sparse_classes_10k_train_004361
8,452
permissive
[ { "docstring": "Create an Assignment for a given Applet, returning an existing Assignment if one or more exists. :param applet: The ID of the Applet for which to find Assignments. :type applet: str :param user: User :type user: User :returns: New Assignments", "name": "create", "signature": "def create(...
3
stack_v2_sparse_classes_30k_train_002151
Implement the Python class `Assignment` described below. Class description: Assignments are access-controlled Folders, each of which contains managerially-controlled Applet Folders. Method signatures and docstrings: - def create(self, applet, user): Create an Assignment for a given Applet, returning an existing Assig...
Implement the Python class `Assignment` described below. Class description: Assignments are access-controlled Folders, each of which contains managerially-controlled Applet Folders. Method signatures and docstrings: - def create(self, applet, user): Create an Assignment for a given Applet, returning an existing Assig...
96b76353e59377c920570fca767fe4faa84965f7
<|skeleton|> class Assignment: """Assignments are access-controlled Folders, each of which contains managerially-controlled Applet Folders.""" def create(self, applet, user): """Create an Assignment for a given Applet, returning an existing Assignment if one or more exists. :param applet: The ID of the...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Assignment: """Assignments are access-controlled Folders, each of which contains managerially-controlled Applet Folders.""" def create(self, applet, user): """Create an Assignment for a given Applet, returning an existing Assignment if one or more exists. :param applet: The ID of the Applet for w...
the_stack_v2_python_sparse
girderformindlogger/models/assignment.py
jj105/mindlogger-app-backend
train
0
e07e35976407d5147f6c4b3c88d7e9014483afa4
[ "if not cov.shape[0] == cov.shape[1]:\n raise ValueError('Covariance matrix is not square.')\nif not mean.shape[0] == cov.shape[0]:\n raise ValueError('Dimension mismatch between mean and covariance.')\nif not torch.allclose(cov, cov.transpose(-1, -2)):\n raise ValueError('Covariance matrix is not symmetri...
<|body_start_0|> if not cov.shape[0] == cov.shape[1]: raise ValueError('Covariance matrix is not square.') if not mean.shape[0] == cov.shape[0]: raise ValueError('Dimension mismatch between mean and covariance.') if not torch.allclose(cov, cov.transpose(-1, -2)): ...
Engine for qMC sampling from a multivariate Normal `N(\\mu, \\Sigma)`. By default, this implementation uses Box-Muller transformed Sobol samples following pg. 123 in [Pages2018numprob]_. To use the inverse transform instead, set `inv_transform=True`. Example: >>> mean = torch.tensor([1.0, 2.0]) >>> cov = torch.tensor([...
MultivariateNormalQMCEngine
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultivariateNormalQMCEngine: """Engine for qMC sampling from a multivariate Normal `N(\\mu, \\Sigma)`. By default, this implementation uses Box-Muller transformed Sobol samples following pg. 123 in [Pages2018numprob]_. To use the inverse transform instead, set `inv_transform=True`. Example: >>> m...
stack_v2_sparse_classes_10k_train_004362
6,555
permissive
[ { "docstring": "Engine for qMC sampling from a multivariate Normal `N(\\\\mu, \\\\Sigma)`. Args: mean: The mean vector. cov: The covariance matrix. seed: The seed with which to seed the random number generator of the underlying SobolEngine. inv_transform: If True, use inverse transform instead of Box-Muller.", ...
2
stack_v2_sparse_classes_30k_train_004755
Implement the Python class `MultivariateNormalQMCEngine` described below. Class description: Engine for qMC sampling from a multivariate Normal `N(\\mu, \\Sigma)`. By default, this implementation uses Box-Muller transformed Sobol samples following pg. 123 in [Pages2018numprob]_. To use the inverse transform instead, s...
Implement the Python class `MultivariateNormalQMCEngine` described below. Class description: Engine for qMC sampling from a multivariate Normal `N(\\mu, \\Sigma)`. By default, this implementation uses Box-Muller transformed Sobol samples following pg. 123 in [Pages2018numprob]_. To use the inverse transform instead, s...
4cc5ed59b2e8a9c780f786830c548e05cc74d53c
<|skeleton|> class MultivariateNormalQMCEngine: """Engine for qMC sampling from a multivariate Normal `N(\\mu, \\Sigma)`. By default, this implementation uses Box-Muller transformed Sobol samples following pg. 123 in [Pages2018numprob]_. To use the inverse transform instead, set `inv_transform=True`. Example: >>> m...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MultivariateNormalQMCEngine: """Engine for qMC sampling from a multivariate Normal `N(\\mu, \\Sigma)`. By default, this implementation uses Box-Muller transformed Sobol samples following pg. 123 in [Pages2018numprob]_. To use the inverse transform instead, set `inv_transform=True`. Example: >>> mean = torch.t...
the_stack_v2_python_sparse
botorch/sampling/qmc.py
pytorch/botorch
train
2,891
ae85a0038e9bc4120cbd847f29a14d052de53fbc
[ "super(MultiHeadedAttention, self).__init__()\nassert d_model % h == 0\nself.d_k = d_model // h\nself.h = h\nself.linears = clones(nn.Linear(d_model, d_model), 4)\nself.attn = None\nself.dropout = nn.Dropout(p=dropout)", "if mask is not None:\n mask = mask.unsqueeze(1)\nnbatches = query.size(0)\nif layer_past ...
<|body_start_0|> super(MultiHeadedAttention, self).__init__() assert d_model % h == 0 self.d_k = d_model // h self.h = h self.linears = clones(nn.Linear(d_model, d_model), 4) self.attn = None self.dropout = nn.Dropout(p=dropout) <|end_body_0|> <|body_start_1|> ...
MultiHeadedAttention
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiHeadedAttention: def __init__(self, h, d_model, dropout=0.1): """Take in model size and number of heads.""" <|body_0|> def forward(self, query, key, value, mask=None, layer_past=None): """Implements Figure 2""" <|body_1|> <|end_skeleton|> <|body_start_...
stack_v2_sparse_classes_10k_train_004363
16,634
permissive
[ { "docstring": "Take in model size and number of heads.", "name": "__init__", "signature": "def __init__(self, h, d_model, dropout=0.1)" }, { "docstring": "Implements Figure 2", "name": "forward", "signature": "def forward(self, query, key, value, mask=None, layer_past=None)" } ]
2
stack_v2_sparse_classes_30k_train_003195
Implement the Python class `MultiHeadedAttention` described below. Class description: Implement the MultiHeadedAttention class. Method signatures and docstrings: - def __init__(self, h, d_model, dropout=0.1): Take in model size and number of heads. - def forward(self, query, key, value, mask=None, layer_past=None): I...
Implement the Python class `MultiHeadedAttention` described below. Class description: Implement the MultiHeadedAttention class. Method signatures and docstrings: - def __init__(self, h, d_model, dropout=0.1): Take in model size and number of heads. - def forward(self, query, key, value, mask=None, layer_past=None): I...
6a774be5c27b1a5eecf4bcfff55249acf6c2fd5f
<|skeleton|> class MultiHeadedAttention: def __init__(self, h, d_model, dropout=0.1): """Take in model size and number of heads.""" <|body_0|> def forward(self, query, key, value, mask=None, layer_past=None): """Implements Figure 2""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MultiHeadedAttention: def __init__(self, h, d_model, dropout=0.1): """Take in model size and number of heads.""" super(MultiHeadedAttention, self).__init__() assert d_model % h == 0 self.d_k = d_model // h self.h = h self.linears = clones(nn.Linear(d_model, d_mo...
the_stack_v2_python_sparse
captioning/models/cachedTransformer.py
ruotianluo/ImageCaptioning.pytorch
train
1,247
04c9db5252c3ebd00174b92e2603904182e33a68
[ "if user_id == 'me':\n user = auth.get_current_user()\n if not user:\n return self.error('not authenticated', 401)\nelse:\n raise NotImplementedError\nuser.options = list(ItemOption.query.filter(ItemOption.item_id == user.id))\nreturn self.respond_with_schema(user_schema, user)", "if user_id == 'm...
<|body_start_0|> if user_id == 'me': user = auth.get_current_user() if not user: return self.error('not authenticated', 401) else: raise NotImplementedError user.options = list(ItemOption.query.filter(ItemOption.item_id == user.id)) ret...
UserDetailsResource
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserDetailsResource: def get(self, user_id: str): """Return information on a user.""" <|body_0|> def put(self, user_id: str): """Return information on a user.""" <|body_1|> <|end_skeleton|> <|body_start_0|> if user_id == 'me': user = aut...
stack_v2_sparse_classes_10k_train_004364
1,582
permissive
[ { "docstring": "Return information on a user.", "name": "get", "signature": "def get(self, user_id: str)" }, { "docstring": "Return information on a user.", "name": "put", "signature": "def put(self, user_id: str)" } ]
2
null
Implement the Python class `UserDetailsResource` described below. Class description: Implement the UserDetailsResource class. Method signatures and docstrings: - def get(self, user_id: str): Return information on a user. - def put(self, user_id: str): Return information on a user.
Implement the Python class `UserDetailsResource` described below. Class description: Implement the UserDetailsResource class. Method signatures and docstrings: - def get(self, user_id: str): Return information on a user. - def put(self, user_id: str): Return information on a user. <|skeleton|> class UserDetailsResou...
6d4a490c19ebe406b551641a022ca08f26c21fcb
<|skeleton|> class UserDetailsResource: def get(self, user_id: str): """Return information on a user.""" <|body_0|> def put(self, user_id: str): """Return information on a user.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UserDetailsResource: def get(self, user_id: str): """Return information on a user.""" if user_id == 'me': user = auth.get_current_user() if not user: return self.error('not authenticated', 401) else: raise NotImplementedError ...
the_stack_v2_python_sparse
zeus/api/resources/user_details.py
getsentry/zeus
train
222
b597bf9e047f31939535f5babc8efdc681668c97
[ "self.sources = sources\nself.max_sentence_length = max_sentence_length\nself.limit = limit", "for source in self.sources:\n try:\n source.seek(0)\n for line in itertools.islice(source, self.limit):\n line = to_unicode(line)\n line = list(line.strip().replace(' ', ''))\n ...
<|body_start_0|> self.sources = sources self.max_sentence_length = max_sentence_length self.limit = limit <|end_body_0|> <|body_start_1|> for source in self.sources: try: source.seek(0) for line in itertools.islice(source, self.limit): ...
Simple format: one sentence = one line; words already preprocessed and separated by whitespace.
MyLineSentence
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyLineSentence: """Simple format: one sentence = one line; words already preprocessed and separated by whitespace.""" def __init__(self, sources, max_sentence_length=MAX_WORDS_IN_BATCH, limit=None): """`source` can be either a string or a file object. Clip the file to the first `limi...
stack_v2_sparse_classes_10k_train_004365
4,034
no_license
[ { "docstring": "`source` can be either a string or a file object. Clip the file to the first `limit` lines (or no clipped if limit is None, the default).", "name": "__init__", "signature": "def __init__(self, sources, max_sentence_length=MAX_WORDS_IN_BATCH, limit=None)" }, { "docstring": "Iterat...
2
stack_v2_sparse_classes_30k_train_001914
Implement the Python class `MyLineSentence` described below. Class description: Simple format: one sentence = one line; words already preprocessed and separated by whitespace. Method signatures and docstrings: - def __init__(self, sources, max_sentence_length=MAX_WORDS_IN_BATCH, limit=None): `source` can be either a ...
Implement the Python class `MyLineSentence` described below. Class description: Simple format: one sentence = one line; words already preprocessed and separated by whitespace. Method signatures and docstrings: - def __init__(self, sources, max_sentence_length=MAX_WORDS_IN_BATCH, limit=None): `source` can be either a ...
abadb44b442aba5c579431e8697d11cff84658a6
<|skeleton|> class MyLineSentence: """Simple format: one sentence = one line; words already preprocessed and separated by whitespace.""" def __init__(self, sources, max_sentence_length=MAX_WORDS_IN_BATCH, limit=None): """`source` can be either a string or a file object. Clip the file to the first `limi...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MyLineSentence: """Simple format: one sentence = one line; words already preprocessed and separated by whitespace.""" def __init__(self, sources, max_sentence_length=MAX_WORDS_IN_BATCH, limit=None): """`source` can be either a string or a file object. Clip the file to the first `limit` lines (or ...
the_stack_v2_python_sparse
NLPCCKBQAModels/word2vec/chars2vec.py
JuneTse/NLPCCKBQAProj
train
1
609bbe9b5746cc531b44ce7089af343a05ce9a10
[ "self.__config = config\nself.__section = section\nself.__options = options\nself.__guidata = guidata\nself.__initialised = True", "if name not in ['_PreferencesSection__section', '_PreferencesSection__options', '_PreferencesSection__config', '_PreferencesSection__initialised', '_PreferencesSection__get_option', ...
<|body_start_0|> self.__config = config self.__section = section self.__options = options self.__guidata = guidata self.__initialised = True <|end_body_0|> <|body_start_1|> if name not in ['_PreferencesSection__section', '_PreferencesSection__options', '_PreferencesSecti...
Preferences Section Helper Class
_PreferencesSection
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _PreferencesSection: """Preferences Section Helper Class""" def __init__(self, config, section, options, guidata): """Class constructor""" <|body_0|> def __getattr__(self, name): """Get attribute method overload for accesing options""" <|body_1|> def...
stack_v2_sparse_classes_10k_train_004366
10,591
permissive
[ { "docstring": "Class constructor", "name": "__init__", "signature": "def __init__(self, config, section, options, guidata)" }, { "docstring": "Get attribute method overload for accesing options", "name": "__getattr__", "signature": "def __getattr__(self, name)" }, { "docstring":...
6
stack_v2_sparse_classes_30k_train_004362
Implement the Python class `_PreferencesSection` described below. Class description: Preferences Section Helper Class Method signatures and docstrings: - def __init__(self, config, section, options, guidata): Class constructor - def __getattr__(self, name): Get attribute method overload for accesing options - def __s...
Implement the Python class `_PreferencesSection` described below. Class description: Preferences Section Helper Class Method signatures and docstrings: - def __init__(self, config, section, options, guidata): Class constructor - def __getattr__(self, name): Get attribute method overload for accesing options - def __s...
9f951a08770e99ffd701a1994ba948aa8014f2af
<|skeleton|> class _PreferencesSection: """Preferences Section Helper Class""" def __init__(self, config, section, options, guidata): """Class constructor""" <|body_0|> def __getattr__(self, name): """Get attribute method overload for accesing options""" <|body_1|> def...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class _PreferencesSection: """Preferences Section Helper Class""" def __init__(self, config, section, options, guidata): """Class constructor""" self.__config = config self.__section = section self.__options = options self.__guidata = guidata self.__initialised =...
the_stack_v2_python_sparse
evogtk/gui/preferences.py
olivergs/evogtk
train
0
d67bc24e6c0aa772a829f8636e077c6afe9236a2
[ "if method == 'BCR764':\n a = zeros(4)\n a[0] = 0.0\n a[1] = 1.5171479707207227\n a[2] = -2.0342959414414454\n a[3] = 1.5171479707207227\n b = zeros(4)\n b[0] = 0.5600879810924619\n b[1] = -0.06008798109246194\n b[2] = -0.06008798109246194\n b[3] = 0.5600879810924619\n z = zeros(6)\...
<|body_start_0|> if method == 'BCR764': a = zeros(4) a[0] = 0.0 a[1] = 1.5171479707207227 a[2] = -2.0342959414414454 a[3] = 1.5171479707207227 b = zeros(4) b[0] = 0.5600879810924619 b[1] = -0.06008798109246194 ...
ProcessingSplittingParameters
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProcessingSplittingParameters: def build(self, method): """:param method: A string specifying the method for time integration. :return: Four arrays :math:`a`, :math:`b` and :math:`y`, :math:`z`. ====== ======= ================= ========= Method Order Authors Reference ====== ======= ====...
stack_v2_sparse_classes_10k_train_004367
3,691
permissive
[ { "docstring": ":param method: A string specifying the method for time integration. :return: Four arrays :math:`a`, :math:`b` and :math:`y`, :math:`z`. ====== ======= ================= ========= Method Order Authors Reference ====== ======= ================= ========= BCR764 (7,6,4) Blanes/Casas/Ros [1]_ table ...
2
null
Implement the Python class `ProcessingSplittingParameters` described below. Class description: Implement the ProcessingSplittingParameters class. Method signatures and docstrings: - def build(self, method): :param method: A string specifying the method for time integration. :return: Four arrays :math:`a`, :math:`b` a...
Implement the Python class `ProcessingSplittingParameters` described below. Class description: Implement the ProcessingSplittingParameters class. Method signatures and docstrings: - def build(self, method): :param method: A string specifying the method for time integration. :return: Four arrays :math:`a`, :math:`b` a...
225b5dd9b1af1998bd40b5f6467ee959292b6a83
<|skeleton|> class ProcessingSplittingParameters: def build(self, method): """:param method: A string specifying the method for time integration. :return: Four arrays :math:`a`, :math:`b` and :math:`y`, :math:`z`. ====== ======= ================= ========= Method Order Authors Reference ====== ======= ====...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ProcessingSplittingParameters: def build(self, method): """:param method: A string specifying the method for time integration. :return: Four arrays :math:`a`, :math:`b` and :math:`y`, :math:`z`. ====== ======= ================= ========= Method Order Authors Reference ====== ======= ================= ...
the_stack_v2_python_sparse
WaveBlocksND/ProcessingSplittingParameters.py
WaveBlocks/WaveBlocksND
train
4
b8b5162c54707bf94e61ba9396e4091258b18695
[ "if positive_fraction < 0 or positive_fraction > 1:\n raise ValueError('positive_fraction should be in range [0,1]. Received: %s.' % positive_fraction)\nself._positive_fraction = positive_fraction", "if len(indicator.get_shape().as_list()) != 1:\n raise ValueError('indicator must be 1 dimensional, got a ten...
<|body_start_0|> if positive_fraction < 0 or positive_fraction > 1: raise ValueError('positive_fraction should be in range [0,1]. Received: %s.' % positive_fraction) self._positive_fraction = positive_fraction <|end_body_0|> <|body_start_1|> if len(indicator.get_shape().as_list()) !...
Subsamples minibatches to a desired balance of positives and negatives.
BalancedPositiveNegativeSampler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BalancedPositiveNegativeSampler: """Subsamples minibatches to a desired balance of positives and negatives.""" def __init__(self, positive_fraction=0.5): """Constructs a minibatch sampler. Args: positive_fraction: desired fraction of positive examples (scalar in [0,1]) in the batch. ...
stack_v2_sparse_classes_10k_train_004368
4,434
permissive
[ { "docstring": "Constructs a minibatch sampler. Args: positive_fraction: desired fraction of positive examples (scalar in [0,1]) in the batch. Raises: ValueError: if positive_fraction < 0, or positive_fraction > 1", "name": "__init__", "signature": "def __init__(self, positive_fraction=0.5)" }, { ...
2
stack_v2_sparse_classes_30k_train_006496
Implement the Python class `BalancedPositiveNegativeSampler` described below. Class description: Subsamples minibatches to a desired balance of positives and negatives. Method signatures and docstrings: - def __init__(self, positive_fraction=0.5): Constructs a minibatch sampler. Args: positive_fraction: desired fract...
Implement the Python class `BalancedPositiveNegativeSampler` described below. Class description: Subsamples minibatches to a desired balance of positives and negatives. Method signatures and docstrings: - def __init__(self, positive_fraction=0.5): Constructs a minibatch sampler. Args: positive_fraction: desired fract...
39272caea30ab01faa3795156af76a08aaf1455f
<|skeleton|> class BalancedPositiveNegativeSampler: """Subsamples minibatches to a desired balance of positives and negatives.""" def __init__(self, positive_fraction=0.5): """Constructs a minibatch sampler. Args: positive_fraction: desired fraction of positive examples (scalar in [0,1]) in the batch. ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BalancedPositiveNegativeSampler: """Subsamples minibatches to a desired balance of positives and negatives.""" def __init__(self, positive_fraction=0.5): """Constructs a minibatch sampler. Args: positive_fraction: desired fraction of positive examples (scalar in [0,1]) in the batch. Raises: Value...
the_stack_v2_python_sparse
core/balanced_positive_negative_sampler.py
ambakick/Person-Detection-and-Tracking
train
262
87c5dd54ebe8d2f19b1f2a6e92fceb38cb1234fa
[ "url = utils.urljoin(self.base_path, self.id, 'root')\nresp = session.post(url)\nreturn resp.json()['user']", "url = utils.urljoin(self.base_path, self.id, 'root')\nresp = session.get(url)\nreturn resp.json()['rootEnabled']", "body = {'restart': {}}\nurl = utils.urljoin(self.base_path, self.id, 'action')\nsessi...
<|body_start_0|> url = utils.urljoin(self.base_path, self.id, 'root') resp = session.post(url) return resp.json()['user'] <|end_body_0|> <|body_start_1|> url = utils.urljoin(self.base_path, self.id, 'root') resp = session.get(url) return resp.json()['rootEnabled'] <|end_...
Instance
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Instance: def enable_root_user(self, session): """Enable login for the root user. This operation enables login from any host for the root user and provides the user with a generated root password. :param session: The session to use for making this request. :type session: :class:`~keyston...
stack_v2_sparse_classes_10k_train_004369
3,825
permissive
[ { "docstring": "Enable login for the root user. This operation enables login from any host for the root user and provides the user with a generated root password. :param session: The session to use for making this request. :type session: :class:`~keystoneauth1.adapter.Adapter` :returns: A dictionary with keys `...
5
stack_v2_sparse_classes_30k_val_000349
Implement the Python class `Instance` described below. Class description: Implement the Instance class. Method signatures and docstrings: - def enable_root_user(self, session): Enable login for the root user. This operation enables login from any host for the root user and provides the user with a generated root pass...
Implement the Python class `Instance` described below. Class description: Implement the Instance class. Method signatures and docstrings: - def enable_root_user(self, session): Enable login for the root user. This operation enables login from any host for the root user and provides the user with a generated root pass...
d474eb84c605c429bb9cccb166cabbdd1654d73c
<|skeleton|> class Instance: def enable_root_user(self, session): """Enable login for the root user. This operation enables login from any host for the root user and provides the user with a generated root password. :param session: The session to use for making this request. :type session: :class:`~keyston...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Instance: def enable_root_user(self, session): """Enable login for the root user. This operation enables login from any host for the root user and provides the user with a generated root password. :param session: The session to use for making this request. :type session: :class:`~keystoneauth1.adapter...
the_stack_v2_python_sparse
openstack/database/v1/instance.py
openstack/openstacksdk
train
124
ff1544a50011f4fa6920b71509e27f9a3a0b1062
[ "if '_xml_ns' in kwargs:\n self._xml_ns = kwargs['_xml_ns']\nif '_xml_ns_key' in kwargs:\n self._xml_ns_key = kwargs['_xml_ns_key']\nself.AntCoordFrame = AntCoordFrame\nself.AntPhaseCenter = AntPhaseCenter\nself.AntPattern = AntPattern\nsuper(AntennaType, self).__init__(**kwargs)", "if self.AntCoordFrame is...
<|body_start_0|> if '_xml_ns' in kwargs: self._xml_ns = kwargs['_xml_ns'] if '_xml_ns_key' in kwargs: self._xml_ns_key = kwargs['_xml_ns_key'] self.AntCoordFrame = AntCoordFrame self.AntPhaseCenter = AntPhaseCenter self.AntPattern = AntPattern supe...
Parameters that describe the transmit and receive antennas used to collect the signal array(s).
AntennaType
[ "MIT", "LicenseRef-scancode-free-unknown", "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AntennaType: """Parameters that describe the transmit and receive antennas used to collect the signal array(s).""" def __init__(self, AntCoordFrame=None, AntPhaseCenter=None, AntPattern=None, **kwargs): """Parameters ---------- AntCoordFrame : List[AntCoordFrameType] AntPhaseCenter :...
stack_v2_sparse_classes_10k_train_004370
7,511
permissive
[ { "docstring": "Parameters ---------- AntCoordFrame : List[AntCoordFrameType] AntPhaseCenter : List[AntPhaseCenterType] AntPattern : List[AntPatternType] kwargs", "name": "__init__", "signature": "def __init__(self, AntCoordFrame=None, AntPhaseCenter=None, AntPattern=None, **kwargs)" }, { "docst...
4
null
Implement the Python class `AntennaType` described below. Class description: Parameters that describe the transmit and receive antennas used to collect the signal array(s). Method signatures and docstrings: - def __init__(self, AntCoordFrame=None, AntPhaseCenter=None, AntPattern=None, **kwargs): Parameters ----------...
Implement the Python class `AntennaType` described below. Class description: Parameters that describe the transmit and receive antennas used to collect the signal array(s). Method signatures and docstrings: - def __init__(self, AntCoordFrame=None, AntPhaseCenter=None, AntPattern=None, **kwargs): Parameters ----------...
de1b1886f161a83b6c89aadc7a2c7cfc4892ef81
<|skeleton|> class AntennaType: """Parameters that describe the transmit and receive antennas used to collect the signal array(s).""" def __init__(self, AntCoordFrame=None, AntPhaseCenter=None, AntPattern=None, **kwargs): """Parameters ---------- AntCoordFrame : List[AntCoordFrameType] AntPhaseCenter :...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AntennaType: """Parameters that describe the transmit and receive antennas used to collect the signal array(s).""" def __init__(self, AntCoordFrame=None, AntPhaseCenter=None, AntPattern=None, **kwargs): """Parameters ---------- AntCoordFrame : List[AntCoordFrameType] AntPhaseCenter : List[AntPhas...
the_stack_v2_python_sparse
sarpy/io/received/crsd1_elements/Antenna.py
ngageoint/sarpy
train
192
5b37a4471322a633d7ad60d4606ad9a5f6aaca7a
[ "self.maze = maze\nself.rat_1 = rat_1\nself.rat_2 = rat_2\nself.num_sprouts_left = 0\nfor i in range(len(self.maze)):\n row = self.maze[i]\n self.num_sprouts_left += row.count('@')", "if self.maze[row][col] == '#':\n return True\nelse:\n return False", "if row == self.rat_1.row and col == self.rat_1...
<|body_start_0|> self.maze = maze self.rat_1 = rat_1 self.rat_2 = rat_2 self.num_sprouts_left = 0 for i in range(len(self.maze)): row = self.maze[i] self.num_sprouts_left += row.count('@') <|end_body_0|> <|body_start_1|> if self.maze[row][col] == ...
A 2D maze.
Maze
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Maze: """A 2D maze.""" def __init__(self, maze, rat_1, rat_2): """(Maze, list of list of str, Rat, Rat) -> NoneType Initialize a maze with two rats. Args: maze (list of list of str): a maze with contents. rat_1 (object): the first rat in the maze. rat_2 (object): the second rat in th...
stack_v2_sparse_classes_10k_train_004371
6,001
permissive
[ { "docstring": "(Maze, list of list of str, Rat, Rat) -> NoneType Initialize a maze with two rats. Args: maze (list of list of str): a maze with contents. rat_1 (object): the first rat in the maze. rat_2 (object): the second rat in the maze. Example call: Maze([['#', '#', '#', '#', '#', '#', '#'], ['#', '.', '....
5
stack_v2_sparse_classes_30k_train_003801
Implement the Python class `Maze` described below. Class description: A 2D maze. Method signatures and docstrings: - def __init__(self, maze, rat_1, rat_2): (Maze, list of list of str, Rat, Rat) -> NoneType Initialize a maze with two rats. Args: maze (list of list of str): a maze with contents. rat_1 (object): the fi...
Implement the Python class `Maze` described below. Class description: A 2D maze. Method signatures and docstrings: - def __init__(self, maze, rat_1, rat_2): (Maze, list of list of str, Rat, Rat) -> NoneType Initialize a maze with two rats. Args: maze (list of list of str): a maze with contents. rat_1 (object): the fi...
ff265343635a0109b6deab31f2a112d304d020cb
<|skeleton|> class Maze: """A 2D maze.""" def __init__(self, maze, rat_1, rat_2): """(Maze, list of list of str, Rat, Rat) -> NoneType Initialize a maze with two rats. Args: maze (list of list of str): a maze with contents. rat_1 (object): the first rat in the maze. rat_2 (object): the second rat in th...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Maze: """A 2D maze.""" def __init__(self, maze, rat_1, rat_2): """(Maze, list of list of str, Rat, Rat) -> NoneType Initialize a maze with two rats. Args: maze (list of list of str): a maze with contents. rat_1 (object): the first rat in the maze. rat_2 (object): the second rat in the maze. Examp...
the_stack_v2_python_sparse
Crafting_Quality_Code_UniToronto/week5_functions/assignment/a2.py
bounty030/Coursera
train
1
eca0b321a0e50117f6e6279a032335409d667249
[ "for s, t in zip_longest(self.get_next(S), self.get_next(T)):\n if s != t:\n return False\nreturn True", "hash_count = 0\nfor c in reversed(s):\n if c == '#':\n hash_count += 1\n elif hash_count > 0:\n hash_count -= 1\n else:\n yield c" ]
<|body_start_0|> for s, t in zip_longest(self.get_next(S), self.get_next(T)): if s != t: return False return True <|end_body_0|> <|body_start_1|> hash_count = 0 for c in reversed(s): if c == '#': hash_count += 1 elif ha...
Runtime: 24 ms, faster than 99.92% of Python3 online submissions for Backspace String Compare. Memory Usage: 13.3 MB, less than 9.92% of Python3 online submissions for Backspace String Compare.
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """Runtime: 24 ms, faster than 99.92% of Python3 online submissions for Backspace String Compare. Memory Usage: 13.3 MB, less than 9.92% of Python3 online submissions for Backspace String Compare.""" def backspaceCompare(self, S, T): """Given two strings S and T, return if ...
stack_v2_sparse_classes_10k_train_004372
1,928
no_license
[ { "docstring": "Given two strings S and T, return if they are equal when both are typed into empty text editors. # means a backspace character. Example 1: Input: S = \"ab#c\", T = \"ad#c\" Output: true Explanation: Both S and T become \"ac\". Example 2: Input: S = \"ab##\", T = \"c#d#\" Output: true Explanation...
2
null
Implement the Python class `Solution` described below. Class description: Runtime: 24 ms, faster than 99.92% of Python3 online submissions for Backspace String Compare. Memory Usage: 13.3 MB, less than 9.92% of Python3 online submissions for Backspace String Compare. Method signatures and docstrings: - def backspaceC...
Implement the Python class `Solution` described below. Class description: Runtime: 24 ms, faster than 99.92% of Python3 online submissions for Backspace String Compare. Memory Usage: 13.3 MB, less than 9.92% of Python3 online submissions for Backspace String Compare. Method signatures and docstrings: - def backspaceC...
01fe893ba2e37c9bda79e3081c556698f0b6d2f0
<|skeleton|> class Solution: """Runtime: 24 ms, faster than 99.92% of Python3 online submissions for Backspace String Compare. Memory Usage: 13.3 MB, less than 9.92% of Python3 online submissions for Backspace String Compare.""" def backspaceCompare(self, S, T): """Given two strings S and T, return if ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: """Runtime: 24 ms, faster than 99.92% of Python3 online submissions for Backspace String Compare. Memory Usage: 13.3 MB, less than 9.92% of Python3 online submissions for Backspace String Compare.""" def backspaceCompare(self, S, T): """Given two strings S and T, return if they are equa...
the_stack_v2_python_sparse
LeetCode/844_backspace_string_compare.py
KKosukeee/CodingQuestions
train
1
67ad328150f81565eed6168a51112866c3f59d55
[ "counter = {}\nfor num in nums:\n if num in counter:\n counter[num] += 1\n else:\n counter[num] = 1\nusing = avoid = 0\nprev = None\nfor k in sorted(counter):\n max_value = max(using, avoid)\n if k - 1 != prev:\n using = k * counter[k] + max(using, avoid)\n avoid = max_value\...
<|body_start_0|> counter = {} for num in nums: if num in counter: counter[num] += 1 else: counter[num] = 1 using = avoid = 0 prev = None for k in sorted(counter): max_value = max(using, avoid) if k - ...
Array
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Array: def delete_and_earn_(self, nums: List[int]) -> int: """Approach: DP (current and previous value) + Sorting Time Complexity: O(N log N) Space Complexity: O(N) :param nums: :return:""" <|body_0|> def delete_and_earn(self, nums: List[int]) -> int: """Approach: DP...
stack_v2_sparse_classes_10k_train_004373
1,643
no_license
[ { "docstring": "Approach: DP (current and previous value) + Sorting Time Complexity: O(N log N) Space Complexity: O(N) :param nums: :return:", "name": "delete_and_earn_", "signature": "def delete_and_earn_(self, nums: List[int]) -> int" }, { "docstring": "Approach: DP Time Complexity: O(N) Space...
2
null
Implement the Python class `Array` described below. Class description: Implement the Array class. Method signatures and docstrings: - def delete_and_earn_(self, nums: List[int]) -> int: Approach: DP (current and previous value) + Sorting Time Complexity: O(N log N) Space Complexity: O(N) :param nums: :return: - def d...
Implement the Python class `Array` described below. Class description: Implement the Array class. Method signatures and docstrings: - def delete_and_earn_(self, nums: List[int]) -> int: Approach: DP (current and previous value) + Sorting Time Complexity: O(N log N) Space Complexity: O(N) :param nums: :return: - def d...
65cc78b5afa0db064f9fe8f06597e3e120f7363d
<|skeleton|> class Array: def delete_and_earn_(self, nums: List[int]) -> int: """Approach: DP (current and previous value) + Sorting Time Complexity: O(N log N) Space Complexity: O(N) :param nums: :return:""" <|body_0|> def delete_and_earn(self, nums: List[int]) -> int: """Approach: DP...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Array: def delete_and_earn_(self, nums: List[int]) -> int: """Approach: DP (current and previous value) + Sorting Time Complexity: O(N log N) Space Complexity: O(N) :param nums: :return:""" counter = {} for num in nums: if num in counter: counter[num] += 1 ...
the_stack_v2_python_sparse
goldman_sachs/delete_and_earn.py
Shiv2157k/leet_code
train
1
f8c76d2c6a5a6595b6842ab4913feb18e056bb7a
[ "g = Grammar()\ng.train_string('Hello, world!')\nself.assertEqual('0 --(0)--> H e l l o , _ w o r l d ! \\n', g.print_grammar())", "g = Grammar()\ng.train_string('abcabdabcabd')\nself.assertEqual('0 --(0)--> 1 1 \\n1 --(2)--> 2 c 2 d abcabd\\n2 --(2)--> a b ...
<|body_start_0|> g = Grammar() g.train_string('Hello, world!') self.assertEqual('0 --(0)--> H e l l o , _ w o r l d ! \n', g.print_grammar()) <|end_body_0|> <|body_start_1|> g = Grammar() g.train_string('abcabdabcabd') self.assertEqual('0 --(0)--> 1 1 \n1 --(2)--> 2 c 2 ...
TestSequitur
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestSequitur: def test_sequitur(self): """docstring for test_sequitur""" <|body_0|> def test_sequitur_base(self): """docstring for test_sequitur_base""" <|body_1|> <|end_skeleton|> <|body_start_0|> g = Grammar() g.train_string('Hello, world!...
stack_v2_sparse_classes_10k_train_004374
696
permissive
[ { "docstring": "docstring for test_sequitur", "name": "test_sequitur", "signature": "def test_sequitur(self)" }, { "docstring": "docstring for test_sequitur_base", "name": "test_sequitur_base", "signature": "def test_sequitur_base(self)" } ]
2
stack_v2_sparse_classes_30k_train_000950
Implement the Python class `TestSequitur` described below. Class description: Implement the TestSequitur class. Method signatures and docstrings: - def test_sequitur(self): docstring for test_sequitur - def test_sequitur_base(self): docstring for test_sequitur_base
Implement the Python class `TestSequitur` described below. Class description: Implement the TestSequitur class. Method signatures and docstrings: - def test_sequitur(self): docstring for test_sequitur - def test_sequitur_base(self): docstring for test_sequitur_base <|skeleton|> class TestSequitur: def test_sequ...
7192f0bf26378d8aacb21c0220cc705cb577c6dc
<|skeleton|> class TestSequitur: def test_sequitur(self): """docstring for test_sequitur""" <|body_0|> def test_sequitur_base(self): """docstring for test_sequitur_base""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestSequitur: def test_sequitur(self): """docstring for test_sequitur""" g = Grammar() g.train_string('Hello, world!') self.assertEqual('0 --(0)--> H e l l o , _ w o r l d ! \n', g.print_grammar()) def test_sequitur_base(self): """docstring for test_sequitur_base""...
the_stack_v2_python_sparse
make_demo_discover_rt/pysequitur/sequiturpython/sequitur_test.py
sjtuytc/AAAI21-RoutineAugmentedPolicyLearning
train
15
f9d3c7f1e9ffe1e3c38cee5eeafd17c93abe2304
[ "self.num_generations = 0\nself.num_schemas = num_schemas\nself.min_generations = min_generations", "self.num_generations += 1\nif self.num_generations >= self.min_generations:\n all_seqs = []\n for org in organisms:\n if org.fitness > 0:\n if org.genome not in all_seqs:\n a...
<|body_start_0|> self.num_generations = 0 self.num_schemas = num_schemas self.min_generations = min_generations <|end_body_0|> <|body_start_1|> self.num_generations += 1 if self.num_generations >= self.min_generations: all_seqs = [] for org in organisms: ...
Determine when we are done evolving motifs. This takes the very simple approach of halting evolution when the GA has proceeded for a specified number of generations and has a given number of unique schema with positive fitness.
SimpleFinisher
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SimpleFinisher: """Determine when we are done evolving motifs. This takes the very simple approach of halting evolution when the GA has proceeded for a specified number of generations and has a given number of unique schema with positive fitness.""" def __init__(self, num_schemas, min_genera...
stack_v2_sparse_classes_10k_train_004375
26,199
permissive
[ { "docstring": "Initialize the finisher with its parameters. Arguments: o num_schemas -- the number of useful (positive fitness) schemas we want to generation o min_generations -- The minimum number of generations to allow the GA to proceed.", "name": "__init__", "signature": "def __init__(self, num_sch...
2
stack_v2_sparse_classes_30k_train_006297
Implement the Python class `SimpleFinisher` described below. Class description: Determine when we are done evolving motifs. This takes the very simple approach of halting evolution when the GA has proceeded for a specified number of generations and has a given number of unique schema with positive fitness. Method sig...
Implement the Python class `SimpleFinisher` described below. Class description: Determine when we are done evolving motifs. This takes the very simple approach of halting evolution when the GA has proceeded for a specified number of generations and has a given number of unique schema with positive fitness. Method sig...
1d9a8e84a8572809ee3260ede44290e14de3bdd1
<|skeleton|> class SimpleFinisher: """Determine when we are done evolving motifs. This takes the very simple approach of halting evolution when the GA has proceeded for a specified number of generations and has a given number of unique schema with positive fitness.""" def __init__(self, num_schemas, min_genera...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SimpleFinisher: """Determine when we are done evolving motifs. This takes the very simple approach of halting evolution when the GA has proceeded for a specified number of generations and has a given number of unique schema with positive fitness.""" def __init__(self, num_schemas, min_generations=100): ...
the_stack_v2_python_sparse
bin/last_wrapper/Bio/NeuralNetwork/Gene/Schema.py
LyonsLab/coge
train
41
3c6c7228a2b40b35be6604a70ac71748457e0b0f
[ "if isinstance(filter_names[0], str):\n flist = phot.load_filters(filter_names, interp=True, lamb=self.lamb, filterLib=filterLib)\n _fnames = filter_names\nelse:\n flist = phot.load_Integrationfilters(filter_names, interp=True, lamb=self.lamb)\n _fnames = [fk.name for fk in filter_names]\nif extLaw is n...
<|body_start_0|> if isinstance(filter_names[0], str): flist = phot.load_filters(filter_names, interp=True, lamb=self.lamb, filterLib=filterLib) _fnames = filter_names else: flist = phot.load_Integrationfilters(filter_names, interp=True, lamb=self.lamb) _fn...
Generate a grid that contains spectra. It provides an access to integrated photometry function getSEDs
SpectralGrid
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SpectralGrid: """Generate a grid that contains spectra. It provides an access to integrated photometry function getSEDs""" def getSEDs(self, filter_names, absFlux=True, extLaw=None, inplace=False, filterLib=None, **kwargs): """Extract integrated fluxes through filters Parameters ----...
stack_v2_sparse_classes_10k_train_004376
11,734
permissive
[ { "docstring": "Extract integrated fluxes through filters Parameters ---------- filter_names: list list of filter names according to the filter lib or filter instances (no mixing between name and instances) absFlux:bool returns absolute fluxes if set extLaw: extinction.ExtinctionLaw apply extinction law if prov...
2
stack_v2_sparse_classes_30k_val_000271
Implement the Python class `SpectralGrid` described below. Class description: Generate a grid that contains spectra. It provides an access to integrated photometry function getSEDs Method signatures and docstrings: - def getSEDs(self, filter_names, absFlux=True, extLaw=None, inplace=False, filterLib=None, **kwargs): ...
Implement the Python class `SpectralGrid` described below. Class description: Generate a grid that contains spectra. It provides an access to integrated photometry function getSEDs Method signatures and docstrings: - def getSEDs(self, filter_names, absFlux=True, extLaw=None, inplace=False, filterLib=None, **kwargs): ...
892940813f4b22d545b501cc596c72967d9a45bc
<|skeleton|> class SpectralGrid: """Generate a grid that contains spectra. It provides an access to integrated photometry function getSEDs""" def getSEDs(self, filter_names, absFlux=True, extLaw=None, inplace=False, filterLib=None, **kwargs): """Extract integrated fluxes through filters Parameters ----...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SpectralGrid: """Generate a grid that contains spectra. It provides an access to integrated photometry function getSEDs""" def getSEDs(self, filter_names, absFlux=True, extLaw=None, inplace=False, filterLib=None, **kwargs): """Extract integrated fluxes through filters Parameters ---------- filter...
the_stack_v2_python_sparse
beast/physicsmodel/grid.py
dthilker/beast
train
0
29abbd1ea85905caa5b284ecae65636de4d33fd3
[ "if not secret_key:\n return None\nsigner_kwargs = dict(key_derivation=self.key_derivation, digest_method=self.digest_method)\nreturn URLSafeTimedSerializer(secret_key, salt=self.salt, serializer=self.serializer, signer_kwargs=signer_kwargs)", "sscsi = SimpleSecureCookieSessionInterface()\nsigningSerializer = ...
<|body_start_0|> if not secret_key: return None signer_kwargs = dict(key_derivation=self.key_derivation, digest_method=self.digest_method) return URLSafeTimedSerializer(secret_key, salt=self.salt, serializer=self.serializer, signer_kwargs=signer_kwargs) <|end_body_0|> <|body_start_1...
SimpleSecureCookieSessionInterface
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SimpleSecureCookieSessionInterface: def get_signing_serializer(self, secret_key): """Used to check secret key""" <|body_0|> def decodeFlaskCookie(self, secret_key, cookieValue): """Decode a base 64 encoded string""" <|body_1|> def encodeFlaskCookie(self,...
stack_v2_sparse_classes_10k_train_004377
2,701
no_license
[ { "docstring": "Used to check secret key", "name": "get_signing_serializer", "signature": "def get_signing_serializer(self, secret_key)" }, { "docstring": "Decode a base 64 encoded string", "name": "decodeFlaskCookie", "signature": "def decodeFlaskCookie(self, secret_key, cookieValue)" ...
3
stack_v2_sparse_classes_30k_train_006257
Implement the Python class `SimpleSecureCookieSessionInterface` described below. Class description: Implement the SimpleSecureCookieSessionInterface class. Method signatures and docstrings: - def get_signing_serializer(self, secret_key): Used to check secret key - def decodeFlaskCookie(self, secret_key, cookieValue):...
Implement the Python class `SimpleSecureCookieSessionInterface` described below. Class description: Implement the SimpleSecureCookieSessionInterface class. Method signatures and docstrings: - def get_signing_serializer(self, secret_key): Used to check secret key - def decodeFlaskCookie(self, secret_key, cookieValue):...
24e1e25d2e512105c9bf70b5e33b1afed4790f71
<|skeleton|> class SimpleSecureCookieSessionInterface: def get_signing_serializer(self, secret_key): """Used to check secret key""" <|body_0|> def decodeFlaskCookie(self, secret_key, cookieValue): """Decode a base 64 encoded string""" <|body_1|> def encodeFlaskCookie(self,...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SimpleSecureCookieSessionInterface: def get_signing_serializer(self, secret_key): """Used to check secret key""" if not secret_key: return None signer_kwargs = dict(key_derivation=self.key_derivation, digest_method=self.digest_method) return URLSafeTimedSerializer(s...
the_stack_v2_python_sparse
flask/app/config.py
InTheNou/InTheNou-Backend
train
0
69b8ecf656173add61531024d7d8ed636e7f6f2b
[ "stack = []\nresult = [0] * len(temperatures)\nstack.append(0)\nfor i, v in enumerate(temperatures):\n while len(stack) != 0 and v > temperatures[stack[-1]]:\n pre = stack.pop()\n result[pre] = i - pre\n stack.append(i)\nreturn result", "n = len(temperatures)\ndays = [0] * n\nfor i in range(n ...
<|body_start_0|> stack = [] result = [0] * len(temperatures) stack.append(0) for i, v in enumerate(temperatures): while len(stack) != 0 and v > temperatures[stack[-1]]: pre = stack.pop() result[pre] = i - pre stack.append(i) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def dailyTemperatures(self, temperatures): """:type temperatures: List[int] :rtype: List[int]""" <|body_0|> def dailyTemperatures1(self, temperatures): """:type temperatures: List[int] :rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_...
stack_v2_sparse_classes_10k_train_004378
1,904
no_license
[ { "docstring": ":type temperatures: List[int] :rtype: List[int]", "name": "dailyTemperatures", "signature": "def dailyTemperatures(self, temperatures)" }, { "docstring": ":type temperatures: List[int] :rtype: List[int]", "name": "dailyTemperatures1", "signature": "def dailyTemperatures1(...
2
stack_v2_sparse_classes_30k_train_001727
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def dailyTemperatures(self, temperatures): :type temperatures: List[int] :rtype: List[int] - def dailyTemperatures1(self, temperatures): :type temperatures: List[int] :rtype: Lis...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def dailyTemperatures(self, temperatures): :type temperatures: List[int] :rtype: List[int] - def dailyTemperatures1(self, temperatures): :type temperatures: List[int] :rtype: Lis...
eaeeb9ad2d8cf2a60517cd86f42b30678b5ad2f8
<|skeleton|> class Solution: def dailyTemperatures(self, temperatures): """:type temperatures: List[int] :rtype: List[int]""" <|body_0|> def dailyTemperatures1(self, temperatures): """:type temperatures: List[int] :rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def dailyTemperatures(self, temperatures): """:type temperatures: List[int] :rtype: List[int]""" stack = [] result = [0] * len(temperatures) stack.append(0) for i, v in enumerate(temperatures): while len(stack) != 0 and v > temperatures[stack[-1]]:...
the_stack_v2_python_sparse
Python/739. Daily Temperatures.py
maiwen/LeetCode
train
0
7f02a712bd24ffc1fc9155af5a78881d76225f18
[ "self.agent_upgrade_task = agent_upgrade_task\nself.analysis_task = analysis_task\nself.backup_task = backup_task\nself.bulk_install_app_task = bulk_install_app_task\nself.clone_task = clone_task\nself.created_time_secs = created_time_secs\nself.description = description\nself.dismissed = dismissed\nself.dismissed_...
<|body_start_0|> self.agent_upgrade_task = agent_upgrade_task self.analysis_task = analysis_task self.backup_task = backup_task self.bulk_install_app_task = bulk_install_app_task self.clone_task = clone_task self.created_time_secs = created_time_secs self.descript...
Implementation of the 'TaskNotification' model. Structure that captures Task Notifications for a user. Attributes: agent_upgrade_task (AgentUpgradeTaskInfo): The notification details of Agent upgrade Task. analysis_task (AnalysisTaskInfo): The notifications details of Analysis Task. backup_task (BackupTaskInfo): The no...
TaskNotification
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TaskNotification: """Implementation of the 'TaskNotification' model. Structure that captures Task Notifications for a user. Attributes: agent_upgrade_task (AgentUpgradeTaskInfo): The notification details of Agent upgrade Task. analysis_task (AnalysisTaskInfo): The notifications details of Analysi...
stack_v2_sparse_classes_10k_train_004379
8,762
permissive
[ { "docstring": "Constructor for the TaskNotification class", "name": "__init__", "signature": "def __init__(self, agent_upgrade_task=None, analysis_task=None, backup_task=None, bulk_install_app_task=None, clone_task=None, created_time_secs=None, description=None, dismissed=None, dismissed_time_secs=None...
2
null
Implement the Python class `TaskNotification` described below. Class description: Implementation of the 'TaskNotification' model. Structure that captures Task Notifications for a user. Attributes: agent_upgrade_task (AgentUpgradeTaskInfo): The notification details of Agent upgrade Task. analysis_task (AnalysisTaskInfo...
Implement the Python class `TaskNotification` described below. Class description: Implementation of the 'TaskNotification' model. Structure that captures Task Notifications for a user. Attributes: agent_upgrade_task (AgentUpgradeTaskInfo): The notification details of Agent upgrade Task. analysis_task (AnalysisTaskInfo...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class TaskNotification: """Implementation of the 'TaskNotification' model. Structure that captures Task Notifications for a user. Attributes: agent_upgrade_task (AgentUpgradeTaskInfo): The notification details of Agent upgrade Task. analysis_task (AnalysisTaskInfo): The notifications details of Analysi...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TaskNotification: """Implementation of the 'TaskNotification' model. Structure that captures Task Notifications for a user. Attributes: agent_upgrade_task (AgentUpgradeTaskInfo): The notification details of Agent upgrade Task. analysis_task (AnalysisTaskInfo): The notifications details of Analysis Task. backu...
the_stack_v2_python_sparse
cohesity_management_sdk/models/task_notification.py
cohesity/management-sdk-python
train
24
d156ae6ab06ae81eb473288ceb2de35008fe3310
[ "if not grid or not grid[0]:\n return 0\nm, n = (len(grid), len(grid[0]))\nelapsed = [[float('inf')] * n for _ in range(m)]\n\ndef bfs(i, j, s):\n visited = set()\n queue = deque([(s, i, j)])\n while queue:\n s, i, j = queue.popleft()\n for dx, dy in ((-1, 0), (1, 0), (0, -1), (0, 1)):\n ...
<|body_start_0|> if not grid or not grid[0]: return 0 m, n = (len(grid), len(grid[0])) elapsed = [[float('inf')] * n for _ in range(m)] def bfs(i, j, s): visited = set() queue = deque([(s, i, j)]) while queue: s, i, j = que...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def orangesRotting(self, grid: List[List[int]]) -> int: """Time complexity: O(n^2) Space complexity: O(n^2)""" <|body_0|> def orangesRotting(self, grid: List[List[int]]) -> int: """Time complexity: O(n^2) Space complexity: O(n^2)""" <|body_1|> <|en...
stack_v2_sparse_classes_10k_train_004380
3,758
no_license
[ { "docstring": "Time complexity: O(n^2) Space complexity: O(n^2)", "name": "orangesRotting", "signature": "def orangesRotting(self, grid: List[List[int]]) -> int" }, { "docstring": "Time complexity: O(n^2) Space complexity: O(n^2)", "name": "orangesRotting", "signature": "def orangesRott...
2
stack_v2_sparse_classes_30k_train_003605
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def orangesRotting(self, grid: List[List[int]]) -> int: Time complexity: O(n^2) Space complexity: O(n^2) - def orangesRotting(self, grid: List[List[int]]) -> int: Time complexity...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def orangesRotting(self, grid: List[List[int]]) -> int: Time complexity: O(n^2) Space complexity: O(n^2) - def orangesRotting(self, grid: List[List[int]]) -> int: Time complexity...
1389a009a02e90e8700a7a00e0b7f797c129cdf4
<|skeleton|> class Solution: def orangesRotting(self, grid: List[List[int]]) -> int: """Time complexity: O(n^2) Space complexity: O(n^2)""" <|body_0|> def orangesRotting(self, grid: List[List[int]]) -> int: """Time complexity: O(n^2) Space complexity: O(n^2)""" <|body_1|> <|en...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def orangesRotting(self, grid: List[List[int]]) -> int: """Time complexity: O(n^2) Space complexity: O(n^2)""" if not grid or not grid[0]: return 0 m, n = (len(grid), len(grid[0])) elapsed = [[float('inf')] * n for _ in range(m)] def bfs(i, j, s):...
the_stack_v2_python_sparse
leetcode/solved/1036_Rotting_Oranges/solution.py
sungminoh/algorithms
train
0
790e1bc996d03b7d6f4aeee8cb1f4bb932117324
[ "self.amount_total = 0.0\nfor data in self.commission_line:\n self.amount_total += data.amount", "account_jrnl_obj = self.env['account.journal'].search([('type', '=', 'purchase')], limit=1)\nfor data in self:\n inv_line_values = {'name': 'Commission For ' + data.number or '', 'analytic_account_id': data.ten...
<|body_start_0|> self.amount_total = 0.0 for data in self.commission_line: self.amount_total += data.amount <|end_body_0|> <|body_start_1|> account_jrnl_obj = self.env['account.journal'].search([('type', '=', 'purchase')], limit=1) for data in self: inv_line_valu...
CommissionInvoice
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CommissionInvoice: def _amount_all(self): """Compute the total amounts of the SO.""" <|body_0|> def create_invoice(self): """This method is used to create supplier invoice. ------------------------------------------------------------ @param self: The object pointer""...
stack_v2_sparse_classes_10k_train_004381
11,342
no_license
[ { "docstring": "Compute the total amounts of the SO.", "name": "_amount_all", "signature": "def _amount_all(self)" }, { "docstring": "This method is used to create supplier invoice. ------------------------------------------------------------ @param self: The object pointer", "name": "create...
5
stack_v2_sparse_classes_30k_test_000135
Implement the Python class `CommissionInvoice` described below. Class description: Implement the CommissionInvoice class. Method signatures and docstrings: - def _amount_all(self): Compute the total amounts of the SO. - def create_invoice(self): This method is used to create supplier invoice. ------------------------...
Implement the Python class `CommissionInvoice` described below. Class description: Implement the CommissionInvoice class. Method signatures and docstrings: - def _amount_all(self): Compute the total amounts of the SO. - def create_invoice(self): This method is used to create supplier invoice. ------------------------...
163136f382faa8607db8fb6cda42a5ba07c4076b
<|skeleton|> class CommissionInvoice: def _amount_all(self): """Compute the total amounts of the SO.""" <|body_0|> def create_invoice(self): """This method is used to create supplier invoice. ------------------------------------------------------------ @param self: The object pointer""...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CommissionInvoice: def _amount_all(self): """Compute the total amounts of the SO.""" self.amount_total = 0.0 for data in self.commission_line: self.amount_total += data.amount def create_invoice(self): """This method is used to create supplier invoice. --------...
the_stack_v2_python_sparse
property_commission_ee/models/property_commission.py
maarejsys/Roya
train
0
b219452a72cc74876124d76ca356e7c5fdb35992
[ "self._inset = inset\nself._term_width = (maxwidth or get_terminal_size()[0]) - inset * 4\nself._items: List[Tuple[str, str]] = []\nself._max_name_width = 0\nself._max_value_width = 0", "self._items.extend(item_list)\nfor name, value in item_list:\n self._max_name_width = max(self._max_name_width, len(name))\n...
<|body_start_0|> self._inset = inset self._term_width = (maxwidth or get_terminal_size()[0]) - inset * 4 self._items: List[Tuple[str, str]] = [] self._max_name_width = 0 self._max_value_width = 0 <|end_body_0|> <|body_start_1|> self._items.extend(item_list) for n...
@brief Formats a set of values in multiple columns. The value_list must be a list of bi-tuples (name, value) sorted in the desired display order. The number of columns will be determined by the terminal width and maximum value width. The values will be printed in column major order.
ColumnFormatter
[ "CC-BY-4.0", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ColumnFormatter: """@brief Formats a set of values in multiple columns. The value_list must be a list of bi-tuples (name, value) sorted in the desired display order. The number of columns will be determined by the terminal width and maximum value width. The values will be printed in column major ...
stack_v2_sparse_classes_10k_train_004382
3,831
permissive
[ { "docstring": "@brief Constructor. @param self The object. @param maxwidth Number of characters to which the output width must be constrained. If not provided, then the width of the stdout terminal is used. If getting the terminal width fails, for instance if stdout is not a terminal, then a default of 80 char...
4
null
Implement the Python class `ColumnFormatter` described below. Class description: @brief Formats a set of values in multiple columns. The value_list must be a list of bi-tuples (name, value) sorted in the desired display order. The number of columns will be determined by the terminal width and maximum value width. The ...
Implement the Python class `ColumnFormatter` described below. Class description: @brief Formats a set of values in multiple columns. The value_list must be a list of bi-tuples (name, value) sorted in the desired display order. The number of columns will be determined by the terminal width and maximum value width. The ...
9253740baf46ebf4eacbce6bf3369150c5fb8ee0
<|skeleton|> class ColumnFormatter: """@brief Formats a set of values in multiple columns. The value_list must be a list of bi-tuples (name, value) sorted in the desired display order. The number of columns will be determined by the terminal width and maximum value width. The values will be printed in column major ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ColumnFormatter: """@brief Formats a set of values in multiple columns. The value_list must be a list of bi-tuples (name, value) sorted in the desired display order. The number of columns will be determined by the terminal width and maximum value width. The values will be printed in column major order.""" ...
the_stack_v2_python_sparse
pyocd/utility/columns.py
pyocd/pyOCD
train
507
2fe5e1aa02b31005092dcd43d6f3fb2d697408d6
[ "self.base_image = pygame.image.load(image)\nself.images = []\nself.duration = duration\nself.last_change = time()\nself.selected_image = 0\nsprite_w = self.base_image.get_width() / w\nsprite_h = self.base_image.get_height() / h\nself.final_size = final_size\nself.invisible_color = invisible_color\nif final_size is...
<|body_start_0|> self.base_image = pygame.image.load(image) self.images = [] self.duration = duration self.last_change = time() self.selected_image = 0 sprite_w = self.base_image.get_width() / w sprite_h = self.base_image.get_height() / h self.final_size =...
SpriteSheet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SpriteSheet: def __init__(self, image: str, w: int, h: int, duration: float=None, final_size: tuple=None, invisible_color: tuple=(0, 0, 1)): """This class is for creating spritesheets :param image: the path to the image of the sheet :param w: the width of each frame in the sheet :param h...
stack_v2_sparse_classes_10k_train_004383
2,468
no_license
[ { "docstring": "This class is for creating spritesheets :param image: the path to the image of the sheet :param w: the width of each frame in the sheet :param h: the height of each frame in the sheet :param duration: the number of seconds to stay on each frame :param final_size: the final size to scale the imag...
3
stack_v2_sparse_classes_30k_train_005587
Implement the Python class `SpriteSheet` described below. Class description: Implement the SpriteSheet class. Method signatures and docstrings: - def __init__(self, image: str, w: int, h: int, duration: float=None, final_size: tuple=None, invisible_color: tuple=(0, 0, 1)): This class is for creating spritesheets :par...
Implement the Python class `SpriteSheet` described below. Class description: Implement the SpriteSheet class. Method signatures and docstrings: - def __init__(self, image: str, w: int, h: int, duration: float=None, final_size: tuple=None, invisible_color: tuple=(0, 0, 1)): This class is for creating spritesheets :par...
e9e68cf3ba4f9f12e66eae81893ca9dcc534835c
<|skeleton|> class SpriteSheet: def __init__(self, image: str, w: int, h: int, duration: float=None, final_size: tuple=None, invisible_color: tuple=(0, 0, 1)): """This class is for creating spritesheets :param image: the path to the image of the sheet :param w: the width of each frame in the sheet :param h...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SpriteSheet: def __init__(self, image: str, w: int, h: int, duration: float=None, final_size: tuple=None, invisible_color: tuple=(0, 0, 1)): """This class is for creating spritesheets :param image: the path to the image of the sheet :param w: the width of each frame in the sheet :param h: the height o...
the_stack_v2_python_sparse
Objects/SpriteSheet.py
john-palazzolo/PyGE
train
0
20dbeed40bbf3a52d73b62441485b43c7ba64eb3
[ "self.encoding = encoding\nself.object_hook = object_hook\nself.object_pairs_hook = object_pairs_hook\nself.parse_float = parse_float or float\nself.parse_int = parse_int or int\nself.parse_constant = parse_constant or _CONSTANTS.__getitem__\nself.strict = strict\nself.parse_object = JSONObject\nself.parse_array = ...
<|body_start_0|> self.encoding = encoding self.object_hook = object_hook self.object_pairs_hook = object_pairs_hook self.parse_float = parse_float or float self.parse_int = parse_int or int self.parse_constant = parse_constant or _CONSTANTS.__getitem__ self.strict...
Simple JSON <http://json.org> decoder Performs the following translations in decoding by default: +---------------+-------------------+ | JSON | Python | +===============+===================+ | object | dict | +---------------+-------------------+ | array | list | +---------------+-------------------+ | string | unicod...
JSONDecoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JSONDecoder: """Simple JSON <http://json.org> decoder Performs the following translations in decoding by default: +---------------+-------------------+ | JSON | Python | +===============+===================+ | object | dict | +---------------+-------------------+ | array | list | +---------------...
stack_v2_sparse_classes_10k_train_004384
47,385
no_license
[ { "docstring": "``encoding`` determines the encoding used to interpret any ``str`` objects decoded by this instance (utf-8 by default). It has no effect when decoding ``unicode`` objects. Note that currently only encodings that are a superset of ASCII work, strings of other encodings should be passed in as ``un...
3
stack_v2_sparse_classes_30k_train_004062
Implement the Python class `JSONDecoder` described below. Class description: Simple JSON <http://json.org> decoder Performs the following translations in decoding by default: +---------------+-------------------+ | JSON | Python | +===============+===================+ | object | dict | +---------------+---------------...
Implement the Python class `JSONDecoder` described below. Class description: Simple JSON <http://json.org> decoder Performs the following translations in decoding by default: +---------------+-------------------+ | JSON | Python | +===============+===================+ | object | dict | +---------------+---------------...
1f5295cd6114f3f18958be0e0618ff6b35aa16d7
<|skeleton|> class JSONDecoder: """Simple JSON <http://json.org> decoder Performs the following translations in decoding by default: +---------------+-------------------+ | JSON | Python | +===============+===================+ | object | dict | +---------------+-------------------+ | array | list | +---------------...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class JSONDecoder: """Simple JSON <http://json.org> decoder Performs the following translations in decoding by default: +---------------+-------------------+ | JSON | Python | +===============+===================+ | object | dict | +---------------+-------------------+ | array | list | +---------------+------------...
the_stack_v2_python_sparse
packages/python_compat_json.py
grid-control/grid-control
train
32
1a26e4dc0293ea5e61eba87cdc6247a267ac67c2
[ "max_profit = 0\nprev_price = prices[0]\nfor price in prices[1:]:\n if price > prev_price:\n max_profit += price - prev_price\n prev_price = price\nreturn max_profit", "n = len(prices)\ndp = [[None, None] for _ in range(n)]\ndp[0][0], dp[0][1] = (0, -prices[0])\nfor idx in range(1, n):\n dp[idx][0...
<|body_start_0|> max_profit = 0 prev_price = prices[0] for price in prices[1:]: if price > prev_price: max_profit += price - prev_price prev_price = price return max_profit <|end_body_0|> <|body_start_1|> n = len(prices) dp = [[Non...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxProfit(self, prices: List[int]) -> int: """贪心""" <|body_0|> def maxProfitDP(self, prices: List[int]) -> int: """动态规划-二维数组""" <|body_1|> def maxProfitDPOPT(self, prices: List[int]) -> int: """动态规划-空间优化""" <|body_2|> <|end...
stack_v2_sparse_classes_10k_train_004385
2,597
no_license
[ { "docstring": "贪心", "name": "maxProfit", "signature": "def maxProfit(self, prices: List[int]) -> int" }, { "docstring": "动态规划-二维数组", "name": "maxProfitDP", "signature": "def maxProfitDP(self, prices: List[int]) -> int" }, { "docstring": "动态规划-空间优化", "name": "maxProfitDPOPT",...
3
stack_v2_sparse_classes_30k_train_004696
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices: List[int]) -> int: 贪心 - def maxProfitDP(self, prices: List[int]) -> int: 动态规划-二维数组 - def maxProfitDPOPT(self, prices: List[int]) -> int: 动态规划-空间优化
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices: List[int]) -> int: 贪心 - def maxProfitDP(self, prices: List[int]) -> int: 动态规划-二维数组 - def maxProfitDPOPT(self, prices: List[int]) -> int: 动态规划-空间优化 <|...
52756b30e9d51794591aca030bc918e707f473f1
<|skeleton|> class Solution: def maxProfit(self, prices: List[int]) -> int: """贪心""" <|body_0|> def maxProfitDP(self, prices: List[int]) -> int: """动态规划-二维数组""" <|body_1|> def maxProfitDPOPT(self, prices: List[int]) -> int: """动态规划-空间优化""" <|body_2|> <|end...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def maxProfit(self, prices: List[int]) -> int: """贪心""" max_profit = 0 prev_price = prices[0] for price in prices[1:]: if price > prev_price: max_profit += price - prev_price prev_price = price return max_profit def...
the_stack_v2_python_sparse
122.买卖股票的最佳时机II/solution.py
QtTao/daily_leetcode
train
0
6ca3259a6785bf4e58c7ec9a3cfc14a44acb3a85
[ "if IATTopic.providedBy(context) or ICollection.providedBy(context):\n return context.queryCatalog(batch=False)\nelif IFolderish.providedBy(context):\n return context.getFolderContents(batch=False)", "if objectimages:\n theader = '\\n <thead>\\n <tr>\\n ...
<|body_start_0|> if IATTopic.providedBy(context) or ICollection.providedBy(context): return context.queryCatalog(batch=False) elif IFolderish.providedBy(context): return context.getFolderContents(batch=False) <|end_body_0|> <|body_start_1|> if objectimages: t...
DownloadWoid_Viewlet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DownloadWoid_Viewlet: def query(self, context): """Make catalog query for the folder listing.""" <|body_0|> def createTableHeader(self, objectimages): """Create the Header for Table""" <|body_1|> def createZeileFromMF(self, obj, objectimages): ""...
stack_v2_sparse_classes_10k_train_004386
5,467
no_license
[ { "docstring": "Make catalog query for the folder listing.", "name": "query", "signature": "def query(self, context)" }, { "docstring": "Create the Header for Table", "name": "createTableHeader", "signature": "def createTableHeader(self, objectimages)" }, { "docstring": "Create a...
5
null
Implement the Python class `DownloadWoid_Viewlet` described below. Class description: Implement the DownloadWoid_Viewlet class. Method signatures and docstrings: - def query(self, context): Make catalog query for the folder listing. - def createTableHeader(self, objectimages): Create the Header for Table - def create...
Implement the Python class `DownloadWoid_Viewlet` described below. Class description: Implement the DownloadWoid_Viewlet class. Method signatures and docstrings: - def query(self, context): Make catalog query for the folder listing. - def createTableHeader(self, objectimages): Create the Header for Table - def create...
62203ae995bd708dc81809cc8698c0b24208735e
<|skeleton|> class DownloadWoid_Viewlet: def query(self, context): """Make catalog query for the folder listing.""" <|body_0|> def createTableHeader(self, objectimages): """Create the Header for Table""" <|body_1|> def createZeileFromMF(self, obj, objectimages): ""...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DownloadWoid_Viewlet: def query(self, context): """Make catalog query for the folder listing.""" if IATTopic.providedBy(context) or ICollection.providedBy(context): return context.queryCatalog(batch=False) elif IFolderish.providedBy(context): return context.getF...
the_stack_v2_python_sparse
nva.flgdesktop/trunk/nva/flgdesktop/viewlets.py
witsch/novareto
train
0
4b2f5be965fb5274f9efeeaa05979c7e39fea8ca
[ "user_id = params.get('user_id')\nlog.debug(f'Checking if user ({user_id}) is permitted to change their nickname.')\ndata = self.db.get(self.prison_table, user_id) or {}\nif data and data.get('end_timestamp'):\n log.trace('User exists in the prison_table.')\n end_time = data.get('end_timestamp')\n if is_ex...
<|body_start_0|> user_id = params.get('user_id') log.debug(f'Checking if user ({user_id}) is permitted to change their nickname.') data = self.db.get(self.prison_table, user_id) or {} if data and data.get('end_timestamp'): log.trace('User exists in the prison_table.') ...
SuperstarifyView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SuperstarifyView: def get(self, params=None): """Check if the user is currently in superstar-prison. If user is currently servin' his sentence in the big house, return the name stored in the forced_nick column of prison_table. If user cannot be found in prison, or if his sentence has exp...
stack_v2_sparse_classes_10k_train_004387
5,973
permissive
[ { "docstring": "Check if the user is currently in superstar-prison. If user is currently servin' his sentence in the big house, return the name stored in the forced_nick column of prison_table. If user cannot be found in prison, or if his sentence has expired, return nothing. Data must be provided as params. AP...
3
stack_v2_sparse_classes_30k_train_000691
Implement the Python class `SuperstarifyView` described below. Class description: Implement the SuperstarifyView class. Method signatures and docstrings: - def get(self, params=None): Check if the user is currently in superstar-prison. If user is currently servin' his sentence in the big house, return the name stored...
Implement the Python class `SuperstarifyView` described below. Class description: Implement the SuperstarifyView class. Method signatures and docstrings: - def get(self, params=None): Check if the user is currently in superstar-prison. If user is currently servin' his sentence in the big house, return the name stored...
bc87a43b3fc1ff3424b1c9603b0a35b28f2c3896
<|skeleton|> class SuperstarifyView: def get(self, params=None): """Check if the user is currently in superstar-prison. If user is currently servin' his sentence in the big house, return the name stored in the forced_nick column of prison_table. If user cannot be found in prison, or if his sentence has exp...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SuperstarifyView: def get(self, params=None): """Check if the user is currently in superstar-prison. If user is currently servin' his sentence in the big house, return the name stored in the forced_nick column of prison_table. If user cannot be found in prison, or if his sentence has expired, return n...
the_stack_v2_python_sparse
pysite/views/api/bot/superstarify.py
landizz/site
train
0
eab34f8ac29168d50aca50b6ac8c9332437525b9
[ "res = super(ManageCusomerBadge, self).default_get(fields)\ncustomer_id = self.env.context.get('default_customer_id')\nif customer_id:\n customer = self.env['res.partner'].browse(customer_id)\nif customer.exists():\n if 'flsp_cb_id' in fields:\n res['flsp_cb_id'] = customer.flsp_cb_id\nres = self._conv...
<|body_start_0|> res = super(ManageCusomerBadge, self).default_get(fields) customer_id = self.env.context.get('default_customer_id') if customer_id: customer = self.env['res.partner'].browse(customer_id) if customer.exists(): if 'flsp_cb_id' in fields: ...
Class_Name: ManageCusomerBadge Model_Name: flsp.manage.customer.badge Purpose: To create a model used in the wizard to manage customer badge Date: April/09th/2021 Author: Perry He
ManageCusomerBadge
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ManageCusomerBadge: """Class_Name: ManageCusomerBadge Model_Name: flsp.manage.customer.badge Purpose: To create a model used in the wizard to manage customer badge Date: April/09th/2021 Author: Perry He""" def default_get(self, fields): """Purpose: to get the default values from the ...
stack_v2_sparse_classes_10k_train_004388
3,247
no_license
[ { "docstring": "Purpose: to get the default values from the customer model and load in the wizard", "name": "default_get", "signature": "def default_get(self, fields)" }, { "docstring": "Purpose: 1) Button used in wizard to add/update the badge 2) send the email only when it is done", "name"...
3
null
Implement the Python class `ManageCusomerBadge` described below. Class description: Class_Name: ManageCusomerBadge Model_Name: flsp.manage.customer.badge Purpose: To create a model used in the wizard to manage customer badge Date: April/09th/2021 Author: Perry He Method signatures and docstrings: - def default_get(se...
Implement the Python class `ManageCusomerBadge` described below. Class description: Class_Name: ManageCusomerBadge Model_Name: flsp.manage.customer.badge Purpose: To create a model used in the wizard to manage customer badge Date: April/09th/2021 Author: Perry He Method signatures and docstrings: - def default_get(se...
4a82cd5cfd1898c6da860cb68dff3a14e037bbad
<|skeleton|> class ManageCusomerBadge: """Class_Name: ManageCusomerBadge Model_Name: flsp.manage.customer.badge Purpose: To create a model used in the wizard to manage customer badge Date: April/09th/2021 Author: Perry He""" def default_get(self, fields): """Purpose: to get the default values from the ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ManageCusomerBadge: """Class_Name: ManageCusomerBadge Model_Name: flsp.manage.customer.badge Purpose: To create a model used in the wizard to manage customer badge Date: April/09th/2021 Author: Perry He""" def default_get(self, fields): """Purpose: to get the default values from the customer mode...
the_stack_v2_python_sparse
flsp-salesorder/models/manage_customer_badge_wizard.py
odoo-smg/firstlight
train
3
60b2fba24c18be3fd65449e31e24574a42f9166d
[ "super(AnaphoraDocumentGraph, self).__init__()\nself.name = name if name else os.path.basename(anaphora_filepath)\nself.ns = namespace\nself.root = self.ns + ':root_node'\nself.tokens = []\nif anaphora_filepath:\n self.add_node(self.root, layers={self.ns})\n with open(anaphora_filepath, 'r') as anno_file:\n ...
<|body_start_0|> super(AnaphoraDocumentGraph, self).__init__() self.name = name if name else os.path.basename(anaphora_filepath) self.ns = namespace self.root = self.ns + ':root_node' self.tokens = [] if anaphora_filepath: self.add_node(self.root, layers={self...
represents a text in which abstract anaphora were annotated as a graph. Attributes ---------- ns : str the namespace of the graph (default: anaphoricity) tokens : list of int a list of node IDs (int) which represent the tokens in the order they occur in the text root : str name of the document root node ID (default: se...
AnaphoraDocumentGraph
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AnaphoraDocumentGraph: """represents a text in which abstract anaphora were annotated as a graph. Attributes ---------- ns : str the namespace of the graph (default: anaphoricity) tokens : list of int a list of node IDs (int) which represent the tokens in the order they occur in the text root : s...
stack_v2_sparse_classes_10k_train_004389
7,148
permissive
[ { "docstring": "Reads an abstract anaphora annotation file, creates a directed graph and adds a node for each token, as well as an edge from the root node to each token. If a token is annotated, it will have a 'namespace:annotation' attribute, which maps to a dict with the keys 'anaphoricity' (str) and 'certain...
2
stack_v2_sparse_classes_30k_train_000271
Implement the Python class `AnaphoraDocumentGraph` described below. Class description: represents a text in which abstract anaphora were annotated as a graph. Attributes ---------- ns : str the namespace of the graph (default: anaphoricity) tokens : list of int a list of node IDs (int) which represent the tokens in th...
Implement the Python class `AnaphoraDocumentGraph` described below. Class description: represents a text in which abstract anaphora were annotated as a graph. Attributes ---------- ns : str the namespace of the graph (default: anaphoricity) tokens : list of int a list of node IDs (int) which represent the tokens in th...
108fea5a7f61030a9c11708296e06ee8ccfd7783
<|skeleton|> class AnaphoraDocumentGraph: """represents a text in which abstract anaphora were annotated as a graph. Attributes ---------- ns : str the namespace of the graph (default: anaphoricity) tokens : list of int a list of node IDs (int) which represent the tokens in the order they occur in the text root : s...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AnaphoraDocumentGraph: """represents a text in which abstract anaphora were annotated as a graph. Attributes ---------- ns : str the namespace of the graph (default: anaphoricity) tokens : list of int a list of node IDs (int) which represent the tokens in the order they occur in the text root : str name of th...
the_stack_v2_python_sparse
src/discoursegraphs/readwrite/anaphoricity.py
dav009/discoursegraphs
train
1
ae1484874866b0cae3797d25c09cef62088d97b4
[ "res = ''\nfor e in strs:\n res += str(len(e)) + ':' + e\nreturn res", "ans = []\ni = 0\nwhile i < len(s):\n index = s.find(':', i)\n size = int(s[i:index])\n print(s[i:index])\n ans.append(s[index + 1:index + 1 + size])\n i = index + 1 + size\nreturn ans" ]
<|body_start_0|> res = '' for e in strs: res += str(len(e)) + ':' + e return res <|end_body_0|> <|body_start_1|> ans = [] i = 0 while i < len(s): index = s.find(':', i) size = int(s[i:index]) print(s[i:index]) a...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def encode(self, strs): """Encodes a list of strings to a single string. :type strs: List[str] :rtype: str""" <|body_0|> def decode(self, s): """Decodes a single string to a list of strings. :type s: str :rtype: List[str]""" <|body_1|> <|end_skelet...
stack_v2_sparse_classes_10k_train_004390
854
no_license
[ { "docstring": "Encodes a list of strings to a single string. :type strs: List[str] :rtype: str", "name": "encode", "signature": "def encode(self, strs)" }, { "docstring": "Decodes a single string to a list of strings. :type s: str :rtype: List[str]", "name": "decode", "signature": "def ...
2
stack_v2_sparse_classes_30k_train_004320
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def encode(self, strs): Encodes a list of strings to a single string. :type strs: List[str] :rtype: str - def decode(self, s): Decodes a single string to a list of strings. :type...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def encode(self, strs): Encodes a list of strings to a single string. :type strs: List[str] :rtype: str - def decode(self, s): Decodes a single string to a list of strings. :type...
0bab7ee631af6b45c0c1322fcc8ae26b6280a7d6
<|skeleton|> class Solution: def encode(self, strs): """Encodes a list of strings to a single string. :type strs: List[str] :rtype: str""" <|body_0|> def decode(self, s): """Decodes a single string to a list of strings. :type s: str :rtype: List[str]""" <|body_1|> <|end_skelet...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def encode(self, strs): """Encodes a list of strings to a single string. :type strs: List[str] :rtype: str""" res = '' for e in strs: res += str(len(e)) + ':' + e return res def decode(self, s): """Decodes a single string to a list of strings....
the_stack_v2_python_sparse
python/271.encode_decode_strings.py
xiang525/leetcode_2018
train
0
f53e8d47c874f62e63b8b4e7a2f1b6c2e94f4df6
[ "try:\n updated_exp_model = exp_services.populate_exp_model_fields(exp_model, migrated_exp)\n commit_message = 'Update exploration states schema version to %d.' % feconf.CURRENT_STATE_SCHEMA_VERSION\n models_to_put_values = []\n with datastore_services.get_ndb_context():\n models_to_put_values = ...
<|body_start_0|> try: updated_exp_model = exp_services.populate_exp_model_fields(exp_model, migrated_exp) commit_message = 'Update exploration states schema version to %d.' % feconf.CURRENT_STATE_SCHEMA_VERSION models_to_put_values = [] with datastore_services.get...
Job that migrates Exploration models.
MigrateExplorationJob
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MigrateExplorationJob: """Job that migrates Exploration models.""" def _update_exploration(exp_model: exp_models.ExplorationModel, migrated_exp: exp_domain.Exploration, exp_changes: Sequence[exp_domain.ExplorationChange]) -> result.Result[Tuple[base_models.BaseModel], Tuple[str, Exception]]:...
stack_v2_sparse_classes_10k_train_004391
28,752
permissive
[ { "docstring": "Generates newly updated exploration models. Args: exp_model: ExplorationModel. The exploration which should be updated. migrated_exp: Exploration. The migrated exploration domain object. exp_changes: Sequence(ExplorationChange). The exploration changes to apply. Returns: Sequence(BaseModel). Seq...
2
null
Implement the Python class `MigrateExplorationJob` described below. Class description: Job that migrates Exploration models. Method signatures and docstrings: - def _update_exploration(exp_model: exp_models.ExplorationModel, migrated_exp: exp_domain.Exploration, exp_changes: Sequence[exp_domain.ExplorationChange]) ->...
Implement the Python class `MigrateExplorationJob` described below. Class description: Job that migrates Exploration models. Method signatures and docstrings: - def _update_exploration(exp_model: exp_models.ExplorationModel, migrated_exp: exp_domain.Exploration, exp_changes: Sequence[exp_domain.ExplorationChange]) ->...
d16fdf23d790eafd63812bd7239532256e30a21d
<|skeleton|> class MigrateExplorationJob: """Job that migrates Exploration models.""" def _update_exploration(exp_model: exp_models.ExplorationModel, migrated_exp: exp_domain.Exploration, exp_changes: Sequence[exp_domain.ExplorationChange]) -> result.Result[Tuple[base_models.BaseModel], Tuple[str, Exception]]:...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MigrateExplorationJob: """Job that migrates Exploration models.""" def _update_exploration(exp_model: exp_models.ExplorationModel, migrated_exp: exp_domain.Exploration, exp_changes: Sequence[exp_domain.ExplorationChange]) -> result.Result[Tuple[base_models.BaseModel], Tuple[str, Exception]]: """G...
the_stack_v2_python_sparse
core/jobs/batch_jobs/exp_migration_jobs.py
oppia/oppia
train
6,172
5db9854cf3c0f1fc3907b81fa0b4d06bb72cb2d8
[ "left, right = (0, len(height) - 1)\nleft_max = right_max = area = 0\nwhile left < right:\n if height[left] < height[right]:\n if height[left] >= left_max:\n left_max = height[left]\n area += left_max - height[left]\n left += 1\n else:\n if height[right] >= right_max:\n ...
<|body_start_0|> left, right = (0, len(height) - 1) left_max = right_max = area = 0 while left < right: if height[left] < height[right]: if height[left] >= left_max: left_max = height[left] area += left_max - height[left] ...
Formulae to find trapping rain water: elevation = [0, 2, 3] [0, 1, 2] current_index = 1 water_area = minimum( maximum(elevation[previous], elevation[current]), maximum(elevation[current], elevation[next]) ) - elevation[current]
ElevationMap
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ElevationMap: """Formulae to find trapping rain water: elevation = [0, 2, 3] [0, 1, 2] current_index = 1 water_area = minimum( maximum(elevation[previous], elevation[current]), maximum(elevation[current], elevation[next]) ) - elevation[current]""" def get_trapped_rain_water_area(self, height...
stack_v2_sparse_classes_10k_train_004392
5,285
no_license
[ { "docstring": "Approach: Two Pointers Time Complexity: O(n) Space Complexity: O(1) Algorithm: - Initialize left and right pointer with 0 and last elevation position - loop until left is less than right - if elevation of left positioned is less then elevation of right positioned - if left elevation is greater t...
3
null
Implement the Python class `ElevationMap` described below. Class description: Formulae to find trapping rain water: elevation = [0, 2, 3] [0, 1, 2] current_index = 1 water_area = minimum( maximum(elevation[previous], elevation[current]), maximum(elevation[current], elevation[next]) ) - elevation[current] Method signa...
Implement the Python class `ElevationMap` described below. Class description: Formulae to find trapping rain water: elevation = [0, 2, 3] [0, 1, 2] current_index = 1 water_area = minimum( maximum(elevation[previous], elevation[current]), maximum(elevation[current], elevation[next]) ) - elevation[current] Method signa...
65cc78b5afa0db064f9fe8f06597e3e120f7363d
<|skeleton|> class ElevationMap: """Formulae to find trapping rain water: elevation = [0, 2, 3] [0, 1, 2] current_index = 1 water_area = minimum( maximum(elevation[previous], elevation[current]), maximum(elevation[current], elevation[next]) ) - elevation[current]""" def get_trapped_rain_water_area(self, height...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ElevationMap: """Formulae to find trapping rain water: elevation = [0, 2, 3] [0, 1, 2] current_index = 1 water_area = minimum( maximum(elevation[previous], elevation[current]), maximum(elevation[current], elevation[next]) ) - elevation[current]""" def get_trapped_rain_water_area(self, height: List[int]) ...
the_stack_v2_python_sparse
data_structures/trapping_rain_water.py
Shiv2157k/leet_code
train
1
76d8394392631cadec6be80a7152b68608f87a2e
[ "super().__init__(*args, **kwargs)\nxblock_resource_info = {(xblock_resource_pkg(xblock_class), xblock_class.get_resources_dir()) for __, xblock_class in XBlock.load_classes()}\nself.package_storages = [XBlockPackageStorage(pkg_name, resources_dir) for pkg_name, resources_dir in xblock_resource_info]", "for stora...
<|body_start_0|> super().__init__(*args, **kwargs) xblock_resource_info = {(xblock_resource_pkg(xblock_class), xblock_class.get_resources_dir()) for __, xblock_class in XBlock.load_classes()} self.package_storages = [XBlockPackageStorage(pkg_name, resources_dir) for pkg_name, resources_dir in xb...
A static files finder that gets static assets from xblocks.
XBlockPipelineFinder
[ "AGPL-3.0-only", "AGPL-3.0-or-later", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class XBlockPipelineFinder: """A static files finder that gets static assets from xblocks.""" def __init__(self, *args, **kwargs): """The XBlockPipelineFinder creates a separate XBlockPackageStorage for every installed XBlock package when its initialized. After that initialization happens,...
stack_v2_sparse_classes_10k_train_004393
5,498
permissive
[ { "docstring": "The XBlockPipelineFinder creates a separate XBlockPackageStorage for every installed XBlock package when its initialized. After that initialization happens, we just proxy all list()/find() requests by iterating through the XBlockPackageStorage objects.", "name": "__init__", "signature": ...
3
null
Implement the Python class `XBlockPipelineFinder` described below. Class description: A static files finder that gets static assets from xblocks. Method signatures and docstrings: - def __init__(self, *args, **kwargs): The XBlockPipelineFinder creates a separate XBlockPackageStorage for every installed XBlock package...
Implement the Python class `XBlockPipelineFinder` described below. Class description: A static files finder that gets static assets from xblocks. Method signatures and docstrings: - def __init__(self, *args, **kwargs): The XBlockPipelineFinder creates a separate XBlockPackageStorage for every installed XBlock package...
5809eaca7079a15ee56b0b7fcfea425337046c97
<|skeleton|> class XBlockPipelineFinder: """A static files finder that gets static assets from xblocks.""" def __init__(self, *args, **kwargs): """The XBlockPipelineFinder creates a separate XBlockPackageStorage for every installed XBlock package when its initialized. After that initialization happens,...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class XBlockPipelineFinder: """A static files finder that gets static assets from xblocks.""" def __init__(self, *args, **kwargs): """The XBlockPipelineFinder creates a separate XBlockPackageStorage for every installed XBlock package when its initialized. After that initialization happens, we just prox...
the_stack_v2_python_sparse
Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/openedx/core/lib/xblock_pipeline/finder.py
luque/better-ways-of-thinking-about-software
train
3
a754919e854bb13f1e283e8e8fada59e9c1298c1
[ "self.r = 0\nself.c = 0\nself.l = vec2d", "re = self.l[self.r][self.c]\nself.c += 1\nreturn re", "while self.r < len(self.l):\n if self.c < len(self.l[self.r]):\n return True\n self.r += 1\n self.c = 0\nreturn False" ]
<|body_start_0|> self.r = 0 self.c = 0 self.l = vec2d <|end_body_0|> <|body_start_1|> re = self.l[self.r][self.c] self.c += 1 return re <|end_body_1|> <|body_start_2|> while self.r < len(self.l): if self.c < len(self.l[self.r]): retur...
Vector2D
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Vector2D: def __init__(self, vec2d): """Initialize your data structure here. :type vec2d: List[List[int]]""" <|body_0|> def next(self): """:rtype: int""" <|body_1|> def hasNext(self): """:rtype: bool""" <|body_2|> <|end_skeleton|> <|bod...
stack_v2_sparse_classes_10k_train_004394
1,584
no_license
[ { "docstring": "Initialize your data structure here. :type vec2d: List[List[int]]", "name": "__init__", "signature": "def __init__(self, vec2d)" }, { "docstring": ":rtype: int", "name": "next", "signature": "def next(self)" }, { "docstring": ":rtype: bool", "name": "hasNext",...
3
null
Implement the Python class `Vector2D` described below. Class description: Implement the Vector2D class. Method signatures and docstrings: - def __init__(self, vec2d): Initialize your data structure here. :type vec2d: List[List[int]] - def next(self): :rtype: int - def hasNext(self): :rtype: bool
Implement the Python class `Vector2D` described below. Class description: Implement the Vector2D class. Method signatures and docstrings: - def __init__(self, vec2d): Initialize your data structure here. :type vec2d: List[List[int]] - def next(self): :rtype: int - def hasNext(self): :rtype: bool <|skeleton|> class V...
fe79161211cc08c269cde9e1fdcfed27de11f2cb
<|skeleton|> class Vector2D: def __init__(self, vec2d): """Initialize your data structure here. :type vec2d: List[List[int]]""" <|body_0|> def next(self): """:rtype: int""" <|body_1|> def hasNext(self): """:rtype: bool""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Vector2D: def __init__(self, vec2d): """Initialize your data structure here. :type vec2d: List[List[int]]""" self.r = 0 self.c = 0 self.l = vec2d def next(self): """:rtype: int""" re = self.l[self.r][self.c] self.c += 1 return re def ha...
the_stack_v2_python_sparse
MyLeetCode/python/Flatten 2D Vector.py
ihuei801/leetcode
train
0
bb420c3ec2693ce5b78109d5345a5fd7bfe2935b
[ "shared = SharedObjects.get()\nself.flagmaterial = ba.Material()\nself.flagmaterial.add_actions(conditions=(('we_are_younger_than', 100), 'and', ('they_have_material', shared.object_material)), actions=('modify_node_collision', 'collide', False))\nself.flagmaterial.add_actions(conditions=('they_have_material', shar...
<|body_start_0|> shared = SharedObjects.get() self.flagmaterial = ba.Material() self.flagmaterial.add_actions(conditions=(('we_are_younger_than', 100), 'and', ('they_have_material', shared.object_material)), actions=('modify_node_collision', 'collide', False)) self.flagmaterial.add_actio...
Wraps up media and other resources used by ba.Flags. category: Gameplay Classes A single instance of this is shared between all flags and can be retrieved via bastd.actor.flag.get_factory(). Attributes: flagmaterial The ba.Material applied to all ba.Flags. impact_sound The ba.Sound used when a ba.Flag hits the ground. ...
FlagFactory
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FlagFactory: """Wraps up media and other resources used by ba.Flags. category: Gameplay Classes A single instance of this is shared between all flags and can be retrieved via bastd.actor.flag.get_factory(). Attributes: flagmaterial The ba.Material applied to all ba.Flags. impact_sound The ba.Soun...
stack_v2_sparse_classes_10k_train_004395
13,816
permissive
[ { "docstring": "Instantiate a FlagFactory. You shouldn't need to do this; call bastd.actor.flag.get_factory() to get a shared instance.", "name": "__init__", "signature": "def __init__(self) -> None" }, { "docstring": "Get/create a shared FlagFactory instance.", "name": "get", "signature...
2
null
Implement the Python class `FlagFactory` described below. Class description: Wraps up media and other resources used by ba.Flags. category: Gameplay Classes A single instance of this is shared between all flags and can be retrieved via bastd.actor.flag.get_factory(). Attributes: flagmaterial The ba.Material applied to...
Implement the Python class `FlagFactory` described below. Class description: Wraps up media and other resources used by ba.Flags. category: Gameplay Classes A single instance of this is shared between all flags and can be retrieved via bastd.actor.flag.get_factory(). Attributes: flagmaterial The ba.Material applied to...
3ffeff8ce401a00128363ff08b406471092adaa9
<|skeleton|> class FlagFactory: """Wraps up media and other resources used by ba.Flags. category: Gameplay Classes A single instance of this is shared between all flags and can be retrieved via bastd.actor.flag.get_factory(). Attributes: flagmaterial The ba.Material applied to all ba.Flags. impact_sound The ba.Soun...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FlagFactory: """Wraps up media and other resources used by ba.Flags. category: Gameplay Classes A single instance of this is shared between all flags and can be retrieved via bastd.actor.flag.get_factory(). Attributes: flagmaterial The ba.Material applied to all ba.Flags. impact_sound The ba.Sound used when a...
the_stack_v2_python_sparse
assets/src/ba_data/python/bastd/actor/flag.py
kakekakeka/ballistica
train
2
942a1b7180ca41a8a3f2996b4b7f16f2f4ff2ae7
[ "patient_id = data['patient_id']\npatient = Patient(data['patient'])\nanamnesis = Anamnesis(data['anamnesis'])\nrecord = Record(patient_id, patient, anamnesis)\nfilename = '{}.json'.format(str(random.randint(10000, 99999)))\nfilepath = os.path.join(os.getcwd(), self.DEFAULT_PATH_TO_PENDING_BLOCK, filename)\nwith op...
<|body_start_0|> patient_id = data['patient_id'] patient = Patient(data['patient']) anamnesis = Anamnesis(data['anamnesis']) record = Record(patient_id, patient, anamnesis) filename = '{}.json'.format(str(random.randint(10000, 99999))) filepath = os.path.join(os.getcwd(),...
Controller
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Controller: def add(self, data): """Data akan ditambahkan ke folder pending sebelum dibuat menjadi satu blok utuh Data terdiri dari 2 class yaitu : Patient, Anamnesis""" <|body_0|> def get(self, id): """Mengambil data berdasarkan ID yang ada""" <|body_1|> ...
stack_v2_sparse_classes_10k_train_004396
1,571
no_license
[ { "docstring": "Data akan ditambahkan ke folder pending sebelum dibuat menjadi satu blok utuh Data terdiri dari 2 class yaitu : Patient, Anamnesis", "name": "add", "signature": "def add(self, data)" }, { "docstring": "Mengambil data berdasarkan ID yang ada", "name": "get", "signature": "...
3
stack_v2_sparse_classes_30k_train_003029
Implement the Python class `Controller` described below. Class description: Implement the Controller class. Method signatures and docstrings: - def add(self, data): Data akan ditambahkan ke folder pending sebelum dibuat menjadi satu blok utuh Data terdiri dari 2 class yaitu : Patient, Anamnesis - def get(self, id): M...
Implement the Python class `Controller` described below. Class description: Implement the Controller class. Method signatures and docstrings: - def add(self, data): Data akan ditambahkan ke folder pending sebelum dibuat menjadi satu blok utuh Data terdiri dari 2 class yaitu : Patient, Anamnesis - def get(self, id): M...
8e55e77f6a89e0e4fef60da38c318fcf97b551a3
<|skeleton|> class Controller: def add(self, data): """Data akan ditambahkan ke folder pending sebelum dibuat menjadi satu blok utuh Data terdiri dari 2 class yaitu : Patient, Anamnesis""" <|body_0|> def get(self, id): """Mengambil data berdasarkan ID yang ada""" <|body_1|> ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Controller: def add(self, data): """Data akan ditambahkan ke folder pending sebelum dibuat menjadi satu blok utuh Data terdiri dari 2 class yaitu : Patient, Anamnesis""" patient_id = data['patient_id'] patient = Patient(data['patient']) anamnesis = Anamnesis(data['anamnesis']) ...
the_stack_v2_python_sparse
Distributed/Puskesmas Manado/Data/components/Controller.py
chlengkey/medchain-peer
train
0
36d2653943b5703d04b9bd44d62feace2bd260ac
[ "product_data_queue_obj = self.env['shopify.product.data.queue.ept']\nir_model_obj = self.env['ir.model']\ncommon_log_book_obj = self.env['common.log.book.ept']\nquery = \"select queue.id\\n from shopify_product_data_queue_line_ept as queue_line\\n inner join shopify_product_data_queue...
<|body_start_0|> product_data_queue_obj = self.env['shopify.product.data.queue.ept'] ir_model_obj = self.env['ir.model'] common_log_book_obj = self.env['common.log.book.ept'] query = "select queue.id\n from shopify_product_data_queue_line_ept as queue_line\n ...
ShopifyProductDataQueueLineEpt
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ShopifyProductDataQueueLineEpt: def auto_import_product_queue_line_data(self): """This method used to process synced shopify product data in batch of 100 queue lines. @author: Maulik Barad on Date 31-Aug-2020.""" <|body_0|> def process_product_queue_line_data(self): ...
stack_v2_sparse_classes_10k_train_004397
6,365
no_license
[ { "docstring": "This method used to process synced shopify product data in batch of 100 queue lines. @author: Maulik Barad on Date 31-Aug-2020.", "name": "auto_import_product_queue_line_data", "signature": "def auto_import_product_queue_line_data(self)" }, { "docstring": "This method processes p...
3
stack_v2_sparse_classes_30k_train_006056
Implement the Python class `ShopifyProductDataQueueLineEpt` described below. Class description: Implement the ShopifyProductDataQueueLineEpt class. Method signatures and docstrings: - def auto_import_product_queue_line_data(self): This method used to process synced shopify product data in batch of 100 queue lines. @a...
Implement the Python class `ShopifyProductDataQueueLineEpt` described below. Class description: Implement the ShopifyProductDataQueueLineEpt class. Method signatures and docstrings: - def auto_import_product_queue_line_data(self): This method used to process synced shopify product data in batch of 100 queue lines. @a...
581b23342122c0568407c1c42efd4b2085719335
<|skeleton|> class ShopifyProductDataQueueLineEpt: def auto_import_product_queue_line_data(self): """This method used to process synced shopify product data in batch of 100 queue lines. @author: Maulik Barad on Date 31-Aug-2020.""" <|body_0|> def process_product_queue_line_data(self): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ShopifyProductDataQueueLineEpt: def auto_import_product_queue_line_data(self): """This method used to process synced shopify product data in batch of 100 queue lines. @author: Maulik Barad on Date 31-Aug-2020.""" product_data_queue_obj = self.env['shopify.product.data.queue.ept'] ir_mo...
the_stack_v2_python_sparse
modules/shopify_ept/models/product_data_queue_line.py
yspcn/odoo14-import
train
0
89bb95569b2c036cf44fa64b7ddcedfa740036f6
[ "self.wave = wave\nself.flux = flux\nself.ivar = ivar\nself.mask = mask\nself.resolution_data = resolution_data\nself.fibermap = fibermap\nself.header = header\nself.meta = header\nself.scores = scores", "if not isinstance(index, slice):\n index = np.atleast_1d(index)\nif self.scores is not None:\n scores =...
<|body_start_0|> self.wave = wave self.flux = flux self.ivar = ivar self.mask = mask self.resolution_data = resolution_data self.fibermap = fibermap self.header = header self.meta = header self.scores = scores <|end_body_0|> <|body_start_1|> ...
Lightweight Frame object for regrouping This is intended for I/O without the overheads of float32 -> float64 conversion, correcting endianness, etc.
FrameLite
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FrameLite: """Lightweight Frame object for regrouping This is intended for I/O without the overheads of float32 -> float64 conversion, correcting endianness, etc.""" def __init__(self, wave, flux, ivar, mask, resolution_data, fibermap, header, scores=None): """Create a new FrameLite ...
stack_v2_sparse_classes_10k_train_004398
28,251
permissive
[ { "docstring": "Create a new FrameLite object Args: wave: 1D array of wavlengths flux: 2D[nspec, nwave] fluxes ivar: 2D[nspec, nwave] inverse variances of flux mask: 2D[nspec, nwave] mask of flux; 0=good resolution_data 3D[nspec, ndiag, nwave] Resolution matrix diagonals fibermap: fibermap table header: FITS he...
3
null
Implement the Python class `FrameLite` described below. Class description: Lightweight Frame object for regrouping This is intended for I/O without the overheads of float32 -> float64 conversion, correcting endianness, etc. Method signatures and docstrings: - def __init__(self, wave, flux, ivar, mask, resolution_data...
Implement the Python class `FrameLite` described below. Class description: Lightweight Frame object for regrouping This is intended for I/O without the overheads of float32 -> float64 conversion, correcting endianness, etc. Method signatures and docstrings: - def __init__(self, wave, flux, ivar, mask, resolution_data...
d75d0540cd07df1bf46130338a33c2ced51fbead
<|skeleton|> class FrameLite: """Lightweight Frame object for regrouping This is intended for I/O without the overheads of float32 -> float64 conversion, correcting endianness, etc.""" def __init__(self, wave, flux, ivar, mask, resolution_data, fibermap, header, scores=None): """Create a new FrameLite ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FrameLite: """Lightweight Frame object for regrouping This is intended for I/O without the overheads of float32 -> float64 conversion, correcting endianness, etc.""" def __init__(self, wave, flux, ivar, mask, resolution_data, fibermap, header, scores=None): """Create a new FrameLite object Args: ...
the_stack_v2_python_sparse
py/desispec/pixgroup.py
desihub/desispec
train
33
182149bb257971bc11799a4d521e5de50e7621ac
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn BookingService()", "from .booking_price_type import BookingPriceType\nfrom .booking_question_assignment import BookingQuestionAssignment\nfrom .booking_reminder import BookingReminder\nfrom .booking_scheduling_policy import BookingSche...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return BookingService() <|end_body_0|> <|body_start_1|> from .booking_price_type import BookingPriceType from .booking_question_assignment import BookingQuestionAssignment from .booking...
Represents a particular service offered by a booking business.
BookingService
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BookingService: """Represents a particular service offered by a booking business.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> BookingService: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The pars...
stack_v2_sparse_classes_10k_train_004399
9,420
permissive
[ { "docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: BookingService", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_valu...
3
null
Implement the Python class `BookingService` described below. Class description: Represents a particular service offered by a booking business. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> BookingService: Creates a new instance of the appropriate clas...
Implement the Python class `BookingService` described below. Class description: Represents a particular service offered by a booking business. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> BookingService: Creates a new instance of the appropriate clas...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class BookingService: """Represents a particular service offered by a booking business.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> BookingService: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The pars...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BookingService: """Represents a particular service offered by a booking business.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> BookingService: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use...
the_stack_v2_python_sparse
msgraph/generated/models/booking_service.py
microsoftgraph/msgraph-sdk-python
train
135