blob_id stringlengths 40 40 | bodies listlengths 2 6 | bodies_text stringlengths 196 6.73k | class_docstring stringlengths 0 700 | class_name stringlengths 1 86 | detected_licenses listlengths 0 45 | format_version stringclasses 1
value | full_text stringlengths 438 7.52k | id stringlengths 40 40 | length_bytes int64 506 50k | license_type stringclasses 2
values | methods listlengths 2 6 | n_methods int64 2 6 | original_id stringlengths 38 40 ⌀ | prompt stringlengths 153 4.25k | prompted_full_text stringlengths 645 10.7k | revision_id stringlengths 40 40 | skeleton stringlengths 162 4.34k | snapshot_name stringclasses 1
value | snapshot_source_dir stringclasses 1
value | solution stringlengths 302 7.33k | source stringclasses 1
value | source_path stringlengths 4 177 | source_repo stringlengths 6 110 | split stringclasses 1
value | star_events_count int64 0 209k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
d5f3f5672bbc26e921e40e75080ad7584c1d2bba | [
"super(GlobalDiscriminator, self).__init__()\nself.global_model = PatchDiscriminator(input_nc=cfg.cond_nc, ndf=cfg.ndf, n_layers=cfg.n_layers, max_nf_mult=cfg.max_nf_mult, norm_type=cfg.norm_type, use_sigmoid=cfg.use_sigmoid)\nif use_aug_bg:\n self.bg_model = PatchDiscriminator(input_nc=cfg.bg_cond_nc, ndf=cfg.n... | <|body_start_0|>
super(GlobalDiscriminator, self).__init__()
self.global_model = PatchDiscriminator(input_nc=cfg.cond_nc, ndf=cfg.ndf, n_layers=cfg.n_layers, max_nf_mult=cfg.max_nf_mult, norm_type=cfg.norm_type, use_sigmoid=cfg.use_sigmoid)
if use_aug_bg:
self.bg_model = PatchDiscrim... | GlobalDiscriminator | [
"MIT",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-proprietary-license",
"Apache-2.0",
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GlobalDiscriminator:
def __init__(self, cfg, use_aug_bg=False):
"""Args: cfg (dict or EasyDict): the configurations, and it contains the followings, --cond_nc (int): the input dimension; --ndf (int): the number of filters at the first layer, default is 64; --n_layers (int): the number of... | stack_v2_sparse_classes_36k_train_008600 | 11,501 | permissive | [
{
"docstring": "Args: cfg (dict or EasyDict): the configurations, and it contains the followings, --cond_nc (int): the input dimension; --ndf (int): the number of filters at the first layer, default is 64; --n_layers (int): the number of downsampling operations, such as the convolution with stride 2, default is... | 2 | stack_v2_sparse_classes_30k_train_001936 | Implement the Python class `GlobalDiscriminator` described below.
Class description:
Implement the GlobalDiscriminator class.
Method signatures and docstrings:
- def __init__(self, cfg, use_aug_bg=False): Args: cfg (dict or EasyDict): the configurations, and it contains the followings, --cond_nc (int): the input dime... | Implement the Python class `GlobalDiscriminator` described below.
Class description:
Implement the GlobalDiscriminator class.
Method signatures and docstrings:
- def __init__(self, cfg, use_aug_bg=False): Args: cfg (dict or EasyDict): the configurations, and it contains the followings, --cond_nc (int): the input dime... | fcf9a18ffd66bf3fdd3eea4153a3bc4785131848 | <|skeleton|>
class GlobalDiscriminator:
def __init__(self, cfg, use_aug_bg=False):
"""Args: cfg (dict or EasyDict): the configurations, and it contains the followings, --cond_nc (int): the input dimension; --ndf (int): the number of filters at the first layer, default is 64; --n_layers (int): the number of... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GlobalDiscriminator:
def __init__(self, cfg, use_aug_bg=False):
"""Args: cfg (dict or EasyDict): the configurations, and it contains the followings, --cond_nc (int): the input dimension; --ndf (int): the number of filters at the first layer, default is 64; --n_layers (int): the number of downsampling ... | the_stack_v2_python_sparse | iPERCore/models/networks/discriminators/multi_scale_dis.py | iPERDance/iPERCore | train | 2,520 | |
bdcf768f75c74f4900f61438a4ee56b1ff924fec | [
"cached_state = None\nif self.cli_state is self.SHELL:\n cached_state = self.SHELL\nif self.cli_state is not self.CONFIG:\n self._drive_cli_state(self.cli_state, self.CONFIG)\nerr_cmd, status = (None, True)\nerr_msg = None\ncmd_list = self._va_list_of_cmds(cmd)\nfor each_cmd in cmd_list:\n output, status =... | <|body_start_0|>
cached_state = None
if self.cli_state is self.SHELL:
cached_state = self.SHELL
if self.cli_state is not self.CONFIG:
self._drive_cli_state(self.cli_state, self.CONFIG)
err_cmd, status = (None, True)
err_msg = None
cmd_list = self._... | Access implements methods that translate to executing cli commands remotely on the director. | VaAccess | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VaAccess:
"""Access implements methods that translate to executing cli commands remotely on the director."""
def va_config(self, cmd=None, timeout=60, commit=True, exit=True, **kwargs):
"""method calls the _va_exec_cli_cmd method of the access layer. kwargs: :cmd (str|list): a single... | stack_v2_sparse_classes_36k_train_008601 | 5,550 | no_license | [
{
"docstring": "method calls the _va_exec_cli_cmd method of the access layer. kwargs: :cmd (str|list): a single string command or a list of string commands :timeout (int): timeout for each command in the list :commit (bool-True): if the config requires a commit :exit (bool-True): exit config mode and go back to... | 5 | stack_v2_sparse_classes_30k_train_017852 | Implement the Python class `VaAccess` described below.
Class description:
Access implements methods that translate to executing cli commands remotely on the director.
Method signatures and docstrings:
- def va_config(self, cmd=None, timeout=60, commit=True, exit=True, **kwargs): method calls the _va_exec_cli_cmd meth... | Implement the Python class `VaAccess` described below.
Class description:
Access implements methods that translate to executing cli commands remotely on the director.
Method signatures and docstrings:
- def va_config(self, cmd=None, timeout=60, commit=True, exit=True, **kwargs): method calls the _va_exec_cli_cmd meth... | cb02979e233ce772bd5fe88ecdc31caf8764d306 | <|skeleton|>
class VaAccess:
"""Access implements methods that translate to executing cli commands remotely on the director."""
def va_config(self, cmd=None, timeout=60, commit=True, exit=True, **kwargs):
"""method calls the _va_exec_cli_cmd method of the access layer. kwargs: :cmd (str|list): a single... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class VaAccess:
"""Access implements methods that translate to executing cli commands remotely on the director."""
def va_config(self, cmd=None, timeout=60, commit=True, exit=True, **kwargs):
"""method calls the _va_exec_cli_cmd method of the access layer. kwargs: :cmd (str|list): a single string comma... | the_stack_v2_python_sparse | feature/director/accesslib/director_3_1.py | 18782967131/test | train | 1 |
371f7250db3db5a1ed091f2cfa2d49854ae3ca24 | [
"dict = {}\nfor each in nums:\n if each not in dict:\n dict[each] = 1\n else:\n dict[each] += 1\nres = []\nfor each in dict.keys():\n if dict[each] == 2:\n res.append(each)\nreturn res",
"a = []\nb = set()\nfor each in nums:\n if each in b:\n a.append(each)\n else:\n ... | <|body_start_0|>
dict = {}
for each in nums:
if each not in dict:
dict[each] = 1
else:
dict[each] += 1
res = []
for each in dict.keys():
if dict[each] == 2:
res.append(each)
return res
<|end_body_... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findDuplicates(self, nums):
""":type nums: List[int] :rtype: List[int]"""
<|body_0|>
def findDuplicates2(self, nums):
""":type nums: List[int] :rtype: List[int]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
dict = {}
for each... | stack_v2_sparse_classes_36k_train_008602 | 724 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: List[int]",
"name": "findDuplicates",
"signature": "def findDuplicates(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: List[int]",
"name": "findDuplicates2",
"signature": "def findDuplicates2(self, nums)"
}
] | 2 | stack_v2_sparse_classes_30k_train_016926 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findDuplicates(self, nums): :type nums: List[int] :rtype: List[int]
- def findDuplicates2(self, nums): :type nums: List[int] :rtype: List[int] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findDuplicates(self, nums): :type nums: List[int] :rtype: List[int]
- def findDuplicates2(self, nums): :type nums: List[int] :rtype: List[int]
<|skeleton|>
class Solution:
... | 4105e18050b15fc0409c75353ad31be17187dd34 | <|skeleton|>
class Solution:
def findDuplicates(self, nums):
""":type nums: List[int] :rtype: List[int]"""
<|body_0|>
def findDuplicates2(self, nums):
""":type nums: List[int] :rtype: List[int]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def findDuplicates(self, nums):
""":type nums: List[int] :rtype: List[int]"""
dict = {}
for each in nums:
if each not in dict:
dict[each] = 1
else:
dict[each] += 1
res = []
for each in dict.keys():
... | the_stack_v2_python_sparse | findDuplicates.py | NeilWangziyu/Leetcode_py | train | 2 | |
ebaed0a7637233f5340efe6f200842f274eabea5 | [
"if allowed_path and (not os.path.isdir(allowed_path)):\n raise ValueError(\"'allowed_path' has to be a directory.\")\nself.path = allowed_path\nself.encoding = encoding",
"if filename != os.path.basename(filename):\n raise ValueError('No path allowed in filename. (%s)' % filename)\nfilename = os.path.join(... | <|body_start_0|>
if allowed_path and (not os.path.isdir(allowed_path)):
raise ValueError("'allowed_path' has to be a directory.")
self.path = allowed_path
self.encoding = encoding
<|end_body_0|>
<|body_start_1|>
if filename != os.path.basename(filename):
raise Va... | Load template from a file. When loading a template from a file, it's possible to including other templates (by using 'include' in the template). But for simplicity and security, all included templates have to be in the same directory! (see ``allowed_path``) | LoaderFile | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LoaderFile:
"""Load template from a file. When loading a template from a file, it's possible to including other templates (by using 'include' in the template). But for simplicity and security, all included templates have to be in the same directory! (see ``allowed_path``)"""
def __init__(sel... | stack_v2_sparse_classes_36k_train_008603 | 46,659 | permissive | [
{
"docstring": "Init the loader. :Parameters: - `allowed_path`: path of the template-files - `encoding`: encoding of the template-files :Exceptions: - `ValueError`: if `allowed_path` is not a directory",
"name": "__init__",
"signature": "def __init__(self, allowed_path=None, encoding='utf-8')"
},
{
... | 2 | stack_v2_sparse_classes_30k_train_014174 | Implement the Python class `LoaderFile` described below.
Class description:
Load template from a file. When loading a template from a file, it's possible to including other templates (by using 'include' in the template). But for simplicity and security, all included templates have to be in the same directory! (see ``a... | Implement the Python class `LoaderFile` described below.
Class description:
Load template from a file. When loading a template from a file, it's possible to including other templates (by using 'include' in the template). But for simplicity and security, all included templates have to be in the same directory! (see ``a... | 5efe02f4ac37156152ec8ec5512ce74a163d6675 | <|skeleton|>
class LoaderFile:
"""Load template from a file. When loading a template from a file, it's possible to including other templates (by using 'include' in the template). But for simplicity and security, all included templates have to be in the same directory! (see ``allowed_path``)"""
def __init__(sel... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LoaderFile:
"""Load template from a file. When loading a template from a file, it's possible to including other templates (by using 'include' in the template). But for simplicity and security, all included templates have to be in the same directory! (see ``allowed_path``)"""
def __init__(self, allowed_pa... | the_stack_v2_python_sparse | util/py_lib/pyratemp.py | seqan/seqan | train | 438 |
0730394ebf585c76cb3e3e4a6a8d99e4cd7453f9 | [
"self.__window = Window(lexicon, windowSize, startPadding, endPadding)\nself.__lexicon = lexicon\nself.__filters = filters",
"tknIdxs = []\nfor token in sequence:\n for f in self.__filters:\n token = f.filter(token, sequence)\n tknIdxs.append(self.__lexicon.put(token))\nreturn self.__window.buildWind... | <|body_start_0|>
self.__window = Window(lexicon, windowSize, startPadding, endPadding)
self.__lexicon = lexicon
self.__filters = filters
<|end_body_0|>
<|body_start_1|>
tknIdxs = []
for token in sequence:
for f in self.__filters:
token = f.filter(toke... | Generate window of words from each word of a list. This list can be a line. | WordWindowGenerator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WordWindowGenerator:
"""Generate window of words from each word of a list. This list can be a line."""
def __init__(self, windowSize, lexicon, filters, startPadding, endPadding=None):
""":type windowSize: int :param windowSize: the size of window :type lexicon: data.Lexicon.Lexicon :... | stack_v2_sparse_classes_36k_train_008604 | 1,529 | no_license | [
{
"docstring": ":type windowSize: int :param windowSize: the size of window :type lexicon: data.Lexicon.Lexicon :param lexicon: :type filters: list[DataOperation.Filters.Filter] :param filters: :param startPadding: Object that will be place when the initial limit of a list is exceeded :param endPadding: Object ... | 2 | null | Implement the Python class `WordWindowGenerator` described below.
Class description:
Generate window of words from each word of a list. This list can be a line.
Method signatures and docstrings:
- def __init__(self, windowSize, lexicon, filters, startPadding, endPadding=None): :type windowSize: int :param windowSize:... | Implement the Python class `WordWindowGenerator` described below.
Class description:
Generate window of words from each word of a list. This list can be a line.
Method signatures and docstrings:
- def __init__(self, windowSize, lexicon, filters, startPadding, endPadding=None): :type windowSize: int :param windowSize:... | c2b6d502790fb1b15eee41b32636bd0a55ab3de2 | <|skeleton|>
class WordWindowGenerator:
"""Generate window of words from each word of a list. This list can be a line."""
def __init__(self, windowSize, lexicon, filters, startPadding, endPadding=None):
""":type windowSize: int :param windowSize: the size of window :type lexicon: data.Lexicon.Lexicon :... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class WordWindowGenerator:
"""Generate window of words from each word of a list. This list can be a line."""
def __init__(self, windowSize, lexicon, filters, startPadding, endPadding=None):
""":type windowSize: int :param windowSize: the size of window :type lexicon: data.Lexicon.Lexicon :param lexicon... | the_stack_v2_python_sparse | data/WordWindowGenerator.py | eraldoluis/lia-pln-deeplearning | train | 5 |
4e795d4488a814ebc494485f02c8f499cea11005 | [
"user_id = get_jwt_identity()\nif user_id is None:\n query = Blog.select().where(Blog.published)\nelse:\n query = Blog.select()\nreturn paginate(query, pagination)",
"blog = Blog(**args)\nblog.date = datetime.utcnow()\nuser_id = get_jwt_identity()\ntry:\n user = User.get()\nexcept User.DoesNotExist:\n ... | <|body_start_0|>
user_id = get_jwt_identity()
if user_id is None:
query = Blog.select().where(Blog.published)
else:
query = Blog.select()
return paginate(query, pagination)
<|end_body_0|>
<|body_start_1|>
blog = Blog(**args)
blog.date = datetime.u... | BlogListAPI | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BlogListAPI:
def get(self, pagination):
"""List blog posts"""
<|body_0|>
def post(self, pagination, args):
"""Create blog post"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
user_id = get_jwt_identity()
if user_id is None:
query... | stack_v2_sparse_classes_36k_train_008605 | 4,891 | permissive | [
{
"docstring": "List blog posts",
"name": "get",
"signature": "def get(self, pagination)"
},
{
"docstring": "Create blog post",
"name": "post",
"signature": "def post(self, pagination, args)"
}
] | 2 | stack_v2_sparse_classes_30k_train_012674 | Implement the Python class `BlogListAPI` described below.
Class description:
Implement the BlogListAPI class.
Method signatures and docstrings:
- def get(self, pagination): List blog posts
- def post(self, pagination, args): Create blog post | Implement the Python class `BlogListAPI` described below.
Class description:
Implement the BlogListAPI class.
Method signatures and docstrings:
- def get(self, pagination): List blog posts
- def post(self, pagination, args): Create blog post
<|skeleton|>
class BlogListAPI:
def get(self, pagination):
"""... | dffc3b1e16c24dd49e516e36aaa731a8dd299e66 | <|skeleton|>
class BlogListAPI:
def get(self, pagination):
"""List blog posts"""
<|body_0|>
def post(self, pagination, args):
"""Create blog post"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BlogListAPI:
def get(self, pagination):
"""List blog posts"""
user_id = get_jwt_identity()
if user_id is None:
query = Blog.select().where(Blog.published)
else:
query = Blog.select()
return paginate(query, pagination)
def post(self, paginati... | the_stack_v2_python_sparse | tilda/api/blog.py | tilda-center/backend | train | 0 | |
0970c58385b7ca40b7fab5b2e3149433a00a84f9 | [
"self.gallery = gallery\nself.handler = handler\nself.app = self.handler.app\nself.config = self.handler.app.config\nself.user = self.handler.user",
"amap = html_params(**kwargs)\nimages = []\nfor i in self.gallery.get_images():\n try:\n asset = self.app.module_map.uploader.get(i.image)\n v = ass... | <|body_start_0|>
self.gallery = gallery
self.handler = handler
self.app = self.handler.app
self.config = self.handler.app.config
self.user = self.handler.user
<|end_body_0|>
<|body_start_1|>
amap = html_params(**kwargs)
images = []
for i in self.gallery.g... | wrapper around an image gallery to provide additional features | GalleryView | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GalleryView:
"""wrapper around an image gallery to provide additional features"""
def __init__(self, gallery, handler):
"""initialize the wrapper with the gallery and the handler it is used with"""
<|body_0|>
def get_images(self, variant='userlist', **kwargs):
""... | stack_v2_sparse_classes_36k_train_008606 | 9,195 | permissive | [
{
"docstring": "initialize the wrapper with the gallery and the handler it is used with",
"name": "__init__",
"signature": "def __init__(self, gallery, handler)"
},
{
"docstring": "return image tags for all the images :param variant: variant of the image to retrieve :param kwargs: additional att... | 2 | null | Implement the Python class `GalleryView` described below.
Class description:
wrapper around an image gallery to provide additional features
Method signatures and docstrings:
- def __init__(self, gallery, handler): initialize the wrapper with the gallery and the handler it is used with
- def get_images(self, variant='... | Implement the Python class `GalleryView` described below.
Class description:
wrapper around an image gallery to provide additional features
Method signatures and docstrings:
- def __init__(self, gallery, handler): initialize the wrapper with the gallery and the handler it is used with
- def get_images(self, variant='... | 9b45664e46c451b2cbe00bb55583b043e769083d | <|skeleton|>
class GalleryView:
"""wrapper around an image gallery to provide additional features"""
def __init__(self, gallery, handler):
"""initialize the wrapper with the gallery and the handler it is used with"""
<|body_0|>
def get_images(self, variant='userlist', **kwargs):
""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GalleryView:
"""wrapper around an image gallery to provide additional features"""
def __init__(self, gallery, handler):
"""initialize the wrapper with the gallery and the handler it is used with"""
self.gallery = gallery
self.handler = handler
self.app = self.handler.app
... | the_stack_v2_python_sparse | camper/barcamps/base.py | comlounge/camper | train | 14 |
c0fbfeba98e3e6741e22c1238671edcd6569cf9f | [
"from collections import deque\nif not root:\n return 0\nelse:\n q = deque([(1, root)])\nwhile q:\n depth, root = q.popleft()\n children = [root.left, root.right]\n if not any(children):\n return depth\n for child in children:\n if child:\n q.append((depth + 1, child))",
... | <|body_start_0|>
from collections import deque
if not root:
return 0
else:
q = deque([(1, root)])
while q:
depth, root = q.popleft()
children = [root.left, root.right]
if not any(children):
return depth
... | Tree | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Tree:
def min_depth(self, root: 'TreeNode') -> int:
"""Approach: Iterative BFS Time Complexity: O(N) Space Complexity: O(N) :param root: :return:"""
<|body_0|>
def min_depth_(self, root: 'TreeNode') -> int:
"""Approach: Iterative DFS Time Complexity: O(N) Space Compl... | stack_v2_sparse_classes_36k_train_008607 | 1,996 | no_license | [
{
"docstring": "Approach: Iterative BFS Time Complexity: O(N) Space Complexity: O(N) :param root: :return:",
"name": "min_depth",
"signature": "def min_depth(self, root: 'TreeNode') -> int"
},
{
"docstring": "Approach: Iterative DFS Time Complexity: O(N) Space Complexity: O(N) :param root: :retu... | 3 | null | Implement the Python class `Tree` described below.
Class description:
Implement the Tree class.
Method signatures and docstrings:
- def min_depth(self, root: 'TreeNode') -> int: Approach: Iterative BFS Time Complexity: O(N) Space Complexity: O(N) :param root: :return:
- def min_depth_(self, root: 'TreeNode') -> int: ... | Implement the Python class `Tree` described below.
Class description:
Implement the Tree class.
Method signatures and docstrings:
- def min_depth(self, root: 'TreeNode') -> int: Approach: Iterative BFS Time Complexity: O(N) Space Complexity: O(N) :param root: :return:
- def min_depth_(self, root: 'TreeNode') -> int: ... | 65cc78b5afa0db064f9fe8f06597e3e120f7363d | <|skeleton|>
class Tree:
def min_depth(self, root: 'TreeNode') -> int:
"""Approach: Iterative BFS Time Complexity: O(N) Space Complexity: O(N) :param root: :return:"""
<|body_0|>
def min_depth_(self, root: 'TreeNode') -> int:
"""Approach: Iterative DFS Time Complexity: O(N) Space Compl... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Tree:
def min_depth(self, root: 'TreeNode') -> int:
"""Approach: Iterative BFS Time Complexity: O(N) Space Complexity: O(N) :param root: :return:"""
from collections import deque
if not root:
return 0
else:
q = deque([(1, root)])
while q:
... | the_stack_v2_python_sparse | revisited_2021/tree/min_depth_bst.py | Shiv2157k/leet_code | train | 1 | |
b3b5a46342b86652deb5a903b9cf477dcc9c5fd6 | [
"self.enable_fips_mode = enable_fips_mode\nself.enable_hardware_encryption = enable_hardware_encryption\nself.enable_software_encryption = enable_software_encryption\nself.rotation_period = rotation_period",
"if dictionary is None:\n return None\nenable_fips_mode = dictionary.get('enableFipsMode')\nenable_hard... | <|body_start_0|>
self.enable_fips_mode = enable_fips_mode
self.enable_hardware_encryption = enable_hardware_encryption
self.enable_software_encryption = enable_software_encryption
self.rotation_period = rotation_period
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
... | Implementation of the 'EncryptionConfiguration' model. Specifies the parameters the user wants to use when configuring encryption for the new Cluster. Attributes: enable_fips_mode (bool): Specifies whether or not to enable FIPS mode. EnableSoftwareEncryption must be set to true in order to enable FIPS. enable_hardware_... | EncryptionConfiguration | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EncryptionConfiguration:
"""Implementation of the 'EncryptionConfiguration' model. Specifies the parameters the user wants to use when configuring encryption for the new Cluster. Attributes: enable_fips_mode (bool): Specifies whether or not to enable FIPS mode. EnableSoftwareEncryption must be se... | stack_v2_sparse_classes_36k_train_008608 | 3,088 | permissive | [
{
"docstring": "Constructor for the EncryptionConfiguration class",
"name": "__init__",
"signature": "def __init__(self, enable_fips_mode=None, enable_hardware_encryption=None, enable_software_encryption=None, rotation_period=None)"
},
{
"docstring": "Creates an instance of this model from a dic... | 2 | stack_v2_sparse_classes_30k_train_015050 | Implement the Python class `EncryptionConfiguration` described below.
Class description:
Implementation of the 'EncryptionConfiguration' model. Specifies the parameters the user wants to use when configuring encryption for the new Cluster. Attributes: enable_fips_mode (bool): Specifies whether or not to enable FIPS mo... | Implement the Python class `EncryptionConfiguration` described below.
Class description:
Implementation of the 'EncryptionConfiguration' model. Specifies the parameters the user wants to use when configuring encryption for the new Cluster. Attributes: enable_fips_mode (bool): Specifies whether or not to enable FIPS mo... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class EncryptionConfiguration:
"""Implementation of the 'EncryptionConfiguration' model. Specifies the parameters the user wants to use when configuring encryption for the new Cluster. Attributes: enable_fips_mode (bool): Specifies whether or not to enable FIPS mode. EnableSoftwareEncryption must be se... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class EncryptionConfiguration:
"""Implementation of the 'EncryptionConfiguration' model. Specifies the parameters the user wants to use when configuring encryption for the new Cluster. Attributes: enable_fips_mode (bool): Specifies whether or not to enable FIPS mode. EnableSoftwareEncryption must be set to true in ... | the_stack_v2_python_sparse | cohesity_management_sdk/models/encryption_configuration.py | cohesity/management-sdk-python | train | 24 |
172bd30a6699caeb17f87f7487415401836e8d2b | [
"template_dirs = [('build', 'templates'), ('common', 'templates'), ('company', 'templates'), ('label', 'templates'), ('order', 'templates'), ('part', 'templates'), ('report', 'templates'), ('stock', 'templates'), ('templates',)]\ntemplate_files = []\nhere = os.path.abspath(os.path.dirname(__file__))\ntld = os.path.... | <|body_start_0|>
template_dirs = [('build', 'templates'), ('common', 'templates'), ('company', 'templates'), ('label', 'templates'), ('order', 'templates'), ('part', 'templates'), ('report', 'templates'), ('stock', 'templates'), ('templates',)]
template_files = []
here = os.path.abspath(os.path.... | Test all files for broken url tags. | URLTest | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class URLTest:
"""Test all files for broken url tags."""
def find_files(self, suffix):
"""Search for all files in the template directories, which can have URLs rendered."""
<|body_0|>
def find_urls(self, input_file):
"""Search for all instances of {% url %} in supplied... | stack_v2_sparse_classes_36k_train_008609 | 3,483 | permissive | [
{
"docstring": "Search for all files in the template directories, which can have URLs rendered.",
"name": "find_files",
"signature": "def find_files(self, suffix)"
},
{
"docstring": "Search for all instances of {% url %} in supplied template file.",
"name": "find_urls",
"signature": "def... | 6 | stack_v2_sparse_classes_30k_train_018446 | Implement the Python class `URLTest` described below.
Class description:
Test all files for broken url tags.
Method signatures and docstrings:
- def find_files(self, suffix): Search for all files in the template directories, which can have URLs rendered.
- def find_urls(self, input_file): Search for all instances of ... | Implement the Python class `URLTest` described below.
Class description:
Test all files for broken url tags.
Method signatures and docstrings:
- def find_files(self, suffix): Search for all files in the template directories, which can have URLs rendered.
- def find_urls(self, input_file): Search for all instances of ... | e88a8e99a5f0b201c67a95cba097c729f090d5e2 | <|skeleton|>
class URLTest:
"""Test all files for broken url tags."""
def find_files(self, suffix):
"""Search for all files in the template directories, which can have URLs rendered."""
<|body_0|>
def find_urls(self, input_file):
"""Search for all instances of {% url %} in supplied... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class URLTest:
"""Test all files for broken url tags."""
def find_files(self, suffix):
"""Search for all files in the template directories, which can have URLs rendered."""
template_dirs = [('build', 'templates'), ('common', 'templates'), ('company', 'templates'), ('label', 'templates'), ('orde... | the_stack_v2_python_sparse | InvenTree/InvenTree/test_urls.py | inventree/InvenTree | train | 3,077 |
2af110be3a2908a5ef3ba5560175723561726fdc | [
"try:\n self.detach(logger)\nexcept ValueError:\n pass\nlogger.addHandler(self)",
"existing_handlers = [h for h in logger.handlers if self == h]\nif not existing_handlers:\n raise ValueError('Handler not found on logger: %s: %s' % (logger, self))\nfor h in existing_handlers:\n pylogger.debug('Removing... | <|body_start_0|>
try:
self.detach(logger)
except ValueError:
pass
logger.addHandler(self)
<|end_body_0|>
<|body_start_1|>
existing_handlers = [h for h in logger.handlers if self == h]
if not existing_handlers:
raise ValueError('Handler not fou... | Mixin for custom logging handlers. | LoggerPluginMixin | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LoggerPluginMixin:
"""Mixin for custom logging handlers."""
def attach(self, logger):
"""Attach this logging handler to logger after first removing any similar logging handlers. @type logger: logging.Logger instance @param logger: Logger to which this handler will be attached."""
... | stack_v2_sparse_classes_36k_train_008610 | 5,064 | no_license | [
{
"docstring": "Attach this logging handler to logger after first removing any similar logging handlers. @type logger: logging.Logger instance @param logger: Logger to which this handler will be attached.",
"name": "attach",
"signature": "def attach(self, logger)"
},
{
"docstring": "Detach this ... | 2 | stack_v2_sparse_classes_30k_train_021058 | Implement the Python class `LoggerPluginMixin` described below.
Class description:
Mixin for custom logging handlers.
Method signatures and docstrings:
- def attach(self, logger): Attach this logging handler to logger after first removing any similar logging handlers. @type logger: logging.Logger instance @param logg... | Implement the Python class `LoggerPluginMixin` described below.
Class description:
Mixin for custom logging handlers.
Method signatures and docstrings:
- def attach(self, logger): Attach this logging handler to logger after first removing any similar logging handlers. @type logger: logging.Logger instance @param logg... | 5b55817c050b637e2747084290f6206d2e622938 | <|skeleton|>
class LoggerPluginMixin:
"""Mixin for custom logging handlers."""
def attach(self, logger):
"""Attach this logging handler to logger after first removing any similar logging handlers. @type logger: logging.Logger instance @param logger: Logger to which this handler will be attached."""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LoggerPluginMixin:
"""Mixin for custom logging handlers."""
def attach(self, logger):
"""Attach this logging handler to logger after first removing any similar logging handlers. @type logger: logging.Logger instance @param logger: Logger to which this handler will be attached."""
try:
... | the_stack_v2_python_sparse | SystemTesting/pylib/vmware/common/logging_handlers.py | Cloudxtreme/MyProject | train | 0 |
0218e30ef9a9a7af73fefec1767155ca722cd03b | [
"self.qa_yaml_name = os.environ['qa_yaml_name']\nself.rd_yaml_path = os.environ['rd_yaml_path']\nlogger.info('###self.qa_yaml_name: {}'.format(self.qa_yaml_name))\nself.reponame = os.environ['reponame']\nself.system = os.environ['system']\nself.step = os.environ['step']\nlogger.info('###self.step: {}'.format(self.s... | <|body_start_0|>
self.qa_yaml_name = os.environ['qa_yaml_name']
self.rd_yaml_path = os.environ['rd_yaml_path']
logger.info('###self.qa_yaml_name: {}'.format(self.qa_yaml_name))
self.reponame = os.environ['reponame']
self.system = os.environ['system']
self.step = os.enviro... | 自定义环境准备 | PaddleScience_Start | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PaddleScience_Start:
"""自定义环境准备"""
def __init__(self):
"""init"""
<|body_0|>
def prepare_gpu_env(self):
"""根据操作系统获取用gpu还是cpu"""
<|body_1|>
def add_paddlescience_to_pythonpath(self):
"""paddlescience 打包路径添加到python的路径中"""
<|body_2|>
... | stack_v2_sparse_classes_36k_train_008611 | 3,716 | no_license | [
{
"docstring": "init",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "根据操作系统获取用gpu还是cpu",
"name": "prepare_gpu_env",
"signature": "def prepare_gpu_env(self)"
},
{
"docstring": "paddlescience 打包路径添加到python的路径中",
"name": "add_paddlescience_to_pythonpat... | 6 | stack_v2_sparse_classes_30k_train_007641 | Implement the Python class `PaddleScience_Start` described below.
Class description:
自定义环境准备
Method signatures and docstrings:
- def __init__(self): init
- def prepare_gpu_env(self): 根据操作系统获取用gpu还是cpu
- def add_paddlescience_to_pythonpath(self): paddlescience 打包路径添加到python的路径中
- def download_datasets(self): download ... | Implement the Python class `PaddleScience_Start` described below.
Class description:
自定义环境准备
Method signatures and docstrings:
- def __init__(self): init
- def prepare_gpu_env(self): 根据操作系统获取用gpu还是cpu
- def add_paddlescience_to_pythonpath(self): paddlescience 打包路径添加到python的路径中
- def download_datasets(self): download ... | bd3790ce72a2a26611b5eda3901651b5a809348f | <|skeleton|>
class PaddleScience_Start:
"""自定义环境准备"""
def __init__(self):
"""init"""
<|body_0|>
def prepare_gpu_env(self):
"""根据操作系统获取用gpu还是cpu"""
<|body_1|>
def add_paddlescience_to_pythonpath(self):
"""paddlescience 打包路径添加到python的路径中"""
<|body_2|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PaddleScience_Start:
"""自定义环境准备"""
def __init__(self):
"""init"""
self.qa_yaml_name = os.environ['qa_yaml_name']
self.rd_yaml_path = os.environ['rd_yaml_path']
logger.info('###self.qa_yaml_name: {}'.format(self.qa_yaml_name))
self.reponame = os.environ['reponame']
... | the_stack_v2_python_sparse | models_restruct/PaddleScience/tools/start.py | PaddlePaddle/PaddleTest | train | 42 |
d4f263b1d09ee744103edfb470d1b5afd6ca504d | [
"super(LSTMCharEncoder, self).__init__()\nself.hidden_size = char_emb_size if hidden_size is None else hidden_size\nself.lstm = nn.LSTM(input_size=char_emb_size, hidden_size=self.hidden_size, num_layers=1, bias=True, batch_first=True)\ninitial_parameter(self, initial_method)",
"batch_size = x.shape[0]\nh0 = torch... | <|body_start_0|>
super(LSTMCharEncoder, self).__init__()
self.hidden_size = char_emb_size if hidden_size is None else hidden_size
self.lstm = nn.LSTM(input_size=char_emb_size, hidden_size=self.hidden_size, num_layers=1, bias=True, batch_first=True)
initial_parameter(self, initial_method)... | char级别基于LSTM的encoder. | LSTMCharEncoder | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LSTMCharEncoder:
"""char级别基于LSTM的encoder."""
def __init__(self, char_emb_size=50, hidden_size=None, initial_method=None):
""":param int char_emb_size: char级别embedding的维度. Default: 50 例: 有26个字符, 每一个的embedding是一个50维的向量, 所以输入的向量维度为50. :param int hidden_size: LSTM隐层的大小, 默认为char的embedding... | stack_v2_sparse_classes_36k_train_008612 | 3,980 | permissive | [
{
"docstring": ":param int char_emb_size: char级别embedding的维度. Default: 50 例: 有26个字符, 每一个的embedding是一个50维的向量, 所以输入的向量维度为50. :param int hidden_size: LSTM隐层的大小, 默认为char的embedding维度 :param initial_method: 初始化参数的方式, 默认为`xavier normal`",
"name": "__init__",
"signature": "def __init__(self, char_emb_size=50, h... | 2 | stack_v2_sparse_classes_30k_train_000813 | Implement the Python class `LSTMCharEncoder` described below.
Class description:
char级别基于LSTM的encoder.
Method signatures and docstrings:
- def __init__(self, char_emb_size=50, hidden_size=None, initial_method=None): :param int char_emb_size: char级别embedding的维度. Default: 50 例: 有26个字符, 每一个的embedding是一个50维的向量, 所以输入的向量维度... | Implement the Python class `LSTMCharEncoder` described below.
Class description:
char级别基于LSTM的encoder.
Method signatures and docstrings:
- def __init__(self, char_emb_size=50, hidden_size=None, initial_method=None): :param int char_emb_size: char级别embedding的维度. Default: 50 例: 有26个字符, 每一个的embedding是一个50维的向量, 所以输入的向量维度... | dffc7a06cdbff2671a3ca73d2398159d91a4a7db | <|skeleton|>
class LSTMCharEncoder:
"""char级别基于LSTM的encoder."""
def __init__(self, char_emb_size=50, hidden_size=None, initial_method=None):
""":param int char_emb_size: char级别embedding的维度. Default: 50 例: 有26个字符, 每一个的embedding是一个50维的向量, 所以输入的向量维度为50. :param int hidden_size: LSTM隐层的大小, 默认为char的embedding... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LSTMCharEncoder:
"""char级别基于LSTM的encoder."""
def __init__(self, char_emb_size=50, hidden_size=None, initial_method=None):
""":param int char_emb_size: char级别embedding的维度. Default: 50 例: 有26个字符, 每一个的embedding是一个50维的向量, 所以输入的向量维度为50. :param int hidden_size: LSTM隐层的大小, 默认为char的embedding维度 :param ini... | the_stack_v2_python_sparse | phenobert/utils/fastNLP/modules/encoder/char_encoder.py | TianlabTech/PhenoBERT | train | 2 |
8cc3d2a0a40aab6a66ce02735a4793bc068c1808 | [
"if not callable(func):\n raise TypeError('func must be callable')\nwith suppress(TypeError):\n sig = inspect.signature(func)\n kinds = [x.kind for x in sig.parameters.values()]\n if len((x for x in kinds if x == sig.POSITIONAL_ONLY)) != 2 and sig.VAR_POSITIONAL not in kinds:\n raise ValueError('... | <|body_start_0|>
if not callable(func):
raise TypeError('func must be callable')
with suppress(TypeError):
sig = inspect.signature(func)
kinds = [x.kind for x in sig.parameters.values()]
if len((x for x in kinds if x == sig.POSITIONAL_ONLY)) != 2 and sig.V... | A transformation defined by a function. A transformation defined by a function that accepts a type and returns the transformed object. Parameters ---------- func : callable The transformation function. Should have a call signature ``func(fromdata, *args, **kwargs)``. fromtype : class The coordinate frame class to start... | DataTransform | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DataTransform:
"""A transformation defined by a function. A transformation defined by a function that accepts a type and returns the transformed object. Parameters ---------- func : callable The transformation function. Should have a call signature ``func(fromdata, *args, **kwargs)``. fromtype : ... | stack_v2_sparse_classes_36k_train_008613 | 12,601 | permissive | [
{
"docstring": "Create a data transformer.",
"name": "__init__",
"signature": "def __init__(self, func: T.Callable, fromtype, totype, priority: int=1, register_graph=None, func_args: T.Optional[T.Sequence]=None, func_kwargs: T.Optional[T.Mapping]=None)"
},
{
"docstring": "Run transformation. Par... | 2 | stack_v2_sparse_classes_30k_train_019981 | Implement the Python class `DataTransform` described below.
Class description:
A transformation defined by a function. A transformation defined by a function that accepts a type and returns the transformed object. Parameters ---------- func : callable The transformation function. Should have a call signature ``func(fr... | Implement the Python class `DataTransform` described below.
Class description:
A transformation defined by a function. A transformation defined by a function that accepts a type and returns the transformed object. Parameters ---------- func : callable The transformation function. Should have a call signature ``func(fr... | 17984942145d31126724df23500bafba18fb7516 | <|skeleton|>
class DataTransform:
"""A transformation defined by a function. A transformation defined by a function that accepts a type and returns the transformed object. Parameters ---------- func : callable The transformation function. Should have a call signature ``func(fromdata, *args, **kwargs)``. fromtype : ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DataTransform:
"""A transformation defined by a function. A transformation defined by a function that accepts a type and returns the transformed object. Parameters ---------- func : callable The transformation function. Should have a call signature ``func(fromdata, *args, **kwargs)``. fromtype : class The coo... | the_stack_v2_python_sparse | utilipy/data_utils/xfm/transformations.py | nstarman/utilipy | train | 2 |
71315a3c867bc0c386139cb2e2ada264b26bdaa8 | [
"self.id = id\nself.provider_id = provider_id\nself.server_time = server_time\nself.username = username\nself.driver_license_number = driver_license_number\nself.country = country\nself.region = region\nself.driver_home_terminal = driver_home_terminal",
"if dictionary is None:\n return None\nid = dictionary.ge... | <|body_start_0|>
self.id = id
self.provider_id = provider_id
self.server_time = server_time
self.username = username
self.driver_license_number = driver_license_number
self.country = country
self.region = region
self.driver_home_terminal = driver_home_term... | Implementation of the 'Driver' model. TODO: type model description here. Attributes: id (string): The id of this Driver object provider_id (string): The unique 'Provider ID' of the TSP server_time (string): Date and time when this object was received at the TSP username (string): a username of this driver driver_licens... | Driver | [
"MIT",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Driver:
"""Implementation of the 'Driver' model. TODO: type model description here. Attributes: id (string): The id of this Driver object provider_id (string): The unique 'Provider ID' of the TSP server_time (string): Date and time when this object was received at the TSP username (string): a use... | stack_v2_sparse_classes_36k_train_008614 | 3,303 | permissive | [
{
"docstring": "Constructor for the Driver class",
"name": "__init__",
"signature": "def __init__(self, id=None, provider_id=None, server_time=None, username=None, driver_license_number=None, country=None, region=None, driver_home_terminal=None)"
},
{
"docstring": "Creates an instance of this mo... | 2 | stack_v2_sparse_classes_30k_train_004744 | Implement the Python class `Driver` described below.
Class description:
Implementation of the 'Driver' model. TODO: type model description here. Attributes: id (string): The id of this Driver object provider_id (string): The unique 'Provider ID' of the TSP server_time (string): Date and time when this object was recei... | Implement the Python class `Driver` described below.
Class description:
Implementation of the 'Driver' model. TODO: type model description here. Attributes: id (string): The id of this Driver object provider_id (string): The unique 'Provider ID' of the TSP server_time (string): Date and time when this object was recei... | 729e9391879e273545a4818558677b2e47261f08 | <|skeleton|>
class Driver:
"""Implementation of the 'Driver' model. TODO: type model description here. Attributes: id (string): The id of this Driver object provider_id (string): The unique 'Provider ID' of the TSP server_time (string): Date and time when this object was received at the TSP username (string): a use... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Driver:
"""Implementation of the 'Driver' model. TODO: type model description here. Attributes: id (string): The id of this Driver object provider_id (string): The unique 'Provider ID' of the TSP server_time (string): Date and time when this object was received at the TSP username (string): a username of this... | the_stack_v2_python_sparse | sdk/python/v0.1-rc.4/opentelematicsapi/models/driver.py | nmfta-repo/nmfta-opentelematics-prototype | train | 2 |
231824f489c72a9cfa09d2fdf6992ab233ecf1c8 | [
"tmp = visual.TextStim(win=window, font=task_font, text=static_task_text)\nstatic_task_pos = (tmp.boundingBox[0] / window.size[0] - 1, 1 - task_height)\ninfo_color = [static_task_color, info_color]\ninfo_font = [task_font, info_font]\ninfo_text = [static_task_text, info_text]\ninfo_pos = [static_task_pos, info_pos]... | <|body_start_0|>
tmp = visual.TextStim(win=window, font=task_font, text=static_task_text)
static_task_pos = (tmp.boundingBox[0] / window.size[0] - 1, 1 - task_height)
info_color = [static_task_color, info_color]
info_font = [task_font, info_font]
info_text = [static_task_text, in... | Copy Phrase display object of RSVP Attr: static_task(visual_Text_Stimuli): aim string of the copy phrase. (Stored in self.text[0]) information(visual_Text_Stimuli): information text. (Stored in self.text[1]) task(Multiinfo_color_Stimuli): task visualization. sti(visual_Text_Stimuli): stimuli text. | CopyPhraseDisplay | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CopyPhraseDisplay:
"""Copy Phrase display object of RSVP Attr: static_task(visual_Text_Stimuli): aim string of the copy phrase. (Stored in self.text[0]) information(visual_Text_Stimuli): information text. (Stored in self.text[1]) task(Multiinfo_color_Stimuli): task visualization. sti(visual_Text_... | stack_v2_sparse_classes_36k_train_008615 | 4,166 | permissive | [
{
"docstring": "Initializes Copy Phrase Task Objects",
"name": "__init__",
"signature": "def __init__(self, window, clock, experiment_clock, marker_writer, static_task_text='COPY_PHRASE', static_task_color='White', info_text='Press Space Bar to Pause', info_color='White', info_pos=(0, -0.9), info_height... | 2 | stack_v2_sparse_classes_30k_test_000331 | Implement the Python class `CopyPhraseDisplay` described below.
Class description:
Copy Phrase display object of RSVP Attr: static_task(visual_Text_Stimuli): aim string of the copy phrase. (Stored in self.text[0]) information(visual_Text_Stimuli): information text. (Stored in self.text[1]) task(Multiinfo_color_Stimuli... | Implement the Python class `CopyPhraseDisplay` described below.
Class description:
Copy Phrase display object of RSVP Attr: static_task(visual_Text_Stimuli): aim string of the copy phrase. (Stored in self.text[0]) information(visual_Text_Stimuli): information text. (Stored in self.text[1]) task(Multiinfo_color_Stimuli... | 397ce67c15a9e84d8a6c13f621fad3cf6b62df2e | <|skeleton|>
class CopyPhraseDisplay:
"""Copy Phrase display object of RSVP Attr: static_task(visual_Text_Stimuli): aim string of the copy phrase. (Stored in self.text[0]) information(visual_Text_Stimuli): information text. (Stored in self.text[1]) task(Multiinfo_color_Stimuli): task visualization. sti(visual_Text_... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CopyPhraseDisplay:
"""Copy Phrase display object of RSVP Attr: static_task(visual_Text_Stimuli): aim string of the copy phrase. (Stored in self.text[0]) information(visual_Text_Stimuli): information text. (Stored in self.text[1]) task(Multiinfo_color_Stimuli): task visualization. sti(visual_Text_Stimuli): sti... | the_stack_v2_python_sparse | bcipy/display/rsvp/mode/copy_phrase.py | nik-sm/BciPy | train | 0 |
d1482c74c06e77b035610ef527f8910ecea39c25 | [
"super(HttpContractClauseBuilder, self).__init__(title=title, retryable_for_secs=retryable_for_secs)\nself.__agent = agent\nself.__strict = strict",
"self.observer = HttpObjectObserver(self.__agent, path)\nobservation_builder = jc.ValueObservationVerifierBuilder('Get ' + path, strict=self.__strict)\nself.verifier... | <|body_start_0|>
super(HttpContractClauseBuilder, self).__init__(title=title, retryable_for_secs=retryable_for_secs)
self.__agent = agent
self.__strict = strict
<|end_body_0|>
<|body_start_1|>
self.observer = HttpObjectObserver(self.__agent, path)
observation_builder = jc.ValueO... | Build clauses based on HTTP endpoint queries. | HttpContractClauseBuilder | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HttpContractClauseBuilder:
"""Build clauses based on HTTP endpoint queries."""
def __init__(self, title, agent, retryable_for_secs=0, strict=False):
"""Construct builder. Args: title [string]: The title of the clause for reporting. agent [HttpAgent]: The HTTP agent the clause is obse... | stack_v2_sparse_classes_36k_train_008616 | 7,070 | permissive | [
{
"docstring": "Construct builder. Args: title [string]: The title of the clause for reporting. agent [HttpAgent]: The HTTP agent the clause is observing with. retryable_for_secs [int]: Seconds to retry the observation if needed. strict [bool]: Whether verification is strict or not.",
"name": "__init__",
... | 2 | stack_v2_sparse_classes_30k_train_009915 | Implement the Python class `HttpContractClauseBuilder` described below.
Class description:
Build clauses based on HTTP endpoint queries.
Method signatures and docstrings:
- def __init__(self, title, agent, retryable_for_secs=0, strict=False): Construct builder. Args: title [string]: The title of the clause for report... | Implement the Python class `HttpContractClauseBuilder` described below.
Class description:
Build clauses based on HTTP endpoint queries.
Method signatures and docstrings:
- def __init__(self, title, agent, retryable_for_secs=0, strict=False): Construct builder. Args: title [string]: The title of the clause for report... | af959f88885f003fc2e6724e2e0bea6657274db5 | <|skeleton|>
class HttpContractClauseBuilder:
"""Build clauses based on HTTP endpoint queries."""
def __init__(self, title, agent, retryable_for_secs=0, strict=False):
"""Construct builder. Args: title [string]: The title of the clause for reporting. agent [HttpAgent]: The HTTP agent the clause is obse... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class HttpContractClauseBuilder:
"""Build clauses based on HTTP endpoint queries."""
def __init__(self, title, agent, retryable_for_secs=0, strict=False):
"""Construct builder. Args: title [string]: The title of the clause for reporting. agent [HttpAgent]: The HTTP agent the clause is observing with. r... | the_stack_v2_python_sparse | citest/service_testing/http_observer.py | lwander/citest | train | 0 |
b587cb668f5e1e3ba09761e1bea04d15bcbd72a9 | [
"super().__init__(entry, account, zone, entity_description)\nself._attr_state: StateType = None\nself._old_state: StateType = None",
"if last_state is not None:\n self._attr_state = last_state.state\nif self.state == STATE_UNAVAILABLE:\n self._attr_available = False",
"new_state = None\nif sia_event.code:... | <|body_start_0|>
super().__init__(entry, account, zone, entity_description)
self._attr_state: StateType = None
self._old_state: StateType = None
<|end_body_0|>
<|body_start_1|>
if last_state is not None:
self._attr_state = last_state.state
if self.state == STATE_UNAV... | Class for SIA Alarm Control Panels. | SIAAlarmControlPanel | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SIAAlarmControlPanel:
"""Class for SIA Alarm Control Panels."""
def __init__(self, entry: ConfigEntry, account: str, zone: int, entity_description: SIAAlarmControlPanelEntityDescription) -> None:
"""Create SIAAlarmControlPanel object."""
<|body_0|>
def handle_last_state(... | stack_v2_sparse_classes_36k_train_008617 | 4,240 | permissive | [
{
"docstring": "Create SIAAlarmControlPanel object.",
"name": "__init__",
"signature": "def __init__(self, entry: ConfigEntry, account: str, zone: int, entity_description: SIAAlarmControlPanelEntityDescription) -> None"
},
{
"docstring": "Handle the last state.",
"name": "handle_last_state",... | 3 | stack_v2_sparse_classes_30k_train_010084 | Implement the Python class `SIAAlarmControlPanel` described below.
Class description:
Class for SIA Alarm Control Panels.
Method signatures and docstrings:
- def __init__(self, entry: ConfigEntry, account: str, zone: int, entity_description: SIAAlarmControlPanelEntityDescription) -> None: Create SIAAlarmControlPanel ... | Implement the Python class `SIAAlarmControlPanel` described below.
Class description:
Class for SIA Alarm Control Panels.
Method signatures and docstrings:
- def __init__(self, entry: ConfigEntry, account: str, zone: int, entity_description: SIAAlarmControlPanelEntityDescription) -> None: Create SIAAlarmControlPanel ... | 80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743 | <|skeleton|>
class SIAAlarmControlPanel:
"""Class for SIA Alarm Control Panels."""
def __init__(self, entry: ConfigEntry, account: str, zone: int, entity_description: SIAAlarmControlPanelEntityDescription) -> None:
"""Create SIAAlarmControlPanel object."""
<|body_0|>
def handle_last_state(... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SIAAlarmControlPanel:
"""Class for SIA Alarm Control Panels."""
def __init__(self, entry: ConfigEntry, account: str, zone: int, entity_description: SIAAlarmControlPanelEntityDescription) -> None:
"""Create SIAAlarmControlPanel object."""
super().__init__(entry, account, zone, entity_descr... | the_stack_v2_python_sparse | homeassistant/components/sia/alarm_control_panel.py | home-assistant/core | train | 35,501 |
9728a6503f89f24639b4398c25d0c3734ae438ee | [
"if not s:\n return\nn = len(s)\nif n == 1:\n return s\nret = s[0]\nfor i in xrange(0, n):\n cur = self.get_palindrome_from_center(s, i, i)\n if len(cur) > len(ret):\n ret = cur\n cur = self.get_palindrome_from_center(s, i, i + 1)\n if len(cur) > len(ret):\n ret = cur\nreturn ret",
... | <|body_start_0|>
if not s:
return
n = len(s)
if n == 1:
return s
ret = s[0]
for i in xrange(0, n):
cur = self.get_palindrome_from_center(s, i, i)
if len(cur) > len(ret):
ret = cur
cur = self.get_palindrom... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def longestPalindrome(self, s):
"""O(n^2) :param s: string :return: string"""
<|body_0|>
def longestPalindrome_TLE(self, s):
"""Algorithm: dp, O(n^2) p[i,j] represents weather s[i:j] is palindrome. (incl. i-th while excl. j-th) For example S = "abccb" 01234... | stack_v2_sparse_classes_36k_train_008618 | 3,362 | permissive | [
{
"docstring": "O(n^2) :param s: string :return: string",
"name": "longestPalindrome",
"signature": "def longestPalindrome(self, s)"
},
{
"docstring": "Algorithm: dp, O(n^2) p[i,j] represents weather s[i:j] is palindrome. (incl. i-th while excl. j-th) For example S = \"abccb\" 01234 p[0,1] = Tru... | 4 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def longestPalindrome(self, s): O(n^2) :param s: string :return: string
- def longestPalindrome_TLE(self, s): Algorithm: dp, O(n^2) p[i,j] represents weather s[i:j] is palindrome... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def longestPalindrome(self, s): O(n^2) :param s: string :return: string
- def longestPalindrome_TLE(self, s): Algorithm: dp, O(n^2) p[i,j] represents weather s[i:j] is palindrome... | cbbd4a67ab342ada2421e13f82d660b1d47d4d20 | <|skeleton|>
class Solution:
def longestPalindrome(self, s):
"""O(n^2) :param s: string :return: string"""
<|body_0|>
def longestPalindrome_TLE(self, s):
"""Algorithm: dp, O(n^2) p[i,j] represents weather s[i:j] is palindrome. (incl. i-th while excl. j-th) For example S = "abccb" 01234... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def longestPalindrome(self, s):
"""O(n^2) :param s: string :return: string"""
if not s:
return
n = len(s)
if n == 1:
return s
ret = s[0]
for i in xrange(0, n):
cur = self.get_palindrome_from_center(s, i, i)
... | the_stack_v2_python_sparse | 005 Longest Palindromic Substring.py | Aminaba123/LeetCode | train | 1 | |
34d15558c42e28ffdcd0a3b5667b691c81dc2861 | [
"self.application_environment = application_environment\nself.application_restore_objects = application_restore_objects\nself.hosting_protection_source = hosting_protection_source\nself.protection_source_and_application_objects = protection_source_and_application_objects",
"if dictionary is None:\n return None... | <|body_start_0|>
self.application_environment = application_environment
self.application_restore_objects = application_restore_objects
self.hosting_protection_source = hosting_protection_source
self.protection_source_and_application_objects = protection_source_and_application_objects
<|e... | Implementation of the 'ApplicationRestoreParameters' model. Specifies the information regarding the application restore parameters. Attributes: application_environment (ApplicationEnvironmentEnum): Specifies the Environment of the Application server to restore like 'kSQL','kAD',or 'kExchange'. Supported environment typ... | ApplicationRestoreParameters | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ApplicationRestoreParameters:
"""Implementation of the 'ApplicationRestoreParameters' model. Specifies the information regarding the application restore parameters. Attributes: application_environment (ApplicationEnvironmentEnum): Specifies the Environment of the Application server to restore lik... | stack_v2_sparse_classes_36k_train_008619 | 8,238 | permissive | [
{
"docstring": "Constructor for the ApplicationRestoreParameters class",
"name": "__init__",
"signature": "def __init__(self, application_environment=None, application_restore_objects=None, hosting_protection_source=None, protection_source_and_application_objects=None)"
},
{
"docstring": "Create... | 2 | null | Implement the Python class `ApplicationRestoreParameters` described below.
Class description:
Implementation of the 'ApplicationRestoreParameters' model. Specifies the information regarding the application restore parameters. Attributes: application_environment (ApplicationEnvironmentEnum): Specifies the Environment o... | Implement the Python class `ApplicationRestoreParameters` described below.
Class description:
Implementation of the 'ApplicationRestoreParameters' model. Specifies the information regarding the application restore parameters. Attributes: application_environment (ApplicationEnvironmentEnum): Specifies the Environment o... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class ApplicationRestoreParameters:
"""Implementation of the 'ApplicationRestoreParameters' model. Specifies the information regarding the application restore parameters. Attributes: application_environment (ApplicationEnvironmentEnum): Specifies the Environment of the Application server to restore lik... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ApplicationRestoreParameters:
"""Implementation of the 'ApplicationRestoreParameters' model. Specifies the information regarding the application restore parameters. Attributes: application_environment (ApplicationEnvironmentEnum): Specifies the Environment of the Application server to restore like 'kSQL','kAD... | the_stack_v2_python_sparse | cohesity_management_sdk/models/application_restore_parameters.py | cohesity/management-sdk-python | train | 24 |
d550940d2d4bc669dfd7d292845277599e4995b9 | [
"self.chunkArray = []\nfor i in range(self.chunksHigh):\n for j in range(self.chunksWide):\n self.chunkArray.append(chunk.Chunk([(i, j)]))\nrandom.shuffle(self.chunkArray)",
"for c in self.chunkArray:\n if not c.filled:\n height = image.shape[0] / self.chunksHigh\n width = image.shape[1... | <|body_start_0|>
self.chunkArray = []
for i in range(self.chunksHigh):
for j in range(self.chunksWide):
self.chunkArray.append(chunk.Chunk([(i, j)]))
random.shuffle(self.chunkArray)
<|end_body_0|>
<|body_start_1|>
for c in self.chunkArray:
if not ... | Grid mode fills the image with random chunks in a random order | Mode_Grid | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Mode_Grid:
"""Grid mode fills the image with random chunks in a random order"""
def _createChunkArray(self):
"""Uses the current state of the class to create a fresh chunk array filled with randomly ordered random chunks"""
<|body_0|>
def fillNextChunk(self, image):
... | stack_v2_sparse_classes_36k_train_008620 | 1,579 | no_license | [
{
"docstring": "Uses the current state of the class to create a fresh chunk array filled with randomly ordered random chunks",
"name": "_createChunkArray",
"signature": "def _createChunkArray(self)"
},
{
"docstring": "Take the current chunk array and fill a chunk if it needs to be done Arguments... | 2 | stack_v2_sparse_classes_30k_val_000789 | Implement the Python class `Mode_Grid` described below.
Class description:
Grid mode fills the image with random chunks in a random order
Method signatures and docstrings:
- def _createChunkArray(self): Uses the current state of the class to create a fresh chunk array filled with randomly ordered random chunks
- def ... | Implement the Python class `Mode_Grid` described below.
Class description:
Grid mode fills the image with random chunks in a random order
Method signatures and docstrings:
- def _createChunkArray(self): Uses the current state of the class to create a fresh chunk array filled with randomly ordered random chunks
- def ... | b87c1d826485695565f7f4ff22fb3b78db4f43d0 | <|skeleton|>
class Mode_Grid:
"""Grid mode fills the image with random chunks in a random order"""
def _createChunkArray(self):
"""Uses the current state of the class to create a fresh chunk array filled with randomly ordered random chunks"""
<|body_0|>
def fillNextChunk(self, image):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Mode_Grid:
"""Grid mode fills the image with random chunks in a random order"""
def _createChunkArray(self):
"""Uses the current state of the class to create a fresh chunk array filled with randomly ordered random chunks"""
self.chunkArray = []
for i in range(self.chunksHigh):
... | the_stack_v2_python_sparse | Python/mode_grid.py | SNAP-SAPIENT/plotting-time-and-space | train | 0 |
33dd6597dc36645bf9b6f23b878c80d4f009ee67 | [
"super().__init__()\nself.backbone_model = ElectraModel.from_cfg(backbone_cfg)\nif weight_initializer is None:\n weight_initializer = self.backbone_model.weight_initializer\nif bias_initializer is None:\n bias_initializer = self.backbone_model.bias_initializer\nself.mlm_decoder = nn.HybridSequential()\nself.m... | <|body_start_0|>
super().__init__()
self.backbone_model = ElectraModel.from_cfg(backbone_cfg)
if weight_initializer is None:
weight_initializer = self.backbone_model.weight_initializer
if bias_initializer is None:
bias_initializer = self.backbone_model.bias_initia... | This is a typical mlm model whose size is usually the 1/4 - 1/2 of the discriminator. | ElectraGenerator | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ElectraGenerator:
"""This is a typical mlm model whose size is usually the 1/4 - 1/2 of the discriminator."""
def __init__(self, backbone_cfg, weight_initializer=None, bias_initializer=None):
"""Parameters ---------- backbone_cfg Configuration of the backbone model weight_initializer... | stack_v2_sparse_classes_36k_train_008621 | 45,388 | permissive | [
{
"docstring": "Parameters ---------- backbone_cfg Configuration of the backbone model weight_initializer bias_initializer",
"name": "__init__",
"signature": "def __init__(self, backbone_cfg, weight_initializer=None, bias_initializer=None)"
},
{
"docstring": "Tie the embedding layers between the... | 3 | null | Implement the Python class `ElectraGenerator` described below.
Class description:
This is a typical mlm model whose size is usually the 1/4 - 1/2 of the discriminator.
Method signatures and docstrings:
- def __init__(self, backbone_cfg, weight_initializer=None, bias_initializer=None): Parameters ---------- backbone_c... | Implement the Python class `ElectraGenerator` described below.
Class description:
This is a typical mlm model whose size is usually the 1/4 - 1/2 of the discriminator.
Method signatures and docstrings:
- def __init__(self, backbone_cfg, weight_initializer=None, bias_initializer=None): Parameters ---------- backbone_c... | 1df42c561ae9552960e3f8b5f22e74de812a29c6 | <|skeleton|>
class ElectraGenerator:
"""This is a typical mlm model whose size is usually the 1/4 - 1/2 of the discriminator."""
def __init__(self, backbone_cfg, weight_initializer=None, bias_initializer=None):
"""Parameters ---------- backbone_cfg Configuration of the backbone model weight_initializer... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ElectraGenerator:
"""This is a typical mlm model whose size is usually the 1/4 - 1/2 of the discriminator."""
def __init__(self, backbone_cfg, weight_initializer=None, bias_initializer=None):
"""Parameters ---------- backbone_cfg Configuration of the backbone model weight_initializer bias_initial... | the_stack_v2_python_sparse | src/gluonnlp/models/electra.py | akshatgui/gluon-nlp | train | 0 |
49711dc5a87cb4d93f27783e84a799da16924b58 | [
"self.instance_service = instance_service\nself.ec2_storage_service = ec2_storage_service\nself.security_group_service = security_group_service\nself.tag_service = tag_service\nself.elastic_ip_service = elastic_ip_service",
"try:\n self._delete(ec2_session, instance_id)\nexcept ClientError as clientErr:\n e... | <|body_start_0|>
self.instance_service = instance_service
self.ec2_storage_service = ec2_storage_service
self.security_group_service = security_group_service
self.tag_service = tag_service
self.elastic_ip_service = elastic_ip_service
<|end_body_0|>
<|body_start_1|>
try:
... | DeleteAMIOperation | [
"ISC"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DeleteAMIOperation:
def __init__(self, instance_service, ec2_storage_service, security_group_service, tag_service, elastic_ip_service):
""":param instance_service: :type instance_service: cloudshell.cp.aws.domain.services.ec2.instance.InstanceService :param ec2_storage_service: :type ec2... | stack_v2_sparse_classes_36k_train_008622 | 3,538 | permissive | [
{
"docstring": ":param instance_service: :type instance_service: cloudshell.cp.aws.domain.services.ec2.instance.InstanceService :param ec2_storage_service: :type ec2_storage_service: cloudshell.cp.aws.domain.services.ec2.ebs.EC2StorageService :param security_group_service: :type security_group_service: cloudshe... | 3 | null | Implement the Python class `DeleteAMIOperation` described below.
Class description:
Implement the DeleteAMIOperation class.
Method signatures and docstrings:
- def __init__(self, instance_service, ec2_storage_service, security_group_service, tag_service, elastic_ip_service): :param instance_service: :type instance_se... | Implement the Python class `DeleteAMIOperation` described below.
Class description:
Implement the DeleteAMIOperation class.
Method signatures and docstrings:
- def __init__(self, instance_service, ec2_storage_service, security_group_service, tag_service, elastic_ip_service): :param instance_service: :type instance_se... | 6f3c24037bec97702ddc8aa9729672c090b1e73d | <|skeleton|>
class DeleteAMIOperation:
def __init__(self, instance_service, ec2_storage_service, security_group_service, tag_service, elastic_ip_service):
""":param instance_service: :type instance_service: cloudshell.cp.aws.domain.services.ec2.instance.InstanceService :param ec2_storage_service: :type ec2... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DeleteAMIOperation:
def __init__(self, instance_service, ec2_storage_service, security_group_service, tag_service, elastic_ip_service):
""":param instance_service: :type instance_service: cloudshell.cp.aws.domain.services.ec2.instance.InstanceService :param ec2_storage_service: :type ec2_storage_servi... | the_stack_v2_python_sparse | package/cloudshell/cp/aws/domain/ami_management/operations/delete_operation.py | QualiSystems/AWS-Shell | train | 3 | |
062b6078e945baae00d4ce62faddc05d7feb7ad0 | [
"gtk.VBox.__init__(self)\nself.config = config\nself.set_spacing(8)\nself.set_border_width(8)\nself.debug = gtk.CheckButton(_('_Show debug in console'))\nself.debug.set_active(self.config.glob['debug'])\nself.binary = gtk.CheckButton(_('_Show binary codes in debug'))\nself.binary.set_active(self.config.glob['binary... | <|body_start_0|>
gtk.VBox.__init__(self)
self.config = config
self.set_spacing(8)
self.set_border_width(8)
self.debug = gtk.CheckButton(_('_Show debug in console'))
self.debug.set_active(self.config.glob['debug'])
self.binary = gtk.CheckButton(_('_Show binary code... | This class represent the tab that contains the connection options | ConnectionTab | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ConnectionTab:
"""This class represent the tab that contains the connection options"""
def __init__(self, config):
"""Constructor"""
<|body_0|>
def save(self):
"""save the actual setting"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
gtk.VBox._... | stack_v2_sparse_classes_36k_train_008623 | 25,236 | no_license | [
{
"docstring": "Constructor",
"name": "__init__",
"signature": "def __init__(self, config)"
},
{
"docstring": "save the actual setting",
"name": "save",
"signature": "def save(self)"
}
] | 2 | null | Implement the Python class `ConnectionTab` described below.
Class description:
This class represent the tab that contains the connection options
Method signatures and docstrings:
- def __init__(self, config): Constructor
- def save(self): save the actual setting | Implement the Python class `ConnectionTab` described below.
Class description:
This class represent the tab that contains the connection options
Method signatures and docstrings:
- def __init__(self, config): Constructor
- def save(self): save the actual setting
<|skeleton|>
class ConnectionTab:
"""This class re... | 1a99c1788f0eb9f1e5d8c2ced3892d00cd9449ad | <|skeleton|>
class ConnectionTab:
"""This class represent the tab that contains the connection options"""
def __init__(self, config):
"""Constructor"""
<|body_0|>
def save(self):
"""save the actual setting"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ConnectionTab:
"""This class represent the tab that contains the connection options"""
def __init__(self, config):
"""Constructor"""
gtk.VBox.__init__(self)
self.config = config
self.set_spacing(8)
self.set_border_width(8)
self.debug = gtk.CheckButton(_('_S... | the_stack_v2_python_sparse | emesene/rev1286-1505/left-trunk-1505/PreferenceWindow.py | joliebig/featurehouse_fstmerge_examples | train | 3 |
587fcc5493081aa26787413f58e6f8e5d8782256 | [
"lehrangebotId = request.args.get('lehrangebotId')\nteilnehmerId = request.args.get('teilnehmerId')\nprojektAdministration = ProjektAdministration()\nprojektAdministration.delete_teilnahme(lehrangebotId, teilnehmerId)",
"lehrangebotId = request.args.get('lehrangebotId')\nteilnehmerId = request.args.get('teilnehme... | <|body_start_0|>
lehrangebotId = request.args.get('lehrangebotId')
teilnehmerId = request.args.get('teilnehmerId')
projektAdministration = ProjektAdministration()
projektAdministration.delete_teilnahme(lehrangebotId, teilnehmerId)
<|end_body_0|>
<|body_start_1|>
lehrangebotId = ... | TeilnahmeOperationen | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TeilnahmeOperationen:
def delete(self):
"""Löschen eines bestimmten Teihnahme-Objekts. Anhand der Lehrangebot ID und Teilnehmer ID"""
<|body_0|>
def post(self):
"""Anlegen eines neuen Teinahme-Objekts für ein bestimmtes Lehrangebot."""
<|body_1|>
<|end_skele... | stack_v2_sparse_classes_36k_train_008624 | 29,521 | no_license | [
{
"docstring": "Löschen eines bestimmten Teihnahme-Objekts. Anhand der Lehrangebot ID und Teilnehmer ID",
"name": "delete",
"signature": "def delete(self)"
},
{
"docstring": "Anlegen eines neuen Teinahme-Objekts für ein bestimmtes Lehrangebot.",
"name": "post",
"signature": "def post(sel... | 2 | stack_v2_sparse_classes_30k_train_017611 | Implement the Python class `TeilnahmeOperationen` described below.
Class description:
Implement the TeilnahmeOperationen class.
Method signatures and docstrings:
- def delete(self): Löschen eines bestimmten Teihnahme-Objekts. Anhand der Lehrangebot ID und Teilnehmer ID
- def post(self): Anlegen eines neuen Teinahme-O... | Implement the Python class `TeilnahmeOperationen` described below.
Class description:
Implement the TeilnahmeOperationen class.
Method signatures and docstrings:
- def delete(self): Löschen eines bestimmten Teihnahme-Objekts. Anhand der Lehrangebot ID und Teilnehmer ID
- def post(self): Anlegen eines neuen Teinahme-O... | 9014f16fed08956bd28216e1373b60139e5caea1 | <|skeleton|>
class TeilnahmeOperationen:
def delete(self):
"""Löschen eines bestimmten Teihnahme-Objekts. Anhand der Lehrangebot ID und Teilnehmer ID"""
<|body_0|>
def post(self):
"""Anlegen eines neuen Teinahme-Objekts für ein bestimmtes Lehrangebot."""
<|body_1|>
<|end_skele... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TeilnahmeOperationen:
def delete(self):
"""Löschen eines bestimmten Teihnahme-Objekts. Anhand der Lehrangebot ID und Teilnehmer ID"""
lehrangebotId = request.args.get('lehrangebotId')
teilnehmerId = request.args.get('teilnehmerId')
projektAdministration = ProjektAdministration(... | the_stack_v2_python_sparse | src/main.py | leanderpeter/university_project_selector | train | 3 | |
e59a211480b0d31723249ec394512542ab84bd53 | [
"if n == 0:\n return 1.0\nif n == 1:\n return x\nif n < 0:\n return self.power(1 / x, -n)\nresult = self.power(x * x, n // 2)\nif n % 2:\n result *= x\nreturn result",
"m, result = (abs(n), 1.0)\nwhile m:\n if m % 2:\n result *= x\n x *= x\n m //= 2\nreturn result if n > 0 else 1 / res... | <|body_start_0|>
if n == 0:
return 1.0
if n == 1:
return x
if n < 0:
return self.power(1 / x, -n)
result = self.power(x * x, n // 2)
if n % 2:
result *= x
return result
<|end_body_0|>
<|body_start_1|>
m, result = (a... | Calculate | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Calculate:
def power(self, x: float, n: int) -> float:
"""Approach: Recursion Optimized Time Complexity: O(log N) Space Complexity: O(1) :param x: :param n: :return:"""
<|body_0|>
def power_(self, x: float, n: int) -> float:
"""Approach: Iterative Time Complexity: O(... | stack_v2_sparse_classes_36k_train_008625 | 1,753 | no_license | [
{
"docstring": "Approach: Recursion Optimized Time Complexity: O(log N) Space Complexity: O(1) :param x: :param n: :return:",
"name": "power",
"signature": "def power(self, x: float, n: int) -> float"
},
{
"docstring": "Approach: Iterative Time Complexity: O(log N) Space Complexity: O(1) :param ... | 3 | null | Implement the Python class `Calculate` described below.
Class description:
Implement the Calculate class.
Method signatures and docstrings:
- def power(self, x: float, n: int) -> float: Approach: Recursion Optimized Time Complexity: O(log N) Space Complexity: O(1) :param x: :param n: :return:
- def power_(self, x: fl... | Implement the Python class `Calculate` described below.
Class description:
Implement the Calculate class.
Method signatures and docstrings:
- def power(self, x: float, n: int) -> float: Approach: Recursion Optimized Time Complexity: O(log N) Space Complexity: O(1) :param x: :param n: :return:
- def power_(self, x: fl... | 65cc78b5afa0db064f9fe8f06597e3e120f7363d | <|skeleton|>
class Calculate:
def power(self, x: float, n: int) -> float:
"""Approach: Recursion Optimized Time Complexity: O(log N) Space Complexity: O(1) :param x: :param n: :return:"""
<|body_0|>
def power_(self, x: float, n: int) -> float:
"""Approach: Iterative Time Complexity: O(... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Calculate:
def power(self, x: float, n: int) -> float:
"""Approach: Recursion Optimized Time Complexity: O(log N) Space Complexity: O(1) :param x: :param n: :return:"""
if n == 0:
return 1.0
if n == 1:
return x
if n < 0:
return self.power(1 /... | the_stack_v2_python_sparse | revisited/math_and_strings/math/my_pow.py | Shiv2157k/leet_code | train | 1 | |
e70c1d480265b0ad4ea553ce9a2f1cd0d0bd4a43 | [
"lower_bound = float('-inf')\nstack = []\nfor val in preorder:\n if val < lower_bound:\n return False\n while stack and val > stack[-1]:\n lower_bound = stack.pop()\n stack.append(val)\nreturn True",
"lower_bound = float('-inf')\ni = 0\nfor val in preorder:\n if val < lower_bound:\n ... | <|body_start_0|>
lower_bound = float('-inf')
stack = []
for val in preorder:
if val < lower_bound:
return False
while stack and val > stack[-1]:
lower_bound = stack.pop()
stack.append(val)
return True
<|end_body_0|>
<|b... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def verifyPreorder(self, preorder: List[int]) -> bool:
"""In BST, node.left.val < node.val < node.right.val, and the preorder traversal will visit left child all the way to the leaf before visiting any right child. This traversal order will reflect in the preorder array as a de... | stack_v2_sparse_classes_36k_train_008626 | 2,035 | no_license | [
{
"docstring": "In BST, node.left.val < node.val < node.right.val, and the preorder traversal will visit left child all the way to the leaf before visiting any right child. This traversal order will reflect in the preorder array as a decreasing val subseq. If we see a val that's greater than its preceeding val ... | 2 | stack_v2_sparse_classes_30k_test_001142 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def verifyPreorder(self, preorder: List[int]) -> bool: In BST, node.left.val < node.val < node.right.val, and the preorder traversal will visit left child all the way to the leaf... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def verifyPreorder(self, preorder: List[int]) -> bool: In BST, node.left.val < node.val < node.right.val, and the preorder traversal will visit left child all the way to the leaf... | 6ff1941ff213a843013100ac7033e2d4f90fbd6a | <|skeleton|>
class Solution:
def verifyPreorder(self, preorder: List[int]) -> bool:
"""In BST, node.left.val < node.val < node.right.val, and the preorder traversal will visit left child all the way to the leaf before visiting any right child. This traversal order will reflect in the preorder array as a de... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def verifyPreorder(self, preorder: List[int]) -> bool:
"""In BST, node.left.val < node.val < node.right.val, and the preorder traversal will visit left child all the way to the leaf before visiting any right child. This traversal order will reflect in the preorder array as a decreasing val s... | the_stack_v2_python_sparse | Leetcode 0255. Verify Preorder Sequence in Binary Search Tree.py | Chaoran-sjsu/leetcode | train | 0 | |
7973e3adbee2b3e3a32e8e98a33a8b263eca11ef | [
"startTime = datetime.datetime.now()\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('gasparde_ljmcgann', 'gasparde_ljmcgann')\nprops = repo.gasparde_ljmcgann.properties\nfor prop in props.find():\n print('hi!')\n _id = prop['_id']\n address = prop['ST_NUM'].split(' ')[0] + ' ' +... | <|body_start_0|>
startTime = datetime.datetime.now()
client = dml.pymongo.MongoClient()
repo = client.repo
repo.authenticate('gasparde_ljmcgann', 'gasparde_ljmcgann')
props = repo.gasparde_ljmcgann.properties
for prop in props.find():
print('hi!')
... | livingAreaCost | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class livingAreaCost:
def execute(trial=False):
"""Retrieve some data sets (not using the API here for the sake of simplicity)."""
<|body_0|>
def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None):
"""Create the provenance document describing everythin... | stack_v2_sparse_classes_36k_train_008627 | 4,882 | no_license | [
{
"docstring": "Retrieve some data sets (not using the API here for the sake of simplicity).",
"name": "execute",
"signature": "def execute(trial=False)"
},
{
"docstring": "Create the provenance document describing everything happening in this script. Each run of the script will generate a new d... | 2 | stack_v2_sparse_classes_30k_train_008634 | Implement the Python class `livingAreaCost` described below.
Class description:
Implement the livingAreaCost class.
Method signatures and docstrings:
- def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity).
- def provenance(doc=prov.model.ProvDocument(), startTime=None,... | Implement the Python class `livingAreaCost` described below.
Class description:
Implement the livingAreaCost class.
Method signatures and docstrings:
- def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity).
- def provenance(doc=prov.model.ProvDocument(), startTime=None,... | 90284cf3debbac36eead07b8d2339cdd191b86cf | <|skeleton|>
class livingAreaCost:
def execute(trial=False):
"""Retrieve some data sets (not using the API here for the sake of simplicity)."""
<|body_0|>
def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None):
"""Create the provenance document describing everythin... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class livingAreaCost:
def execute(trial=False):
"""Retrieve some data sets (not using the API here for the sake of simplicity)."""
startTime = datetime.datetime.now()
client = dml.pymongo.MongoClient()
repo = client.repo
repo.authenticate('gasparde_ljmcgann', 'gasparde_ljmcga... | the_stack_v2_python_sparse | gasparde_ljmcgann/livingAreaCost.py | maximega/course-2019-spr-proj | train | 2 | |
0c3c1d313039885d916b11af7b2de1063b38f102 | [
"if root is None:\n return ''\n\ndef recursion(node):\n if node is None:\n return 'None'\n return str(node.val) + ',' + recursion(node.left) + ',' + recursion(node.right)\nreturn recursion(root)",
"if data == '' or len(data) == 0:\n return\n\ndef recursion():\n value = next(values)\n if v... | <|body_start_0|>
if root is None:
return ''
def recursion(node):
if node is None:
return 'None'
return str(node.val) + ',' + recursion(node.left) + ',' + recursion(node.right)
return recursion(root)
<|end_body_0|>
<|body_start_1|>
if ... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(root):
"""前序遍历。将树转换成序列字符串输出"""
<|body_0|>
def deserialize(data):
"""将字符串转换成树"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if root is None:
return ''
def recursion(node):
if node is None:
... | stack_v2_sparse_classes_36k_train_008628 | 5,822 | no_license | [
{
"docstring": "前序遍历。将树转换成序列字符串输出",
"name": "serialize",
"signature": "def serialize(root)"
},
{
"docstring": "将字符串转换成树",
"name": "deserialize",
"signature": "def deserialize(data)"
}
] | 2 | stack_v2_sparse_classes_30k_train_004120 | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(root): 前序遍历。将树转换成序列字符串输出
- def deserialize(data): 将字符串转换成树 | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(root): 前序遍历。将树转换成序列字符串输出
- def deserialize(data): 将字符串转换成树
<|skeleton|>
class Codec:
def serialize(root):
"""前序遍历。将树转换成序列字符串输出"""
<|body_0|>
de... | 497c9717d783bb9f2d2675a3b254ec406582d849 | <|skeleton|>
class Codec:
def serialize(root):
"""前序遍历。将树转换成序列字符串输出"""
<|body_0|>
def deserialize(data):
"""将字符串转换成树"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Codec:
def serialize(root):
"""前序遍历。将树转换成序列字符串输出"""
if root is None:
return ''
def recursion(node):
if node is None:
return 'None'
return str(node.val) + ',' + recursion(node.left) + ',' + recursion(node.right)
return recursi... | the_stack_v2_python_sparse | 297.二叉树的序列化与反序列化/Codec.py | boyshen/leetcode_Algorithm_problem | train | 0 | |
2269234e37a281d99f480e8bfdf4d282f4217005 | [
"super(FileInterfaceAdapter, self).__init__(**kwargs)\nself.directories = {}\nif DIRECTORY_CONFIG_NAME in self.options:\n for directory_str in self.options[DIRECTORY_CONFIG_NAME].split(','):\n logging.debug(directory_str)\n try:\n dir_name, path = directory_str.split('=')\n se... | <|body_start_0|>
super(FileInterfaceAdapter, self).__init__(**kwargs)
self.directories = {}
if DIRECTORY_CONFIG_NAME in self.options:
for directory_str in self.options[DIRECTORY_CONFIG_NAME].split(','):
logging.debug(directory_str)
try:
... | System info adapter class for the ODIN server. This adapter provides ODIN clients with information about the server and the system that it is running on. | FileInterfaceAdapter | [
"MIT",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FileInterfaceAdapter:
"""System info adapter class for the ODIN server. This adapter provides ODIN clients with information about the server and the system that it is running on."""
def __init__(self, **kwargs):
"""Initialize the FileInterfaceAdapter object. This constructor initiali... | stack_v2_sparse_classes_36k_train_008629 | 7,951 | permissive | [
{
"docstring": "Initialize the FileInterfaceAdapter object. This constructor initializes the FileInterfaceAdapter object. :param kwargs: keyword arguments specifying options",
"name": "__init__",
"signature": "def __init__(self, **kwargs)"
},
{
"docstring": "Handle an HTTP GET request. This meth... | 4 | null | Implement the Python class `FileInterfaceAdapter` described below.
Class description:
System info adapter class for the ODIN server. This adapter provides ODIN clients with information about the server and the system that it is running on.
Method signatures and docstrings:
- def __init__(self, **kwargs): Initialize t... | Implement the Python class `FileInterfaceAdapter` described below.
Class description:
System info adapter class for the ODIN server. This adapter provides ODIN clients with information about the server and the system that it is running on.
Method signatures and docstrings:
- def __init__(self, **kwargs): Initialize t... | 39c053a2c5371c6d96f594c4f5bd2083ca888015 | <|skeleton|>
class FileInterfaceAdapter:
"""System info adapter class for the ODIN server. This adapter provides ODIN clients with information about the server and the system that it is running on."""
def __init__(self, **kwargs):
"""Initialize the FileInterfaceAdapter object. This constructor initiali... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FileInterfaceAdapter:
"""System info adapter class for the ODIN server. This adapter provides ODIN clients with information about the server and the system that it is running on."""
def __init__(self, **kwargs):
"""Initialize the FileInterfaceAdapter object. This constructor initializes the FileI... | the_stack_v2_python_sparse | control/src/hexitec/FileInterface.py | stfc-aeg/hexitec-detector | train | 2 |
c55368d7f7f25a9f08c079abd77c5f4db0d74b50 | [
"array = [head]\nwhile array[-1].next:\n array.append(array[-1].next)\nreturn array[len(array) // 2]",
"n, cur = (0, head)\nwhile cur:\n n += 1\n cur = cur.next\nk, cur = (0, head)\nwhile k < n // 2:\n k += 1\n cur = cur.next\nreturn cur",
"fast = slow = head\nwhile fast and fast.next:\n slow ... | <|body_start_0|>
array = [head]
while array[-1].next:
array.append(array[-1].next)
return array[len(array) // 2]
<|end_body_0|>
<|body_start_1|>
n, cur = (0, head)
while cur:
n += 1
cur = cur.next
k, cur = (0, head)
while k < n... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def middle_node(cls, head: ListNode) -> ListNode:
"""数组"""
<|body_0|>
def middle_node_v2(cls, head: ListNode) -> ListNode:
"""单指针"""
<|body_1|>
def middle_node_v3(cls, head: ListNode) -> ListNode:
"""快慢指针"""
<|body_2|>
<|end_sk... | stack_v2_sparse_classes_36k_train_008630 | 1,920 | no_license | [
{
"docstring": "数组",
"name": "middle_node",
"signature": "def middle_node(cls, head: ListNode) -> ListNode"
},
{
"docstring": "单指针",
"name": "middle_node_v2",
"signature": "def middle_node_v2(cls, head: ListNode) -> ListNode"
},
{
"docstring": "快慢指针",
"name": "middle_node_v3"... | 3 | stack_v2_sparse_classes_30k_train_000800 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def middle_node(cls, head: ListNode) -> ListNode: 数组
- def middle_node_v2(cls, head: ListNode) -> ListNode: 单指针
- def middle_node_v3(cls, head: ListNode) -> ListNode: 快慢指针 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def middle_node(cls, head: ListNode) -> ListNode: 数组
- def middle_node_v2(cls, head: ListNode) -> ListNode: 单指针
- def middle_node_v3(cls, head: ListNode) -> ListNode: 快慢指针
<|ske... | 1d1876620a55ff88af7bc390cf1a4fd4350d8d16 | <|skeleton|>
class Solution:
def middle_node(cls, head: ListNode) -> ListNode:
"""数组"""
<|body_0|>
def middle_node_v2(cls, head: ListNode) -> ListNode:
"""单指针"""
<|body_1|>
def middle_node_v3(cls, head: ListNode) -> ListNode:
"""快慢指针"""
<|body_2|>
<|end_sk... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def middle_node(cls, head: ListNode) -> ListNode:
"""数组"""
array = [head]
while array[-1].next:
array.append(array[-1].next)
return array[len(array) // 2]
def middle_node_v2(cls, head: ListNode) -> ListNode:
"""单指针"""
n, cur = (0, head... | the_stack_v2_python_sparse | 01-数据结构/链表/876.链表的中间结点.py | jh-lau/leetcode_in_python | train | 0 | |
03d63aa3e581c3ead799612d2d4c11f3fbee9f01 | [
"self.shell = shell\nself.callbacks = {n: [] for n in available_events}\nself.print_on_error = print_on_error",
"if not callable(function):\n raise TypeError('Need a callable, got %r' % function)\ncallback_proto = available_events.get(event)\nif function not in self.callbacks[event]:\n self.callbacks[event]... | <|body_start_0|>
self.shell = shell
self.callbacks = {n: [] for n in available_events}
self.print_on_error = print_on_error
<|end_body_0|>
<|body_start_1|>
if not callable(function):
raise TypeError('Need a callable, got %r' % function)
callback_proto = available_eve... | Manage a collection of events and a sequence of callbacks for each. This is attached to :class:`~IPython.core.interactiveshell.InteractiveShell` instances as an ``events`` attribute. .. note:: This API is experimental in IPython 2.0, and may be revised in future versions. | EventManager | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EventManager:
"""Manage a collection of events and a sequence of callbacks for each. This is attached to :class:`~IPython.core.interactiveshell.InteractiveShell` instances as an ``events`` attribute. .. note:: This API is experimental in IPython 2.0, and may be revised in future versions."""
... | stack_v2_sparse_classes_36k_train_008631 | 5,586 | permissive | [
{
"docstring": "Initialise the :class:`CallbackManager`. Parameters ---------- shell The :class:`~IPython.core.interactiveshell.InteractiveShell` instance available_events An iterable of names for callback events. print_on_error: A boolean flag to set whether the EventManager will print a warning which a event ... | 4 | null | Implement the Python class `EventManager` described below.
Class description:
Manage a collection of events and a sequence of callbacks for each. This is attached to :class:`~IPython.core.interactiveshell.InteractiveShell` instances as an ``events`` attribute. .. note:: This API is experimental in IPython 2.0, and may... | Implement the Python class `EventManager` described below.
Class description:
Manage a collection of events and a sequence of callbacks for each. This is attached to :class:`~IPython.core.interactiveshell.InteractiveShell` instances as an ``events`` attribute. .. note:: This API is experimental in IPython 2.0, and may... | e5103f971233fd66b558585cce7a4f52a716cd56 | <|skeleton|>
class EventManager:
"""Manage a collection of events and a sequence of callbacks for each. This is attached to :class:`~IPython.core.interactiveshell.InteractiveShell` instances as an ``events`` attribute. .. note:: This API is experimental in IPython 2.0, and may be revised in future versions."""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class EventManager:
"""Manage a collection of events and a sequence of callbacks for each. This is attached to :class:`~IPython.core.interactiveshell.InteractiveShell` instances as an ``events`` attribute. .. note:: This API is experimental in IPython 2.0, and may be revised in future versions."""
def __init__... | the_stack_v2_python_sparse | IPython/core/events.py | ipython/ipython | train | 13,673 |
e9ad7b3c2636fb38e377a562443f6c87e2f8255b | [
"self.X_mn = self.load_base_connectome(base_filename)\nr_state = np.random.RandomState(signature_seed)\nself.sigs = self.generate_injury_signatures(self.X_mn, n_injuries, r_state)",
"X, Y = self.sample_injury_strengths(n_samples, self.X_mn, self.sigs[0], self.sigs[1], noise_weight)\nassert X.shape[0] == n_samples... | <|body_start_0|>
self.X_mn = self.load_base_connectome(base_filename)
r_state = np.random.RandomState(signature_seed)
self.sigs = self.generate_injury_signatures(self.X_mn, n_injuries, r_state)
<|end_body_0|>
<|body_start_1|>
X, Y = self.sample_injury_strengths(n_samples, self.X_mn, sel... | ConnectomeInjury | [
"LicenseRef-scancode-cecill-b-en"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ConnectomeInjury:
def __init__(self, base_filename, n_injuries=2, signature_seed=333):
"""Use to create synthetic injury data."""
<|body_0|>
def generate_injury(self, n_samples=100, noise_weight=0.125):
"""Return n_samples of synthetic injury data and corresponding i... | stack_v2_sparse_classes_36k_train_008632 | 8,625 | permissive | [
{
"docstring": "Use to create synthetic injury data.",
"name": "__init__",
"signature": "def __init__(self, base_filename, n_injuries=2, signature_seed=333)"
},
{
"docstring": "Return n_samples of synthetic injury data and corresponding injury strength.",
"name": "generate_injury",
"sign... | 5 | stack_v2_sparse_classes_30k_train_008604 | Implement the Python class `ConnectomeInjury` described below.
Class description:
Implement the ConnectomeInjury class.
Method signatures and docstrings:
- def __init__(self, base_filename, n_injuries=2, signature_seed=333): Use to create synthetic injury data.
- def generate_injury(self, n_samples=100, noise_weight=... | Implement the Python class `ConnectomeInjury` described below.
Class description:
Implement the ConnectomeInjury class.
Method signatures and docstrings:
- def __init__(self, base_filename, n_injuries=2, signature_seed=333): Use to create synthetic injury data.
- def generate_injury(self, n_samples=100, noise_weight=... | 7a807ed690929563ce36086eaf0998d0e8856aea | <|skeleton|>
class ConnectomeInjury:
def __init__(self, base_filename, n_injuries=2, signature_seed=333):
"""Use to create synthetic injury data."""
<|body_0|>
def generate_injury(self, n_samples=100, noise_weight=0.125):
"""Return n_samples of synthetic injury data and corresponding i... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ConnectomeInjury:
def __init__(self, base_filename, n_injuries=2, signature_seed=333):
"""Use to create synthetic injury data."""
self.X_mn = self.load_base_connectome(base_filename)
r_state = np.random.RandomState(signature_seed)
self.sigs = self.generate_injury_signatures(sel... | the_stack_v2_python_sparse | pynet/datasets/connectome.py | Duplums/pynet | train | 0 | |
86fab569c5be52fbefeefdf7850d762c26d57ed1 | [
"blog = self.get_parent()\nself.category_id = str(blog.get_unique_category_id())\nself.put()",
"blog = self.get_parent()\nq = BlogEntry.all()\nq.filter('cparent_key =', blog.get_namekey())\nq.filter('categories =', self.category_id)\nq.order(order)\nif end == -1:\n end = start + blog.BATCH_SIZE\nreturn list(q.... | <|body_start_0|>
blog = self.get_parent()
self.category_id = str(blog.get_unique_category_id())
self.put()
<|end_body_0|>
<|body_start_1|>
blog = self.get_parent()
q = BlogEntry.all()
q.filter('cparent_key =', blog.get_namekey())
q.filter('categories =', self.cat... | A model class of blog category, representing categories on a blog. | BlogCategory | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BlogCategory:
"""A model class of blog category, representing categories on a blog."""
def set_category_id(self):
"""A method to set unique category id"""
<|body_0|>
def get_entries(self, start=0, end=-1, order='-created_at'):
"""A method to obtain entries in a c... | stack_v2_sparse_classes_36k_train_008633 | 9,377 | permissive | [
{
"docstring": "A method to set unique category id",
"name": "set_category_id",
"signature": "def set_category_id(self)"
},
{
"docstring": "A method to obtain entries in a category.",
"name": "get_entries",
"signature": "def get_entries(self, start=0, end=-1, order='-created_at')"
}
] | 2 | null | Implement the Python class `BlogCategory` described below.
Class description:
A model class of blog category, representing categories on a blog.
Method signatures and docstrings:
- def set_category_id(self): A method to set unique category id
- def get_entries(self, start=0, end=-1, order='-created_at'): A method to ... | Implement the Python class `BlogCategory` described below.
Class description:
A model class of blog category, representing categories on a blog.
Method signatures and docstrings:
- def set_category_id(self): A method to set unique category id
- def get_entries(self, start=0, end=-1, order='-created_at'): A method to ... | e1209f7d44d1c59ff9d373b7d89d414f31a9c28b | <|skeleton|>
class BlogCategory:
"""A model class of blog category, representing categories on a blog."""
def set_category_id(self):
"""A method to set unique category id"""
<|body_0|>
def get_entries(self, start=0, end=-1, order='-created_at'):
"""A method to obtain entries in a c... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BlogCategory:
"""A model class of blog category, representing categories on a blog."""
def set_category_id(self):
"""A method to set unique category id"""
blog = self.get_parent()
self.category_id = str(blog.get_unique_category_id())
self.put()
def get_entries(self, s... | the_stack_v2_python_sparse | applications/aha.application.coreblog3/application/model/blogengine.py | Letractively/aha-gae | train | 0 |
02d6ae9495c7727ebff2d90697995a08d19818ab | [
"for i in range(len(nums)):\n for j in range(i + 1, len(nums)):\n if nums[i] + nums[j] == target:\n return [i, j]",
"hash_table = {}\nfor i in range(len(nums)):\n complement = target - nums[i]\n if complement in hash_table:\n return [hash_table[complement], i]\n hash_table[num... | <|body_start_0|>
for i in range(len(nums)):
for j in range(i + 1, len(nums)):
if nums[i] + nums[j] == target:
return [i, j]
<|end_body_0|>
<|body_start_1|>
hash_table = {}
for i in range(len(nums)):
complement = target - nums[i]
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def twoSum_bf(self, nums, target):
"""TC: O(n^2) Arguments: nums {[List[int]]} -- [description] target {[List[int]]} -- [description]"""
<|body_0|>
def twoSum_hash_table(self, nums, target):
"""[O(n log n)] Arguments: nums {[List[int]]} target {[int]} Retur... | stack_v2_sparse_classes_36k_train_008634 | 1,136 | no_license | [
{
"docstring": "TC: O(n^2) Arguments: nums {[List[int]]} -- [description] target {[List[int]]} -- [description]",
"name": "twoSum_bf",
"signature": "def twoSum_bf(self, nums, target)"
},
{
"docstring": "[O(n log n)] Arguments: nums {[List[int]]} target {[int]} Returns: [List[int]] -- [list of in... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def twoSum_bf(self, nums, target): TC: O(n^2) Arguments: nums {[List[int]]} -- [description] target {[List[int]]} -- [description]
- def twoSum_hash_table(self, nums, target): [O... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def twoSum_bf(self, nums, target): TC: O(n^2) Arguments: nums {[List[int]]} -- [description] target {[List[int]]} -- [description]
- def twoSum_hash_table(self, nums, target): [O... | 8f775e7ac0d6daf5767cb30ac2739b62dfefc096 | <|skeleton|>
class Solution:
def twoSum_bf(self, nums, target):
"""TC: O(n^2) Arguments: nums {[List[int]]} -- [description] target {[List[int]]} -- [description]"""
<|body_0|>
def twoSum_hash_table(self, nums, target):
"""[O(n log n)] Arguments: nums {[List[int]]} target {[int]} Retur... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def twoSum_bf(self, nums, target):
"""TC: O(n^2) Arguments: nums {[List[int]]} -- [description] target {[List[int]]} -- [description]"""
for i in range(len(nums)):
for j in range(i + 1, len(nums)):
if nums[i] + nums[j] == target:
return... | the_stack_v2_python_sparse | leetCode/two_sum.py | rhender007/python-ps | train | 0 | |
fd939494f43c3b2c314406995afddb4c021ad8dd | [
"self.conclusion = conclusion\nself.guard = guard\nself.rhsList = rhsList\nself.quality = quality\nself.confTemplate = confTemplate",
"self.ran = False\nif self.guard is None:\n return True\nelse:\n env = self.conclusion.buildEnv(conclusion)\n return self.guard.guardPassed(env)",
"if not self.canRun(fi... | <|body_start_0|>
self.conclusion = conclusion
self.guard = guard
self.rhsList = rhsList
self.quality = quality
self.confTemplate = confTemplate
<|end_body_0|>
<|body_start_1|>
self.ran = False
if self.guard is None:
return True
else:
... | Object that defines a complete rule (Horn clause/implication). contains the conclusion, any prerequisites, the rhses and the confidence combination information. | Rule | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Rule:
"""Object that defines a complete rule (Horn clause/implication). contains the conclusion, any prerequisites, the rhses and the confidence combination information."""
def __init__(self, conclusion, guard, rhsList, quality, confTemplate):
"""Makes a new rule."""
<|body_0... | stack_v2_sparse_classes_36k_train_008635 | 14,326 | no_license | [
{
"docstring": "Makes a new rule.",
"name": "__init__",
"signature": "def __init__(self, conclusion, guard, rhsList, quality, confTemplate)"
},
{
"docstring": "evaluates the prerequisites. Returns true if all prereqs are met.",
"name": "canRun",
"signature": "def canRun(self, conclusion)... | 3 | stack_v2_sparse_classes_30k_val_000424 | Implement the Python class `Rule` described below.
Class description:
Object that defines a complete rule (Horn clause/implication). contains the conclusion, any prerequisites, the rhses and the confidence combination information.
Method signatures and docstrings:
- def __init__(self, conclusion, guard, rhsList, qual... | Implement the Python class `Rule` described below.
Class description:
Object that defines a complete rule (Horn clause/implication). contains the conclusion, any prerequisites, the rhses and the confidence combination information.
Method signatures and docstrings:
- def __init__(self, conclusion, guard, rhsList, qual... | f2236ccbc46609c01432f20063cc2fd71a638edb | <|skeleton|>
class Rule:
"""Object that defines a complete rule (Horn clause/implication). contains the conclusion, any prerequisites, the rhses and the confidence combination information."""
def __init__(self, conclusion, guard, rhsList, quality, confTemplate):
"""Makes a new rule."""
<|body_0... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Rule:
"""Object that defines a complete rule (Horn clause/implication). contains the conclusion, any prerequisites, the rhses and the confidence combination information."""
def __init__(self, conclusion, guard, rhsList, quality, confTemplate):
"""Makes a new rule."""
self.conclusion = con... | the_stack_v2_python_sparse | src/calvin/reasoning/rules.py | john-klingner/Calvin | train | 0 |
5884b209cb43b025156b78ba2f7d33c18cbf6de6 | [
"nums.sort()\ni, j = (0, len(nums) - 1)\nwhile i < j:\n if nums[i] + nums[j] == target:\n return [i, j]\n elif nums[i] + nums[j] > target:\n j -= 1\n else:\n i += 1\nreturn False",
"if len(nums) <= 1:\n return False\nbuff_dict = {}\nfor i, first in enumerate(nums):\n if first i... | <|body_start_0|>
nums.sort()
i, j = (0, len(nums) - 1)
while i < j:
if nums[i] + nums[j] == target:
return [i, j]
elif nums[i] + nums[j] > target:
j -= 1
else:
i += 1
return False
<|end_body_0|>
<|body_s... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def twoPointer(self, nums, target):
"""有序数组采用头尾双指针查找"""
<|body_0|>
def twoSum(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
nums.sort()
i, j = (0, ... | stack_v2_sparse_classes_36k_train_008636 | 1,859 | no_license | [
{
"docstring": "有序数组采用头尾双指针查找",
"name": "twoPointer",
"signature": "def twoPointer(self, nums, target)"
},
{
"docstring": ":type nums: List[int] :type target: int :rtype: List[int]",
"name": "twoSum",
"signature": "def twoSum(self, nums, target)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def twoPointer(self, nums, target): 有序数组采用头尾双指针查找
- def twoSum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def twoPointer(self, nums, target): 有序数组采用头尾双指针查找
- def twoSum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int]
<|skeleton|>
class Solution:
d... | 29be6e07cca1dd89d4ff4df3fd23eaa1671fbd1d | <|skeleton|>
class Solution:
def twoPointer(self, nums, target):
"""有序数组采用头尾双指针查找"""
<|body_0|>
def twoSum(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def twoPointer(self, nums, target):
"""有序数组采用头尾双指针查找"""
nums.sort()
i, j = (0, len(nums) - 1)
while i < j:
if nums[i] + nums[j] == target:
return [i, j]
elif nums[i] + nums[j] > target:
j -= 1
else:
... | the_stack_v2_python_sparse | leetcode/1.TwoSum.py | zuxinlin/leetcode | train | 0 | |
4cdcd2254e219ca22f778cf162069424188aa01a | [
"super().__init__()\nself.in_dim = in_dim\nself.out_dim = out_dim\nself.non_linearity = non_linearity\nself.layers = nn.ModuleList()\nfor dim in range(len(hidden_dims) + 1):\n if dim == 0:\n self.layers.append(nn.Linear(self.in_dim, hidden_dims[dim]))\n elif dim == len(hidden_dims):\n self.layer... | <|body_start_0|>
super().__init__()
self.in_dim = in_dim
self.out_dim = out_dim
self.non_linearity = non_linearity
self.layers = nn.ModuleList()
for dim in range(len(hidden_dims) + 1):
if dim == 0:
self.layers.append(nn.Linear(self.in_dim, hidd... | A `vanilla` neural network. | VanillaNN | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VanillaNN:
"""A `vanilla` neural network."""
def __init__(self, in_dim, out_dim, hidden_dims, non_linearity=F.relu):
""":param in_dim: (int) Dimensionality of the input. :param out_dim: (int) Dimensionality of the output. :param hidden_dims: (list of ints) Architecture of the network... | stack_v2_sparse_classes_36k_train_008637 | 16,175 | no_license | [
{
"docstring": ":param in_dim: (int) Dimensionality of the input. :param out_dim: (int) Dimensionality of the output. :param hidden_dims: (list of ints) Architecture of the network. :param non_linearity: Non-linear activation function to apply after each linear transformation, e.g. relu or tanh.",
"name": "... | 2 | stack_v2_sparse_classes_30k_train_000202 | Implement the Python class `VanillaNN` described below.
Class description:
A `vanilla` neural network.
Method signatures and docstrings:
- def __init__(self, in_dim, out_dim, hidden_dims, non_linearity=F.relu): :param in_dim: (int) Dimensionality of the input. :param out_dim: (int) Dimensionality of the output. :para... | Implement the Python class `VanillaNN` described below.
Class description:
A `vanilla` neural network.
Method signatures and docstrings:
- def __init__(self, in_dim, out_dim, hidden_dims, non_linearity=F.relu): :param in_dim: (int) Dimensionality of the input. :param out_dim: (int) Dimensionality of the output. :para... | de60f831ee082ab2ae232c498cf2755da7c14c27 | <|skeleton|>
class VanillaNN:
"""A `vanilla` neural network."""
def __init__(self, in_dim, out_dim, hidden_dims, non_linearity=F.relu):
""":param in_dim: (int) Dimensionality of the input. :param out_dim: (int) Dimensionality of the output. :param hidden_dims: (list of ints) Architecture of the network... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class VanillaNN:
"""A `vanilla` neural network."""
def __init__(self, in_dim, out_dim, hidden_dims, non_linearity=F.relu):
""":param in_dim: (int) Dimensionality of the input. :param out_dim: (int) Dimensionality of the output. :param hidden_dims: (list of ints) Architecture of the network. :param non_... | the_stack_v2_python_sparse | models/networks/np_networks.py | PenelopeJones/neural_processes | train | 4 |
ef47079f0d3fb71453f277831396e9718a4489d4 | [
"self.sample_size = sample_size\nself.sampler = UnigramSampler(corpus, power, sample_size)\nself.loss_layers = [SigmoidWithLoss() for _ in range(sample_size + 1)]\nself.embed_dot_layers = [EmbeddingDot(W) for _ in range(sample_size + 1)]\nself.params, self.grads = ([], [])\nfor layer in self.embed_dot_layers:\n ... | <|body_start_0|>
self.sample_size = sample_size
self.sampler = UnigramSampler(corpus, power, sample_size)
self.loss_layers = [SigmoidWithLoss() for _ in range(sample_size + 1)]
self.embed_dot_layers = [EmbeddingDot(W) for _ in range(sample_size + 1)]
self.params, self.grads = ([]... | NegativeSamplingLoss | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NegativeSamplingLoss:
def __init__(self, W, corpus, power=0.75, sample_size=5):
"""1. W : 출력층의 가중치(W_out) 2. corpus : 단어 ID의 리스트 3. power : 부정 단어 추출에서 확률 분포에 제곱할 값 (낮은 확률의 단어를 구제하는 변수) 4. sample_size : 부정 샘플링할 단어 수(긍정 + 부정 단어만큼 layer 생성) 5. sampler : UnigramSampler 클래스를 담은 변수 6. loss_lay... | stack_v2_sparse_classes_36k_train_008638 | 6,878 | no_license | [
{
"docstring": "1. W : 출력층의 가중치(W_out) 2. corpus : 단어 ID의 리스트 3. power : 부정 단어 추출에서 확률 분포에 제곱할 값 (낮은 확률의 단어를 구제하는 변수) 4. sample_size : 부정 샘플링할 단어 수(긍정 + 부정 단어만큼 layer 생성) 5. sampler : UnigramSampler 클래스를 담은 변수 6. loss_layers : SigmoidWithLoss 클래스를 sample_size + 1 만큼 담은 리스트 변수 7. embed_dot_layers : EmbeddingDot ... | 3 | stack_v2_sparse_classes_30k_train_007107 | Implement the Python class `NegativeSamplingLoss` described below.
Class description:
Implement the NegativeSamplingLoss class.
Method signatures and docstrings:
- def __init__(self, W, corpus, power=0.75, sample_size=5): 1. W : 출력층의 가중치(W_out) 2. corpus : 단어 ID의 리스트 3. power : 부정 단어 추출에서 확률 분포에 제곱할 값 (낮은 확률의 단어를 구제하... | Implement the Python class `NegativeSamplingLoss` described below.
Class description:
Implement the NegativeSamplingLoss class.
Method signatures and docstrings:
- def __init__(self, W, corpus, power=0.75, sample_size=5): 1. W : 출력층의 가중치(W_out) 2. corpus : 단어 ID의 리스트 3. power : 부정 단어 추출에서 확률 분포에 제곱할 값 (낮은 확률의 단어를 구제하... | a7a8d590fa13f53348f83f8c808538affbc7b3e8 | <|skeleton|>
class NegativeSamplingLoss:
def __init__(self, W, corpus, power=0.75, sample_size=5):
"""1. W : 출력층의 가중치(W_out) 2. corpus : 단어 ID의 리스트 3. power : 부정 단어 추출에서 확률 분포에 제곱할 값 (낮은 확률의 단어를 구제하는 변수) 4. sample_size : 부정 샘플링할 단어 수(긍정 + 부정 단어만큼 layer 생성) 5. sampler : UnigramSampler 클래스를 담은 변수 6. loss_lay... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NegativeSamplingLoss:
def __init__(self, W, corpus, power=0.75, sample_size=5):
"""1. W : 출력층의 가중치(W_out) 2. corpus : 단어 ID의 리스트 3. power : 부정 단어 추출에서 확률 분포에 제곱할 값 (낮은 확률의 단어를 구제하는 변수) 4. sample_size : 부정 샘플링할 단어 수(긍정 + 부정 단어만큼 layer 생성) 5. sampler : UnigramSampler 클래스를 담은 변수 6. loss_layers : SigmoidW... | the_stack_v2_python_sparse | practice/deep-learning-from-scratch-2/common/negative_sampling_layer.py | heaven324/Deeplearning | train | 1 | |
e04be72ecd51f9e9da4a2c481cdca8670200d13b | [
"self.cache = {}\nself.list = []\nself.len_list = -1",
"self.list.append(val)\nself.len_list += 1\nif val not in self.cache:\n self.cache[val] = [self.len_list]\n return True\nelse:\n self.cache[val].append(self.len_list)\n return False",
"if val not in self.cache:\n return False\nelse:\n inde... | <|body_start_0|>
self.cache = {}
self.list = []
self.len_list = -1
<|end_body_0|>
<|body_start_1|>
self.list.append(val)
self.len_list += 1
if val not in self.cache:
self.cache[val] = [self.len_list]
return True
else:
self.cach... | RandomizedCollection | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RandomizedCollection:
def __init__(self):
"""Initialize your data structure here."""
<|body_0|>
def insert(self, val):
"""Inserts a value to the collection. Returns true if the collection did not already contain the specified element. :type val: int :rtype: bool"""
... | stack_v2_sparse_classes_36k_train_008639 | 3,036 | no_license | [
{
"docstring": "Initialize your data structure here.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Inserts a value to the collection. Returns true if the collection did not already contain the specified element. :type val: int :rtype: bool",
"name": "insert",
... | 4 | stack_v2_sparse_classes_30k_train_006097 | Implement the Python class `RandomizedCollection` described below.
Class description:
Implement the RandomizedCollection class.
Method signatures and docstrings:
- def __init__(self): Initialize your data structure here.
- def insert(self, val): Inserts a value to the collection. Returns true if the collection did no... | Implement the Python class `RandomizedCollection` described below.
Class description:
Implement the RandomizedCollection class.
Method signatures and docstrings:
- def __init__(self): Initialize your data structure here.
- def insert(self, val): Inserts a value to the collection. Returns true if the collection did no... | 43cd80c3535a6fa70112ad99996c11af0decb8c5 | <|skeleton|>
class RandomizedCollection:
def __init__(self):
"""Initialize your data structure here."""
<|body_0|>
def insert(self, val):
"""Inserts a value to the collection. Returns true if the collection did not already contain the specified element. :type val: int :rtype: bool"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RandomizedCollection:
def __init__(self):
"""Initialize your data structure here."""
self.cache = {}
self.list = []
self.len_list = -1
def insert(self, val):
"""Inserts a value to the collection. Returns true if the collection did not already contain the specified ... | the_stack_v2_python_sparse | leetcode/Insert Delete GetRandom O(1) - Duplicates allowed.py | Tcake/py_leetcode | train | 0 | |
46a1f61a9f61b70e42207af09d6b08ecbf126e00 | [
"super().__init__(param_name, cli_option_name, default)\nif separator is None:\n separator = ' '\nself._separator = separator",
"if value is None:\n return None\nresult = [self._cli_option_name]\nif isinstance(value, LIST_TYPES):\n value = self._separator.join([str(item) for item in value])\nresult.appen... | <|body_start_0|>
super().__init__(param_name, cli_option_name, default)
if separator is None:
separator = ' '
self._separator = separator
<|end_body_0|>
<|body_start_1|>
if value is None:
return None
result = [self._cli_option_name]
if isinstance(... | composite keyword argument class. it should be used for composite keyword argument cli options. composite keyword arguments are those that have to emit an argument name with an argument value, note that this type of arguments could emit a list for a single argument with `--arg` name. for example: `command --arg1 value1... | CompositeKeywordArgument | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CompositeKeywordArgument:
"""composite keyword argument class. it should be used for composite keyword argument cli options. composite keyword arguments are those that have to emit an argument name with an argument value, note that this type of arguments could emit a list for a single argument wi... | stack_v2_sparse_classes_36k_train_008640 | 27,947 | permissive | [
{
"docstring": "initializes an instance of CompositeKeywordArgument. :param str param_name: param name presented in method signature. :param str cli_option_name: relevant cli option name to `param_name`. for example `--message` flag of alembic must be present with the message value itself. :param str separator:... | 2 | null | Implement the Python class `CompositeKeywordArgument` described below.
Class description:
composite keyword argument class. it should be used for composite keyword argument cli options. composite keyword arguments are those that have to emit an argument name with an argument value, note that this type of arguments cou... | Implement the Python class `CompositeKeywordArgument` described below.
Class description:
composite keyword argument class. it should be used for composite keyword argument cli options. composite keyword arguments are those that have to emit an argument name with an argument value, note that this type of arguments cou... | 9d4776498225de4f3d16a4600b5b19212abe8562 | <|skeleton|>
class CompositeKeywordArgument:
"""composite keyword argument class. it should be used for composite keyword argument cli options. composite keyword arguments are those that have to emit an argument name with an argument value, note that this type of arguments could emit a list for a single argument wi... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CompositeKeywordArgument:
"""composite keyword argument class. it should be used for composite keyword argument cli options. composite keyword arguments are those that have to emit an argument name with an argument value, note that this type of arguments could emit a list for a single argument with `--arg` na... | the_stack_v2_python_sparse | src/pyrin/cli/arguments.py | mononobi/pyrin | train | 20 |
7178b04f118b7a96827146d612776936e49a22cb | [
"try:\n return self.find_elem('input[name=\"' + self.comp_name + '\"] + div')\nexcept Exception as ex:\n print('微信录音获取div异常:%s' % ex)\n return 'none'",
"try:\n the_div = self.get_the_div()\n return the_div.find_element_by_css_selector('audio')\nexcept Exception as ex:\n print('微信录音获取div异常:%s' % ... | <|body_start_0|>
try:
return self.find_elem('input[name="' + self.comp_name + '"] + div')
except Exception as ex:
print('微信录音获取div异常:%s' % ex)
return 'none'
<|end_body_0|>
<|body_start_1|>
try:
the_div = self.get_the_div()
return the_d... | SuperRecordPage | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SuperRecordPage:
def get_the_div(self):
"""获取the div"""
<|body_0|>
def get_the_audio(self):
"""获取音频文件"""
<|body_1|>
def check_del_function(self):
"""微信录音功能验证"""
<|body_2|>
def check_del_icon(self):
"""微信录音删除图标是否显示"""
... | stack_v2_sparse_classes_36k_train_008641 | 3,115 | no_license | [
{
"docstring": "获取the div",
"name": "get_the_div",
"signature": "def get_the_div(self)"
},
{
"docstring": "获取音频文件",
"name": "get_the_audio",
"signature": "def get_the_audio(self)"
},
{
"docstring": "微信录音功能验证",
"name": "check_del_function",
"signature": "def check_del_func... | 4 | null | Implement the Python class `SuperRecordPage` described below.
Class description:
Implement the SuperRecordPage class.
Method signatures and docstrings:
- def get_the_div(self): 获取the div
- def get_the_audio(self): 获取音频文件
- def check_del_function(self): 微信录音功能验证
- def check_del_icon(self): 微信录音删除图标是否显示 | Implement the Python class `SuperRecordPage` described below.
Class description:
Implement the SuperRecordPage class.
Method signatures and docstrings:
- def get_the_div(self): 获取the div
- def get_the_audio(self): 获取音频文件
- def check_del_function(self): 微信录音功能验证
- def check_del_icon(self): 微信录音删除图标是否显示
<|skeleton|>
c... | 78768989a79a14013b983024cf6e4838d51ed595 | <|skeleton|>
class SuperRecordPage:
def get_the_div(self):
"""获取the div"""
<|body_0|>
def get_the_audio(self):
"""获取音频文件"""
<|body_1|>
def check_del_function(self):
"""微信录音功能验证"""
<|body_2|>
def check_del_icon(self):
"""微信录音删除图标是否显示"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SuperRecordPage:
def get_the_div(self):
"""获取the div"""
try:
return self.find_elem('input[name="' + self.comp_name + '"] + div')
except Exception as ex:
print('微信录音获取div异常:%s' % ex)
return 'none'
def get_the_audio(self):
"""获取音频文件"""
... | the_stack_v2_python_sparse | test_case/page_obj/form/record_page.py | pylk/pythonSelenium | train | 0 | |
c006e85e62c03a211bdaa96972474d60a7560077 | [
"privilege = win32security.LookupPrivilegeValue(None, 'SeSystemEnvironmentPrivilege')\ntoken = win32security.OpenProcessToken(win32process.GetCurrentProcess(), win32security.TOKEN_READ | win32security.TOKEN_ADJUST_PRIVILEGES)\nwin32security.AdjustTokenPrivileges(token, False, [(privilege, win32security.SE_PRIVILEGE... | <|body_start_0|>
privilege = win32security.LookupPrivilegeValue(None, 'SeSystemEnvironmentPrivilege')
token = win32security.OpenProcessToken(win32process.GetCurrentProcess(), win32security.TOKEN_READ | win32security.TOKEN_ADJUST_PRIVILEGES)
win32security.AdjustTokenPrivileges(token, False, [(pri... | Class to interact with firmware variables. | FirmwareVariables | [
"BSD-2-Clause-Patent"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FirmwareVariables:
"""Class to interact with firmware variables."""
def __init__(self):
"""Constructor."""
<|body_0|>
def get_variable(self, name, guid):
"""Gets a firmware variable. Args: name (str): Name of the variable to get guid (str): GUID of the variable t... | stack_v2_sparse_classes_36k_train_008642 | 19,788 | permissive | [
{
"docstring": "Constructor.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Gets a firmware variable. Args: name (str): Name of the variable to get guid (str): GUID of the variable to get Returns: The value of the variable",
"name": "get_variable",
"signature"... | 2 | stack_v2_sparse_classes_30k_train_009611 | Implement the Python class `FirmwareVariables` described below.
Class description:
Class to interact with firmware variables.
Method signatures and docstrings:
- def __init__(self): Constructor.
- def get_variable(self, name, guid): Gets a firmware variable. Args: name (str): Name of the variable to get guid (str): G... | Implement the Python class `FirmwareVariables` described below.
Class description:
Class to interact with firmware variables.
Method signatures and docstrings:
- def __init__(self): Constructor.
- def get_variable(self, name, guid): Gets a firmware variable. Args: name (str): Name of the variable to get guid (str): G... | 1c397b5ad9ced5820cdcfa63dfea941bf9dabab6 | <|skeleton|>
class FirmwareVariables:
"""Class to interact with firmware variables."""
def __init__(self):
"""Constructor."""
<|body_0|>
def get_variable(self, name, guid):
"""Gets a firmware variable. Args: name (str): Name of the variable to get guid (str): GUID of the variable t... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FirmwareVariables:
"""Class to interact with firmware variables."""
def __init__(self):
"""Constructor."""
privilege = win32security.LookupPrivilegeValue(None, 'SeSystemEnvironmentPrivilege')
token = win32security.OpenProcessToken(win32process.GetCurrentProcess(), win32security.TO... | the_stack_v2_python_sparse | edk2toolext/windows/secureboot/secureboot_audit.py | tianocore/edk2-pytool-extensions | train | 48 |
f27fa8f844fd374a175fd9a1c73a102e9552a32a | [
"self.clusters_count = count\nself._leaders = [i for i in range(count)]\nself._ranks = [0] * count",
"ot = self.find(x)\nto = self.find(y)\nif ot == to:\n return\nself.clusters_count -= 1\nrank_ot = self._ranks[ot]\nrank_to = self._ranks[to]\nif rank_ot == rank_to:\n self._leaders[ot] = to\n self._ranks[... | <|body_start_0|>
self.clusters_count = count
self._leaders = [i for i in range(count)]
self._ranks = [0] * count
<|end_body_0|>
<|body_start_1|>
ot = self.find(x)
to = self.find(y)
if ot == to:
return
self.clusters_count -= 1
rank_ot = self._r... | UnionFind | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UnionFind:
def __init__(self, count):
"""Constructor of the union find structure"""
<|body_0|>
def union(self, x, y):
"""Put x and y into one cluster"""
<|body_1|>
def find(self, i):
"""Find cluster for i"""
<|body_2|>
<|end_skeleton|>
... | stack_v2_sparse_classes_36k_train_008643 | 1,847 | no_license | [
{
"docstring": "Constructor of the union find structure",
"name": "__init__",
"signature": "def __init__(self, count)"
},
{
"docstring": "Put x and y into one cluster",
"name": "union",
"signature": "def union(self, x, y)"
},
{
"docstring": "Find cluster for i",
"name": "find... | 3 | stack_v2_sparse_classes_30k_train_007602 | Implement the Python class `UnionFind` described below.
Class description:
Implement the UnionFind class.
Method signatures and docstrings:
- def __init__(self, count): Constructor of the union find structure
- def union(self, x, y): Put x and y into one cluster
- def find(self, i): Find cluster for i | Implement the Python class `UnionFind` described below.
Class description:
Implement the UnionFind class.
Method signatures and docstrings:
- def __init__(self, count): Constructor of the union find structure
- def union(self, x, y): Put x and y into one cluster
- def find(self, i): Find cluster for i
<|skeleton|>
c... | 8eac3ac57066d3e91f4621abf88264c48ba0f691 | <|skeleton|>
class UnionFind:
def __init__(self, count):
"""Constructor of the union find structure"""
<|body_0|>
def union(self, x, y):
"""Put x and y into one cluster"""
<|body_1|>
def find(self, i):
"""Find cluster for i"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UnionFind:
def __init__(self, count):
"""Constructor of the union find structure"""
self.clusters_count = count
self._leaders = [i for i in range(count)]
self._ranks = [0] * count
def union(self, x, y):
"""Put x and y into one cluster"""
ot = self.find(x)
... | the_stack_v2_python_sparse | Pythoning/computer_science/datatypes/union_find.py | omikad/omikad-stuff | train | 0 | |
1c796288312bdd66c95d780320dd28d8a03a554b | [
"if n == 0:\n return [0]\nresult = ['']\nfor i in range(n):\n result = ['0' + num for num in result] + ['1' + num for num in reversed(result)]\nreturn [int(num, 2) for num in result]",
"result = [0]\nfor i in range(n):\n result += [result[j] | 1 << i for j in range(len(result) - 1, -1, -1)]\nreturn resul... | <|body_start_0|>
if n == 0:
return [0]
result = ['']
for i in range(n):
result = ['0' + num for num in result] + ['1' + num for num in reversed(result)]
return [int(num, 2) for num in result]
<|end_body_0|>
<|body_start_1|>
result = [0]
for i in r... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def grayCode(self, n):
"""Direct implementation of the algorithm described at wikipedia."""
<|body_0|>
def grayCode(self, n):
"""Improved implementation using bitwise operations."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if n == 0:
... | stack_v2_sparse_classes_36k_train_008644 | 918 | no_license | [
{
"docstring": "Direct implementation of the algorithm described at wikipedia.",
"name": "grayCode",
"signature": "def grayCode(self, n)"
},
{
"docstring": "Improved implementation using bitwise operations.",
"name": "grayCode",
"signature": "def grayCode(self, n)"
}
] | 2 | stack_v2_sparse_classes_30k_train_011589 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def grayCode(self, n): Direct implementation of the algorithm described at wikipedia.
- def grayCode(self, n): Improved implementation using bitwise operations. | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def grayCode(self, n): Direct implementation of the algorithm described at wikipedia.
- def grayCode(self, n): Improved implementation using bitwise operations.
<|skeleton|>
cla... | 71b722ddfe8da04572e527b055cf8723d5c87bbf | <|skeleton|>
class Solution:
def grayCode(self, n):
"""Direct implementation of the algorithm described at wikipedia."""
<|body_0|>
def grayCode(self, n):
"""Improved implementation using bitwise operations."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def grayCode(self, n):
"""Direct implementation of the algorithm described at wikipedia."""
if n == 0:
return [0]
result = ['']
for i in range(n):
result = ['0' + num for num in result] + ['1' + num for num in reversed(result)]
return [... | the_stack_v2_python_sparse | Bit_Manipulation/gray_code.py | vladn90/Algorithms | train | 0 | |
2419187dafbed75331e4d65d60f87d3c8d36386c | [
"QWidget.__init__(self, flags=Qt.Widget)\nself.te_1 = QTextEdit()\nself.te_2 = QTextEdit()\nself.te_3 = QTextEdit()\nself.split_1 = QSplitter()\nself.split_2 = QSplitter()\nself.vbox = QVBoxLayout()\nself.container_vbox = QVBoxLayout()\nself.init_widget()",
"self.setWindowTitle('Hello World')\nself.split_1.addWid... | <|body_start_0|>
QWidget.__init__(self, flags=Qt.Widget)
self.te_1 = QTextEdit()
self.te_2 = QTextEdit()
self.te_3 = QTextEdit()
self.split_1 = QSplitter()
self.split_2 = QSplitter()
self.vbox = QVBoxLayout()
self.container_vbox = QVBoxLayout()
sel... | 만들고자 하는 프로그램의 기본이 되는 창 또는 폼 위젯. 본 위젯 위에 다른 위젯을 올려서 모양을 만든다. QWidget을 상속받아서 필요한 메소드를 작성. | Form | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Form:
"""만들고자 하는 프로그램의 기본이 되는 창 또는 폼 위젯. 본 위젯 위에 다른 위젯을 올려서 모양을 만든다. QWidget을 상속받아서 필요한 메소드를 작성."""
def __init__(self):
"""보통 __init__ (생성자)에서 필요한 것들을 다를 위젯들을 선언해줘도 되지만 init_widget을 따로 만들어서 호출한다."""
<|body_0|>
def init_widget(self):
"""현재 위젯의 모양등을 초기화"""
... | stack_v2_sparse_classes_36k_train_008645 | 1,815 | no_license | [
{
"docstring": "보통 __init__ (생성자)에서 필요한 것들을 다를 위젯들을 선언해줘도 되지만 init_widget을 따로 만들어서 호출한다.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "현재 위젯의 모양등을 초기화",
"name": "init_widget",
"signature": "def init_widget(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_019418 | Implement the Python class `Form` described below.
Class description:
만들고자 하는 프로그램의 기본이 되는 창 또는 폼 위젯. 본 위젯 위에 다른 위젯을 올려서 모양을 만든다. QWidget을 상속받아서 필요한 메소드를 작성.
Method signatures and docstrings:
- def __init__(self): 보통 __init__ (생성자)에서 필요한 것들을 다를 위젯들을 선언해줘도 되지만 init_widget을 따로 만들어서 호출한다.
- def init_widget(self): 현재 위젯의... | Implement the Python class `Form` described below.
Class description:
만들고자 하는 프로그램의 기본이 되는 창 또는 폼 위젯. 본 위젯 위에 다른 위젯을 올려서 모양을 만든다. QWidget을 상속받아서 필요한 메소드를 작성.
Method signatures and docstrings:
- def __init__(self): 보통 __init__ (생성자)에서 필요한 것들을 다를 위젯들을 선언해줘도 되지만 init_widget을 따로 만들어서 호출한다.
- def init_widget(self): 현재 위젯의... | 559ad5618eb99368b4da140cb78609bce2d5da71 | <|skeleton|>
class Form:
"""만들고자 하는 프로그램의 기본이 되는 창 또는 폼 위젯. 본 위젯 위에 다른 위젯을 올려서 모양을 만든다. QWidget을 상속받아서 필요한 메소드를 작성."""
def __init__(self):
"""보통 __init__ (생성자)에서 필요한 것들을 다를 위젯들을 선언해줘도 되지만 init_widget을 따로 만들어서 호출한다."""
<|body_0|>
def init_widget(self):
"""현재 위젯의 모양등을 초기화"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Form:
"""만들고자 하는 프로그램의 기본이 되는 창 또는 폼 위젯. 본 위젯 위에 다른 위젯을 올려서 모양을 만든다. QWidget을 상속받아서 필요한 메소드를 작성."""
def __init__(self):
"""보통 __init__ (생성자)에서 필요한 것들을 다를 위젯들을 선언해줘도 되지만 init_widget을 따로 만들어서 호출한다."""
QWidget.__init__(self, flags=Qt.Widget)
self.te_1 = QTextEdit()
self.te_2 ... | the_stack_v2_python_sparse | Python/pyqt5/OpenTutorials_PyQt/QtFramework/QtWidgets/QSplitter/QSplitter_00_basic.py | ghdic/marinelifeirony | train | 6 |
1bc9aa4066fd8fae2ef646c5a1694a0cc88fdc47 | [
"super().__init__(host, port, ssl_channel, ca_file)\nconfiguration()\nself._metadata = Metadata(api_key, secret_key, aud=aud['tts'])\nself._stub = TextToSpeechStub(self._channel)",
"validate(config, config_schema.streaming_synthesize_config_schema)\nrequest = get_proto_synthesize_request(config)\nutterances = get... | <|body_start_0|>
super().__init__(host, port, ssl_channel, ca_file)
configuration()
self._metadata = Metadata(api_key, secret_key, aud=aud['tts'])
self._stub = TextToSpeechStub(self._channel)
<|end_body_0|>
<|body_start_1|>
validate(config, config_schema.streaming_synthesize_con... | ClientTTS | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ClientTTS:
def __init__(self, api_key: str, secret_key: str, host: str=client_config['host_tts'], port: int=client_config['port'], ssl_channel: bool=True, ca_file: str=None):
"""Create client for speech synthesis. :param api_key: client public api key :param secret_key: client secret api... | stack_v2_sparse_classes_36k_train_008646 | 4,664 | permissive | [
{
"docstring": "Create client for speech synthesis. :param api_key: client public api key :param secret_key: client secret api key :param host: Tinkoff Voicekit speech synthesize host url :param port: Tinkoff Voicekit speech synthesize port, default value: 443 :param ca_file: optional certificate file",
"na... | 3 | stack_v2_sparse_classes_30k_train_007822 | Implement the Python class `ClientTTS` described below.
Class description:
Implement the ClientTTS class.
Method signatures and docstrings:
- def __init__(self, api_key: str, secret_key: str, host: str=client_config['host_tts'], port: int=client_config['port'], ssl_channel: bool=True, ca_file: str=None): Create clien... | Implement the Python class `ClientTTS` described below.
Class description:
Implement the ClientTTS class.
Method signatures and docstrings:
- def __init__(self, api_key: str, secret_key: str, host: str=client_config['host_tts'], port: int=client_config['port'], ssl_channel: bool=True, ca_file: str=None): Create clien... | d9103b88cdfa8fc3afb9164bd9dd87a1b6f7f2f5 | <|skeleton|>
class ClientTTS:
def __init__(self, api_key: str, secret_key: str, host: str=client_config['host_tts'], port: int=client_config['port'], ssl_channel: bool=True, ca_file: str=None):
"""Create client for speech synthesis. :param api_key: client public api key :param secret_key: client secret api... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ClientTTS:
def __init__(self, api_key: str, secret_key: str, host: str=client_config['host_tts'], port: int=client_config['port'], ssl_channel: bool=True, ca_file: str=None):
"""Create client for speech synthesis. :param api_key: client public api key :param secret_key: client secret api key :param ho... | the_stack_v2_python_sparse | tinkoff_voicekit_client/TTS/client_tts.py | Morracheg/voicekit_client_python | train | 0 | |
9165c5a71ccd215c255977294871e9c9e6949ae4 | [
"page = int(request.query_params.get('page', 1))\nper_page = int(request.query_params.get('perPage', 10))\nqueryset: QuerySet = User.objects.filter(is_deleted=0).only('user_id', 'name', 'user_type').order_by('-create_time')\nqueryset = queryset[(page - 1) * per_page:page * per_page]\ndata = []\nfor obj in queryset:... | <|body_start_0|>
page = int(request.query_params.get('page', 1))
per_page = int(request.query_params.get('perPage', 10))
queryset: QuerySet = User.objects.filter(is_deleted=0).only('user_id', 'name', 'user_type').order_by('-create_time')
queryset = queryset[(page - 1) * per_page:page * p... | 用户 | UsersView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UsersView:
"""用户"""
def get(self, request: Request, *args, **kwargs) -> JsonResponse:
"""查看用户列表"""
<|body_0|>
def post(self, request: Request, *args, **kwargs) -> JsonResponse:
"""新增用户"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
page = int(r... | stack_v2_sparse_classes_36k_train_008647 | 3,486 | no_license | [
{
"docstring": "查看用户列表",
"name": "get",
"signature": "def get(self, request: Request, *args, **kwargs) -> JsonResponse"
},
{
"docstring": "新增用户",
"name": "post",
"signature": "def post(self, request: Request, *args, **kwargs) -> JsonResponse"
}
] | 2 | stack_v2_sparse_classes_30k_val_000777 | Implement the Python class `UsersView` described below.
Class description:
用户
Method signatures and docstrings:
- def get(self, request: Request, *args, **kwargs) -> JsonResponse: 查看用户列表
- def post(self, request: Request, *args, **kwargs) -> JsonResponse: 新增用户 | Implement the Python class `UsersView` described below.
Class description:
用户
Method signatures and docstrings:
- def get(self, request: Request, *args, **kwargs) -> JsonResponse: 查看用户列表
- def post(self, request: Request, *args, **kwargs) -> JsonResponse: 新增用户
<|skeleton|>
class UsersView:
"""用户"""
def get(... | 53d5ad66adf9391d1abb417b4d1960af6ade3c3a | <|skeleton|>
class UsersView:
"""用户"""
def get(self, request: Request, *args, **kwargs) -> JsonResponse:
"""查看用户列表"""
<|body_0|>
def post(self, request: Request, *args, **kwargs) -> JsonResponse:
"""新增用户"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UsersView:
"""用户"""
def get(self, request: Request, *args, **kwargs) -> JsonResponse:
"""查看用户列表"""
page = int(request.query_params.get('page', 1))
per_page = int(request.query_params.get('perPage', 10))
queryset: QuerySet = User.objects.filter(is_deleted=0).only('user_id',... | the_stack_v2_python_sparse | app_user/views/user.py | sekil9529/django-demo | train | 1 |
d6e38f29f64dd6bca4ef3fbd1af87e04f30ac82d | [
"self.min_sigma = min_sigma\nself.max_sigma = max_sigma\nself.threshold = threshold",
"img = img_as_float(img_array)\npeaks = blob_dog(img, min_sigma=self.min_sigma, max_sigma=self.max_sigma, threshold=self.threshold)\npeaks = peaks[:, [0, 1]] = peaks[:, [1, 0]]\nreturn peaks"
] | <|body_start_0|>
self.min_sigma = min_sigma
self.max_sigma = max_sigma
self.threshold = threshold
<|end_body_0|>
<|body_start_1|>
img = img_as_float(img_array)
peaks = blob_dog(img, min_sigma=self.min_sigma, max_sigma=self.max_sigma, threshold=self.threshold)
peaks = pea... | A class using difference of gaussian to find peaks. It uses skimage blob_dog internally. ... Attributes ---------- min_sigma (float) max_sigma (int) threshold (float) | PeakFinderDifferenceOfGaussian | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PeakFinderDifferenceOfGaussian:
"""A class using difference of gaussian to find peaks. It uses skimage blob_dog internally. ... Attributes ---------- min_sigma (float) max_sigma (int) threshold (float)"""
def __init__(self, min_sigma=0.75, max_sigma=3, threshold=0.1):
"""For more det... | stack_v2_sparse_classes_36k_train_008648 | 4,440 | permissive | [
{
"docstring": "For more detailed information about the parameters in the constructor refer to blob_dog from skimage.feature. Args: min_sigma (float, optional): Defaults to 0.75. max_sigma (int, optional): Defaults to 3. threshold (float, optional): Defaults to 0.1.",
"name": "__init__",
"signature": "d... | 2 | stack_v2_sparse_classes_30k_test_000618 | Implement the Python class `PeakFinderDifferenceOfGaussian` described below.
Class description:
A class using difference of gaussian to find peaks. It uses skimage blob_dog internally. ... Attributes ---------- min_sigma (float) max_sigma (int) threshold (float)
Method signatures and docstrings:
- def __init__(self, ... | Implement the Python class `PeakFinderDifferenceOfGaussian` described below.
Class description:
A class using difference of gaussian to find peaks. It uses skimage blob_dog internally. ... Attributes ---------- min_sigma (float) max_sigma (int) threshold (float)
Method signatures and docstrings:
- def __init__(self, ... | 1358c9817150316be4de6093212ce2f71059d472 | <|skeleton|>
class PeakFinderDifferenceOfGaussian:
"""A class using difference of gaussian to find peaks. It uses skimage blob_dog internally. ... Attributes ---------- min_sigma (float) max_sigma (int) threshold (float)"""
def __init__(self, min_sigma=0.75, max_sigma=3, threshold=0.1):
"""For more det... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PeakFinderDifferenceOfGaussian:
"""A class using difference of gaussian to find peaks. It uses skimage blob_dog internally. ... Attributes ---------- min_sigma (float) max_sigma (int) threshold (float)"""
def __init__(self, min_sigma=0.75, max_sigma=3, threshold=0.1):
"""For more detailed informa... | the_stack_v2_python_sparse | situr/registration/peak_finder.py | 13hannes11/situr | train | 0 |
502a08343ca1c37bf8d5e904a443d77438579842 | [
"if len(candidates) == 0 or not candidates:\n return []\ncandidates.sort()\nself.result = []\nself.dfs(candidates, target, 0, [])\nreturn self.result",
"if target == 0:\n self.result.append(valuelist)\n return\nlength = len(candidates)\nfor i in range(start, length):\n if target < candidates[i]:\n ... | <|body_start_0|>
if len(candidates) == 0 or not candidates:
return []
candidates.sort()
self.result = []
self.dfs(candidates, target, 0, [])
return self.result
<|end_body_0|>
<|body_start_1|>
if target == 0:
self.result.append(valuelist)
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def combinationSum(self, candidates, target):
""":type candidates: List[int] :type target: int :rtype: List[List[int]]"""
<|body_0|>
def dfs(self, candidates, target, start, valuelist):
"""DFS函数第一步一般先判断跳出/返回条件"""
<|body_1|>
<|end_skeleton|>
<|body... | stack_v2_sparse_classes_36k_train_008649 | 2,109 | no_license | [
{
"docstring": ":type candidates: List[int] :type target: int :rtype: List[List[int]]",
"name": "combinationSum",
"signature": "def combinationSum(self, candidates, target)"
},
{
"docstring": "DFS函数第一步一般先判断跳出/返回条件",
"name": "dfs",
"signature": "def dfs(self, candidates, target, start, va... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def combinationSum(self, candidates, target): :type candidates: List[int] :type target: int :rtype: List[List[int]]
- def dfs(self, candidates, target, start, valuelist): DFS函数第一... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def combinationSum(self, candidates, target): :type candidates: List[int] :type target: int :rtype: List[List[int]]
- def dfs(self, candidates, target, start, valuelist): DFS函数第一... | 26e2a812d86b4c09b2917d983df76d3ece69b074 | <|skeleton|>
class Solution:
def combinationSum(self, candidates, target):
""":type candidates: List[int] :type target: int :rtype: List[List[int]]"""
<|body_0|>
def dfs(self, candidates, target, start, valuelist):
"""DFS函数第一步一般先判断跳出/返回条件"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def combinationSum(self, candidates, target):
""":type candidates: List[int] :type target: int :rtype: List[List[int]]"""
if len(candidates) == 0 or not candidates:
return []
candidates.sort()
self.result = []
self.dfs(candidates, target, 0, [])
... | the_stack_v2_python_sparse | DFS_BackTrack/dfs_combinationSum.py | YusiZhang/leetcode-python | train | 1 | |
b811c2e8d1f1ab927488f605837c446dbce56b7c | [
"temple.zhifu = mock.Mock(return_value={'result': 'success', 'reason': 'null'})\nstatues = temple.zhifu_statues()\nprint(statues)\nself.assertEqual(statues, '支付成功')",
"temple.zhifu = mock.Mock(return_value={'result': 'fail', 'reason': '余额不足'})\nstatues = temple.zhifu_statues()\nself.assertEqual(statues, '支付失败')"
... | <|body_start_0|>
temple.zhifu = mock.Mock(return_value={'result': 'success', 'reason': 'null'})
statues = temple.zhifu_statues()
print(statues)
self.assertEqual(statues, '支付成功')
<|end_body_0|>
<|body_start_1|>
temple.zhifu = mock.Mock(return_value={'result': 'fail', 'reason': '余... | 单元测试用例 | Test_zhifu_status | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Test_zhifu_status:
"""单元测试用例"""
def test_01(self):
"""测试支付成功场景"""
<|body_0|>
def test_02(self):
"""测试支付失败场景"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
temple.zhifu = mock.Mock(return_value={'result': 'success', 'reason': 'null'})
st... | stack_v2_sparse_classes_36k_train_008650 | 859 | no_license | [
{
"docstring": "测试支付成功场景",
"name": "test_01",
"signature": "def test_01(self)"
},
{
"docstring": "测试支付失败场景",
"name": "test_02",
"signature": "def test_02(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_002528 | Implement the Python class `Test_zhifu_status` described below.
Class description:
单元测试用例
Method signatures and docstrings:
- def test_01(self): 测试支付成功场景
- def test_02(self): 测试支付失败场景 | Implement the Python class `Test_zhifu_status` described below.
Class description:
单元测试用例
Method signatures and docstrings:
- def test_01(self): 测试支付成功场景
- def test_02(self): 测试支付失败场景
<|skeleton|>
class Test_zhifu_status:
"""单元测试用例"""
def test_01(self):
"""测试支付成功场景"""
<|body_0|>
def tes... | a15213d33a253c3a77ab0d5de9a4f937c27693ca | <|skeleton|>
class Test_zhifu_status:
"""单元测试用例"""
def test_01(self):
"""测试支付成功场景"""
<|body_0|>
def test_02(self):
"""测试支付失败场景"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Test_zhifu_status:
"""单元测试用例"""
def test_01(self):
"""测试支付成功场景"""
temple.zhifu = mock.Mock(return_value={'result': 'success', 'reason': 'null'})
statues = temple.zhifu_statues()
print(statues)
self.assertEqual(statues, '支付成功')
def test_02(self):
"""测试支... | the_stack_v2_python_sparse | 练习题/pay/test_zhifu_statues.py | pod1019/python_learning | train | 0 |
33005c888ad3ac1ce8d1da9c6471d41bbeedcd35 | [
"super().__init__(openuv, sensor_type)\nself._attr_icon = icon\nself._attr_name = name\nself._attr_unit_of_measurement = unit",
"data = self.openuv.data[DATA_UV].get('result')\nif not data:\n self._attr_available = False\n return\nself._attr_available = True\nif self._sensor_type == TYPE_CURRENT_OZONE_LEVEL... | <|body_start_0|>
super().__init__(openuv, sensor_type)
self._attr_icon = icon
self._attr_name = name
self._attr_unit_of_measurement = unit
<|end_body_0|>
<|body_start_1|>
data = self.openuv.data[DATA_UV].get('result')
if not data:
self._attr_available = False... | Define a binary sensor for OpenUV. | OpenUvSensor | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OpenUvSensor:
"""Define a binary sensor for OpenUV."""
def __init__(self, openuv, sensor_type, name, icon, unit):
"""Initialize the sensor."""
<|body_0|>
def update_from_latest_data(self):
"""Update the state."""
<|body_1|>
<|end_skeleton|>
<|body_start... | stack_v2_sparse_classes_36k_train_008651 | 4,483 | permissive | [
{
"docstring": "Initialize the sensor.",
"name": "__init__",
"signature": "def __init__(self, openuv, sensor_type, name, icon, unit)"
},
{
"docstring": "Update the state.",
"name": "update_from_latest_data",
"signature": "def update_from_latest_data(self)"
}
] | 2 | null | Implement the Python class `OpenUvSensor` described below.
Class description:
Define a binary sensor for OpenUV.
Method signatures and docstrings:
- def __init__(self, openuv, sensor_type, name, icon, unit): Initialize the sensor.
- def update_from_latest_data(self): Update the state. | Implement the Python class `OpenUvSensor` described below.
Class description:
Define a binary sensor for OpenUV.
Method signatures and docstrings:
- def __init__(self, openuv, sensor_type, name, icon, unit): Initialize the sensor.
- def update_from_latest_data(self): Update the state.
<|skeleton|>
class OpenUvSensor... | 2fee32fce03bc49e86cf2e7b741a15621a97cce5 | <|skeleton|>
class OpenUvSensor:
"""Define a binary sensor for OpenUV."""
def __init__(self, openuv, sensor_type, name, icon, unit):
"""Initialize the sensor."""
<|body_0|>
def update_from_latest_data(self):
"""Update the state."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class OpenUvSensor:
"""Define a binary sensor for OpenUV."""
def __init__(self, openuv, sensor_type, name, icon, unit):
"""Initialize the sensor."""
super().__init__(openuv, sensor_type)
self._attr_icon = icon
self._attr_name = name
self._attr_unit_of_measurement = unit
... | the_stack_v2_python_sparse | homeassistant/components/openuv/sensor.py | BenWoodford/home-assistant | train | 11 |
4de8f1b4cc95a4fd1e355babe47c3b5e8afb1915 | [
"super().add_arguments(parser)\nparser.add_argument('--simulate', action='store_true', default=False, help='If True it only simulates the command without saving the changes.')\nparser.add_argument('--skip-sync-es', action='store_true', default=False, help='Skips running sync_es after the Companies House load finish... | <|body_start_0|>
super().add_arguments(parser)
parser.add_argument('--simulate', action='store_true', default=False, help='If True it only simulates the command without saving the changes.')
parser.add_argument('--skip-sync-es', action='store_true', default=False, help='Skips running sync_es aft... | Companies House sync command. | Command | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Command:
"""Companies House sync command."""
def add_arguments(self, parser):
"""Define extra arguments."""
<|body_0|>
def handle(self, *args, **options):
"""Handle."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
super().add_arguments(parser)
... | stack_v2_sparse_classes_36k_train_008652 | 9,566 | no_license | [
{
"docstring": "Define extra arguments.",
"name": "add_arguments",
"signature": "def add_arguments(self, parser)"
},
{
"docstring": "Handle.",
"name": "handle",
"signature": "def handle(self, *args, **options)"
}
] | 2 | stack_v2_sparse_classes_30k_train_020197 | Implement the Python class `Command` described below.
Class description:
Companies House sync command.
Method signatures and docstrings:
- def add_arguments(self, parser): Define extra arguments.
- def handle(self, *args, **options): Handle. | Implement the Python class `Command` described below.
Class description:
Companies House sync command.
Method signatures and docstrings:
- def add_arguments(self, parser): Define extra arguments.
- def handle(self, *args, **options): Handle.
<|skeleton|>
class Command:
"""Companies House sync command."""
de... | 7f033fcbcfb2f7c1c0e10bec51620742d3d929df | <|skeleton|>
class Command:
"""Companies House sync command."""
def add_arguments(self, parser):
"""Define extra arguments."""
<|body_0|>
def handle(self, *args, **options):
"""Handle."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Command:
"""Companies House sync command."""
def add_arguments(self, parser):
"""Define extra arguments."""
super().add_arguments(parser)
parser.add_argument('--simulate', action='store_true', default=False, help='If True it only simulates the command without saving the changes.')... | the_stack_v2_python_sparse | datahub/company/management/commands/sync_ch.py | jakub-kozlowski/data-hub-leeloo | train | 0 |
6c90a2de82f2a282ec7417b1974ab998e7d4e8d5 | [
"if ':' in data['ip']:\n data['type'] = 'ipv6'\n data['addr_byte'], data['mask_byte'] = eptSubnet.get_prefix_array('ipv6', data['ip'])\nelse:\n data['type'] = 'ipv4'\n data['addr_byte'], data['mask_byte'] = eptSubnet.get_prefix_array('ipv4', data['ip'])\nreturn data",
"if prefix_type == 'ipv4':\n a... | <|body_start_0|>
if ':' in data['ip']:
data['type'] = 'ipv6'
data['addr_byte'], data['mask_byte'] = eptSubnet.get_prefix_array('ipv6', data['ip'])
else:
data['type'] = 'ipv4'
data['addr_byte'], data['mask_byte'] = eptSubnet.get_prefix_array('ipv4', data['i... | provide subnet to BD vnid mapping for configured subnets | eptSubnet | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class eptSubnet:
"""provide subnet to BD vnid mapping for configured subnets"""
def before_subnet_create(cls, data):
"""before create auto-detect type and update integer value for addr and mask list"""
<|body_0|>
def get_prefix_array(prefix_type, prefix):
"""for ipv4 o... | stack_v2_sparse_classes_36k_train_008653 | 4,138 | permissive | [
{
"docstring": "before create auto-detect type and update integer value for addr and mask list",
"name": "before_subnet_create",
"signature": "def before_subnet_create(cls, data)"
},
{
"docstring": "for ipv4 or ipv6 prefix, return tuple (addr_byte list, mask_byte list)",
"name": "get_prefix_... | 3 | stack_v2_sparse_classes_30k_train_013732 | Implement the Python class `eptSubnet` described below.
Class description:
provide subnet to BD vnid mapping for configured subnets
Method signatures and docstrings:
- def before_subnet_create(cls, data): before create auto-detect type and update integer value for addr and mask list
- def get_prefix_array(prefix_type... | Implement the Python class `eptSubnet` described below.
Class description:
provide subnet to BD vnid mapping for configured subnets
Method signatures and docstrings:
- def before_subnet_create(cls, data): before create auto-detect type and update integer value for addr and mask list
- def get_prefix_array(prefix_type... | a4de84c5fc00549e6539dbc1d8d927c74a704dcc | <|skeleton|>
class eptSubnet:
"""provide subnet to BD vnid mapping for configured subnets"""
def before_subnet_create(cls, data):
"""before create auto-detect type and update integer value for addr and mask list"""
<|body_0|>
def get_prefix_array(prefix_type, prefix):
"""for ipv4 o... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class eptSubnet:
"""provide subnet to BD vnid mapping for configured subnets"""
def before_subnet_create(cls, data):
"""before create auto-detect type and update integer value for addr and mask list"""
if ':' in data['ip']:
data['type'] = 'ipv6'
data['addr_byte'], data['... | the_stack_v2_python_sparse | Service/app/models/aci/ept/ept_subnet.py | Hrishi5/ACI-EnhancedEndpointTracker | train | 0 |
a0bc2b7d6fd3c08d789820eaaaf72394e5e365fc | [
"encoded_claims = None\nfor parameter in challenge.split(','):\n if 'claims=' in parameter:\n if encoded_claims:\n return None\n encoded_claims = parameter[parameter.index('=') + 1:].strip(' \"\\'')\nif not encoded_claims:\n return None\npadding_needed = -len(encoded_claims) % 4\ntry:... | <|body_start_0|>
encoded_claims = None
for parameter in challenge.split(','):
if 'claims=' in parameter:
if encoded_claims:
return None
encoded_claims = parameter[parameter.index('=') + 1:].strip(' "\'')
if not encoded_claims:
... | Adds a bearer token Authorization header to requests. This policy internally handles Continuous Access Evaluation (CAE) challenges. When it can't complete a challenge, it will return the 401 (unauthorized) response from ARM. :param ~azure.core.credentials.TokenCredential credential: credential for authorizing requests ... | AAZARMChallengeAuthenticationPolicy | [
"MIT",
"BSD-3-Clause",
"LGPL-2.0-or-later",
"GPL-1.0-or-later",
"MPL-2.0",
"LGPL-2.1-only",
"Apache-2.0",
"LGPL-2.1-or-later",
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AAZARMChallengeAuthenticationPolicy:
"""Adds a bearer token Authorization header to requests. This policy internally handles Continuous Access Evaluation (CAE) challenges. When it can't complete a challenge, it will return the 401 (unauthorized) response from ARM. :param ~azure.core.credentials.T... | stack_v2_sparse_classes_36k_train_008654 | 9,082 | permissive | [
{
"docstring": "Parse the \"claims\" parameter from an authentication challenge Example challenge with claims: Bearer authorization_uri=\"https://login.windows-ppe.net/\", error=\"invalid_token\", error_description=\"User session has been revoked\", claims=\"eyJhY2Nlc3NfdG9rZW4iOnsibmJmIjp7ImVzc2VudGlhbCI6dHJ1Z... | 2 | null | Implement the Python class `AAZARMChallengeAuthenticationPolicy` described below.
Class description:
Adds a bearer token Authorization header to requests. This policy internally handles Continuous Access Evaluation (CAE) challenges. When it can't complete a challenge, it will return the 401 (unauthorized) response fro... | Implement the Python class `AAZARMChallengeAuthenticationPolicy` described below.
Class description:
Adds a bearer token Authorization header to requests. This policy internally handles Continuous Access Evaluation (CAE) challenges. When it can't complete a challenge, it will return the 401 (unauthorized) response fro... | a40fd14ad0b6e89720a2e58d4d9be3a6ce1535ca | <|skeleton|>
class AAZARMChallengeAuthenticationPolicy:
"""Adds a bearer token Authorization header to requests. This policy internally handles Continuous Access Evaluation (CAE) challenges. When it can't complete a challenge, it will return the 401 (unauthorized) response from ARM. :param ~azure.core.credentials.T... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AAZARMChallengeAuthenticationPolicy:
"""Adds a bearer token Authorization header to requests. This policy internally handles Continuous Access Evaluation (CAE) challenges. When it can't complete a challenge, it will return the 401 (unauthorized) response from ARM. :param ~azure.core.credentials.TokenCredentia... | the_stack_v2_python_sparse | src/azure-cli-core/azure/cli/core/aaz/_http_policy.py | Azure/azure-cli | train | 4,018 |
4f903c18f393ccabaa69660e274fbdf7ffcd110c | [
"self.rating_1_field = rating_1_field\nself.rating_beskrivelse_field = rating_beskrivelse_field\nself.limit_field = limit_field\nself.aktuell_hendelse_field = aktuell_hendelse_field\nself.delb_grunnfakta_field = delb_grunnfakta_field\nself.delb_eier_jurdisk_field = delb_eier_jurdisk_field\nself.delb_okonomi_field =... | <|body_start_0|>
self.rating_1_field = rating_1_field
self.rating_beskrivelse_field = rating_beskrivelse_field
self.limit_field = limit_field
self.aktuell_hendelse_field = aktuell_hendelse_field
self.delb_grunnfakta_field = delb_grunnfakta_field
self.delb_eier_jurdisk_fie... | Implementation of the 'Rating' model. TODO: type model description here. Attributes: rating_1_field (string): TODO: type description here. rating_beskrivelse_field (string): TODO: type description here. limit_field (int): TODO: type description here. aktuell_hendelse_field (string): TODO: type description here. delb_gr... | Rating | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Rating:
"""Implementation of the 'Rating' model. TODO: type model description here. Attributes: rating_1_field (string): TODO: type description here. rating_beskrivelse_field (string): TODO: type description here. limit_field (int): TODO: type description here. aktuell_hendelse_field (string): TO... | stack_v2_sparse_classes_36k_train_008655 | 4,252 | permissive | [
{
"docstring": "Constructor for the Rating class",
"name": "__init__",
"signature": "def __init__(self, rating_1_field=None, rating_beskrivelse_field=None, limit_field=None, aktuell_hendelse_field=None, delb_grunnfakta_field=None, delb_eier_jurdisk_field=None, delb_okonomi_field=None, delb_betalingserfa... | 2 | stack_v2_sparse_classes_30k_train_018305 | Implement the Python class `Rating` described below.
Class description:
Implementation of the 'Rating' model. TODO: type model description here. Attributes: rating_1_field (string): TODO: type description here. rating_beskrivelse_field (string): TODO: type description here. limit_field (int): TODO: type description he... | Implement the Python class `Rating` described below.
Class description:
Implementation of the 'Rating' model. TODO: type model description here. Attributes: rating_1_field (string): TODO: type description here. rating_beskrivelse_field (string): TODO: type description here. limit_field (int): TODO: type description he... | fa3918a6c54ea0eedb9146578645b7eb1755b642 | <|skeleton|>
class Rating:
"""Implementation of the 'Rating' model. TODO: type model description here. Attributes: rating_1_field (string): TODO: type description here. rating_beskrivelse_field (string): TODO: type description here. limit_field (int): TODO: type description here. aktuell_hendelse_field (string): TO... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Rating:
"""Implementation of the 'Rating' model. TODO: type model description here. Attributes: rating_1_field (string): TODO: type description here. rating_beskrivelse_field (string): TODO: type description here. limit_field (int): TODO: type description here. aktuell_hendelse_field (string): TODO: type desc... | the_stack_v2_python_sparse | idfy_rest_client/models/rating.py | dealflowteam/Idfy | train | 0 |
48fe841213e811da2b23a79561973a1687783a06 | [
"alt_url_arr = []\nalt_url_tag = pm_soup.find_all('a', target='_blank')\nfor img_url in alt_url_tag:\n href_url = img_url.get('href')\n if href_url not in alt_url_arr:\n alt_url_arr.append(href_url)\nreturn alt_url_arr",
"alt_name_arr = []\nimg_name = pm_soup.select('a > img')\nfor alt_name in img_na... | <|body_start_0|>
alt_url_arr = []
alt_url_tag = pm_soup.find_all('a', target='_blank')
for img_url in alt_url_tag:
href_url = img_url.get('href')
if href_url not in alt_url_arr:
alt_url_arr.append(href_url)
return alt_url_arr
<|end_body_0|>
<|body... | MZITU | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MZITU:
def get_alt_url(self, pm_soup):
"""查找主页图片链接"""
<|body_0|>
def get_alt_name(self, pm_soup):
"""查找主页图片名字"""
<|body_1|>
def get_num_pags(self, pm_url):
"""获取页数 参数 pm_url 二级链接地址"""
<|body_2|>
def creat_dic(self, pm_alt_name_arr, p... | stack_v2_sparse_classes_36k_train_008656 | 3,573 | no_license | [
{
"docstring": "查找主页图片链接",
"name": "get_alt_url",
"signature": "def get_alt_url(self, pm_soup)"
},
{
"docstring": "查找主页图片名字",
"name": "get_alt_name",
"signature": "def get_alt_name(self, pm_soup)"
},
{
"docstring": "获取页数 参数 pm_url 二级链接地址",
"name": "get_num_pags",
"signatu... | 5 | stack_v2_sparse_classes_30k_test_000549 | Implement the Python class `MZITU` described below.
Class description:
Implement the MZITU class.
Method signatures and docstrings:
- def get_alt_url(self, pm_soup): 查找主页图片链接
- def get_alt_name(self, pm_soup): 查找主页图片名字
- def get_num_pags(self, pm_url): 获取页数 参数 pm_url 二级链接地址
- def creat_dic(self, pm_alt_name_arr, pm_a... | Implement the Python class `MZITU` described below.
Class description:
Implement the MZITU class.
Method signatures and docstrings:
- def get_alt_url(self, pm_soup): 查找主页图片链接
- def get_alt_name(self, pm_soup): 查找主页图片名字
- def get_num_pags(self, pm_url): 获取页数 参数 pm_url 二级链接地址
- def creat_dic(self, pm_alt_name_arr, pm_a... | 636c3f25b48a22cfb41d536b4a5bd0a41ad5a8c6 | <|skeleton|>
class MZITU:
def get_alt_url(self, pm_soup):
"""查找主页图片链接"""
<|body_0|>
def get_alt_name(self, pm_soup):
"""查找主页图片名字"""
<|body_1|>
def get_num_pags(self, pm_url):
"""获取页数 参数 pm_url 二级链接地址"""
<|body_2|>
def creat_dic(self, pm_alt_name_arr, p... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MZITU:
def get_alt_url(self, pm_soup):
"""查找主页图片链接"""
alt_url_arr = []
alt_url_tag = pm_soup.find_all('a', target='_blank')
for img_url in alt_url_tag:
href_url = img_url.get('href')
if href_url not in alt_url_arr:
alt_url_arr.append(href... | the_stack_v2_python_sparse | python爬虫/demo5.py | dction123/Python | train | 0 | |
dc9c4a2fdc2d15ddbc132c6e14cea001cd148e5c | [
"memo = dict()\n\ndef dp(K, N) -> int:\n if K == 1:\n return N\n if N == 0:\n return 0\n if (K, N) in memo:\n return memo[K, N]\n res = float('INF')\n for i in range(1, N + 1):\n res = min(res, max(dp(K, N - i), dp(K - 1, i - 1)) + 1)\n memo[K, N] = res\n return res\... | <|body_start_0|>
memo = dict()
def dp(K, N) -> int:
if K == 1:
return N
if N == 0:
return 0
if (K, N) in memo:
return memo[K, N]
res = float('INF')
for i in range(1, N + 1):
res =... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def superEggDrop(self, K: int, N: int) -> int:
"""动态规划:dp(K, N)就是当前拥有的鸡蛋数K和需要测试的楼层数N labuladong:https://mp.weixin.qq.com/s?__biz=MzAxODQxMDM0Mw==&mid=2247484675&idx=1&sn=4a4ac1c0f1279530b42fedacc6cca6e6&chksm=9bd7fb0baca0721dda1eaa1d00b9a520672dc9d5c3be762eeca869be35d7ce232922b... | stack_v2_sparse_classes_36k_train_008657 | 7,716 | permissive | [
{
"docstring": "动态规划:dp(K, N)就是当前拥有的鸡蛋数K和需要测试的楼层数N labuladong:https://mp.weixin.qq.com/s?__biz=MzAxODQxMDM0Mw==&mid=2247484675&idx=1&sn=4a4ac1c0f1279530b42fedacc6cca6e6&chksm=9bd7fb0baca0721dda1eaa1d00b9a520672dc9d5c3be762eeca869be35d7ce232922ba8e928b&scene=21#wechat_redirect",
"name": "superEggDrop",
"... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def superEggDrop(self, K: int, N: int) -> int: 动态规划:dp(K, N)就是当前拥有的鸡蛋数K和需要测试的楼层数N labuladong:https://mp.weixin.qq.com/s?__biz=MzAxODQxMDM0Mw==&mid=2247484675&idx=1&sn=4a4ac1c0f12... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def superEggDrop(self, K: int, N: int) -> int: 动态规划:dp(K, N)就是当前拥有的鸡蛋数K和需要测试的楼层数N labuladong:https://mp.weixin.qq.com/s?__biz=MzAxODQxMDM0Mw==&mid=2247484675&idx=1&sn=4a4ac1c0f12... | e8a1c6cae6547cbcb6e8494be6df685f3e7c837c | <|skeleton|>
class Solution:
def superEggDrop(self, K: int, N: int) -> int:
"""动态规划:dp(K, N)就是当前拥有的鸡蛋数K和需要测试的楼层数N labuladong:https://mp.weixin.qq.com/s?__biz=MzAxODQxMDM0Mw==&mid=2247484675&idx=1&sn=4a4ac1c0f1279530b42fedacc6cca6e6&chksm=9bd7fb0baca0721dda1eaa1d00b9a520672dc9d5c3be762eeca869be35d7ce232922b... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def superEggDrop(self, K: int, N: int) -> int:
"""动态规划:dp(K, N)就是当前拥有的鸡蛋数K和需要测试的楼层数N labuladong:https://mp.weixin.qq.com/s?__biz=MzAxODQxMDM0Mw==&mid=2247484675&idx=1&sn=4a4ac1c0f1279530b42fedacc6cca6e6&chksm=9bd7fb0baca0721dda1eaa1d00b9a520672dc9d5c3be762eeca869be35d7ce232922ba8e928b&scene=... | the_stack_v2_python_sparse | 887-super-egg-drop.py | yuenliou/leetcode | train | 0 | |
4010046c1b41cb806dd79aace2acc5f4329fedf7 | [
"self.__completed = 0\nself.__total = float(total)\nself.__prefix = prefix\nself.__suffix = suffix\nself.__decimals = decimals\nself.__bar_length = bar_length\nself.__fill = fill",
"if self.__completed != self.__total:\n remaining = self.__total - self.__completed\n self.__completed = self.__completed + pro... | <|body_start_0|>
self.__completed = 0
self.__total = float(total)
self.__prefix = prefix
self.__suffix = suffix
self.__decimals = decimals
self.__bar_length = bar_length
self.__fill = fill
<|end_body_0|>
<|body_start_1|>
if self.__completed != self.__tota... | Helper class to create a terminal progress bar | ProgressBar | [
"BSD-3-Clause",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProgressBar:
"""Helper class to create a terminal progress bar"""
def __init__(self, total, prefix='', suffix='', decimals=1, bar_length=50, fill='#'):
"""Initialize the progressBar :param total: (Required) total iterations, the goal :param prefix: (Optional) prefix string that will ... | stack_v2_sparse_classes_36k_train_008658 | 6,493 | permissive | [
{
"docstring": "Initialize the progressBar :param total: (Required) total iterations, the goal :param prefix: (Optional) prefix string that will show before the progress bar :param suffix: (Optional) suffix string that will show after the progress bar :param decimals: (Optional) positive number of decimals in p... | 2 | stack_v2_sparse_classes_30k_train_014894 | Implement the Python class `ProgressBar` described below.
Class description:
Helper class to create a terminal progress bar
Method signatures and docstrings:
- def __init__(self, total, prefix='', suffix='', decimals=1, bar_length=50, fill='#'): Initialize the progressBar :param total: (Required) total iterations, th... | Implement the Python class `ProgressBar` described below.
Class description:
Helper class to create a terminal progress bar
Method signatures and docstrings:
- def __init__(self, total, prefix='', suffix='', decimals=1, bar_length=50, fill='#'): Initialize the progressBar :param total: (Required) total iterations, th... | 20d8df6172906337f81583dabb841d66b8f31857 | <|skeleton|>
class ProgressBar:
"""Helper class to create a terminal progress bar"""
def __init__(self, total, prefix='', suffix='', decimals=1, bar_length=50, fill='#'):
"""Initialize the progressBar :param total: (Required) total iterations, the goal :param prefix: (Optional) prefix string that will ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ProgressBar:
"""Helper class to create a terminal progress bar"""
def __init__(self, total, prefix='', suffix='', decimals=1, bar_length=50, fill='#'):
"""Initialize the progressBar :param total: (Required) total iterations, the goal :param prefix: (Optional) prefix string that will show before t... | the_stack_v2_python_sparse | new_algs/Graph+algorithms/Coloring+algorithm/DataCrawl-windows.py | coolsnake/JupyterNotebook | train | 0 |
44b819dfe19122868d3f208fdf445d9b9ad91dae | [
"self.is_endpoint_valid(self.request.path)\npath = self.sanitize_path(self.request.get_full_path())\npath = self.append_credentials(path)\nr = requests.get('https://services.datafordeler.dk' + path)\nresponse = HttpResponse(r.content, status=r.status_code)\nexcluded_headers = ['connection', 'content-encoding', 'con... | <|body_start_0|>
self.is_endpoint_valid(self.request.path)
path = self.sanitize_path(self.request.get_full_path())
path = self.append_credentials(path)
r = requests.get('https://services.datafordeler.dk' + path)
response = HttpResponse(r.content, status=r.status_code)
exc... | Proxy for Datafordeler map service. Created so we can show maps without leaking the IP of our visitors. | MapProxyView | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MapProxyView:
"""Proxy for Datafordeler map service. Created so we can show maps without leaking the IP of our visitors."""
def get(self, *args, **kwargs):
"""Before we make the request we check that the path is in our whitelist. Before we return the response we copy headers except f... | stack_v2_sparse_classes_36k_train_008659 | 3,504 | permissive | [
{
"docstring": "Before we make the request we check that the path is in our whitelist. Before we return the response we copy headers except for a list we dont want.",
"name": "get",
"signature": "def get(self, *args, **kwargs)"
},
{
"docstring": "Validate request path against whitelisted endpoin... | 4 | stack_v2_sparse_classes_30k_train_006831 | Implement the Python class `MapProxyView` described below.
Class description:
Proxy for Datafordeler map service. Created so we can show maps without leaking the IP of our visitors.
Method signatures and docstrings:
- def get(self, *args, **kwargs): Before we make the request we check that the path is in our whitelis... | Implement the Python class `MapProxyView` described below.
Class description:
Proxy for Datafordeler map service. Created so we can show maps without leaking the IP of our visitors.
Method signatures and docstrings:
- def get(self, *args, **kwargs): Before we make the request we check that the path is in our whitelis... | 767deb7f58429e9162e0c2ef79be9f0f38f37ce1 | <|skeleton|>
class MapProxyView:
"""Proxy for Datafordeler map service. Created so we can show maps without leaking the IP of our visitors."""
def get(self, *args, **kwargs):
"""Before we make the request we check that the path is in our whitelist. Before we return the response we copy headers except f... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MapProxyView:
"""Proxy for Datafordeler map service. Created so we can show maps without leaking the IP of our visitors."""
def get(self, *args, **kwargs):
"""Before we make the request we check that the path is in our whitelist. Before we return the response we copy headers except for a list we ... | the_stack_v2_python_sparse | src/maps/views.py | bornhack/bornhack-website | train | 9 |
10618d8a39ddf338bb856a86dfe491a24df399fb | [
"super(LocationReader, self).__init__(*args, **kwargs)\nself.location_indexes = []\nself.chromosome_list = []\nif 'chromosome_list' in kwargs.keys():\n self.chromosome_list = kwargs['chromosome_list']\nself.labels = [None, None, None]\nif 'label_chr' in kwargs.keys():\n self.labels[0] = kwargs['label_chr']\ni... | <|body_start_0|>
super(LocationReader, self).__init__(*args, **kwargs)
self.location_indexes = []
self.chromosome_list = []
if 'chromosome_list' in kwargs.keys():
self.chromosome_list = kwargs['chromosome_list']
self.labels = [None, None, None]
if 'label_chr' ... | LocationReader adds location data to a header. Wraps a table object associate a Location to the values. | LocationReader | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LocationReader:
"""LocationReader adds location data to a header. Wraps a table object associate a Location to the values."""
def __init__(self, *args, **kwargs):
"""__init__ creates a new LocationParser."""
<|body_0|>
def next(self):
"""Return the next element."... | stack_v2_sparse_classes_36k_train_008660 | 5,320 | permissive | [
{
"docstring": "__init__ creates a new LocationParser.",
"name": "__init__",
"signature": "def __init__(self, *args, **kwargs)"
},
{
"docstring": "Return the next element.",
"name": "next",
"signature": "def next(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_021107 | Implement the Python class `LocationReader` described below.
Class description:
LocationReader adds location data to a header. Wraps a table object associate a Location to the values.
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): __init__ creates a new LocationParser.
- def next(self): Retu... | Implement the Python class `LocationReader` described below.
Class description:
LocationReader adds location data to a header. Wraps a table object associate a Location to the values.
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): __init__ creates a new LocationParser.
- def next(self): Retu... | bbf7ca288d798d8f1c6156ddf45fed31892bd557 | <|skeleton|>
class LocationReader:
"""LocationReader adds location data to a header. Wraps a table object associate a Location to the values."""
def __init__(self, *args, **kwargs):
"""__init__ creates a new LocationParser."""
<|body_0|>
def next(self):
"""Return the next element."... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LocationReader:
"""LocationReader adds location data to a header. Wraps a table object associate a Location to the values."""
def __init__(self, *args, **kwargs):
"""__init__ creates a new LocationParser."""
super(LocationReader, self).__init__(*args, **kwargs)
self.location_index... | the_stack_v2_python_sparse | table/Location/reader.py | DenverN3/Nimbus | train | 0 |
fffcfa947cfa1bbd7db1966c11c4435ba9860d05 | [
"try:\n search = SavedSearch.objects.get(project=project, id=search_id)\nexcept SavedSearch.DoesNotExist:\n raise ResourceDoesNotExist\nreturn Response(serialize(search, request.user))",
"try:\n search = SavedSearch.objects.get(project=project, id=search_id)\nexcept SavedSearch.DoesNotExist:\n raise R... | <|body_start_0|>
try:
search = SavedSearch.objects.get(project=project, id=search_id)
except SavedSearch.DoesNotExist:
raise ResourceDoesNotExist
return Response(serialize(search, request.user))
<|end_body_0|>
<|body_start_1|>
try:
search = SavedSearc... | ProjectSearchDetailsEndpoint | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProjectSearchDetailsEndpoint:
def get(self, request, project, search_id):
"""Retrieve a saved search Return details on an individual saved search. {method} {path}"""
<|body_0|>
def put(self, request, project, search_id):
"""Update a saved search Update a saved search... | stack_v2_sparse_classes_36k_train_008661 | 3,530 | permissive | [
{
"docstring": "Retrieve a saved search Return details on an individual saved search. {method} {path}",
"name": "get",
"signature": "def get(self, request, project, search_id)"
},
{
"docstring": "Update a saved search Update a saved search. {method} {path} {{ \"name: \"Unresolved\", \"query\": \... | 3 | stack_v2_sparse_classes_30k_train_008999 | Implement the Python class `ProjectSearchDetailsEndpoint` described below.
Class description:
Implement the ProjectSearchDetailsEndpoint class.
Method signatures and docstrings:
- def get(self, request, project, search_id): Retrieve a saved search Return details on an individual saved search. {method} {path}
- def pu... | Implement the Python class `ProjectSearchDetailsEndpoint` described below.
Class description:
Implement the ProjectSearchDetailsEndpoint class.
Method signatures and docstrings:
- def get(self, request, project, search_id): Retrieve a saved search Return details on an individual saved search. {method} {path}
- def pu... | b937615079d7b24dc225a83b99b1b65da932fc66 | <|skeleton|>
class ProjectSearchDetailsEndpoint:
def get(self, request, project, search_id):
"""Retrieve a saved search Return details on an individual saved search. {method} {path}"""
<|body_0|>
def put(self, request, project, search_id):
"""Update a saved search Update a saved search... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ProjectSearchDetailsEndpoint:
def get(self, request, project, search_id):
"""Retrieve a saved search Return details on an individual saved search. {method} {path}"""
try:
search = SavedSearch.objects.get(project=project, id=search_id)
except SavedSearch.DoesNotExist:
... | the_stack_v2_python_sparse | src/sentry/api/endpoints/project_search_details.py | atlassian/sentry | train | 1 | |
5516f104d579041073dde85424c61342ecb70b3e | [
"user = UserProfile.objects.get(user=self.request.user)\nbid = get_object_or_404(Bid, user=user, id=pk, status=Bid.Status.draft)\nif user.bidlist.filter(status=Bid.Status.submitted, bidcycle=bid.bidcycle).count() >= Bid.MAXIMUM_SUBMITTED_BIDS:\n return Response({'detail': 'Submitted bid limit exceeded.'}, status... | <|body_start_0|>
user = UserProfile.objects.get(user=self.request.user)
bid = get_object_or_404(Bid, user=user, id=pk, status=Bid.Status.draft)
if user.bidlist.filter(status=Bid.Status.submitted, bidcycle=bid.bidcycle).count() >= Bid.MAXIMUM_SUBMITTED_BIDS:
return Response({'detail':... | Supports all bidder actions for a bid | BidListBidderActionView | [
"CC0-1.0",
"LicenseRef-scancode-public-domain"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BidListBidderActionView:
"""Supports all bidder actions for a bid"""
def submit(self, request, pk, format=None):
"""Submits a bid Returns 204 if the action is a success"""
<|body_0|>
def accept_handshake(self, request, pk, format=None):
"""Accepts a handshake for... | stack_v2_sparse_classes_36k_train_008662 | 5,772 | permissive | [
{
"docstring": "Submits a bid Returns 204 if the action is a success",
"name": "submit",
"signature": "def submit(self, request, pk, format=None)"
},
{
"docstring": "Accepts a handshake for a bid Returns 204 if the action is a success",
"name": "accept_handshake",
"signature": "def accep... | 3 | stack_v2_sparse_classes_30k_train_016150 | Implement the Python class `BidListBidderActionView` described below.
Class description:
Supports all bidder actions for a bid
Method signatures and docstrings:
- def submit(self, request, pk, format=None): Submits a bid Returns 204 if the action is a success
- def accept_handshake(self, request, pk, format=None): Ac... | Implement the Python class `BidListBidderActionView` described below.
Class description:
Supports all bidder actions for a bid
Method signatures and docstrings:
- def submit(self, request, pk, format=None): Submits a bid Returns 204 if the action is a success
- def accept_handshake(self, request, pk, format=None): Ac... | cf71acd2ea0957aa2d599da8e1185d8519d8b013 | <|skeleton|>
class BidListBidderActionView:
"""Supports all bidder actions for a bid"""
def submit(self, request, pk, format=None):
"""Submits a bid Returns 204 if the action is a success"""
<|body_0|>
def accept_handshake(self, request, pk, format=None):
"""Accepts a handshake for... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BidListBidderActionView:
"""Supports all bidder actions for a bid"""
def submit(self, request, pk, format=None):
"""Submits a bid Returns 204 if the action is a success"""
user = UserProfile.objects.get(user=self.request.user)
bid = get_object_or_404(Bid, user=user, id=pk, status=... | the_stack_v2_python_sparse | talentmap_api/bidding/views/bid.py | 18F/State-TalentMAP-API | train | 5 |
5e14428d64985553340d17bbd8968272164cf654 | [
"successor = None\nwhile root:\n if p.val < root.val:\n successor = root\n root = root.left\n else:\n root = root.right\nreturn successor",
"if not root:\n return None\nif root == p:\n node = root.right\n while node and node.left:\n node = node.left\n return node\neli... | <|body_start_0|>
successor = None
while root:
if p.val < root.val:
successor = root
root = root.left
else:
root = root.right
return successor
<|end_body_0|>
<|body_start_1|>
if not root:
return None
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def inorderSuccessor(self, root, p):
""":type root: TreeNode :type p: TreeNode :rtype: TreeNode"""
<|body_0|>
def inorderSuccessor_recursive(self, root, p):
""":type root: TreeNode :type p: TreeNode :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|>
... | stack_v2_sparse_classes_36k_train_008663 | 2,142 | no_license | [
{
"docstring": ":type root: TreeNode :type p: TreeNode :rtype: TreeNode",
"name": "inorderSuccessor",
"signature": "def inorderSuccessor(self, root, p)"
},
{
"docstring": ":type root: TreeNode :type p: TreeNode :rtype: TreeNode",
"name": "inorderSuccessor_recursive",
"signature": "def in... | 2 | stack_v2_sparse_classes_30k_train_016015 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def inorderSuccessor(self, root, p): :type root: TreeNode :type p: TreeNode :rtype: TreeNode
- def inorderSuccessor_recursive(self, root, p): :type root: TreeNode :type p: TreeNo... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def inorderSuccessor(self, root, p): :type root: TreeNode :type p: TreeNode :rtype: TreeNode
- def inorderSuccessor_recursive(self, root, p): :type root: TreeNode :type p: TreeNo... | e60ba45fe2f2e5e3b3abfecec3db76f5ce1fde59 | <|skeleton|>
class Solution:
def inorderSuccessor(self, root, p):
""":type root: TreeNode :type p: TreeNode :rtype: TreeNode"""
<|body_0|>
def inorderSuccessor_recursive(self, root, p):
""":type root: TreeNode :type p: TreeNode :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def inorderSuccessor(self, root, p):
""":type root: TreeNode :type p: TreeNode :rtype: TreeNode"""
successor = None
while root:
if p.val < root.val:
successor = root
root = root.left
else:
root = root.rig... | the_stack_v2_python_sparse | src/lt_285.py | oxhead/CodingYourWay | train | 0 | |
6b5e7be9613c16b13e9f1e6e1feaa9b528316d81 | [
"super().__init__(*args, **kwargs)\ntry:\n self.idp_hint_param_names = config['allowed_params']\nexcept KeyError:\n raise SATOSAConfigurationError(f\"{self.__class__.__name__} can't find allowed_params\")",
"target_entity_id = context.get_decoration(context.KEY_TARGET_ENTITYID)\nqs_params = context.qs_param... | <|body_start_0|>
super().__init__(*args, **kwargs)
try:
self.idp_hint_param_names = config['allowed_params']
except KeyError:
raise SATOSAConfigurationError(f"{self.__class__.__name__} can't find allowed_params")
<|end_body_0|>
<|body_start_1|>
target_entity_id =... | Detect if an idp hinting feature have been requested | IdpHinting | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IdpHinting:
"""Detect if an idp hinting feature have been requested"""
def __init__(self, config, *args, **kwargs):
"""Constructor. :param config: microservice configuration :type config: Dict[str, Dict[str, str]]"""
<|body_0|>
def process(self, context, data):
"... | stack_v2_sparse_classes_36k_train_008664 | 1,773 | permissive | [
{
"docstring": "Constructor. :param config: microservice configuration :type config: Dict[str, Dict[str, str]]",
"name": "__init__",
"signature": "def __init__(self, config, *args, **kwargs)"
},
{
"docstring": "This intercepts if idp_hint paramenter is in use :param context: request context :par... | 2 | stack_v2_sparse_classes_30k_train_002716 | Implement the Python class `IdpHinting` described below.
Class description:
Detect if an idp hinting feature have been requested
Method signatures and docstrings:
- def __init__(self, config, *args, **kwargs): Constructor. :param config: microservice configuration :type config: Dict[str, Dict[str, str]]
- def process... | Implement the Python class `IdpHinting` described below.
Class description:
Detect if an idp hinting feature have been requested
Method signatures and docstrings:
- def __init__(self, config, *args, **kwargs): Constructor. :param config: microservice configuration :type config: Dict[str, Dict[str, str]]
- def process... | d5cac7fc150807f3a42b4ec5942679dd9622cc97 | <|skeleton|>
class IdpHinting:
"""Detect if an idp hinting feature have been requested"""
def __init__(self, config, *args, **kwargs):
"""Constructor. :param config: microservice configuration :type config: Dict[str, Dict[str, str]]"""
<|body_0|>
def process(self, context, data):
"... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class IdpHinting:
"""Detect if an idp hinting feature have been requested"""
def __init__(self, config, *args, **kwargs):
"""Constructor. :param config: microservice configuration :type config: Dict[str, Dict[str, str]]"""
super().__init__(*args, **kwargs)
try:
self.idp_hint... | the_stack_v2_python_sparse | src/satosa/micro_services/idp_hinting.py | IdentityPython/SATOSA | train | 139 |
6a8d51385bc02d017f1e248dc33e066d50abc2d2 | [
"self.nodes_count = n\nself.graph = [[] for _ in range(n)]\nfor rib, rib_weight in pairs:\n self.graph[rib[0] - 1].append((rib[1] - 1, rib_weight))",
"cur_node = [np.inf, 0]\nfor i in range(self.nodes_count):\n if d[i] < cur_node[0] and (not used[i]):\n cur_node = [d[i], i]\nreturn (cur_node, d, used... | <|body_start_0|>
self.nodes_count = n
self.graph = [[] for _ in range(n)]
for rib, rib_weight in pairs:
self.graph[rib[0] - 1].append((rib[1] - 1, rib_weight))
<|end_body_0|>
<|body_start_1|>
cur_node = [np.inf, 0]
for i in range(self.nodes_count):
if d[i... | Dijkstra | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Dijkstra:
def __init__(self, pairs, n):
"""Create graph for dijkstra algorithm :param pairs: :return:"""
<|body_0|>
def __find_next_node(self, d, used):
"""Find next node with min weight :param d: :param used: :return:"""
<|body_1|>
def solve(self, start... | stack_v2_sparse_classes_36k_train_008665 | 2,687 | no_license | [
{
"docstring": "Create graph for dijkstra algorithm :param pairs: :return:",
"name": "__init__",
"signature": "def __init__(self, pairs, n)"
},
{
"docstring": "Find next node with min weight :param d: :param used: :return:",
"name": "__find_next_node",
"signature": "def __find_next_node(... | 3 | stack_v2_sparse_classes_30k_train_016862 | Implement the Python class `Dijkstra` described below.
Class description:
Implement the Dijkstra class.
Method signatures and docstrings:
- def __init__(self, pairs, n): Create graph for dijkstra algorithm :param pairs: :return:
- def __find_next_node(self, d, used): Find next node with min weight :param d: :param us... | Implement the Python class `Dijkstra` described below.
Class description:
Implement the Dijkstra class.
Method signatures and docstrings:
- def __init__(self, pairs, n): Create graph for dijkstra algorithm :param pairs: :return:
- def __find_next_node(self, d, used): Find next node with min weight :param d: :param us... | e672e0232ba7978107ab9fac2624e5bccf5f6a46 | <|skeleton|>
class Dijkstra:
def __init__(self, pairs, n):
"""Create graph for dijkstra algorithm :param pairs: :return:"""
<|body_0|>
def __find_next_node(self, d, used):
"""Find next node with min weight :param d: :param used: :return:"""
<|body_1|>
def solve(self, start... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Dijkstra:
def __init__(self, pairs, n):
"""Create graph for dijkstra algorithm :param pairs: :return:"""
self.nodes_count = n
self.graph = [[] for _ in range(n)]
for rib, rib_weight in pairs:
self.graph[rib[0] - 1].append((rib[1] - 1, rib_weight))
def __find_ne... | the_stack_v2_python_sparse | SAiIO/src/dijkstra.py | qqpoltergeist/BSUIR-IITP-2016-2020 | train | 0 | |
a00fc6d07cb60a3a3ff75183be0e754ea03f68fe | [
"user = SupportRequest.target_user(request)\nif user.is_support_staff:\n sr = SupportRequest.get_current(self.request, as_obj=True)\n user = sr.user\ndata = self.serializer_class(user).data\nif user.is_advisor:\n role = 'advisor'\n data['advisor'] = AdvisorSerializer(user.advisor).data\nelif user.is_cli... | <|body_start_0|>
user = SupportRequest.target_user(request)
if user.is_support_staff:
sr = SupportRequest.get_current(self.request, as_obj=True)
user = sr.user
data = self.serializer_class(user).data
if user.is_advisor:
role = 'advisor'
dat... | MeView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MeView:
def get(self, request):
"""--- # Swagger response_serializer: serializers.UserSerializer"""
<|body_0|>
def put(self, request):
"""--- # Swagger request_serializer: serializers.UserUpdateSerializer response_serializer: serializers.UserSerializer"""
<|b... | stack_v2_sparse_classes_36k_train_008666 | 15,651 | no_license | [
{
"docstring": "--- # Swagger response_serializer: serializers.UserSerializer",
"name": "get",
"signature": "def get(self, request)"
},
{
"docstring": "--- # Swagger request_serializer: serializers.UserUpdateSerializer response_serializer: serializers.UserSerializer",
"name": "put",
"sig... | 2 | null | Implement the Python class `MeView` described below.
Class description:
Implement the MeView class.
Method signatures and docstrings:
- def get(self, request): --- # Swagger response_serializer: serializers.UserSerializer
- def put(self, request): --- # Swagger request_serializer: serializers.UserUpdateSerializer res... | Implement the Python class `MeView` described below.
Class description:
Implement the MeView class.
Method signatures and docstrings:
- def get(self, request): --- # Swagger response_serializer: serializers.UserSerializer
- def put(self, request): --- # Swagger request_serializer: serializers.UserUpdateSerializer res... | fa31fa82505c3d0fbc54bd8436cfc0e49c896f3e | <|skeleton|>
class MeView:
def get(self, request):
"""--- # Swagger response_serializer: serializers.UserSerializer"""
<|body_0|>
def put(self, request):
"""--- # Swagger request_serializer: serializers.UserUpdateSerializer response_serializer: serializers.UserSerializer"""
<|b... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MeView:
def get(self, request):
"""--- # Swagger response_serializer: serializers.UserSerializer"""
user = SupportRequest.target_user(request)
if user.is_support_staff:
sr = SupportRequest.get_current(self.request, as_obj=True)
user = sr.user
data = self... | the_stack_v2_python_sparse | api/v1/user/views.py | WealthCity/django-project | train | 0 | |
42d1706789a6fd65c652127cba0347966b3d120d | [
"def _generate(open, close, str, l=[]):\n if open == 0 and close == 0:\n l.append(str)\n if open > 0:\n _generate(open - 1, close + 1, str + '(', l)\n if close > 0:\n _generate(open, close - 1, str + ')', l)\n return l\nreturn _generate(n, 0, '')",
"res = []\n\ndef is_valid(s):\n ... | <|body_start_0|>
def _generate(open, close, str, l=[]):
if open == 0 and close == 0:
l.append(str)
if open > 0:
_generate(open - 1, close + 1, str + '(', l)
if close > 0:
_generate(open, close - 1, str + ')', l)
retu... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def generateParenthesis(self, n: int) -> List[str]:
"""Recursively generate all possible parenthesis. For each open paranthesis, there must be a close paranthesis. At first, we have n opens at hand and we try to use them all. When all open&closed pars are left, we add the strin... | stack_v2_sparse_classes_36k_train_008667 | 1,685 | no_license | [
{
"docstring": "Recursively generate all possible parenthesis. For each open paranthesis, there must be a close paranthesis. At first, we have n opens at hand and we try to use them all. When all open&closed pars are left, we add the string to the result.",
"name": "generateParenthesis",
"signature": "d... | 3 | stack_v2_sparse_classes_30k_train_011931 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def generateParenthesis(self, n: int) -> List[str]: Recursively generate all possible parenthesis. For each open paranthesis, there must be a close paranthesis. At first, we have... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def generateParenthesis(self, n: int) -> List[str]: Recursively generate all possible parenthesis. For each open paranthesis, there must be a close paranthesis. At first, we have... | 9a0e41d2d718803eb297430995e464fcab472a55 | <|skeleton|>
class Solution:
def generateParenthesis(self, n: int) -> List[str]:
"""Recursively generate all possible parenthesis. For each open paranthesis, there must be a close paranthesis. At first, we have n opens at hand and we try to use them all. When all open&closed pars are left, we add the strin... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def generateParenthesis(self, n: int) -> List[str]:
"""Recursively generate all possible parenthesis. For each open paranthesis, there must be a close paranthesis. At first, we have n opens at hand and we try to use them all. When all open&closed pars are left, we add the string to the resul... | the_stack_v2_python_sparse | leetcode/22.py | evinpinar/competitive_python | train | 0 | |
5e82b59132f7279265b6712ae549b847369b4f9a | [
"name: str = inputs['name']\nsmiles: str = inputs['smiles']\npyrosetta.distributed.maybe_init(extra_options=self.init_options)\ntry:\n binary_hits = inputs['binary_hits']\n hits: List[Chem.Mol] = [hit for hit in map(unbinarize, binary_hits) if hit]\n assert len(hits) > 0, 'No valid hits!'\n victor = sel... | <|body_start_0|>
name: str = inputs['name']
smiles: str = inputs['smiles']
pyrosetta.distributed.maybe_init(extra_options=self.init_options)
try:
binary_hits = inputs['binary_hits']
hits: List[Chem.Mol] = [hit for hit in map(unbinarize, binary_hits) if hit]
... | LabPlace | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LabPlace:
def place_subprocess(self, inputs: BinPlacementInput):
"""This is the placement subprocess. The combination subprocess is ``place_subprocess``. They are very similar..."""
<|body_0|>
def place(self, queries: Union[pd.DataFrame, Sequence[MolPlacementInput]], expand_... | stack_v2_sparse_classes_36k_train_008668 | 4,640 | permissive | [
{
"docstring": "This is the placement subprocess. The combination subprocess is ``place_subprocess``. They are very similar...",
"name": "place_subprocess",
"signature": "def place_subprocess(self, inputs: BinPlacementInput)"
},
{
"docstring": "Due to the way Monster works merging A with B may y... | 2 | null | Implement the Python class `LabPlace` described below.
Class description:
Implement the LabPlace class.
Method signatures and docstrings:
- def place_subprocess(self, inputs: BinPlacementInput): This is the placement subprocess. The combination subprocess is ``place_subprocess``. They are very similar...
- def place(... | Implement the Python class `LabPlace` described below.
Class description:
Implement the LabPlace class.
Method signatures and docstrings:
- def place_subprocess(self, inputs: BinPlacementInput): This is the placement subprocess. The combination subprocess is ``place_subprocess``. They are very similar...
- def place(... | c03945c089beec35b7aabb83dc1efd9cc57ac281 | <|skeleton|>
class LabPlace:
def place_subprocess(self, inputs: BinPlacementInput):
"""This is the placement subprocess. The combination subprocess is ``place_subprocess``. They are very similar..."""
<|body_0|>
def place(self, queries: Union[pd.DataFrame, Sequence[MolPlacementInput]], expand_... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LabPlace:
def place_subprocess(self, inputs: BinPlacementInput):
"""This is the placement subprocess. The combination subprocess is ``place_subprocess``. They are very similar..."""
name: str = inputs['name']
smiles: str = inputs['smiles']
pyrosetta.distributed.maybe_init(extra... | the_stack_v2_python_sparse | fragmenstein/laboratory/_place.py | matteoferla/Fragmenstein | train | 120 | |
d59b7a5f85c6a06f0deaf1343ac2b35a3fdd1997 | [
"self.num_units = num_units\nself.kernel_size = kernel_size\nself.stride = stride",
"with tf.variable_scope(scope or type(self).__name__):\n input_dim = int(inputs.get_shape()[2])\n stddev = 1 / input_dim ** 0.5\n w = tf.get_variable('filter', [self.kernel_size, input_dim, self.num_units], initializer=tf... | <|body_start_0|>
self.num_units = num_units
self.kernel_size = kernel_size
self.stride = stride
<|end_body_0|>
<|body_start_1|>
with tf.variable_scope(scope or type(self).__name__):
input_dim = int(inputs.get_shape()[2])
stddev = 1 / input_dim ** 0.5
... | a 1-D convolutional layer | Conv1dLayer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Conv1dLayer:
"""a 1-D convolutional layer"""
def __init__(self, num_units, kernel_size, stride):
"""constructor Args: num_units: the number of filters kernel_size: the size of the filters stride: the stride of the convolution"""
<|body_0|>
def __call__(self, inputs, seq_... | stack_v2_sparse_classes_36k_train_008669 | 11,183 | permissive | [
{
"docstring": "constructor Args: num_units: the number of filters kernel_size: the size of the filters stride: the stride of the convolution",
"name": "__init__",
"signature": "def __init__(self, num_units, kernel_size, stride)"
},
{
"docstring": "Create the variables and do the forward computa... | 2 | stack_v2_sparse_classes_30k_train_004203 | Implement the Python class `Conv1dLayer` described below.
Class description:
a 1-D convolutional layer
Method signatures and docstrings:
- def __init__(self, num_units, kernel_size, stride): constructor Args: num_units: the number of filters kernel_size: the size of the filters stride: the stride of the convolution
-... | Implement the Python class `Conv1dLayer` described below.
Class description:
a 1-D convolutional layer
Method signatures and docstrings:
- def __init__(self, num_units, kernel_size, stride): constructor Args: num_units: the number of filters kernel_size: the size of the filters stride: the stride of the convolution
-... | fb530cf617ff86fe8a249d4582dfe90a303da295 | <|skeleton|>
class Conv1dLayer:
"""a 1-D convolutional layer"""
def __init__(self, num_units, kernel_size, stride):
"""constructor Args: num_units: the number of filters kernel_size: the size of the filters stride: the stride of the convolution"""
<|body_0|>
def __call__(self, inputs, seq_... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Conv1dLayer:
"""a 1-D convolutional layer"""
def __init__(self, num_units, kernel_size, stride):
"""constructor Args: num_units: the number of filters kernel_size: the size of the filters stride: the stride of the convolution"""
self.num_units = num_units
self.kernel_size = kernel... | the_stack_v2_python_sparse | nabu/neuralnetworks/classifiers/layer.py | DavidKarlas/nabu | train | 1 |
6a55778884f01902814ae792c7eaf01e9a3206ec | [
"s1, s2 = ([], [])\nfor v1 in S:\n if v1 != '#':\n s1.append(v1)\n elif len(s1) != 0:\n s1.pop()\nfor v2 in T:\n if v2 != '#':\n s2.append(v2)\n elif len(s2) != 0:\n s2.pop()\nreturn ''.join(s1) == ''.join(s2)",
"def f(input_str):\n skip = 0\n for s in reversed(input_... | <|body_start_0|>
s1, s2 = ([], [])
for v1 in S:
if v1 != '#':
s1.append(v1)
elif len(s1) != 0:
s1.pop()
for v2 in T:
if v2 != '#':
s2.append(v2)
elif len(s2) != 0:
s2.pop()
ret... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def backspaceCompare2(self, S, T):
""":type S: str :type T: str :rtype: bool"""
<|body_0|>
def backspaceCompare(self, S, T):
""":type S: str :type T: str :rtype: bool"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
s1, s2 = ([], [])
... | stack_v2_sparse_classes_36k_train_008670 | 954 | no_license | [
{
"docstring": ":type S: str :type T: str :rtype: bool",
"name": "backspaceCompare2",
"signature": "def backspaceCompare2(self, S, T)"
},
{
"docstring": ":type S: str :type T: str :rtype: bool",
"name": "backspaceCompare",
"signature": "def backspaceCompare(self, S, T)"
}
] | 2 | stack_v2_sparse_classes_30k_train_000827 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def backspaceCompare2(self, S, T): :type S: str :type T: str :rtype: bool
- def backspaceCompare(self, S, T): :type S: str :type T: str :rtype: bool | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def backspaceCompare2(self, S, T): :type S: str :type T: str :rtype: bool
- def backspaceCompare(self, S, T): :type S: str :type T: str :rtype: bool
<|skeleton|>
class Solution:... | 77ee7186a918cf865a038d9da5ae71e0aa6b64dc | <|skeleton|>
class Solution:
def backspaceCompare2(self, S, T):
""":type S: str :type T: str :rtype: bool"""
<|body_0|>
def backspaceCompare(self, S, T):
""":type S: str :type T: str :rtype: bool"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def backspaceCompare2(self, S, T):
""":type S: str :type T: str :rtype: bool"""
s1, s2 = ([], [])
for v1 in S:
if v1 != '#':
s1.append(v1)
elif len(s1) != 0:
s1.pop()
for v2 in T:
if v2 != '#':
... | the_stack_v2_python_sparse | 874-backspace-string-compare/solution.py | GoingMyWay/LeetCode | train | 2 | |
33f8363ce5b1bafaf6c830e8665c80f834104607 | [
"q = quantity.Pressure(1.0, 'Pa')\nself.assertAlmostEqual(q.value, 1.0, 6)\nself.assertAlmostEqual(q.value_si, 1.0, delta=1e-06)\nself.assertEqual(q.units, 'Pa')",
"q = quantity.Pressure(1.0, 'bar')\nself.assertAlmostEqual(q.value, 1.0, 6)\nself.assertAlmostEqual(q.value_si, 100000.0, delta=1e-06)\nself.assertEqu... | <|body_start_0|>
q = quantity.Pressure(1.0, 'Pa')
self.assertAlmostEqual(q.value, 1.0, 6)
self.assertAlmostEqual(q.value_si, 1.0, delta=1e-06)
self.assertEqual(q.units, 'Pa')
<|end_body_0|>
<|body_start_1|>
q = quantity.Pressure(1.0, 'bar')
self.assertAlmostEqual(q.value... | Contains unit tests of the Pressure unit type object. | TestPressure | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestPressure:
"""Contains unit tests of the Pressure unit type object."""
def test_pa(self):
"""Test the creation of a pressure quantity with units of Pa."""
<|body_0|>
def test_bar(self):
"""Test the creation of a pressure quantity with units of bar."""
... | stack_v2_sparse_classes_36k_train_008671 | 49,563 | permissive | [
{
"docstring": "Test the creation of a pressure quantity with units of Pa.",
"name": "test_pa",
"signature": "def test_pa(self)"
},
{
"docstring": "Test the creation of a pressure quantity with units of bar.",
"name": "test_bar",
"signature": "def test_bar(self)"
},
{
"docstring"... | 5 | null | Implement the Python class `TestPressure` described below.
Class description:
Contains unit tests of the Pressure unit type object.
Method signatures and docstrings:
- def test_pa(self): Test the creation of a pressure quantity with units of Pa.
- def test_bar(self): Test the creation of a pressure quantity with unit... | Implement the Python class `TestPressure` described below.
Class description:
Contains unit tests of the Pressure unit type object.
Method signatures and docstrings:
- def test_pa(self): Test the creation of a pressure quantity with units of Pa.
- def test_bar(self): Test the creation of a pressure quantity with unit... | 349a4af759cf8877197772cd7eaca1e51d46eff5 | <|skeleton|>
class TestPressure:
"""Contains unit tests of the Pressure unit type object."""
def test_pa(self):
"""Test the creation of a pressure quantity with units of Pa."""
<|body_0|>
def test_bar(self):
"""Test the creation of a pressure quantity with units of bar."""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestPressure:
"""Contains unit tests of the Pressure unit type object."""
def test_pa(self):
"""Test the creation of a pressure quantity with units of Pa."""
q = quantity.Pressure(1.0, 'Pa')
self.assertAlmostEqual(q.value, 1.0, 6)
self.assertAlmostEqual(q.value_si, 1.0, de... | the_stack_v2_python_sparse | rmgpy/quantityTest.py | CanePan-cc/CanePanWorkshop | train | 2 |
812496bf433164a1884cb31f3017717d8c94a4c6 | [
"if context is None:\n context = {}\nres = {}\nfor stock_picking in self.browse(cr, uid, ids, context=context):\n res[stock_picking.id] = False\n if stock_picking.purchase_id and stock_picking.purchase_id.sale_order_id:\n res[stock_picking.id] = True\nreturn res",
"picking_id = ids and ids[0] or F... | <|body_start_0|>
if context is None:
context = {}
res = {}
for stock_picking in self.browse(cr, uid, ids, context=context):
res[stock_picking.id] = False
if stock_picking.purchase_id and stock_picking.purchase_id.sale_order_id:
res[stock_pickin... | stock_picking_in | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class stock_picking_in:
def _get_is_edi(self, cr, uid, ids, name, args, context=None):
"""This method will return if the picking is or not an edi picking"""
<|body_0|>
def action_process(self, cr, uid, ids, context=None):
"""Inherit the action process method. If this picki... | stack_v2_sparse_classes_36k_train_008672 | 19,840 | no_license | [
{
"docstring": "This method will return if the picking is or not an edi picking",
"name": "_get_is_edi",
"signature": "def _get_is_edi(self, cr, uid, ids, name, args, context=None)"
},
{
"docstring": "Inherit the action process method. If this picking is an edi and the related picking is not don... | 2 | stack_v2_sparse_classes_30k_test_000435 | Implement the Python class `stock_picking_in` described below.
Class description:
Implement the stock_picking_in class.
Method signatures and docstrings:
- def _get_is_edi(self, cr, uid, ids, name, args, context=None): This method will return if the picking is or not an edi picking
- def action_process(self, cr, uid,... | Implement the Python class `stock_picking_in` described below.
Class description:
Implement the stock_picking_in class.
Method signatures and docstrings:
- def _get_is_edi(self, cr, uid, ids, name, args, context=None): This method will return if the picking is or not an edi picking
- def action_process(self, cr, uid,... | 3e35f7ba7246c54e5a5b31921b28aa5f1ab24999 | <|skeleton|>
class stock_picking_in:
def _get_is_edi(self, cr, uid, ids, name, args, context=None):
"""This method will return if the picking is or not an edi picking"""
<|body_0|>
def action_process(self, cr, uid, ids, context=None):
"""Inherit the action process method. If this picki... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class stock_picking_in:
def _get_is_edi(self, cr, uid, ids, name, args, context=None):
"""This method will return if the picking is or not an edi picking"""
if context is None:
context = {}
res = {}
for stock_picking in self.browse(cr, uid, ids, context=context):
... | the_stack_v2_python_sparse | intercompany_warehouse/stock.py | mgielissen/julius-openobject-addons | train | 1 | |
ce9dcd435605bd89892bc471d41d7936957b4d26 | [
"if isinstance(key, int):\n return ClassificationLevel(key)\nif key not in ClassificationLevel._member_map_:\n return extend_enum(ClassificationLevel, key, default)\nreturn ClassificationLevel[key]",
"if not (isinstance(value, int) and 0 <= value <= 255):\n raise ValueError('%r is not a valid %s' % (valu... | <|body_start_0|>
if isinstance(key, int):
return ClassificationLevel(key)
if key not in ClassificationLevel._member_map_:
return extend_enum(ClassificationLevel, key, default)
return ClassificationLevel[key]
<|end_body_0|>
<|body_start_1|>
if not (isinstance(valu... | [ClassificationLevel] Classification Level Encodings | ClassificationLevel | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ClassificationLevel:
"""[ClassificationLevel] Classification Level Encodings"""
def get(key: 'int | str', default: 'int'=-1) -> 'ClassificationLevel':
"""Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:"""
... | stack_v2_sparse_classes_36k_train_008673 | 1,882 | permissive | [
{
"docstring": "Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:",
"name": "get",
"signature": "def get(key: 'int | str', default: 'int'=-1) -> 'ClassificationLevel'"
},
{
"docstring": "Lookup function used when value is no... | 2 | null | Implement the Python class `ClassificationLevel` described below.
Class description:
[ClassificationLevel] Classification Level Encodings
Method signatures and docstrings:
- def get(key: 'int | str', default: 'int'=-1) -> 'ClassificationLevel': Backport support for original codes. Args: key: Key to get enum item. def... | Implement the Python class `ClassificationLevel` described below.
Class description:
[ClassificationLevel] Classification Level Encodings
Method signatures and docstrings:
- def get(key: 'int | str', default: 'int'=-1) -> 'ClassificationLevel': Backport support for original codes. Args: key: Key to get enum item. def... | a6fe49ec58f09e105bec5a00fb66d9b3f22730d9 | <|skeleton|>
class ClassificationLevel:
"""[ClassificationLevel] Classification Level Encodings"""
def get(key: 'int | str', default: 'int'=-1) -> 'ClassificationLevel':
"""Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ClassificationLevel:
"""[ClassificationLevel] Classification Level Encodings"""
def get(key: 'int | str', default: 'int'=-1) -> 'ClassificationLevel':
"""Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:"""
if isinsta... | the_stack_v2_python_sparse | pcapkit/const/ipv4/classification_level.py | JarryShaw/PyPCAPKit | train | 204 |
13faae550a4f408fcabffbe45a858c3803a2f863 | [
"title = request.POST['title']\nnew_properties = json.loads(request.POST.get('newProperties', '[]'))\ntemplate = mall_models.ProductPropertyTemplate.objects.create(owner=request.manager, name=title)\nfor property in new_properties:\n if property['id'] < 0:\n mall_models.TemplateProperty.objects.create(own... | <|body_start_0|>
title = request.POST['title']
new_properties = json.loads(request.POST.get('newProperties', '[]'))
template = mall_models.ProductPropertyTemplate.objects.create(owner=request.manager, name=title)
for property in new_properties:
if property['id'] < 0:
... | Property | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Property:
def api_put(request):
"""创建属性模板 Args: title: 属性模板标题 newProperties 属性模板中需要新建的property信息的json字符串 Example: { 'title': 'aaa', 'newProperties':[ { id: -1, //id=-1, 代表需要新建的属性 name: "属性1", value: "属性1的描述" }, ... ] }"""
<|body_0|>
def api_post(request):
"""更新属性模板 A... | stack_v2_sparse_classes_36k_train_008674 | 5,912 | no_license | [
{
"docstring": "创建属性模板 Args: title: 属性模板标题 newProperties 属性模板中需要新建的property信息的json字符串 Example: { 'title': 'aaa', 'newProperties':[ { id: -1, //id=-1, 代表需要新建的属性 name: \"属性1\", value: \"属性1的描述\" }, ... ] }",
"name": "api_put",
"signature": "def api_put(request)"
},
{
"docstring": "更新属性模板 Args: id:... | 3 | stack_v2_sparse_classes_30k_train_017127 | Implement the Python class `Property` described below.
Class description:
Implement the Property class.
Method signatures and docstrings:
- def api_put(request): 创建属性模板 Args: title: 属性模板标题 newProperties 属性模板中需要新建的property信息的json字符串 Example: { 'title': 'aaa', 'newProperties':[ { id: -1, //id=-1, 代表需要新建的属性 name: "属性1",... | Implement the Python class `Property` described below.
Class description:
Implement the Property class.
Method signatures and docstrings:
- def api_put(request): 创建属性模板 Args: title: 属性模板标题 newProperties 属性模板中需要新建的property信息的json字符串 Example: { 'title': 'aaa', 'newProperties':[ { id: -1, //id=-1, 代表需要新建的属性 name: "属性1",... | 8b2f7befe92841bcc35e0e60cac5958ef3f3af54 | <|skeleton|>
class Property:
def api_put(request):
"""创建属性模板 Args: title: 属性模板标题 newProperties 属性模板中需要新建的property信息的json字符串 Example: { 'title': 'aaa', 'newProperties':[ { id: -1, //id=-1, 代表需要新建的属性 name: "属性1", value: "属性1的描述" }, ... ] }"""
<|body_0|>
def api_post(request):
"""更新属性模板 A... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Property:
def api_put(request):
"""创建属性模板 Args: title: 属性模板标题 newProperties 属性模板中需要新建的property信息的json字符串 Example: { 'title': 'aaa', 'newProperties':[ { id: -1, //id=-1, 代表需要新建的属性 name: "属性1", value: "属性1的描述" }, ... ] }"""
title = request.POST['title']
new_properties = json.loads(reques... | the_stack_v2_python_sparse | weapp/mall/product/properties.py | chengdg/weizoom | train | 1 | |
c31f4dc06c1a4569916ddf278e08d0ff343ccbbe | [
"cards = Card.many_from_text('AsTdTs5sAc5cQd')\nhand = BestHandEval7(cards)\nself.assertEqual(str(hand), 'two pair, Aces and Tens')",
"hand1 = BestHandEval7(Card.many_from_text('AsTdTs5sAc5cQd'))\nhand2 = BestHandEval7(Card.many_from_text('AsTdTs5sAc5cJd'))\nself.assertTrue(hand1 > hand2)"
] | <|body_start_0|>
cards = Card.many_from_text('AsTdTs5sAc5cQd')
hand = BestHandEval7(cards)
self.assertEqual(str(hand), 'two pair, Aces and Tens')
<|end_body_0|>
<|body_start_1|>
hand1 = BestHandEval7(Card.many_from_text('AsTdTs5sAc5cQd'))
hand2 = BestHandEval7(Card.many_from_tex... | Unit tests for BestHandEval7 | Test | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Test:
"""Unit tests for BestHandEval7"""
def test_description(self):
"""Test BestHandEval7 to string"""
<|body_0|>
def test_compare(self):
"""Test BestHandEval7 compare"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
cards = Card.many_from_text(... | stack_v2_sparse_classes_36k_train_008675 | 1,314 | no_license | [
{
"docstring": "Test BestHandEval7 to string",
"name": "test_description",
"signature": "def test_description(self)"
},
{
"docstring": "Test BestHandEval7 compare",
"name": "test_compare",
"signature": "def test_compare(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_014364 | Implement the Python class `Test` described below.
Class description:
Unit tests for BestHandEval7
Method signatures and docstrings:
- def test_description(self): Test BestHandEval7 to string
- def test_compare(self): Test BestHandEval7 compare | Implement the Python class `Test` described below.
Class description:
Unit tests for BestHandEval7
Method signatures and docstrings:
- def test_description(self): Test BestHandEval7 to string
- def test_compare(self): Test BestHandEval7 compare
<|skeleton|>
class Test:
"""Unit tests for BestHandEval7"""
def... | 1b94df3b3c4f83920ad68d605e0dc7a2a265f5f6 | <|skeleton|>
class Test:
"""Unit tests for BestHandEval7"""
def test_description(self):
"""Test BestHandEval7 to string"""
<|body_0|>
def test_compare(self):
"""Test BestHandEval7 compare"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Test:
"""Unit tests for BestHandEval7"""
def test_description(self):
"""Test BestHandEval7 to string"""
cards = Card.many_from_text('AsTdTs5sAc5cQd')
hand = BestHandEval7(cards)
self.assertEqual(str(hand), 'two pair, Aces and Tens')
def test_compare(self):
"""... | the_stack_v2_python_sparse | rvr/poker/evaluate.py | RangeVsRange/range-vs-range | train | 8 |
8784258c18c3f1c5c5f3f22bcc24532c325726a9 | [
"nodes = []\nfor inst in self.op.instances:\n if inst.iallocator is not None:\n raise errors.OpPrereqError('iallocator are not allowed to be set on instance objects', errors.ECODE_INVAL)\n nodes.append(bool(inst.pnode))\n if inst.disk_template in constants.DTS_INT_MIRROR:\n nodes.append(bool(... | <|body_start_0|>
nodes = []
for inst in self.op.instances:
if inst.iallocator is not None:
raise errors.OpPrereqError('iallocator are not allowed to be set on instance objects', errors.ECODE_INVAL)
nodes.append(bool(inst.pnode))
if inst.disk_template i... | Allocates multiple instances at the same time. | LUInstanceMultiAlloc | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LUInstanceMultiAlloc:
"""Allocates multiple instances at the same time."""
def CheckArguments(self):
"""Check arguments."""
<|body_0|>
def ExpandNames(self):
"""Calculate the locks."""
<|body_1|>
def CheckPrereq(self):
"""Check prerequisite."... | stack_v2_sparse_classes_36k_train_008676 | 31,763 | permissive | [
{
"docstring": "Check arguments.",
"name": "CheckArguments",
"signature": "def CheckArguments(self)"
},
{
"docstring": "Calculate the locks.",
"name": "ExpandNames",
"signature": "def ExpandNames(self)"
},
{
"docstring": "Check prerequisite.",
"name": "CheckPrereq",
"sign... | 5 | null | Implement the Python class `LUInstanceMultiAlloc` described below.
Class description:
Allocates multiple instances at the same time.
Method signatures and docstrings:
- def CheckArguments(self): Check arguments.
- def ExpandNames(self): Calculate the locks.
- def CheckPrereq(self): Check prerequisite.
- def _Construc... | Implement the Python class `LUInstanceMultiAlloc` described below.
Class description:
Allocates multiple instances at the same time.
Method signatures and docstrings:
- def CheckArguments(self): Check arguments.
- def ExpandNames(self): Calculate the locks.
- def CheckPrereq(self): Check prerequisite.
- def _Construc... | 456ea285a7583183c2c8e5bcffe9006ec8a9d658 | <|skeleton|>
class LUInstanceMultiAlloc:
"""Allocates multiple instances at the same time."""
def CheckArguments(self):
"""Check arguments."""
<|body_0|>
def ExpandNames(self):
"""Calculate the locks."""
<|body_1|>
def CheckPrereq(self):
"""Check prerequisite."... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LUInstanceMultiAlloc:
"""Allocates multiple instances at the same time."""
def CheckArguments(self):
"""Check arguments."""
nodes = []
for inst in self.op.instances:
if inst.iallocator is not None:
raise errors.OpPrereqError('iallocator are not allowed ... | the_stack_v2_python_sparse | lib/cmdlib/instance.py | ganeti/ganeti | train | 465 |
e1e04b0521fbfa40d4fe5c1d49e2575dca0c59e3 | [
"self.tree = tree\nself.goal = goal\nif not self.goal.fingerprint:\n self.goal.fingerprint = theorem_fingerprint.Fingerprint(goal)\nself.index = index\nif parent is not None:\n self.parents = [parent]\nelse:\n self.parents = []\nself.successful_attempts = []\nself.failed_attempts = []\nself.closed = None\n... | <|body_start_0|>
self.tree = tree
self.goal = goal
if not self.goal.fingerprint:
self.goal.fingerprint = theorem_fingerprint.Fingerprint(goal)
self.index = index
if parent is not None:
self.parents = [parent]
else:
self.parents = []
... | Node in the proof tree, corresponding to one goal. | ProofSearchNode | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProofSearchNode:
"""Node in the proof tree, corresponding to one goal."""
def __init__(self, tree: ProofSearchTree, index: int, goal: proof_assistant_pb2.Theorem, parent: Optional[SubGoalRef]=None):
"""Constructor for a Node within proof search. Each node represents a goal or subgoal... | stack_v2_sparse_classes_36k_train_008677 | 25,964 | permissive | [
{
"docstring": "Constructor for a Node within proof search. Each node represents a goal or subgoal with one or multiple proof attempts. Proof attempts are tactic_applications that can generate one or multiple subgoals. Args: tree: The ProofSearchTree object to which this node belongs. index: Index of this node ... | 5 | null | Implement the Python class `ProofSearchNode` described below.
Class description:
Node in the proof tree, corresponding to one goal.
Method signatures and docstrings:
- def __init__(self, tree: ProofSearchTree, index: int, goal: proof_assistant_pb2.Theorem, parent: Optional[SubGoalRef]=None): Constructor for a Node wi... | Implement the Python class `ProofSearchNode` described below.
Class description:
Node in the proof tree, corresponding to one goal.
Method signatures and docstrings:
- def __init__(self, tree: ProofSearchTree, index: int, goal: proof_assistant_pb2.Theorem, parent: Optional[SubGoalRef]=None): Constructor for a Node wi... | c526cc957be0f6067ef9de1ea18f3e8bbc3be0e8 | <|skeleton|>
class ProofSearchNode:
"""Node in the proof tree, corresponding to one goal."""
def __init__(self, tree: ProofSearchTree, index: int, goal: proof_assistant_pb2.Theorem, parent: Optional[SubGoalRef]=None):
"""Constructor for a Node within proof search. Each node represents a goal or subgoal... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ProofSearchNode:
"""Node in the proof tree, corresponding to one goal."""
def __init__(self, tree: ProofSearchTree, index: int, goal: proof_assistant_pb2.Theorem, parent: Optional[SubGoalRef]=None):
"""Constructor for a Node within proof search. Each node represents a goal or subgoal with one or ... | the_stack_v2_python_sparse | deepmath/deephol/proof_search_tree.py | magualas/deepmath | train | 1 |
d321c427cf27cd6d2f3264f14c277bd5f70b3118 | [
"if not root:\n return []\nrow_values = []\nrow_values = self.build_values_list([root], row_values)\nresult = [max(row) for row in row_values]\nreturn result",
"if not nodes:\n return collected_values_list\nelse:\n row_values = []\n node_children = []\n for node in nodes:\n row_values.append... | <|body_start_0|>
if not root:
return []
row_values = []
row_values = self.build_values_list([root], row_values)
result = [max(row) for row in row_values]
return result
<|end_body_0|>
<|body_start_1|>
if not nodes:
return collected_values_list
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def largestValues(self, root):
""":type root: TreeNode :rtype: List[int]"""
<|body_0|>
def build_values_list(self, nodes, collected_values_list):
"""Builds a list of values for the given list of nodes. Meant to traverse a tree and collect all the values as ... | stack_v2_sparse_classes_36k_train_008678 | 1,791 | no_license | [
{
"docstring": ":type root: TreeNode :rtype: List[int]",
"name": "largestValues",
"signature": "def largestValues(self, root)"
},
{
"docstring": "Builds a list of values for the given list of nodes. Meant to traverse a tree and collect all the values as a list of lists where each list is a row: ... | 3 | stack_v2_sparse_classes_30k_train_004648 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def largestValues(self, root): :type root: TreeNode :rtype: List[int]
- def build_values_list(self, nodes, collected_values_list): Builds a list of values for the given list of n... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def largestValues(self, root): :type root: TreeNode :rtype: List[int]
- def build_values_list(self, nodes, collected_values_list): Builds a list of values for the given list of n... | 1f498d19a4cf96b00df8d9d901992bd4d2f83097 | <|skeleton|>
class Solution:
def largestValues(self, root):
""":type root: TreeNode :rtype: List[int]"""
<|body_0|>
def build_values_list(self, nodes, collected_values_list):
"""Builds a list of values for the given list of nodes. Meant to traverse a tree and collect all the values as ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def largestValues(self, root):
""":type root: TreeNode :rtype: List[int]"""
if not root:
return []
row_values = []
row_values = self.build_values_list([root], row_values)
result = [max(row) for row in row_values]
return result
def buil... | the_stack_v2_python_sparse | 5--/515/python3/solution.py | scott-mcnulty/leetcode | train | 0 | |
68f44addfb9163bb2696f511e6bb58378f22e780 | [
"try:\n if self.id is None:\n return self.query.all()\n if self.id is not None and type(self.id) is int and (self.id >= 0):\n return self.query.get(self.id)\nexcept Exception as e:\n return e.__cause__.args[1]",
"try:\n db.session.add(self)\n return db.session.commit()\nexcept Excepti... | <|body_start_0|>
try:
if self.id is None:
return self.query.all()
if self.id is not None and type(self.id) is int and (self.id >= 0):
return self.query.get(self.id)
except Exception as e:
return e.__cause__.args[1]
<|end_body_0|>
<|bod... | Using to create a cache [description] Extends: db.Model Variables: __tablename__ {str} -- [table name in database] id {[int]} -- [The id of cache] key {[string(255)]} -- [The key value of cache] value {[text]} -- [The value of key in cache] expiration {[int]} -- [The expiration] | Cache | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Cache:
"""Using to create a cache [description] Extends: db.Model Variables: __tablename__ {str} -- [table name in database] id {[int]} -- [The id of cache] key {[string(255)]} -- [The key value of cache] value {[text]} -- [The value of key in cache] expiration {[int]} -- [The expiration]"""
... | stack_v2_sparse_classes_36k_train_008679 | 5,599 | no_license | [
{
"docstring": "[summary] [description] Keyword Arguments: id {[type]} -- [description] (default: {None}) Returns: [None] -- [When successed] [Message] -- [When failed]",
"name": "get",
"signature": "def get(self)"
},
{
"docstring": "[summary] [description] Arguments: key {[type]} -- [descriptio... | 3 | stack_v2_sparse_classes_30k_train_006680 | Implement the Python class `Cache` described below.
Class description:
Using to create a cache [description] Extends: db.Model Variables: __tablename__ {str} -- [table name in database] id {[int]} -- [The id of cache] key {[string(255)]} -- [The key value of cache] value {[text]} -- [The value of key in cache] expirat... | Implement the Python class `Cache` described below.
Class description:
Using to create a cache [description] Extends: db.Model Variables: __tablename__ {str} -- [table name in database] id {[int]} -- [The id of cache] key {[string(255)]} -- [The key value of cache] value {[text]} -- [The value of key in cache] expirat... | 052956e5006f7d274d19a43b061c2fe4a6456cc0 | <|skeleton|>
class Cache:
"""Using to create a cache [description] Extends: db.Model Variables: __tablename__ {str} -- [table name in database] id {[int]} -- [The id of cache] key {[string(255)]} -- [The key value of cache] value {[text]} -- [The value of key in cache] expiration {[int]} -- [The expiration]"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Cache:
"""Using to create a cache [description] Extends: db.Model Variables: __tablename__ {str} -- [table name in database] id {[int]} -- [The id of cache] key {[string(255)]} -- [The key value of cache] value {[text]} -- [The value of key in cache] expiration {[int]} -- [The expiration]"""
def get(self... | the_stack_v2_python_sparse | models/cache.py | BoTranVan/statuspage | train | 0 |
1a17a1fb65e8aa5095a4d5390410177fd2aa74e6 | [
"if not hasattr(self, '_cfg'):\n raise ValueError('self._cfg must be set before calling _init_k2().')\nif not hasattr(self._cfg, 'graph_module_cfg') or self._cfg.graph_module_cfg is None:\n raise ValueError('self._cfg.graph_module_cfg must be set and cannot be None.')\nself.graph_module_cfg = self._cfg.graph_... | <|body_start_0|>
if not hasattr(self, '_cfg'):
raise ValueError('self._cfg must be set before calling _init_k2().')
if not hasattr(self._cfg, 'graph_module_cfg') or self._cfg.graph_module_cfg is None:
raise ValueError('self._cfg.graph_module_cfg must be set and cannot be None.')
... | k2 Mixin class that simplifies the construction of various models with k2-based losses. It does the following: - Sets up the graph loss and decoder (methods _init_k2 and update_k2_modules). - Registers external graphs, if needed. - Augments forward(...) with optional graph decoding to get accurate predictions. | ASRK2Mixin | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ASRK2Mixin:
"""k2 Mixin class that simplifies the construction of various models with k2-based losses. It does the following: - Sets up the graph loss and decoder (methods _init_k2 and update_k2_modules). - Registers external graphs, if needed. - Augments forward(...) with optional graph decoding... | stack_v2_sparse_classes_36k_train_008680 | 7,098 | permissive | [
{
"docstring": "k2-related initialization implementation. This method is expected to run after the __init__ which sets self._cfg self._cfg is expected to have the attribute graph_module_cfg",
"name": "_init_k2",
"signature": "def _init_k2(self)"
},
{
"docstring": "Helper function to initialize o... | 3 | stack_v2_sparse_classes_30k_train_008666 | Implement the Python class `ASRK2Mixin` described below.
Class description:
k2 Mixin class that simplifies the construction of various models with k2-based losses. It does the following: - Sets up the graph loss and decoder (methods _init_k2 and update_k2_modules). - Registers external graphs, if needed. - Augments fo... | Implement the Python class `ASRK2Mixin` described below.
Class description:
k2 Mixin class that simplifies the construction of various models with k2-based losses. It does the following: - Sets up the graph loss and decoder (methods _init_k2 and update_k2_modules). - Registers external graphs, if needed. - Augments fo... | c20a16ea8aa2a9d8e31a98eb22178ddb9d5935e7 | <|skeleton|>
class ASRK2Mixin:
"""k2 Mixin class that simplifies the construction of various models with k2-based losses. It does the following: - Sets up the graph loss and decoder (methods _init_k2 and update_k2_modules). - Registers external graphs, if needed. - Augments forward(...) with optional graph decoding... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ASRK2Mixin:
"""k2 Mixin class that simplifies the construction of various models with k2-based losses. It does the following: - Sets up the graph loss and decoder (methods _init_k2 and update_k2_modules). - Registers external graphs, if needed. - Augments forward(...) with optional graph decoding to get accur... | the_stack_v2_python_sparse | nemo/collections/asr/parts/k2/classes.py | NVIDIA/NeMo | train | 7,957 |
7b65bc3832a6c0ace5648b876ebb266aa31ece16 | [
"data = self.get_json()\ngroup_id = int(group_id)\nstream_id = data.get('stream_id')\nwith self.Session() as session:\n group = session.scalars(Group.select(session.user_or_token, mode='update').where(Group.id == group_id)).first()\n if group is None:\n return self.error(f'Group with ID {group_id} not ... | <|body_start_0|>
data = self.get_json()
group_id = int(group_id)
stream_id = data.get('stream_id')
with self.Session() as session:
group = session.scalars(Group.select(session.user_or_token, mode='update').where(Group.id == group_id)).first()
if group is None:
... | GroupStreamHandler | [
"BSD-3-Clause",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GroupStreamHandler:
def post(self, group_id, *ignored_args):
"""--- description: Add alert stream access to group tags: - groups - streams parameters: - in: path name: group_id required: true schema: type: integer requestBody: content: application/json: schema: type: object properties: s... | stack_v2_sparse_classes_36k_train_008681 | 31,492 | permissive | [
{
"docstring": "--- description: Add alert stream access to group tags: - groups - streams parameters: - in: path name: group_id required: true schema: type: integer requestBody: content: application/json: schema: type: object properties: stream_id: type: integer required: - stream_id responses: 200: content: a... | 2 | stack_v2_sparse_classes_30k_train_010123 | Implement the Python class `GroupStreamHandler` described below.
Class description:
Implement the GroupStreamHandler class.
Method signatures and docstrings:
- def post(self, group_id, *ignored_args): --- description: Add alert stream access to group tags: - groups - streams parameters: - in: path name: group_id requ... | Implement the Python class `GroupStreamHandler` described below.
Class description:
Implement the GroupStreamHandler class.
Method signatures and docstrings:
- def post(self, group_id, *ignored_args): --- description: Add alert stream access to group tags: - groups - streams parameters: - in: path name: group_id requ... | 161d3532ba3ba059446addcdac58ca96f39e9636 | <|skeleton|>
class GroupStreamHandler:
def post(self, group_id, *ignored_args):
"""--- description: Add alert stream access to group tags: - groups - streams parameters: - in: path name: group_id required: true schema: type: integer requestBody: content: application/json: schema: type: object properties: s... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GroupStreamHandler:
def post(self, group_id, *ignored_args):
"""--- description: Add alert stream access to group tags: - groups - streams parameters: - in: path name: group_id required: true schema: type: integer requestBody: content: application/json: schema: type: object properties: stream_id: type... | the_stack_v2_python_sparse | skyportal/handlers/api/group.py | skyportal/skyportal | train | 80 | |
f984117e23b7480ee14ae77806b5a6d8639bcee4 | [
"try:\n return cls._groupby_reduce_impls[agg_name]\nexcept KeyError:\n raise KeyError(f'Have no implementation for {agg_name}.')",
"if hashable(agg_func):\n return agg_func in cls._groupby_reduce_impls\nif not isinstance(agg_func, dict):\n return False\nfrom modin.pandas.utils import walk_aggregation_... | <|body_start_0|>
try:
return cls._groupby_reduce_impls[agg_name]
except KeyError:
raise KeyError(f'Have no implementation for {agg_name}.')
<|end_body_0|>
<|body_start_1|>
if hashable(agg_func):
return agg_func in cls._groupby_reduce_impls
if not isin... | Provide TreeReduce implementations for certain groupby aggregations. | GroupbyReduceImpl | [
"Apache-2.0",
"LicenseRef-scancode-generic-cla",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GroupbyReduceImpl:
"""Provide TreeReduce implementations for certain groupby aggregations."""
def get_impl(cls, agg_name):
"""Get TreeReduce implementations for the specified `agg_name`. Parameters ---------- agg_name : hashable Returns ------- (map_fn: Union[callable, str], reduce_f... | stack_v2_sparse_classes_36k_train_008682 | 9,070 | permissive | [
{
"docstring": "Get TreeReduce implementations for the specified `agg_name`. Parameters ---------- agg_name : hashable Returns ------- (map_fn: Union[callable, str], reduce_fn: Union[callable, str], default2pandas_fn: callable)",
"name": "get_impl",
"signature": "def get_impl(cls, agg_name)"
},
{
... | 5 | stack_v2_sparse_classes_30k_train_015562 | Implement the Python class `GroupbyReduceImpl` described below.
Class description:
Provide TreeReduce implementations for certain groupby aggregations.
Method signatures and docstrings:
- def get_impl(cls, agg_name): Get TreeReduce implementations for the specified `agg_name`. Parameters ---------- agg_name : hashabl... | Implement the Python class `GroupbyReduceImpl` described below.
Class description:
Provide TreeReduce implementations for certain groupby aggregations.
Method signatures and docstrings:
- def get_impl(cls, agg_name): Get TreeReduce implementations for the specified `agg_name`. Parameters ---------- agg_name : hashabl... | 8f6e00378e095817deccd25f4140406c5ee6c992 | <|skeleton|>
class GroupbyReduceImpl:
"""Provide TreeReduce implementations for certain groupby aggregations."""
def get_impl(cls, agg_name):
"""Get TreeReduce implementations for the specified `agg_name`. Parameters ---------- agg_name : hashable Returns ------- (map_fn: Union[callable, str], reduce_f... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GroupbyReduceImpl:
"""Provide TreeReduce implementations for certain groupby aggregations."""
def get_impl(cls, agg_name):
"""Get TreeReduce implementations for the specified `agg_name`. Parameters ---------- agg_name : hashable Returns ------- (map_fn: Union[callable, str], reduce_fn: Union[call... | the_stack_v2_python_sparse | modin/core/storage_formats/pandas/groupby.py | modin-project/modin | train | 9,241 |
2f33aaf400db61fd2d874412e1807de56afda3bb | [
"private_key_file = self.cleaned_data.get('private_key_file')\npassword = self.cleaned_data.get('password')\nif private_key_file:\n key_string = private_key_file.read()\n private_key_file.seek(0)\n if not validate_ssh_private_key(key_string, password):\n raise forms.ValidationError(_('Invalid privat... | <|body_start_0|>
private_key_file = self.cleaned_data.get('private_key_file')
password = self.cleaned_data.get('password')
if private_key_file:
key_string = private_key_file.read()
private_key_file.seek(0)
if not validate_ssh_private_key(key_string, password):... | 密码或密钥验证表单,是其他用户表单等的基础表单 | PasswordAndKeyAuthForm | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PasswordAndKeyAuthForm:
"""密码或密钥验证表单,是其他用户表单等的基础表单"""
def clean_private_key_file(self):
"""验证上传的私钥文件,返回字符串形式的私钥"""
<|body_0|>
def validate_password_key(self):
"""验证私钥 和 密码 必填其一"""
<|body_1|>
def gen_keys(self):
"""根据上传的私钥文件,生产公钥,返回密钥对"""
... | stack_v2_sparse_classes_36k_train_008683 | 6,024 | no_license | [
{
"docstring": "验证上传的私钥文件,返回字符串形式的私钥",
"name": "clean_private_key_file",
"signature": "def clean_private_key_file(self)"
},
{
"docstring": "验证私钥 和 密码 必填其一",
"name": "validate_password_key",
"signature": "def validate_password_key(self)"
},
{
"docstring": "根据上传的私钥文件,生产公钥,返回密钥对",
... | 3 | stack_v2_sparse_classes_30k_train_020387 | Implement the Python class `PasswordAndKeyAuthForm` described below.
Class description:
密码或密钥验证表单,是其他用户表单等的基础表单
Method signatures and docstrings:
- def clean_private_key_file(self): 验证上传的私钥文件,返回字符串形式的私钥
- def validate_password_key(self): 验证私钥 和 密码 必填其一
- def gen_keys(self): 根据上传的私钥文件,生产公钥,返回密钥对 | Implement the Python class `PasswordAndKeyAuthForm` described below.
Class description:
密码或密钥验证表单,是其他用户表单等的基础表单
Method signatures and docstrings:
- def clean_private_key_file(self): 验证上传的私钥文件,返回字符串形式的私钥
- def validate_password_key(self): 验证私钥 和 密码 必填其一
- def gen_keys(self): 根据上传的私钥文件,生产公钥,返回密钥对
<|skeleton|>
class Pa... | 274ab76ad2af79f47aa01f7b35992eef76d59a29 | <|skeleton|>
class PasswordAndKeyAuthForm:
"""密码或密钥验证表单,是其他用户表单等的基础表单"""
def clean_private_key_file(self):
"""验证上传的私钥文件,返回字符串形式的私钥"""
<|body_0|>
def validate_password_key(self):
"""验证私钥 和 密码 必填其一"""
<|body_1|>
def gen_keys(self):
"""根据上传的私钥文件,生产公钥,返回密钥对"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PasswordAndKeyAuthForm:
"""密码或密钥验证表单,是其他用户表单等的基础表单"""
def clean_private_key_file(self):
"""验证上传的私钥文件,返回字符串形式的私钥"""
private_key_file = self.cleaned_data.get('private_key_file')
password = self.cleaned_data.get('password')
if private_key_file:
key_string = privat... | the_stack_v2_python_sparse | apps/assets/forms/user.py | Amos-x/Operation | train | 0 |
fe41227834695fdd301389de35bdcae17b541183 | [
"def _dot(x, y):\n if isinstance(x, SS.SparseVariable):\n return SS.structured_dot(x, y)\n else:\n return TT.dot(x, y)\n\ndef weight(n):\n return 'w' if len(self.inputs) == 1 else 'w_{}'.format(n)\nxws = ((inputs[n], self.find(weight(n))) for n in self.inputs)\npre = sum((_dot(x, w) for x, w ... | <|body_start_0|>
def _dot(x, y):
if isinstance(x, SS.SparseVariable):
return SS.structured_dot(x, y)
else:
return TT.dot(x, y)
def weight(n):
return 'w' if len(self.inputs) == 1 else 'w_{}'.format(n)
xws = ((inputs[n], self.fin... | A feedforward neural network layer performs a transform of its input. More precisely, feedforward layers as implemented here perform an affine transformation of their input, followed by a potentially nonlinear "activation" function performed elementwise on the transformed input. Feedforward layers are the fundamental b... | Feedforward | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Feedforward:
"""A feedforward neural network layer performs a transform of its input. More precisely, feedforward layers as implemented here perform an affine transformation of their input, followed by a potentially nonlinear "activation" function performed elementwise on the transformed input. F... | stack_v2_sparse_classes_36k_train_008684 | 8,072 | permissive | [
{
"docstring": "Transform the inputs for this layer into an output for the layer. Parameters ---------- inputs : dict of Theano expressions Symbolic inputs to this layer, given as a dictionary mapping string names to Theano expressions. See :func:`Layer.connect`. Returns ------- outputs : dict of Theano express... | 2 | stack_v2_sparse_classes_30k_train_019699 | Implement the Python class `Feedforward` described below.
Class description:
A feedforward neural network layer performs a transform of its input. More precisely, feedforward layers as implemented here perform an affine transformation of their input, followed by a potentially nonlinear "activation" function performed ... | Implement the Python class `Feedforward` described below.
Class description:
A feedforward neural network layer performs a transform of its input. More precisely, feedforward layers as implemented here perform an affine transformation of their input, followed by a potentially nonlinear "activation" function performed ... | 06b5b6f5de05220702f34c943f309d8188010b57 | <|skeleton|>
class Feedforward:
"""A feedforward neural network layer performs a transform of its input. More precisely, feedforward layers as implemented here perform an affine transformation of their input, followed by a potentially nonlinear "activation" function performed elementwise on the transformed input. F... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Feedforward:
"""A feedforward neural network layer performs a transform of its input. More precisely, feedforward layers as implemented here perform an affine transformation of their input, followed by a potentially nonlinear "activation" function performed elementwise on the transformed input. Feedforward la... | the_stack_v2_python_sparse | code/seq2seq_graph/src/theanets-0.6.1/theanets/layers/feedforward.py | scylla/masters_thesis | train | 2 |
70b665bc635b8b95707ec2f49dce9a10c4e58284 | [
"self.optionsQuestionBuilder = OptionsQuestionBuilder()\nself.promptQuestionBuilder = PromptQuestionBuilder()\nself.optionsRange = range(0, 4)\nself.promptRange = range(4, 6)",
"questions = []\noptionsPairs = []\npromptPairs = []\nfor pair in pairs:\n mastery = masteryCache[pair.foreign.id].answerRating\n i... | <|body_start_0|>
self.optionsQuestionBuilder = OptionsQuestionBuilder()
self.promptQuestionBuilder = PromptQuestionBuilder()
self.optionsRange = range(0, 4)
self.promptRange = range(4, 6)
<|end_body_0|>
<|body_start_1|>
questions = []
optionsPairs = []
promptPair... | Constructs Questions | QuestionFactory | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class QuestionFactory:
"""Constructs Questions"""
def __init__(self):
"""Initialize the question factory with the builders for each question type"""
<|body_0|>
def buildQuestions(self, pairs, masteryCache):
"""Build the questions for use in the quiz"""
<|body_1... | stack_v2_sparse_classes_36k_train_008685 | 1,361 | no_license | [
{
"docstring": "Initialize the question factory with the builders for each question type",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Build the questions for use in the quiz",
"name": "buildQuestions",
"signature": "def buildQuestions(self, pairs, masteryCac... | 2 | null | Implement the Python class `QuestionFactory` described below.
Class description:
Constructs Questions
Method signatures and docstrings:
- def __init__(self): Initialize the question factory with the builders for each question type
- def buildQuestions(self, pairs, masteryCache): Build the questions for use in the qui... | Implement the Python class `QuestionFactory` described below.
Class description:
Constructs Questions
Method signatures and docstrings:
- def __init__(self): Initialize the question factory with the builders for each question type
- def buildQuestions(self, pairs, masteryCache): Build the questions for use in the qui... | f08dc4465b7e4fb32235e1647c46edd4472f9093 | <|skeleton|>
class QuestionFactory:
"""Constructs Questions"""
def __init__(self):
"""Initialize the question factory with the builders for each question type"""
<|body_0|>
def buildQuestions(self, pairs, masteryCache):
"""Build the questions for use in the quiz"""
<|body_1... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class QuestionFactory:
"""Constructs Questions"""
def __init__(self):
"""Initialize the question factory with the builders for each question type"""
self.optionsQuestionBuilder = OptionsQuestionBuilder()
self.promptQuestionBuilder = PromptQuestionBuilder()
self.optionsRange = ra... | the_stack_v2_python_sparse | src/Quiz/Question/question_factory.py | cloew/VocabTester | train | 0 |
ae3d020aba80ad83e32ceab07ccac8b7ccd8108a | [
"self._students = []\nself._grades = {}\nself._is_sorted = True",
"if student in self._students:\n raise ValueError('Duplicate student')\nself._students.append(student)\nself._grades[student.get_id_num()] = []\nself._is_sorted = False",
"try:\n self._grades[student.get_id_num()].append(grade)\nexcept:\n ... | <|body_start_0|>
self._students = []
self._grades = {}
self._is_sorted = True
<|end_body_0|>
<|body_start_1|>
if student in self._students:
raise ValueError('Duplicate student')
self._students.append(student)
self._grades[student.get_id_num()] = []
se... | Grades | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Grades:
def __init__(self):
"""Create empty grade book"""
<|body_0|>
def add_student(self, student):
"""Assumes: student is of type Student Add student to the grade book"""
<|body_1|>
def add_grade(self, student, grade):
"""Assumes: grade is a fl... | stack_v2_sparse_classes_36k_train_008686 | 40,027 | permissive | [
{
"docstring": "Create empty grade book",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Assumes: student is of type Student Add student to the grade book",
"name": "add_student",
"signature": "def add_student(self, student)"
},
{
"docstring": "Assumes: ... | 6 | stack_v2_sparse_classes_30k_train_015341 | Implement the Python class `Grades` described below.
Class description:
Implement the Grades class.
Method signatures and docstrings:
- def __init__(self): Create empty grade book
- def add_student(self, student): Assumes: student is of type Student Add student to the grade book
- def add_grade(self, student, grade):... | Implement the Python class `Grades` described below.
Class description:
Implement the Grades class.
Method signatures and docstrings:
- def __init__(self): Create empty grade book
- def add_student(self, student): Assumes: student is of type Student Add student to the grade book
- def add_grade(self, student, grade):... | fedab41508d7a4830af29cb86bf83e52ff161046 | <|skeleton|>
class Grades:
def __init__(self):
"""Create empty grade book"""
<|body_0|>
def add_student(self, student):
"""Assumes: student is of type Student Add student to the grade book"""
<|body_1|>
def add_grade(self, student, grade):
"""Assumes: grade is a fl... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Grades:
def __init__(self):
"""Create empty grade book"""
self._students = []
self._grades = {}
self._is_sorted = True
def add_student(self, student):
"""Assumes: student is of type Student Add student to the grade book"""
if student in self._students:
... | the_stack_v2_python_sparse | finger_exercise.py | lcsm29/MIT6.0001 | train | 6 | |
221e8ebeb1db9a394dc7f7653982818ff025649d | [
"self.meta = {}\nself.meta['ra'] = dict(ext=0, card='RA')\nself.meta['dec'] = dict(ext=0, card='DEC')\nself.meta['target'] = dict(ext=0, card='OBJECT')\nself.meta['decker'] = dict(ext=0, card=None, default='default')\nself.meta['dichroic'] = dict(ext=0, card=None, default='default')\nself.meta['binning'] = dict(ext... | <|body_start_0|>
self.meta = {}
self.meta['ra'] = dict(ext=0, card='RA')
self.meta['dec'] = dict(ext=0, card='DEC')
self.meta['target'] = dict(ext=0, card='OBJECT')
self.meta['decker'] = dict(ext=0, card=None, default='default')
self.meta['dichroic'] = dict(ext=0, card=No... | Child to handle Magellan/FIRE specific code .. note:: For FIRE Echelle, we usually use high gain and SUTR read mode. The exposure time is usually around 900s. The detector parameters below are based on such mode. Standard star and calibrations are usually use Fowler 1 read mode in which case the read noise is ~20 elect... | MagellanFIRESpectrograph | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MagellanFIRESpectrograph:
"""Child to handle Magellan/FIRE specific code .. note:: For FIRE Echelle, we usually use high gain and SUTR read mode. The exposure time is usually around 900s. The detector parameters below are based on such mode. Standard star and calibrations are usually use Fowler 1... | stack_v2_sparse_classes_36k_train_008687 | 18,946 | permissive | [
{
"docstring": "Define how metadata are derived from the spectrograph files. That is, this associates the PypeIt-specific metadata keywords with the instrument-specific header cards using :attr:`meta`.",
"name": "init_meta",
"signature": "def init_meta(self)"
},
{
"docstring": "Define the list o... | 2 | stack_v2_sparse_classes_30k_train_018884 | Implement the Python class `MagellanFIRESpectrograph` described below.
Class description:
Child to handle Magellan/FIRE specific code .. note:: For FIRE Echelle, we usually use high gain and SUTR read mode. The exposure time is usually around 900s. The detector parameters below are based on such mode. Standard star an... | Implement the Python class `MagellanFIRESpectrograph` described below.
Class description:
Child to handle Magellan/FIRE specific code .. note:: For FIRE Echelle, we usually use high gain and SUTR read mode. The exposure time is usually around 900s. The detector parameters below are based on such mode. Standard star an... | 0d2e2196afc6904050b1af4d572f5c643bb07e38 | <|skeleton|>
class MagellanFIRESpectrograph:
"""Child to handle Magellan/FIRE specific code .. note:: For FIRE Echelle, we usually use high gain and SUTR read mode. The exposure time is usually around 900s. The detector parameters below are based on such mode. Standard star and calibrations are usually use Fowler 1... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MagellanFIRESpectrograph:
"""Child to handle Magellan/FIRE specific code .. note:: For FIRE Echelle, we usually use high gain and SUTR read mode. The exposure time is usually around 900s. The detector parameters below are based on such mode. Standard star and calibrations are usually use Fowler 1 read mode in... | the_stack_v2_python_sparse | pypeit/spectrographs/magellan_fire.py | pypeit/PypeIt | train | 136 |
4da0e5b71fa6866f00420ffd2fa6863de55e646c | [
"head = None\npre = None\ncurr = root\nwhile curr:\n while curr:\n if curr.left:\n if pre:\n pre.next = curr.left\n else:\n head = curr.left\n pre = curr.left\n if curr.right:\n if pre:\n pre.next = curr.right\... | <|body_start_0|>
head = None
pre = None
curr = root
while curr:
while curr:
if curr.left:
if pre:
pre.next = curr.left
else:
head = curr.left
pre = curr... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def connect(self, root):
""":type root: TreeLinkNode :rtype: nothing"""
<|body_0|>
def connect_self(self, root):
""":type root: TreeLinkNode :rtype: nothing"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
head = None
pre = None
... | stack_v2_sparse_classes_36k_train_008688 | 2,403 | no_license | [
{
"docstring": ":type root: TreeLinkNode :rtype: nothing",
"name": "connect",
"signature": "def connect(self, root)"
},
{
"docstring": ":type root: TreeLinkNode :rtype: nothing",
"name": "connect_self",
"signature": "def connect_self(self, root)"
}
] | 2 | stack_v2_sparse_classes_30k_train_020388 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def connect(self, root): :type root: TreeLinkNode :rtype: nothing
- def connect_self(self, root): :type root: TreeLinkNode :rtype: nothing | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def connect(self, root): :type root: TreeLinkNode :rtype: nothing
- def connect_self(self, root): :type root: TreeLinkNode :rtype: nothing
<|skeleton|>
class Solution:
def ... | ea492ec864b50547214ecbbb2cdeeac21e70229b | <|skeleton|>
class Solution:
def connect(self, root):
""":type root: TreeLinkNode :rtype: nothing"""
<|body_0|>
def connect_self(self, root):
""":type root: TreeLinkNode :rtype: nothing"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def connect(self, root):
""":type root: TreeLinkNode :rtype: nothing"""
head = None
pre = None
curr = root
while curr:
while curr:
if curr.left:
if pre:
pre.next = curr.left
... | the_stack_v2_python_sparse | 117_populating_next_right_pointers_in_each_node_2/sol.py | lianke123321/leetcode_sol | train | 0 | |
71c8499cb9a2bc0ee15bac2618e0d05c1c782253 | [
"validinterval = ['[1,2]', '(2,5)', '[1,3)', '(5,7]', '[-3,-1]', '[-4,-1)', '(-5,-2]', '(-6,-3)', '[1,1]', '[-1,-1]', '[ 0, 1]', '[1, 2]', ' [ 3, 4 ] ', '[00,+11]']\nintervals = [interval(item) for item in validinterval]\nself.assertEqual(len(validinterval), len(intervals))",
"invalid_interval = ['[a,1]... | <|body_start_0|>
validinterval = ['[1,2]', '(2,5)', '[1,3)', '(5,7]', '[-3,-1]', '[-4,-1)', '(-5,-2]', '(-6,-3)', '[1,1]', '[-1,-1]', '[ 0, 1]', '[1, 2]', ' [ 3, 4 ] ', '[00,+11]']
intervals = [interval(item) for item in validinterval]
self.assertEqual(len(validinterval), len(intervals... | Unit-testing class that lets us to run tests with expected outcomes. | Test_interval | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Test_interval:
"""Unit-testing class that lets us to run tests with expected outcomes."""
def test_validinterval(self):
"""unit tests for the interval constructor Test the creation of valid inputs to the Interval constructor."""
<|body_0|>
def test_invalidinterval(self):... | stack_v2_sparse_classes_36k_train_008689 | 4,215 | no_license | [
{
"docstring": "unit tests for the interval constructor Test the creation of valid inputs to the Interval constructor.",
"name": "test_validinterval",
"signature": "def test_validinterval(self)"
},
{
"docstring": "unit tests for the interval constructor Test the creation of invalid inputs to the... | 6 | null | Implement the Python class `Test_interval` described below.
Class description:
Unit-testing class that lets us to run tests with expected outcomes.
Method signatures and docstrings:
- def test_validinterval(self): unit tests for the interval constructor Test the creation of valid inputs to the Interval constructor.
-... | Implement the Python class `Test_interval` described below.
Class description:
Unit-testing class that lets us to run tests with expected outcomes.
Method signatures and docstrings:
- def test_validinterval(self): unit tests for the interval constructor Test the creation of valid inputs to the Interval constructor.
-... | 33c7a3e579c37ce3096099a350a7c8135b302ea4 | <|skeleton|>
class Test_interval:
"""Unit-testing class that lets us to run tests with expected outcomes."""
def test_validinterval(self):
"""unit tests for the interval constructor Test the creation of valid inputs to the Interval constructor."""
<|body_0|>
def test_invalidinterval(self):... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Test_interval:
"""Unit-testing class that lets us to run tests with expected outcomes."""
def test_validinterval(self):
"""unit tests for the interval constructor Test the creation of valid inputs to the Interval constructor."""
validinterval = ['[1,2]', '(2,5)', '[1,3)', '(5,7]', '[-3,-1... | the_stack_v2_python_sparse | cyh343/test.py | ds-ga-1007/assignment7 | train | 0 |
338bcbf8ccf04c2429ecb09efad53b763682926b | [
"spec = super().getInputSpecification()\nspec.addSub(InputData.parameterInputFactory('source', contentType=InputTypes.StringType, descr='The name of the RAVEN DataObject from which the data should be taken for this plotter.\\n This should be the SolutionExport for a MultiRun with an Optimizer.'))\nspec... | <|body_start_0|>
spec = super().getInputSpecification()
spec.addSub(InputData.parameterInputFactory('source', contentType=InputTypes.StringType, descr='The name of the RAVEN DataObject from which the data should be taken for this plotter.\n This should be the SolutionExport for a MultiRun w... | Plots input coordinate in a parallel coordinate plot | OptParallelCoordinatePlot | [
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer",
"BSD-2-Clause",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OptParallelCoordinatePlot:
"""Plots input coordinate in a parallel coordinate plot"""
def getInputSpecification(cls):
"""Method to get a reference to a class that specifies the input data for class "cls". @ In, cls, the class for which we are retrieving the specification @ Out, input... | stack_v2_sparse_classes_36k_train_008690 | 4,979 | permissive | [
{
"docstring": "Method to get a reference to a class that specifies the input data for class \"cls\". @ In, cls, the class for which we are retrieving the specification @ Out, inputSpecification, InputData.ParameterInput, class to use for specifying the input of cls.",
"name": "getInputSpecification",
"... | 5 | null | Implement the Python class `OptParallelCoordinatePlot` described below.
Class description:
Plots input coordinate in a parallel coordinate plot
Method signatures and docstrings:
- def getInputSpecification(cls): Method to get a reference to a class that specifies the input data for class "cls". @ In, cls, the class f... | Implement the Python class `OptParallelCoordinatePlot` described below.
Class description:
Plots input coordinate in a parallel coordinate plot
Method signatures and docstrings:
- def getInputSpecification(cls): Method to get a reference to a class that specifies the input data for class "cls". @ In, cls, the class f... | 2b16e7aa3325fe84cab2477947a951414c635381 | <|skeleton|>
class OptParallelCoordinatePlot:
"""Plots input coordinate in a parallel coordinate plot"""
def getInputSpecification(cls):
"""Method to get a reference to a class that specifies the input data for class "cls". @ In, cls, the class for which we are retrieving the specification @ Out, input... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class OptParallelCoordinatePlot:
"""Plots input coordinate in a parallel coordinate plot"""
def getInputSpecification(cls):
"""Method to get a reference to a class that specifies the input data for class "cls". @ In, cls, the class for which we are retrieving the specification @ Out, inputSpecification... | the_stack_v2_python_sparse | ravenframework/OutStreams/PlotInterfaces/OptParallelCoordinate.py | idaholab/raven | train | 201 |
60392b959b52d3e8e49f8e465d1a3644d085de2c | [
"with open(path, 'r') as stream:\n reader = FileReader(stream)\n for line in reader:\n if 'INFO' in line and '127.0.0.1' in line:\n yield self._parseStatusLine(line)\n elif 'ERROR' in line:\n yield self._parseErrorLine(line, reader)",
"time = '%s %s' % (parts[0], parts[1]... | <|body_start_0|>
with open(path, 'r') as stream:
reader = FileReader(stream)
for line in reader:
if 'INFO' in line and '127.0.0.1' in line:
yield self._parseStatusLine(line)
elif 'ERROR' in line:
yield self._parseErr... | Parser reads log files generated by the Fluidinfo API service. | LogParser | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LogParser:
"""Parser reads log files generated by the Fluidinfo API service."""
def parse(self, path):
"""Generator parses a log file and yields L{StatusLine} and L{ErrorLine} instances built from data in the log. @param path: The path of the log file to parse."""
<|body_0|>
... | stack_v2_sparse_classes_36k_train_008691 | 10,436 | permissive | [
{
"docstring": "Generator parses a log file and yields L{StatusLine} and L{ErrorLine} instances built from data in the log. @param path: The path of the log file to parse.",
"name": "parse",
"signature": "def parse(self, path)"
},
{
"docstring": "Parse the time from the log line. @param parts: T... | 4 | stack_v2_sparse_classes_30k_train_020123 | Implement the Python class `LogParser` described below.
Class description:
Parser reads log files generated by the Fluidinfo API service.
Method signatures and docstrings:
- def parse(self, path): Generator parses a log file and yields L{StatusLine} and L{ErrorLine} instances built from data in the log. @param path: ... | Implement the Python class `LogParser` described below.
Class description:
Parser reads log files generated by the Fluidinfo API service.
Method signatures and docstrings:
- def parse(self, path): Generator parses a log file and yields L{StatusLine} and L{ErrorLine} instances built from data in the log. @param path: ... | b5a8c8349f3eaf3364cc4efba4736c3e33b30d96 | <|skeleton|>
class LogParser:
"""Parser reads log files generated by the Fluidinfo API service."""
def parse(self, path):
"""Generator parses a log file and yields L{StatusLine} and L{ErrorLine} instances built from data in the log. @param path: The path of the log file to parse."""
<|body_0|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LogParser:
"""Parser reads log files generated by the Fluidinfo API service."""
def parse(self, path):
"""Generator parses a log file and yields L{StatusLine} and L{ErrorLine} instances built from data in the log. @param path: The path of the log file to parse."""
with open(path, 'r') as ... | the_stack_v2_python_sparse | fluiddb/scripts/logs.py | fluidinfo/fluiddb | train | 3 |
87e7d37a8e1955fa7434004addd10e444cb7725a | [
"self.topk = topk\nself.sum = [0.0] * len(topk)\nself.data_num = 0\nself.pfm = [0.0] * len(topk)",
"if isinstance(output, tuple):\n output = output[0]\nres = accuracy(output, target, self.topk)\nn = output.size(0)\nself.data_num += n\nself.sum = [self.sum[index] + item.item() * n for index, item in enumerate(r... | <|body_start_0|>
self.topk = topk
self.sum = [0.0] * len(topk)
self.data_num = 0
self.pfm = [0.0] * len(topk)
<|end_body_0|>
<|body_start_1|>
if isinstance(output, tuple):
output = output[0]
res = accuracy(output, target, self.topk)
n = output.size(0)... | Calculate classification accuracy between output and target. | Accuracy | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Accuracy:
"""Calculate classification accuracy between output and target."""
def __init__(self, topk=(1, 5)):
"""Init Accuracy metric."""
<|body_0|>
def __call__(self, output, target, *args, **kwargs):
"""Perform top k accuracy. :param output: output of classific... | stack_v2_sparse_classes_36k_train_008692 | 4,028 | permissive | [
{
"docstring": "Init Accuracy metric.",
"name": "__init__",
"signature": "def __init__(self, topk=(1, 5))"
},
{
"docstring": "Perform top k accuracy. :param output: output of classification network :param target: ground truth from dataset :return: pfm",
"name": "__call__",
"signature": "... | 4 | null | Implement the Python class `Accuracy` described below.
Class description:
Calculate classification accuracy between output and target.
Method signatures and docstrings:
- def __init__(self, topk=(1, 5)): Init Accuracy metric.
- def __call__(self, output, target, *args, **kwargs): Perform top k accuracy. :param output... | Implement the Python class `Accuracy` described below.
Class description:
Calculate classification accuracy between output and target.
Method signatures and docstrings:
- def __init__(self, topk=(1, 5)): Init Accuracy metric.
- def __call__(self, output, target, *args, **kwargs): Perform top k accuracy. :param output... | e4ef3a1c92d19d1d08c3ef0e2156b6fecefdbe04 | <|skeleton|>
class Accuracy:
"""Calculate classification accuracy between output and target."""
def __init__(self, topk=(1, 5)):
"""Init Accuracy metric."""
<|body_0|>
def __call__(self, output, target, *args, **kwargs):
"""Perform top k accuracy. :param output: output of classific... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Accuracy:
"""Calculate classification accuracy between output and target."""
def __init__(self, topk=(1, 5)):
"""Init Accuracy metric."""
self.topk = topk
self.sum = [0.0] * len(topk)
self.data_num = 0
self.pfm = [0.0] * len(topk)
def __call__(self, output, ta... | the_stack_v2_python_sparse | zeus/metrics/pytorch/classifier_metric.py | huawei-noah/xingtian | train | 308 |
f812136e6dbfa178c8857da6e3c3ef6dd6754299 | [
"args = add_user_api_parser.parse_args()\nuser = Users.objects(account=args['account']).first()\nif user:\n return {'msg': '用户已存在'}\nelse:\n user = Users()\n user.account = args['account']\n user.password = args['password']\n user.is_manager = args['is_manager'] == 'true'\n user.phone = args['phon... | <|body_start_0|>
args = add_user_api_parser.parse_args()
user = Users.objects(account=args['account']).first()
if user:
return {'msg': '用户已存在'}
else:
user = Users()
user.account = args['account']
user.password = args['password']
... | UsersResource | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UsersResource:
def post(self):
"""添加用户"""
<|body_0|>
def get(self):
"""获取用户列表"""
<|body_1|>
def put(self):
"""修改使用时间"""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>
args = add_user_api_parser.parse_args()
user = Users.ob... | stack_v2_sparse_classes_36k_train_008693 | 6,265 | no_license | [
{
"docstring": "添加用户",
"name": "post",
"signature": "def post(self)"
},
{
"docstring": "获取用户列表",
"name": "get",
"signature": "def get(self)"
},
{
"docstring": "修改使用时间",
"name": "put",
"signature": "def put(self)"
}
] | 3 | stack_v2_sparse_classes_30k_train_006052 | Implement the Python class `UsersResource` described below.
Class description:
Implement the UsersResource class.
Method signatures and docstrings:
- def post(self): 添加用户
- def get(self): 获取用户列表
- def put(self): 修改使用时间 | Implement the Python class `UsersResource` described below.
Class description:
Implement the UsersResource class.
Method signatures and docstrings:
- def post(self): 添加用户
- def get(self): 获取用户列表
- def put(self): 修改使用时间
<|skeleton|>
class UsersResource:
def post(self):
"""添加用户"""
<|body_0|>
... | b153b1fb297a7ec1324ca80587d3b4c0f6fc9df5 | <|skeleton|>
class UsersResource:
def post(self):
"""添加用户"""
<|body_0|>
def get(self):
"""获取用户列表"""
<|body_1|>
def put(self):
"""修改使用时间"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UsersResource:
def post(self):
"""添加用户"""
args = add_user_api_parser.parse_args()
user = Users.objects(account=args['account']).first()
if user:
return {'msg': '用户已存在'}
else:
user = Users()
user.account = args['account']
u... | the_stack_v2_python_sparse | SpiderMangerApi/app/apis/user_api.py | hezhisu/SpiderManager | train | 6 | |
33330b9937f12c690ec45be5fb7a1bcd65d2ab19 | [
"self.id = _id\nself.overwrites = []\nif 'overwrite' in config:\n overwrite_keyvals = config['overwrite'].split(';')\n for keyval in overwrite_keyvals:\n self.overwrites.append(keyval.split('='))\nself.target = 'event'\nif 'target' in config:\n if not config['target'] in MOD_TARGETS:\n loggin... | <|body_start_0|>
self.id = _id
self.overwrites = []
if 'overwrite' in config:
overwrite_keyvals = config['overwrite'].split(';')
for keyval in overwrite_keyvals:
self.overwrites.append(keyval.split('='))
self.target = 'event'
if 'target' in... | Modifies an event or a complete event group on the fly | ModifierProcessor | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ModifierProcessor:
"""Modifies an event or a complete event group on the fly"""
def setup(self, _id, config):
"""Setup method that configures the instance of this method InstanceFactory calls this with the id and configuration from datasource definitions defined in the conf.d directo... | stack_v2_sparse_classes_36k_train_008694 | 3,907 | no_license | [
{
"docstring": "Setup method that configures the instance of this method InstanceFactory calls this with the id and configuration from datasource definitions defined in the conf.d directory",
"name": "setup",
"signature": "def setup(self, _id, config)"
},
{
"docstring": "Processes the event if t... | 4 | stack_v2_sparse_classes_30k_train_008483 | Implement the Python class `ModifierProcessor` described below.
Class description:
Modifies an event or a complete event group on the fly
Method signatures and docstrings:
- def setup(self, _id, config): Setup method that configures the instance of this method InstanceFactory calls this with the id and configuration ... | Implement the Python class `ModifierProcessor` described below.
Class description:
Modifies an event or a complete event group on the fly
Method signatures and docstrings:
- def setup(self, _id, config): Setup method that configures the instance of this method InstanceFactory calls this with the id and configuration ... | 6b1834a1a3337bbb11b9cdb37d084b3f6699fdee | <|skeleton|>
class ModifierProcessor:
"""Modifies an event or a complete event group on the fly"""
def setup(self, _id, config):
"""Setup method that configures the instance of this method InstanceFactory calls this with the id and configuration from datasource definitions defined in the conf.d directo... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ModifierProcessor:
"""Modifies an event or a complete event group on the fly"""
def setup(self, _id, config):
"""Setup method that configures the instance of this method InstanceFactory calls this with the id and configuration from datasource definitions defined in the conf.d directory"""
... | the_stack_v2_python_sparse | src/processors/modifier_processor.py | NETWAYS/eventdbcorrelator | train | 0 |
e5c5e3f8175b285b3729e3fd770fef3b3d5c278d | [
"super(GitPush, self).__init__(path, ssh_key=ssh_key)\nself.path = path\nself.remote = remote\nself.src_branch = src_branch\nself.dest_branch = dest_branch\nself.debug = []\nos.chdir(path)",
"current_branch_results = self._get_current_branch()\nif current_branch_results['results'] == self.src_branch:\n return ... | <|body_start_0|>
super(GitPush, self).__init__(path, ssh_key=ssh_key)
self.path = path
self.remote = remote
self.src_branch = src_branch
self.dest_branch = dest_branch
self.debug = []
os.chdir(path)
<|end_body_0|>
<|body_start_1|>
current_branch_results =... | Class to wrap the git merge line tools | GitPush | [
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GitPush:
"""Class to wrap the git merge line tools"""
def __init__(self, path, remote, src_branch, dest_branch, ssh_key=None):
"""Constructor for GitPush"""
<|body_0|>
def checkout_branch(self):
"""check out the desired branch"""
<|body_1|>
def remot... | stack_v2_sparse_classes_36k_train_008695 | 2,595 | permissive | [
{
"docstring": "Constructor for GitPush",
"name": "__init__",
"signature": "def __init__(self, path, remote, src_branch, dest_branch, ssh_key=None)"
},
{
"docstring": "check out the desired branch",
"name": "checkout_branch",
"signature": "def checkout_branch(self)"
},
{
"docstri... | 5 | stack_v2_sparse_classes_30k_train_004075 | Implement the Python class `GitPush` described below.
Class description:
Class to wrap the git merge line tools
Method signatures and docstrings:
- def __init__(self, path, remote, src_branch, dest_branch, ssh_key=None): Constructor for GitPush
- def checkout_branch(self): check out the desired branch
- def remote_up... | Implement the Python class `GitPush` described below.
Class description:
Class to wrap the git merge line tools
Method signatures and docstrings:
- def __init__(self, path, remote, src_branch, dest_branch, ssh_key=None): Constructor for GitPush
- def checkout_branch(self): check out the desired branch
- def remote_up... | e342f6659a4ef1a188ff403e2fc6b06ac6d119c7 | <|skeleton|>
class GitPush:
"""Class to wrap the git merge line tools"""
def __init__(self, path, remote, src_branch, dest_branch, ssh_key=None):
"""Constructor for GitPush"""
<|body_0|>
def checkout_branch(self):
"""check out the desired branch"""
<|body_1|>
def remot... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GitPush:
"""Class to wrap the git merge line tools"""
def __init__(self, path, remote, src_branch, dest_branch, ssh_key=None):
"""Constructor for GitPush"""
super(GitPush, self).__init__(path, ssh_key=ssh_key)
self.path = path
self.remote = remote
self.src_branch =... | the_stack_v2_python_sparse | ansible/roles/lib_git/build/src/git_push.py | openshift/openshift-tools | train | 170 |
5e8e15b12d569763695d09986a819c9b6a682a51 | [
"raytracer = Rangefinder(min_num_aux=1)\nraytracer.set_map(example_world)\nraytracer.add_photoreceptors(linspace(-deg2rad(170), deg2rad(170), 180), spatial_sigma=deg2rad(0.5), sigma=0.01)\nraytracer.render(RigidBodyState())\nraytracer2 = make_sure_pickable(raytracer)\nraytracer2.render(RigidBodyState())\nmake_sure_... | <|body_start_0|>
raytracer = Rangefinder(min_num_aux=1)
raytracer.set_map(example_world)
raytracer.add_photoreceptors(linspace(-deg2rad(170), deg2rad(170), 180), spatial_sigma=deg2rad(0.5), sigma=0.01)
raytracer.render(RigidBodyState())
raytracer2 = make_sure_pickable(raytracer)
... | SensorPickling | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SensorPickling:
def testPickling(self):
"""Testing that we can render() even after a pickling"""
<|body_0|>
def testPickling2(self):
"""Pickling twice, no map"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
raytracer = Rangefinder(min_num_aux=1)
... | stack_v2_sparse_classes_36k_train_008696 | 5,320 | no_license | [
{
"docstring": "Testing that we can render() even after a pickling",
"name": "testPickling",
"signature": "def testPickling(self)"
},
{
"docstring": "Pickling twice, no map",
"name": "testPickling2",
"signature": "def testPickling2(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_008165 | Implement the Python class `SensorPickling` described below.
Class description:
Implement the SensorPickling class.
Method signatures and docstrings:
- def testPickling(self): Testing that we can render() even after a pickling
- def testPickling2(self): Pickling twice, no map | Implement the Python class `SensorPickling` described below.
Class description:
Implement the SensorPickling class.
Method signatures and docstrings:
- def testPickling(self): Testing that we can render() even after a pickling
- def testPickling2(self): Pickling twice, no map
<|skeleton|>
class SensorPickling:
... | 2f1dace35ec9d5d72db1201231f655de4372a01e | <|skeleton|>
class SensorPickling:
def testPickling(self):
"""Testing that we can render() even after a pickling"""
<|body_0|>
def testPickling2(self):
"""Pickling twice, no map"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SensorPickling:
def testPickling(self):
"""Testing that we can render() even after a pickling"""
raytracer = Rangefinder(min_num_aux=1)
raytracer.set_map(example_world)
raytracer.add_photoreceptors(linspace(-deg2rad(170), deg2rad(170), 180), spatial_sigma=deg2rad(0.5), sigma=0.... | the_stack_v2_python_sparse | src/pybv/sensors/image_range_sensor_test.py | AndreaCensi/pybv | train | 0 | |
ef3d44f8d2235404677437acdd3b014c4ee51468 | [
"super(FLEN, self).__init__()\nself.feature_size = feature_size\nself.embedding_size = embedding_size\nself.num_categories = num_categories\nif not field_ranges:\n field_ranges = torch.tensor(range(num_categories))\nself.field_ranges = field_ranges\nself.field_size = field_size\nself.emb_layer = nn.Embedding(num... | <|body_start_0|>
super(FLEN, self).__init__()
self.feature_size = feature_size
self.embedding_size = embedding_size
self.num_categories = num_categories
if not field_ranges:
field_ranges = torch.tensor(range(num_categories))
self.field_ranges = field_ranges
... | FLEN Network | FLEN | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FLEN:
"""FLEN Network"""
def __init__(self, feature_size, field_size, num_categories, field_ranges, embedding_size=5, fc_dims=[32, 32, 32], dropout=0.0, is_batch_norm=False, out_type='binary'):
"""Init model :param feature_size: int, size of the feature dictionary :param num_categori... | stack_v2_sparse_classes_36k_train_008697 | 4,457 | permissive | [
{
"docstring": "Init model :param feature_size: int, size of the feature dictionary :param num_categories: int, size of the category fields :param field_ranges: :param embedding_size: :param fc_dims: :param dropout: :param is_batch_norm: :param out_type:",
"name": "__init__",
"signature": "def __init__(... | 2 | stack_v2_sparse_classes_30k_train_017348 | Implement the Python class `FLEN` described below.
Class description:
FLEN Network
Method signatures and docstrings:
- def __init__(self, feature_size, field_size, num_categories, field_ranges, embedding_size=5, fc_dims=[32, 32, 32], dropout=0.0, is_batch_norm=False, out_type='binary'): Init model :param feature_size... | Implement the Python class `FLEN` described below.
Class description:
FLEN Network
Method signatures and docstrings:
- def __init__(self, feature_size, field_size, num_categories, field_ranges, embedding_size=5, fc_dims=[32, 32, 32], dropout=0.0, is_batch_norm=False, out_type='binary'): Init model :param feature_size... | 8437dea8baf0137ab3c07dd19c5f2bb8c15b4435 | <|skeleton|>
class FLEN:
"""FLEN Network"""
def __init__(self, feature_size, field_size, num_categories, field_ranges, embedding_size=5, fc_dims=[32, 32, 32], dropout=0.0, is_batch_norm=False, out_type='binary'):
"""Init model :param feature_size: int, size of the feature dictionary :param num_categori... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FLEN:
"""FLEN Network"""
def __init__(self, feature_size, field_size, num_categories, field_ranges, embedding_size=5, fc_dims=[32, 32, 32], dropout=0.0, is_batch_norm=False, out_type='binary'):
"""Init model :param feature_size: int, size of the feature dictionary :param num_categories: int, size... | the_stack_v2_python_sparse | rater/models/ctr/flen.py | geziaka/rater | train | 0 |
ea50b8248744cd7efa23d29e2546e9cfedf20037 | [
"self.marker_id = self._id.next()\nname = 'Marker' + str(self.marker_id)\nsuper(Marker, self).__init__(name, parent=parent)\nself._parent = parent\nself.node_id = node_id\nself.body_id = body_id\nself.rP = rP\nself.uP = uP\nself.SetConeRadius(0.0)\nself.AxisLabelsOff()\nself._size = 0.002\nself.SetTotalLength(self.... | <|body_start_0|>
self.marker_id = self._id.next()
name = 'Marker' + str(self.marker_id)
super(Marker, self).__init__(name, parent=parent)
self._parent = parent
self.node_id = node_id
self.body_id = body_id
self.rP = rP
self.uP = uP
self.SetConeRadi... | classdocs | Marker | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Marker:
"""classdocs"""
def __init__(self, rP, uP=None, theta0=np.zeros(3), body_id=None, node_id=None, body=None, MBD_item=None, parent=None):
""":return:"""
<|body_0|>
def update_vtk_data(self, q, rP=np.zeros(3), theta=np.zeros(3)):
""":return:"""
<|bod... | stack_v2_sparse_classes_36k_train_008698 | 3,323 | no_license | [
{
"docstring": ":return:",
"name": "__init__",
"signature": "def __init__(self, rP, uP=None, theta0=np.zeros(3), body_id=None, node_id=None, body=None, MBD_item=None, parent=None)"
},
{
"docstring": ":return:",
"name": "update_vtk_data",
"signature": "def update_vtk_data(self, q, rP=np.z... | 5 | null | Implement the Python class `Marker` described below.
Class description:
classdocs
Method signatures and docstrings:
- def __init__(self, rP, uP=None, theta0=np.zeros(3), body_id=None, node_id=None, body=None, MBD_item=None, parent=None): :return:
- def update_vtk_data(self, q, rP=np.zeros(3), theta=np.zeros(3)): :ret... | Implement the Python class `Marker` described below.
Class description:
classdocs
Method signatures and docstrings:
- def __init__(self, rP, uP=None, theta0=np.zeros(3), body_id=None, node_id=None, body=None, MBD_item=None, parent=None): :return:
- def update_vtk_data(self, q, rP=np.zeros(3), theta=np.zeros(3)): :ret... | 5e6a54dee662206664dde022ccca372f966b1789 | <|skeleton|>
class Marker:
"""classdocs"""
def __init__(self, rP, uP=None, theta0=np.zeros(3), body_id=None, node_id=None, body=None, MBD_item=None, parent=None):
""":return:"""
<|body_0|>
def update_vtk_data(self, q, rP=np.zeros(3), theta=np.zeros(3)):
""":return:"""
<|bod... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Marker:
"""classdocs"""
def __init__(self, rP, uP=None, theta0=np.zeros(3), body_id=None, node_id=None, body=None, MBD_item=None, parent=None):
""":return:"""
self.marker_id = self._id.next()
name = 'Marker' + str(self.marker_id)
super(Marker, self).__init__(name, parent=p... | the_stack_v2_python_sparse | simulation_control_widget/vtk_widget/marker/marker.py | xupeiwust/DyS | train | 0 |
8d47c43dde1380a19c72a1a2863d1d9f05b255d1 | [
"A = sum(machines)\nl = len(machines)\nif A % l != 0:\n return -1\nneed = A // l\ntoLeft = 0\nres = 0\nfor i in range(len(machines)):\n toRight = machines[i] - need - toLeft\n res = max(res, toLeft, toRight, toLeft + toRight)\n toLeft = -toRight\nreturn res",
"s = 0\nl = len(machines)\nfor i in machin... | <|body_start_0|>
A = sum(machines)
l = len(machines)
if A % l != 0:
return -1
need = A // l
toLeft = 0
res = 0
for i in range(len(machines)):
toRight = machines[i] - need - toLeft
res = max(res, toLeft, toRight, toLeft + toRight... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findMinMoves(self, machines):
""":type machines: List[int] :rtype: int 51ms"""
<|body_0|>
def findMinMoves_1(self, machines):
""":type machines: List[int] :rtype: int 47ms"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
A = sum(machine... | stack_v2_sparse_classes_36k_train_008699 | 2,247 | no_license | [
{
"docstring": ":type machines: List[int] :rtype: int 51ms",
"name": "findMinMoves",
"signature": "def findMinMoves(self, machines)"
},
{
"docstring": ":type machines: List[int] :rtype: int 47ms",
"name": "findMinMoves_1",
"signature": "def findMinMoves_1(self, machines)"
}
] | 2 | stack_v2_sparse_classes_30k_train_001947 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findMinMoves(self, machines): :type machines: List[int] :rtype: int 51ms
- def findMinMoves_1(self, machines): :type machines: List[int] :rtype: int 47ms | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findMinMoves(self, machines): :type machines: List[int] :rtype: int 51ms
- def findMinMoves_1(self, machines): :type machines: List[int] :rtype: int 47ms
<|skeleton|>
class ... | 679a2b246b8b6bb7fc55ed1c8096d3047d6d4461 | <|skeleton|>
class Solution:
def findMinMoves(self, machines):
""":type machines: List[int] :rtype: int 51ms"""
<|body_0|>
def findMinMoves_1(self, machines):
""":type machines: List[int] :rtype: int 47ms"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def findMinMoves(self, machines):
""":type machines: List[int] :rtype: int 51ms"""
A = sum(machines)
l = len(machines)
if A % l != 0:
return -1
need = A // l
toLeft = 0
res = 0
for i in range(len(machines)):
toRi... | the_stack_v2_python_sparse | SuperWashingMachines_HARD_517.py | 953250587/leetcode-python | train | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.