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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
cf54d9bf5a263143aaa8bcd2b00dc7d57e3b251a | [
"if self.request.version == 'v6':\n return BatchDetailsSerializerV6\nelif self.request.version == 'v7':\n return BatchDetailsSerializerV6",
"if request.version == 'v6':\n return self._retrieve_v6(batch_id)\nelif request.version == 'v7':\n return self._retrieve_v6(batch_id)\nraise Http404()",
"if req... | <|body_start_0|>
if self.request.version == 'v6':
return BatchDetailsSerializerV6
elif self.request.version == 'v7':
return BatchDetailsSerializerV6
<|end_body_0|>
<|body_start_1|>
if request.version == 'v6':
return self._retrieve_v6(batch_id)
elif re... | This view is the endpoint for a specific batch | BatchDetailsView | [
"LicenseRef-scancode-free-unknown",
"Apache-2.0",
"LicenseRef-scancode-public-domain"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BatchDetailsView:
"""This view is the endpoint for a specific batch"""
def get_serializer_class(self):
"""Returns the appropriate serializer based off the requests version of the REST API"""
<|body_0|>
def retrieve(self, request, batch_id):
"""Retrieves the detai... | stack_v2_sparse_classes_36k_train_011900 | 14,601 | permissive | [
{
"docstring": "Returns the appropriate serializer based off the requests version of the REST API",
"name": "get_serializer_class",
"signature": "def get_serializer_class(self)"
},
{
"docstring": "Retrieves the details for a batch and returns them in JSON form :param request: the HTTP GET reques... | 5 | null | Implement the Python class `BatchDetailsView` described below.
Class description:
This view is the endpoint for a specific batch
Method signatures and docstrings:
- def get_serializer_class(self): Returns the appropriate serializer based off the requests version of the REST API
- def retrieve(self, request, batch_id)... | Implement the Python class `BatchDetailsView` described below.
Class description:
This view is the endpoint for a specific batch
Method signatures and docstrings:
- def get_serializer_class(self): Returns the appropriate serializer based off the requests version of the REST API
- def retrieve(self, request, batch_id)... | 28618aee07ceed9e4a6eb7b8d0e6f05b31d8fd6b | <|skeleton|>
class BatchDetailsView:
"""This view is the endpoint for a specific batch"""
def get_serializer_class(self):
"""Returns the appropriate serializer based off the requests version of the REST API"""
<|body_0|>
def retrieve(self, request, batch_id):
"""Retrieves the detai... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BatchDetailsView:
"""This view is the endpoint for a specific batch"""
def get_serializer_class(self):
"""Returns the appropriate serializer based off the requests version of the REST API"""
if self.request.version == 'v6':
return BatchDetailsSerializerV6
elif self.req... | the_stack_v2_python_sparse | scale/batch/views.py | kfconsultant/scale | train | 0 |
f1f8659f7f88284d464d69205950c77050b914f7 | [
"self.n = n\nself.p = p\nself.fact = [1, 1]\nself.factinv = [1, 1]\nself.inv = [0, 1]",
"numer, denom = (1, 1)\nfor i in range(r):\n numer = numer * (n - i) % self.p\n denom = denom * (i + 1) % self.p\nreturn numer * pow(denom, self.p - 2, self.p) % self.p",
"for i in range(2, self.n + 1):\n self.fact.... | <|body_start_0|>
self.n = n
self.p = p
self.fact = [1, 1]
self.factinv = [1, 1]
self.inv = [0, 1]
<|end_body_0|>
<|body_start_1|>
numer, denom = (1, 1)
for i in range(r):
numer = numer * (n - i) % self.p
denom = denom * (i + 1) % self.p
... | CmbMod | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CmbMod:
def __init__(self, n, p):
"""二項係数nCr(n個の区別できるものからr個のものを選ぶ組み合わせの数)をpで割った余りを求める"""
<|body_0|>
def cmb_mod(self, n, r):
"""二項係数nCr(mod p)をO(r)にて計算。nが大きいがrは小さい時に使用。"""
<|body_1|>
def prep(self):
"""二項係数nCr(mod p)をO(1)で求める為の前処理をO(N)にて実行。"""
... | stack_v2_sparse_classes_36k_train_011901 | 2,051 | no_license | [
{
"docstring": "二項係数nCr(n個の区別できるものからr個のものを選ぶ組み合わせの数)をpで割った余りを求める",
"name": "__init__",
"signature": "def __init__(self, n, p)"
},
{
"docstring": "二項係数nCr(mod p)をO(r)にて計算。nが大きいがrは小さい時に使用。",
"name": "cmb_mod",
"signature": "def cmb_mod(self, n, r)"
},
{
"docstring": "二項係数nCr(mod p)... | 4 | null | Implement the Python class `CmbMod` described below.
Class description:
Implement the CmbMod class.
Method signatures and docstrings:
- def __init__(self, n, p): 二項係数nCr(n個の区別できるものからr個のものを選ぶ組み合わせの数)をpで割った余りを求める
- def cmb_mod(self, n, r): 二項係数nCr(mod p)をO(r)にて計算。nが大きいがrは小さい時に使用。
- def prep(self): 二項係数nCr(mod p)をO(1)で求... | Implement the Python class `CmbMod` described below.
Class description:
Implement the CmbMod class.
Method signatures and docstrings:
- def __init__(self, n, p): 二項係数nCr(n個の区別できるものからr個のものを選ぶ組み合わせの数)をpで割った余りを求める
- def cmb_mod(self, n, r): 二項係数nCr(mod p)をO(r)にて計算。nが大きいがrは小さい時に使用。
- def prep(self): 二項係数nCr(mod p)をO(1)で求... | 2526e72de9eb19d1e1c634dbd577816bfe39bc10 | <|skeleton|>
class CmbMod:
def __init__(self, n, p):
"""二項係数nCr(n個の区別できるものからr個のものを選ぶ組み合わせの数)をpで割った余りを求める"""
<|body_0|>
def cmb_mod(self, n, r):
"""二項係数nCr(mod p)をO(r)にて計算。nが大きいがrは小さい時に使用。"""
<|body_1|>
def prep(self):
"""二項係数nCr(mod p)をO(1)で求める為の前処理をO(N)にて実行。"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CmbMod:
def __init__(self, n, p):
"""二項係数nCr(n個の区別できるものからr個のものを選ぶ組み合わせの数)をpで割った余りを求める"""
self.n = n
self.p = p
self.fact = [1, 1]
self.factinv = [1, 1]
self.inv = [0, 1]
def cmb_mod(self, n, r):
"""二項係数nCr(mod p)をO(r)にて計算。nが大きいがrは小さい時に使用。"""
... | the_stack_v2_python_sparse | ARC/ARC039/ARC039-B.py | happa64/AtCoder_Beginner_Contest | train | 0 | |
66d39efd66bbbb34a3930015c2cdaa179410b8ba | [
"self.archive = []\nself.activateClip = preferences.BooleanPreference().getFromValue('Activate Clip', True)\nself.archive.append(self.activateClip)\nself.clipOverExtrusionWidth = preferences.FloatPreference().getFromValue('Clip Over Extrusion Width (ratio):', 0.15)\nself.archive.append(self.clipOverExtrusionWidth)\... | <|body_start_0|>
self.archive = []
self.activateClip = preferences.BooleanPreference().getFromValue('Activate Clip', True)
self.archive.append(self.activateClip)
self.clipOverExtrusionWidth = preferences.FloatPreference().getFromValue('Clip Over Extrusion Width (ratio):', 0.15)
s... | A class to handle the clip preferences. | ClipPreferences | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ClipPreferences:
"""A class to handle the clip preferences."""
def __init__(self):
"""Set the default preferences, execute title & preferences fileName."""
<|body_0|>
def execute(self):
"""Clip button has been clicked."""
<|body_1|>
<|end_skeleton|>
<|b... | stack_v2_sparse_classes_36k_train_011902 | 8,539 | no_license | [
{
"docstring": "Set the default preferences, execute title & preferences fileName.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Clip button has been clicked.",
"name": "execute",
"signature": "def execute(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_003167 | Implement the Python class `ClipPreferences` described below.
Class description:
A class to handle the clip preferences.
Method signatures and docstrings:
- def __init__(self): Set the default preferences, execute title & preferences fileName.
- def execute(self): Clip button has been clicked. | Implement the Python class `ClipPreferences` described below.
Class description:
A class to handle the clip preferences.
Method signatures and docstrings:
- def __init__(self): Set the default preferences, execute title & preferences fileName.
- def execute(self): Clip button has been clicked.
<|skeleton|>
class Cli... | 9e24dabbca21e67fecda1ed55a5af45dce41bfe2 | <|skeleton|>
class ClipPreferences:
"""A class to handle the clip preferences."""
def __init__(self):
"""Set the default preferences, execute title & preferences fileName."""
<|body_0|>
def execute(self):
"""Clip button has been clicked."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ClipPreferences:
"""A class to handle the clip preferences."""
def __init__(self):
"""Set the default preferences, execute title & preferences fileName."""
self.archive = []
self.activateClip = preferences.BooleanPreference().getFromValue('Activate Clip', True)
self.archiv... | the_stack_v2_python_sparse | reprap_python_beanshell/skeinforge_tools/craft_plugins/clip.py | TeamTeamUSA/SkeinFox | train | 0 |
7e607f7dfbf9313a2df4ed9add7dc8590faf722b | [
"if not root:\n return\nif root.left is None and root.right is None:\n return root\nreturn self.dfs(root)",
"if not node:\n return\ntmp = self.dfs(node.left)\nnode.left = self.dfs(node.right)\nnode.right = tmp\nreturn node"
] | <|body_start_0|>
if not root:
return
if root.left is None and root.right is None:
return root
return self.dfs(root)
<|end_body_0|>
<|body_start_1|>
if not node:
return
tmp = self.dfs(node.left)
node.left = self.dfs(node.right)
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def invertTree(self, root):
""":type root: TreeNode :rtype: TreeNode"""
<|body_0|>
def dfs(self, node):
""":type node: TreeNode :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not root:
return
if roo... | stack_v2_sparse_classes_36k_train_011903 | 1,152 | no_license | [
{
"docstring": ":type root: TreeNode :rtype: TreeNode",
"name": "invertTree",
"signature": "def invertTree(self, root)"
},
{
"docstring": ":type node: TreeNode :rtype: TreeNode",
"name": "dfs",
"signature": "def dfs(self, node)"
}
] | 2 | stack_v2_sparse_classes_30k_train_017299 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def invertTree(self, root): :type root: TreeNode :rtype: TreeNode
- def dfs(self, node): :type node: TreeNode :rtype: TreeNode | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def invertTree(self, root): :type root: TreeNode :rtype: TreeNode
- def dfs(self, node): :type node: TreeNode :rtype: TreeNode
<|skeleton|>
class Solution:
def invertTree(s... | f012740215568768794a019153af0b6e4c77b91b | <|skeleton|>
class Solution:
def invertTree(self, root):
""":type root: TreeNode :rtype: TreeNode"""
<|body_0|>
def dfs(self, node):
""":type node: TreeNode :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def invertTree(self, root):
""":type root: TreeNode :rtype: TreeNode"""
if not root:
return
if root.left is None and root.right is None:
return root
return self.dfs(root)
def dfs(self, node):
""":type node: TreeNode :rtype: TreeNod... | the_stack_v2_python_sparse | No.226_InvertBinaryTree.py | wh279813/LeetCode | train | 0 | |
3a296923732c90228989255ec5da214cf5a396e2 | [
"self._attacker = attacker\nself._defender = defender\nsuper().__init__(attacker, defender, enemy=enemy)",
"super().update(ticks)\nself._scrolling_background.scroll(dx=-1)\nif self.is_dead():\n self._scrolling_background = FRAMES.reload(self._move_file_name[:-4] + '_background.png', (0, 0))\n return\nbackgr... | <|body_start_0|>
self._attacker = attacker
self._defender = defender
super().__init__(attacker, defender, enemy=enemy)
<|end_body_0|>
<|body_start_1|>
super().update(ticks)
self._scrolling_background.scroll(dx=-1)
if self.is_dead():
self._scrolling_background... | ScrollingMove | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ScrollingMove:
def __init__(self, attacker, defender, enemy=False):
"""This class, which extends MoveBase, is the basis for all moves that have a scrolling background. One can see an example of this in moves like Thunder. This class controls the scrolling of the background."""
<|... | stack_v2_sparse_classes_36k_train_011904 | 1,761 | no_license | [
{
"docstring": "This class, which extends MoveBase, is the basis for all moves that have a scrolling background. One can see an example of this in moves like Thunder. This class controls the scrolling of the background.",
"name": "__init__",
"signature": "def __init__(self, attacker, defender, enemy=Fal... | 2 | stack_v2_sparse_classes_30k_train_002933 | Implement the Python class `ScrollingMove` described below.
Class description:
Implement the ScrollingMove class.
Method signatures and docstrings:
- def __init__(self, attacker, defender, enemy=False): This class, which extends MoveBase, is the basis for all moves that have a scrolling background. One can see an exa... | Implement the Python class `ScrollingMove` described below.
Class description:
Implement the ScrollingMove class.
Method signatures and docstrings:
- def __init__(self, attacker, defender, enemy=False): This class, which extends MoveBase, is the basis for all moves that have a scrolling background. One can see an exa... | 6718fdb6555d87f0b7b331c10d64a604431f8e81 | <|skeleton|>
class ScrollingMove:
def __init__(self, attacker, defender, enemy=False):
"""This class, which extends MoveBase, is the basis for all moves that have a scrolling background. One can see an example of this in moves like Thunder. This class controls the scrolling of the background."""
<|... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ScrollingMove:
def __init__(self, attacker, defender, enemy=False):
"""This class, which extends MoveBase, is the basis for all moves that have a scrolling background. One can see an example of this in moves like Thunder. This class controls the scrolling of the background."""
self._attacker =... | the_stack_v2_python_sparse | pokered/modules/animations/moves/scrolling_move.py | surranc20/pokered | train | 44 | |
22b1732d723a24284b4156248463121e13cf4c29 | [
"if page_url is None or html_cont is None:\n return\nsoup = BeautifulSoup(html_cont, 'html.parser', from_encoding='utf-8')\nnew_urls = self._get_new_urls(page_url, soup)\nnew_data = self._get_new_data(page_url, soup)\nreturn (new_urls, new_data)",
"new_urls = set()\nlinks = soup.find_all('a', href=re.compile('... | <|body_start_0|>
if page_url is None or html_cont is None:
return
soup = BeautifulSoup(html_cont, 'html.parser', from_encoding='utf-8')
new_urls = self._get_new_urls(page_url, soup)
new_data = self._get_new_data(page_url, soup)
return (new_urls, new_data)
<|end_body_0... | Htmlparser | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Htmlparser:
def parser(self, page_url, html_cont):
"""用于解析网页内容,抽取URL和数据 :param page_url:下载页面的URL:param html_cont:下载的网页内容 :return:返回URL和数据"""
<|body_0|>
def _get_new_urls(self, page_url, soup):
""":F1抽取新的URL集合 :param page_ur1:下载页面的URL :param soup:soup :return:返回新的URL集... | stack_v2_sparse_classes_36k_train_011905 | 1,722 | no_license | [
{
"docstring": "用于解析网页内容,抽取URL和数据 :param page_url:下载页面的URL:param html_cont:下载的网页内容 :return:返回URL和数据",
"name": "parser",
"signature": "def parser(self, page_url, html_cont)"
},
{
"docstring": ":F1抽取新的URL集合 :param page_ur1:下载页面的URL :param soup:soup :return:返回新的URL集合",
"name": "_get_new_urls",
... | 3 | stack_v2_sparse_classes_30k_train_014838 | Implement the Python class `Htmlparser` described below.
Class description:
Implement the Htmlparser class.
Method signatures and docstrings:
- def parser(self, page_url, html_cont): 用于解析网页内容,抽取URL和数据 :param page_url:下载页面的URL:param html_cont:下载的网页内容 :return:返回URL和数据
- def _get_new_urls(self, page_url, soup): :F1抽取新的U... | Implement the Python class `Htmlparser` described below.
Class description:
Implement the Htmlparser class.
Method signatures and docstrings:
- def parser(self, page_url, html_cont): 用于解析网页内容,抽取URL和数据 :param page_url:下载页面的URL:param html_cont:下载的网页内容 :return:返回URL和数据
- def _get_new_urls(self, page_url, soup): :F1抽取新的U... | 5651c6469496e9d3aa08c9ff66884175e181a7d4 | <|skeleton|>
class Htmlparser:
def parser(self, page_url, html_cont):
"""用于解析网页内容,抽取URL和数据 :param page_url:下载页面的URL:param html_cont:下载的网页内容 :return:返回URL和数据"""
<|body_0|>
def _get_new_urls(self, page_url, soup):
""":F1抽取新的URL集合 :param page_ur1:下载页面的URL :param soup:soup :return:返回新的URL集... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Htmlparser:
def parser(self, page_url, html_cont):
"""用于解析网页内容,抽取URL和数据 :param page_url:下载页面的URL:param html_cont:下载的网页内容 :return:返回URL和数据"""
if page_url is None or html_cont is None:
return
soup = BeautifulSoup(html_cont, 'html.parser', from_encoding='utf-8')
new_ur... | the_stack_v2_python_sparse | PythonReptiles/HtmlParser.py | liwtText/GetText | train | 0 | |
55c3fc3dbb121e01940a7846c6a5b79acfb2076c | [
"url = utils.urljoin(self.base_path, self.id, 'users', user.id, 'roles', role.id)\nresp = session.put(url)\nif resp.status_code == 204:\n return True\nreturn False",
"url = utils.urljoin(self.base_path, self.id, 'users', user.id, 'roles', role.id)\nresp = session.head(url)\nif resp.status_code == 204:\n ret... | <|body_start_0|>
url = utils.urljoin(self.base_path, self.id, 'users', user.id, 'roles', role.id)
resp = session.put(url)
if resp.status_code == 204:
return True
return False
<|end_body_0|>
<|body_start_1|>
url = utils.urljoin(self.base_path, self.id, 'users', user.i... | Project | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Project:
def assign_role_to_user(self, session, user, role):
"""Assign role to user on project"""
<|body_0|>
def validate_user_has_role(self, session, user, role):
"""Validates that a user has a role on a project"""
<|body_1|>
def unassign_role_from_user... | stack_v2_sparse_classes_36k_train_011906 | 4,885 | permissive | [
{
"docstring": "Assign role to user on project",
"name": "assign_role_to_user",
"signature": "def assign_role_to_user(self, session, user, role)"
},
{
"docstring": "Validates that a user has a role on a project",
"name": "validate_user_has_role",
"signature": "def validate_user_has_role(... | 6 | stack_v2_sparse_classes_30k_train_007145 | Implement the Python class `Project` described below.
Class description:
Implement the Project class.
Method signatures and docstrings:
- def assign_role_to_user(self, session, user, role): Assign role to user on project
- def validate_user_has_role(self, session, user, role): Validates that a user has a role on a pr... | Implement the Python class `Project` described below.
Class description:
Implement the Project class.
Method signatures and docstrings:
- def assign_role_to_user(self, session, user, role): Assign role to user on project
- def validate_user_has_role(self, session, user, role): Validates that a user has a role on a pr... | d474eb84c605c429bb9cccb166cabbdd1654d73c | <|skeleton|>
class Project:
def assign_role_to_user(self, session, user, role):
"""Assign role to user on project"""
<|body_0|>
def validate_user_has_role(self, session, user, role):
"""Validates that a user has a role on a project"""
<|body_1|>
def unassign_role_from_user... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Project:
def assign_role_to_user(self, session, user, role):
"""Assign role to user on project"""
url = utils.urljoin(self.base_path, self.id, 'users', user.id, 'roles', role.id)
resp = session.put(url)
if resp.status_code == 204:
return True
return False
... | the_stack_v2_python_sparse | openstack/identity/v3/project.py | openstack/openstacksdk | train | 124 | |
23e0f3de9f5fc64dd937112bbcef229d9489f96b | [
"super().__init__()\nassert reduction in ['mean', 'sum'], \" reduction must in ['mean','sum']\"\nself.alpha = alpha\nself.beta = beta\nself.ohem_ratio = ohem_ratio\nself.reduction = reduction\nself.bce_loss = BalanceCrossEntropyLoss(negative_ratio=ohem_ratio, eps=eps)\nself.dice_loss = DiceLoss(eps=eps)\nself.l1_lo... | <|body_start_0|>
super().__init__()
assert reduction in ['mean', 'sum'], " reduction must in ['mean','sum']"
self.alpha = alpha
self.beta = beta
self.ohem_ratio = ohem_ratio
self.reduction = reduction
self.bce_loss = BalanceCrossEntropyLoss(negative_ratio=ohem_rat... | DBLoss | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DBLoss:
def __init__(self, alpha=1.0, beta=10, ohem_ratio=3, reduction='mean', eps=1e-06):
"""DB loss :param alpha: :param beta: :param ohem_ratio: :param reduction: :param eps:"""
<|body_0|>
def forward(self, pred, batch):
""":param pred: :param batch: bach为一个dict{ ... | stack_v2_sparse_classes_36k_train_011907 | 2,366 | permissive | [
{
"docstring": "DB loss :param alpha: :param beta: :param ohem_ratio: :param reduction: :param eps:",
"name": "__init__",
"signature": "def __init__(self, alpha=1.0, beta=10, ohem_ratio=3, reduction='mean', eps=1e-06)"
},
{
"docstring": ":param pred: :param batch: bach为一个dict{ 'shrink_map': 收缩图,... | 2 | null | Implement the Python class `DBLoss` described below.
Class description:
Implement the DBLoss class.
Method signatures and docstrings:
- def __init__(self, alpha=1.0, beta=10, ohem_ratio=3, reduction='mean', eps=1e-06): DB loss :param alpha: :param beta: :param ohem_ratio: :param reduction: :param eps:
- def forward(s... | Implement the Python class `DBLoss` described below.
Class description:
Implement the DBLoss class.
Method signatures and docstrings:
- def __init__(self, alpha=1.0, beta=10, ohem_ratio=3, reduction='mean', eps=1e-06): DB loss :param alpha: :param beta: :param ohem_ratio: :param reduction: :param eps:
- def forward(s... | 1c2fed17ce85dadb16b0f47f0bde2bdce7a310af | <|skeleton|>
class DBLoss:
def __init__(self, alpha=1.0, beta=10, ohem_ratio=3, reduction='mean', eps=1e-06):
"""DB loss :param alpha: :param beta: :param ohem_ratio: :param reduction: :param eps:"""
<|body_0|>
def forward(self, pred, batch):
""":param pred: :param batch: bach为一个dict{ ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DBLoss:
def __init__(self, alpha=1.0, beta=10, ohem_ratio=3, reduction='mean', eps=1e-06):
"""DB loss :param alpha: :param beta: :param ohem_ratio: :param reduction: :param eps:"""
super().__init__()
assert reduction in ['mean', 'sum'], " reduction must in ['mean','sum']"
self.... | the_stack_v2_python_sparse | torchocr/losses/db_loss.py | flyingGH/OpenOCR | train | 0 | |
a98e03c1f3cc30278fad3213d0176d2991df7f8a | [
"self.paths = module_paths\nself.module_append_string = '\\n'.join(('module.paths.push(\"%s\")\\n' % p for p in self.paths))\ncommand_string = 'var babel = require(\"babel-core\")'\nself.babel = execjs.compile(self.module_append_string + command_string)",
"if options is None:\n options = {'ast': False, 'preset... | <|body_start_0|>
self.paths = module_paths
self.module_append_string = '\n'.join(('module.paths.push("%s")\n' % p for p in self.paths))
command_string = 'var babel = require("babel-core")'
self.babel = execjs.compile(self.module_append_string + command_string)
<|end_body_0|>
<|body_star... | Babel | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Babel:
def __init__(self, *module_paths):
"""Constructor :param module_paths: Paths to node_modules"""
<|body_0|>
def transpile(self, code, options=None):
"""Takes code and runs it through babel.js if ``options`` is not provided it'll default to: .. code-block:: pyth... | stack_v2_sparse_classes_36k_train_011908 | 2,713 | permissive | [
{
"docstring": "Constructor :param module_paths: Paths to node_modules",
"name": "__init__",
"signature": "def __init__(self, *module_paths)"
},
{
"docstring": "Takes code and runs it through babel.js if ``options`` is not provided it'll default to: .. code-block:: python {'ast': false, 'presets... | 2 | stack_v2_sparse_classes_30k_train_014387 | Implement the Python class `Babel` described below.
Class description:
Implement the Babel class.
Method signatures and docstrings:
- def __init__(self, *module_paths): Constructor :param module_paths: Paths to node_modules
- def transpile(self, code, options=None): Takes code and runs it through babel.js if ``option... | Implement the Python class `Babel` described below.
Class description:
Implement the Babel class.
Method signatures and docstrings:
- def __init__(self, *module_paths): Constructor :param module_paths: Paths to node_modules
- def transpile(self, code, options=None): Takes code and runs it through babel.js if ``option... | 408f3fa3d36542d8fc1236ba1cac804de6f14b0c | <|skeleton|>
class Babel:
def __init__(self, *module_paths):
"""Constructor :param module_paths: Paths to node_modules"""
<|body_0|>
def transpile(self, code, options=None):
"""Takes code and runs it through babel.js if ``options`` is not provided it'll default to: .. code-block:: pyth... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Babel:
def __init__(self, *module_paths):
"""Constructor :param module_paths: Paths to node_modules"""
self.paths = module_paths
self.module_append_string = '\n'.join(('module.paths.push("%s")\n' % p for p in self.paths))
command_string = 'var babel = require("babel-core")'
... | the_stack_v2_python_sparse | hard-gists/19a4b105d1dff9a591b8/snippet.py | dockerizeme/dockerizeme | train | 24 | |
f6305d281838cc2f000fb95d9d3296198d3d3215 | [
"self.fname = fname\nself.testing = testing\nself.to_find = [1, 2, 3, 4, 17, 117, 517, 997]\nwith open(fname, 'r') as f:\n data = f.readlines()\nself.num_vertex = int(data[0])\ndata[0] = 0\nself.weights = [int(x) for x in data]\nif testing:\n fname = fname.replace('input', 'output')\n with open(fname, 'r')... | <|body_start_0|>
self.fname = fname
self.testing = testing
self.to_find = [1, 2, 3, 4, 17, 117, 517, 997]
with open(fname, 'r') as f:
data = f.readlines()
self.num_vertex = int(data[0])
data[0] = 0
self.weights = [int(x) for x in data]
if testi... | Defines the max weight for an independent set of a path graph | MaxWeightIndependentSet | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MaxWeightIndependentSet:
"""Defines the max weight for an independent set of a path graph"""
def __init__(self, fname, testing=False):
"""read in the input and optional solution data (if testing)"""
<|body_0|>
def generate_wis_costs(self):
"""Go through the path ... | stack_v2_sparse_classes_36k_train_011909 | 3,561 | no_license | [
{
"docstring": "read in the input and optional solution data (if testing)",
"name": "__init__",
"signature": "def __init__(self, fname, testing=False)"
},
{
"docstring": "Go through the path graph and generate the weight independent set",
"name": "generate_wis_costs",
"signature": "def g... | 4 | stack_v2_sparse_classes_30k_train_010002 | Implement the Python class `MaxWeightIndependentSet` described below.
Class description:
Defines the max weight for an independent set of a path graph
Method signatures and docstrings:
- def __init__(self, fname, testing=False): read in the input and optional solution data (if testing)
- def generate_wis_costs(self):... | Implement the Python class `MaxWeightIndependentSet` described below.
Class description:
Defines the max weight for an independent set of a path graph
Method signatures and docstrings:
- def __init__(self, fname, testing=False): read in the input and optional solution data (if testing)
- def generate_wis_costs(self):... | 2a9b795d3bbcccd5b1fce83d3ed431ec54d084a7 | <|skeleton|>
class MaxWeightIndependentSet:
"""Defines the max weight for an independent set of a path graph"""
def __init__(self, fname, testing=False):
"""read in the input and optional solution data (if testing)"""
<|body_0|>
def generate_wis_costs(self):
"""Go through the path ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MaxWeightIndependentSet:
"""Defines the max weight for an independent set of a path graph"""
def __init__(self, fname, testing=False):
"""read in the input and optional solution data (if testing)"""
self.fname = fname
self.testing = testing
self.to_find = [1, 2, 3, 4, 17, ... | the_stack_v2_python_sparse | course3/assignment3_q3.py | denck007/Algorithms_specialization | train | 1 |
cb78af925ada42e408204966003f5c31647b79ca | [
"self.db_connection = db_connection\nself.cur: pymysql.cursors.Cursor = db_connection.get_cursor()\nself.stats = stats_manager_object\nself.user_agent = user_agent\nself.connection_timeout = connection_timeout\nself.objects = {'db_connection': self.db_connection, 'stats_manager_object': self.stats, 'file_manager_ob... | <|body_start_0|>
self.db_connection = db_connection
self.cur: pymysql.cursors.Cursor = db_connection.get_cursor()
self.stats = stats_manager_object
self.user_agent = user_agent
self.connection_timeout = connection_timeout
self.objects = {'db_connection': self.db_connectio... | Manage actions (i.e. interactions with servers) except remote control of the chromium browser. | ExoActions | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ExoActions:
"""Manage actions (i.e. interactions with servers) except remote control of the chromium browser."""
def __init__(self, db_connection: database_connection.DatabaseConnection, stats_manager_object: statistics_manager.StatisticsManager, file_manager_object: file_manager.FileManager... | stack_v2_sparse_classes_36k_train_011910 | 13,314 | permissive | [
{
"docstring": "Init class",
"name": "__init__",
"signature": "def __init__(self, db_connection: database_connection.DatabaseConnection, stats_manager_object: statistics_manager.StatisticsManager, file_manager_object: file_manager.FileManager, time_manager_object: time_manager.TimeManager, crawling_erro... | 3 | stack_v2_sparse_classes_30k_train_001831 | Implement the Python class `ExoActions` described below.
Class description:
Manage actions (i.e. interactions with servers) except remote control of the chromium browser.
Method signatures and docstrings:
- def __init__(self, db_connection: database_connection.DatabaseConnection, stats_manager_object: statistics_mana... | Implement the Python class `ExoActions` described below.
Class description:
Manage actions (i.e. interactions with servers) except remote control of the chromium browser.
Method signatures and docstrings:
- def __init__(self, db_connection: database_connection.DatabaseConnection, stats_manager_object: statistics_mana... | 2cdeaeca0094a7aa37c5e2b78a0e4c82da609817 | <|skeleton|>
class ExoActions:
"""Manage actions (i.e. interactions with servers) except remote control of the chromium browser."""
def __init__(self, db_connection: database_connection.DatabaseConnection, stats_manager_object: statistics_manager.StatisticsManager, file_manager_object: file_manager.FileManager... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ExoActions:
"""Manage actions (i.e. interactions with servers) except remote control of the chromium browser."""
def __init__(self, db_connection: database_connection.DatabaseConnection, stats_manager_object: statistics_manager.StatisticsManager, file_manager_object: file_manager.FileManager, time_manage... | the_stack_v2_python_sparse | exoskeleton/actions.py | RuedigerVoigt/exoskeleton | train | 23 |
7fe201b8cafa83bf4ccc9bc6b45d52575bb3e711 | [
"def max_branch(root):\n if not root:\n return 0\n return max([len(root.children)] + [max_branch(ch) for ch in root.children])\nn = max_branch(root)\n\ndef recur(root):\n if not root:\n return ['#']\n ret = [str(root.val)]\n children = root.children\n if len(children) < n:\n c... | <|body_start_0|>
def max_branch(root):
if not root:
return 0
return max([len(root.children)] + [max_branch(ch) for ch in root.children])
n = max_branch(root)
def recur(root):
if not root:
return ['#']
ret = [str(roo... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: Node :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: Node"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|... | stack_v2_sparse_classes_36k_train_011911 | 1,939 | no_license | [
{
"docstring": "Encodes a tree to a single string. :type root: Node :rtype: str",
"name": "serialize",
"signature": "def serialize(self, root)"
},
{
"docstring": "Decodes your encoded data to tree. :type data: str :rtype: Node",
"name": "deserialize",
"signature": "def deserialize(self, ... | 2 | null | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: Node :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype: Nod... | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: Node :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype: Nod... | 2722c0deafcd094ce64140a9a837b4027d29ed6f | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: Node :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: Node"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: Node :rtype: str"""
def max_branch(root):
if not root:
return 0
return max([len(root.children)] + [max_branch(ch) for ch in root.children])
n = max_branch(root)
... | the_stack_v2_python_sparse | 428_deser_n_ary_tree_h/main.py | chao-shi/lclc | train | 0 | |
0dda8afdad4b648f5006c08506ab8443eb490e89 | [
"self.accum = [[matrix[i][j] for j in range(len(matrix[0]))] for i in range(len(matrix))]\nfor i in range(len(matrix)):\n for j in range(len(matrix[0])):\n if j == 0 and i == 0:\n continue\n if j == 0:\n self.accum[i][j] += self.accum[i - 1][j]\n elif i == 0:\n ... | <|body_start_0|>
self.accum = [[matrix[i][j] for j in range(len(matrix[0]))] for i in range(len(matrix))]
for i in range(len(matrix)):
for j in range(len(matrix[0])):
if j == 0 and i == 0:
continue
if j == 0:
self.accum[... | NumMatrix | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NumMatrix:
def __init__(self, matrix):
""":type matrix: List[List[int]]"""
<|body_0|>
def sumRegion(self, row1, col1, row2, col2):
""":type row1: int :type col1: int :type row2: int :type col2: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>... | stack_v2_sparse_classes_36k_train_011912 | 1,480 | no_license | [
{
"docstring": ":type matrix: List[List[int]]",
"name": "__init__",
"signature": "def __init__(self, matrix)"
},
{
"docstring": ":type row1: int :type col1: int :type row2: int :type col2: int :rtype: int",
"name": "sumRegion",
"signature": "def sumRegion(self, row1, col1, row2, col2)"
... | 2 | null | Implement the Python class `NumMatrix` described below.
Class description:
Implement the NumMatrix class.
Method signatures and docstrings:
- def __init__(self, matrix): :type matrix: List[List[int]]
- def sumRegion(self, row1, col1, row2, col2): :type row1: int :type col1: int :type row2: int :type col2: int :rtype:... | Implement the Python class `NumMatrix` described below.
Class description:
Implement the NumMatrix class.
Method signatures and docstrings:
- def __init__(self, matrix): :type matrix: List[List[int]]
- def sumRegion(self, row1, col1, row2, col2): :type row1: int :type col1: int :type row2: int :type col2: int :rtype:... | 917bd000c2a055dfa2633440a61ca4ae2b665fe3 | <|skeleton|>
class NumMatrix:
def __init__(self, matrix):
""":type matrix: List[List[int]]"""
<|body_0|>
def sumRegion(self, row1, col1, row2, col2):
""":type row1: int :type col1: int :type row2: int :type col2: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NumMatrix:
def __init__(self, matrix):
""":type matrix: List[List[int]]"""
self.accum = [[matrix[i][j] for j in range(len(matrix[0]))] for i in range(len(matrix))]
for i in range(len(matrix)):
for j in range(len(matrix[0])):
if j == 0 and i == 0:
... | the_stack_v2_python_sparse | 304_range-sum-query-2d-immutable.py | Khrystynka/LeetCodeProblems | train | 0 | |
bfaa39515669ff0833ec5609af7d06af9bdae15d | [
"for i in range(1, len(nums) + 1):\n idx = 0\n while idx <= len(nums) - i:\n if sum(nums[idx:idx + i]) >= s:\n return i\n idx += 1\nreturn 0",
"num_sum = 0\nmin_length = float('inf')\nstart = 0\nfor idx, val in enumerate(nums):\n num_sum += val\n if num_sum >= s:\n min_... | <|body_start_0|>
for i in range(1, len(nums) + 1):
idx = 0
while idx <= len(nums) - i:
if sum(nums[idx:idx + i]) >= s:
return i
idx += 1
return 0
<|end_body_0|>
<|body_start_1|>
num_sum = 0
min_length = float('i... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def minSubArrayLen_1(self, s, nums):
""":type s: int :type nums: List[int] :rtype: int"""
<|body_0|>
def minSubArrayLen_2(self, s, nums):
""":type s: int :type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
for... | stack_v2_sparse_classes_36k_train_011913 | 1,205 | no_license | [
{
"docstring": ":type s: int :type nums: List[int] :rtype: int",
"name": "minSubArrayLen_1",
"signature": "def minSubArrayLen_1(self, s, nums)"
},
{
"docstring": ":type s: int :type nums: List[int] :rtype: int",
"name": "minSubArrayLen_2",
"signature": "def minSubArrayLen_2(self, s, nums... | 2 | stack_v2_sparse_classes_30k_train_004852 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minSubArrayLen_1(self, s, nums): :type s: int :type nums: List[int] :rtype: int
- def minSubArrayLen_2(self, s, nums): :type s: int :type nums: List[int] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minSubArrayLen_1(self, s, nums): :type s: int :type nums: List[int] :rtype: int
- def minSubArrayLen_2(self, s, nums): :type s: int :type nums: List[int] :rtype: int
<|skele... | f0fa1f0af9613914c12f45a218500a75f9ba3c1a | <|skeleton|>
class Solution:
def minSubArrayLen_1(self, s, nums):
""":type s: int :type nums: List[int] :rtype: int"""
<|body_0|>
def minSubArrayLen_2(self, s, nums):
""":type s: int :type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def minSubArrayLen_1(self, s, nums):
""":type s: int :type nums: List[int] :rtype: int"""
for i in range(1, len(nums) + 1):
idx = 0
while idx <= len(nums) - i:
if sum(nums[idx:idx + i]) >= s:
return i
idx += ... | the_stack_v2_python_sparse | Array_and_String/Minimum_Size_Subarray_Sum.py | ncturoger/LeetCodePractice | train | 0 | |
875aef1d6a491e0cb4d4095f5b720f8a26070477 | [
"super().__init__()\nself._solution_dim = solution_dim\nself._population_size = population_size\nself._upper_bound = upper_bound\nself._lower_bound = lower_bound\nself._cost_func = cost_func",
"batch_size = observation.shape[0]\nsolutions = torch.rand(batch_size, self._population_size, self._solution_dim) * (self... | <|body_start_0|>
super().__init__()
self._solution_dim = solution_dim
self._population_size = population_size
self._upper_bound = upper_bound
self._lower_bound = lower_bound
self._cost_func = cost_func
<|end_body_0|>
<|body_start_1|>
batch_size = observation.shap... | RandomOptimizer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RandomOptimizer:
def __init__(self, solution_dim, population_size, cost_func, upper_bound, lower_bound):
"""Random Trajectory Optimizer This module conducts trajectory optimization via random-shooting-based optimization, i.e., generating a random population for each sample in the batch a... | stack_v2_sparse_classes_36k_train_011914 | 8,541 | permissive | [
{
"docstring": "Random Trajectory Optimizer This module conducts trajectory optimization via random-shooting-based optimization, i.e., generating a random population for each sample in the batch and select those having the lowest cost as the solution. Args: solution_dim (int): The dimensionality of the problem ... | 2 | null | Implement the Python class `RandomOptimizer` described below.
Class description:
Implement the RandomOptimizer class.
Method signatures and docstrings:
- def __init__(self, solution_dim, population_size, cost_func, upper_bound, lower_bound): Random Trajectory Optimizer This module conducts trajectory optimization via... | Implement the Python class `RandomOptimizer` described below.
Class description:
Implement the RandomOptimizer class.
Method signatures and docstrings:
- def __init__(self, solution_dim, population_size, cost_func, upper_bound, lower_bound): Random Trajectory Optimizer This module conducts trajectory optimization via... | b00ff2fa5e660de31020338ba340263183fbeaa4 | <|skeleton|>
class RandomOptimizer:
def __init__(self, solution_dim, population_size, cost_func, upper_bound, lower_bound):
"""Random Trajectory Optimizer This module conducts trajectory optimization via random-shooting-based optimization, i.e., generating a random population for each sample in the batch a... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RandomOptimizer:
def __init__(self, solution_dim, population_size, cost_func, upper_bound, lower_bound):
"""Random Trajectory Optimizer This module conducts trajectory optimization via random-shooting-based optimization, i.e., generating a random population for each sample in the batch and select thos... | the_stack_v2_python_sparse | alf/optimizers/traj_optimizers.py | HorizonRobotics/alf | train | 288 | |
44098b9b12434929a8f5852271bf2b0e1f3be349 | [
"prev_u_next = u_next\nwhile True:\n g = self.system.evaluate(t + dt, tslices.TimeSlice(prev_u_next, domain, time=t)).data\n dg, TOL = self.system.implicit_method_jacobian(t + dt, tslices.TimeSlice(prev_u_next, domain, time=t))\n dg = dg.data\n f = prev_u_next - u_start - dt * g\n df = 1.0 - dt * dg\... | <|body_start_0|>
prev_u_next = u_next
while True:
g = self.system.evaluate(t + dt, tslices.TimeSlice(prev_u_next, domain, time=t)).data
dg, TOL = self.system.implicit_method_jacobian(t + dt, tslices.TimeSlice(prev_u_next, domain, time=t))
dg = dg.data
f = ... | An implementation of the first order implicit Euler method. | ImplicitEuler | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ImplicitEuler:
"""An implementation of the first order implicit Euler method."""
def _NR(self, u_start, u_next, t, dt, domain):
"""A Newton-Raphson auxilliary routine for the implementation of the implicit Euler scheme. Parameters ---------- u_start: numpy.ndarray Initial values of t... | stack_v2_sparse_classes_36k_train_011915 | 8,908 | no_license | [
{
"docstring": "A Newton-Raphson auxilliary routine for the implementation of the implicit Euler scheme. Parameters ---------- u_start: numpy.ndarray Initial values of the function. u_next: numpy.ndarray The first guess at the next values of the function. t: float Current time. dt: float Current time step. doma... | 2 | null | Implement the Python class `ImplicitEuler` described below.
Class description:
An implementation of the first order implicit Euler method.
Method signatures and docstrings:
- def _NR(self, u_start, u_next, t, dt, domain): A Newton-Raphson auxilliary routine for the implementation of the implicit Euler scheme. Paramet... | Implement the Python class `ImplicitEuler` described below.
Class description:
An implementation of the first order implicit Euler method.
Method signatures and docstrings:
- def _NR(self, u_start, u_next, t, dt, domain): A Newton-Raphson auxilliary routine for the implementation of the implicit Euler scheme. Paramet... | 2ce16d776448553e2ae5c45f3cf973c8271aefbf | <|skeleton|>
class ImplicitEuler:
"""An implementation of the first order implicit Euler method."""
def _NR(self, u_start, u_next, t, dt, domain):
"""A Newton-Raphson auxilliary routine for the implementation of the implicit Euler scheme. Parameters ---------- u_start: numpy.ndarray Initial values of t... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ImplicitEuler:
"""An implementation of the first order implicit Euler method."""
def _NR(self, u_start, u_next, t, dt, domain):
"""A Newton-Raphson auxilliary routine for the implementation of the implicit Euler scheme. Parameters ---------- u_start: numpy.ndarray Initial values of the function. ... | the_stack_v2_python_sparse | Code/packages/coffee/solvers/solvers.py | mfuphi/SOFTX_2019_93 | train | 0 |
311d5bb07b10110f6da9df5f1c2770c26de680de | [
"super(LeftItemWidget, self).__init__(*args, **kwargs)\nself.item_ = item\nself.check_ = check_all\nself.list_ = args[0]\nrow = self.list_.indexFromItem(self.item_).row()\nh_box = QHBoxLayout(self)\nself.checkbox = QCheckBox('选项{0}'.format(row))\nself.label = QLabel('这是第{0}标签'.format(row))\nh_box.addWidget(self.che... | <|body_start_0|>
super(LeftItemWidget, self).__init__(*args, **kwargs)
self.item_ = item
self.check_ = check_all
self.list_ = args[0]
row = self.list_.indexFromItem(self.item_).row()
h_box = QHBoxLayout(self)
self.checkbox = QCheckBox('选项{0}'.format(row))
... | 自定义列表item控件,用于插入自定义控件 自定义控件时,注意区分实例属性和类属性 相关内容需要对应各自的实例,否则无法进行操作 | LeftItemWidget | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LeftItemWidget:
"""自定义列表item控件,用于插入自定义控件 自定义控件时,注意区分实例属性和类属性 相关内容需要对应各自的实例,否则无法进行操作"""
def __init__(self, item, check_all, *args, **kwargs):
"""自定义控件初始化 :param item: 注意这里的item是实例属性,由上面初始化时传递,每个item对应不同实例 :param check_all: 注意这里的check_all是实例属性,由上面初始化时传递,每个check_all对应不同实例, 有多少个实例就有多少个实例... | stack_v2_sparse_classes_36k_train_011916 | 6,371 | no_license | [
{
"docstring": "自定义控件初始化 :param item: 注意这里的item是实例属性,由上面初始化时传递,每个item对应不同实例 :param check_all: 注意这里的check_all是实例属性,由上面初始化时传递,每个check_all对应不同实例, 有多少个实例就有多少个实例属性 :param args: :param kwargs:",
"name": "__init__",
"signature": "def __init__(self, item, check_all, *args, **kwargs)"
},
{
"docstring": "... | 3 | stack_v2_sparse_classes_30k_val_000729 | Implement the Python class `LeftItemWidget` described below.
Class description:
自定义列表item控件,用于插入自定义控件 自定义控件时,注意区分实例属性和类属性 相关内容需要对应各自的实例,否则无法进行操作
Method signatures and docstrings:
- def __init__(self, item, check_all, *args, **kwargs): 自定义控件初始化 :param item: 注意这里的item是实例属性,由上面初始化时传递,每个item对应不同实例 :param check_all: 注意这里的... | Implement the Python class `LeftItemWidget` described below.
Class description:
自定义列表item控件,用于插入自定义控件 自定义控件时,注意区分实例属性和类属性 相关内容需要对应各自的实例,否则无法进行操作
Method signatures and docstrings:
- def __init__(self, item, check_all, *args, **kwargs): 自定义控件初始化 :param item: 注意这里的item是实例属性,由上面初始化时传递,每个item对应不同实例 :param check_all: 注意这里的... | 7dde3ab21bc29ab810f64b5fd64c69299ba0d90d | <|skeleton|>
class LeftItemWidget:
"""自定义列表item控件,用于插入自定义控件 自定义控件时,注意区分实例属性和类属性 相关内容需要对应各自的实例,否则无法进行操作"""
def __init__(self, item, check_all, *args, **kwargs):
"""自定义控件初始化 :param item: 注意这里的item是实例属性,由上面初始化时传递,每个item对应不同实例 :param check_all: 注意这里的check_all是实例属性,由上面初始化时传递,每个check_all对应不同实例, 有多少个实例就有多少个实例... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LeftItemWidget:
"""自定义列表item控件,用于插入自定义控件 自定义控件时,注意区分实例属性和类属性 相关内容需要对应各自的实例,否则无法进行操作"""
def __init__(self, item, check_all, *args, **kwargs):
"""自定义控件初始化 :param item: 注意这里的item是实例属性,由上面初始化时传递,每个item对应不同实例 :param check_all: 注意这里的check_all是实例属性,由上面初始化时传递,每个check_all对应不同实例, 有多少个实例就有多少个实例属性 :param arg... | the_stack_v2_python_sparse | demo/view/test_check_all_add_widget.py | RonChu-01/package_demo | train | 0 |
bff906aea8c1ca0ea97af646f4a4f95352a157b6 | [
"if data is None:\n if n <= 0:\n raise ValueError('n must be a positive value')\n if p >= 1 or p <= 0:\n raise ValueError('p must be greater than 0 and less than 1')\n self.n = n\n self.p = p\nelse:\n if type(data) is not list:\n raise TypeError('data must be a list')\n if len... | <|body_start_0|>
if data is None:
if n <= 0:
raise ValueError('n must be a positive value')
if p >= 1 or p <= 0:
raise ValueError('p must be greater than 0 and less than 1')
self.n = n
self.p = p
else:
if type(da... | Binomial distribution class | Binomial | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Binomial:
"""Binomial distribution class"""
def __init__(self, data=None, n=1, p=0.5):
"""init binomial class"""
<|body_0|>
def pmf(self, k):
"""Return probability mass at k successes"""
<|body_1|>
def cdf(self, k):
"""Return cumulative proba... | stack_v2_sparse_classes_36k_train_011917 | 1,681 | no_license | [
{
"docstring": "init binomial class",
"name": "__init__",
"signature": "def __init__(self, data=None, n=1, p=0.5)"
},
{
"docstring": "Return probability mass at k successes",
"name": "pmf",
"signature": "def pmf(self, k)"
},
{
"docstring": "Return cumulative probability of 0 to k... | 3 | null | Implement the Python class `Binomial` described below.
Class description:
Binomial distribution class
Method signatures and docstrings:
- def __init__(self, data=None, n=1, p=0.5): init binomial class
- def pmf(self, k): Return probability mass at k successes
- def cdf(self, k): Return cumulative probability of 0 to ... | Implement the Python class `Binomial` described below.
Class description:
Binomial distribution class
Method signatures and docstrings:
- def __init__(self, data=None, n=1, p=0.5): init binomial class
- def pmf(self, k): Return probability mass at k successes
- def cdf(self, k): Return cumulative probability of 0 to ... | 56356c56297d8391bad8a1607eb226489766bc63 | <|skeleton|>
class Binomial:
"""Binomial distribution class"""
def __init__(self, data=None, n=1, p=0.5):
"""init binomial class"""
<|body_0|>
def pmf(self, k):
"""Return probability mass at k successes"""
<|body_1|>
def cdf(self, k):
"""Return cumulative proba... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Binomial:
"""Binomial distribution class"""
def __init__(self, data=None, n=1, p=0.5):
"""init binomial class"""
if data is None:
if n <= 0:
raise ValueError('n must be a positive value')
if p >= 1 or p <= 0:
raise ValueError('p must... | the_stack_v2_python_sparse | math/0x03-probability/binomial.py | sidneyriffic/holbertonschool-machine_learning | train | 1 |
c6a15ea05328f68dfb876b89ae93b638c3fd605e | [
"now = datetime.now().date()\nfirst_day = now + timedelta(days=7 * offset)\nlast_day = first_day + timedelta(days=6)\napplications_in_the_next_7days = cls.objects.filter(Q(start_date__lte=last_day) & Q(end_date__gte=first_day))\nreturn applications_in_the_next_7days",
"content = {place: [{time: [] for time, t in ... | <|body_start_0|>
now = datetime.now().date()
first_day = now + timedelta(days=7 * offset)
last_day = first_day + timedelta(days=6)
applications_in_the_next_7days = cls.objects.filter(Q(start_date__lte=last_day) & Q(end_date__gte=first_day))
return applications_in_the_next_7days
<... | CampusFieldApplication | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CampusFieldApplication:
def get_applications_a_week(cls, offset=0):
"""most are the same as custom.utils.get_application_a_week except the filter logic"""
<|body_0|>
def generate_table(cls, offset=0):
"""generate a dict of the structure below table - date : [ 7 date ... | stack_v2_sparse_classes_36k_train_011918 | 6,464 | no_license | [
{
"docstring": "most are the same as custom.utils.get_application_a_week except the filter logic",
"name": "get_applications_a_week",
"signature": "def get_applications_a_week(cls, offset=0)"
},
{
"docstring": "generate a dict of the structure below table - date : [ 7 date ] - ( place1, [ 7 * [ ... | 2 | stack_v2_sparse_classes_30k_train_009761 | Implement the Python class `CampusFieldApplication` described below.
Class description:
Implement the CampusFieldApplication class.
Method signatures and docstrings:
- def get_applications_a_week(cls, offset=0): most are the same as custom.utils.get_application_a_week except the filter logic
- def generate_table(cls,... | Implement the Python class `CampusFieldApplication` described below.
Class description:
Implement the CampusFieldApplication class.
Method signatures and docstrings:
- def get_applications_a_week(cls, offset=0): most are the same as custom.utils.get_application_a_week except the filter logic
- def generate_table(cls,... | 51c325a40ffce81ea4892f2286289bc3a965a609 | <|skeleton|>
class CampusFieldApplication:
def get_applications_a_week(cls, offset=0):
"""most are the same as custom.utils.get_application_a_week except the filter logic"""
<|body_0|>
def generate_table(cls, offset=0):
"""generate a dict of the structure below table - date : [ 7 date ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CampusFieldApplication:
def get_applications_a_week(cls, offset=0):
"""most are the same as custom.utils.get_application_a_week except the filter logic"""
now = datetime.now().date()
first_day = now + timedelta(days=7 * offset)
last_day = first_day + timedelta(days=6)
a... | the_stack_v2_python_sparse | field_application/field_application/campus_field/models.py | HxSeek/field-application | train | 3 | |
5ec7fd068f91d7b5dedadbd05abe6421a3970787 | [
"payload, user = self.get_payload(request)\nif not payload:\n return Response(status=status.HTTP_401_UNAUTHORIZED)\nconsulted_user = User.objects.filter(pk=kwargs['id']).first()\nif not consulted_user:\n return Response({'code': 'user_not_found', 'detailed': 'usuario no encontrado'}, status=status.HTTP_404_NO... | <|body_start_0|>
payload, user = self.get_payload(request)
if not payload:
return Response(status=status.HTTP_401_UNAUTHORIZED)
consulted_user = User.objects.filter(pk=kwargs['id']).first()
if not consulted_user:
return Response({'code': 'user_not_found', 'detaile... | Defines the HTTP verbs to specific user model management. | SpecificUserApi | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SpecificUserApi:
"""Defines the HTTP verbs to specific user model management."""
def get(self, request, *args, **kwargs):
"""Retrieve user list. Parameters ---------- request (dict) Contains http transaction information. Returns ------- Response (JSON, int) Body response and status c... | stack_v2_sparse_classes_36k_train_011919 | 9,574 | permissive | [
{
"docstring": "Retrieve user list. Parameters ---------- request (dict) Contains http transaction information. Returns ------- Response (JSON, int) Body response and status code.",
"name": "get",
"signature": "def get(self, request, *args, **kwargs)"
},
{
"docstring": "Update user information. ... | 3 | stack_v2_sparse_classes_30k_train_019072 | Implement the Python class `SpecificUserApi` described below.
Class description:
Defines the HTTP verbs to specific user model management.
Method signatures and docstrings:
- def get(self, request, *args, **kwargs): Retrieve user list. Parameters ---------- request (dict) Contains http transaction information. Return... | Implement the Python class `SpecificUserApi` described below.
Class description:
Defines the HTTP verbs to specific user model management.
Method signatures and docstrings:
- def get(self, request, *args, **kwargs): Retrieve user list. Parameters ---------- request (dict) Contains http transaction information. Return... | d56d365dd840ecd272ce933c26f2d408e01c44c7 | <|skeleton|>
class SpecificUserApi:
"""Defines the HTTP verbs to specific user model management."""
def get(self, request, *args, **kwargs):
"""Retrieve user list. Parameters ---------- request (dict) Contains http transaction information. Returns ------- Response (JSON, int) Body response and status c... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SpecificUserApi:
"""Defines the HTTP verbs to specific user model management."""
def get(self, request, *args, **kwargs):
"""Retrieve user list. Parameters ---------- request (dict) Contains http transaction information. Returns ------- Response (JSON, int) Body response and status code."""
... | the_stack_v2_python_sparse | api/views/user/general.py | santiagoSSAA/ParkingLot_Back | train | 0 |
32ac3e836e2b4ebc1cd375581b35c9db3bbc99d2 | [
"ana_id = super(hr_department, self).create(vals)\nif self.manager_id.id != False and self.analytic_account_id.id != False:\n self.analytic_account_id.write({'user_id': self.manager_id.user_id.id})\nreturn ana_id",
"ana_id = super(hr_department, self).write(vals)\nif self.manager_id.id != False and self.analyt... | <|body_start_0|>
ana_id = super(hr_department, self).create(vals)
if self.manager_id.id != False and self.analytic_account_id.id != False:
self.analytic_account_id.write({'user_id': self.manager_id.user_id.id})
return ana_id
<|end_body_0|>
<|body_start_1|>
ana_id = super(hr_... | hr_department | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class hr_department:
def create(self, vals):
"""override create function to set responsible of department's analytic account equals to department's manager"""
<|body_0|>
def write(self, vals):
"""override write function to set responsible of department's analytic account e... | stack_v2_sparse_classes_36k_train_011920 | 1,664 | no_license | [
{
"docstring": "override create function to set responsible of department's analytic account equals to department's manager",
"name": "create",
"signature": "def create(self, vals)"
},
{
"docstring": "override write function to set responsible of department's analytic account equals to departmen... | 2 | stack_v2_sparse_classes_30k_train_005092 | Implement the Python class `hr_department` described below.
Class description:
Implement the hr_department class.
Method signatures and docstrings:
- def create(self, vals): override create function to set responsible of department's analytic account equals to department's manager
- def write(self, vals): override wr... | Implement the Python class `hr_department` described below.
Class description:
Implement the hr_department class.
Method signatures and docstrings:
- def create(self, vals): override create function to set responsible of department's analytic account equals to department's manager
- def write(self, vals): override wr... | 0b997095c260d58b026440967fea3a202bef7efb | <|skeleton|>
class hr_department:
def create(self, vals):
"""override create function to set responsible of department's analytic account equals to department's manager"""
<|body_0|>
def write(self, vals):
"""override write function to set responsible of department's analytic account e... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class hr_department:
def create(self, vals):
"""override create function to set responsible of department's analytic account equals to department's manager"""
ana_id = super(hr_department, self).create(vals)
if self.manager_id.id != False and self.analytic_account_id.id != False:
... | the_stack_v2_python_sparse | v_11/EBS-SVN/branches/common/hr_department_custom/models/hr_department.py | musabahmed/baba | train | 0 | |
e3b29168d0fc866be989b05c8d93b2ce1de51d28 | [
"if self.form_class is None:\n return None\nelse:\n return self.form_class()",
"context = super().get_context_data(*args, **kwargs)\ncontext['report_name'] = self.report_name\ncontext['form'] = self.get_form()\ncontext['create_report_url'] = self.create_report_url\ncontext['report_list_url'] = self.report_l... | <|body_start_0|>
if self.form_class is None:
return None
else:
return self.form_class()
<|end_body_0|>
<|body_start_1|>
context = super().get_context_data(*args, **kwargs)
context['report_name'] = self.report_name
context['form'] = self.get_form()
... | Base view for report pages. | BaseReportPage | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BaseReportPage:
"""Base view for report pages."""
def get_form(self):
"""Return a form instance if form_class is not None, else return None."""
<|body_0|>
def get_context_data(self, *args, **kwargs):
"""Return context for the template."""
<|body_1|>
<|en... | stack_v2_sparse_classes_36k_train_011921 | 4,803 | no_license | [
{
"docstring": "Return a form instance if form_class is not None, else return None.",
"name": "get_form",
"signature": "def get_form(self)"
},
{
"docstring": "Return context for the template.",
"name": "get_context_data",
"signature": "def get_context_data(self, *args, **kwargs)"
}
] | 2 | null | Implement the Python class `BaseReportPage` described below.
Class description:
Base view for report pages.
Method signatures and docstrings:
- def get_form(self): Return a form instance if form_class is not None, else return None.
- def get_context_data(self, *args, **kwargs): Return context for the template. | Implement the Python class `BaseReportPage` described below.
Class description:
Base view for report pages.
Method signatures and docstrings:
- def get_form(self): Return a form instance if form_class is not None, else return None.
- def get_context_data(self, *args, **kwargs): Return context for the template.
<|ske... | ba51d4e304b1aeb296fa2fe16611c892fcdbd471 | <|skeleton|>
class BaseReportPage:
"""Base view for report pages."""
def get_form(self):
"""Return a form instance if form_class is not None, else return None."""
<|body_0|>
def get_context_data(self, *args, **kwargs):
"""Return context for the template."""
<|body_1|>
<|en... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BaseReportPage:
"""Base view for report pages."""
def get_form(self):
"""Return a form instance if form_class is not None, else return None."""
if self.form_class is None:
return None
else:
return self.form_class()
def get_context_data(self, *args, **k... | the_stack_v2_python_sparse | reports/views.py | stcstores/stcadmin | train | 0 |
7aadfa25127a2bccf79ffa31939fdfc7c8f96ada | [
"self.behavior = behavior\nself.nsteps = nsteps\nself.nsteps_so_far_taken = 0\nself.first_obs = first_obs\nself.most_recent_obs = first_obs\nself.action_shape = action_shape\nself.observation_space = observation_space",
"self.nsteps_so_far_taken = 0\nif callable(self.first_obs):\n obs = self.first_obs()\nelse:... | <|body_start_0|>
self.behavior = behavior
self.nsteps = nsteps
self.nsteps_so_far_taken = 0
self.first_obs = first_obs
self.most_recent_obs = first_obs
self.action_shape = action_shape
self.observation_space = observation_space
<|end_body_0|>
<|body_start_1|>
... | The test environment. | TestEnvironment | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestEnvironment:
"""The test environment."""
def __init__(self, behavior, nsteps, first_obs, action_shape, observation_space):
""":param behavior: A callable of signature fn(obs, action) -> (obs, reward, done). This function is what our step() function actually calls under the hood. ... | stack_v2_sparse_classes_36k_train_011922 | 13,073 | permissive | [
{
"docstring": ":param behavior: A callable of signature fn(obs, action) -> (obs, reward, done). This function is what our step() function actually calls under the hood. :param nsteps: The number of steps before we return 'done' for step(). If this parameter is None, an episode will only terminate if the behavi... | 3 | stack_v2_sparse_classes_30k_val_000644 | Implement the Python class `TestEnvironment` described below.
Class description:
The test environment.
Method signatures and docstrings:
- def __init__(self, behavior, nsteps, first_obs, action_shape, observation_space): :param behavior: A callable of signature fn(obs, action) -> (obs, reward, done). This function is... | Implement the Python class `TestEnvironment` described below.
Class description:
The test environment.
Method signatures and docstrings:
- def __init__(self, behavior, nsteps, first_obs, action_shape, observation_space): :param behavior: A callable of signature fn(obs, action) -> (obs, reward, done). This function is... | 1edbb171a5405d2971227f2d2d83acb523c70034 | <|skeleton|>
class TestEnvironment:
"""The test environment."""
def __init__(self, behavior, nsteps, first_obs, action_shape, observation_space):
""":param behavior: A callable of signature fn(obs, action) -> (obs, reward, done). This function is what our step() function actually calls under the hood. ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestEnvironment:
"""The test environment."""
def __init__(self, behavior, nsteps, first_obs, action_shape, observation_space):
""":param behavior: A callable of signature fn(obs, action) -> (obs, reward, done). This function is what our step() function actually calls under the hood. :param nsteps... | the_stack_v2_python_sparse | Artie/internals/rl/environment.py | MaxStrange/ArtieInfant | train | 1 |
546da4336aab8bb0e83a3be2303b77c6baa21bcd | [
"if kw.get('purity', False):\n raise NotImplementedError('Purity benchmarking is not implemented for 2QB RB. Set \"purity=False.\"')\nself.max_clifford_idx = max_clifford_idx\ntqc.gate_decomposition = rb.get_clifford_decomposition(kw.get('gate_decomposition', 'HZ'))\nif kw.get('interleaved_gate', None) is not No... | <|body_start_0|>
if kw.get('purity', False):
raise NotImplementedError('Purity benchmarking is not implemented for 2QB RB. Set "purity=False."')
self.max_clifford_idx = max_clifford_idx
tqc.gate_decomposition = rb.get_clifford_decomposition(kw.get('gate_decomposition', 'HZ'))
... | Class for running the two-qubit randomized benchmarking experiment on several pairs of qubits in parallel. Attributes in addition to the ones created by the base class: max_clifford_idx: Int, size of the 2QB Clifford group | TwoQubitRandomizedBenchmarking | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TwoQubitRandomizedBenchmarking:
"""Class for running the two-qubit randomized benchmarking experiment on several pairs of qubits in parallel. Attributes in addition to the ones created by the base class: max_clifford_idx: Int, size of the 2QB Clifford group"""
def __init__(self, task_list, s... | stack_v2_sparse_classes_36k_train_011923 | 38,263 | permissive | [
{
"docstring": "Each task in task_list corresponds to a qubit pair, which is specified with the keys 'qb_1' and 'qb2.' Args: nr_seeds (int): the number of times the Clifford group should be sampled for each Clifford sequence length. cliffords (list/array): integers specifying the number of cliffords to apply. m... | 3 | stack_v2_sparse_classes_30k_train_006581 | Implement the Python class `TwoQubitRandomizedBenchmarking` described below.
Class description:
Class for running the two-qubit randomized benchmarking experiment on several pairs of qubits in parallel. Attributes in addition to the ones created by the base class: max_clifford_idx: Int, size of the 2QB Clifford group
... | Implement the Python class `TwoQubitRandomizedBenchmarking` described below.
Class description:
Class for running the two-qubit randomized benchmarking experiment on several pairs of qubits in parallel. Attributes in addition to the ones created by the base class: max_clifford_idx: Int, size of the 2QB Clifford group
... | bc6733d774fe31a23f4c7e73e5eb0beed8d30e7d | <|skeleton|>
class TwoQubitRandomizedBenchmarking:
"""Class for running the two-qubit randomized benchmarking experiment on several pairs of qubits in parallel. Attributes in addition to the ones created by the base class: max_clifford_idx: Int, size of the 2QB Clifford group"""
def __init__(self, task_list, s... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TwoQubitRandomizedBenchmarking:
"""Class for running the two-qubit randomized benchmarking experiment on several pairs of qubits in parallel. Attributes in addition to the ones created by the base class: max_clifford_idx: Int, size of the 2QB Clifford group"""
def __init__(self, task_list, sweep_points=N... | the_stack_v2_python_sparse | pycqed/measurement/benchmarking/randomized_benchmarking.py | QudevETH/PycQED_py3 | train | 8 |
1c327e9905e35673f2886472298d3558e571cffa | [
"self._offset = numpy.ndarray((3, len(cellid_list), 8192, 128), dtype=numpy.int16)\nself._digital_gain = numpy.ndarray((3, len(cellid_list), 8192, 128), dtype=numpy.int16)\nself._relative_gain = numpy.ndarray((3, len(cellid_list), 8192, 128), dtype=numpy.float32)\nfor index, cell in enumerate(cellid_list):\n sel... | <|body_start_0|>
self._offset = numpy.ndarray((3, len(cellid_list), 8192, 128), dtype=numpy.int16)
self._digital_gain = numpy.ndarray((3, len(cellid_list), 8192, 128), dtype=numpy.int16)
self._relative_gain = numpy.ndarray((3, len(cellid_list), 8192, 128), dtype=numpy.float32)
for index,... | See documentation of the '__init__' function. | Agipd1MCalibration | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Agipd1MCalibration:
"""See documentation of the '__init__' function."""
def __init__(self, calibration_filename, cellid_list):
"""Calibration of the AGIPD 1M detector. This algorithm stores the calibration parameters for an AGIPD 1M detector and applies the calibration to a detector ... | stack_v2_sparse_classes_36k_train_011924 | 7,938 | no_license | [
{
"docstring": "Calibration of the AGIPD 1M detector. This algorithm stores the calibration parameters for an AGIPD 1M detector and applies the calibration to a detector data frame upon request. Since the the full set of correction parameters for the AGIPD 1M detector takes up a lot of memory, only the paramete... | 2 | stack_v2_sparse_classes_30k_val_000793 | Implement the Python class `Agipd1MCalibration` described below.
Class description:
See documentation of the '__init__' function.
Method signatures and docstrings:
- def __init__(self, calibration_filename, cellid_list): Calibration of the AGIPD 1M detector. This algorithm stores the calibration parameters for an AGI... | Implement the Python class `Agipd1MCalibration` described below.
Class description:
See documentation of the '__init__' function.
Method signatures and docstrings:
- def __init__(self, calibration_filename, cellid_list): Calibration of the AGIPD 1M detector. This algorithm stores the calibration parameters for an AGI... | 42385522e68116db0e03df19574e904a5d146a9c | <|skeleton|>
class Agipd1MCalibration:
"""See documentation of the '__init__' function."""
def __init__(self, calibration_filename, cellid_list):
"""Calibration of the AGIPD 1M detector. This algorithm stores the calibration parameters for an AGIPD 1M detector and applies the calibration to a detector ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Agipd1MCalibration:
"""See documentation of the '__init__' function."""
def __init__(self, calibration_filename, cellid_list):
"""Calibration of the AGIPD 1M detector. This algorithm stores the calibration parameters for an AGIPD 1M detector and applies the calibration to a detector data frame up... | the_stack_v2_python_sparse | onda/algorithms/calibration_algorithms.py | clydeph/onda | train | 2 |
0d5cd24d18e18a12353e79a4b48a9766b1cfca22 | [
"super(ScheduledSampler, self).__init__(*args, **kwargs)\nself._scope = scope\nself._values = values\nself._scheduler = scheduler\nself._scheduler_params = scheduler_params or {}\nassert self._values is not None and len(self._values), 'must provide non-empty values.'\nself._n = len(self._values)\nself._count = 0\ns... | <|body_start_0|>
super(ScheduledSampler, self).__init__(*args, **kwargs)
self._scope = scope
self._values = values
self._scheduler = scheduler
self._scheduler_params = scheduler_params or {}
assert self._values is not None and len(self._values), 'must provide non-empty va... | Scheduled sampler. | ScheduledSampler | [
"MIT",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ScheduledSampler:
"""Scheduled sampler."""
def __init__(self, scope='default', values=None, scheduler='cycle', scheduler_params=None, *args, **kwargs):
"""Construct sampler. Args: scope: Scope name. values: A list of numbers or [num_context_dim] Numpy arrays representing the values t... | stack_v2_sparse_classes_36k_train_011925 | 14,171 | permissive | [
{
"docstring": "Construct sampler. Args: scope: Scope name. values: A list of numbers or [num_context_dim] Numpy arrays representing the values to cycle. scheduler: scheduler type. scheduler_params: scheduler parameters. *args: arguments. **kwargs: keyword arguments.",
"name": "__init__",
"signature": "... | 3 | null | Implement the Python class `ScheduledSampler` described below.
Class description:
Scheduled sampler.
Method signatures and docstrings:
- def __init__(self, scope='default', values=None, scheduler='cycle', scheduler_params=None, *args, **kwargs): Construct sampler. Args: scope: Scope name. values: A list of numbers or... | Implement the Python class `ScheduledSampler` described below.
Class description:
Scheduled sampler.
Method signatures and docstrings:
- def __init__(self, scope='default', values=None, scheduler='cycle', scheduler_params=None, *args, **kwargs): Construct sampler. Args: scope: Scope name. values: A list of numbers or... | a115d918f6894a69586174653172be0b5d1de952 | <|skeleton|>
class ScheduledSampler:
"""Scheduled sampler."""
def __init__(self, scope='default', values=None, scheduler='cycle', scheduler_params=None, *args, **kwargs):
"""Construct sampler. Args: scope: Scope name. values: A list of numbers or [num_context_dim] Numpy arrays representing the values t... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ScheduledSampler:
"""Scheduled sampler."""
def __init__(self, scope='default', values=None, scheduler='cycle', scheduler_params=None, *args, **kwargs):
"""Construct sampler. Args: scope: Scope name. values: A list of numbers or [num_context_dim] Numpy arrays representing the values to cycle. sche... | the_stack_v2_python_sparse | models/research/efficient-hrl/context/samplers.py | finnickniu/tensorflow_object_detection_tflite | train | 60 |
a67f9257efdf54a4750b3f5da0adb1a1535ad95b | [
"try:\n path = importlib_resources.files(origin.package) / PosixPath(origin.resource)\n return path.read_text()\nexcept Exception:\n raise TemplateDoesNotExist(origin)",
"resource = f'templates/{template_name}'\nfor extmgr in get_extension_managers():\n for ext in extmgr.get_enabled_extensions():\n ... | <|body_start_0|>
try:
path = importlib_resources.files(origin.package) / PosixPath(origin.resource)
return path.read_text()
except Exception:
raise TemplateDoesNotExist(origin)
<|end_body_0|>
<|body_start_1|>
resource = f'templates/{template_name}'
fo... | Loads templates found within an extension. This will look through all enabled extensions and attempt to fetch the named template under the :file:`templates` directory within the extension's package. This should be added last to the list of template loaders. .. versionadded:: 0.9 | Loader | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Loader:
"""Loads templates found within an extension. This will look through all enabled extensions and attempt to fetch the named template under the :file:`templates` directory within the extension's package. This should be added last to the list of template loaders. .. versionadded:: 0.9"""
... | stack_v2_sparse_classes_36k_train_011926 | 2,838 | no_license | [
{
"docstring": "Return the contents of a template. Args: origin (ExtensionOrigin): The origin of the template. Returns: str: The resulting template contents. Raises: TemplateDoesNotExist: The template could not be found.",
"name": "get_contents",
"signature": "def get_contents(self, origin: ExtensionOri... | 2 | stack_v2_sparse_classes_30k_train_015239 | Implement the Python class `Loader` described below.
Class description:
Loads templates found within an extension. This will look through all enabled extensions and attempt to fetch the named template under the :file:`templates` directory within the extension's package. This should be added last to the list of templat... | Implement the Python class `Loader` described below.
Class description:
Loads templates found within an extension. This will look through all enabled extensions and attempt to fetch the named template under the :file:`templates` directory within the extension's package. This should be added last to the list of templat... | 99ea69d80a3a393b0da4da3152ef26e808dd8487 | <|skeleton|>
class Loader:
"""Loads templates found within an extension. This will look through all enabled extensions and attempt to fetch the named template under the :file:`templates` directory within the extension's package. This should be added last to the list of template loaders. .. versionadded:: 0.9"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Loader:
"""Loads templates found within an extension. This will look through all enabled extensions and attempt to fetch the named template under the :file:`templates` directory within the extension's package. This should be added last to the list of template loaders. .. versionadded:: 0.9"""
def get_con... | the_stack_v2_python_sparse | djblets/extensions/loaders.py | chipx86/djblets | train | 2 |
e9c7e9b916d1f7a924cd9dcb4fc48dffd48dbf53 | [
"url = self.build_url('/datastores/%s/versions' % datastore, limit=limit, marker=marker)\nif response_key:\n return self._get(url, 'versions', **kwargs)\nelse:\n return self._get(url, **kwargs)",
"if response_key:\n return self._get('/datastores/%s/versions/%s' % (datastore, datastore_version), 'version'... | <|body_start_0|>
url = self.build_url('/datastores/%s/versions' % datastore, limit=limit, marker=marker)
if response_key:
return self._get(url, 'versions', **kwargs)
else:
return self._get(url, **kwargs)
<|end_body_0|>
<|body_start_1|>
if response_key:
... | DatastoreVersionManager | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DatastoreVersionManager:
def list(self, datastore, limit=None, marker=None, response_key=True, **kwargs):
"""Get a list of all datastore versions. :rtype: list of :class:`DatastoreVersion`."""
<|body_0|>
def get(self, datastore, datastore_version, response_key=True, **kwargs... | stack_v2_sparse_classes_36k_train_011927 | 1,604 | no_license | [
{
"docstring": "Get a list of all datastore versions. :rtype: list of :class:`DatastoreVersion`.",
"name": "list",
"signature": "def list(self, datastore, limit=None, marker=None, response_key=True, **kwargs)"
},
{
"docstring": "Get a specific datastore version. :rtype: :class:`DatastoreVersion`... | 3 | null | Implement the Python class `DatastoreVersionManager` described below.
Class description:
Implement the DatastoreVersionManager class.
Method signatures and docstrings:
- def list(self, datastore, limit=None, marker=None, response_key=True, **kwargs): Get a list of all datastore versions. :rtype: list of :class:`Datas... | Implement the Python class `DatastoreVersionManager` described below.
Class description:
Implement the DatastoreVersionManager class.
Method signatures and docstrings:
- def list(self, datastore, limit=None, marker=None, response_key=True, **kwargs): Get a list of all datastore versions. :rtype: list of :class:`Datas... | 42f9197ba26ffb6b9dd336a524639ecbbf194365 | <|skeleton|>
class DatastoreVersionManager:
def list(self, datastore, limit=None, marker=None, response_key=True, **kwargs):
"""Get a list of all datastore versions. :rtype: list of :class:`DatastoreVersion`."""
<|body_0|>
def get(self, datastore, datastore_version, response_key=True, **kwargs... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DatastoreVersionManager:
def list(self, datastore, limit=None, marker=None, response_key=True, **kwargs):
"""Get a list of all datastore versions. :rtype: list of :class:`DatastoreVersion`."""
url = self.build_url('/datastores/%s/versions' % datastore, limit=limit, marker=marker)
if re... | the_stack_v2_python_sparse | ops_client/project/trove/datastore_versions.py | tokuzfunpi/ops_client | train | 0 | |
1fb7ae3826bab57c7dd1ad22876e8eda41508c30 | [
"self.set_frang_config(frang_config=self.burst_config)\nbase_client = self.get_client(self.base_client_id)\noptional_client = self.get_client(self.optional_client_id)\nlimit = 4\nbase_client.uri += f'[1-{limit}]'\noptional_client.uri += f'[1-{limit}]'\nbase_client.parallel = limit\noptional_client.parallel = limit\... | <|body_start_0|>
self.set_frang_config(frang_config=self.burst_config)
base_client = self.get_client(self.base_client_id)
optional_client = self.get_client(self.optional_client_id)
limit = 4
base_client.uri += f'[1-{limit}]'
optional_client.uri += f'[1-{limit}]'
b... | Tests for tls and non-tls connections 'tls_connection_burst' and 'tls_connection_rate' | FrangTlsAndNonTlsRateBurst | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FrangTlsAndNonTlsRateBurst:
"""Tests for tls and non-tls connections 'tls_connection_burst' and 'tls_connection_rate'"""
def test_burst(self):
"""Set `tls_connection_burst 3` and create 4 tls and 4 non-tls connections. Only tls connections will be blocked."""
<|body_0|>
... | stack_v2_sparse_classes_36k_train_011928 | 13,457 | no_license | [
{
"docstring": "Set `tls_connection_burst 3` and create 4 tls and 4 non-tls connections. Only tls connections will be blocked.",
"name": "test_burst",
"signature": "def test_burst(self)"
},
{
"docstring": "Set `tls_connection_rate 3` and create 4 tls and 4 non-tls connections. Only tls connectio... | 2 | null | Implement the Python class `FrangTlsAndNonTlsRateBurst` described below.
Class description:
Tests for tls and non-tls connections 'tls_connection_burst' and 'tls_connection_rate'
Method signatures and docstrings:
- def test_burst(self): Set `tls_connection_burst 3` and create 4 tls and 4 non-tls connections. Only tls... | Implement the Python class `FrangTlsAndNonTlsRateBurst` described below.
Class description:
Tests for tls and non-tls connections 'tls_connection_burst' and 'tls_connection_rate'
Method signatures and docstrings:
- def test_burst(self): Set `tls_connection_burst 3` and create 4 tls and 4 non-tls connections. Only tls... | d56358ea653dbb367624937197ce5e489abf0b00 | <|skeleton|>
class FrangTlsAndNonTlsRateBurst:
"""Tests for tls and non-tls connections 'tls_connection_burst' and 'tls_connection_rate'"""
def test_burst(self):
"""Set `tls_connection_burst 3` and create 4 tls and 4 non-tls connections. Only tls connections will be blocked."""
<|body_0|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FrangTlsAndNonTlsRateBurst:
"""Tests for tls and non-tls connections 'tls_connection_burst' and 'tls_connection_rate'"""
def test_burst(self):
"""Set `tls_connection_burst 3` and create 4 tls and 4 non-tls connections. Only tls connections will be blocked."""
self.set_frang_config(frang_c... | the_stack_v2_python_sparse | t_frang/test_connection_rate_burst.py | tempesta-tech/tempesta-test | train | 13 |
5c5ae6a5a3b41516182b09b03c36fe8636dbebf7 | [
"Graph.__init__(self)\nself.initial = None\nself.final = None\nself.position = None",
"if node not in self.nodes:\n raise NameError(\"node aren't in the automate\")\n return False\nself.initial = node\nself.position = node",
"if node not in self.nodes:\n raise NameError(\"node aren't in the automate\")... | <|body_start_0|>
Graph.__init__(self)
self.initial = None
self.final = None
self.position = None
<|end_body_0|>
<|body_start_1|>
if node not in self.nodes:
raise NameError("node aren't in the automate")
return False
self.initial = node
sel... | FiniteStateMachine | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FiniteStateMachine:
def __init__(self):
"""init the Machine with her attribute and the one from Graph"""
<|body_0|>
def set_initial(self, node):
"""attribute the initial value of initial and position if node is in the "Grah" Machine, else NameError"""
<|body_... | stack_v2_sparse_classes_36k_train_011929 | 2,199 | no_license | [
{
"docstring": "init the Machine with her attribute and the one from Graph",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "attribute the initial value of initial and position if node is in the \"Grah\" Machine, else NameError",
"name": "set_initial",
"signature... | 6 | null | Implement the Python class `FiniteStateMachine` described below.
Class description:
Implement the FiniteStateMachine class.
Method signatures and docstrings:
- def __init__(self): init the Machine with her attribute and the one from Graph
- def set_initial(self, node): attribute the initial value of initial and posit... | Implement the Python class `FiniteStateMachine` described below.
Class description:
Implement the FiniteStateMachine class.
Method signatures and docstrings:
- def __init__(self): init the Machine with her attribute and the one from Graph
- def set_initial(self, node): attribute the initial value of initial and posit... | 147773cc8871d74f1ec1d6bd03e3cce95e9490d1 | <|skeleton|>
class FiniteStateMachine:
def __init__(self):
"""init the Machine with her attribute and the one from Graph"""
<|body_0|>
def set_initial(self, node):
"""attribute the initial value of initial and position if node is in the "Grah" Machine, else NameError"""
<|body_... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FiniteStateMachine:
def __init__(self):
"""init the Machine with her attribute and the one from Graph"""
Graph.__init__(self)
self.initial = None
self.final = None
self.position = None
def set_initial(self, node):
"""attribute the initial value of initial a... | the_stack_v2_python_sparse | theorie_des_graphes/TP2/FiniteStateMachine.py | porigonop/code_v2 | train | 0 | |
05f5a21dff28087ee80fa0cc52e094bb951abe13 | [
"danhao = cheWu()[0]\nlogin_url = 'http://uat-c2b.taoche.com/basegate/work/order/' + danhao + '/approval-success'\nheaders = {'Content-Type': 'application/json;charset=UTF-8'}\nresponse_data = requests.patch(login_url, headers=headers).json()\nself.assertEqual(response_data['message'], '用户未登录')",
"danhao = cheWu(... | <|body_start_0|>
danhao = cheWu()[0]
login_url = 'http://uat-c2b.taoche.com/basegate/work/order/' + danhao + '/approval-success'
headers = {'Content-Type': 'application/json;charset=UTF-8'}
response_data = requests.patch(login_url, headers=headers).json()
self.assertEqual(respons... | TestZhunRu | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestZhunRu:
def test1_zhunru_notoken(self):
"""准入接口,未登录直接请求"""
<|body_0|>
def test2_zhunru_status(self):
"""准入接口,登录后判断工单是否为待核准状态"""
<|body_1|>
def test3_zhunru(self):
"""执行准入操作"""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>
dan... | stack_v2_sparse_classes_36k_train_011930 | 2,461 | no_license | [
{
"docstring": "准入接口,未登录直接请求",
"name": "test1_zhunru_notoken",
"signature": "def test1_zhunru_notoken(self)"
},
{
"docstring": "准入接口,登录后判断工单是否为待核准状态",
"name": "test2_zhunru_status",
"signature": "def test2_zhunru_status(self)"
},
{
"docstring": "执行准入操作",
"name": "test3_zhunru... | 3 | stack_v2_sparse_classes_30k_train_007871 | Implement the Python class `TestZhunRu` described below.
Class description:
Implement the TestZhunRu class.
Method signatures and docstrings:
- def test1_zhunru_notoken(self): 准入接口,未登录直接请求
- def test2_zhunru_status(self): 准入接口,登录后判断工单是否为待核准状态
- def test3_zhunru(self): 执行准入操作 | Implement the Python class `TestZhunRu` described below.
Class description:
Implement the TestZhunRu class.
Method signatures and docstrings:
- def test1_zhunru_notoken(self): 准入接口,未登录直接请求
- def test2_zhunru_status(self): 准入接口,登录后判断工单是否为待核准状态
- def test3_zhunru(self): 执行准入操作
<|skeleton|>
class TestZhunRu:
def t... | 204856bd33c06d25f2970eba13799db75d4fd4fe | <|skeleton|>
class TestZhunRu:
def test1_zhunru_notoken(self):
"""准入接口,未登录直接请求"""
<|body_0|>
def test2_zhunru_status(self):
"""准入接口,登录后判断工单是否为待核准状态"""
<|body_1|>
def test3_zhunru(self):
"""执行准入操作"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestZhunRu:
def test1_zhunru_notoken(self):
"""准入接口,未登录直接请求"""
danhao = cheWu()[0]
login_url = 'http://uat-c2b.taoche.com/basegate/work/order/' + danhao + '/approval-success'
headers = {'Content-Type': 'application/json;charset=UTF-8'}
response_data = requests.patch(log... | the_stack_v2_python_sparse | mc/xmdCW/testcase/test_zhunru.py | boeai/mc | train | 0 | |
ea2c69a4ff08274eb8599fc2bdd30b9a535cea2a | [
"Parametre.__init__(self, 'affecter', 'affect')\nself.schema = '<nom_matelot>'\nself.tronquer = True\nself.aide_courte = \"change l'affectation d'un matelot\"\nself.aide_longue = \"Cette commande demande à un matelot de changer d'affectation. Le matelot précisé en paramètre voit la salle où vous vous trouvez deveni... | <|body_start_0|>
Parametre.__init__(self, 'affecter', 'affect')
self.schema = '<nom_matelot>'
self.tronquer = True
self.aide_courte = "change l'affectation d'un matelot"
self.aide_longue = "Cette commande demande à un matelot de changer d'affectation. Le matelot précisé en paramè... | Commande 'matelot affecter'. | PrmAffecter | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PrmAffecter:
"""Commande 'matelot affecter'."""
def __init__(self):
"""Constructeur du paramètre"""
<|body_0|>
def interpreter(self, personnage, dic_masques):
"""Interprétation du paramètre"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
Paramet... | stack_v2_sparse_classes_36k_train_011931 | 4,078 | permissive | [
{
"docstring": "Constructeur du paramètre",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Interprétation du paramètre",
"name": "interpreter",
"signature": "def interpreter(self, personnage, dic_masques)"
}
] | 2 | null | Implement the Python class `PrmAffecter` described below.
Class description:
Commande 'matelot affecter'.
Method signatures and docstrings:
- def __init__(self): Constructeur du paramètre
- def interpreter(self, personnage, dic_masques): Interprétation du paramètre | Implement the Python class `PrmAffecter` described below.
Class description:
Commande 'matelot affecter'.
Method signatures and docstrings:
- def __init__(self): Constructeur du paramètre
- def interpreter(self, personnage, dic_masques): Interprétation du paramètre
<|skeleton|>
class PrmAffecter:
"""Commande 'ma... | 7e93bff08cdf891352efba587e89c40f3b4a2301 | <|skeleton|>
class PrmAffecter:
"""Commande 'matelot affecter'."""
def __init__(self):
"""Constructeur du paramètre"""
<|body_0|>
def interpreter(self, personnage, dic_masques):
"""Interprétation du paramètre"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PrmAffecter:
"""Commande 'matelot affecter'."""
def __init__(self):
"""Constructeur du paramètre"""
Parametre.__init__(self, 'affecter', 'affect')
self.schema = '<nom_matelot>'
self.tronquer = True
self.aide_courte = "change l'affectation d'un matelot"
self... | the_stack_v2_python_sparse | src/secondaires/navigation/commandes/matelot/affecter.py | vincent-lg/tsunami | train | 5 |
3a22897ae9fbf3a754be03343fbd247a0f715fc0 | [
"no_of_percentiles = 3\nresult = choose_set_of_percentiles(no_of_percentiles)\nself.assertIsInstance(result, list)\nself.assertEqual(len(result), no_of_percentiles)",
"data = np.array([25, 50, 75])\nno_of_percentiles = 3\nresult = choose_set_of_percentiles(no_of_percentiles)\nself.assertArrayAlmostEqual(result, d... | <|body_start_0|>
no_of_percentiles = 3
result = choose_set_of_percentiles(no_of_percentiles)
self.assertIsInstance(result, list)
self.assertEqual(len(result), no_of_percentiles)
<|end_body_0|>
<|body_start_1|>
data = np.array([25, 50, 75])
no_of_percentiles = 3
r... | Test the choose_set_of_percentiles plugin. | Test_choose_set_of_percentiles | [
"BSD-3-Clause",
"LicenseRef-scancode-proprietary-license"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Test_choose_set_of_percentiles:
"""Test the choose_set_of_percentiles plugin."""
def test_basic(self):
"""Test that the plugin returns a list with the expected number of percentiles."""
<|body_0|>
def test_data(self):
"""Test that the plugin returns a list with t... | stack_v2_sparse_classes_36k_train_011932 | 28,421 | permissive | [
{
"docstring": "Test that the plugin returns a list with the expected number of percentiles.",
"name": "test_basic",
"signature": "def test_basic(self)"
},
{
"docstring": "Test that the plugin returns a list with the expected data values for the percentiles.",
"name": "test_data",
"signa... | 4 | null | Implement the Python class `Test_choose_set_of_percentiles` described below.
Class description:
Test the choose_set_of_percentiles plugin.
Method signatures and docstrings:
- def test_basic(self): Test that the plugin returns a list with the expected number of percentiles.
- def test_data(self): Test that the plugin ... | Implement the Python class `Test_choose_set_of_percentiles` described below.
Class description:
Test the choose_set_of_percentiles plugin.
Method signatures and docstrings:
- def test_basic(self): Test that the plugin returns a list with the expected number of percentiles.
- def test_data(self): Test that the plugin ... | cd2c9019944345df1e703bf8f625db537ad9f559 | <|skeleton|>
class Test_choose_set_of_percentiles:
"""Test the choose_set_of_percentiles plugin."""
def test_basic(self):
"""Test that the plugin returns a list with the expected number of percentiles."""
<|body_0|>
def test_data(self):
"""Test that the plugin returns a list with t... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Test_choose_set_of_percentiles:
"""Test the choose_set_of_percentiles plugin."""
def test_basic(self):
"""Test that the plugin returns a list with the expected number of percentiles."""
no_of_percentiles = 3
result = choose_set_of_percentiles(no_of_percentiles)
self.assert... | the_stack_v2_python_sparse | improver_tests/ensemble_copula_coupling/test_utilities.py | metoppv/improver | train | 101 |
dc9743d1577a951ca87cbfcf76d30f3a2cb6e5b6 | [
"def get_tag(obj, tag_name):\n if isclass(obj):\n return obj.get_class_tag(tag_name)\n else:\n return obj.get_tag(tag_name)\nif not isinstance(obj, BaseForecaster) and (not issubclass(obj, BaseForecaster)):\n return False\nis_univariate = self.get_tag('univariate_y')\nif is_univariate and get... | <|body_start_0|>
def get_tag(obj, tag_name):
if isclass(obj):
return obj.get_class_tag(tag_name)
else:
return obj.get_tag(tag_name)
if not isinstance(obj, BaseForecaster) and (not issubclass(obj, BaseForecaster)):
return False
i... | ForecasterTestScenario | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ForecasterTestScenario:
def is_applicable(self, obj):
"""Check whether scenario is applicable to obj. Parameters ---------- obj : class or object to check against scenario Returns ------- applicable: bool True if self is applicable to obj, False if not"""
<|body_0|>
def get_... | stack_v2_sparse_classes_36k_train_011933 | 9,436 | permissive | [
{
"docstring": "Check whether scenario is applicable to obj. Parameters ---------- obj : class or object to check against scenario Returns ------- applicable: bool True if self is applicable to obj, False if not",
"name": "is_applicable",
"signature": "def is_applicable(self, obj)"
},
{
"docstri... | 2 | null | Implement the Python class `ForecasterTestScenario` described below.
Class description:
Implement the ForecasterTestScenario class.
Method signatures and docstrings:
- def is_applicable(self, obj): Check whether scenario is applicable to obj. Parameters ---------- obj : class or object to check against scenario Retur... | Implement the Python class `ForecasterTestScenario` described below.
Class description:
Implement the ForecasterTestScenario class.
Method signatures and docstrings:
- def is_applicable(self, obj): Check whether scenario is applicable to obj. Parameters ---------- obj : class or object to check against scenario Retur... | 70b2bfaaa597eb31bc3a1032366dcc0e1f4c8a9f | <|skeleton|>
class ForecasterTestScenario:
def is_applicable(self, obj):
"""Check whether scenario is applicable to obj. Parameters ---------- obj : class or object to check against scenario Returns ------- applicable: bool True if self is applicable to obj, False if not"""
<|body_0|>
def get_... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ForecasterTestScenario:
def is_applicable(self, obj):
"""Check whether scenario is applicable to obj. Parameters ---------- obj : class or object to check against scenario Returns ------- applicable: bool True if self is applicable to obj, False if not"""
def get_tag(obj, tag_name):
... | the_stack_v2_python_sparse | sktime/utils/_testing/scenarios_forecasting.py | sktime/sktime | train | 1,117 | |
67374f8f72233e685a1e1b3428a6379c146019cb | [
"dr = login_domain\nself.arn = resnodeaction.Add_Res_Node(dr)\nself.srmpg = sys_regionMgrPage.SysRegionMgrPage(dr)\np_data = datainfo.get_xls_to_dict('res_node_data.xlsx', 'endpoint')['创建vmware-endpoint']\nself.arn.add_endpoint(p_data['regionname'], p_data['nodename'], p_data['servicename'], p_data['url'])\ntime.sl... | <|body_start_0|>
dr = login_domain
self.arn = resnodeaction.Add_Res_Node(dr)
self.srmpg = sys_regionMgrPage.SysRegionMgrPage(dr)
p_data = datainfo.get_xls_to_dict('res_node_data.xlsx', 'endpoint')['创建vmware-endpoint']
self.arn.add_endpoint(p_data['regionname'], p_data['nodename']... | 测试添加Endpoint | TestCreateEndpoint | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestCreateEndpoint:
"""测试添加Endpoint"""
def test_vmware_endpoint(self, login_domain):
"""测试添加vmware,endpoint 依赖已添加vmware服务 :return:"""
<|body_0|>
def test_openstack_endpoint(self, login_domain):
"""测试添加openstack,endpoint 依赖已添加openstack服务 :return:"""
<|body... | stack_v2_sparse_classes_36k_train_011934 | 2,324 | no_license | [
{
"docstring": "测试添加vmware,endpoint 依赖已添加vmware服务 :return:",
"name": "test_vmware_endpoint",
"signature": "def test_vmware_endpoint(self, login_domain)"
},
{
"docstring": "测试添加openstack,endpoint 依赖已添加openstack服务 :return:",
"name": "test_openstack_endpoint",
"signature": "def test_opensta... | 2 | null | Implement the Python class `TestCreateEndpoint` described below.
Class description:
测试添加Endpoint
Method signatures and docstrings:
- def test_vmware_endpoint(self, login_domain): 测试添加vmware,endpoint 依赖已添加vmware服务 :return:
- def test_openstack_endpoint(self, login_domain): 测试添加openstack,endpoint 依赖已添加openstack服务 :retu... | Implement the Python class `TestCreateEndpoint` described below.
Class description:
测试添加Endpoint
Method signatures and docstrings:
- def test_vmware_endpoint(self, login_domain): 测试添加vmware,endpoint 依赖已添加vmware服务 :return:
- def test_openstack_endpoint(self, login_domain): 测试添加openstack,endpoint 依赖已添加openstack服务 :retu... | 7997338cd1038512be5cc0ad6fb60054896d0c59 | <|skeleton|>
class TestCreateEndpoint:
"""测试添加Endpoint"""
def test_vmware_endpoint(self, login_domain):
"""测试添加vmware,endpoint 依赖已添加vmware服务 :return:"""
<|body_0|>
def test_openstack_endpoint(self, login_domain):
"""测试添加openstack,endpoint 依赖已添加openstack服务 :return:"""
<|body... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestCreateEndpoint:
"""测试添加Endpoint"""
def test_vmware_endpoint(self, login_domain):
"""测试添加vmware,endpoint 依赖已添加vmware服务 :return:"""
dr = login_domain
self.arn = resnodeaction.Add_Res_Node(dr)
self.srmpg = sys_regionMgrPage.SysRegionMgrPage(dr)
p_data = datainfo.g... | the_stack_v2_python_sparse | testcase02/test_08_create_endpoint.py | woozs/ui_auto_test | train | 1 |
5b0b55fda02c89a174a3168b38e7f09e363bbb17 | [
"self.clerk = clerk\nself.atr = atr\nself.fclass = fclass\nself.fkey = fkey",
"if name == self.atr:\n box.removeInjector(self.inject)\n table = self.clerk.schema.tableForClass(self.fclass)\n for row in self.clerk.storage.match(table, **{self.fkey: box.ID}):\n obj = self.clerk.rowToInstance(row, se... | <|body_start_0|>
self.clerk = clerk
self.atr = atr
self.fclass = fclass
self.fkey = fkey
<|end_body_0|>
<|body_start_1|>
if name == self.atr:
box.removeInjector(self.inject)
table = self.clerk.schema.tableForClass(self.fclass)
for row in self.... | LinkSetInjector | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LinkSetInjector:
def __init__(self, atr, clerk, fclass, fkey):
"""atr: the attribute name for the linkset clerk: a clerk fclass: the type of the linkset fkey: column name of the foreign key that points back to the parent"""
<|body_0|>
def inject(self, box, name):
"""... | stack_v2_sparse_classes_36k_train_011935 | 895 | no_license | [
{
"docstring": "atr: the attribute name for the linkset clerk: a clerk fclass: the type of the linkset fkey: column name of the foreign key that points back to the parent",
"name": "__init__",
"signature": "def __init__(self, atr, clerk, fclass, fkey)"
},
{
"docstring": "box: the Strongbox insta... | 2 | stack_v2_sparse_classes_30k_train_020513 | Implement the Python class `LinkSetInjector` described below.
Class description:
Implement the LinkSetInjector class.
Method signatures and docstrings:
- def __init__(self, atr, clerk, fclass, fkey): atr: the attribute name for the linkset clerk: a clerk fclass: the type of the linkset fkey: column name of the foreig... | Implement the Python class `LinkSetInjector` described below.
Class description:
Implement the LinkSetInjector class.
Method signatures and docstrings:
- def __init__(self, atr, clerk, fclass, fkey): atr: the attribute name for the linkset clerk: a clerk fclass: the type of the linkset fkey: column name of the foreig... | a7df929147d82d225606c216f69c48d898e19ebe | <|skeleton|>
class LinkSetInjector:
def __init__(self, atr, clerk, fclass, fkey):
"""atr: the attribute name for the linkset clerk: a clerk fclass: the type of the linkset fkey: column name of the foreign key that points back to the parent"""
<|body_0|>
def inject(self, box, name):
"""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LinkSetInjector:
def __init__(self, atr, clerk, fclass, fkey):
"""atr: the attribute name for the linkset clerk: a clerk fclass: the type of the linkset fkey: column name of the foreign key that points back to the parent"""
self.clerk = clerk
self.atr = atr
self.fclass = fclass... | the_stack_v2_python_sparse | @gone/arlo/LinkSetInjector.py | mattharkness/sixthdev | train | 0 | |
a026393596cb420d39852d1a1cc43f84b92107b4 | [
"material = context.active_object.active_material\nif not (self.filepath[-4:] in ('.tga', '.png') or self.filepath[-5:] == '.tobj'):\n self.report({'ERROR'}, \"Selected file is not TOBJ, TGA or PNG! Texture won't be loaded.\")\n lprint(\"E Selected file is not TOBJ, TGA or PNG! Texture won't be loaded.\")\n ... | <|body_start_0|>
material = context.active_object.active_material
if not (self.filepath[-4:] in ('.tga', '.png') or self.filepath[-5:] == '.tobj'):
self.report({'ERROR'}, "Selected file is not TOBJ, TGA or PNG! Texture won't be loaded.")
lprint("E Selected file is not TOBJ, TGA o... | Universal operator for setting relative or absolute paths to shader texture files. | SelectShaderTextureFilePath | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SelectShaderTextureFilePath:
"""Universal operator for setting relative or absolute paths to shader texture files."""
def execute(self, context):
"""Set shader texture file path."""
<|body_0|>
def invoke(self, context, event):
"""Invoke a file path selector."""
... | stack_v2_sparse_classes_36k_train_011936 | 24,902 | no_license | [
{
"docstring": "Set shader texture file path.",
"name": "execute",
"signature": "def execute(self, context)"
},
{
"docstring": "Invoke a file path selector.",
"name": "invoke",
"signature": "def invoke(self, context, event)"
}
] | 2 | null | Implement the Python class `SelectShaderTextureFilePath` described below.
Class description:
Universal operator for setting relative or absolute paths to shader texture files.
Method signatures and docstrings:
- def execute(self, context): Set shader texture file path.
- def invoke(self, context, event): Invoke a fil... | Implement the Python class `SelectShaderTextureFilePath` described below.
Class description:
Universal operator for setting relative or absolute paths to shader texture files.
Method signatures and docstrings:
- def execute(self, context): Set shader texture file path.
- def invoke(self, context, event): Invoke a fil... | 7b796d30dfd22b7706a93e4419ed913d18d29a44 | <|skeleton|>
class SelectShaderTextureFilePath:
"""Universal operator for setting relative or absolute paths to shader texture files."""
def execute(self, context):
"""Set shader texture file path."""
<|body_0|>
def invoke(self, context, event):
"""Invoke a file path selector."""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SelectShaderTextureFilePath:
"""Universal operator for setting relative or absolute paths to shader texture files."""
def execute(self, context):
"""Set shader texture file path."""
material = context.active_object.active_material
if not (self.filepath[-4:] in ('.tga', '.png') or ... | the_stack_v2_python_sparse | All_In_One/addons/io_scs_tools/operators/material.py | 2434325680/Learnbgame | train | 0 |
1ad46bb4988f06fdd488687f891b345706ed376c | [
"array.append(0)\nstack = [-1]\nmax_area = 0\nfor i, curr in enumerate(array):\n while array[stack[-1]] > curr:\n height = array[stack.pop()]\n area = (i - stack[-1] - 1) * height\n if area > max_area:\n max_area = area\n stack.append(i)\narray.pop()\nreturn max_area",
"if no... | <|body_start_0|>
array.append(0)
stack = [-1]
max_area = 0
for i, curr in enumerate(array):
while array[stack[-1]] > curr:
height = array[stack.pop()]
area = (i - stack[-1] - 1) * height
if area > max_area:
m... | SolutionOptimized | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SolutionOptimized:
def largest_rectangle(self, array):
"""Time complexity: O(n). Space complexity: O(n), n is len(array)."""
<|body_0|>
def maximalRectangle(self, matrix):
"""Time complexity: O(n * m). Space complexity: O(n), n, m are number of rows and columns in th... | stack_v2_sparse_classes_36k_train_011937 | 3,584 | no_license | [
{
"docstring": "Time complexity: O(n). Space complexity: O(n), n is len(array).",
"name": "largest_rectangle",
"signature": "def largest_rectangle(self, array)"
},
{
"docstring": "Time complexity: O(n * m). Space complexity: O(n), n, m are number of rows and columns in the matrix.",
"name": ... | 2 | null | Implement the Python class `SolutionOptimized` described below.
Class description:
Implement the SolutionOptimized class.
Method signatures and docstrings:
- def largest_rectangle(self, array): Time complexity: O(n). Space complexity: O(n), n is len(array).
- def maximalRectangle(self, matrix): Time complexity: O(n *... | Implement the Python class `SolutionOptimized` described below.
Class description:
Implement the SolutionOptimized class.
Method signatures and docstrings:
- def largest_rectangle(self, array): Time complexity: O(n). Space complexity: O(n), n is len(array).
- def maximalRectangle(self, matrix): Time complexity: O(n *... | 71b722ddfe8da04572e527b055cf8723d5c87bbf | <|skeleton|>
class SolutionOptimized:
def largest_rectangle(self, array):
"""Time complexity: O(n). Space complexity: O(n), n is len(array)."""
<|body_0|>
def maximalRectangle(self, matrix):
"""Time complexity: O(n * m). Space complexity: O(n), n, m are number of rows and columns in th... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SolutionOptimized:
def largest_rectangle(self, array):
"""Time complexity: O(n). Space complexity: O(n), n is len(array)."""
array.append(0)
stack = [-1]
max_area = 0
for i, curr in enumerate(array):
while array[stack[-1]] > curr:
height = ar... | the_stack_v2_python_sparse | Matrix_problems/maximal_rectangle.py | vladn90/Algorithms | train | 0 | |
f275d28d27451e829fb50a700cf3b122f2a2a66e | [
"try:\n self._fromfile()\nexcept:\n self._fromdatabase()\n self._tofile()",
"from datasource import DataSource\nfrom astropy.coordinates import SkyCoord\nfrom astropy import units as u\nself.wifsip = DataSource(database=config.dbname, user=config.dbuser, host=config.dbhost)\nself.stars = []\ncolumns = se... | <|body_start_0|>
try:
self._fromfile()
except:
self._fromdatabase()
self._tofile()
<|end_body_0|>
<|body_start_1|>
from datasource import DataSource
from astropy.coordinates import SkyCoord
from astropy import units as u
self.wifsip = ... | NGC6633Table | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NGC6633Table:
def __init__(self):
"""Constructor"""
<|body_0|>
def _fromdatabase(self):
"""import the table from a database"""
<|body_1|>
def _fromfile(self, filename=None):
"""unpickle the data from a file"""
<|body_2|>
def _tofile(... | stack_v2_sparse_classes_36k_train_011938 | 2,628 | no_license | [
{
"docstring": "Constructor",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "import the table from a database",
"name": "_fromdatabase",
"signature": "def _fromdatabase(self)"
},
{
"docstring": "unpickle the data from a file",
"name": "_fromfile",
... | 4 | stack_v2_sparse_classes_30k_train_015030 | Implement the Python class `NGC6633Table` described below.
Class description:
Implement the NGC6633Table class.
Method signatures and docstrings:
- def __init__(self): Constructor
- def _fromdatabase(self): import the table from a database
- def _fromfile(self, filename=None): unpickle the data from a file
- def _tof... | Implement the Python class `NGC6633Table` described below.
Class description:
Implement the NGC6633Table class.
Method signatures and docstrings:
- def __init__(self): Constructor
- def _fromdatabase(self): import the table from a database
- def _fromfile(self, filename=None): unpickle the data from a file
- def _tof... | c2df6b5de8e94c3935768a8fb40b4f046c21afb4 | <|skeleton|>
class NGC6633Table:
def __init__(self):
"""Constructor"""
<|body_0|>
def _fromdatabase(self):
"""import the table from a database"""
<|body_1|>
def _fromfile(self, filename=None):
"""unpickle the data from a file"""
<|body_2|>
def _tofile(... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NGC6633Table:
def __init__(self):
"""Constructor"""
try:
self._fromfile()
except:
self._fromdatabase()
self._tofile()
def _fromdatabase(self):
"""import the table from a database"""
from datasource import DataSource
from ... | the_stack_v2_python_sparse | src/ngc6633/ngc6633table.py | weingrill/SOCS | train | 0 | |
d7cc301b431a7927576741ed488938a1d1e47cdf | [
"self.features = []\nself.csv_url = []\nreturn",
"order = FME_utils.feature_get_attribute(feature, ORDER, True)\nif order == 1:\n url_value = FME_utils.feature_get_attribute(feature, URL, True)\n self.csv_url.append(url_value)\nelse:\n self.features.append(feature)\nreturn",
"for feature in self.featur... | <|body_start_0|>
self.features = []
self.csv_url = []
return
<|end_body_0|>
<|body_start_1|>
order = FME_utils.feature_get_attribute(feature, ORDER, True)
if order == 1:
url_value = FME_utils.feature_get_attribute(feature, URL, True)
self.csv_url.append(u... | Template Class Interface: When using this class, make sure its name is set as the value of the 'Class to Process Features' transformer parameter. This class will update the FME attribute resource{} list by adding 2 attributes if the resources{x}.url attribute is contained in the list of URL read from the CSV file. | SetUrlResources | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SetUrlResources:
"""Template Class Interface: When using this class, make sure its name is set as the value of the 'Class to Process Features' transformer parameter. This class will update the FME attribute resource{} list by adding 2 attributes if the resources{x}.url attribute is contained in t... | stack_v2_sparse_classes_36k_train_011939 | 2,930 | permissive | [
{
"docstring": "Define the variables needed to load and store the incoming features. Parameters ---------- None Returns ------- None",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "This method stores the incoming FME features. Parameters ---------- feature: FmeFeature ... | 3 | stack_v2_sparse_classes_30k_train_017085 | Implement the Python class `SetUrlResources` described below.
Class description:
Template Class Interface: When using this class, make sure its name is set as the value of the 'Class to Process Features' transformer parameter. This class will update the FME attribute resource{} list by adding 2 attributes if the resou... | Implement the Python class `SetUrlResources` described below.
Class description:
Template Class Interface: When using this class, make sure its name is set as the value of the 'Class to Process Features' transformer parameter. This class will update the FME attribute resource{} list by adding 2 attributes if the resou... | 82368614a2658260c0f09a1b5d341918310626e5 | <|skeleton|>
class SetUrlResources:
"""Template Class Interface: When using this class, make sure its name is set as the value of the 'Class to Process Features' transformer parameter. This class will update the FME attribute resource{} list by adding 2 attributes if the resources{x}.url attribute is contained in t... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SetUrlResources:
"""Template Class Interface: When using this class, make sure its name is set as the value of the 'Class to Process Features' transformer parameter. This class will update the FME attribute resource{} list by adding 2 attributes if the resources{x}.url attribute is contained in the list of UR... | the_stack_v2_python_sparse | FME_files/FME_Custom_Transformers/Python/MAP_RESOURCE_ATTRIBUTION_REMOVER_NG.py | federal-geospatial-platform/fgp-metadata-proxy | train | 10 |
fcb6dab7f8b77083a166d75c28c46c515c9f73ce | [
"if not protocol_version:\n return protocol_version\nif protocol_version != 1:\n raise ValidationError('Protocol version 1 only supported.')\nreturn protocol_version",
"allowed_metadata_versions = ('1.0', '1.1', '1.2', '2.0', '2.1')\nif metadata_version not in allowed_metadata_versions:\n raise Validatio... | <|body_start_0|>
if not protocol_version:
return protocol_version
if protocol_version != 1:
raise ValidationError('Protocol version 1 only supported.')
return protocol_version
<|end_body_0|>
<|body_start_1|>
allowed_metadata_versions = ('1.0', '1.1', '1.2', '2.0'... | PackageUpload | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PackageUpload:
def validate_protocol_version(cls, protocol_version: int) -> int:
"""Check if protocol_version is 1."""
<|body_0|>
def validate_metadata_version(cls, metadata_version: str) -> str:
"""Check if metadata_version is known."""
<|body_1|>
<|end_ske... | stack_v2_sparse_classes_36k_train_011940 | 3,537 | no_license | [
{
"docstring": "Check if protocol_version is 1.",
"name": "validate_protocol_version",
"signature": "def validate_protocol_version(cls, protocol_version: int) -> int"
},
{
"docstring": "Check if metadata_version is known.",
"name": "validate_metadata_version",
"signature": "def validate_... | 2 | stack_v2_sparse_classes_30k_train_016914 | Implement the Python class `PackageUpload` described below.
Class description:
Implement the PackageUpload class.
Method signatures and docstrings:
- def validate_protocol_version(cls, protocol_version: int) -> int: Check if protocol_version is 1.
- def validate_metadata_version(cls, metadata_version: str) -> str: Ch... | Implement the Python class `PackageUpload` described below.
Class description:
Implement the PackageUpload class.
Method signatures and docstrings:
- def validate_protocol_version(cls, protocol_version: int) -> int: Check if protocol_version is 1.
- def validate_metadata_version(cls, metadata_version: str) -> str: Ch... | 26759c37375d04ab202a490ca5d1063faab042e6 | <|skeleton|>
class PackageUpload:
def validate_protocol_version(cls, protocol_version: int) -> int:
"""Check if protocol_version is 1."""
<|body_0|>
def validate_metadata_version(cls, metadata_version: str) -> str:
"""Check if metadata_version is known."""
<|body_1|>
<|end_ske... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PackageUpload:
def validate_protocol_version(cls, protocol_version: int) -> int:
"""Check if protocol_version is 1."""
if not protocol_version:
return protocol_version
if protocol_version != 1:
raise ValidationError('Protocol version 1 only supported.')
... | the_stack_v2_python_sparse | pypis/api/models/packages.py | jurelou/pypis | train | 1 | |
1f38ffd5950fb055abdbf9a464e87ae5129147bb | [
"data = request.data\ntry:\n page_size = request.GET.get('page_size', 20)\n page = int(request.GET.get('page', 1))\nexcept Exception as ex:\n return JsonResponse(code=status.HTTP_400_BAD_REQUEST, msg=ex)\nqurieyset = GlobalData.objects.all()\npaginator = Paginator(qurieyset, page_size)\ntotal = paginator.n... | <|body_start_0|>
data = request.data
try:
page_size = request.GET.get('page_size', 20)
page = int(request.GET.get('page', 1))
except Exception as ex:
return JsonResponse(code=status.HTTP_400_BAD_REQUEST, msg=ex)
qurieyset = GlobalData.objects.all()
... | GlobalParamsApi | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GlobalParamsApi:
def get(self, request):
"""查询所有全局参数列表 :param request: :return:"""
<|body_0|>
def post(self, request):
"""添加全局参数接口 :param request: :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
data = request.data
try:
... | stack_v2_sparse_classes_36k_train_011941 | 3,019 | no_license | [
{
"docstring": "查询所有全局参数列表 :param request: :return:",
"name": "get",
"signature": "def get(self, request)"
},
{
"docstring": "添加全局参数接口 :param request: :return:",
"name": "post",
"signature": "def post(self, request)"
}
] | 2 | stack_v2_sparse_classes_30k_train_011038 | Implement the Python class `GlobalParamsApi` described below.
Class description:
Implement the GlobalParamsApi class.
Method signatures and docstrings:
- def get(self, request): 查询所有全局参数列表 :param request: :return:
- def post(self, request): 添加全局参数接口 :param request: :return: | Implement the Python class `GlobalParamsApi` described below.
Class description:
Implement the GlobalParamsApi class.
Method signatures and docstrings:
- def get(self, request): 查询所有全局参数列表 :param request: :return:
- def post(self, request): 添加全局参数接口 :param request: :return:
<|skeleton|>
class GlobalParamsApi:
d... | 694e608a20e2774f94589a3c00de4b6a6b3dfdc5 | <|skeleton|>
class GlobalParamsApi:
def get(self, request):
"""查询所有全局参数列表 :param request: :return:"""
<|body_0|>
def post(self, request):
"""添加全局参数接口 :param request: :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GlobalParamsApi:
def get(self, request):
"""查询所有全局参数列表 :param request: :return:"""
data = request.data
try:
page_size = request.GET.get('page_size', 20)
page = int(request.GET.get('page', 1))
except Exception as ex:
return JsonResponse(code=s... | the_stack_v2_python_sparse | webkeyword/api/v1/ui/api_global_params.py | LiuXiangQi/supper | train | 0 | |
0d0002a74f37d3a84129a14afe25fe6cb477cfc8 | [
"super(PrintPopulationTypeClusters, self).__init__(experiment, name='PrintPopulationTypeClusters', label=label)\nself.epoch_start = self.experiment.config.getint(self.config_section, 'epoch_start', 0)\nself.epoch_end = self.experiment.config.getint(self.config_section, 'epoch_end', default=self.experiment.config.ge... | <|body_start_0|>
super(PrintPopulationTypeClusters, self).__init__(experiment, name='PrintPopulationTypeClusters', label=label)
self.epoch_start = self.experiment.config.getint(self.config_section, 'epoch_start', 0)
self.epoch_end = self.experiment.config.getint(self.config_section, 'epoch_end',... | Write a data file containing the numbers of clusters of each Cell type, as well as their mean size and the standard deviation in size Configuration is done in the [PrintPopulationTypeClusters] section Configuration Options: epoch_start The epoch at which to start executing (default: 0) epoch_end The epoch at which to s... | PrintPopulationTypeClusters | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PrintPopulationTypeClusters:
"""Write a data file containing the numbers of clusters of each Cell type, as well as their mean size and the standard deviation in size Configuration is done in the [PrintPopulationTypeClusters] section Configuration Options: epoch_start The epoch at which to start e... | stack_v2_sparse_classes_36k_train_011942 | 4,832 | permissive | [
{
"docstring": "Initialize the PrintPopulationTypeClusters Action",
"name": "__init__",
"signature": "def __init__(self, experiment, label=None)"
},
{
"docstring": "Execute the Action",
"name": "update",
"signature": "def update(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_016943 | Implement the Python class `PrintPopulationTypeClusters` described below.
Class description:
Write a data file containing the numbers of clusters of each Cell type, as well as their mean size and the standard deviation in size Configuration is done in the [PrintPopulationTypeClusters] section Configuration Options: ep... | Implement the Python class `PrintPopulationTypeClusters` described below.
Class description:
Write a data file containing the numbers of clusters of each Cell type, as well as their mean size and the standard deviation in size Configuration is done in the [PrintPopulationTypeClusters] section Configuration Options: ep... | a114ac66e62a960e18127faf52cff9e48831e212 | <|skeleton|>
class PrintPopulationTypeClusters:
"""Write a data file containing the numbers of clusters of each Cell type, as well as their mean size and the standard deviation in size Configuration is done in the [PrintPopulationTypeClusters] section Configuration Options: epoch_start The epoch at which to start e... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PrintPopulationTypeClusters:
"""Write a data file containing the numbers of clusters of each Cell type, as well as their mean size and the standard deviation in size Configuration is done in the [PrintPopulationTypeClusters] section Configuration Options: epoch_start The epoch at which to start executing (def... | the_stack_v2_python_sparse | seeds/plugins/action/PrintPopulationTypeClusters.py | namlehai/seeds | train | 0 |
3fca41681797fe48a678c9f88aac87234a6cb12e | [
"alsoProvides(request, IDisableCSRFProtection)\nself.context = context\nself.request = request",
"if api.user.is_anonymous:\n return True\nroles = api.user.get_roles(obj=self.context)\nreturn 'Member' not in roles"
] | <|body_start_0|>
alsoProvides(request, IDisableCSRFProtection)
self.context = context
self.request = request
<|end_body_0|>
<|body_start_1|>
if api.user.is_anonymous:
return True
roles = api.user.get_roles(obj=self.context)
return 'Member' not in roles
<|end_... | Logic needed for the homepage view | HomePage | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HomePage:
"""Logic needed for the homepage view"""
def __init__(self, context, request):
"""Initialize context and request as view multi adaption parameters."""
<|body_0|>
def newbie(self):
"""True if 'Member' role not assigned"""
<|body_1|>
<|end_skelet... | stack_v2_sparse_classes_36k_train_011943 | 713 | no_license | [
{
"docstring": "Initialize context and request as view multi adaption parameters.",
"name": "__init__",
"signature": "def __init__(self, context, request)"
},
{
"docstring": "True if 'Member' role not assigned",
"name": "newbie",
"signature": "def newbie(self)"
}
] | 2 | null | Implement the Python class `HomePage` described below.
Class description:
Logic needed for the homepage view
Method signatures and docstrings:
- def __init__(self, context, request): Initialize context and request as view multi adaption parameters.
- def newbie(self): True if 'Member' role not assigned | Implement the Python class `HomePage` described below.
Class description:
Logic needed for the homepage view
Method signatures and docstrings:
- def __init__(self, context, request): Initialize context and request as view multi adaption parameters.
- def newbie(self): True if 'Member' role not assigned
<|skeleton|>
... | 6d7656dfd1687df055f7f8cedb2e7fad92468988 | <|skeleton|>
class HomePage:
"""Logic needed for the homepage view"""
def __init__(self, context, request):
"""Initialize context and request as view multi adaption parameters."""
<|body_0|>
def newbie(self):
"""True if 'Member' role not assigned"""
<|body_1|>
<|end_skelet... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class HomePage:
"""Logic needed for the homepage view"""
def __init__(self, context, request):
"""Initialize context and request as view multi adaption parameters."""
alsoProvides(request, IDisableCSRFProtection)
self.context = context
self.request = request
def newbie(self... | the_stack_v2_python_sparse | src/pcp/contenttypes/browser/home_page.py | EUDAT-DPMT/pcp.contenttypes | train | 1 |
db5392730296201fc393727bab4d48779fbfa707 | [
"super().__init__(address)\nself._name = name\nself._card_no = card_no\nself._expiry_date = expiry_date",
"expiry = ''\ncard_no = ''\nif self._expiry_date is not None:\n expiry = f\"Expires on {self._expiry_date.strftime('%Y-%m-%d')}\\n\"\nif self._card_no is not None:\n card_no = f'{self._card_no}\\n'\nret... | <|body_start_0|>
super().__init__(address)
self._name = name
self._card_no = card_no
self._expiry_date = expiry_date
<|end_body_0|>
<|body_start_1|>
expiry = ''
card_no = ''
if self._expiry_date is not None:
expiry = f"Expires on {self._expiry_date.st... | Represent identification card. | IDCard | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IDCard:
"""Represent identification card."""
def __init__(self, name, card_no, expiry_date, address):
"""Initialise IDCard. :param name: String :param card_no: String :param expiry_date: Date :param address: Address"""
<|body_0|>
def __str__(self):
"""Format how ... | stack_v2_sparse_classes_36k_train_011944 | 10,626 | no_license | [
{
"docstring": "Initialise IDCard. :param name: String :param card_no: String :param expiry_date: Date :param address: Address",
"name": "__init__",
"signature": "def __init__(self, name, card_no, expiry_date, address)"
},
{
"docstring": "Format how IDCards are displayed to the user. :return: St... | 2 | stack_v2_sparse_classes_30k_train_005067 | Implement the Python class `IDCard` described below.
Class description:
Represent identification card.
Method signatures and docstrings:
- def __init__(self, name, card_no, expiry_date, address): Initialise IDCard. :param name: String :param card_no: String :param expiry_date: Date :param address: Address
- def __str... | Implement the Python class `IDCard` described below.
Class description:
Represent identification card.
Method signatures and docstrings:
- def __init__(self, name, card_no, expiry_date, address): Initialise IDCard. :param name: String :param card_no: String :param expiry_date: Date :param address: Address
- def __str... | b7695cc7cf0860aa9c8bf492b1bd06bd88b9af41 | <|skeleton|>
class IDCard:
"""Represent identification card."""
def __init__(self, name, card_no, expiry_date, address):
"""Initialise IDCard. :param name: String :param card_no: String :param expiry_date: Date :param address: Address"""
<|body_0|>
def __str__(self):
"""Format how ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class IDCard:
"""Represent identification card."""
def __init__(self, name, card_no, expiry_date, address):
"""Initialise IDCard. :param name: String :param card_no: String :param expiry_date: Date :param address: Address"""
super().__init__(address)
self._name = name
self._card... | the_stack_v2_python_sparse | Assignments/Assignment 2/card.py | sakshambhardwaj523/Python-OOP-Projects | train | 0 |
ec1edb3e63106cf9ed23810cc15ee7d787c032f1 | [
"if game_object is None or household_id == -1:\n return False\ngame_object.set_household_owner_id(household_id)\nreturn True",
"if game_object is None:\n return -1\nreturn game_object.get_household_owner_id()",
"if game_object is None or sim_info is None:\n return False\nsim = CommonSimUtils.get_sim_in... | <|body_start_0|>
if game_object is None or household_id == -1:
return False
game_object.set_household_owner_id(household_id)
return True
<|end_body_0|>
<|body_start_1|>
if game_object is None:
return -1
return game_object.get_household_owner_id()
<|end_bo... | Utilities for manipulating the ownership of Objects. | CommonObjectOwnershipUtils | [
"CC-BY-4.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CommonObjectOwnershipUtils:
"""Utilities for manipulating the ownership of Objects."""
def set_owning_household_id(game_object: GameObject, household_id: int) -> bool:
"""set_owning_household_id(game_object, household_id) Set the Household that owns the Object. :param game_object: An... | stack_v2_sparse_classes_36k_train_011945 | 6,020 | permissive | [
{
"docstring": "set_owning_household_id(game_object, household_id) Set the Household that owns the Object. :param game_object: An instance of an Object. :type game_object: GameObject :param household_id: The decimal identifier of a Household. :type household_id: int :return: True, if the Household was successfu... | 5 | null | Implement the Python class `CommonObjectOwnershipUtils` described below.
Class description:
Utilities for manipulating the ownership of Objects.
Method signatures and docstrings:
- def set_owning_household_id(game_object: GameObject, household_id: int) -> bool: set_owning_household_id(game_object, household_id) Set t... | Implement the Python class `CommonObjectOwnershipUtils` described below.
Class description:
Utilities for manipulating the ownership of Objects.
Method signatures and docstrings:
- def set_owning_household_id(game_object: GameObject, household_id: int) -> bool: set_owning_household_id(game_object, household_id) Set t... | 58e7beb30b9c818b294d35abd2436a0192cd3e82 | <|skeleton|>
class CommonObjectOwnershipUtils:
"""Utilities for manipulating the ownership of Objects."""
def set_owning_household_id(game_object: GameObject, household_id: int) -> bool:
"""set_owning_household_id(game_object, household_id) Set the Household that owns the Object. :param game_object: An... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CommonObjectOwnershipUtils:
"""Utilities for manipulating the ownership of Objects."""
def set_owning_household_id(game_object: GameObject, household_id: int) -> bool:
"""set_owning_household_id(game_object, household_id) Set the Household that owns the Object. :param game_object: An instance of ... | the_stack_v2_python_sparse | Scripts/sims4communitylib/utils/objects/common_object_ownership_utils.py | ColonolNutty/Sims4CommunityLibrary | train | 183 |
d1e276709598d8a4c0a1ea1bda580b910b5ea589 | [
"self.N = N\nself.list = []\ncur = 0\nfor i in sorted(blacklist):\n if cur == i:\n cur += 1\n continue\n if len(self.list) == 0:\n self.list.append([i - cur, cur, i - 1])\n else:\n self.list.append([self.list[-1][0] + i - cur, cur, i - 1])\n cur = i + 1\nif cur < N:\n if l... | <|body_start_0|>
self.N = N
self.list = []
cur = 0
for i in sorted(blacklist):
if cur == i:
cur += 1
continue
if len(self.list) == 0:
self.list.append([i - cur, cur, i - 1])
else:
self.lis... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def __init__(self, N, blacklist):
""":type N: int :type blacklist: List[int]"""
<|body_0|>
def pick(self):
""":rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.N = N
self.list = []
cur = 0
for i in so... | stack_v2_sparse_classes_36k_train_011946 | 2,476 | no_license | [
{
"docstring": ":type N: int :type blacklist: List[int]",
"name": "__init__",
"signature": "def __init__(self, N, blacklist)"
},
{
"docstring": ":rtype: int",
"name": "pick",
"signature": "def pick(self)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def __init__(self, N, blacklist): :type N: int :type blacklist: List[int]
- def pick(self): :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def __init__(self, N, blacklist): :type N: int :type blacklist: List[int]
- def pick(self): :rtype: int
<|skeleton|>
class Solution:
def __init__(self, N, blacklist):
... | 9190d3d178f1733aa226973757ee7e045b7bab00 | <|skeleton|>
class Solution:
def __init__(self, N, blacklist):
""":type N: int :type blacklist: List[int]"""
<|body_0|>
def pick(self):
""":rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def __init__(self, N, blacklist):
""":type N: int :type blacklist: List[int]"""
self.N = N
self.list = []
cur = 0
for i in sorted(blacklist):
if cur == i:
cur += 1
continue
if len(self.list) == 0:
... | the_stack_v2_python_sparse | RandomPickWithBlacklist.py | ellinx/LC-python | train | 1 | |
a9991cc8b86cbe07dc3e0e6ade1a44ee55859c97 | [
"random_id = data_utils.rand_uuid_hex()\nimage = self.admin_client.create_image(container_format='bare', disk_format='raw', owner=random_id)\nself.addCleanup(self.admin_client.delete_image, image['id'])\nimage_info = self.admin_client.show_image(image['id'])\nself.assertEqual(random_id, image_info['owner'])",
"ra... | <|body_start_0|>
random_id = data_utils.rand_uuid_hex()
image = self.admin_client.create_image(container_format='bare', disk_format='raw', owner=random_id)
self.addCleanup(self.admin_client.delete_image, image['id'])
image_info = self.admin_client.show_image(image['id'])
self.ass... | "Test image operations about image owner | BasicOperationsImagesAdminTest | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BasicOperationsImagesAdminTest:
""""Test image operations about image owner"""
def test_create_image_owner_param(self):
"""Test creating image with specified owner"""
<|body_0|>
def test_update_image_owner_param(self):
"""Test updating image owner"""
<|bo... | stack_v2_sparse_classes_36k_train_011947 | 7,863 | permissive | [
{
"docstring": "Test creating image with specified owner",
"name": "test_create_image_owner_param",
"signature": "def test_create_image_owner_param(self)"
},
{
"docstring": "Test updating image owner",
"name": "test_update_image_owner_param",
"signature": "def test_update_image_owner_par... | 3 | stack_v2_sparse_classes_30k_train_013528 | Implement the Python class `BasicOperationsImagesAdminTest` described below.
Class description:
"Test image operations about image owner
Method signatures and docstrings:
- def test_create_image_owner_param(self): Test creating image with specified owner
- def test_update_image_owner_param(self): Test updating image ... | Implement the Python class `BasicOperationsImagesAdminTest` described below.
Class description:
"Test image operations about image owner
Method signatures and docstrings:
- def test_create_image_owner_param(self): Test creating image with specified owner
- def test_update_image_owner_param(self): Test updating image ... | 3932a799e620a20d7abf7b89e21b520683a1809b | <|skeleton|>
class BasicOperationsImagesAdminTest:
""""Test image operations about image owner"""
def test_create_image_owner_param(self):
"""Test creating image with specified owner"""
<|body_0|>
def test_update_image_owner_param(self):
"""Test updating image owner"""
<|bo... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BasicOperationsImagesAdminTest:
""""Test image operations about image owner"""
def test_create_image_owner_param(self):
"""Test creating image with specified owner"""
random_id = data_utils.rand_uuid_hex()
image = self.admin_client.create_image(container_format='bare', disk_format... | the_stack_v2_python_sparse | tempest/api/image/v2/admin/test_images.py | openstack/tempest | train | 270 |
ae24b7eea7a73b587ec50156b601339ef5e3ae8d | [
"parameters = json_parameters()\nbytes_param = param_get(parameters, 'bytes')\ntry:\n set_local_account_limit(account=account, rse=rse, bytes_=bytes_param, issuer=request.environ.get('issuer'), vo=request.environ.get('vo'))\nexcept AccessDenied as error:\n return generate_http_error_flask(401, error)\nexcept ... | <|body_start_0|>
parameters = json_parameters()
bytes_param = param_get(parameters, 'bytes')
try:
set_local_account_limit(account=account, rse=rse, bytes_=bytes_param, issuer=request.environ.get('issuer'), vo=request.environ.get('vo'))
except AccessDenied as error:
... | LocalAccountLimit | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LocalAccountLimit:
def post(self, account, rse):
"""--- summary: Create or update a local accont limit tags: - Account Limit parameters: - name: account in: path description: The account for the accountlimit. schema: type: string style: simple - name: rse in: path description: The rse fo... | stack_v2_sparse_classes_36k_train_011948 | 7,826 | permissive | [
{
"docstring": "--- summary: Create or update a local accont limit tags: - Account Limit parameters: - name: account in: path description: The account for the accountlimit. schema: type: string style: simple - name: rse in: path description: The rse for the accountlimit. schema: type: string style: simple reque... | 2 | null | Implement the Python class `LocalAccountLimit` described below.
Class description:
Implement the LocalAccountLimit class.
Method signatures and docstrings:
- def post(self, account, rse): --- summary: Create or update a local accont limit tags: - Account Limit parameters: - name: account in: path description: The acc... | Implement the Python class `LocalAccountLimit` described below.
Class description:
Implement the LocalAccountLimit class.
Method signatures and docstrings:
- def post(self, account, rse): --- summary: Create or update a local accont limit tags: - Account Limit parameters: - name: account in: path description: The acc... | 7f0d229ac0b3bc7dec12c6e158bea2b82d414a3b | <|skeleton|>
class LocalAccountLimit:
def post(self, account, rse):
"""--- summary: Create or update a local accont limit tags: - Account Limit parameters: - name: account in: path description: The account for the accountlimit. schema: type: string style: simple - name: rse in: path description: The rse fo... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LocalAccountLimit:
def post(self, account, rse):
"""--- summary: Create or update a local accont limit tags: - Account Limit parameters: - name: account in: path description: The account for the accountlimit. schema: type: string style: simple - name: rse in: path description: The rse for the accountl... | the_stack_v2_python_sparse | lib/rucio/web/rest/flaskapi/v1/accountlimits.py | rucio/rucio | train | 232 | |
28fdbff0af061fcdc4b58a724418db2d027abc6a | [
"base.Action.__init__(self, self.__loadOverlay)\nself.__overlayList = overlayList\nself.__displayCtx = displayCtx",
"def onLoad(paths, overlays):\n if len(overlays) == 0:\n return\n self.__overlayList.extend(overlays)\n self.__displayCtx.selectedOverlay = self.__displayCtx.overlayOrder[-1]\n if... | <|body_start_0|>
base.Action.__init__(self, self.__loadOverlay)
self.__overlayList = overlayList
self.__displayCtx = displayCtx
<|end_body_0|>
<|body_start_1|>
def onLoad(paths, overlays):
if len(overlays) == 0:
return
self.__overlayList.extend(ov... | The ``LoadOverlayAction`` allows the user to add files to the :class:`.OverlayList`. | LoadOverlayAction | [
"BSD-3-Clause",
"CC-BY-3.0",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LoadOverlayAction:
"""The ``LoadOverlayAction`` allows the user to add files to the :class:`.OverlayList`."""
def __init__(self, overlayList, displayCtx, frame):
"""Create a ``LoadOverlayAction``. :arg overlayList: The :class:`.OverlayList`. :arg displayCtx: The :class:`.DisplayConte... | stack_v2_sparse_classes_36k_train_011949 | 16,912 | permissive | [
{
"docstring": "Create a ``LoadOverlayAction``. :arg overlayList: The :class:`.OverlayList`. :arg displayCtx: The :class:`.DisplayContext`. :arg frame: The :class:`.FSLeyesFrame`.",
"name": "__init__",
"signature": "def __init__(self, overlayList, displayCtx, frame)"
},
{
"docstring": "Calls :fu... | 2 | stack_v2_sparse_classes_30k_train_012974 | Implement the Python class `LoadOverlayAction` described below.
Class description:
The ``LoadOverlayAction`` allows the user to add files to the :class:`.OverlayList`.
Method signatures and docstrings:
- def __init__(self, overlayList, displayCtx, frame): Create a ``LoadOverlayAction``. :arg overlayList: The :class:`... | Implement the Python class `LoadOverlayAction` described below.
Class description:
The ``LoadOverlayAction`` allows the user to add files to the :class:`.OverlayList`.
Method signatures and docstrings:
- def __init__(self, overlayList, displayCtx, frame): Create a ``LoadOverlayAction``. :arg overlayList: The :class:`... | 46ccb4fe2b2346eb57576247f49714032b61307a | <|skeleton|>
class LoadOverlayAction:
"""The ``LoadOverlayAction`` allows the user to add files to the :class:`.OverlayList`."""
def __init__(self, overlayList, displayCtx, frame):
"""Create a ``LoadOverlayAction``. :arg overlayList: The :class:`.OverlayList`. :arg displayCtx: The :class:`.DisplayConte... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LoadOverlayAction:
"""The ``LoadOverlayAction`` allows the user to add files to the :class:`.OverlayList`."""
def __init__(self, overlayList, displayCtx, frame):
"""Create a ``LoadOverlayAction``. :arg overlayList: The :class:`.OverlayList`. :arg displayCtx: The :class:`.DisplayContext`. :arg fra... | the_stack_v2_python_sparse | fsleyes/actions/loadoverlay.py | sanjayankur31/fsleyes | train | 1 |
e0082e3a2da4575de5b192dc60b1dedb967b0ff2 | [
"elements = [Adder(val) for val in (0, -2, 2, 1000000.0, -1000000.0)]\nfor parent, child in itertools.product(elements, repeat=2):\n for initial in (0, 15, -15, -1000000.0, +1000000.0):\n with self.subTest(parent=parent, child=child, initial=initial):\n expected = initial + parent.value + child... | <|body_start_0|>
elements = [Adder(val) for val in (0, -2, 2, 1000000.0, -1000000.0)]
for parent, child in itertools.product(elements, repeat=2):
for initial in (0, 15, -15, -1000000.0, +1000000.0):
with self.subTest(parent=parent, child=child, initial=initial):
... | ChainPrimitives | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ChainPrimitives:
def test_pair(self):
"""Push single link chain as `parent >> child`"""
<|body_0|>
def test_multi(self):
"""Push multi link chain as `a >> b >> c >> ...`"""
<|body_1|>
def test_fork(self):
"""Push fork link chain as `a >> (b, c)`"... | stack_v2_sparse_classes_36k_train_011950 | 2,343 | permissive | [
{
"docstring": "Push single link chain as `parent >> child`",
"name": "test_pair",
"signature": "def test_pair(self)"
},
{
"docstring": "Push multi link chain as `a >> b >> c >> ...`",
"name": "test_multi",
"signature": "def test_multi(self)"
},
{
"docstring": "Push fork link cha... | 4 | stack_v2_sparse_classes_30k_train_005352 | Implement the Python class `ChainPrimitives` described below.
Class description:
Implement the ChainPrimitives class.
Method signatures and docstrings:
- def test_pair(self): Push single link chain as `parent >> child`
- def test_multi(self): Push multi link chain as `a >> b >> c >> ...`
- def test_fork(self): Push f... | Implement the Python class `ChainPrimitives` described below.
Class description:
Implement the ChainPrimitives class.
Method signatures and docstrings:
- def test_pair(self): Push single link chain as `parent >> child`
- def test_multi(self): Push multi link chain as `a >> b >> c >> ...`
- def test_fork(self): Push f... | 4e17f9992b4780bd0d9309202e2847df640bffe8 | <|skeleton|>
class ChainPrimitives:
def test_pair(self):
"""Push single link chain as `parent >> child`"""
<|body_0|>
def test_multi(self):
"""Push multi link chain as `a >> b >> c >> ...`"""
<|body_1|>
def test_fork(self):
"""Push fork link chain as `a >> (b, c)`"... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ChainPrimitives:
def test_pair(self):
"""Push single link chain as `parent >> child`"""
elements = [Adder(val) for val in (0, -2, 2, 1000000.0, -1000000.0)]
for parent, child in itertools.product(elements, repeat=2):
for initial in (0, 15, -15, -1000000.0, +1000000.0):
... | the_stack_v2_python_sparse | chainlet_unittests/test_dataflow/test_primitives.py | maxfischer2781/chainlet | train | 1 | |
267694fc073f935a37bfc4dfaa0fb06a3c297191 | [
"participant = self.request.user\nkw = super(ItemPreCreateView, self).get_form_kwargs()\nif participant.staffjournalist:\n kw.update({'entity_owner': participant.staffjournalist.newsorganization})\n kw.update({'participant_owner': self.request.user})\nelif participant.unaffiliatedstaffjournalist:\n kw.upda... | <|body_start_0|>
participant = self.request.user
kw = super(ItemPreCreateView, self).get_form_kwargs()
if participant.staffjournalist:
kw.update({'entity_owner': participant.staffjournalist.newsorganization})
kw.update({'participant_owner': self.request.user})
eli... | First step in creating an item. | ItemPreCreateView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ItemPreCreateView:
"""First step in creating an item."""
def get_form_kwargs(self):
"""Pass existing/future entity_owner to the form."""
<|body_0|>
def form_valid(self, form):
"""Redirect to real item-creation form."""
<|body_1|>
<|end_skeleton|>
<|body... | stack_v2_sparse_classes_36k_train_011951 | 7,119 | no_license | [
{
"docstring": "Pass existing/future entity_owner to the form.",
"name": "get_form_kwargs",
"signature": "def get_form_kwargs(self)"
},
{
"docstring": "Redirect to real item-creation form.",
"name": "form_valid",
"signature": "def form_valid(self, form)"
}
] | 2 | stack_v2_sparse_classes_30k_train_013204 | Implement the Python class `ItemPreCreateView` described below.
Class description:
First step in creating an item.
Method signatures and docstrings:
- def get_form_kwargs(self): Pass existing/future entity_owner to the form.
- def form_valid(self, form): Redirect to real item-creation form. | Implement the Python class `ItemPreCreateView` described below.
Class description:
First step in creating an item.
Method signatures and docstrings:
- def get_form_kwargs(self): Pass existing/future entity_owner to the form.
- def form_valid(self, form): Redirect to real item-creation form.
<|skeleton|>
class ItemPr... | d748e6f85907fa50d1d88ee003999c3d875b812b | <|skeleton|>
class ItemPreCreateView:
"""First step in creating an item."""
def get_form_kwargs(self):
"""Pass existing/future entity_owner to the form."""
<|body_0|>
def form_valid(self, form):
"""Redirect to real item-creation form."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ItemPreCreateView:
"""First step in creating an item."""
def get_form_kwargs(self):
"""Pass existing/future entity_owner to the form."""
participant = self.request.user
kw = super(ItemPreCreateView, self).get_form_kwargs()
if participant.staffjournalist:
kw.upd... | the_stack_v2_python_sparse | facet/editorial/views/item.py | ProjectFacet/multifacet | train | 3 |
21f3114859b4995123df086e32f8788e5f3284c2 | [
"CommandScaffold.parser(parser)\noutput(parser)\ncommands(parser)\nconfig(parser)",
"self.nr = self._inventory()\nif self.args.config:\n results = self.nr.run(task=netmiko_send_config, commands=self.args.commands, name='SSH CONFIG EXECUTION', num_workers=self.args.workers, dry_run=self.args.X, severity_level=s... | <|body_start_0|>
CommandScaffold.parser(parser)
output(parser)
commands(parser)
config(parser)
<|end_body_0|>
<|body_start_1|>
self.nr = self._inventory()
if self.args.config:
results = self.nr.run(task=netmiko_send_config, commands=self.args.commands, name='... | cli command to execute show and config commands via SSH | Ssh | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Ssh:
"""cli command to execute show and config commands via SSH"""
def parser(parser):
"""cli command parser"""
<|body_0|>
def run(self):
"""cli command execution"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
CommandScaffold.parser(parser)
... | stack_v2_sparse_classes_36k_train_011952 | 1,756 | permissive | [
{
"docstring": "cli command parser",
"name": "parser",
"signature": "def parser(parser)"
},
{
"docstring": "cli command execution",
"name": "run",
"signature": "def run(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_013597 | Implement the Python class `Ssh` described below.
Class description:
cli command to execute show and config commands via SSH
Method signatures and docstrings:
- def parser(parser): cli command parser
- def run(self): cli command execution | Implement the Python class `Ssh` described below.
Class description:
cli command to execute show and config commands via SSH
Method signatures and docstrings:
- def parser(parser): cli command parser
- def run(self): cli command execution
<|skeleton|>
class Ssh:
"""cli command to execute show and config commands... | 9d2c3467cf558895af16cd2450198d51f8c4a3d4 | <|skeleton|>
class Ssh:
"""cli command to execute show and config commands via SSH"""
def parser(parser):
"""cli command parser"""
<|body_0|>
def run(self):
"""cli command execution"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Ssh:
"""cli command to execute show and config commands via SSH"""
def parser(parser):
"""cli command parser"""
CommandScaffold.parser(parser)
output(parser)
commands(parser)
config(parser)
def run(self):
"""cli command execution"""
self.nr = s... | the_stack_v2_python_sparse | netnir/core/tasks/ssh.py | netdevops/netnir | train | 0 |
a3633ef3fbf5e46080be99ad9500212f7a4c5005 | [
"super(SysFSHygrometer, self).__init__(device)\ncandidates = self._device.Glob(rh_filename_pattern)\nassert len(candidates) == 1, 'Not having exactly one candidate.'\nself._rh_filename = candidates[0]\nself._rh_map = rh_map",
"try:\n return self._rh_map(self._device.ReadFile(self._rh_filename))\nexcept Excepti... | <|body_start_0|>
super(SysFSHygrometer, self).__init__(device)
candidates = self._device.Glob(rh_filename_pattern)
assert len(candidates) == 1, 'Not having exactly one candidate.'
self._rh_filename = candidates[0]
self._rh_map = rh_map
<|end_body_0|>
<|body_start_1|>
try... | System module for hygrometers. Implementation for systems which able to read humidities with sysfs api. | SysFSHygrometer | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SysFSHygrometer:
"""System module for hygrometers. Implementation for systems which able to read humidities with sysfs api."""
def __init__(self, device, rh_filename_pattern, rh_map=float):
"""Constructor. Args: device: Instance of cros.factory.device.device_types.DeviceInterface. rh... | stack_v2_sparse_classes_36k_train_011953 | 1,605 | permissive | [
{
"docstring": "Constructor. Args: device: Instance of cros.factory.device.device_types.DeviceInterface. rh_filename_pattern: The glob pattern to find the file containing relative humidity information. rh_map: A function (str -> float) that translates the content of file indicated by \"rh_filename_pattern\" to ... | 2 | null | Implement the Python class `SysFSHygrometer` described below.
Class description:
System module for hygrometers. Implementation for systems which able to read humidities with sysfs api.
Method signatures and docstrings:
- def __init__(self, device, rh_filename_pattern, rh_map=float): Constructor. Args: device: Instanc... | Implement the Python class `SysFSHygrometer` described below.
Class description:
System module for hygrometers. Implementation for systems which able to read humidities with sysfs api.
Method signatures and docstrings:
- def __init__(self, device, rh_filename_pattern, rh_map=float): Constructor. Args: device: Instanc... | a1b0fccd68987d8cd9c89710adc3c04b868347ec | <|skeleton|>
class SysFSHygrometer:
"""System module for hygrometers. Implementation for systems which able to read humidities with sysfs api."""
def __init__(self, device, rh_filename_pattern, rh_map=float):
"""Constructor. Args: device: Instance of cros.factory.device.device_types.DeviceInterface. rh... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SysFSHygrometer:
"""System module for hygrometers. Implementation for systems which able to read humidities with sysfs api."""
def __init__(self, device, rh_filename_pattern, rh_map=float):
"""Constructor. Args: device: Instance of cros.factory.device.device_types.DeviceInterface. rh_filename_pat... | the_stack_v2_python_sparse | py/device/hygrometer.py | bridder/factory | train | 0 |
bd0f1abfcf830758fb58ba5e12d93d44f79d7085 | [
"super(Encoder, self).__init__()\nself.layers = clones(layer, N)\nself.norm = LayerNorm(layer.size)\nself.position = position",
"if self.position:\n x = self.position(x, mask, indices)\nmask = mask.unsqueeze(-2)\nfor layer in self.layers:\n x = layer(x, mask)\nreturn self.norm(x)"
] | <|body_start_0|>
super(Encoder, self).__init__()
self.layers = clones(layer, N)
self.norm = LayerNorm(layer.size)
self.position = position
<|end_body_0|>
<|body_start_1|>
if self.position:
x = self.position(x, mask, indices)
mask = mask.unsqueeze(-2)
... | Stack of Transformer encoder blocks with positional encoding. | Encoder | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Encoder:
"""Stack of Transformer encoder blocks with positional encoding."""
def __init__(self, layer, N, position):
""":param layer: single building block to clone :param N: number of copies :param position: positional encoding module"""
<|body_0|>
def forward(self, x, ... | stack_v2_sparse_classes_36k_train_011954 | 21,238 | no_license | [
{
"docstring": ":param layer: single building block to clone :param N: number of copies :param position: positional encoding module",
"name": "__init__",
"signature": "def __init__(self, layer, N, position)"
},
{
"docstring": "Forward pass through each block of the Transformer. :param x: input o... | 2 | stack_v2_sparse_classes_30k_train_001703 | Implement the Python class `Encoder` described below.
Class description:
Stack of Transformer encoder blocks with positional encoding.
Method signatures and docstrings:
- def __init__(self, layer, N, position): :param layer: single building block to clone :param N: number of copies :param position: positional encodin... | Implement the Python class `Encoder` described below.
Class description:
Stack of Transformer encoder blocks with positional encoding.
Method signatures and docstrings:
- def __init__(self, layer, N, position): :param layer: single building block to clone :param N: number of copies :param position: positional encodin... | 7e55a422588c1d1e00f35a3d3a3ff896cce59e18 | <|skeleton|>
class Encoder:
"""Stack of Transformer encoder blocks with positional encoding."""
def __init__(self, layer, N, position):
""":param layer: single building block to clone :param N: number of copies :param position: positional encoding module"""
<|body_0|>
def forward(self, x, ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Encoder:
"""Stack of Transformer encoder blocks with positional encoding."""
def __init__(self, layer, N, position):
""":param layer: single building block to clone :param N: number of copies :param position: positional encoding module"""
super(Encoder, self).__init__()
self.layer... | the_stack_v2_python_sparse | generated/test_allegro_allRank.py | jansel/pytorch-jit-paritybench | train | 35 |
395894b682ece2b60e052c6f592624dfa651517f | [
"super().__init__(pool_size=pool_size)\nself.min_neg = min_neg\nself.batch_size_per_image = batch_size_per_image\nself.positive_fraction = positive_fraction",
"anchors_per_image = [anchors_in_image.shape[0] for anchors_in_image in target_labels]\nfg_probs = fg_probs.split(anchors_per_image, 0)\npos_idx = []\nneg_... | <|body_start_0|>
super().__init__(pool_size=pool_size)
self.min_neg = min_neg
self.batch_size_per_image = batch_size_per_image
self.positive_fraction = positive_fraction
<|end_body_0|>
<|body_start_1|>
anchors_per_image = [anchors_in_image.shape[0] for anchors_in_image in target... | HardNegativeSampler | [
"BSD-3-Clause",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HardNegativeSampler:
def __init__(self, batch_size_per_image: int, positive_fraction: float, min_neg: int=0, pool_size: float=10):
"""Created a pool from the highest scoring false positives and sample defined number of negatives from it Args: batch_size_per_image (int): number of element... | stack_v2_sparse_classes_36k_train_011955 | 13,985 | permissive | [
{
"docstring": "Created a pool from the highest scoring false positives and sample defined number of negatives from it Args: batch_size_per_image (int): number of elements to be selected per image positive_fraction (float): percentage of positive elements per batch pool_size (float): hard negatives are sampled ... | 5 | stack_v2_sparse_classes_30k_train_020604 | Implement the Python class `HardNegativeSampler` described below.
Class description:
Implement the HardNegativeSampler class.
Method signatures and docstrings:
- def __init__(self, batch_size_per_image: int, positive_fraction: float, min_neg: int=0, pool_size: float=10): Created a pool from the highest scoring false ... | Implement the Python class `HardNegativeSampler` described below.
Class description:
Implement the HardNegativeSampler class.
Method signatures and docstrings:
- def __init__(self, batch_size_per_image: int, positive_fraction: float, min_neg: int=0, pool_size: float=10): Created a pool from the highest scoring false ... | 4f41faa7536dcef8fca7b647dcdca25360e5b58a | <|skeleton|>
class HardNegativeSampler:
def __init__(self, batch_size_per_image: int, positive_fraction: float, min_neg: int=0, pool_size: float=10):
"""Created a pool from the highest scoring false positives and sample defined number of negatives from it Args: batch_size_per_image (int): number of element... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class HardNegativeSampler:
def __init__(self, batch_size_per_image: int, positive_fraction: float, min_neg: int=0, pool_size: float=10):
"""Created a pool from the highest scoring false positives and sample defined number of negatives from it Args: batch_size_per_image (int): number of elements to be select... | the_stack_v2_python_sparse | nndet/core/boxes/sampler.py | dboun/nnDetection | train | 1 | |
98a0e702cc5df157fd32d387767acc8b2f588187 | [
"super(NRIModel, self).__init__()\nself.enc = AttENC(dim, n_hid, edge_type, do_prob)\nself.dec = RNNDEC(dim, edge_type, n_hid, n_hid, n_hid, do_prob, skip_first)\nself.gumbel_softmax = GumbelSoftmax()\nself.es = Tensor(es, dtype=ms.int32)\nself.size = size",
"logits = self.enc(states_enc, self.es)\nedges = self.g... | <|body_start_0|>
super(NRIModel, self).__init__()
self.enc = AttENC(dim, n_hid, edge_type, do_prob)
self.dec = RNNDEC(dim, edge_type, n_hid, n_hid, n_hid, do_prob, skip_first)
self.gumbel_softmax = GumbelSoftmax()
self.es = Tensor(es, dtype=ms.int32)
self.size = size
<|en... | Auto-encoder. | NRIModel | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-proprietary-license"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NRIModel:
"""Auto-encoder."""
def __init__(self, dim, n_hid, edge_type, do_prob, skip_first, size, es):
"""Parameters ---------- encoder : nn.Cell an encoder inferring relations. decoder : nn.Cell an decoder predicting future states. es : Tensor edge list. size : int number of nodes.... | stack_v2_sparse_classes_36k_train_011956 | 12,491 | permissive | [
{
"docstring": "Parameters ---------- encoder : nn.Cell an encoder inferring relations. decoder : nn.Cell an decoder predicting future states. es : Tensor edge list. size : int number of nodes.",
"name": "__init__",
"signature": "def __init__(self, dim, n_hid, edge_type, do_prob, skip_first, size, es)"
... | 2 | stack_v2_sparse_classes_30k_train_014111 | Implement the Python class `NRIModel` described below.
Class description:
Auto-encoder.
Method signatures and docstrings:
- def __init__(self, dim, n_hid, edge_type, do_prob, skip_first, size, es): Parameters ---------- encoder : nn.Cell an encoder inferring relations. decoder : nn.Cell an decoder predicting future s... | Implement the Python class `NRIModel` described below.
Class description:
Auto-encoder.
Method signatures and docstrings:
- def __init__(self, dim, n_hid, edge_type, do_prob, skip_first, size, es): Parameters ---------- encoder : nn.Cell an encoder inferring relations. decoder : nn.Cell an decoder predicting future s... | eab643f51336dbf7d711f02d27e6516e5affee59 | <|skeleton|>
class NRIModel:
"""Auto-encoder."""
def __init__(self, dim, n_hid, edge_type, do_prob, skip_first, size, es):
"""Parameters ---------- encoder : nn.Cell an encoder inferring relations. decoder : nn.Cell an decoder predicting future states. es : Tensor edge list. size : int number of nodes.... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NRIModel:
"""Auto-encoder."""
def __init__(self, dim, n_hid, edge_type, do_prob, skip_first, size, es):
"""Parameters ---------- encoder : nn.Cell an encoder inferring relations. decoder : nn.Cell an decoder predicting future states. es : Tensor edge list. size : int number of nodes."""
s... | the_stack_v2_python_sparse | research/gnn/nri-mpm/models/nri.py | mindspore-ai/models | train | 301 |
b63437234bca25f577fd20bbeb8fac3c003de996 | [
"super(NewtonFool, self).__init__(classifier)\nif not isinstance(classifier, ClassifierGradients):\n raise TypeError('For `' + self.__class__.__name__ + '` classifier must be an instance of `art.classifiers.classifier.ClassifierGradients`, the provided classifier is instance of ' + str(classifier.__class__.__bas... | <|body_start_0|>
super(NewtonFool, self).__init__(classifier)
if not isinstance(classifier, ClassifierGradients):
raise TypeError('For `' + self.__class__.__name__ + '` classifier must be an instance of `art.classifiers.classifier.ClassifierGradients`, the provided classifier is instance of ... | Implementation of the attack from Uyeong Jang et al. (2017). | Paper link: http://doi.acm.org/10.1145/3134600.3134635 | NewtonFool | [
"MIT",
"LicenseRef-scancode-dco-1.1"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NewtonFool:
"""Implementation of the attack from Uyeong Jang et al. (2017). | Paper link: http://doi.acm.org/10.1145/3134600.3134635"""
def __init__(self, classifier, max_iter=100, eta=0.01, batch_size=1):
"""Create a NewtonFool attack instance. :param classifier: A trained classifie... | stack_v2_sparse_classes_36k_train_011957 | 7,977 | permissive | [
{
"docstring": "Create a NewtonFool attack instance. :param classifier: A trained classifier. :type classifier: :class:`.Classifier` :param max_iter: The maximum number of iterations. :type max_iter: `int` :param eta: The eta coefficient. :type eta: `float` :param batch_size: Size of the batch on which adversar... | 5 | null | Implement the Python class `NewtonFool` described below.
Class description:
Implementation of the attack from Uyeong Jang et al. (2017). | Paper link: http://doi.acm.org/10.1145/3134600.3134635
Method signatures and docstrings:
- def __init__(self, classifier, max_iter=100, eta=0.01, batch_size=1): Create a NewtonFoo... | Implement the Python class `NewtonFool` described below.
Class description:
Implementation of the attack from Uyeong Jang et al. (2017). | Paper link: http://doi.acm.org/10.1145/3134600.3134635
Method signatures and docstrings:
- def __init__(self, classifier, max_iter=100, eta=0.01, batch_size=1): Create a NewtonFoo... | cc44830cba2d4260d1bfafe1c822aee4246e0d36 | <|skeleton|>
class NewtonFool:
"""Implementation of the attack from Uyeong Jang et al. (2017). | Paper link: http://doi.acm.org/10.1145/3134600.3134635"""
def __init__(self, classifier, max_iter=100, eta=0.01, batch_size=1):
"""Create a NewtonFool attack instance. :param classifier: A trained classifie... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NewtonFool:
"""Implementation of the attack from Uyeong Jang et al. (2017). | Paper link: http://doi.acm.org/10.1145/3134600.3134635"""
def __init__(self, classifier, max_iter=100, eta=0.01, batch_size=1):
"""Create a NewtonFool attack instance. :param classifier: A trained classifier. :type clas... | the_stack_v2_python_sparse | art/attacks/newtonfool.py | rish-16/adversarial-robustness-toolbox | train | 2 |
5e04525f370d1bbd7e88900c1acd10e1bbe4a620 | [
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')"
] | <|body_start_0|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
<|end_body_0|>
<|body_start_1|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not im... | Missing associated documentation comment in .proto file | IMPALAServicer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IMPALAServicer:
"""Missing associated documentation comment in .proto file"""
def get_trajectory(self, request, context):
"""Missing associated documentation comment in .proto file"""
<|body_0|>
def send_parameter(self, request, context):
"""Missing associated do... | stack_v2_sparse_classes_36k_train_011958 | 3,799 | no_license | [
{
"docstring": "Missing associated documentation comment in .proto file",
"name": "get_trajectory",
"signature": "def get_trajectory(self, request, context)"
},
{
"docstring": "Missing associated documentation comment in .proto file",
"name": "send_parameter",
"signature": "def send_para... | 2 | stack_v2_sparse_classes_30k_train_013338 | Implement the Python class `IMPALAServicer` described below.
Class description:
Missing associated documentation comment in .proto file
Method signatures and docstrings:
- def get_trajectory(self, request, context): Missing associated documentation comment in .proto file
- def send_parameter(self, request, context): ... | Implement the Python class `IMPALAServicer` described below.
Class description:
Missing associated documentation comment in .proto file
Method signatures and docstrings:
- def get_trajectory(self, request, context): Missing associated documentation comment in .proto file
- def send_parameter(self, request, context): ... | e5b4dc1647f14dd1d2b9818e8a57bb33c44be62b | <|skeleton|>
class IMPALAServicer:
"""Missing associated documentation comment in .proto file"""
def get_trajectory(self, request, context):
"""Missing associated documentation comment in .proto file"""
<|body_0|>
def send_parameter(self, request, context):
"""Missing associated do... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class IMPALAServicer:
"""Missing associated documentation comment in .proto file"""
def get_trajectory(self, request, context):
"""Missing associated documentation comment in .proto file"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
... | the_stack_v2_python_sparse | impala_pb2_grpc.py | deligentfool/IMPALA_pytorch | train | 2 |
1301d87eae0c3303727368d6a72f7c1e45c4d187 | [
"print(nums, target)\nindex = [x[0] for x in sorted(enumerate(nums), key=lambda x: x[1])]\nprint('index:', index)\nfor i in index:\n print(nums[i], end=',')\nprint()\nn1 = 0\nn2 = len(index) - 1\nwhile n2 > n1:\n print(nums[index[n1]], nums[index[n2]])\n sum = nums[index[n1]] + nums[index[n2]]\n if sum ... | <|body_start_0|>
print(nums, target)
index = [x[0] for x in sorted(enumerate(nums), key=lambda x: x[1])]
print('index:', index)
for i in index:
print(nums[i], end=',')
print()
n1 = 0
n2 = len(index) - 1
while n2 > n1:
print(nums[ind... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def twoSum(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int]"""
<|body_0|>
def twoSumHash(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int]"""
<|body_1|>
<|end_skeleton|>
<|body_start... | stack_v2_sparse_classes_36k_train_011959 | 1,988 | no_license | [
{
"docstring": ":type nums: List[int] :type target: int :rtype: List[int]",
"name": "twoSum",
"signature": "def twoSum(self, nums, target)"
},
{
"docstring": ":type nums: List[int] :type target: int :rtype: List[int]",
"name": "twoSumHash",
"signature": "def twoSumHash(self, nums, target... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def twoSum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int]
- def twoSumHash(self, nums, target): :type nums: List[int] :type target: int :rtype: Li... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def twoSum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int]
- def twoSumHash(self, nums, target): :type nums: List[int] :type target: int :rtype: Li... | 9a7bc5e8b1c2d7de6ab3a7274c1f5b7597f08333 | <|skeleton|>
class Solution:
def twoSum(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int]"""
<|body_0|>
def twoSumHash(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 twoSum(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int]"""
print(nums, target)
index = [x[0] for x in sorted(enumerate(nums), key=lambda x: x[1])]
print('index:', index)
for i in index:
print(nums[i], end=',')
... | the_stack_v2_python_sparse | python/TwoSum.py | zatserkl/learn | train | 1 | |
7025fc7a0d15ededfffab6e641b3d3521d849942 | [
"StochasticSolver.__init__(self, **kwargs)\nself.spec['momentum'] = self.spec.get('momentum', 0)\nself.spec['asgd'] = self.spec.get('asgd', False)\nself.spec['asgd_skip'] = self.spec.get('asgd_skip', 1)\nself.spec['power'] = self.spec.get('power', 1)\nself.spec['max_lr'] = self.spec.get('max_lr', float('inf'))\nsel... | <|body_start_0|>
StochasticSolver.__init__(self, **kwargs)
self.spec['momentum'] = self.spec.get('momentum', 0)
self.spec['asgd'] = self.spec.get('asgd', False)
self.spec['asgd_skip'] = self.spec.get('asgd_skip', 1)
self.spec['power'] = self.spec.get('power', 1)
self.spec... | The SGD solver. | SGDSolver | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SGDSolver:
"""The SGD solver."""
def __init__(self, **kwargs):
"""Initializes the SGD solver. kwargs: base_lr: the base learning rate. max_iter: the maximum number of iterations. Default 1000. lr_policy: the learning rate policy. could be: 'fixed': rate will always be base_lr. 'exp':... | stack_v2_sparse_classes_36k_train_011960 | 13,002 | no_license | [
{
"docstring": "Initializes the SGD solver. kwargs: base_lr: the base learning rate. max_iter: the maximum number of iterations. Default 1000. lr_policy: the learning rate policy. could be: 'fixed': rate will always be base_lr. 'exp': exponent decay - rate will be base_lr * (gamma ^ t) 'inv': rate will be base_... | 6 | stack_v2_sparse_classes_30k_train_020876 | Implement the Python class `SGDSolver` described below.
Class description:
The SGD solver.
Method signatures and docstrings:
- def __init__(self, **kwargs): Initializes the SGD solver. kwargs: base_lr: the base learning rate. max_iter: the maximum number of iterations. Default 1000. lr_policy: the learning rate polic... | Implement the Python class `SGDSolver` described below.
Class description:
The SGD solver.
Method signatures and docstrings:
- def __init__(self, **kwargs): Initializes the SGD solver. kwargs: base_lr: the base learning rate. max_iter: the maximum number of iterations. Default 1000. lr_policy: the learning rate polic... | 6fa4cdfbd0d0b8d486d7146bf1e32edd3662fec4 | <|skeleton|>
class SGDSolver:
"""The SGD solver."""
def __init__(self, **kwargs):
"""Initializes the SGD solver. kwargs: base_lr: the base learning rate. max_iter: the maximum number of iterations. Default 1000. lr_policy: the learning rate policy. could be: 'fixed': rate will always be base_lr. 'exp':... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SGDSolver:
"""The SGD solver."""
def __init__(self, **kwargs):
"""Initializes the SGD solver. kwargs: base_lr: the base learning rate. max_iter: the maximum number of iterations. Default 1000. lr_policy: the learning rate policy. could be: 'fixed': rate will always be base_lr. 'exp': exponent dec... | the_stack_v2_python_sparse | decaf/opt/stochastic_solver.py | UCBAIR/decaf-release | train | 62 |
a8b901effd6b802e80959fc12ed71be79a91520a | [
"expiring = parsed_args['expiring']\nif expiring:\n expiration = app.config.get('APP_SPECIFIC_TOKEN_EXPIRATION')\n token_expiration = convert_to_timedelta(expiration or _DEFAULT_TOKEN_EXPIRATION_WINDOW)\n seconds = math.ceil(token_expiration.total_seconds() * 0.1) or 1\n soon = timedelta(seconds=seconds... | <|body_start_0|>
expiring = parsed_args['expiring']
if expiring:
expiration = app.config.get('APP_SPECIFIC_TOKEN_EXPIRATION')
token_expiration = convert_to_timedelta(expiration or _DEFAULT_TOKEN_EXPIRATION_WINDOW)
seconds = math.ceil(token_expiration.total_seconds() *... | Lists all app specific tokens for a user. | AppTokens | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AppTokens:
"""Lists all app specific tokens for a user."""
def get(self, parsed_args):
"""Lists the app specific tokens for the user."""
<|body_0|>
def post(self):
"""Create a new app specific token for user."""
<|body_1|>
<|end_skeleton|>
<|body_start_... | stack_v2_sparse_classes_36k_train_011961 | 4,648 | permissive | [
{
"docstring": "Lists the app specific tokens for the user.",
"name": "get",
"signature": "def get(self, parsed_args)"
},
{
"docstring": "Create a new app specific token for user.",
"name": "post",
"signature": "def post(self)"
}
] | 2 | stack_v2_sparse_classes_30k_test_000177 | Implement the Python class `AppTokens` described below.
Class description:
Lists all app specific tokens for a user.
Method signatures and docstrings:
- def get(self, parsed_args): Lists the app specific tokens for the user.
- def post(self): Create a new app specific token for user. | Implement the Python class `AppTokens` described below.
Class description:
Lists all app specific tokens for a user.
Method signatures and docstrings:
- def get(self, parsed_args): Lists the app specific tokens for the user.
- def post(self): Create a new app specific token for user.
<|skeleton|>
class AppTokens:
... | e400a0c22c5f89dd35d571654b13d262b1f6e3b3 | <|skeleton|>
class AppTokens:
"""Lists all app specific tokens for a user."""
def get(self, parsed_args):
"""Lists the app specific tokens for the user."""
<|body_0|>
def post(self):
"""Create a new app specific token for user."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AppTokens:
"""Lists all app specific tokens for a user."""
def get(self, parsed_args):
"""Lists the app specific tokens for the user."""
expiring = parsed_args['expiring']
if expiring:
expiration = app.config.get('APP_SPECIFIC_TOKEN_EXPIRATION')
token_expir... | the_stack_v2_python_sparse | endpoints/api/appspecifictokens.py | quay/quay | train | 2,363 |
a5428b1a799611dac61e81dbc7ee2f8a16a80f57 | [
"try:\n params = self.request.query_params\n for key in ['part_detail', 'location_detail', 'stock_detail', 'build_detail']:\n if key in params:\n kwargs[key] = str2bool(params.get(key, False))\nexcept AttributeError:\n pass\nreturn self.serializer_class(*args, **kwargs)",
"queryset = Bu... | <|body_start_0|>
try:
params = self.request.query_params
for key in ['part_detail', 'location_detail', 'stock_detail', 'build_detail']:
if key in params:
kwargs[key] = str2bool(params.get(key, False))
except AttributeError:
pass
... | API endpoint for accessing a list of BuildItem objects. - GET: Return list of objects - POST: Create a new BuildItem object | BuildItemList | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BuildItemList:
"""API endpoint for accessing a list of BuildItem objects. - GET: Return list of objects - POST: Create a new BuildItem object"""
def get_serializer(self, *args, **kwargs):
"""Returns a BuildItemSerializer instance based on the request."""
<|body_0|>
def g... | stack_v2_sparse_classes_36k_train_011962 | 20,912 | permissive | [
{
"docstring": "Returns a BuildItemSerializer instance based on the request.",
"name": "get_serializer",
"signature": "def get_serializer(self, *args, **kwargs)"
},
{
"docstring": "Override the queryset method, to allow filtering by stock_item.part.",
"name": "get_queryset",
"signature":... | 3 | stack_v2_sparse_classes_30k_train_007134 | Implement the Python class `BuildItemList` described below.
Class description:
API endpoint for accessing a list of BuildItem objects. - GET: Return list of objects - POST: Create a new BuildItem object
Method signatures and docstrings:
- def get_serializer(self, *args, **kwargs): Returns a BuildItemSerializer instan... | Implement the Python class `BuildItemList` described below.
Class description:
API endpoint for accessing a list of BuildItem objects. - GET: Return list of objects - POST: Create a new BuildItem object
Method signatures and docstrings:
- def get_serializer(self, *args, **kwargs): Returns a BuildItemSerializer instan... | e88a8e99a5f0b201c67a95cba097c729f090d5e2 | <|skeleton|>
class BuildItemList:
"""API endpoint for accessing a list of BuildItem objects. - GET: Return list of objects - POST: Create a new BuildItem object"""
def get_serializer(self, *args, **kwargs):
"""Returns a BuildItemSerializer instance based on the request."""
<|body_0|>
def g... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BuildItemList:
"""API endpoint for accessing a list of BuildItem objects. - GET: Return list of objects - POST: Create a new BuildItem object"""
def get_serializer(self, *args, **kwargs):
"""Returns a BuildItemSerializer instance based on the request."""
try:
params = self.req... | the_stack_v2_python_sparse | InvenTree/build/api.py | inventree/InvenTree | train | 3,077 |
69d9af0dbd5157592a436235ae3a2c0675cc1202 | [
"self.hparam_names = hparam_names\nself.initial_hparams = initial_hparams\nself.sample_hparams = sample_hparam_mapping\nself.eps = eps\nCoroutineTuningAlgorithm.__init__(self, self._coroutine())",
"def key_for_hparams(hparams):\n return tuple(sorted(six.iteritems(hparams)))\nhparams_to_point = {}\nfor hparams ... | <|body_start_0|>
self.hparam_names = hparam_names
self.initial_hparams = initial_hparams
self.sample_hparams = sample_hparam_mapping
self.eps = eps
CoroutineTuningAlgorithm.__init__(self, self._coroutine())
<|end_body_0|>
<|body_start_1|>
def key_for_hparams(hparams):
... | The TuneReg algorithm defined in section 3 of paper. | TuneReg | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TuneReg:
"""The TuneReg algorithm defined in section 3 of paper."""
def __init__(self, hparam_names, initial_hparams, sample_hparam_mapping, eps=1e-06):
"""Initializer. Args: hparam_names: sequence of hyperparameter names initial_hparams: iterable of initial hyperparameter settings t... | stack_v2_sparse_classes_36k_train_011963 | 5,450 | permissive | [
{
"docstring": "Initializer. Args: hparam_names: sequence of hyperparameter names initial_hparams: iterable of initial hyperparameter settings to try first, before solving LP sample_hparam_mapping: a callable that returns a randoml-sampled ParameterMapping eps: if a hyperparameter vector obtained by solving the... | 2 | null | Implement the Python class `TuneReg` described below.
Class description:
The TuneReg algorithm defined in section 3 of paper.
Method signatures and docstrings:
- def __init__(self, hparam_names, initial_hparams, sample_hparam_mapping, eps=1e-06): Initializer. Args: hparam_names: sequence of hyperparameter names initi... | Implement the Python class `TuneReg` described below.
Class description:
The TuneReg algorithm defined in section 3 of paper.
Method signatures and docstrings:
- def __init__(self, hparam_names, initial_hparams, sample_hparam_mapping, eps=1e-06): Initializer. Args: hparam_names: sequence of hyperparameter names initi... | dea327aa9e7ef7f7bca5a6c225dbdca1077a06e9 | <|skeleton|>
class TuneReg:
"""The TuneReg algorithm defined in section 3 of paper."""
def __init__(self, hparam_names, initial_hparams, sample_hparam_mapping, eps=1e-06):
"""Initializer. Args: hparam_names: sequence of hyperparameter names initial_hparams: iterable of initial hyperparameter settings t... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TuneReg:
"""The TuneReg algorithm defined in section 3 of paper."""
def __init__(self, hparam_names, initial_hparams, sample_hparam_mapping, eps=1e-06):
"""Initializer. Args: hparam_names: sequence of hyperparameter names initial_hparams: iterable of initial hyperparameter settings to try first, ... | the_stack_v2_python_sparse | learnreg/tuning_algorithms.py | Tarkiyah/googleResearch | train | 11 |
12e84cf753dbfd1107f1b67e9d6a8326fd3e054b | [
"file_name = base_name + '.hdf5'\noutput_path = output_directory + '/' + file_name\nphdLogger.info('hdf5 format: Writting %s' % file_name)\nwith h5py.File(output_path, 'w') as f:\n f.attrs['dt'] = integrator.dt\n f.attrs['time'] = integrator.time\n f.attrs['iteration'] = integrator.iteration\n particle_... | <|body_start_0|>
file_name = base_name + '.hdf5'
output_path = output_directory + '/' + file_name
phdLogger.info('hdf5 format: Writting %s' % file_name)
with h5py.File(output_path, 'w') as f:
f.attrs['dt'] = integrator.dt
f.attrs['time'] = integrator.time
... | Hdf5 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Hdf5:
def write(self, base_name, output_directory, integrator):
"""Write simulation data to hdf5 file."""
<|body_0|>
def read(self, file_name):
"""Read hdf5 file of particles."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
file_name = base_name + '... | stack_v2_sparse_classes_36k_train_011964 | 3,485 | no_license | [
{
"docstring": "Write simulation data to hdf5 file.",
"name": "write",
"signature": "def write(self, base_name, output_directory, integrator)"
},
{
"docstring": "Read hdf5 file of particles.",
"name": "read",
"signature": "def read(self, file_name)"
}
] | 2 | stack_v2_sparse_classes_30k_train_011988 | Implement the Python class `Hdf5` described below.
Class description:
Implement the Hdf5 class.
Method signatures and docstrings:
- def write(self, base_name, output_directory, integrator): Write simulation data to hdf5 file.
- def read(self, file_name): Read hdf5 file of particles. | Implement the Python class `Hdf5` described below.
Class description:
Implement the Hdf5 class.
Method signatures and docstrings:
- def write(self, base_name, output_directory, integrator): Write simulation data to hdf5 file.
- def read(self, file_name): Read hdf5 file of particles.
<|skeleton|>
class Hdf5:
def... | 513b292ac721284cfd9018d53d78cb17772b7f07 | <|skeleton|>
class Hdf5:
def write(self, base_name, output_directory, integrator):
"""Write simulation data to hdf5 file."""
<|body_0|>
def read(self, file_name):
"""Read hdf5 file of particles."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Hdf5:
def write(self, base_name, output_directory, integrator):
"""Write simulation data to hdf5 file."""
file_name = base_name + '.hdf5'
output_path = output_directory + '/' + file_name
phdLogger.info('hdf5 format: Writting %s' % file_name)
with h5py.File(output_path, ... | the_stack_v2_python_sparse | phd/io/read_write.py.bak | phd-code/phd-code.github.io | train | 0 | |
5edf75a4705040f77fac838cd8564104449a2e35 | [
"all_objects = list(fetch_all_fn())\nself.assertNotEmpty(all_objects, \"Fetched objects can't be empty (%s).\" % error_desc)\nfor i in range(len(all_objects)):\n for l in range(1, len(all_objects) + 1):\n results = list(fetch_range_fn(i, l))\n expected = list(all_objects[i:i + l])\n self.ass... | <|body_start_0|>
all_objects = list(fetch_all_fn())
self.assertNotEmpty(all_objects, "Fetched objects can't be empty (%s)." % error_desc)
for i in range(len(all_objects)):
for l in range(1, len(all_objects) + 1):
results = list(fetch_range_fn(i, l))
ex... | Mixin containing helper methods for list/query methods tests. | QueryTestHelpersMixin | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class QueryTestHelpersMixin:
"""Mixin containing helper methods for list/query methods tests."""
def DoOffsetAndCountTest(self, fetch_all_fn: Callable[[], Iterable[Any]], fetch_range_fn: Callable[[int, int], Iterable[Any]], error_desc: Optional[Text]=None):
"""Tests a DB API method with di... | stack_v2_sparse_classes_36k_train_011965 | 10,806 | permissive | [
{
"docstring": "Tests a DB API method with different offset/count combinations. This helper method works by first fetching all available objects with fetch_all_fn and then fetching all possible ranges using fetch_fn. The test passes if subranges returned by fetch_fn match subranges of values in the list returne... | 3 | stack_v2_sparse_classes_30k_train_016736 | Implement the Python class `QueryTestHelpersMixin` described below.
Class description:
Mixin containing helper methods for list/query methods tests.
Method signatures and docstrings:
- def DoOffsetAndCountTest(self, fetch_all_fn: Callable[[], Iterable[Any]], fetch_range_fn: Callable[[int, int], Iterable[Any]], error_... | Implement the Python class `QueryTestHelpersMixin` described below.
Class description:
Mixin containing helper methods for list/query methods tests.
Method signatures and docstrings:
- def DoOffsetAndCountTest(self, fetch_all_fn: Callable[[], Iterable[Any]], fetch_range_fn: Callable[[int, int], Iterable[Any]], error_... | 44c0eb8c938302098ef7efae8cfd6b90bcfbb2d6 | <|skeleton|>
class QueryTestHelpersMixin:
"""Mixin containing helper methods for list/query methods tests."""
def DoOffsetAndCountTest(self, fetch_all_fn: Callable[[], Iterable[Any]], fetch_range_fn: Callable[[int, int], Iterable[Any]], error_desc: Optional[Text]=None):
"""Tests a DB API method with di... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class QueryTestHelpersMixin:
"""Mixin containing helper methods for list/query methods tests."""
def DoOffsetAndCountTest(self, fetch_all_fn: Callable[[], Iterable[Any]], fetch_range_fn: Callable[[int, int], Iterable[Any]], error_desc: Optional[Text]=None):
"""Tests a DB API method with different offse... | the_stack_v2_python_sparse | grr/server/grr_response_server/databases/db_test_utils.py | google/grr | train | 4,683 |
8993e36d53f21eb9675c8dac0716841f699ef201 | [
"if coco91_to_80 and include_mask:\n raise ValueError('If masks are included you cannot convert coco from the91 class format to the 80 class format.')\nself._coco91_to_80 = coco91_to_80\nsuper().__init__(include_mask=include_mask, regenerate_source_id=regenerate_source_id, mask_binarize_threshold=mask_binarize_t... | <|body_start_0|>
if coco91_to_80 and include_mask:
raise ValueError('If masks are included you cannot convert coco from the91 class format to the 80 class format.')
self._coco91_to_80 = coco91_to_80
super().__init__(include_mask=include_mask, regenerate_source_id=regenerate_source_id... | Tensorflow Example proto decoder. | TfExampleDecoder | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TfExampleDecoder:
"""Tensorflow Example proto decoder."""
def __init__(self, coco91_to_80=None, include_mask=False, regenerate_source_id=False, mask_binarize_threshold=None):
"""Initialize the example decoder. Args: coco91_to_80: `bool` indicating whether to convert coco from its 91 ... | stack_v2_sparse_classes_36k_train_011966 | 4,810 | permissive | [
{
"docstring": "Initialize the example decoder. Args: coco91_to_80: `bool` indicating whether to convert coco from its 91 class format to the 80 class format. include_mask: `bool` indicating if the decoder should also decode instance masks for instance segmentation. regenerate_source_id: `bool` indicating if th... | 2 | stack_v2_sparse_classes_30k_train_013377 | Implement the Python class `TfExampleDecoder` described below.
Class description:
Tensorflow Example proto decoder.
Method signatures and docstrings:
- def __init__(self, coco91_to_80=None, include_mask=False, regenerate_source_id=False, mask_binarize_threshold=None): Initialize the example decoder. Args: coco91_to_8... | Implement the Python class `TfExampleDecoder` described below.
Class description:
Tensorflow Example proto decoder.
Method signatures and docstrings:
- def __init__(self, coco91_to_80=None, include_mask=False, regenerate_source_id=False, mask_binarize_threshold=None): Initialize the example decoder. Args: coco91_to_8... | d3507b550a3ade40cade60a79eb5b8978b56c7ae | <|skeleton|>
class TfExampleDecoder:
"""Tensorflow Example proto decoder."""
def __init__(self, coco91_to_80=None, include_mask=False, regenerate_source_id=False, mask_binarize_threshold=None):
"""Initialize the example decoder. Args: coco91_to_80: `bool` indicating whether to convert coco from its 91 ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TfExampleDecoder:
"""Tensorflow Example proto decoder."""
def __init__(self, coco91_to_80=None, include_mask=False, regenerate_source_id=False, mask_binarize_threshold=None):
"""Initialize the example decoder. Args: coco91_to_80: `bool` indicating whether to convert coco from its 91 class format ... | the_stack_v2_python_sparse | official/projects/yolo/dataloaders/tf_example_decoder.py | jianzhnie/models | train | 2 |
294a474b9b1aa7ef9f651753bde2a6b2b9f2f208 | [
"whiteList = ['/admin/index/', '/admin/category/', '/admin/article/', '/admin/article_add/']\nuri = request.path_info\nif uri in whiteList:\n pass\nelse:\n pass\nprint('来了,老弟1')",
"print('走了,老弟1!')\nresponse.content = response.content + 'abcs2'.encode()\nreturn response",
"print('*' * 80)\nprint('mw1中间件的p... | <|body_start_0|>
whiteList = ['/admin/index/', '/admin/category/', '/admin/article/', '/admin/article_add/']
uri = request.path_info
if uri in whiteList:
pass
else:
pass
print('来了,老弟1')
<|end_body_0|>
<|body_start_1|>
print('走了,老弟1!')
resp... | mw1 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class mw1:
def process_request(self, request):
"""在路由前自动执行 :param request: :return:"""
<|body_0|>
def process_response(self, request, response):
"""在视图处理以后自动执行 :param request: :param response: :return:"""
<|body_1|>
def process_view(self, request, view_func, v... | stack_v2_sparse_classes_36k_train_011967 | 3,364 | no_license | [
{
"docstring": "在路由前自动执行 :param request: :return:",
"name": "process_request",
"signature": "def process_request(self, request)"
},
{
"docstring": "在视图处理以后自动执行 :param request: :param response: :return:",
"name": "process_response",
"signature": "def process_response(self, request, respon... | 4 | null | Implement the Python class `mw1` described below.
Class description:
Implement the mw1 class.
Method signatures and docstrings:
- def process_request(self, request): 在路由前自动执行 :param request: :return:
- def process_response(self, request, response): 在视图处理以后自动执行 :param request: :param response: :return:
- def process_v... | Implement the Python class `mw1` described below.
Class description:
Implement the mw1 class.
Method signatures and docstrings:
- def process_request(self, request): 在路由前自动执行 :param request: :return:
- def process_response(self, request, response): 在视图处理以后自动执行 :param request: :param response: :return:
- def process_v... | 5a1a6dd59cdd903563389fa7c73a283e8657d731 | <|skeleton|>
class mw1:
def process_request(self, request):
"""在路由前自动执行 :param request: :return:"""
<|body_0|>
def process_response(self, request, response):
"""在视图处理以后自动执行 :param request: :param response: :return:"""
<|body_1|>
def process_view(self, request, view_func, v... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class mw1:
def process_request(self, request):
"""在路由前自动执行 :param request: :return:"""
whiteList = ['/admin/index/', '/admin/category/', '/admin/article/', '/admin/article_add/']
uri = request.path_info
if uri in whiteList:
pass
else:
pass
prin... | the_stack_v2_python_sparse | python/Django/20190702/test01/mw.py | wjl626nice/1902 | train | 4 | |
cb88c5175ce1714d6e75bda08b33c25e19a3e474 | [
"self.end_time_msecs = end_time_msecs\nself.env_type = env_type\nself.job_id = job_id\nself.job_name = job_name\nself.job_run_id = job_run_id\nself.job_type = job_type\nself.start_time_msecs = start_time_msecs\nself.view_box_id = view_box_id",
"if dictionary is None:\n return None\nend_time_msecs = dictionary.... | <|body_start_0|>
self.end_time_msecs = end_time_msecs
self.env_type = env_type
self.job_id = job_id
self.job_name = job_name
self.job_run_id = job_run_id
self.job_type = job_type
self.start_time_msecs = start_time_msecs
self.view_box_id = view_box_id
<|end... | Implementation of the 'GetAllJobRunsResult' model. Specifies the common result structure of the response of all runs info ( protection, replication, archival etc.). Attributes: end_time_msecs (long|int): Specifies the end time of the run. env_type (EnvTypeEnum): Specifies the environment type of the job. Supported envi... | GetAllJobRunsResult | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GetAllJobRunsResult:
"""Implementation of the 'GetAllJobRunsResult' model. Specifies the common result structure of the response of all runs info ( protection, replication, archival etc.). Attributes: end_time_msecs (long|int): Specifies the end time of the run. env_type (EnvTypeEnum): Specifies ... | stack_v2_sparse_classes_36k_train_011968 | 6,994 | permissive | [
{
"docstring": "Constructor for the GetAllJobRunsResult class",
"name": "__init__",
"signature": "def __init__(self, end_time_msecs=None, env_type=None, job_id=None, job_name=None, job_run_id=None, job_type=None, start_time_msecs=None, view_box_id=None)"
},
{
"docstring": "Creates an instance of... | 2 | stack_v2_sparse_classes_30k_train_010858 | Implement the Python class `GetAllJobRunsResult` described below.
Class description:
Implementation of the 'GetAllJobRunsResult' model. Specifies the common result structure of the response of all runs info ( protection, replication, archival etc.). Attributes: end_time_msecs (long|int): Specifies the end time of the ... | Implement the Python class `GetAllJobRunsResult` described below.
Class description:
Implementation of the 'GetAllJobRunsResult' model. Specifies the common result structure of the response of all runs info ( protection, replication, archival etc.). Attributes: end_time_msecs (long|int): Specifies the end time of the ... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class GetAllJobRunsResult:
"""Implementation of the 'GetAllJobRunsResult' model. Specifies the common result structure of the response of all runs info ( protection, replication, archival etc.). Attributes: end_time_msecs (long|int): Specifies the end time of the run. env_type (EnvTypeEnum): Specifies ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GetAllJobRunsResult:
"""Implementation of the 'GetAllJobRunsResult' model. Specifies the common result structure of the response of all runs info ( protection, replication, archival etc.). Attributes: end_time_msecs (long|int): Specifies the end time of the run. env_type (EnvTypeEnum): Specifies the environme... | the_stack_v2_python_sparse | cohesity_management_sdk/models/get_all_job_runs_result.py | cohesity/management-sdk-python | train | 24 |
0d0a318880f46604fe0e963a30334b6d1bd19cc0 | [
"self.client.force_authenticate(user=self.user)\nurl = reverse('commerce:itemlist', kwargs={'version': 'v1'})\ndata = {'title': 'pen', 'quantity': 2}\nresponse = self.client.post(url, data, format='json')\nself.assertEqual(response.status_code, status.HTTP_201_CREATED)\nself.assertEqual(ItemOrder.objects.count(), 1... | <|body_start_0|>
self.client.force_authenticate(user=self.user)
url = reverse('commerce:itemlist', kwargs={'version': 'v1'})
data = {'title': 'pen', 'quantity': 2}
response = self.client.post(url, data, format='json')
self.assertEqual(response.status_code, status.HTTP_201_CREATED... | PurchasePostTest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PurchasePostTest:
def test_create_ItemOrder(self):
"""Ensure we can purchase one item on old version."""
<|body_0|>
def test_create_ItemOrder_fail(self):
"""Ensure we can purchase one item on old version."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_36k_train_011969 | 10,115 | no_license | [
{
"docstring": "Ensure we can purchase one item on old version.",
"name": "test_create_ItemOrder",
"signature": "def test_create_ItemOrder(self)"
},
{
"docstring": "Ensure we can purchase one item on old version.",
"name": "test_create_ItemOrder_fail",
"signature": "def test_create_ItemO... | 2 | stack_v2_sparse_classes_30k_train_016281 | Implement the Python class `PurchasePostTest` described below.
Class description:
Implement the PurchasePostTest class.
Method signatures and docstrings:
- def test_create_ItemOrder(self): Ensure we can purchase one item on old version.
- def test_create_ItemOrder_fail(self): Ensure we can purchase one item on old ve... | Implement the Python class `PurchasePostTest` described below.
Class description:
Implement the PurchasePostTest class.
Method signatures and docstrings:
- def test_create_ItemOrder(self): Ensure we can purchase one item on old version.
- def test_create_ItemOrder_fail(self): Ensure we can purchase one item on old ve... | 82f372ecae245b1affc6f7eaa15a0785146e6ca5 | <|skeleton|>
class PurchasePostTest:
def test_create_ItemOrder(self):
"""Ensure we can purchase one item on old version."""
<|body_0|>
def test_create_ItemOrder_fail(self):
"""Ensure we can purchase one item on old version."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PurchasePostTest:
def test_create_ItemOrder(self):
"""Ensure we can purchase one item on old version."""
self.client.force_authenticate(user=self.user)
url = reverse('commerce:itemlist', kwargs={'version': 'v1'})
data = {'title': 'pen', 'quantity': 2}
response = self.cl... | the_stack_v2_python_sparse | commerce/tests.py | Janujan/commerce-challenge | train | 0 | |
43879ca3aef1ae28c37716e2c2f4fd66486cf481 | [
"\"\"\"找出所有的pair, 如果符合条件,计数器加1 O(n^2)\"\"\"\ncount = 0\nfor i in range(len(nums)):\n for j in range(i + 1, len(nums)):\n if abs(nums[i] - nums[j]) == k:\n count += 1\nreturn count",
"\"\"\"\n 思路:如果k不等于零的话,那就是nums和nums数组每个数加k集合的交,如果k等于零的话,那就统计数组中相同的数字即可\n 区分开k=0的情况\n \... | <|body_start_0|>
"""找出所有的pair, 如果符合条件,计数器加1 O(n^2)"""
count = 0
for i in range(len(nums)):
for j in range(i + 1, len(nums)):
if abs(nums[i] - nums[j]) == k:
count += 1
return count
<|end_body_0|>
<|body_start_1|>
"""
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findPairs_simple(self, nums, k):
""":type nums: List[int] :type k: int :rtype: int"""
<|body_0|>
def findPairs_map(self, nums, k):
""":type nums: List[int] :type k: int :rtype: int"""
<|body_1|>
def findPairs_pointer(self, nums, k):
... | stack_v2_sparse_classes_36k_train_011970 | 2,289 | no_license | [
{
"docstring": ":type nums: List[int] :type k: int :rtype: int",
"name": "findPairs_simple",
"signature": "def findPairs_simple(self, nums, k)"
},
{
"docstring": ":type nums: List[int] :type k: int :rtype: int",
"name": "findPairs_map",
"signature": "def findPairs_map(self, nums, k)"
}... | 3 | stack_v2_sparse_classes_30k_train_021324 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findPairs_simple(self, nums, k): :type nums: List[int] :type k: int :rtype: int
- def findPairs_map(self, nums, k): :type nums: List[int] :type k: int :rtype: int
- def findP... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findPairs_simple(self, nums, k): :type nums: List[int] :type k: int :rtype: int
- def findPairs_map(self, nums, k): :type nums: List[int] :type k: int :rtype: int
- def findP... | a0f270c1adce25be11df92877813037f2e73e28b | <|skeleton|>
class Solution:
def findPairs_simple(self, nums, k):
""":type nums: List[int] :type k: int :rtype: int"""
<|body_0|>
def findPairs_map(self, nums, k):
""":type nums: List[int] :type k: int :rtype: int"""
<|body_1|>
def findPairs_pointer(self, nums, k):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def findPairs_simple(self, nums, k):
""":type nums: List[int] :type k: int :rtype: int"""
"""找出所有的pair, 如果符合条件,计数器加1 O(n^2)"""
count = 0
for i in range(len(nums)):
for j in range(i + 1, len(nums)):
if abs(nums[i] - nums[j]) == k:
... | the_stack_v2_python_sparse | leetcode/532_k_diff_pairs_in_an_array.py | lvraikkonen/GoodCode | train | 0 | |
4d468d67be1bfc25bb72ee44454384f313bced2a | [
"shared = {'fasta': True, 'input': str(self.path / 'input'), 'type': 'dir'}\nattrs_list_exp = [{'path': self.path / 'input/D.fasta', 'segment': 'D'}, {'path': self.path / 'input/J.fasta', 'segment': 'J'}, {'path': self.path / 'input/V.fasta', 'segment': 'V'}]\nfor attrs in attrs_list_exp:\n attrs.update(shared)\... | <|body_start_0|>
shared = {'fasta': True, 'input': str(self.path / 'input'), 'type': 'dir'}
attrs_list_exp = [{'path': self.path / 'input/D.fasta', 'segment': 'D'}, {'path': self.path / 'input/J.fasta', 'segment': 'J'}, {'path': self.path / 'input/V.fasta', 'segment': 'V'}]
for attrs in attrs_li... | Basic test of parse_vdj_paths. | TestParseVDJPaths | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestParseVDJPaths:
"""Basic test of parse_vdj_paths."""
def test_parse_vdj_paths(self):
"""parse_vdj_paths should give a list of dicts with info parsed from the given paths"""
<|body_0|>
def test_parse_vdj_paths_duplicates(self):
"""parse_vdj_paths shouldn't repe... | stack_v2_sparse_classes_36k_train_011971 | 10,033 | no_license | [
{
"docstring": "parse_vdj_paths should give a list of dicts with info parsed from the given paths",
"name": "test_parse_vdj_paths",
"signature": "def test_parse_vdj_paths(self)"
},
{
"docstring": "parse_vdj_paths shouldn't repeat paths that come from multiple input names",
"name": "test_pars... | 4 | stack_v2_sparse_classes_30k_train_019626 | Implement the Python class `TestParseVDJPaths` described below.
Class description:
Basic test of parse_vdj_paths.
Method signatures and docstrings:
- def test_parse_vdj_paths(self): parse_vdj_paths should give a list of dicts with info parsed from the given paths
- def test_parse_vdj_paths_duplicates(self): parse_vdj... | Implement the Python class `TestParseVDJPaths` described below.
Class description:
Basic test of parse_vdj_paths.
Method signatures and docstrings:
- def test_parse_vdj_paths(self): parse_vdj_paths should give a list of dicts with info parsed from the given paths
- def test_parse_vdj_paths_duplicates(self): parse_vdj... | 539868dab2041b7694c0d53e8e74cf1b5b033653 | <|skeleton|>
class TestParseVDJPaths:
"""Basic test of parse_vdj_paths."""
def test_parse_vdj_paths(self):
"""parse_vdj_paths should give a list of dicts with info parsed from the given paths"""
<|body_0|>
def test_parse_vdj_paths_duplicates(self):
"""parse_vdj_paths shouldn't repe... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestParseVDJPaths:
"""Basic test of parse_vdj_paths."""
def test_parse_vdj_paths(self):
"""parse_vdj_paths should give a list of dicts with info parsed from the given paths"""
shared = {'fasta': True, 'input': str(self.path / 'input'), 'type': 'dir'}
attrs_list_exp = [{'path': sel... | the_stack_v2_python_sparse | test_igseq/test_vdj.py | ShawHahnLab/igseq | train | 1 |
90e16efe96bfb67557142e809020218a5d39b29e | [
"super(Dropout, self).__init__()\nself.r = r\nif type(batch_dim) == int:\n batch_dim = [batch_dim]\nself.batch_dim = batch_dim\nself.dropout = nn.Dropout(self.r)",
"shape = list(x.shape)\nif self.batch_dim is not None:\n for bd in self.batch_dim:\n shape[bd] = 1\nmask = x.new_ones(shape)\nmask = self... | <|body_start_0|>
super(Dropout, self).__init__()
self.r = r
if type(batch_dim) == int:
batch_dim = [batch_dim]
self.batch_dim = batch_dim
self.dropout = nn.Dropout(self.r)
<|end_body_0|>
<|body_start_1|>
shape = list(x.shape)
if self.batch_dim is not ... | Implementation of dropout with the ability to share the dropout mask along a particular dimension. If not in training mode, this module computes the identity function. | Dropout | [
"Apache-2.0",
"CC-BY-4.0",
"LicenseRef-scancode-other-permissive",
"CC-BY-NC-4.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Dropout:
"""Implementation of dropout with the ability to share the dropout mask along a particular dimension. If not in training mode, this module computes the identity function."""
def __init__(self, r: float, batch_dim: Union[int, List[int]]):
"""Args: r: Dropout rate batch_dim: D... | stack_v2_sparse_classes_36k_train_011972 | 2,222 | permissive | [
{
"docstring": "Args: r: Dropout rate batch_dim: Dimension(s) along which the dropout mask is shared",
"name": "__init__",
"signature": "def __init__(self, r: float, batch_dim: Union[int, List[int]])"
},
{
"docstring": "Args: x: Tensor to which dropout is applied. Can have any shape compatible w... | 2 | stack_v2_sparse_classes_30k_train_001249 | Implement the Python class `Dropout` described below.
Class description:
Implementation of dropout with the ability to share the dropout mask along a particular dimension. If not in training mode, this module computes the identity function.
Method signatures and docstrings:
- def __init__(self, r: float, batch_dim: U... | Implement the Python class `Dropout` described below.
Class description:
Implementation of dropout with the ability to share the dropout mask along a particular dimension. If not in training mode, this module computes the identity function.
Method signatures and docstrings:
- def __init__(self, r: float, batch_dim: U... | 2134cc09b3994b6280e6e3c569dd7d761e4da7a0 | <|skeleton|>
class Dropout:
"""Implementation of dropout with the ability to share the dropout mask along a particular dimension. If not in training mode, this module computes the identity function."""
def __init__(self, r: float, batch_dim: Union[int, List[int]]):
"""Args: r: Dropout rate batch_dim: D... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Dropout:
"""Implementation of dropout with the ability to share the dropout mask along a particular dimension. If not in training mode, this module computes the identity function."""
def __init__(self, r: float, batch_dim: Union[int, List[int]]):
"""Args: r: Dropout rate batch_dim: Dimension(s) a... | the_stack_v2_python_sparse | openfold/model/dropout.py | aqlaboratory/openfold | train | 2,033 |
d26442be3884936eeceaa41e788a804a3f167ff5 | [
"if layer.base:\n raise ValueError('Cannot reorder base layer {}'.format(layer))\ntry:\n old_i = self.layers.index(layer)\nexcept ValueError:\n raise ValueError('Layer {} does not exist on the map'.format(layer))\nself.layers = tuple_move(self.layers, old_i, new_index)",
"if layer.base:\n raise ValueE... | <|body_start_0|>
if layer.base:
raise ValueError('Cannot reorder base layer {}'.format(layer))
try:
old_i = self.layers.index(layer)
except ValueError:
raise ValueError('Layer {} does not exist on the map'.format(layer))
self.layers = tuple_move(self.l... | Subclass of ``ipyleaflet.Map`` with Workflows defaults and extra helper methods. Attributes ---------- output_log: ipywidgets.Output Widget where functions doing operations on this map (especially compute operations, like autoscaling or timeseries) can log their output. | Map | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Map:
"""Subclass of ``ipyleaflet.Map`` with Workflows defaults and extra helper methods. Attributes ---------- output_log: ipywidgets.Output Widget where functions doing operations on this map (especially compute operations, like autoscaling or timeseries) can log their output."""
def move_l... | stack_v2_sparse_classes_36k_train_011973 | 10,782 | permissive | [
{
"docstring": "Move a layer to a new index. Parameters ---------- layer: ipyleaflet.Layer new_index: int Raises ------ ValueError: If ``layer`` is a base layer, or does not already exist on the map.",
"name": "move_layer",
"signature": "def move_layer(self, layer, new_index)"
},
{
"docstring": ... | 4 | stack_v2_sparse_classes_30k_test_001075 | Implement the Python class `Map` described below.
Class description:
Subclass of ``ipyleaflet.Map`` with Workflows defaults and extra helper methods. Attributes ---------- output_log: ipywidgets.Output Widget where functions doing operations on this map (especially compute operations, like autoscaling or timeseries) c... | Implement the Python class `Map` described below.
Class description:
Subclass of ``ipyleaflet.Map`` with Workflows defaults and extra helper methods. Attributes ---------- output_log: ipywidgets.Output Widget where functions doing operations on this map (especially compute operations, like autoscaling or timeseries) c... | c99c3091f2629c758a27de4d8fd6e4a39a7b3013 | <|skeleton|>
class Map:
"""Subclass of ``ipyleaflet.Map`` with Workflows defaults and extra helper methods. Attributes ---------- output_log: ipywidgets.Output Widget where functions doing operations on this map (especially compute operations, like autoscaling or timeseries) can log their output."""
def move_l... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Map:
"""Subclass of ``ipyleaflet.Map`` with Workflows defaults and extra helper methods. Attributes ---------- output_log: ipywidgets.Output Widget where functions doing operations on this map (especially compute operations, like autoscaling or timeseries) can log their output."""
def move_layer(self, la... | the_stack_v2_python_sparse | descarteslabs/workflows/interactive/map_.py | grpecunia/descarteslabs-python | train | 0 |
04c9c86a051476ad7a66e8bf453a8a7abccce607 | [
"if not self.session.cookies:\n try:\n self.session.cookies = cookies.load()\n except MissingCookiesError:\n return False\n except Exception as exc:\n import traceback\n LOG.error('Failed to load stored cookies: {}', type(exc).__name__)\n LOG.error(traceback.format_exc())... | <|body_start_0|>
if not self.session.cookies:
try:
self.session.cookies = cookies.load()
except MissingCookiesError:
return False
except Exception as exc:
import traceback
LOG.error('Failed to load stored cookies... | Handle the cookies | SessionCookie | [
"LicenseRef-scancode-warranty-disclaimer",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SessionCookie:
"""Handle the cookies"""
def _load_cookies(self):
"""Load stored cookies from disk"""
<|body_0|>
def _verify_session_cookies(self):
"""Verify that the session cookies have not expired"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_36k_train_011974 | 1,950 | permissive | [
{
"docstring": "Load stored cookies from disk",
"name": "_load_cookies",
"signature": "def _load_cookies(self)"
},
{
"docstring": "Verify that the session cookies have not expired",
"name": "_verify_session_cookies",
"signature": "def _verify_session_cookies(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_015353 | Implement the Python class `SessionCookie` described below.
Class description:
Handle the cookies
Method signatures and docstrings:
- def _load_cookies(self): Load stored cookies from disk
- def _verify_session_cookies(self): Verify that the session cookies have not expired | Implement the Python class `SessionCookie` described below.
Class description:
Handle the cookies
Method signatures and docstrings:
- def _load_cookies(self): Load stored cookies from disk
- def _verify_session_cookies(self): Verify that the session cookies have not expired
<|skeleton|>
class SessionCookie:
"""H... | ece10d24449faaccd7d65a4093c6b5679ee0b383 | <|skeleton|>
class SessionCookie:
"""Handle the cookies"""
def _load_cookies(self):
"""Load stored cookies from disk"""
<|body_0|>
def _verify_session_cookies(self):
"""Verify that the session cookies have not expired"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SessionCookie:
"""Handle the cookies"""
def _load_cookies(self):
"""Load stored cookies from disk"""
if not self.session.cookies:
try:
self.session.cookies = cookies.load()
except MissingCookiesError:
return False
except ... | the_stack_v2_python_sparse | resources/lib/services/nfsession/session/cookie.py | CastagnaIT/plugin.video.netflix | train | 2,019 |
b764504c6db55ea447c381c6aa2d29772d3a4df2 | [
"dp = [float('inf')] * len(nums)\ndp[0] = 0\nfor i in range(1, len(nums)):\n dp[i] = min(dp[i - 1] + 1, dp[i])\n for j in range(1, nums[i] + 1):\n if i + j < len(nums):\n dp[i + j] = min(dp[i + j], dp[i] + 1)\nreturn dp[-1]",
"dp = [float('inf')] * len(nums)\ndp[0] = 0\nfor i in range(1, l... | <|body_start_0|>
dp = [float('inf')] * len(nums)
dp[0] = 0
for i in range(1, len(nums)):
dp[i] = min(dp[i - 1] + 1, dp[i])
for j in range(1, nums[i] + 1):
if i + j < len(nums):
dp[i + j] = min(dp[i + j], dp[i] + 1)
return dp[-1]... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def jump1(self, nums: List[int]) -> int:
"""DP:dp[i]代表当前索引需要的最小步数 1. 当前索引i位置的最小步数,取两者最小值,min(dp[i],dp(i-1)+1) 2. [i+1,i+num]范围内的所有位置都可以由i位置一步到达, 所以 dp[i+1]~dp[i+j] = min(dp[x],dp[i]+1)"""
<|body_0|>
def jump2(self, nums: List[int]) -> int:
"""DP: 更容易理解的方法 对... | stack_v2_sparse_classes_36k_train_011975 | 2,318 | no_license | [
{
"docstring": "DP:dp[i]代表当前索引需要的最小步数 1. 当前索引i位置的最小步数,取两者最小值,min(dp[i],dp(i-1)+1) 2. [i+1,i+num]范围内的所有位置都可以由i位置一步到达, 所以 dp[i+1]~dp[i+j] = min(dp[x],dp[i]+1)",
"name": "jump1",
"signature": "def jump1(self, nums: List[int]) -> int"
},
{
"docstring": "DP: 更容易理解的方法 对于当前位置i,如果前面任意位置j的值可以到达, 则dp[i]=m... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def jump1(self, nums: List[int]) -> int: DP:dp[i]代表当前索引需要的最小步数 1. 当前索引i位置的最小步数,取两者最小值,min(dp[i],dp(i-1)+1) 2. [i+1,i+num]范围内的所有位置都可以由i位置一步到达, 所以 dp[i+1]~dp[i+j] = min(dp[x],dp[i]... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def jump1(self, nums: List[int]) -> int: DP:dp[i]代表当前索引需要的最小步数 1. 当前索引i位置的最小步数,取两者最小值,min(dp[i],dp(i-1)+1) 2. [i+1,i+num]范围内的所有位置都可以由i位置一步到达, 所以 dp[i+1]~dp[i+j] = min(dp[x],dp[i]... | 2bbb1640589aab34f2bc42489283033cc11fb885 | <|skeleton|>
class Solution:
def jump1(self, nums: List[int]) -> int:
"""DP:dp[i]代表当前索引需要的最小步数 1. 当前索引i位置的最小步数,取两者最小值,min(dp[i],dp(i-1)+1) 2. [i+1,i+num]范围内的所有位置都可以由i位置一步到达, 所以 dp[i+1]~dp[i+j] = min(dp[x],dp[i]+1)"""
<|body_0|>
def jump2(self, nums: List[int]) -> int:
"""DP: 更容易理解的方法 对... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def jump1(self, nums: List[int]) -> int:
"""DP:dp[i]代表当前索引需要的最小步数 1. 当前索引i位置的最小步数,取两者最小值,min(dp[i],dp(i-1)+1) 2. [i+1,i+num]范围内的所有位置都可以由i位置一步到达, 所以 dp[i+1]~dp[i+j] = min(dp[x],dp[i]+1)"""
dp = [float('inf')] * len(nums)
dp[0] = 0
for i in range(1, len(nums)):
... | the_stack_v2_python_sparse | 045_jump-game-ii.py | helloocc/algorithm | train | 1 | |
a44e7de403141ddcd16796453d218cb52672ae08 | [
"if not head or not head.next:\n return head\nlen_listnode, node = (0, head)\nwhile node:\n len_listnode += 1\n node = node.next\ncut_length = len_listnode - k % len_listnode\nif cut_length == 0 or cut_length == len_listnode:\n return head\nnode = head\nfor i in range(cut_length - 1):\n node = node.n... | <|body_start_0|>
if not head or not head.next:
return head
len_listnode, node = (0, head)
while node:
len_listnode += 1
node = node.next
cut_length = len_listnode - k % len_listnode
if cut_length == 0 or cut_length == len_listnode:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def rotateRight(self, head, k):
""":type head: ListNode :type k: int :rtype: ListNode"""
<|body_0|>
def rotateRight1(self, head, k):
""":type head: ListNode :type k: int :rtype: ListNode"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if n... | stack_v2_sparse_classes_36k_train_011976 | 1,432 | no_license | [
{
"docstring": ":type head: ListNode :type k: int :rtype: ListNode",
"name": "rotateRight",
"signature": "def rotateRight(self, head, k)"
},
{
"docstring": ":type head: ListNode :type k: int :rtype: ListNode",
"name": "rotateRight1",
"signature": "def rotateRight1(self, head, k)"
}
] | 2 | stack_v2_sparse_classes_30k_train_017161 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def rotateRight(self, head, k): :type head: ListNode :type k: int :rtype: ListNode
- def rotateRight1(self, head, k): :type head: ListNode :type k: int :rtype: ListNode | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def rotateRight(self, head, k): :type head: ListNode :type k: int :rtype: ListNode
- def rotateRight1(self, head, k): :type head: ListNode :type k: int :rtype: ListNode
<|skelet... | b8ec1350e904665f1375c29a53f443ecf262d723 | <|skeleton|>
class Solution:
def rotateRight(self, head, k):
""":type head: ListNode :type k: int :rtype: ListNode"""
<|body_0|>
def rotateRight1(self, head, k):
""":type head: ListNode :type k: int :rtype: ListNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def rotateRight(self, head, k):
""":type head: ListNode :type k: int :rtype: ListNode"""
if not head or not head.next:
return head
len_listnode, node = (0, head)
while node:
len_listnode += 1
node = node.next
cut_length = le... | the_stack_v2_python_sparse | leetcode/061旋转链表.py | ShawDa/Coding | train | 0 | |
d938d08128e1c7b385907d829181cc51872391bf | [
"n = len(alist)\nif n > 0:\n mid = n // 2\n if alist[mid] == target:\n return True\n elif target < alist[mid]:\n return self.binary_search_rec(alist[:mid], target)\n else:\n return self.binary_search_rec(alist[mid + 1:], target)\nreturn False",
"low, high = (0, len(alist) - 1)\nwh... | <|body_start_0|>
n = len(alist)
if n > 0:
mid = n // 2
if alist[mid] == target:
return True
elif target < alist[mid]:
return self.binary_search_rec(alist[:mid], target)
else:
return self.binary_search_rec(ali... | Binary_Search | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Binary_Search:
def binary_search_rec(self, alist, target):
"""二分查找,递归"""
<|body_0|>
def binary_search(self, alist, target):
"""二分查找,非递归"""
<|body_1|>
def binary_search_first(self, alist, target):
""""二分查找,查找第一个值等于给定值的元素 alist = [1,3,4,5,6,8,8,8,1... | stack_v2_sparse_classes_36k_train_011977 | 2,881 | no_license | [
{
"docstring": "二分查找,递归",
"name": "binary_search_rec",
"signature": "def binary_search_rec(self, alist, target)"
},
{
"docstring": "二分查找,非递归",
"name": "binary_search",
"signature": "def binary_search(self, alist, target)"
},
{
"docstring": "\"二分查找,查找第一个值等于给定值的元素 alist = [1,3,4,5,... | 6 | null | Implement the Python class `Binary_Search` described below.
Class description:
Implement the Binary_Search class.
Method signatures and docstrings:
- def binary_search_rec(self, alist, target): 二分查找,递归
- def binary_search(self, alist, target): 二分查找,非递归
- def binary_search_first(self, alist, target): "二分查找,查找第一个值等于给定值... | Implement the Python class `Binary_Search` described below.
Class description:
Implement the Binary_Search class.
Method signatures and docstrings:
- def binary_search_rec(self, alist, target): 二分查找,递归
- def binary_search(self, alist, target): 二分查找,非递归
- def binary_search_first(self, alist, target): "二分查找,查找第一个值等于给定值... | 7e82422c84ad699805cc12568b8d3d969f66a419 | <|skeleton|>
class Binary_Search:
def binary_search_rec(self, alist, target):
"""二分查找,递归"""
<|body_0|>
def binary_search(self, alist, target):
"""二分查找,非递归"""
<|body_1|>
def binary_search_first(self, alist, target):
""""二分查找,查找第一个值等于给定值的元素 alist = [1,3,4,5,6,8,8,8,1... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Binary_Search:
def binary_search_rec(self, alist, target):
"""二分查找,递归"""
n = len(alist)
if n > 0:
mid = n // 2
if alist[mid] == target:
return True
elif target < alist[mid]:
return self.binary_search_rec(alist[:mid], t... | the_stack_v2_python_sparse | Algorithms/Python/binary_search.py | mrmenand/Py_transaction | train | 1 | |
2fb55ae891a3283b6d3496650dbcfb99c13e84f4 | [
"dtype = np.float32\ntrue_mean = dtype([0, 0, 0])\ntrue_cov = dtype([[1, 0.25, 0.25], [0.25, 2, 0.25], [0.25, 0.25, 3]])\nchol = tf.linalg.cholesky(true_cov)\ntarget = mvn_tril.MultivariateNormalTriL(loc=true_mean, scale_tril=chol)\n\ndef target_fn(x, y):\n z = tf.concat([x, y], axis=-1) - true_mean\n return ... | <|body_start_0|>
dtype = np.float32
true_mean = dtype([0, 0, 0])
true_cov = dtype([[1, 0.25, 0.25], [0.25, 2, 0.25], [0.25, 0.25, 3]])
chol = tf.linalg.cholesky(true_cov)
target = mvn_tril.MultivariateNormalTriL(loc=true_mean, scale_tril=chol)
def target_fn(x, y):
... | JacobianTest | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class JacobianTest:
def testJacobianDiagonal3DListInput(self):
"""Tests that the diagonal of the Jacobian matrix computes correctly."""
<|body_0|>
def testJacobianDiagonal4D(self):
"""Tests that the diagonal of the Jacobian matrix computes correctly."""
<|body_1|>
... | stack_v2_sparse_classes_36k_train_011978 | 4,890 | permissive | [
{
"docstring": "Tests that the diagonal of the Jacobian matrix computes correctly.",
"name": "testJacobianDiagonal3DListInput",
"signature": "def testJacobianDiagonal3DListInput(self)"
},
{
"docstring": "Tests that the diagonal of the Jacobian matrix computes correctly.",
"name": "testJacobi... | 2 | stack_v2_sparse_classes_30k_train_010524 | Implement the Python class `JacobianTest` described below.
Class description:
Implement the JacobianTest class.
Method signatures and docstrings:
- def testJacobianDiagonal3DListInput(self): Tests that the diagonal of the Jacobian matrix computes correctly.
- def testJacobianDiagonal4D(self): Tests that the diagonal ... | Implement the Python class `JacobianTest` described below.
Class description:
Implement the JacobianTest class.
Method signatures and docstrings:
- def testJacobianDiagonal3DListInput(self): Tests that the diagonal of the Jacobian matrix computes correctly.
- def testJacobianDiagonal4D(self): Tests that the diagonal ... | 42a64ba0d9e0973b1707fcd9b8bd8d14b2d4e3e5 | <|skeleton|>
class JacobianTest:
def testJacobianDiagonal3DListInput(self):
"""Tests that the diagonal of the Jacobian matrix computes correctly."""
<|body_0|>
def testJacobianDiagonal4D(self):
"""Tests that the diagonal of the Jacobian matrix computes correctly."""
<|body_1|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class JacobianTest:
def testJacobianDiagonal3DListInput(self):
"""Tests that the diagonal of the Jacobian matrix computes correctly."""
dtype = np.float32
true_mean = dtype([0, 0, 0])
true_cov = dtype([[1, 0.25, 0.25], [0.25, 2, 0.25], [0.25, 0.25, 3]])
chol = tf.linalg.chole... | the_stack_v2_python_sparse | tensorflow_probability/python/math/diag_jacobian_test.py | tensorflow/probability | train | 4,055 | |
6632899651372ed6fd89282b67bd0d1e7c29e76e | [
"if not precision:\n precision = self.pool.get('decimal.precision').precision_get(cr, uid, 'Account')\nres = self._unit_compute(cr, uid, taxes, price_unit, product, partner, quantity)\ntotal = 0.0\nfor r in res:\n if r.get('balance', False):\n r['amount'] = round(r.get('balance', 0.0) * quantity, 4) - ... | <|body_start_0|>
if not precision:
precision = self.pool.get('decimal.precision').precision_get(cr, uid, 'Account')
res = self._unit_compute(cr, uid, taxes, price_unit, product, partner, quantity)
total = 0.0
for r in res:
if r.get('balance', False):
... | account_tax | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class account_tax:
def _compute(self, cr, uid, taxes, price_unit, quantity, product=None, partner=None, precision=None):
"""Compute tax values for given PRICE_UNIT, QUANTITY and a buyer/seller ADDRESS_ID. RETURN: [ tax ] tax = {'name':'', 'amount':0.0, 'account_collected_id':1, 'account_paid_i... | stack_v2_sparse_classes_36k_train_011979 | 5,125 | no_license | [
{
"docstring": "Compute tax values for given PRICE_UNIT, QUANTITY and a buyer/seller ADDRESS_ID. RETURN: [ tax ] tax = {'name':'', 'amount':0.0, 'account_collected_id':1, 'account_paid_id':2} one tax for each tax id in IDS and their children",
"name": "_compute",
"signature": "def _compute(self, cr, uid... | 2 | null | Implement the Python class `account_tax` described below.
Class description:
Implement the account_tax class.
Method signatures and docstrings:
- def _compute(self, cr, uid, taxes, price_unit, quantity, product=None, partner=None, precision=None): Compute tax values for given PRICE_UNIT, QUANTITY and a buyer/seller A... | Implement the Python class `account_tax` described below.
Class description:
Implement the account_tax class.
Method signatures and docstrings:
- def _compute(self, cr, uid, taxes, price_unit, quantity, product=None, partner=None, precision=None): Compute tax values for given PRICE_UNIT, QUANTITY and a buyer/seller A... | 2486261e4d351d4f444ec31e74c6b0e36ed2fb82 | <|skeleton|>
class account_tax:
def _compute(self, cr, uid, taxes, price_unit, quantity, product=None, partner=None, precision=None):
"""Compute tax values for given PRICE_UNIT, QUANTITY and a buyer/seller ADDRESS_ID. RETURN: [ tax ] tax = {'name':'', 'amount':0.0, 'account_collected_id':1, 'account_paid_i... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class account_tax:
def _compute(self, cr, uid, taxes, price_unit, quantity, product=None, partner=None, precision=None):
"""Compute tax values for given PRICE_UNIT, QUANTITY and a buyer/seller ADDRESS_ID. RETURN: [ tax ] tax = {'name':'', 'amount':0.0, 'account_collected_id':1, 'account_paid_id':2} one tax ... | the_stack_v2_python_sparse | crea8s_glassfix/account.py | tringuyen17588/OpenERP-7.0 | train | 0 | |
aa890a4d28c88cd8ecfe4c96d080df2bb08a7085 | [
"self.dense1 = Dense(self.n_hidden)\nself.dense2 = Dense(self.n_hidden)\nself.dense3 = Dense(self.n_hidden)\nself.dense4 = Dense(self.n_hidden)\nself.dense5 = Dense(self.n_input)\nself.batchnorm1 = nn.BatchNorm(momentum=0.99, epsilon=0.001)\nself.batchnorm2 = nn.BatchNorm(momentum=0.99, epsilon=0.001)\nself.dropout... | <|body_start_0|>
self.dense1 = Dense(self.n_hidden)
self.dense2 = Dense(self.n_hidden)
self.dense3 = Dense(self.n_hidden)
self.dense4 = Dense(self.n_hidden)
self.dense5 = Dense(self.n_input)
self.batchnorm1 = nn.BatchNorm(momentum=0.99, epsilon=0.001)
self.batchno... | Decoder for Jax VAE. | FlaxDecoder | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FlaxDecoder:
"""Decoder for Jax VAE."""
def setup(self):
"""Setup decoder."""
<|body_0|>
def __call__(self, z: jnp.ndarray, batch: jnp.ndarray, training: Optional[bool]=None):
"""Forward pass."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self... | stack_v2_sparse_classes_36k_train_011980 | 7,000 | permissive | [
{
"docstring": "Setup decoder.",
"name": "setup",
"signature": "def setup(self)"
},
{
"docstring": "Forward pass.",
"name": "__call__",
"signature": "def __call__(self, z: jnp.ndarray, batch: jnp.ndarray, training: Optional[bool]=None)"
}
] | 2 | stack_v2_sparse_classes_30k_train_002572 | Implement the Python class `FlaxDecoder` described below.
Class description:
Decoder for Jax VAE.
Method signatures and docstrings:
- def setup(self): Setup decoder.
- def __call__(self, z: jnp.ndarray, batch: jnp.ndarray, training: Optional[bool]=None): Forward pass. | Implement the Python class `FlaxDecoder` described below.
Class description:
Decoder for Jax VAE.
Method signatures and docstrings:
- def setup(self): Setup decoder.
- def __call__(self, z: jnp.ndarray, batch: jnp.ndarray, training: Optional[bool]=None): Forward pass.
<|skeleton|>
class FlaxDecoder:
"""Decoder f... | 2cf00ecef4a04dfa2d35fb0fd3cb3aa0eb101330 | <|skeleton|>
class FlaxDecoder:
"""Decoder for Jax VAE."""
def setup(self):
"""Setup decoder."""
<|body_0|>
def __call__(self, z: jnp.ndarray, batch: jnp.ndarray, training: Optional[bool]=None):
"""Forward pass."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FlaxDecoder:
"""Decoder for Jax VAE."""
def setup(self):
"""Setup decoder."""
self.dense1 = Dense(self.n_hidden)
self.dense2 = Dense(self.n_hidden)
self.dense3 = Dense(self.n_hidden)
self.dense4 = Dense(self.n_hidden)
self.dense5 = Dense(self.n_input)
... | the_stack_v2_python_sparse | scvi/module/_jaxvae.py | jacobkimmel/scVI | train | 0 |
e10369851d43b784ca67e8b394d41a18519e295a | [
"process = CoconutDelivery()\nsteps = map(str, list(process))\nself.assertEqual(steps, ['swallows-needed', 'coconuts-needed'])",
"process = CoconutDelivery()\nprocess.coconuts = 1\nself.assertEqual(str(process.get_next_step()), 'swallows-needed')\nprocess.swallows = 2\nself.assertEqual(process.get_next_step(), No... | <|body_start_0|>
process = CoconutDelivery()
steps = map(str, list(process))
self.assertEqual(steps, ['swallows-needed', 'coconuts-needed'])
<|end_body_0|>
<|body_start_1|>
process = CoconutDelivery()
process.coconuts = 1
self.assertEqual(str(process.get_next_step()), 's... | ProcessManagerTest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProcessManagerTest:
def test_iter(self):
"""ProcessManager.__iter__() returns the steps"""
<|body_0|>
def test_get_next_step(self):
"""ProcessManager.get_next_step() returns the first step with invalid data"""
<|body_1|>
def test_is_complete(self):
... | stack_v2_sparse_classes_36k_train_011981 | 23,040 | no_license | [
{
"docstring": "ProcessManager.__iter__() returns the steps",
"name": "test_iter",
"signature": "def test_iter(self)"
},
{
"docstring": "ProcessManager.get_next_step() returns the first step with invalid data",
"name": "test_get_next_step",
"signature": "def test_get_next_step(self)"
}... | 5 | null | Implement the Python class `ProcessManagerTest` described below.
Class description:
Implement the ProcessManagerTest class.
Method signatures and docstrings:
- def test_iter(self): ProcessManager.__iter__() returns the steps
- def test_get_next_step(self): ProcessManager.get_next_step() returns the first step with in... | Implement the Python class `ProcessManagerTest` described below.
Class description:
Implement the ProcessManagerTest class.
Method signatures and docstrings:
- def test_iter(self): ProcessManager.__iter__() returns the steps
- def test_get_next_step(self): ProcessManager.get_next_step() returns the first step with in... | 0ac6653219c2701c13c508c5c4fc9bc3437eea06 | <|skeleton|>
class ProcessManagerTest:
def test_iter(self):
"""ProcessManager.__iter__() returns the steps"""
<|body_0|>
def test_get_next_step(self):
"""ProcessManager.get_next_step() returns the first step with invalid data"""
<|body_1|>
def test_is_complete(self):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ProcessManagerTest:
def test_iter(self):
"""ProcessManager.__iter__() returns the steps"""
process = CoconutDelivery()
steps = map(str, list(process))
self.assertEqual(steps, ['swallows-needed', 'coconuts-needed'])
def test_get_next_step(self):
"""ProcessManager.ge... | the_stack_v2_python_sparse | repoData/mirumee-satchless/allPythonContent.py | aCoffeeYin/pyreco | train | 0 | |
cac5bc80ce50617e784e8a2b96a40115440b6f16 | [
"super(DarknetConv2D_BN_Leaky, self).__init__()\nno_bias_kwargs = {'use_bias': False}\nno_bias_kwargs.update(kwargs)\nself.conv1 = DarknetConv2D(*args, **no_bias_kwargs)\nself.bn1 = tf.keras.layers.BatchNormalization()\nself.leaky_relu1 = tf.keras.layers.LeakyReLU(alpha=0.1)",
"x = self.conv1(x)\nx = self.bn1(x, ... | <|body_start_0|>
super(DarknetConv2D_BN_Leaky, self).__init__()
no_bias_kwargs = {'use_bias': False}
no_bias_kwargs.update(kwargs)
self.conv1 = DarknetConv2D(*args, **no_bias_kwargs)
self.bn1 = tf.keras.layers.BatchNormalization()
self.leaky_relu1 = tf.keras.layers.LeakyR... | DarknetConv2D_BN_Leaky | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DarknetConv2D_BN_Leaky:
def __init__(self, *args, **kwargs):
"""初始化网络"""
<|body_0|>
def call(self, x, training):
"""运算部分"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
super(DarknetConv2D_BN_Leaky, self).__init__()
no_bias_kwargs = {'use_bi... | stack_v2_sparse_classes_36k_train_011982 | 16,727 | no_license | [
{
"docstring": "初始化网络",
"name": "__init__",
"signature": "def __init__(self, *args, **kwargs)"
},
{
"docstring": "运算部分",
"name": "call",
"signature": "def call(self, x, training)"
}
] | 2 | null | Implement the Python class `DarknetConv2D_BN_Leaky` described below.
Class description:
Implement the DarknetConv2D_BN_Leaky class.
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): 初始化网络
- def call(self, x, training): 运算部分 | Implement the Python class `DarknetConv2D_BN_Leaky` described below.
Class description:
Implement the DarknetConv2D_BN_Leaky class.
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): 初始化网络
- def call(self, x, training): 运算部分
<|skeleton|>
class DarknetConv2D_BN_Leaky:
def __init__(self, *ar... | b7549701b0b1a7e4cc2c8275df2bc6c7a3253d24 | <|skeleton|>
class DarknetConv2D_BN_Leaky:
def __init__(self, *args, **kwargs):
"""初始化网络"""
<|body_0|>
def call(self, x, training):
"""运算部分"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DarknetConv2D_BN_Leaky:
def __init__(self, *args, **kwargs):
"""初始化网络"""
super(DarknetConv2D_BN_Leaky, self).__init__()
no_bias_kwargs = {'use_bias': False}
no_bias_kwargs.update(kwargs)
self.conv1 = DarknetConv2D(*args, **no_bias_kwargs)
self.bn1 = tf.keras.lay... | the_stack_v2_python_sparse | AIServer/ai_api/ai_models/utils/tf_yolo_utils.py | tfwcn/tensorflow2-machine-vision | train | 1 | |
793b9f393ca69ed8fb8cd628d77684031e5174b5 | [
"subsets_A = set()\nsubsets_B = set()\nused = set()\nfor i in range(len(graph)):\n if i not in used:\n subsets_A.add(i)\n cur_list = [i]\n count = 0\n while cur_list:\n next_list = []\n for j in cur_list:\n used.add(j)\n for opposite... | <|body_start_0|>
subsets_A = set()
subsets_B = set()
used = set()
for i in range(len(graph)):
if i not in used:
subsets_A.add(i)
cur_list = [i]
count = 0
while cur_list:
next_list = []
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def isBipartite(self, graph):
""":type graph: List[List[int]] :rtype: bool 514ms"""
<|body_0|>
def isBipartite_1(self, graph):
""":type graph: List[List[int]] :rtype: bool 50ms"""
<|body_1|>
def isBipartite_2(self, graph):
""":type grap... | stack_v2_sparse_classes_36k_train_011983 | 4,734 | no_license | [
{
"docstring": ":type graph: List[List[int]] :rtype: bool 514ms",
"name": "isBipartite",
"signature": "def isBipartite(self, graph)"
},
{
"docstring": ":type graph: List[List[int]] :rtype: bool 50ms",
"name": "isBipartite_1",
"signature": "def isBipartite_1(self, graph)"
},
{
"do... | 3 | stack_v2_sparse_classes_30k_train_021664 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isBipartite(self, graph): :type graph: List[List[int]] :rtype: bool 514ms
- def isBipartite_1(self, graph): :type graph: List[List[int]] :rtype: bool 50ms
- def isBipartite_2... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isBipartite(self, graph): :type graph: List[List[int]] :rtype: bool 514ms
- def isBipartite_1(self, graph): :type graph: List[List[int]] :rtype: bool 50ms
- def isBipartite_2... | 679a2b246b8b6bb7fc55ed1c8096d3047d6d4461 | <|skeleton|>
class Solution:
def isBipartite(self, graph):
""":type graph: List[List[int]] :rtype: bool 514ms"""
<|body_0|>
def isBipartite_1(self, graph):
""":type graph: List[List[int]] :rtype: bool 50ms"""
<|body_1|>
def isBipartite_2(self, graph):
""":type grap... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def isBipartite(self, graph):
""":type graph: List[List[int]] :rtype: bool 514ms"""
subsets_A = set()
subsets_B = set()
used = set()
for i in range(len(graph)):
if i not in used:
subsets_A.add(i)
cur_list = [i]
... | the_stack_v2_python_sparse | IsGraphBipartite_MID_785.py | 953250587/leetcode-python | train | 2 | |
ef74079c0ce3f76a35b637bed9a010c9d630d612 | [
"row, col = (-1, -1)\nfor i in range(len(matrix)):\n for j in range(len(matrix[i])):\n if matrix[i][j] == 0:\n row, col = (i, j)\nif row == -1 or col == -1:\n return\nfor i in range(len(matrix)):\n for j in range(len(matrix[i])):\n if matrix[i][j] == 0:\n matrix[i][col] ... | <|body_start_0|>
row, col = (-1, -1)
for i in range(len(matrix)):
for j in range(len(matrix[i])):
if matrix[i][j] == 0:
row, col = (i, j)
if row == -1 or col == -1:
return
for i in range(len(matrix)):
for j in range(... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def setZeroes(self, matrix):
""":type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead."""
<|body_0|>
def setZeroes_v2(self, matrix):
""":type matrix: List[List[int]] :rtype: void Do not return anything, modify mat... | stack_v2_sparse_classes_36k_train_011984 | 2,791 | no_license | [
{
"docstring": ":type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.",
"name": "setZeroes",
"signature": "def setZeroes(self, matrix)"
},
{
"docstring": ":type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instea... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def setZeroes(self, matrix): :type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.
- def setZeroes_v2(self, matrix): :type matrix: Li... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def setZeroes(self, matrix): :type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.
- def setZeroes_v2(self, matrix): :type matrix: Li... | e60ba45fe2f2e5e3b3abfecec3db76f5ce1fde59 | <|skeleton|>
class Solution:
def setZeroes(self, matrix):
""":type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead."""
<|body_0|>
def setZeroes_v2(self, matrix):
""":type matrix: List[List[int]] :rtype: void Do not return anything, modify mat... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def setZeroes(self, matrix):
""":type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead."""
row, col = (-1, -1)
for i in range(len(matrix)):
for j in range(len(matrix[i])):
if matrix[i][j] == 0:
... | the_stack_v2_python_sparse | src/lt_73.py | oxhead/CodingYourWay | train | 0 | |
8117d728d2792f5e316aaffed7e09c5954657638 | [
"def bsearch(wanted):\n start = 0\n end = len(numbers) - 1\n while start + 1 < end:\n mid = start + (end - start) / 2\n if numbers[mid] == wanted:\n return mid\n elif numbers[mid] > wanted:\n end = mid\n else:\n start = mid\n if numbers[start]... | <|body_start_0|>
def bsearch(wanted):
start = 0
end = len(numbers) - 1
while start + 1 < end:
mid = start + (end - start) / 2
if numbers[mid] == wanted:
return mid
elif numbers[mid] > wanted:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def twoSumBinarySearch(self, numbers, target):
""":type numbers: List[int] :type target: int :rtype: List[int]"""
<|body_0|>
def twoSum(self, numbers, target):
""":type numbers: List[int] :type target: int :rtype: List[int]"""
<|body_1|>
<|end_skel... | stack_v2_sparse_classes_36k_train_011985 | 2,237 | no_license | [
{
"docstring": ":type numbers: List[int] :type target: int :rtype: List[int]",
"name": "twoSumBinarySearch",
"signature": "def twoSumBinarySearch(self, numbers, target)"
},
{
"docstring": ":type numbers: List[int] :type target: int :rtype: List[int]",
"name": "twoSum",
"signature": "def ... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def twoSumBinarySearch(self, numbers, target): :type numbers: List[int] :type target: int :rtype: List[int]
- def twoSum(self, numbers, target): :type numbers: List[int] :type ta... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def twoSumBinarySearch(self, numbers, target): :type numbers: List[int] :type target: int :rtype: List[int]
- def twoSum(self, numbers, target): :type numbers: List[int] :type ta... | d1666d44226274f13af25cf878cd63a24e1c5528 | <|skeleton|>
class Solution:
def twoSumBinarySearch(self, numbers, target):
""":type numbers: List[int] :type target: int :rtype: List[int]"""
<|body_0|>
def twoSum(self, numbers, target):
""":type numbers: List[int] :type target: int :rtype: List[int]"""
<|body_1|>
<|end_skel... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def twoSumBinarySearch(self, numbers, target):
""":type numbers: List[int] :type target: int :rtype: List[int]"""
def bsearch(wanted):
start = 0
end = len(numbers) - 1
while start + 1 < end:
mid = start + (end - start) / 2
... | the_stack_v2_python_sparse | DP/LeetCode167_TwoSumII_InputArrayIsSorted.py | rexhzhang/LeetCodeProbelms | train | 0 | |
241ef0f5d59ff12b9faee262aa85915498c394a6 | [
"frame = self.last_frame if frame is None else frame\ngroup = self.last_group if group is None else group\nif index is None:\n if orb > -1:\n return self[(self['frame'] == frame) & (self['group'] == group) & (self[orbocc] == 0) & (self['spin'] == spin)].iloc[orb]\n else:\n return self[(self['fra... | <|body_start_0|>
frame = self.last_frame if frame is None else frame
group = self.last_group if group is None else group
if index is None:
if orb > -1:
return self[(self['frame'] == frame) & (self['group'] == group) & (self[orbocc] == 0) & (self['spin'] == spin)].iloc... | +-------------------+----------+-------------------------------------------+ | Column | Type | Description | +===================+==========+===========================================+ | frame | category | non-unique integer (req.) | +-------------------+----------+-------------------------------------------+ | group ... | Orbital | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Orbital:
"""+-------------------+----------+-------------------------------------------+ | Column | Type | Description | +===================+==========+===========================================+ | frame | category | non-unique integer (req.) | +-------------------+----------+------------------... | stack_v2_sparse_classes_36k_train_011986 | 21,790 | permissive | [
{
"docstring": "Returns a specific orbital. Args: orb (int): See note below (default HOMO) spin (int): 0, no spin or alpha (default); 1, beta index (int): Orbital dataframe index (default None) frame (int): The frame of the universe (default max(frame)) group (int): The group of orbitals within a given frame or... | 4 | null | Implement the Python class `Orbital` described below.
Class description:
+-------------------+----------+-------------------------------------------+ | Column | Type | Description | +===================+==========+===========================================+ | frame | category | non-unique integer (req.) | +----------... | Implement the Python class `Orbital` described below.
Class description:
+-------------------+----------+-------------------------------------------+ | Column | Type | Description | +===================+==========+===========================================+ | frame | category | non-unique integer (req.) | +----------... | 2e87bae3e043e6958129fc823c83ab0b46add8b5 | <|skeleton|>
class Orbital:
"""+-------------------+----------+-------------------------------------------+ | Column | Type | Description | +===================+==========+===========================================+ | frame | category | non-unique integer (req.) | +-------------------+----------+------------------... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Orbital:
"""+-------------------+----------+-------------------------------------------+ | Column | Type | Description | +===================+==========+===========================================+ | frame | category | non-unique integer (req.) | +-------------------+----------+-------------------------------... | the_stack_v2_python_sparse | exatomic/core/orbital.py | exa-analytics/exatomic | train | 15 |
4d50cccd27ca7273815b2f284a4d0ead400b804a | [
"l_s = []\nfor c in s:\n l_s.append(c)\nl_s_set = set(l_s)\nif len(l_s_set) == 1:\n print('True')\n return True\nlen_s = len(l_s)\nif len_s % 2 == 0:\n mid = int(len_s / 2)\n for i in range(0, mid):\n if l_s[i] == l_s[mid + i]:\n continue\n else:\n print('False')\n... | <|body_start_0|>
l_s = []
for c in s:
l_s.append(c)
l_s_set = set(l_s)
if len(l_s_set) == 1:
print('True')
return True
len_s = len(l_s)
if len_s % 2 == 0:
mid = int(len_s / 2)
for i in range(0, mid):
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def repeatedSubstringPattern(self, s):
""":type s: str :rtype: bool"""
<|body_0|>
def repeatedSubstringPattern2(self, str):
""":type str: str :rtype: bool"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
l_s = []
for c in s:
... | stack_v2_sparse_classes_36k_train_011987 | 1,170 | no_license | [
{
"docstring": ":type s: str :rtype: bool",
"name": "repeatedSubstringPattern",
"signature": "def repeatedSubstringPattern(self, s)"
},
{
"docstring": ":type str: str :rtype: bool",
"name": "repeatedSubstringPattern2",
"signature": "def repeatedSubstringPattern2(self, str)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def repeatedSubstringPattern(self, s): :type s: str :rtype: bool
- def repeatedSubstringPattern2(self, str): :type str: str :rtype: bool | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def repeatedSubstringPattern(self, s): :type s: str :rtype: bool
- def repeatedSubstringPattern2(self, str): :type str: str :rtype: bool
<|skeleton|>
class Solution:
def re... | c2250f2c7365976a6767e3c12760474f7a6618eb | <|skeleton|>
class Solution:
def repeatedSubstringPattern(self, s):
""":type s: str :rtype: bool"""
<|body_0|>
def repeatedSubstringPattern2(self, str):
""":type str: str :rtype: bool"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def repeatedSubstringPattern(self, s):
""":type s: str :rtype: bool"""
l_s = []
for c in s:
l_s.append(c)
l_s_set = set(l_s)
if len(l_s_set) == 1:
print('True')
return True
len_s = len(l_s)
if len_s % 2 == 0:... | the_stack_v2_python_sparse | 459. Repeated Substring Pattern.py | yaolinxia/leetcode_study | train | 0 | |
46a3b9ca803ecad00181a4b9949ad1d58cd86526 | [
"rval = []\nfor group in trans.sa_session.query(trans.app.model.Group).filter(trans.app.model.Group.table.c.deleted == false()):\n if trans.user_is_admin():\n item = group.to_dict(value_mapper={'id': trans.security.encode_id})\n encoded_id = trans.security.encode_id(group.id)\n item['url'] =... | <|body_start_0|>
rval = []
for group in trans.sa_session.query(trans.app.model.Group).filter(trans.app.model.Group.table.c.deleted == false()):
if trans.user_is_admin():
item = group.to_dict(value_mapper={'id': trans.security.encode_id})
encoded_id = trans.sec... | GroupAPIController | [
"CC-BY-2.5",
"AFL-2.1",
"AFL-3.0",
"CC-BY-3.0",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GroupAPIController:
def index(self, trans, **kwd):
"""GET /api/groups Displays a collection (list) of groups."""
<|body_0|>
def create(self, trans, payload, **kwd):
"""POST /api/groups Creates a new group."""
<|body_1|>
def show(self, trans, id, **kwd):
... | stack_v2_sparse_classes_36k_train_011988 | 5,279 | permissive | [
{
"docstring": "GET /api/groups Displays a collection (list) of groups.",
"name": "index",
"signature": "def index(self, trans, **kwd)"
},
{
"docstring": "POST /api/groups Creates a new group.",
"name": "create",
"signature": "def create(self, trans, payload, **kwd)"
},
{
"docstr... | 4 | null | Implement the Python class `GroupAPIController` described below.
Class description:
Implement the GroupAPIController class.
Method signatures and docstrings:
- def index(self, trans, **kwd): GET /api/groups Displays a collection (list) of groups.
- def create(self, trans, payload, **kwd): POST /api/groups Creates a n... | Implement the Python class `GroupAPIController` described below.
Class description:
Implement the GroupAPIController class.
Method signatures and docstrings:
- def index(self, trans, **kwd): GET /api/groups Displays a collection (list) of groups.
- def create(self, trans, payload, **kwd): POST /api/groups Creates a n... | 1ad89511540e6800cd2d0da5d878c1c77d8ccfe9 | <|skeleton|>
class GroupAPIController:
def index(self, trans, **kwd):
"""GET /api/groups Displays a collection (list) of groups."""
<|body_0|>
def create(self, trans, payload, **kwd):
"""POST /api/groups Creates a new group."""
<|body_1|>
def show(self, trans, id, **kwd):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GroupAPIController:
def index(self, trans, **kwd):
"""GET /api/groups Displays a collection (list) of groups."""
rval = []
for group in trans.sa_session.query(trans.app.model.Group).filter(trans.app.model.Group.table.c.deleted == false()):
if trans.user_is_admin():
... | the_stack_v2_python_sparse | lib/galaxy/webapps/galaxy/api/groups.py | abretaud/galaxy | train | 0 | |
2f350ee383cd59ea05eb65d38181925129342165 | [
"self.key_dict = {}\nself.head = Node()\nself.tail = self.head",
"node = None\nif self.key_dict.has_key(key):\n node = self.key_dict[key]\n del node.key_map[key]\nelse:\n node = self.head\nif node.next == None:\n node.next = Node(node.value + 1, {key: 1})\n node.next.prev = node\n self.tail = no... | <|body_start_0|>
self.key_dict = {}
self.head = Node()
self.tail = self.head
<|end_body_0|>
<|body_start_1|>
node = None
if self.key_dict.has_key(key):
node = self.key_dict[key]
del node.key_map[key]
else:
node = self.head
if n... | AllOne | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AllOne:
def __init__(self):
"""Initialize your data structure here."""
<|body_0|>
def inc(self, key):
"""Inserts a new key <Key> with value 1. Or increments an existing key by 1. :type key: str :rtype: void"""
<|body_1|>
def dec(self, key):
"""De... | stack_v2_sparse_classes_36k_train_011989 | 2,962 | no_license | [
{
"docstring": "Initialize your data structure here.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Inserts a new key <Key> with value 1. Or increments an existing key by 1. :type key: str :rtype: void",
"name": "inc",
"signature": "def inc(self, key)"
},
... | 5 | stack_v2_sparse_classes_30k_train_013997 | Implement the Python class `AllOne` described below.
Class description:
Implement the AllOne class.
Method signatures and docstrings:
- def __init__(self): Initialize your data structure here.
- def inc(self, key): Inserts a new key <Key> with value 1. Or increments an existing key by 1. :type key: str :rtype: void
-... | Implement the Python class `AllOne` described below.
Class description:
Implement the AllOne class.
Method signatures and docstrings:
- def __init__(self): Initialize your data structure here.
- def inc(self, key): Inserts a new key <Key> with value 1. Or increments an existing key by 1. :type key: str :rtype: void
-... | e5dd213411b5c82b07171c3adf4556dcf9c44207 | <|skeleton|>
class AllOne:
def __init__(self):
"""Initialize your data structure here."""
<|body_0|>
def inc(self, key):
"""Inserts a new key <Key> with value 1. Or increments an existing key by 1. :type key: str :rtype: void"""
<|body_1|>
def dec(self, key):
"""De... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AllOne:
def __init__(self):
"""Initialize your data structure here."""
self.key_dict = {}
self.head = Node()
self.tail = self.head
def inc(self, key):
"""Inserts a new key <Key> with value 1. Or increments an existing key by 1. :type key: str :rtype: void"""
... | the_stack_v2_python_sparse | python/432.all-oone-data-structure.py | songzy12/LeetCode | train | 4 | |
1c6315bf1ee497701ab03a0319aa9cf1024b13f0 | [
"url = '/account/'\nresponse = self.client.get(url, HTTP_HOST='website.domain')\nself.assertEqual(response.status_code, 302)",
"url = '/account/'\nself.client.login(username=self.adminUN, password='pass')\nresponse = self.client.get(url, HTTP_HOST='website.domain')\nself.assertEqual(response.status_code, 200)",
... | <|body_start_0|>
url = '/account/'
response = self.client.get(url, HTTP_HOST='website.domain')
self.assertEqual(response.status_code, 302)
<|end_body_0|>
<|body_start_1|>
url = '/account/'
self.client.login(username=self.adminUN, password='pass')
response = self.client.g... | AccountTestCase | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AccountTestCase:
def test_not_logged_in(self):
"""Test that the acount view will redirect to index page whilst not logged in."""
<|body_0|>
def test_logged_in_admin(self):
"""Test that the account view will load whilst logged in as admin."""
<|body_1|>
d... | stack_v2_sparse_classes_36k_train_011990 | 26,818 | permissive | [
{
"docstring": "Test that the acount view will redirect to index page whilst not logged in.",
"name": "test_not_logged_in",
"signature": "def test_not_logged_in(self)"
},
{
"docstring": "Test that the account view will load whilst logged in as admin.",
"name": "test_logged_in_admin",
"si... | 3 | null | Implement the Python class `AccountTestCase` described below.
Class description:
Implement the AccountTestCase class.
Method signatures and docstrings:
- def test_not_logged_in(self): Test that the acount view will redirect to index page whilst not logged in.
- def test_logged_in_admin(self): Test that the account vi... | Implement the Python class `AccountTestCase` described below.
Class description:
Implement the AccountTestCase class.
Method signatures and docstrings:
- def test_not_logged_in(self): Test that the acount view will redirect to index page whilst not logged in.
- def test_logged_in_admin(self): Test that the account vi... | 37d2942efcbdaad072f7a06ac876a40e0f69f702 | <|skeleton|>
class AccountTestCase:
def test_not_logged_in(self):
"""Test that the acount view will redirect to index page whilst not logged in."""
<|body_0|>
def test_logged_in_admin(self):
"""Test that the account view will load whilst logged in as admin."""
<|body_1|>
d... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AccountTestCase:
def test_not_logged_in(self):
"""Test that the acount view will redirect to index page whilst not logged in."""
url = '/account/'
response = self.client.get(url, HTTP_HOST='website.domain')
self.assertEqual(response.status_code, 302)
def test_logged_in_adm... | the_stack_v2_python_sparse | mooring/test_views.py | dbca-wa/moorings | train | 0 | |
894afbec7420c31c65df42d3e367218c3ff39e16 | [
"if fused in (True, None):\n raise ValueError('The TPU version of BatchNormalization does not support fused=True.')\nself.max_shards_for_local = max_shards_for_local\nsuper(BatchNormalization, self).__init__(fused=fused, **kwargs)",
"num_shards = tpu_function.get_tpu_context().number_of_shards\ngroup_assignmen... | <|body_start_0|>
if fused in (True, None):
raise ValueError('The TPU version of BatchNormalization does not support fused=True.')
self.max_shards_for_local = max_shards_for_local
super(BatchNormalization, self).__init__(fused=fused, **kwargs)
<|end_body_0|>
<|body_start_1|>
... | Batch Normalization layer that supports cross replica computation on TPU. This class extends the keras.BatchNormalization implementation by supporting cross replica means and variances. The base class implementation only computes moments based on mini-batch per replica (TPU core). For detailed information of arguments ... | BatchNormalization | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BatchNormalization:
"""Batch Normalization layer that supports cross replica computation on TPU. This class extends the keras.BatchNormalization implementation by supporting cross replica means and variances. The base class implementation only computes moments based on mini-batch per replica (TPU... | stack_v2_sparse_classes_36k_train_011991 | 26,918 | permissive | [
{
"docstring": "Builds the batch normalization layer. Arguments: fused: If `False`, use the system recommended implementation. Only support `False` in the current implementation. max_shards_for_local: The maximum number of TPU shards that should use local Batch Normalization. Any larger number of shards will us... | 3 | stack_v2_sparse_classes_30k_train_001752 | Implement the Python class `BatchNormalization` described below.
Class description:
Batch Normalization layer that supports cross replica computation on TPU. This class extends the keras.BatchNormalization implementation by supporting cross replica means and variances. The base class implementation only computes momen... | Implement the Python class `BatchNormalization` described below.
Class description:
Batch Normalization layer that supports cross replica computation on TPU. This class extends the keras.BatchNormalization implementation by supporting cross replica means and variances. The base class implementation only computes momen... | 0f7adb97a93ec3e3485c261d030c507eb16b33e4 | <|skeleton|>
class BatchNormalization:
"""Batch Normalization layer that supports cross replica computation on TPU. This class extends the keras.BatchNormalization implementation by supporting cross replica means and variances. The base class implementation only computes moments based on mini-batch per replica (TPU... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BatchNormalization:
"""Batch Normalization layer that supports cross replica computation on TPU. This class extends the keras.BatchNormalization implementation by supporting cross replica means and variances. The base class implementation only computes moments based on mini-batch per replica (TPU core). For d... | the_stack_v2_python_sparse | models/official/detection/modeling/architecture/nn_ops.py | tensorflow/tpu | train | 5,627 |
d3076f357c7ba8fa3d1d33199cbb74411a6e5590 | [
"assert isinstance(response, scrapy.http.response.html.HtmlResponse)\nBOARDS = ['charterboatuk boats']\nURLS = ['http://www.charterboats-uk.co.uk/england']\nPAGES = [18]\nassert len(BOARDS) == len(URLS) == len(PAGES), 'Setup list lengths DO NOT match'\nfor i, root_url in enumerate(URLS):\n curboard = BOARDS[i]\n... | <|body_start_0|>
assert isinstance(response, scrapy.http.response.html.HtmlResponse)
BOARDS = ['charterboatuk boats']
URLS = ['http://www.charterboats-uk.co.uk/england']
PAGES = [18]
assert len(BOARDS) == len(URLS) == len(PAGES), 'Setup list lengths DO NOT match'
for i, r... | scrape all the text in on the boat details tab to write to ugc | CharterBoatUKBoatTextSpider | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CharterBoatUKBoatTextSpider:
"""scrape all the text in on the boat details tab to write to ugc"""
def parse(self, response):
"""generate links to pages in a board"""
<|body_0|>
def crawl_boats(self, response):
"""each page with links to 10 boats details"""
... | stack_v2_sparse_classes_36k_train_011992 | 17,953 | no_license | [
{
"docstring": "generate links to pages in a board",
"name": "parse",
"signature": "def parse(self, response)"
},
{
"docstring": "each page with links to 10 boats details",
"name": "crawl_boats",
"signature": "def crawl_boats(self, response)"
},
{
"docstring": "crawl",
"name"... | 3 | stack_v2_sparse_classes_30k_train_011859 | Implement the Python class `CharterBoatUKBoatTextSpider` described below.
Class description:
scrape all the text in on the boat details tab to write to ugc
Method signatures and docstrings:
- def parse(self, response): generate links to pages in a board
- def crawl_boats(self, response): each page with links to 10 bo... | Implement the Python class `CharterBoatUKBoatTextSpider` described below.
Class description:
scrape all the text in on the boat details tab to write to ugc
Method signatures and docstrings:
- def parse(self, response): generate links to pages in a board
- def crawl_boats(self, response): each page with links to 10 bo... | 9123aa6baf538b662143b9098d963d55165e8409 | <|skeleton|>
class CharterBoatUKBoatTextSpider:
"""scrape all the text in on the boat details tab to write to ugc"""
def parse(self, response):
"""generate links to pages in a board"""
<|body_0|>
def crawl_boats(self, response):
"""each page with links to 10 boats details"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CharterBoatUKBoatTextSpider:
"""scrape all the text in on the boat details tab to write to ugc"""
def parse(self, response):
"""generate links to pages in a board"""
assert isinstance(response, scrapy.http.response.html.HtmlResponse)
BOARDS = ['charterboatuk boats']
URLS =... | the_stack_v2_python_sparse | imgscrape/spiders/charterboatuk.py | gmonkman/python | train | 0 |
1cf0c7496dd65a76e2ca3a2cf871e6a1843adb46 | [
"try:\n InvitationService.validate_token(invitation_token)\n response, status = ({}, http_status.HTTP_200_OK)\nexcept BusinessException as exception:\n response, status = ({'code': exception.code, 'message': exception.message}, exception.status_code)\nreturn (response, status)",
"origin = request.environ... | <|body_start_0|>
try:
InvitationService.validate_token(invitation_token)
response, status = ({}, http_status.HTTP_200_OK)
except BusinessException as exception:
response, status = ({'code': exception.code, 'message': exception.message}, exception.status_code)
... | Check whether a token is valid. | InvitationAction | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InvitationAction:
"""Check whether a token is valid."""
def get(invitation_token):
"""Check whether the passed token is valid."""
<|body_0|>
def put(invitation_token):
"""Check whether the passed token is valid and add user, role and org from invitation to member... | stack_v2_sparse_classes_36k_train_011993 | 6,644 | permissive | [
{
"docstring": "Check whether the passed token is valid.",
"name": "get",
"signature": "def get(invitation_token)"
},
{
"docstring": "Check whether the passed token is valid and add user, role and org from invitation to membership.",
"name": "put",
"signature": "def put(invitation_token)... | 2 | null | Implement the Python class `InvitationAction` described below.
Class description:
Check whether a token is valid.
Method signatures and docstrings:
- def get(invitation_token): Check whether the passed token is valid.
- def put(invitation_token): Check whether the passed token is valid and add user, role and org from... | Implement the Python class `InvitationAction` described below.
Class description:
Check whether a token is valid.
Method signatures and docstrings:
- def get(invitation_token): Check whether the passed token is valid.
- def put(invitation_token): Check whether the passed token is valid and add user, role and org from... | 923cb8a3ee88dcbaf0fe800ca70022b3c13c1d01 | <|skeleton|>
class InvitationAction:
"""Check whether a token is valid."""
def get(invitation_token):
"""Check whether the passed token is valid."""
<|body_0|>
def put(invitation_token):
"""Check whether the passed token is valid and add user, role and org from invitation to member... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class InvitationAction:
"""Check whether a token is valid."""
def get(invitation_token):
"""Check whether the passed token is valid."""
try:
InvitationService.validate_token(invitation_token)
response, status = ({}, http_status.HTTP_200_OK)
except BusinessExcepti... | the_stack_v2_python_sparse | auth-api/src/auth_api/resources/invitation.py | bcgov/sbc-auth | train | 13 |
26b3c811b63a8830fd70c3379de87ed922188807 | [
"deck.sort()\ni = 0\nres = collections.deque()\nwhile deck:\n if i % 2 == 0:\n res.appendleft(deck.pop())\n else:\n res.appendleft(res.pop())\n i += 1\nreturn res",
"deck.sort()\nres = collections.deque()\nres.append(deck.pop())\nfor i in reversed(deck):\n res.appendleft(res.pop())\n ... | <|body_start_0|>
deck.sort()
i = 0
res = collections.deque()
while deck:
if i % 2 == 0:
res.appendleft(deck.pop())
else:
res.appendleft(res.pop())
i += 1
return res
<|end_body_0|>
<|body_start_1|>
deck.s... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def deckRevealedIncreasing(self, deck):
""":type deck: List[int] :rtype: List[int]"""
<|body_0|>
def deckRevealedIncreasing(self, deck):
""":type deck: List[int] :rtype: List[int]"""
<|body_1|>
def deckRevealedIncreasing(self, deck):
""... | stack_v2_sparse_classes_36k_train_011994 | 1,522 | no_license | [
{
"docstring": ":type deck: List[int] :rtype: List[int]",
"name": "deckRevealedIncreasing",
"signature": "def deckRevealedIncreasing(self, deck)"
},
{
"docstring": ":type deck: List[int] :rtype: List[int]",
"name": "deckRevealedIncreasing",
"signature": "def deckRevealedIncreasing(self, ... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def deckRevealedIncreasing(self, deck): :type deck: List[int] :rtype: List[int]
- def deckRevealedIncreasing(self, deck): :type deck: List[int] :rtype: List[int]
- def deckReveal... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def deckRevealedIncreasing(self, deck): :type deck: List[int] :rtype: List[int]
- def deckRevealedIncreasing(self, deck): :type deck: List[int] :rtype: List[int]
- def deckReveal... | a509b383a42f54313970168d9faa11f088f18708 | <|skeleton|>
class Solution:
def deckRevealedIncreasing(self, deck):
""":type deck: List[int] :rtype: List[int]"""
<|body_0|>
def deckRevealedIncreasing(self, deck):
""":type deck: List[int] :rtype: List[int]"""
<|body_1|>
def deckRevealedIncreasing(self, deck):
""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def deckRevealedIncreasing(self, deck):
""":type deck: List[int] :rtype: List[int]"""
deck.sort()
i = 0
res = collections.deque()
while deck:
if i % 2 == 0:
res.appendleft(deck.pop())
else:
res.appendleft... | the_stack_v2_python_sparse | 0950_Reveal_Cards_In_Increasing_Order.py | bingli8802/leetcode | train | 0 | |
f08aa98227e6a746cad12b2f3b2966ca1ad7fb24 | [
"Questionnaire.__init__(self, df)\nself.name = 'AIMS_General'\nself.labels = ['Affect Intensity Measure - General']\nself.values = {'AIMS_General': {}}\nself.code_dic = aims_dic",
"aims_df = pd.DataFrame(index=self.df.index, columns=self.df.columns)\nfor i in range(self.df.shape[0]):\n for j in range(self.df.s... | <|body_start_0|>
Questionnaire.__init__(self, df)
self.name = 'AIMS_General'
self.labels = ['Affect Intensity Measure - General']
self.values = {'AIMS_General': {}}
self.code_dic = aims_dic
<|end_body_0|>
<|body_start_1|>
aims_df = pd.DataFrame(index=self.df.index, colum... | A class used to represent an the Affect Intensity Measure Questionnaire Attributes ---------- df : DataFrame a Pandas data frame with the specific columns for the questionnaire Methods ------- grade() calculate the grading of the questionnaire | AIMS | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AIMS:
"""A class used to represent an the Affect Intensity Measure Questionnaire Attributes ---------- df : DataFrame a Pandas data frame with the specific columns for the questionnaire Methods ------- grade() calculate the grading of the questionnaire"""
def __init__(self, df):
"""I... | stack_v2_sparse_classes_36k_train_011995 | 1,766 | no_license | [
{
"docstring": "Init the following arguments: name = the new column name (after grading) labels = labels for column to be written in the SPSS output file values = explanation for the value for SPSS column - empty for this questionaire self.code_dic = a dictionary from each pharse to a number Parameters --------... | 2 | stack_v2_sparse_classes_30k_train_021681 | Implement the Python class `AIMS` described below.
Class description:
A class used to represent an the Affect Intensity Measure Questionnaire Attributes ---------- df : DataFrame a Pandas data frame with the specific columns for the questionnaire Methods ------- grade() calculate the grading of the questionnaire
Meth... | Implement the Python class `AIMS` described below.
Class description:
A class used to represent an the Affect Intensity Measure Questionnaire Attributes ---------- df : DataFrame a Pandas data frame with the specific columns for the questionnaire Methods ------- grade() calculate the grading of the questionnaire
Meth... | 26b8a2847d7202b61e67e2cd0074278a46a9f8f3 | <|skeleton|>
class AIMS:
"""A class used to represent an the Affect Intensity Measure Questionnaire Attributes ---------- df : DataFrame a Pandas data frame with the specific columns for the questionnaire Methods ------- grade() calculate the grading of the questionnaire"""
def __init__(self, df):
"""I... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AIMS:
"""A class used to represent an the Affect Intensity Measure Questionnaire Attributes ---------- df : DataFrame a Pandas data frame with the specific columns for the questionnaire Methods ------- grade() calculate the grading of the questionnaire"""
def __init__(self, df):
"""Init the follo... | the_stack_v2_python_sparse | Questionnaires/AIMS.py | TechnionENIC/ENIC_scoring_program | train | 0 |
b4fd9bffee583db8cc45237db4c0604fa3a2c574 | [
"super(ActorTransformSetter, self).__init__(name)\nself._actor = actor\nself._transform = transform\nself._physics = physics\nself.logger.debug('%s.__init__()' % self.__class__.__name__)",
"new_status = py_trees.common.Status.RUNNING\nif self._actor.is_alive:\n self._actor.set_velocity(carla.Vector3D(0, 0, 0))... | <|body_start_0|>
super(ActorTransformSetter, self).__init__(name)
self._actor = actor
self._transform = transform
self._physics = physics
self.logger.debug('%s.__init__()' % self.__class__.__name__)
<|end_body_0|>
<|body_start_1|>
new_status = py_trees.common.Status.RUNN... | This class contains an atomic behavior to set the transform of an actor. Important parameters: - actor: CARLA actor to execute the behavior - transform: New target transform (position + orientation) of the actor - physics [optional]: If physics is true, the actor physics will be reactivated upon success The behavior te... | ActorTransformSetter | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ActorTransformSetter:
"""This class contains an atomic behavior to set the transform of an actor. Important parameters: - actor: CARLA actor to execute the behavior - transform: New target transform (position + orientation) of the actor - physics [optional]: If physics is true, the actor physics ... | stack_v2_sparse_classes_36k_train_011996 | 39,839 | permissive | [
{
"docstring": "Init",
"name": "__init__",
"signature": "def __init__(self, actor, transform, physics=True, name='ActorTransformSetter')"
},
{
"docstring": "Transform actor",
"name": "update",
"signature": "def update(self)"
}
] | 2 | null | Implement the Python class `ActorTransformSetter` described below.
Class description:
This class contains an atomic behavior to set the transform of an actor. Important parameters: - actor: CARLA actor to execute the behavior - transform: New target transform (position + orientation) of the actor - physics [optional]:... | Implement the Python class `ActorTransformSetter` described below.
Class description:
This class contains an atomic behavior to set the transform of an actor. Important parameters: - actor: CARLA actor to execute the behavior - transform: New target transform (position + orientation) of the actor - physics [optional]:... | 8ab0894b92e1f994802a218002021ee075c405bf | <|skeleton|>
class ActorTransformSetter:
"""This class contains an atomic behavior to set the transform of an actor. Important parameters: - actor: CARLA actor to execute the behavior - transform: New target transform (position + orientation) of the actor - physics [optional]: If physics is true, the actor physics ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ActorTransformSetter:
"""This class contains an atomic behavior to set the transform of an actor. Important parameters: - actor: CARLA actor to execute the behavior - transform: New target transform (position + orientation) of the actor - physics [optional]: If physics is true, the actor physics will be react... | the_stack_v2_python_sparse | carla_rllib/carla_rllib-prak_evaluator-carla_rllib-prak_evaluator/carla_rllib/prak_evaluator/srunner/scenarioconfigs/scenariomanager/scenarioatomics/atomic_behaviors.py | TinaMenke/Deep-Reinforcement-Learning | train | 9 |
b8ca325f77e298a8750cbf50f8324eb99f53d67a | [
"result = is_leap(1990)\nself.assertEquals(result, False)\nreturn",
"result = is_leap(2000)\nself.assertEquals(result, True)\nreturn",
"result = is_leap(2400)\nself.assertEquals(result, True)\nreturn"
] | <|body_start_0|>
result = is_leap(1990)
self.assertEquals(result, False)
return
<|end_body_0|>
<|body_start_1|>
result = is_leap(2000)
self.assertEquals(result, True)
return
<|end_body_1|>
<|body_start_2|>
result = is_leap(2400)
self.assertEquals(result,... | Description | TestWriteAFunction | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestWriteAFunction:
"""Description"""
def test_hackerrank_sample1(self):
"""Verify provided test case."""
<|body_0|>
def test_hackerrank_sample2(self):
"""Verify provided test case."""
<|body_1|>
def test_hackerrank_sample3(self):
"""Verify p... | stack_v2_sparse_classes_36k_train_011997 | 707 | no_license | [
{
"docstring": "Verify provided test case.",
"name": "test_hackerrank_sample1",
"signature": "def test_hackerrank_sample1(self)"
},
{
"docstring": "Verify provided test case.",
"name": "test_hackerrank_sample2",
"signature": "def test_hackerrank_sample2(self)"
},
{
"docstring": "... | 3 | stack_v2_sparse_classes_30k_train_019574 | Implement the Python class `TestWriteAFunction` described below.
Class description:
Description
Method signatures and docstrings:
- def test_hackerrank_sample1(self): Verify provided test case.
- def test_hackerrank_sample2(self): Verify provided test case.
- def test_hackerrank_sample3(self): Verify provided test ca... | Implement the Python class `TestWriteAFunction` described below.
Class description:
Description
Method signatures and docstrings:
- def test_hackerrank_sample1(self): Verify provided test case.
- def test_hackerrank_sample2(self): Verify provided test case.
- def test_hackerrank_sample3(self): Verify provided test ca... | fcf3755b62fe0644af763875e3a00be962941a6d | <|skeleton|>
class TestWriteAFunction:
"""Description"""
def test_hackerrank_sample1(self):
"""Verify provided test case."""
<|body_0|>
def test_hackerrank_sample2(self):
"""Verify provided test case."""
<|body_1|>
def test_hackerrank_sample3(self):
"""Verify p... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestWriteAFunction:
"""Description"""
def test_hackerrank_sample1(self):
"""Verify provided test case."""
result = is_leap(1990)
self.assertEquals(result, False)
return
def test_hackerrank_sample2(self):
"""Verify provided test case."""
result = is_lea... | the_stack_v2_python_sparse | python3/write_a_function/test_write_a_function.py | ayazhemani/hackerrank-py | train | 0 |
e7006182bc3f9a55106d69e7a908bd54208a51d8 | [
"email = self.cleaned_data['email']\ntry:\n ad_rep_lead = AdRepLead.objects.get(email=email)\n ad_rep_lead.first_name = self.cleaned_data.get('first_name') or ad_rep_lead.first_name\n ad_rep_lead.last_name = self.cleaned_data.get('last_name') or ad_rep_lead.last_name\n ad_rep_lead.primary_phone_number =... | <|body_start_0|>
email = self.cleaned_data['email']
try:
ad_rep_lead = AdRepLead.objects.get(email=email)
ad_rep_lead.first_name = self.cleaned_data.get('first_name') or ad_rep_lead.first_name
ad_rep_lead.last_name = self.cleaned_data.get('last_name') or ad_rep_lead.l... | Ad Rep lead generator. | AdRepLeadForm | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AdRepLeadForm:
"""Ad Rep lead generator."""
def add_or_update_ad_rep_lead(self, consumer, site):
"""Add or update ad rep lead from consumer."""
<|body_0|>
def set_ad_rep(request, ad_rep_lead):
"""Set ad rep for this ad rep lead."""
<|body_1|>
def cle... | stack_v2_sparse_classes_36k_train_011998 | 7,830 | no_license | [
{
"docstring": "Add or update ad rep lead from consumer.",
"name": "add_or_update_ad_rep_lead",
"signature": "def add_or_update_ad_rep_lead(self, consumer, site)"
},
{
"docstring": "Set ad rep for this ad rep lead.",
"name": "set_ad_rep",
"signature": "def set_ad_rep(request, ad_rep_lead... | 5 | null | Implement the Python class `AdRepLeadForm` described below.
Class description:
Ad Rep lead generator.
Method signatures and docstrings:
- def add_or_update_ad_rep_lead(self, consumer, site): Add or update ad rep lead from consumer.
- def set_ad_rep(request, ad_rep_lead): Set ad rep for this ad rep lead.
- def clean(s... | Implement the Python class `AdRepLeadForm` described below.
Class description:
Ad Rep lead generator.
Method signatures and docstrings:
- def add_or_update_ad_rep_lead(self, consumer, site): Add or update ad rep lead from consumer.
- def set_ad_rep(request, ad_rep_lead): Set ad rep for this ad rep lead.
- def clean(s... | a780ccdc3350d4b5c7990c65d1af8d71060c62cc | <|skeleton|>
class AdRepLeadForm:
"""Ad Rep lead generator."""
def add_or_update_ad_rep_lead(self, consumer, site):
"""Add or update ad rep lead from consumer."""
<|body_0|>
def set_ad_rep(request, ad_rep_lead):
"""Set ad rep for this ad rep lead."""
<|body_1|>
def cle... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AdRepLeadForm:
"""Ad Rep lead generator."""
def add_or_update_ad_rep_lead(self, consumer, site):
"""Add or update ad rep lead from consumer."""
email = self.cleaned_data['email']
try:
ad_rep_lead = AdRepLead.objects.get(email=email)
ad_rep_lead.first_name =... | the_stack_v2_python_sparse | firestorm/forms.py | wcirillo/ten | train | 0 |
4f03e1d3ebd12b0f7bb4078c5733d9a3d4874507 | [
"super().__init__(self.PROBLEM_NAME)\nself.number_vertices = number_vertices\nself.adjacency_list = adjacency_list",
"print('Solving {} problem ...'.format(self.PROBLEM_NAME))\nparent_list = [i for i in range(self.number_vertices)]\nunion_find = UnionFind(parent_list)\nfor i, j in self.adjacency_list:\n union_... | <|body_start_0|>
super().__init__(self.PROBLEM_NAME)
self.number_vertices = number_vertices
self.adjacency_list = adjacency_list
<|end_body_0|>
<|body_start_1|>
print('Solving {} problem ...'.format(self.PROBLEM_NAME))
parent_list = [i for i in range(self.number_vertices)]
... | FindConnectedComponents | FindConnectedComponents | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FindConnectedComponents:
"""FindConnectedComponents"""
def __init__(self, number_vertices, adjacency_list):
"""Find Connected Components Args: number_vertices: Number of vertices adjacency_list: Adjacency List Returns: None Raises: None"""
<|body_0|>
def solve(self):
... | stack_v2_sparse_classes_36k_train_011999 | 1,416 | no_license | [
{
"docstring": "Find Connected Components Args: number_vertices: Number of vertices adjacency_list: Adjacency List Returns: None Raises: None",
"name": "__init__",
"signature": "def __init__(self, number_vertices, adjacency_list)"
},
{
"docstring": "Solve the problem Note: Args: Returns: Boolean... | 2 | null | Implement the Python class `FindConnectedComponents` described below.
Class description:
FindConnectedComponents
Method signatures and docstrings:
- def __init__(self, number_vertices, adjacency_list): Find Connected Components Args: number_vertices: Number of vertices adjacency_list: Adjacency List Returns: None Rai... | Implement the Python class `FindConnectedComponents` described below.
Class description:
FindConnectedComponents
Method signatures and docstrings:
- def __init__(self, number_vertices, adjacency_list): Find Connected Components Args: number_vertices: Number of vertices adjacency_list: Adjacency List Returns: None Rai... | 11f4d25cb211740514c119a60962d075a0817abd | <|skeleton|>
class FindConnectedComponents:
"""FindConnectedComponents"""
def __init__(self, number_vertices, adjacency_list):
"""Find Connected Components Args: number_vertices: Number of vertices adjacency_list: Adjacency List Returns: None Raises: None"""
<|body_0|>
def solve(self):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FindConnectedComponents:
"""FindConnectedComponents"""
def __init__(self, number_vertices, adjacency_list):
"""Find Connected Components Args: number_vertices: Number of vertices adjacency_list: Adjacency List Returns: None Raises: None"""
super().__init__(self.PROBLEM_NAME)
self.... | the_stack_v2_python_sparse | python/problems/graphs/find_connected_components.py | santhosh-kumar/AlgorithmsAndDataStructures | train | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.