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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4d929bd237c2b8ed8a9e44c0745aa42e0645ccfd | [
"self.args = self.argument_parser()\nself.path = self.args['path']\nself.msg = self.args['msg']\nif self.args.get('no_confirm', False):\n pass\nelse:\n self.confirm_run(self.args)\nreturn None",
"parser = argparse.ArgumentParser(prog='commitpermodule', formatter_class=argparse.RawTextHelpFormatter, descript... | <|body_start_0|>
self.args = self.argument_parser()
self.path = self.args['path']
self.msg = self.args['msg']
if self.args.get('no_confirm', False):
pass
else:
self.confirm_run(self.args)
return None
<|end_body_0|>
<|body_start_1|>
parser ... | This object pretend to get and odoo addons path and aplicate one commit for every module. It is usefull when apply a gobal change in all the modules via script and want to commit the change per module. | CommitPerModule | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CommitPerModule:
"""This object pretend to get and odoo addons path and aplicate one commit for every module. It is usefull when apply a gobal change in all the modules via script and want to commit the change per module."""
def __init__(self):
"""Initialization of the class. @return... | stack_v2_sparse_classes_36k_train_015200 | 4,618 | no_license | [
{
"docstring": "Initialization of the class. @return: None",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "This function create the help command line, manage and filter the parameters of this script (default values, choices values). @return dictionary of the arguments.... | 5 | null | Implement the Python class `CommitPerModule` described below.
Class description:
This object pretend to get and odoo addons path and aplicate one commit for every module. It is usefull when apply a gobal change in all the modules via script and want to commit the change per module.
Method signatures and docstrings:
-... | Implement the Python class `CommitPerModule` described below.
Class description:
This object pretend to get and odoo addons path and aplicate one commit for every module. It is usefull when apply a gobal change in all the modules via script and want to commit the change per module.
Method signatures and docstrings:
-... | 190ef5e596db53084dd8c62ce5864730c1b00667 | <|skeleton|>
class CommitPerModule:
"""This object pretend to get and odoo addons path and aplicate one commit for every module. It is usefull when apply a gobal change in all the modules via script and want to commit the change per module."""
def __init__(self):
"""Initialization of the class. @return... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CommitPerModule:
"""This object pretend to get and odoo addons path and aplicate one commit for every module. It is usefull when apply a gobal change in all the modules via script and want to commit the change per module."""
def __init__(self):
"""Initialization of the class. @return: None"""
... | the_stack_v2_python_sparse | commitpermodule | vauxoo-dev/gist-vauxoo | train | 4 |
5db307096b939a19f1160000defbc60887c96dcf | [
"df_impressions = fb.build_features(df)\nf.print_time('target column')\ndf_impressions.loc[:, 'is_clicked'] = (df_impressions['referenced_item'] == df_impressions['impressed_item']).astype(int)\nfeatures = ['position', 'prices', 'interaction_count', 'is_last_interacted']\nX = df_impressions[features]\ny = df_impres... | <|body_start_0|>
df_impressions = fb.build_features(df)
f.print_time('target column')
df_impressions.loc[:, 'is_clicked'] = (df_impressions['referenced_item'] == df_impressions['impressed_item']).astype(int)
features = ['position', 'prices', 'interaction_count', 'is_last_interacted']
... | Model class for the logistic regression model. Methods fit(df): Fit the model on training data predict(df): Calculate recommendations for test data | ModelLogReg | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ModelLogReg:
"""Model class for the logistic regression model. Methods fit(df): Fit the model on training data predict(df): Calculate recommendations for test data"""
def fit(self, df):
"""Train the logistic regression model."""
<|body_0|>
def predict(self, df):
... | stack_v2_sparse_classes_36k_train_015201 | 2,096 | permissive | [
{
"docstring": "Train the logistic regression model.",
"name": "fit",
"signature": "def fit(self, df)"
},
{
"docstring": "Calculate click probability based on trained logistic regression model.",
"name": "predict",
"signature": "def predict(self, df)"
}
] | 2 | stack_v2_sparse_classes_30k_train_013640 | Implement the Python class `ModelLogReg` described below.
Class description:
Model class for the logistic regression model. Methods fit(df): Fit the model on training data predict(df): Calculate recommendations for test data
Method signatures and docstrings:
- def fit(self, df): Train the logistic regression model.
-... | Implement the Python class `ModelLogReg` described below.
Class description:
Model class for the logistic regression model. Methods fit(df): Fit the model on training data predict(df): Calculate recommendations for test data
Method signatures and docstrings:
- def fit(self, df): Train the logistic regression model.
-... | 9e54a88b9fd2f5451e9b9108872b28a320cb2f09 | <|skeleton|>
class ModelLogReg:
"""Model class for the logistic regression model. Methods fit(df): Fit the model on training data predict(df): Calculate recommendations for test data"""
def fit(self, df):
"""Train the logistic regression model."""
<|body_0|>
def predict(self, df):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ModelLogReg:
"""Model class for the logistic regression model. Methods fit(df): Fit the model on training data predict(df): Calculate recommendations for test data"""
def fit(self, df):
"""Train the logistic regression model."""
df_impressions = fb.build_features(df)
f.print_time(... | the_stack_v2_python_sparse | src/models/model_log_reg.py | dav009/recsys-challenge-2019-benchmarks | train | 0 |
a46283fa8c81bc5889ce89e05829576bcbff6ecc | [
"if not email:\n raise ValueError('Users must have an email address')\nuser = self.model(email=MyUserManager.normalize_email(email), username=username)\nuser.set_password(password)\nuser.save(using=self._db)\nreturn user",
"user = self.create_user(username, email, password=password)\nuser.is_admin = True\nuser... | <|body_start_0|>
if not email:
raise ValueError('Users must have an email address')
user = self.model(email=MyUserManager.normalize_email(email), username=username)
user.set_password(password)
user.save(using=self._db)
return user
<|end_body_0|>
<|body_start_1|>
... | MyUserManager | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MyUserManager:
def create_user(self, username, email=None, password=None):
"""Creates and saves a User with the given email, date of birth and password."""
<|body_0|>
def create_superuser(self, username, email, password):
"""Creates and saves a superuser with the giv... | stack_v2_sparse_classes_36k_train_015202 | 8,453 | permissive | [
{
"docstring": "Creates and saves a User with the given email, date of birth and password.",
"name": "create_user",
"signature": "def create_user(self, username, email=None, password=None)"
},
{
"docstring": "Creates and saves a superuser with the given email, date of birth and password.",
"... | 2 | stack_v2_sparse_classes_30k_val_000791 | Implement the Python class `MyUserManager` described below.
Class description:
Implement the MyUserManager class.
Method signatures and docstrings:
- def create_user(self, username, email=None, password=None): Creates and saves a User with the given email, date of birth and password.
- def create_superuser(self, user... | Implement the Python class `MyUserManager` described below.
Class description:
Implement the MyUserManager class.
Method signatures and docstrings:
- def create_user(self, username, email=None, password=None): Creates and saves a User with the given email, date of birth and password.
- def create_superuser(self, user... | 17db2adec1870213ae246c44f5c80e98042a295f | <|skeleton|>
class MyUserManager:
def create_user(self, username, email=None, password=None):
"""Creates and saves a User with the given email, date of birth and password."""
<|body_0|>
def create_superuser(self, username, email, password):
"""Creates and saves a superuser with the giv... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MyUserManager:
def create_user(self, username, email=None, password=None):
"""Creates and saves a User with the given email, date of birth and password."""
if not email:
raise ValueError('Users must have an email address')
user = self.model(email=MyUserManager.normalize_ema... | the_stack_v2_python_sparse | bloodon/accounts/models.py | houssemFat/bloodOn | train | 2 | |
4e25a1ee4bf90e43e20c1dc9f47cbbc79efa16a7 | [
"forms = [row.doc for row in self.db.view('form', 'enabled', include_docs=True)]\nfor form in forms:\n if form.get('ordinal') is None:\n form['ordinal'] = 0\nforms.sort(key=lambda i: i['ordinal'])\nif not self.current_user:\n self.render('home/anonymous.html', forms=forms)\nelif self.current_user['role... | <|body_start_0|>
forms = [row.doc for row in self.db.view('form', 'enabled', include_docs=True)]
for form in forms:
if form.get('ordinal') is None:
form['ordinal'] = 0
forms.sort(key=lambda i: i['ordinal'])
if not self.current_user:
self.render('ho... | Home page; dashboard. Contents according to role of logged-in account. | Home | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Home:
"""Home page; dashboard. Contents according to role of logged-in account."""
def get(self):
"""Home page; contents depends on the role of the logged-in account, if any."""
<|body_0|>
def home_admin(self, **kwargs):
"""Home page for a current user having rol... | stack_v2_sparse_classes_36k_train_015203 | 7,366 | permissive | [
{
"docstring": "Home page; contents depends on the role of the logged-in account, if any.",
"name": "get",
"signature": "def get(self)"
},
{
"docstring": "Home page for a current user having role 'admin'.",
"name": "home_admin",
"signature": "def home_admin(self, **kwargs)"
},
{
... | 4 | stack_v2_sparse_classes_30k_train_001013 | Implement the Python class `Home` described below.
Class description:
Home page; dashboard. Contents according to role of logged-in account.
Method signatures and docstrings:
- def get(self): Home page; contents depends on the role of the logged-in account, if any.
- def home_admin(self, **kwargs): Home page for a cu... | Implement the Python class `Home` described below.
Class description:
Home page; dashboard. Contents according to role of logged-in account.
Method signatures and docstrings:
- def get(self): Home page; contents depends on the role of the logged-in account, if any.
- def home_admin(self, **kwargs): Home page for a cu... | ac02295cd33f4be562152c7b0ae3ab7cb11735d9 | <|skeleton|>
class Home:
"""Home page; dashboard. Contents according to role of logged-in account."""
def get(self):
"""Home page; contents depends on the role of the logged-in account, if any."""
<|body_0|>
def home_admin(self, **kwargs):
"""Home page for a current user having rol... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Home:
"""Home page; dashboard. Contents according to role of logged-in account."""
def get(self):
"""Home page; contents depends on the role of the logged-in account, if any."""
forms = [row.doc for row in self.db.view('form', 'enabled', include_docs=True)]
for form in forms:
... | the_stack_v2_python_sparse | orderportal/home.py | pekrau/OrderPortal | train | 7 |
6e4a9d4a40e8dcc07926c246199ecd8bb52237df | [
"if n == 1:\n return 9\nmaxb = 10 ** n - 1\nminb = 10 ** (n - 1)\ni = maxb\nwhile i > minb:\n mix = self.buildPalindrome(i)\n j = maxb\n while j * j >= mix:\n if mix % j == 0 and mix / j <= maxb:\n return mix % 1337\n j -= 1\n i -= 1\nreturn -1",
"s = str(x)[::-1]\npaNum = ... | <|body_start_0|>
if n == 1:
return 9
maxb = 10 ** n - 1
minb = 10 ** (n - 1)
i = maxb
while i > minb:
mix = self.buildPalindrome(i)
j = maxb
while j * j >= mix:
if mix % j == 0 and mix / j <= maxb:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def largestPalindrome(self, n):
""":type n: int :rtype: int"""
<|body_0|>
def buildPalindrome(self, x):
""":type x: int :rtype: long"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if n == 1:
return 9
maxb = 10 ** n - 1... | stack_v2_sparse_classes_36k_train_015204 | 678 | no_license | [
{
"docstring": ":type n: int :rtype: int",
"name": "largestPalindrome",
"signature": "def largestPalindrome(self, n)"
},
{
"docstring": ":type x: int :rtype: long",
"name": "buildPalindrome",
"signature": "def buildPalindrome(self, x)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def largestPalindrome(self, n): :type n: int :rtype: int
- def buildPalindrome(self, x): :type x: int :rtype: long | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def largestPalindrome(self, n): :type n: int :rtype: int
- def buildPalindrome(self, x): :type x: int :rtype: long
<|skeleton|>
class Solution:
def largestPalindrome(self, ... | 11ef4ace7aa1f875491163d036935dd76d8b89e0 | <|skeleton|>
class Solution:
def largestPalindrome(self, n):
""":type n: int :rtype: int"""
<|body_0|>
def buildPalindrome(self, x):
""":type x: int :rtype: long"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def largestPalindrome(self, n):
""":type n: int :rtype: int"""
if n == 1:
return 9
maxb = 10 ** n - 1
minb = 10 ** (n - 1)
i = maxb
while i > minb:
mix = self.buildPalindrome(i)
j = maxb
while j * j >= mi... | the_stack_v2_python_sparse | leetcode/largestPalindrome.py | lilyandcy/python3 | train | 1 | |
c36c4efd427de80e7173125dfbd54babcba7724c | [
"text = re.sub('(\\\\n+|\\\\t+|\\\\r+)', ' ', text)\ntext = re.sub('\\\\s+', ' ', text)\nreturn text.strip()",
"trash_index = text.find(trash_sign)\nif trash_index != -1:\n text = text[trash_index + len(trash_sign):]\nreturn text.strip()",
"trash_index = text.find(trash_sign)\nif trash_index != -1:\n text... | <|body_start_0|>
text = re.sub('(\\n+|\\t+|\\r+)', ' ', text)
text = re.sub('\\s+', ' ', text)
return text.strip()
<|end_body_0|>
<|body_start_1|>
trash_index = text.find(trash_sign)
if trash_index != -1:
text = text[trash_index + len(trash_sign):]
return tex... | 总结一些常用的文本清晰方法 方便以后loader.processor调用 | CleanText | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CleanText:
"""总结一些常用的文本清晰方法 方便以后loader.processor调用"""
def clean_white_space(cls, text):
"""只是简单针对文本进行空白清洗,类方法 :param text: 待清洗文本"""
<|body_0|>
def remove_begin_part(cls, text, trash_sign):
"""移除字符串开头的一部分,目前做法比较简答 找到垃圾文本的识别字符串,删除匹配字符串以及之前的文本 text -> 'This is an ad... | stack_v2_sparse_classes_36k_train_015205 | 8,763 | no_license | [
{
"docstring": "只是简单针对文本进行空白清洗,类方法 :param text: 待清洗文本",
"name": "clean_white_space",
"signature": "def clean_white_space(cls, text)"
},
{
"docstring": "移除字符串开头的一部分,目前做法比较简答 找到垃圾文本的识别字符串,删除匹配字符串以及之前的文本 text -> 'This is an advertisement. This is the text we want.' trash_sign -> 'advertisement.' re... | 3 | null | Implement the Python class `CleanText` described below.
Class description:
总结一些常用的文本清晰方法 方便以后loader.processor调用
Method signatures and docstrings:
- def clean_white_space(cls, text): 只是简单针对文本进行空白清洗,类方法 :param text: 待清洗文本
- def remove_begin_part(cls, text, trash_sign): 移除字符串开头的一部分,目前做法比较简答 找到垃圾文本的识别字符串,删除匹配字符串以及之前的文本 t... | Implement the Python class `CleanText` described below.
Class description:
总结一些常用的文本清晰方法 方便以后loader.processor调用
Method signatures and docstrings:
- def clean_white_space(cls, text): 只是简单针对文本进行空白清洗,类方法 :param text: 待清洗文本
- def remove_begin_part(cls, text, trash_sign): 移除字符串开头的一部分,目前做法比较简答 找到垃圾文本的识别字符串,删除匹配字符串以及之前的文本 t... | 1b42878b694fabc65a02228662ffdf819e5dcc71 | <|skeleton|>
class CleanText:
"""总结一些常用的文本清晰方法 方便以后loader.processor调用"""
def clean_white_space(cls, text):
"""只是简单针对文本进行空白清洗,类方法 :param text: 待清洗文本"""
<|body_0|>
def remove_begin_part(cls, text, trash_sign):
"""移除字符串开头的一部分,目前做法比较简答 找到垃圾文本的识别字符串,删除匹配字符串以及之前的文本 text -> 'This is an ad... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CleanText:
"""总结一些常用的文本清晰方法 方便以后loader.processor调用"""
def clean_white_space(cls, text):
"""只是简单针对文本进行空白清洗,类方法 :param text: 待清洗文本"""
text = re.sub('(\\n+|\\t+|\\r+)', ' ', text)
text = re.sub('\\s+', ' ', text)
return text.strip()
def remove_begin_part(cls, text, trash... | the_stack_v2_python_sparse | vivo_public_modules/vivo_itemloaders.py | wangsanshi123/spiders | train | 0 |
042db8150433131b2b5f55d64201442cf0794dcf | [
"if not o:\n return None\nreturn TreeNode().revert(o)",
"if not o:\n return []\nr = []\nq = deque([o])\nwhile q:\n p = q.popleft()\n if p:\n r.append(p.v)\n else:\n r.append(None)\n if p and p.cl:\n q.append(p.cl)\n if p and p.cr:\n q.append(p.cr)\nreturn r"
] | <|body_start_0|>
if not o:
return None
return TreeNode().revert(o)
<|end_body_0|>
<|body_start_1|>
if not o:
return []
r = []
q = deque([o])
while q:
p = q.popleft()
if p:
r.append(p.v)
else:
... | Output | [
"Unlicense"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Output:
def stdout(self, o):
"""Converts input binary search tree to array. :param ListNode o: head node of linked list :return: array representing binary search tree :rtype: list[int]"""
<|body_0|>
def transform_bst(self, o):
"""Converts binary search tree into arra... | stack_v2_sparse_classes_36k_train_015206 | 4,204 | permissive | [
{
"docstring": "Converts input binary search tree to array. :param ListNode o: head node of linked list :return: array representing binary search tree :rtype: list[int]",
"name": "stdout",
"signature": "def stdout(self, o)"
},
{
"docstring": "Converts binary search tree into array representation... | 2 | null | Implement the Python class `Output` described below.
Class description:
Implement the Output class.
Method signatures and docstrings:
- def stdout(self, o): Converts input binary search tree to array. :param ListNode o: head node of linked list :return: array representing binary search tree :rtype: list[int]
- def tr... | Implement the Python class `Output` described below.
Class description:
Implement the Output class.
Method signatures and docstrings:
- def stdout(self, o): Converts input binary search tree to array. :param ListNode o: head node of linked list :return: array representing binary search tree :rtype: list[int]
- def tr... | 69f90877c5466927e8b081c4268cbcda074813ec | <|skeleton|>
class Output:
def stdout(self, o):
"""Converts input binary search tree to array. :param ListNode o: head node of linked list :return: array representing binary search tree :rtype: list[int]"""
<|body_0|>
def transform_bst(self, o):
"""Converts binary search tree into arra... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Output:
def stdout(self, o):
"""Converts input binary search tree to array. :param ListNode o: head node of linked list :return: array representing binary search tree :rtype: list[int]"""
if not o:
return None
return TreeNode().revert(o)
def transform_bst(self, o):
... | the_stack_v2_python_sparse | 0108_convert_sorted_array_binary_search_tree/python_source.py | arthurdysart/LeetCode | train | 0 | |
a3ef47102e3358db03c5d1a09c4006672ca4997d | [
"class YahooCalendarScraper(ScraperBase):\n \"\"\"\n current yahoo calendar scraper class\n \"\"\"\n\n def scrape_worker(self):\n \"\"\"\n the abstract method implementation - does all the scraping work\n \"\"\"\n s_url = 'http://biz.yahoo.com/... | <|body_start_0|>
class YahooCalendarScraper(ScraperBase):
"""
current yahoo calendar scraper class
"""
def scrape_worker(self):
"""
the abstract method implementation - does all the scraping work
... | module tests | ModuleTests | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ModuleTests:
"""module tests"""
def test01():
"""tests class derivation and basic scraping usage for html"""
<|body_0|>
def test02():
"""tests class derivation and basic scraping usage for rss"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
clas... | stack_v2_sparse_classes_36k_train_015207 | 7,741 | permissive | [
{
"docstring": "tests class derivation and basic scraping usage for html",
"name": "test01",
"signature": "def test01()"
},
{
"docstring": "tests class derivation and basic scraping usage for rss",
"name": "test02",
"signature": "def test02()"
}
] | 2 | stack_v2_sparse_classes_30k_train_001287 | Implement the Python class `ModuleTests` described below.
Class description:
module tests
Method signatures and docstrings:
- def test01(): tests class derivation and basic scraping usage for html
- def test02(): tests class derivation and basic scraping usage for rss | Implement the Python class `ModuleTests` described below.
Class description:
module tests
Method signatures and docstrings:
- def test01(): tests class derivation and basic scraping usage for html
- def test02(): tests class derivation and basic scraping usage for rss
<|skeleton|>
class ModuleTests:
"""module te... | 5373ed0f259b264f0e54d9be97a4fbbe1d169248 | <|skeleton|>
class ModuleTests:
"""module tests"""
def test01():
"""tests class derivation and basic scraping usage for html"""
<|body_0|>
def test02():
"""tests class derivation and basic scraping usage for rss"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ModuleTests:
"""module tests"""
def test01():
"""tests class derivation and basic scraping usage for html"""
class YahooCalendarScraper(ScraperBase):
"""
current yahoo calendar scraper class
"""
def scrape_worker(self):
... | the_stack_v2_python_sparse | scraper_base.py | dorontal/python-scrapers | train | 0 |
9e693986a4cb626cfd6ebfbaef62a86d5ae52e27 | [
"max_profit, min_price = (0, float('inf'))\nfor price in prices:\n min_price = min(min_price, price)\n profit = price - min_price\n max_profit = max(max_profit, profit)\nreturn max_profit",
"maxprofit = 0\nfor i in range(len(prices)):\n for j in range(i + 1, len(prices)):\n profit = prices[j] -... | <|body_start_0|>
max_profit, min_price = (0, float('inf'))
for price in prices:
min_price = min(min_price, price)
profit = price - min_price
max_profit = max(max_profit, profit)
return max_profit
<|end_body_0|>
<|body_start_1|>
maxprofit = 0
f... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxProfit(self, prices):
"""Kadane's algorithm Time O(n) space O(1) :type prices: List[int] :rtype: int"""
<|body_0|>
def maxProfit_brute_force(self, prices):
"""Brute Force Time O(n^2) space O(1) :type prices: List[int] :rtype: int"""
<|body_1|... | stack_v2_sparse_classes_36k_train_015208 | 1,037 | no_license | [
{
"docstring": "Kadane's algorithm Time O(n) space O(1) :type prices: List[int] :rtype: int",
"name": "maxProfit",
"signature": "def maxProfit(self, prices)"
},
{
"docstring": "Brute Force Time O(n^2) space O(1) :type prices: List[int] :rtype: int",
"name": "maxProfit_brute_force",
"sign... | 2 | stack_v2_sparse_classes_30k_train_007773 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxProfit(self, prices): Kadane's algorithm Time O(n) space O(1) :type prices: List[int] :rtype: int
- def maxProfit_brute_force(self, prices): Brute Force Time O(n^2) space ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxProfit(self, prices): Kadane's algorithm Time O(n) space O(1) :type prices: List[int] :rtype: int
- def maxProfit_brute_force(self, prices): Brute Force Time O(n^2) space ... | 85f71621c54f6b0029f3a2746f022f89dd7419d9 | <|skeleton|>
class Solution:
def maxProfit(self, prices):
"""Kadane's algorithm Time O(n) space O(1) :type prices: List[int] :rtype: int"""
<|body_0|>
def maxProfit_brute_force(self, prices):
"""Brute Force Time O(n^2) space O(1) :type prices: List[int] :rtype: int"""
<|body_1|... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def maxProfit(self, prices):
"""Kadane's algorithm Time O(n) space O(1) :type prices: List[int] :rtype: int"""
max_profit, min_price = (0, float('inf'))
for price in prices:
min_price = min(min_price, price)
profit = price - min_price
max_p... | the_stack_v2_python_sparse | LeetCode/Array/121_best_time_to_buy_and_sell_stock.py | XyK0907/for_work | train | 0 | |
323fbf297b315da011bfa37c0c891b3776120d89 | [
"self.id = None\nself.type = None\nself.instance_outputs = []\nself.debug = debug\nif self.debug:\n print('Parameter - init')",
"if self.debug:\n print('is_no_echo')\nsys.exit(1)",
"if self.debug:\n print('to_s')\nsys.exit(1)",
"if self.debug:\n print('method_missing')\nsys.exit(1)",
"if self.de... | <|body_start_0|>
self.id = None
self.type = None
self.instance_outputs = []
self.debug = debug
if self.debug:
print('Parameter - init')
<|end_body_0|>
<|body_start_1|>
if self.debug:
print('is_no_echo')
sys.exit(1)
<|end_body_1|>
<|body_s... | Locals model | Locals | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Locals:
"""Locals model"""
def __init__(self, debug=False):
"""Initialize :param debug:"""
<|body_0|>
def is_no_echo(self):
"""??? :return:"""
<|body_1|>
def to_string(self):
"""??? :return:"""
<|body_2|>
def method_missing(self,... | stack_v2_sparse_classes_36k_train_015209 | 1,776 | permissive | [
{
"docstring": "Initialize :param debug:",
"name": "__init__",
"signature": "def __init__(self, debug=False)"
},
{
"docstring": "??? :return:",
"name": "is_no_echo",
"signature": "def is_no_echo(self)"
},
{
"docstring": "??? :return:",
"name": "to_string",
"signature": "d... | 5 | stack_v2_sparse_classes_30k_val_000884 | Implement the Python class `Locals` described below.
Class description:
Locals model
Method signatures and docstrings:
- def __init__(self, debug=False): Initialize :param debug:
- def is_no_echo(self): ??? :return:
- def to_string(self): ??? :return:
- def method_missing(self, method_name, *args): ??? :param method_... | Implement the Python class `Locals` described below.
Class description:
Locals model
Method signatures and docstrings:
- def __init__(self, debug=False): Initialize :param debug:
- def is_no_echo(self): ??? :return:
- def to_string(self): ??? :return:
- def method_missing(self, method_name, *args): ??? :param method_... | a9d0335a532acdb4070e5537155b03b34915b73e | <|skeleton|>
class Locals:
"""Locals model"""
def __init__(self, debug=False):
"""Initialize :param debug:"""
<|body_0|>
def is_no_echo(self):
"""??? :return:"""
<|body_1|>
def to_string(self):
"""??? :return:"""
<|body_2|>
def method_missing(self,... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Locals:
"""Locals model"""
def __init__(self, debug=False):
"""Initialize :param debug:"""
self.id = None
self.type = None
self.instance_outputs = []
self.debug = debug
if self.debug:
print('Parameter - init')
def is_no_echo(self):
... | the_stack_v2_python_sparse | terraform_model/model/Locals.py | rubelw/terraform-validator | train | 7 |
f54ec085be5c729407250033b3875df55ba4db9f | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn WorkbookRangeView()",
"from .entity import Entity\nfrom .json import Json\nfrom .entity import Entity\nfrom .json import Json\nfields: Dict[str, Callable[[Any], None]] = {'cellAddresses': lambda n: setattr(self, 'cell_addresses', n.get... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return WorkbookRangeView()
<|end_body_0|>
<|body_start_1|>
from .entity import Entity
from .json import Json
from .entity import Entity
from .json import Json
fields: Di... | WorkbookRangeView | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WorkbookRangeView:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WorkbookRangeView:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object... | stack_v2_sparse_classes_36k_train_015210 | 5,332 | permissive | [
{
"docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: WorkbookRangeView",
"name": "create_from_discriminator_value",
"signature": "def create_from_discriminator_v... | 3 | stack_v2_sparse_classes_30k_train_001857 | Implement the Python class `WorkbookRangeView` described below.
Class description:
Implement the WorkbookRangeView class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WorkbookRangeView: Creates a new instance of the appropriate class based on discrim... | Implement the Python class `WorkbookRangeView` described below.
Class description:
Implement the WorkbookRangeView class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WorkbookRangeView: Creates a new instance of the appropriate class based on discrim... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class WorkbookRangeView:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WorkbookRangeView:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class WorkbookRangeView:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WorkbookRangeView:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: Work... | the_stack_v2_python_sparse | msgraph/generated/models/workbook_range_view.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
dcf26af44efbf3d2013b5fd0f7909b927dfe3076 | [
"self = object.__new__(cls)\nself.handler = handler\nself.touhou_character = touhou_character\nreturn self",
"if event.user is not event.message.interaction.user:\n return\nimage_detail = await self.handler.get_image(client, event)\nembed = build_touhou_character_embed(self.touhou_character, image_detail)\nif ... | <|body_start_0|>
self = object.__new__(cls)
self.handler = handler
self.touhou_character = touhou_character
return self
<|end_body_0|>
<|body_start_1|>
if event.user is not event.message.interaction.user:
return
image_detail = await self.handler.get_image(cli... | Represents a component command used to renew a touhou character. Attributes ---------- handler : ``ImageHandlerBase`` The handler to use. touhou_character : ``TouhouCharacter`` The respective touhou character. | NewTouhouCharacter | [
"LicenseRef-scancode-warranty-disclaimer"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NewTouhouCharacter:
"""Represents a component command used to renew a touhou character. Attributes ---------- handler : ``ImageHandlerBase`` The handler to use. touhou_character : ``TouhouCharacter`` The respective touhou character."""
def __new__(cls, handler, touhou_character):
"""... | stack_v2_sparse_classes_36k_train_015211 | 4,132 | no_license | [
{
"docstring": "Creates a new touhou character renewer. Parameters ---------- handler : ``ImageHandlerBase`` The handler to use. touhou_character : ``TouhouCharacter`` The respective touhou character.",
"name": "__new__",
"signature": "def __new__(cls, handler, touhou_character)"
},
{
"docstring... | 2 | null | Implement the Python class `NewTouhouCharacter` described below.
Class description:
Represents a component command used to renew a touhou character. Attributes ---------- handler : ``ImageHandlerBase`` The handler to use. touhou_character : ``TouhouCharacter`` The respective touhou character.
Method signatures and do... | Implement the Python class `NewTouhouCharacter` described below.
Class description:
Represents a component command used to renew a touhou character. Attributes ---------- handler : ``ImageHandlerBase`` The handler to use. touhou_character : ``TouhouCharacter`` The respective touhou character.
Method signatures and do... | 74f92b598e86606ea3a269311316cddd84a5215f | <|skeleton|>
class NewTouhouCharacter:
"""Represents a component command used to renew a touhou character. Attributes ---------- handler : ``ImageHandlerBase`` The handler to use. touhou_character : ``TouhouCharacter`` The respective touhou character."""
def __new__(cls, handler, touhou_character):
"""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NewTouhouCharacter:
"""Represents a component command used to renew a touhou character. Attributes ---------- handler : ``ImageHandlerBase`` The handler to use. touhou_character : ``TouhouCharacter`` The respective touhou character."""
def __new__(cls, handler, touhou_character):
"""Creates a new... | the_stack_v2_python_sparse | koishi/plugins/image_handling_commands/touhou_character/touhou_character.py | HuyaneMatsu/Koishi | train | 17 |
dacb9de057271ca74bdaa23fd5f12f803983ed4d | [
"_max, sec, third = (float('-inf'), float('-inf'), float('-inf'))\nfor num in nums:\n if num > _max:\n third = sec\n sec = _max\n _max = num\n elif num < _max and num > sec:\n third = sec\n sec = num\n elif num < sec and num > third:\n third = num\nreturn third if ... | <|body_start_0|>
_max, sec, third = (float('-inf'), float('-inf'), float('-inf'))
for num in nums:
if num > _max:
third = sec
sec = _max
_max = num
elif num < _max and num > sec:
third = sec
sec = num... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def thirdMax(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def thirdMax2(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
_max, sec, third = (float('-inf'), float('-inf'), ... | stack_v2_sparse_classes_36k_train_015212 | 2,163 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "thirdMax",
"signature": "def thirdMax(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "thirdMax2",
"signature": "def thirdMax2(self, nums)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def thirdMax(self, nums): :type nums: List[int] :rtype: int
- def thirdMax2(self, nums): :type nums: List[int] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def thirdMax(self, nums): :type nums: List[int] :rtype: int
- def thirdMax2(self, nums): :type nums: List[int] :rtype: int
<|skeleton|>
class Solution:
def thirdMax(self, n... | 546cbce06fcd4bc34e16d42b5d5eb68fb25e16a9 | <|skeleton|>
class Solution:
def thirdMax(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def thirdMax2(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def thirdMax(self, nums):
""":type nums: List[int] :rtype: int"""
_max, sec, third = (float('-inf'), float('-inf'), float('-inf'))
for num in nums:
if num > _max:
third = sec
sec = _max
_max = num
elif nu... | the_stack_v2_python_sparse | leetcode/solution_414.py | eselyavka/python | train | 0 | |
2456f608b19a6f936dcf23c816ba5679b2cf48fb | [
"super().__init__()\nself.query_emb = nn.Linear(args['target_agent_enc_size'], args['emb_size'])\nself.key_emb = nn.Linear(args['context_enc_size'], args['emb_size'])\nself.val_emb = nn.Linear(args['context_enc_size'], args['emb_size'])\nself.mha = nn.MultiheadAttention(args['emb_size'], args['num_heads'])",
"tar... | <|body_start_0|>
super().__init__()
self.query_emb = nn.Linear(args['target_agent_enc_size'], args['emb_size'])
self.key_emb = nn.Linear(args['context_enc_size'], args['emb_size'])
self.val_emb = nn.Linear(args['context_enc_size'], args['emb_size'])
self.mha = nn.MultiheadAttenti... | Aggregate context encoding using scaled dot product attention. Query obtained using target agent encoding, Keys and values obtained using map and surrounding agent encodings. | GlobalAttention | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GlobalAttention:
"""Aggregate context encoding using scaled dot product attention. Query obtained using target agent encoding, Keys and values obtained using map and surrounding agent encodings."""
def __init__(self, args: Dict):
"""args to include enc_size: int Dimension of encoding... | stack_v2_sparse_classes_36k_train_015213 | 2,711 | permissive | [
{
"docstring": "args to include enc_size: int Dimension of encodings generated by encoder emb_size: int Size of embeddings used for queries, keys and values num_heads: int Number of attention heads",
"name": "__init__",
"signature": "def __init__(self, args: Dict)"
},
{
"docstring": "Forward pas... | 3 | stack_v2_sparse_classes_30k_train_011383 | Implement the Python class `GlobalAttention` described below.
Class description:
Aggregate context encoding using scaled dot product attention. Query obtained using target agent encoding, Keys and values obtained using map and surrounding agent encodings.
Method signatures and docstrings:
- def __init__(self, args: D... | Implement the Python class `GlobalAttention` described below.
Class description:
Aggregate context encoding using scaled dot product attention. Query obtained using target agent encoding, Keys and values obtained using map and surrounding agent encodings.
Method signatures and docstrings:
- def __init__(self, args: D... | 6419894aa040adb9570b14493952a98c0a52f803 | <|skeleton|>
class GlobalAttention:
"""Aggregate context encoding using scaled dot product attention. Query obtained using target agent encoding, Keys and values obtained using map and surrounding agent encodings."""
def __init__(self, args: Dict):
"""args to include enc_size: int Dimension of encoding... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GlobalAttention:
"""Aggregate context encoding using scaled dot product attention. Query obtained using target agent encoding, Keys and values obtained using map and surrounding agent encodings."""
def __init__(self, args: Dict):
"""args to include enc_size: int Dimension of encodings generated b... | the_stack_v2_python_sparse | models/aggregators/global_attention.py | sancarlim/Explainable-MP | train | 17 |
602efe6bfbebaaed8a3826a60cc915d75cf728b2 | [
"model_adapter = OpenvinoAdapter(create_core(), model_file, weight_file, device=device, max_num_requests=num_requests)\nconfiguration = {**attr.asdict(hparams.postprocessing, filter=lambda attr, value: attr.name not in ['header', 'description', 'type', 'visible_in_ui'])}\nmodel = Model.create_model('OTX_SSD', model... | <|body_start_0|>
model_adapter = OpenvinoAdapter(create_core(), model_file, weight_file, device=device, max_num_requests=num_requests)
configuration = {**attr.asdict(hparams.postprocessing, filter=lambda attr, value: attr.name not in ['header', 'description', 'type', 'visible_in_ui'])}
model = M... | Inferencer implementation for OTXDetection using OpenVINO backend. | OpenVINODetectionInferencer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OpenVINODetectionInferencer:
"""Inferencer implementation for OTXDetection using OpenVINO backend."""
def __init__(self, hparams: DetectionConfig, label_schema: LabelSchemaEntity, model_file: Union[str, bytes], weight_file: Union[str, bytes, None]=None, device: str='CPU', num_requests: int=1... | stack_v2_sparse_classes_36k_train_015214 | 26,436 | permissive | [
{
"docstring": "Initialize for OpenVINODetectionInferencer. :param hparams: Hyper parameters that the model should use. :param label_schema: LabelSchemaEntity that was used during model training. :param model_file: Path OpenVINO IR model definition file. :param weight_file: Path OpenVINO IR model weights file. ... | 2 | null | Implement the Python class `OpenVINODetectionInferencer` described below.
Class description:
Inferencer implementation for OTXDetection using OpenVINO backend.
Method signatures and docstrings:
- def __init__(self, hparams: DetectionConfig, label_schema: LabelSchemaEntity, model_file: Union[str, bytes], weight_file: ... | Implement the Python class `OpenVINODetectionInferencer` described below.
Class description:
Inferencer implementation for OTXDetection using OpenVINO backend.
Method signatures and docstrings:
- def __init__(self, hparams: DetectionConfig, label_schema: LabelSchemaEntity, model_file: Union[str, bytes], weight_file: ... | 6116639caeff100b06a6c10a96c7e7f5951f20c7 | <|skeleton|>
class OpenVINODetectionInferencer:
"""Inferencer implementation for OTXDetection using OpenVINO backend."""
def __init__(self, hparams: DetectionConfig, label_schema: LabelSchemaEntity, model_file: Union[str, bytes], weight_file: Union[str, bytes, None]=None, device: str='CPU', num_requests: int=1... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class OpenVINODetectionInferencer:
"""Inferencer implementation for OTXDetection using OpenVINO backend."""
def __init__(self, hparams: DetectionConfig, label_schema: LabelSchemaEntity, model_file: Union[str, bytes], weight_file: Union[str, bytes, None]=None, device: str='CPU', num_requests: int=1):
""... | the_stack_v2_python_sparse | otx/algorithms/detection/tasks/openvino.py | GalyaZalesskaya/openvino_training_extensions | train | 0 |
c2120e99d8e48acc06345d196a2f6c2dc039a59c | [
"super().__init__()\nself._layers = nn.ModuleList()\nfor in_w, out_w in zip([M] + hidden_size[:-1], hidden_size):\n layer = nn.Sequential(nn.Linear(in_w, out_w), g)\n self._layers.append(layer)\nlayer = nn.Sequential(nn.Linear(hidden_size[-1], 1), nn.Sigmoid())\nself._layers.append(layer)",
"d_theta = X\nfo... | <|body_start_0|>
super().__init__()
self._layers = nn.ModuleList()
for in_w, out_w in zip([M] + hidden_size[:-1], hidden_size):
layer = nn.Sequential(nn.Linear(in_w, out_w), g)
self._layers.append(layer)
layer = nn.Sequential(nn.Linear(hidden_size[-1], 1), nn.Sigm... | MalGAN discriminator (substitute detector). Simple feed forward network. | Discriminator | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Discriminator:
"""MalGAN discriminator (substitute detector). Simple feed forward network."""
def __init__(self, M: int, hidden_size: List[int], g: nn.Module):
"""Discriminator Constructor Builds the discriminator block. :param M: Width of the malware feature vector :param hidden_siz... | stack_v2_sparse_classes_36k_train_015215 | 1,425 | permissive | [
{
"docstring": "Discriminator Constructor Builds the discriminator block. :param M: Width of the malware feature vector :param hidden_size: Width of the hidden layer(s). :param g: Activation function",
"name": "__init__",
"signature": "def __init__(self, M: int, hidden_size: List[int], g: nn.Module)"
... | 2 | stack_v2_sparse_classes_30k_train_006250 | Implement the Python class `Discriminator` described below.
Class description:
MalGAN discriminator (substitute detector). Simple feed forward network.
Method signatures and docstrings:
- def __init__(self, M: int, hidden_size: List[int], g: nn.Module): Discriminator Constructor Builds the discriminator block. :param... | Implement the Python class `Discriminator` described below.
Class description:
MalGAN discriminator (substitute detector). Simple feed forward network.
Method signatures and docstrings:
- def __init__(self, M: int, hidden_size: List[int], g: nn.Module): Discriminator Constructor Builds the discriminator block. :param... | c36647d1b3ba86a9a4e6e1a0bda2a371d8875781 | <|skeleton|>
class Discriminator:
"""MalGAN discriminator (substitute detector). Simple feed forward network."""
def __init__(self, M: int, hidden_size: List[int], g: nn.Module):
"""Discriminator Constructor Builds the discriminator block. :param M: Width of the malware feature vector :param hidden_siz... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Discriminator:
"""MalGAN discriminator (substitute detector). Simple feed forward network."""
def __init__(self, M: int, hidden_size: List[int], g: nn.Module):
"""Discriminator Constructor Builds the discriminator block. :param M: Width of the malware feature vector :param hidden_size: Width of t... | the_stack_v2_python_sparse | malgan/discriminator.py | CyberForce/Pesidious | train | 119 |
fdc87ce57b029dd9f596aa3b692ffb2110df3425 | [
"self.prepare_view_1 = prepare_view_1\nself.prepare_view_2 = prepare_view_2\nself.code_dim = model.DIM_LATENT\nprint('Building network ...')\nlayers = model.build_model(show_model=False)\nprint('Loading model parameters from:', param_file)\nwith open(param_file, 'r') as fp:\n params = pickle.load(fp)\nlasagne.la... | <|body_start_0|>
self.prepare_view_1 = prepare_view_1
self.prepare_view_2 = prepare_view_2
self.code_dim = model.DIM_LATENT
print('Building network ...')
layers = model.build_model(show_model=False)
print('Loading model parameters from:', param_file)
with open(par... | Wrapper for cross modality retrieval networks | RetrievalWrapper | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RetrievalWrapper:
"""Wrapper for cross modality retrieval networks"""
def __init__(self, model, param_file, prepare_view_1=None, prepare_view_2=None):
"""Constructor"""
<|body_0|>
def compute_view_1(self, X):
"""compute network output of view 1"""
<|body_... | stack_v2_sparse_classes_36k_train_015216 | 2,974 | no_license | [
{
"docstring": "Constructor",
"name": "__init__",
"signature": "def __init__(self, model, param_file, prepare_view_1=None, prepare_view_2=None)"
},
{
"docstring": "compute network output of view 1",
"name": "compute_view_1",
"signature": "def compute_view_1(self, X)"
},
{
"docstr... | 3 | stack_v2_sparse_classes_30k_train_015327 | Implement the Python class `RetrievalWrapper` described below.
Class description:
Wrapper for cross modality retrieval networks
Method signatures and docstrings:
- def __init__(self, model, param_file, prepare_view_1=None, prepare_view_2=None): Constructor
- def compute_view_1(self, X): compute network output of view... | Implement the Python class `RetrievalWrapper` described below.
Class description:
Wrapper for cross modality retrieval networks
Method signatures and docstrings:
- def __init__(self, model, param_file, prepare_view_1=None, prepare_view_2=None): Constructor
- def compute_view_1(self, X): compute network output of view... | 0869de4fcf74934b693768001e4d4a16cea829e8 | <|skeleton|>
class RetrievalWrapper:
"""Wrapper for cross modality retrieval networks"""
def __init__(self, model, param_file, prepare_view_1=None, prepare_view_2=None):
"""Constructor"""
<|body_0|>
def compute_view_1(self, X):
"""compute network output of view 1"""
<|body_... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RetrievalWrapper:
"""Wrapper for cross modality retrieval networks"""
def __init__(self, model, param_file, prepare_view_1=None, prepare_view_2=None):
"""Constructor"""
self.prepare_view_1 = prepare_view_1
self.prepare_view_2 = prepare_view_2
self.code_dim = model.DIM_LATE... | the_stack_v2_python_sparse | audio_sheet_retrieval/retrieval_wrapper.py | CPJKU/audio_sheet_retrieval | train | 23 |
88a3c09e0d9a4506b867a568d3f6b632ae4d1ee6 | [
"self.model = model\nself.criterion = criterion\nself.valid = valid\nself.minimize_options = {}\nif minimize_options is not None:\n self.minimize_options = minimize_options\nself.model_id = self.model.model_id\nself.objective_customizer = objective_customizer\nself.postprocessor = postprocessor\nself.best_start ... | <|body_start_0|>
self.model = model
self.criterion = criterion
self.valid = valid
self.minimize_options = {}
if minimize_options is not None:
self.minimize_options = minimize_options
self.model_id = self.model.model_id
self.objective_customizer = objec... | Handles all required calibration tasks on a model. Handles the creation, estimation, and evaluation of a model. Here, a model is a PEtab problem that is patched with a dictionary of custom parameter values (which may specify that the parameter should be estimated). Evaluation refers to criterion values such as AIC. Att... | ModelProblem | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ModelProblem:
"""Handles all required calibration tasks on a model. Handles the creation, estimation, and evaluation of a model. Here, a model is a PEtab problem that is patched with a dictionary of custom parameter values (which may specify that the parameter should be estimated). Evaluation ref... | stack_v2_sparse_classes_36k_train_015217 | 7,117 | permissive | [
{
"docstring": "Construct then calibrate a model problem. See the class documentation for documentation of most parameters. Parameters ---------- autorun: If `False`, the model parameters will not be estimated. Allows users to manually call pypesto.minimize with custom options, then`set_result()`. TODO: constra... | 2 | null | Implement the Python class `ModelProblem` described below.
Class description:
Handles all required calibration tasks on a model. Handles the creation, estimation, and evaluation of a model. Here, a model is a PEtab problem that is patched with a dictionary of custom parameter values (which may specify that the paramet... | Implement the Python class `ModelProblem` described below.
Class description:
Handles all required calibration tasks on a model. Handles the creation, estimation, and evaluation of a model. Here, a model is a PEtab problem that is patched with a dictionary of custom parameter values (which may specify that the paramet... | 9a754573a7b77d30d5dc1f67a8dc1be6c29f1640 | <|skeleton|>
class ModelProblem:
"""Handles all required calibration tasks on a model. Handles the creation, estimation, and evaluation of a model. Here, a model is a PEtab problem that is patched with a dictionary of custom parameter values (which may specify that the parameter should be estimated). Evaluation ref... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ModelProblem:
"""Handles all required calibration tasks on a model. Handles the creation, estimation, and evaluation of a model. Here, a model is a PEtab problem that is patched with a dictionary of custom parameter values (which may specify that the parameter should be estimated). Evaluation refers to criter... | the_stack_v2_python_sparse | pypesto/select/model_problem.py | ICB-DCM/pyPESTO | train | 174 |
df3062281a34f1f115e72ddbec8d33652b5e162f | [
"self.x = None\nself.norm_x = None\nself.beta = None\nself.gamma = None\nself.mean = None\nself.var = None\nself.norm_param = {'eps': kwargs.get('eps', 1e-05), 'momentum': kwargs.get('momentum', 0.9)}\nif kwargs.get('running_mean', None) is not None:\n self.norm_param['running_mean'] = kwargs['running_mean']\nif... | <|body_start_0|>
self.x = None
self.norm_x = None
self.beta = None
self.gamma = None
self.mean = None
self.var = None
self.norm_param = {'eps': kwargs.get('eps', 1e-05), 'momentum': kwargs.get('momentum', 0.9)}
if kwargs.get('running_mean', None) is not No... | BatchNorm implements a network layer that performs batch normalization. Normalization is performed on a mini-batch of input data. This layer includes two extra learning parameters, gamma and beta. The gamma is known as the scaling factor and beta is known as the shifting factor. If an optimized network produces a gamma... | BatchNorm | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BatchNorm:
"""BatchNorm implements a network layer that performs batch normalization. Normalization is performed on a mini-batch of input data. This layer includes two extra learning parameters, gamma and beta. The gamma is known as the scaling factor and beta is known as the shifting factor. If ... | stack_v2_sparse_classes_36k_train_015218 | 5,023 | no_license | [
{
"docstring": "Keyword args: eps: constant for numeric stability momentum: constant for running mean/variance calculation running_mean: if input has shape (N, D), then this is array of shape (D,) running_var: if input has shape (N, D), then this is array of shape (D,)",
"name": "__init__",
"signature":... | 3 | null | Implement the Python class `BatchNorm` described below.
Class description:
BatchNorm implements a network layer that performs batch normalization. Normalization is performed on a mini-batch of input data. This layer includes two extra learning parameters, gamma and beta. The gamma is known as the scaling factor and be... | Implement the Python class `BatchNorm` described below.
Class description:
BatchNorm implements a network layer that performs batch normalization. Normalization is performed on a mini-batch of input data. This layer includes two extra learning parameters, gamma and beta. The gamma is known as the scaling factor and be... | 7da789ef34d5e5bcf9033cfbe0ff5df607b2437a | <|skeleton|>
class BatchNorm:
"""BatchNorm implements a network layer that performs batch normalization. Normalization is performed on a mini-batch of input data. This layer includes two extra learning parameters, gamma and beta. The gamma is known as the scaling factor and beta is known as the shifting factor. If ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BatchNorm:
"""BatchNorm implements a network layer that performs batch normalization. Normalization is performed on a mini-batch of input data. This layer includes two extra learning parameters, gamma and beta. The gamma is known as the scaling factor and beta is known as the shifting factor. If an optimized ... | the_stack_v2_python_sparse | convolutional_neural_networks/conv_net/layer/batch_norm.py | calvinfeng/machine-learning-notebook | train | 38 |
19a75ae0f8add5b5d0c7dc479bcfa5e5674ace7c | [
"rec = super(AccountMoveLine, self).default_get(fields)\nif 'line_ids' not in self._context:\n return rec\nif self._context['line_ids']:\n dic = {}\n line = self._context['line_ids'][-1][2]\n if line:\n if 'name' in line:\n dic['name'] = line['name']\n if 'analytic_account_id' i... | <|body_start_0|>
rec = super(AccountMoveLine, self).default_get(fields)
if 'line_ids' not in self._context:
return rec
if self._context['line_ids']:
dic = {}
line = self._context['line_ids'][-1][2]
if line:
if 'name' in line:
... | AccountMoveLine | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AccountMoveLine:
def default_get(self, fields):
"""' Set last name of journal line in case of a manual entry"""
<|body_0|>
def _onchange_amount_currency(self):
"""Overwrite function : to set default credit and debit if exist and currecny amount is zero Recompute the ... | stack_v2_sparse_classes_36k_train_015219 | 2,510 | no_license | [
{
"docstring": "' Set last name of journal line in case of a manual entry",
"name": "default_get",
"signature": "def default_get(self, fields)"
},
{
"docstring": "Overwrite function : to set default credit and debit if exist and currecny amount is zero Recompute the debit/credit based on amount_... | 2 | null | Implement the Python class `AccountMoveLine` described below.
Class description:
Implement the AccountMoveLine class.
Method signatures and docstrings:
- def default_get(self, fields): ' Set last name of journal line in case of a manual entry
- def _onchange_amount_currency(self): Overwrite function : to set default ... | Implement the Python class `AccountMoveLine` described below.
Class description:
Implement the AccountMoveLine class.
Method signatures and docstrings:
- def default_get(self, fields): ' Set last name of journal line in case of a manual entry
- def _onchange_amount_currency(self): Overwrite function : to set default ... | f392c7f17c9a348b00fc9db2e460a8ba010b7748 | <|skeleton|>
class AccountMoveLine:
def default_get(self, fields):
"""' Set last name of journal line in case of a manual entry"""
<|body_0|>
def _onchange_amount_currency(self):
"""Overwrite function : to set default credit and debit if exist and currecny amount is zero Recompute the ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AccountMoveLine:
def default_get(self, fields):
"""' Set last name of journal line in case of a manual entry"""
rec = super(AccountMoveLine, self).default_get(fields)
if 'line_ids' not in self._context:
return rec
if self._context['line_ids']:
dic = {}
... | the_stack_v2_python_sparse | hr-new_branch/auto_complete_journal_entry/model/account_move_line.py | mfhm95/royalLine01052019 | train | 0 | |
4bf7aebc5baaa5224d030607aa79889a5b515035 | [
"directory_path = Path(directory_path)\noutput_path = Path(output_path)\narchive_file_extension = 'tar' if cls._MODE_STRING == '' else f'tar.{cls._MODE_STRING}'\narchive_path = output_path / f'{directory_path.stem}.{archive_file_extension}'\nwith tarfile.open(archive_path, f'w:{cls._MODE_STRING}') as tar_file:\n ... | <|body_start_0|>
directory_path = Path(directory_path)
output_path = Path(output_path)
archive_file_extension = 'tar' if cls._MODE_STRING == '' else f'tar.{cls._MODE_STRING}'
archive_path = output_path / f'{directory_path.stem}.{archive_file_extension}'
with tarfile.open(archive_... | A static class for managing tar archives. | _TarArchiver | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _TarArchiver:
"""A static class for managing tar archives."""
def create_archive(cls, directory_path: str, output_path: str) -> str:
"""Create an archive of all the contents in the given directory and save it to an archive file named as the directory in the provided output path. :par... | stack_v2_sparse_classes_36k_train_015220 | 7,567 | permissive | [
{
"docstring": "Create an archive of all the contents in the given directory and save it to an archive file named as the directory in the provided output path. :param directory_path: The directory with the files to archive. :param output_path: The output path to store the created archive file. :return: The crea... | 2 | stack_v2_sparse_classes_30k_train_012796 | Implement the Python class `_TarArchiver` described below.
Class description:
A static class for managing tar archives.
Method signatures and docstrings:
- def create_archive(cls, directory_path: str, output_path: str) -> str: Create an archive of all the contents in the given directory and save it to an archive file... | Implement the Python class `_TarArchiver` described below.
Class description:
A static class for managing tar archives.
Method signatures and docstrings:
- def create_archive(cls, directory_path: str, output_path: str) -> str: Create an archive of all the contents in the given directory and save it to an archive file... | b5fe0c05ae7f5818a4a5a5a40245c851ff9b2c77 | <|skeleton|>
class _TarArchiver:
"""A static class for managing tar archives."""
def create_archive(cls, directory_path: str, output_path: str) -> str:
"""Create an archive of all the contents in the given directory and save it to an archive file named as the directory in the provided output path. :par... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class _TarArchiver:
"""A static class for managing tar archives."""
def create_archive(cls, directory_path: str, output_path: str) -> str:
"""Create an archive of all the contents in the given directory and save it to an archive file named as the directory in the provided output path. :param directory_... | the_stack_v2_python_sparse | mlrun/package/utils/_archiver.py | mlrun/mlrun | train | 1,093 |
615e16aea97d3560fd76fd260ccf87a2b4d9c2c4 | [
"maxval = 0\nwhile len(s) != 0:\n maxval, s = self.partitionString(maxval, s)\nreturn maxval",
"try:\n if len(substr) == 0 or len(substr) == 1:\n return (max(currentMax, len(substr)), '')\n else:\n char_dict = dict()\n max_len = 0\n count = 0\n for ch in substr:\n ... | <|body_start_0|>
maxval = 0
while len(s) != 0:
maxval, s = self.partitionString(maxval, s)
return maxval
<|end_body_0|>
<|body_start_1|>
try:
if len(substr) == 0 or len(substr) == 1:
return (max(currentMax, len(substr)), '')
else:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def lengthOfLongestSubstring(self, s):
""":type s: str :rtype: int"""
<|body_0|>
def partitionString(self, currentMax, substr):
"""currentMax substr"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
maxval = 0
while len(s) != 0:
... | stack_v2_sparse_classes_36k_train_015221 | 1,176 | no_license | [
{
"docstring": ":type s: str :rtype: int",
"name": "lengthOfLongestSubstring",
"signature": "def lengthOfLongestSubstring(self, s)"
},
{
"docstring": "currentMax substr",
"name": "partitionString",
"signature": "def partitionString(self, currentMax, substr)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lengthOfLongestSubstring(self, s): :type s: str :rtype: int
- def partitionString(self, currentMax, substr): currentMax substr | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lengthOfLongestSubstring(self, s): :type s: str :rtype: int
- def partitionString(self, currentMax, substr): currentMax substr
<|skeleton|>
class Solution:
def lengthOf... | 902f5b6807e60a834f292f242b16202ef95de453 | <|skeleton|>
class Solution:
def lengthOfLongestSubstring(self, s):
""":type s: str :rtype: int"""
<|body_0|>
def partitionString(self, currentMax, substr):
"""currentMax substr"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def lengthOfLongestSubstring(self, s):
""":type s: str :rtype: int"""
maxval = 0
while len(s) != 0:
maxval, s = self.partitionString(maxval, s)
return maxval
def partitionString(self, currentMax, substr):
"""currentMax substr"""
try:
... | the_stack_v2_python_sparse | leetcode/length_longest_non_repeating_substr.py | tusharkaley/competitive-coding-practice | train | 0 | |
707d820f37aff3f092868c741833758b5b273441 | [
"self.fc1 = nn.Linear(self.observation_space.shape[0], 256)\nself.fc2 = nn.Linear(256, 256)\nself.fc3 = nn.Linear(256, 256)\nself.vf = nn.Linear(256, 1)",
"x = x.float()\nx = F.relu(self.fc1(x))\nx = F.relu(self.fc2(x))\nx = F.relu(self.fc3(x))\nreturn self.vf(x)"
] | <|body_start_0|>
self.fc1 = nn.Linear(self.observation_space.shape[0], 256)
self.fc2 = nn.Linear(256, 256)
self.fc3 = nn.Linear(256, 256)
self.vf = nn.Linear(256, 1)
<|end_body_0|>
<|body_start_1|>
x = x.float()
x = F.relu(self.fc1(x))
x = F.relu(self.fc2(x))
... | Value Function. | VFNet | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VFNet:
"""Value Function."""
def build(self):
"""Build."""
<|body_0|>
def forward(self, x):
"""Forward."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.fc1 = nn.Linear(self.observation_space.shape[0], 256)
self.fc2 = nn.Linear(256, ... | stack_v2_sparse_classes_36k_train_015222 | 18,517 | permissive | [
{
"docstring": "Build.",
"name": "build",
"signature": "def build(self)"
},
{
"docstring": "Forward.",
"name": "forward",
"signature": "def forward(self, x)"
}
] | 2 | stack_v2_sparse_classes_30k_train_013841 | Implement the Python class `VFNet` described below.
Class description:
Value Function.
Method signatures and docstrings:
- def build(self): Build.
- def forward(self, x): Forward. | Implement the Python class `VFNet` described below.
Class description:
Value Function.
Method signatures and docstrings:
- def build(self): Build.
- def forward(self, x): Forward.
<|skeleton|>
class VFNet:
"""Value Function."""
def build(self):
"""Build."""
<|body_0|>
def forward(self, ... | f53cf3191f4c38f4d1f394ccd55b1d935a6a70ba | <|skeleton|>
class VFNet:
"""Value Function."""
def build(self):
"""Build."""
<|body_0|>
def forward(self, x):
"""Forward."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class VFNet:
"""Value Function."""
def build(self):
"""Build."""
self.fc1 = nn.Linear(self.observation_space.shape[0], 256)
self.fc2 = nn.Linear(256, 256)
self.fc3 = nn.Linear(256, 256)
self.vf = nn.Linear(256, 1)
def forward(self, x):
"""Forward."""
... | the_stack_v2_python_sparse | python/rrc_example_package/code/residual_ppo.py | takuma-yoneda/rrc_example_package | train | 0 |
ad6b134d2522aa21cb06a1545cadc981be12e928 | [
"with self.assertRaises(SystemExit):\n collapser = DTraceParser()\n collapser.ParseDir('./test_data/empty/')",
"collapser = DTraceParser()\ncollapser.ParseDir('./test_data/valid/')\nself.assertEquals(collapser.GetSamplesListForTesting(), [{'frames': [('fake_module', 'baz'), ('fake_module', 'bar'), ('fake_mo... | <|body_start_0|>
with self.assertRaises(SystemExit):
collapser = DTraceParser()
collapser.ParseDir('./test_data/empty/')
<|end_body_0|>
<|body_start_1|>
collapser = DTraceParser()
collapser.ParseDir('./test_data/valid/')
self.assertEquals(collapser.GetSamplesList... | DTraceReadTest | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DTraceReadTest:
def testEmpty(self):
"""Tests that a directory with no valid stacks triggers a failure."""
<|body_0|>
def testValidBlock(self):
"""Tests basic parsing of the DTrace format."""
<|body_1|>
def testRepeatedFunction(self):
"""Tests ac... | stack_v2_sparse_classes_36k_train_015223 | 2,259 | permissive | [
{
"docstring": "Tests that a directory with no valid stacks triggers a failure.",
"name": "testEmpty",
"signature": "def testEmpty(self)"
},
{
"docstring": "Tests basic parsing of the DTrace format.",
"name": "testValidBlock",
"signature": "def testValidBlock(self)"
},
{
"docstri... | 4 | null | Implement the Python class `DTraceReadTest` described below.
Class description:
Implement the DTraceReadTest class.
Method signatures and docstrings:
- def testEmpty(self): Tests that a directory with no valid stacks triggers a failure.
- def testValidBlock(self): Tests basic parsing of the DTrace format.
- def testR... | Implement the Python class `DTraceReadTest` described below.
Class description:
Implement the DTraceReadTest class.
Method signatures and docstrings:
- def testEmpty(self): Tests that a directory with no valid stacks triggers a failure.
- def testValidBlock(self): Tests basic parsing of the DTrace format.
- def testR... | a401d6cf4f7bf0e2d2e964c512ebb923c3d8832c | <|skeleton|>
class DTraceReadTest:
def testEmpty(self):
"""Tests that a directory with no valid stacks triggers a failure."""
<|body_0|>
def testValidBlock(self):
"""Tests basic parsing of the DTrace format."""
<|body_1|>
def testRepeatedFunction(self):
"""Tests ac... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DTraceReadTest:
def testEmpty(self):
"""Tests that a directory with no valid stacks triggers a failure."""
with self.assertRaises(SystemExit):
collapser = DTraceParser()
collapser.ParseDir('./test_data/empty/')
def testValidBlock(self):
"""Tests basic parsi... | the_stack_v2_python_sparse | tools/mac/power/export_dtrace_test.py | chromium/chromium | train | 17,408 | |
d6697b69f888aa83ef7cbd034c6a20d4dd7f0745 | [
"super(DeepLPFParameterPrediction, self).__init__()\nself.num_in_channels = num_in_channels\nself.num_out_channels = num_out_channels\nself.cubic_filter = CubicFilter()\nself.graduated_filter = GraduatedFilter()\nself.elliptical_filter = EllipticalFilter()",
"x.contiguous()\nx.cuda()\nfeat = x[:, 3:64, :, :]\nimg... | <|body_start_0|>
super(DeepLPFParameterPrediction, self).__init__()
self.num_in_channels = num_in_channels
self.num_out_channels = num_out_channels
self.cubic_filter = CubicFilter()
self.graduated_filter = GraduatedFilter()
self.elliptical_filter = EllipticalFilter()
<|en... | DeepLPFParameterPrediction | [
"BSD-3-Clause",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DeepLPFParameterPrediction:
def __init__(self, num_in_channels=64, num_out_channels=64, batch_size=1):
"""Initialisation function :param num_in_channels: Number of input feature maps :param num_out_channels: Number of output feature maps :param batch_size: Size of image batch :returns: N... | stack_v2_sparse_classes_36k_train_015224 | 38,578 | permissive | [
{
"docstring": "Initialisation function :param num_in_channels: Number of input feature maps :param num_out_channels: Number of output feature maps :param batch_size: Size of image batch :returns: N/A :rtype: N/A",
"name": "__init__",
"signature": "def __init__(self, num_in_channels=64, num_out_channels... | 2 | stack_v2_sparse_classes_30k_train_002958 | Implement the Python class `DeepLPFParameterPrediction` described below.
Class description:
Implement the DeepLPFParameterPrediction class.
Method signatures and docstrings:
- def __init__(self, num_in_channels=64, num_out_channels=64, batch_size=1): Initialisation function :param num_in_channels: Number of input fea... | Implement the Python class `DeepLPFParameterPrediction` described below.
Class description:
Implement the DeepLPFParameterPrediction class.
Method signatures and docstrings:
- def __init__(self, num_in_channels=64, num_out_channels=64, batch_size=1): Initialisation function :param num_in_channels: Number of input fea... | 82c49c36b76987a46dec8479793f7cf0150839c6 | <|skeleton|>
class DeepLPFParameterPrediction:
def __init__(self, num_in_channels=64, num_out_channels=64, batch_size=1):
"""Initialisation function :param num_in_channels: Number of input feature maps :param num_out_channels: Number of output feature maps :param batch_size: Size of image batch :returns: N... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DeepLPFParameterPrediction:
def __init__(self, num_in_channels=64, num_out_channels=64, batch_size=1):
"""Initialisation function :param num_in_channels: Number of input feature maps :param num_out_channels: Number of output feature maps :param batch_size: Size of image batch :returns: N/A :rtype: N/A... | the_stack_v2_python_sparse | DeepLPF/model.py | huawei-noah/noah-research | train | 816 | |
a711f5aa8ac6a65c2a44d1d9750d1d017c322f0d | [
"if matrix == [] or matrix == [[]]:\n return False\nvertical = [x[0] for x in matrix]\ny = self.BS_lowerBound(vertical, target)\nif matrix[y][0] == target:\n return True\nhorizontal = matrix[y]\nx = self.BS_lowerBound(horizontal, target)\nif x >= 0 and matrix[y][x] == target:\n return True\nreturn False",
... | <|body_start_0|>
if matrix == [] or matrix == [[]]:
return False
vertical = [x[0] for x in matrix]
y = self.BS_lowerBound(vertical, target)
if matrix[y][0] == target:
return True
horizontal = matrix[y]
x = self.BS_lowerBound(horizontal, target)
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def searchMatrix(self, matrix, target):
""":type matrix: List[List[int]] :type target: int :rtype: bool"""
<|body_0|>
def BS_lowerBound(self, vertical, target):
"""lower bound binary search algorithm"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>... | stack_v2_sparse_classes_36k_train_015225 | 1,392 | no_license | [
{
"docstring": ":type matrix: List[List[int]] :type target: int :rtype: bool",
"name": "searchMatrix",
"signature": "def searchMatrix(self, matrix, target)"
},
{
"docstring": "lower bound binary search algorithm",
"name": "BS_lowerBound",
"signature": "def BS_lowerBound(self, vertical, t... | 2 | stack_v2_sparse_classes_30k_train_019746 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def searchMatrix(self, matrix, target): :type matrix: List[List[int]] :type target: int :rtype: bool
- def BS_lowerBound(self, vertical, target): lower bound binary search algori... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def searchMatrix(self, matrix, target): :type matrix: List[List[int]] :type target: int :rtype: bool
- def BS_lowerBound(self, vertical, target): lower bound binary search algori... | 54d777e11b91c5debe49c1aef723234c66a5d2cc | <|skeleton|>
class Solution:
def searchMatrix(self, matrix, target):
""":type matrix: List[List[int]] :type target: int :rtype: bool"""
<|body_0|>
def BS_lowerBound(self, vertical, target):
"""lower bound binary search algorithm"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def searchMatrix(self, matrix, target):
""":type matrix: List[List[int]] :type target: int :rtype: bool"""
if matrix == [] or matrix == [[]]:
return False
vertical = [x[0] for x in matrix]
y = self.BS_lowerBound(vertical, target)
if matrix[y][0] ==... | the_stack_v2_python_sparse | leetcode_solution/binary search/#74.Search_a_2D_Matrix.py | HsiangHung/Code-Challenges | train | 0 | |
6819a5f23e635d9457b28daaae2739172344e243 | [
"try:\n m = json.loads(vb.usage_example(text))\n if len(m) > 0:\n return m[0]['text']\n return u''\nexcept Exception as ex:\n error(u'', ex)\n return u''",
"try:\n m = json.loads(vb.meaning(text, lang, lang))\n if len(m) > 0:\n return m[0]['text']\n return u''\nexcept Excepti... | <|body_start_0|>
try:
m = json.loads(vb.usage_example(text))
if len(m) > 0:
return m[0]['text']
return u''
except Exception as ex:
error(u'', ex)
return u''
<|end_body_0|>
<|body_start_1|>
try:
m = json.load... | VocabularityService | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VocabularityService:
def get_context(text):
"""Try to get context for card :param card:"""
<|body_0|>
def get_meaning(text, lang):
"""Try to get meaning for card :param text: :param lang: :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
try:... | stack_v2_sparse_classes_36k_train_015226 | 971 | permissive | [
{
"docstring": "Try to get context for card :param card:",
"name": "get_context",
"signature": "def get_context(text)"
},
{
"docstring": "Try to get meaning for card :param text: :param lang: :return:",
"name": "get_meaning",
"signature": "def get_meaning(text, lang)"
}
] | 2 | stack_v2_sparse_classes_30k_train_018992 | Implement the Python class `VocabularityService` described below.
Class description:
Implement the VocabularityService class.
Method signatures and docstrings:
- def get_context(text): Try to get context for card :param card:
- def get_meaning(text, lang): Try to get meaning for card :param text: :param lang: :return... | Implement the Python class `VocabularityService` described below.
Class description:
Implement the VocabularityService class.
Method signatures and docstrings:
- def get_context(text): Try to get context for card :param card:
- def get_meaning(text, lang): Try to get meaning for card :param text: :param lang: :return... | 9a336d1e467d08c6b3875bd8b83dea0dc3b9236d | <|skeleton|>
class VocabularityService:
def get_context(text):
"""Try to get context for card :param card:"""
<|body_0|>
def get_meaning(text, lang):
"""Try to get meaning for card :param text: :param lang: :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class VocabularityService:
def get_context(text):
"""Try to get context for card :param card:"""
try:
m = json.loads(vb.usage_example(text))
if len(m) > 0:
return m[0]['text']
return u''
except Exception as ex:
error(u'', ex)
... | the_stack_v2_python_sparse | we-web/services/real/vocabularity.py | avatar29A/wordeater-web | train | 0 | |
fd4d0dac22d6e7360ae7adeae8152cce83b43a55 | [
"self.table = {}\nwith open(filename) as input_file:\n for line in input_file:\n str_vals = [i.strip() for i in line.split() if i.strip()]\n vals = [float(i) for i in str_vals]\n pt_thrs = (vals[0], vals[1])\n eta_thrs = (vals[2], vals[3])\n if pt_thrs not in self.table:\n ... | <|body_start_0|>
self.table = {}
with open(filename) as input_file:
for line in input_file:
str_vals = [i.strip() for i in line.split() if i.strip()]
vals = [float(i) for i in str_vals]
pt_thrs = (vals[0], vals[1])
eta_thrs = (v... | Loads a txt file with data to MC corrections | CorrectionLoader | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CorrectionLoader:
"""Loads a txt file with data to MC corrections"""
def __init__(self, filename):
"""Creates object given input filename path txt file format, tab separated table, no header columns: ptmin, ptmax, eta min, eta max, correction uncertainty"""
<|body_0|>
de... | stack_v2_sparse_classes_36k_train_015227 | 1,473 | no_license | [
{
"docstring": "Creates object given input filename path txt file format, tab separated table, no header columns: ptmin, ptmax, eta min, eta max, correction uncertainty",
"name": "__init__",
"signature": "def __init__(self, filename)"
},
{
"docstring": "Return correction given pt and eta, raise ... | 2 | stack_v2_sparse_classes_30k_train_011835 | Implement the Python class `CorrectionLoader` described below.
Class description:
Loads a txt file with data to MC corrections
Method signatures and docstrings:
- def __init__(self, filename): Creates object given input filename path txt file format, tab separated table, no header columns: ptmin, ptmax, eta min, eta ... | Implement the Python class `CorrectionLoader` described below.
Class description:
Loads a txt file with data to MC corrections
Method signatures and docstrings:
- def __init__(self, filename): Creates object given input filename path txt file format, tab separated table, no header columns: ptmin, ptmax, eta min, eta ... | bcb164a8e27d459a9ac438780f6c8730d3e856bf | <|skeleton|>
class CorrectionLoader:
"""Loads a txt file with data to MC corrections"""
def __init__(self, filename):
"""Creates object given input filename path txt file format, tab separated table, no header columns: ptmin, ptmax, eta min, eta max, correction uncertainty"""
<|body_0|>
de... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CorrectionLoader:
"""Loads a txt file with data to MC corrections"""
def __init__(self, filename):
"""Creates object given input filename path txt file format, tab separated table, no header columns: ptmin, ptmax, eta min, eta max, correction uncertainty"""
self.table = {}
with op... | the_stack_v2_python_sparse | TagAndProbe/python/correctionloader.py | uwcms/FinalStateAnalysis | train | 5 |
60cb06944b91448964a52cc1fcf4139c769693d1 | [
"response = echo_request(request)\nlog.debug(response)\nreturn reply_success(**response)",
"response = echo_request(request)\nlog.debug(response)\nreturn reply_success(**response)"
] | <|body_start_0|>
response = echo_request(request)
log.debug(response)
return reply_success(**response)
<|end_body_0|>
<|body_start_1|>
response = echo_request(request)
log.debug(response)
return reply_success(**response)
<|end_body_1|>
| EchoResource | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EchoResource:
def get(self):
"""Returns values as they are received"""
<|body_0|>
def post(self):
"""Returns values as they are received"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
response = echo_request(request)
log.debug(response)
... | stack_v2_sparse_classes_36k_train_015228 | 826 | permissive | [
{
"docstring": "Returns values as they are received",
"name": "get",
"signature": "def get(self)"
},
{
"docstring": "Returns values as they are received",
"name": "post",
"signature": "def post(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_019987 | Implement the Python class `EchoResource` described below.
Class description:
Implement the EchoResource class.
Method signatures and docstrings:
- def get(self): Returns values as they are received
- def post(self): Returns values as they are received | Implement the Python class `EchoResource` described below.
Class description:
Implement the EchoResource class.
Method signatures and docstrings:
- def get(self): Returns values as they are received
- def post(self): Returns values as they are received
<|skeleton|>
class EchoResource:
def get(self):
"""... | f224a0da22162fd479d6b9f9095ff5cae4723716 | <|skeleton|>
class EchoResource:
def get(self):
"""Returns values as they are received"""
<|body_0|>
def post(self):
"""Returns values as they are received"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class EchoResource:
def get(self):
"""Returns values as they are received"""
response = echo_request(request)
log.debug(response)
return reply_success(**response)
def post(self):
"""Returns values as they are received"""
response = echo_request(request)
l... | the_stack_v2_python_sparse | src/artifice/scraper/resources/echo.py | artifice-project/artifice-scraper | train | 0 | |
d3a8e136e15458f1a4c49f48cc05b1103eb89905 | [
"if request.user.is_staff:\n queryset = self.queryset.exclude(actor_object_id=request.user.pk)\nelse:\n queryset = user_stream(request.user).exclude(actor_object_id=request.user.pk)\npage = self.paginate_queryset(queryset)\nserializer = ActionSerializer(page, many=True, context={'request': request})\nreturn s... | <|body_start_0|>
if request.user.is_staff:
queryset = self.queryset.exclude(actor_object_id=request.user.pk)
else:
queryset = user_stream(request.user).exclude(actor_object_id=request.user.pk)
page = self.paginate_queryset(queryset)
serializer = ActionSerializer(p... | User notification API. | PulseViewSet | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PulseViewSet:
"""User notification API."""
def list(self, request):
"""list everything if staff; list everything onnected to your follows otherwise"""
<|body_0|>
def unread(self, request):
"""get just unread things count"""
<|body_1|>
def noise(self,... | stack_v2_sparse_classes_36k_train_015229 | 2,428 | no_license | [
{
"docstring": "list everything if staff; list everything onnected to your follows otherwise",
"name": "list",
"signature": "def list(self, request)"
},
{
"docstring": "get just unread things count",
"name": "unread",
"signature": "def unread(self, request)"
},
{
"docstring": "wh... | 4 | stack_v2_sparse_classes_30k_train_016561 | Implement the Python class `PulseViewSet` described below.
Class description:
User notification API.
Method signatures and docstrings:
- def list(self, request): list everything if staff; list everything onnected to your follows otherwise
- def unread(self, request): get just unread things count
- def noise(self, req... | Implement the Python class `PulseViewSet` described below.
Class description:
User notification API.
Method signatures and docstrings:
- def list(self, request): list everything if staff; list everything onnected to your follows otherwise
- def unread(self, request): get just unread things count
- def noise(self, req... | b731d38f1a5c38466ec8db41fafcd4dedc763426 | <|skeleton|>
class PulseViewSet:
"""User notification API."""
def list(self, request):
"""list everything if staff; list everything onnected to your follows otherwise"""
<|body_0|>
def unread(self, request):
"""get just unread things count"""
<|body_1|>
def noise(self,... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PulseViewSet:
"""User notification API."""
def list(self, request):
"""list everything if staff; list everything onnected to your follows otherwise"""
if request.user.is_staff:
queryset = self.queryset.exclude(actor_object_id=request.user.pk)
else:
queryset... | the_stack_v2_python_sparse | miller/api/pulse.py | resume-unilu/miller | train | 1 |
4a9a70ad70e9c81222a61d6e4071663616f91d75 | [
"groups = {'data-analyst': ['updated'], 'senior-data-analyst': ['updated', 'reviewed'], 'chief-data-analyst': ['updated', 'reviewed', 'finalized']}\nstatus_keys = []\ntry:\n for group in user.groups.all():\n status_keys = status_keys + groups[group.name]\nexcept KeyError:\n status_keys = []\nstatus_key... | <|body_start_0|>
groups = {'data-analyst': ['updated'], 'senior-data-analyst': ['updated', 'reviewed'], 'chief-data-analyst': ['updated', 'reviewed', 'finalized']}
status_keys = []
try:
for group in user.groups.all():
status_keys = status_keys + groups[group.name]
... | PermStatusUpdateManager | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PermStatusUpdateManager:
def available_statuses(self, user):
"""return a list of the available statuses, allows for users to have more that one group"""
<|body_0|>
def get_update_status(self, user, requested_status_id):
"""return the status that the user may update t... | stack_v2_sparse_classes_36k_train_015230 | 41,707 | no_license | [
{
"docstring": "return a list of the available statuses, allows for users to have more that one group",
"name": "available_statuses",
"signature": "def available_statuses(self, user)"
},
{
"docstring": "return the status that the user may update to, so if a user tries to update to finalized and ... | 3 | null | Implement the Python class `PermStatusUpdateManager` described below.
Class description:
Implement the PermStatusUpdateManager class.
Method signatures and docstrings:
- def available_statuses(self, user): return a list of the available statuses, allows for users to have more that one group
- def get_update_status(se... | Implement the Python class `PermStatusUpdateManager` described below.
Class description:
Implement the PermStatusUpdateManager class.
Method signatures and docstrings:
- def available_statuses(self, user): return a list of the available statuses, allows for users to have more that one group
- def get_update_status(se... | 6ea1b69db832acbdce4d28e5c2fc35d159712504 | <|skeleton|>
class PermStatusUpdateManager:
def available_statuses(self, user):
"""return a list of the available statuses, allows for users to have more that one group"""
<|body_0|>
def get_update_status(self, user, requested_status_id):
"""return the status that the user may update t... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PermStatusUpdateManager:
def available_statuses(self, user):
"""return a list of the available statuses, allows for users to have more that one group"""
groups = {'data-analyst': ['updated'], 'senior-data-analyst': ['updated', 'reviewed'], 'chief-data-analyst': ['updated', 'reviewed', 'finaliz... | the_stack_v2_python_sparse | corroborator_app/models.py | equalitie/open-corroborator | train | 10 | |
54cdcbc179f1769858c372bd019a6aa88243f8aa | [
"try:\n result = {}\n row = service.JobStateLoader().set_job_info(nnid, json.loads(str(request.body, 'utf-8')))\n result['epoch'] = row.epoch\n result['batchsize'] = row.batchsize\n result['status'] = row.status\n return_data = {'status': '200', 'result': str(result)}\n return Response(json.dum... | <|body_start_0|>
try:
result = {}
row = service.JobStateLoader().set_job_info(nnid, json.loads(str(request.body, 'utf-8')))
result['epoch'] = row.epoch
result['batchsize'] = row.batchsize
result['status'] = row.status
return_data = {'status... | 1. POST : 2. GET : 3. PUT : 4. DELETE : | CommonJobInfo | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CommonJobInfo:
"""1. POST : 2. GET : 3. PUT : 4. DELETE :"""
def post(self, request, nnid):
"""set the time on the job :param request: :return:"""
<|body_0|>
def get(self, request, nnid):
"""get all job list :param request: :return:"""
<|body_1|>
def... | stack_v2_sparse_classes_36k_train_015231 | 2,906 | no_license | [
{
"docstring": "set the time on the job :param request: :return:",
"name": "post",
"signature": "def post(self, request, nnid)"
},
{
"docstring": "get all job list :param request: :return:",
"name": "get",
"signature": "def get(self, request, nnid)"
},
{
"docstring": "set the tim... | 4 | null | Implement the Python class `CommonJobInfo` described below.
Class description:
1. POST : 2. GET : 3. PUT : 4. DELETE :
Method signatures and docstrings:
- def post(self, request, nnid): set the time on the job :param request: :return:
- def get(self, request, nnid): get all job list :param request: :return:
- def put... | Implement the Python class `CommonJobInfo` described below.
Class description:
1. POST : 2. GET : 3. PUT : 4. DELETE :
Method signatures and docstrings:
- def post(self, request, nnid): set the time on the job :param request: :return:
- def get(self, request, nnid): get all job list :param request: :return:
- def put... | ef058737f391de817c74398ef9a5d3a28f973c98 | <|skeleton|>
class CommonJobInfo:
"""1. POST : 2. GET : 3. PUT : 4. DELETE :"""
def post(self, request, nnid):
"""set the time on the job :param request: :return:"""
<|body_0|>
def get(self, request, nnid):
"""get all job list :param request: :return:"""
<|body_1|>
def... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CommonJobInfo:
"""1. POST : 2. GET : 3. PUT : 4. DELETE :"""
def post(self, request, nnid):
"""set the time on the job :param request: :return:"""
try:
result = {}
row = service.JobStateLoader().set_job_info(nnid, json.loads(str(request.body, 'utf-8')))
... | the_stack_v2_python_sparse | tfmsarest/views/common_job.py | TensorMSA/tensormsa_old | train | 6 |
93dd35a7d4500b28e9804445015f472f9bdea05c | [
"if not nums:\n return 0\ndp = [0 for i in range(len(nums))]\ndp[0] = 1\nfor i in range(1, len(nums)):\n currmax = 0\n for j in range(i):\n if nums[j] < nums[i]:\n currmax = max(currmax, dp[j])\n dp[i] = currmax + 1\nreturn max(dp)",
"tails = [0] * len(nums)\nsize = 0\nfor x in nums:... | <|body_start_0|>
if not nums:
return 0
dp = [0 for i in range(len(nums))]
dp[0] = 1
for i in range(1, len(nums)):
currmax = 0
for j in range(i):
if nums[j] < nums[i]:
currmax = max(currmax, dp[j])
dp[i] =... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def lengthOfLIS(self, nums: List[int]) -> int:
"""DP solution, for each pos check the longest seq including curr number return the longest one Time O(n^2) Space O(n)"""
<|body_0|>
def lengthOfLIS(self, nums):
"""DP with binary search Time O(nlogn) Space O(n... | stack_v2_sparse_classes_36k_train_015232 | 1,215 | no_license | [
{
"docstring": "DP solution, for each pos check the longest seq including curr number return the longest one Time O(n^2) Space O(n)",
"name": "lengthOfLIS",
"signature": "def lengthOfLIS(self, nums: List[int]) -> int"
},
{
"docstring": "DP with binary search Time O(nlogn) Space O(n) https://leet... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lengthOfLIS(self, nums: List[int]) -> int: DP solution, for each pos check the longest seq including curr number return the longest one Time O(n^2) Space O(n)
- def lengthOfL... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lengthOfLIS(self, nums: List[int]) -> int: DP solution, for each pos check the longest seq including curr number return the longest one Time O(n^2) Space O(n)
- def lengthOfL... | 237985eea9853a658f811355e8c75d6b141e40b2 | <|skeleton|>
class Solution:
def lengthOfLIS(self, nums: List[int]) -> int:
"""DP solution, for each pos check the longest seq including curr number return the longest one Time O(n^2) Space O(n)"""
<|body_0|>
def lengthOfLIS(self, nums):
"""DP with binary search Time O(nlogn) Space O(n... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def lengthOfLIS(self, nums: List[int]) -> int:
"""DP solution, for each pos check the longest seq including curr number return the longest one Time O(n^2) Space O(n)"""
if not nums:
return 0
dp = [0 for i in range(len(nums))]
dp[0] = 1
for i in ran... | the_stack_v2_python_sparse | 300. Longest Increasing Subsequence.py | Eustaceyi/Leetcode | train | 0 | |
28aa59c69a49f80feb0d7819bf8da704def57da3 | [
"self.actions = actions\nself.player_id = player_id\nself.goal_states = goal_states",
"play_cost = []\ndraft_cost = []\nplay_set = []\ndraft_set = []\ntry:\n for action in self.actions:\n if (action['play_card'], action['coords']) in play_set:\n continue\n play_set.append((action['play... | <|body_start_0|>
self.actions = actions
self.player_id = player_id
self.goal_states = goal_states
<|end_body_0|>
<|body_start_1|>
play_cost = []
draft_cost = []
play_set = []
draft_set = []
try:
for action in self.actions:
if (... | Class for local search algorithms | SearchProblem | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SearchProblem:
"""Class for local search algorithms"""
def __init__(self, player_id, goal_states, actions):
"""game_state: the current board in list of list format goal_state: Object BoardList"""
<|body_0|>
def GreedyAlgorithm(self, heuristic='simple'):
"""Greedy... | stack_v2_sparse_classes_36k_train_015233 | 1,748 | no_license | [
{
"docstring": "game_state: the current board in list of list format goal_state: Object BoardList",
"name": "__init__",
"signature": "def __init__(self, player_id, goal_states, actions)"
},
{
"docstring": "Greedy heuristic search (local constraint)",
"name": "GreedyAlgorithm",
"signature... | 2 | stack_v2_sparse_classes_30k_train_010811 | Implement the Python class `SearchProblem` described below.
Class description:
Class for local search algorithms
Method signatures and docstrings:
- def __init__(self, player_id, goal_states, actions): game_state: the current board in list of list format goal_state: Object BoardList
- def GreedyAlgorithm(self, heuris... | Implement the Python class `SearchProblem` described below.
Class description:
Class for local search algorithms
Method signatures and docstrings:
- def __init__(self, player_id, goal_states, actions): game_state: the current board in list of list format goal_state: Object BoardList
- def GreedyAlgorithm(self, heuris... | 1ac842505adcf5abf37ef0cd1bbd24b8ce87984f | <|skeleton|>
class SearchProblem:
"""Class for local search algorithms"""
def __init__(self, player_id, goal_states, actions):
"""game_state: the current board in list of list format goal_state: Object BoardList"""
<|body_0|>
def GreedyAlgorithm(self, heuristic='simple'):
"""Greedy... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SearchProblem:
"""Class for local search algorithms"""
def __init__(self, player_id, goal_states, actions):
"""game_state: the current board in list of list format goal_state: Object BoardList"""
self.actions = actions
self.player_id = player_id
self.goal_states = goal_sta... | the_stack_v2_python_sparse | agents/group13/hs_utils/search_problem.py | hmooy/Sequence-COMP90054 | train | 0 |
1634ee8be39bbf84c34233d1e6b636da18dfca76 | [
"self.path = root_dir\nself.feelMap = {'neg': 0, 'pos': 1}\nself.files = []\nself.doConvert = False\nmypath = os.path.join(self.path, 'input')\nif not os.path.exists(mypath) or not os.path.isdir(mypath):\n print('please check the root_dir!')\n raise ValueError\nfor root, _, filename in os.walk(mypath):\n f... | <|body_start_0|>
self.path = root_dir
self.feelMap = {'neg': 0, 'pos': 1}
self.files = []
self.doConvert = False
mypath = os.path.join(self.path, 'input')
if not os.path.exists(mypath) or not os.path.isdir(mypath):
print('please check the root_dir!')
... | preprocess MovieReview dataset | MovieReview | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-proprietary-license"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MovieReview:
"""preprocess MovieReview dataset"""
def __init__(self, root_dir, maxlen, split):
"""input: root_dir: the root directory path of the MR dataset maxlen: set the max length of the sentence split: set the ratio of training set to testing set rank: the logic order of the wor... | stack_v2_sparse_classes_36k_train_015234 | 7,969 | permissive | [
{
"docstring": "input: root_dir: the root directory path of the MR dataset maxlen: set the max length of the sentence split: set the ratio of training set to testing set rank: the logic order of the worker size: the worker num",
"name": "__init__",
"signature": "def __init__(self, root_dir, maxlen, spli... | 5 | stack_v2_sparse_classes_30k_train_019107 | Implement the Python class `MovieReview` described below.
Class description:
preprocess MovieReview dataset
Method signatures and docstrings:
- def __init__(self, root_dir, maxlen, split): input: root_dir: the root directory path of the MR dataset maxlen: set the max length of the sentence split: set the ratio of tra... | Implement the Python class `MovieReview` described below.
Class description:
preprocess MovieReview dataset
Method signatures and docstrings:
- def __init__(self, root_dir, maxlen, split): input: root_dir: the root directory path of the MR dataset maxlen: set the max length of the sentence split: set the ratio of tra... | eab643f51336dbf7d711f02d27e6516e5affee59 | <|skeleton|>
class MovieReview:
"""preprocess MovieReview dataset"""
def __init__(self, root_dir, maxlen, split):
"""input: root_dir: the root directory path of the MR dataset maxlen: set the max length of the sentence split: set the ratio of training set to testing set rank: the logic order of the wor... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MovieReview:
"""preprocess MovieReview dataset"""
def __init__(self, root_dir, maxlen, split):
"""input: root_dir: the root directory path of the MR dataset maxlen: set the max length of the sentence split: set the ratio of training set to testing set rank: the logic order of the worker size: the... | the_stack_v2_python_sparse | research/nlp/textcnn/infer/sdk/predata.py | mindspore-ai/models | train | 301 |
380b0542032b1d8f4b9b533cd874f563fa9d4aa3 | [
"n = len(machines)\ntotal = sum(machines)\nif total % n:\n return -1\navg = total // n\nleft_sum, right_sum = (0, total)\nres = 0\nfor i in range(n):\n right_sum -= machines[i]\n toLeft = max(avg * i - left_sum, 0)\n toRight = max(avg * (n - i - 1) - right_sum, 0)\n res = max(toLeft + toRight, res)\n... | <|body_start_0|>
n = len(machines)
total = sum(machines)
if total % n:
return -1
avg = total // n
left_sum, right_sum = (0, total)
res = 0
for i in range(n):
right_sum -= machines[i]
toLeft = max(avg * i - left_sum, 0)
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findMinMoves(self, machines):
"""减少空间和计算量 :param machines: :return:"""
<|body_0|>
def findMinMoves2(self, machines):
""":type machines: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
n = len(machines)
tot... | stack_v2_sparse_classes_36k_train_015235 | 3,180 | no_license | [
{
"docstring": "减少空间和计算量 :param machines: :return:",
"name": "findMinMoves",
"signature": "def findMinMoves(self, machines)"
},
{
"docstring": ":type machines: List[int] :rtype: int",
"name": "findMinMoves2",
"signature": "def findMinMoves2(self, machines)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findMinMoves(self, machines): 减少空间和计算量 :param machines: :return:
- def findMinMoves2(self, machines): :type machines: List[int] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findMinMoves(self, machines): 减少空间和计算量 :param machines: :return:
- def findMinMoves2(self, machines): :type machines: List[int] :rtype: int
<|skeleton|>
class Solution:
... | 5d3574ccd282d0146c83c286ae28d8baaabd4910 | <|skeleton|>
class Solution:
def findMinMoves(self, machines):
"""减少空间和计算量 :param machines: :return:"""
<|body_0|>
def findMinMoves2(self, machines):
""":type machines: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def findMinMoves(self, machines):
"""减少空间和计算量 :param machines: :return:"""
n = len(machines)
total = sum(machines)
if total % n:
return -1
avg = total // n
left_sum, right_sum = (0, total)
res = 0
for i in range(n):
... | the_stack_v2_python_sparse | 517_超级洗衣机.py | lovehhf/LeetCode | train | 0 | |
a25cfd7578aaee0e0c84a1200d7c5c14db1fd9b2 | [
"n = len(nums)\nif n * k == 0:\n return []\nif k == 1:\n return nums\nleft, right = ([0] * n, [0] * n)\nleft[0], right[n - 1] = (nums[0], nums[n - 1])\nfor lft_idx in range(1, n):\n if lft_idx % k == 0:\n left[lft_idx] = nums[lft_idx]\n else:\n left[lft_idx] = max(left[lft_idx - 1], nums[l... | <|body_start_0|>
n = len(nums)
if n * k == 0:
return []
if k == 1:
return nums
left, right = ([0] * n, [0] * n)
left[0], right[n - 1] = (nums[0], nums[n - 1])
for lft_idx in range(1, n):
if lft_idx % k == 0:
left[lft_idx... | SlidingWindow | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SlidingWindow:
def get_all_max_(self, nums: List[int], k: int) -> List[int]:
"""Approach: DP Time Complexity: O(N) Space Complexity: O(N) :param nums: :param k: :return:"""
<|body_0|>
def get_all_max(self, nums: List[int], k: int) -> List[int]:
"""Approach: Deque / D... | stack_v2_sparse_classes_36k_train_015236 | 3,324 | no_license | [
{
"docstring": "Approach: DP Time Complexity: O(N) Space Complexity: O(N) :param nums: :param k: :return:",
"name": "get_all_max_",
"signature": "def get_all_max_(self, nums: List[int], k: int) -> List[int]"
},
{
"docstring": "Approach: Deque / Doubly Linked List Time Complexity: O(N) - since ea... | 2 | stack_v2_sparse_classes_30k_train_004279 | Implement the Python class `SlidingWindow` described below.
Class description:
Implement the SlidingWindow class.
Method signatures and docstrings:
- def get_all_max_(self, nums: List[int], k: int) -> List[int]: Approach: DP Time Complexity: O(N) Space Complexity: O(N) :param nums: :param k: :return:
- def get_all_ma... | Implement the Python class `SlidingWindow` described below.
Class description:
Implement the SlidingWindow class.
Method signatures and docstrings:
- def get_all_max_(self, nums: List[int], k: int) -> List[int]: Approach: DP Time Complexity: O(N) Space Complexity: O(N) :param nums: :param k: :return:
- def get_all_ma... | 65cc78b5afa0db064f9fe8f06597e3e120f7363d | <|skeleton|>
class SlidingWindow:
def get_all_max_(self, nums: List[int], k: int) -> List[int]:
"""Approach: DP Time Complexity: O(N) Space Complexity: O(N) :param nums: :param k: :return:"""
<|body_0|>
def get_all_max(self, nums: List[int], k: int) -> List[int]:
"""Approach: Deque / D... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SlidingWindow:
def get_all_max_(self, nums: List[int], k: int) -> List[int]:
"""Approach: DP Time Complexity: O(N) Space Complexity: O(N) :param nums: :param k: :return:"""
n = len(nums)
if n * k == 0:
return []
if k == 1:
return nums
left, right... | the_stack_v2_python_sparse | amazon/sliding_window/sliding_window_maximum.py | Shiv2157k/leet_code | train | 1 | |
6c45bf8ab80c5c4a955e7bd9e9d7d4e6f8216ab5 | [
"self.num_in = num_in\nself.number_of_nodes = number_of_nodes\nself.weights = self.init_weights(activation)\nself.output = activation(T.dot(input, self.weights))\nself.params = [self.weights]",
"weights = np.asarray(np.random.uniform(low=-np.sqrt(6.0 / (self.num_in + self.number_of_nodes)), high=np.sqrt(6.0 / (se... | <|body_start_0|>
self.num_in = num_in
self.number_of_nodes = number_of_nodes
self.weights = self.init_weights(activation)
self.output = activation(T.dot(input, self.weights))
self.params = [self.weights]
<|end_body_0|>
<|body_start_1|>
weights = np.asarray(np.random.unif... | HiddenLayer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HiddenLayer:
def __init__(self, input, num_in, number_of_nodes, activation):
"""A hidden layer in an artifical neural network is defined by the output of the activation function of the previous layer, the number of incoming neurons connected to the layer, the amount of neurons in the lay... | stack_v2_sparse_classes_36k_train_015237 | 2,621 | permissive | [
{
"docstring": "A hidden layer in an artifical neural network is defined by the output of the activation function of the previous layer, the number of incoming neurons connected to the layer, the amount of neurons in the layer and an activation function. :param input: the output of the activation function in th... | 2 | stack_v2_sparse_classes_30k_train_016708 | Implement the Python class `HiddenLayer` described below.
Class description:
Implement the HiddenLayer class.
Method signatures and docstrings:
- def __init__(self, input, num_in, number_of_nodes, activation): A hidden layer in an artifical neural network is defined by the output of the activation function of the pre... | Implement the Python class `HiddenLayer` described below.
Class description:
Implement the HiddenLayer class.
Method signatures and docstrings:
- def __init__(self, input, num_in, number_of_nodes, activation): A hidden layer in an artifical neural network is defined by the output of the activation function of the pre... | 79f3b4a5f624d473b461548b263bcf7ecc0846dc | <|skeleton|>
class HiddenLayer:
def __init__(self, input, num_in, number_of_nodes, activation):
"""A hidden layer in an artifical neural network is defined by the output of the activation function of the previous layer, the number of incoming neurons connected to the layer, the amount of neurons in the lay... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class HiddenLayer:
def __init__(self, input, num_in, number_of_nodes, activation):
"""A hidden layer in an artifical neural network is defined by the output of the activation function of the previous layer, the number of incoming neurons connected to the layer, the amount of neurons in the layer and an acti... | the_stack_v2_python_sparse | project3/module5/deeplearning/layer.py | pmitche/it3105-aiprogramming | train | 3 | |
94c5a8481b122d63b31660284efea93c4821c7ae | [
"self.N = 64\nself.num_channels = [1, 16]\nself.platforms = ['gpuNUFFT']",
"for num_channels in self.num_channels:\n for platform in self.platforms:\n _mask = np.random.randint(2, size=(self.N, self.N, self.N))\n _samples = convert_mask_to_locations(_mask)\n fourier_op_dir = NonCartesianFF... | <|body_start_0|>
self.N = 64
self.num_channels = [1, 16]
self.platforms = ['gpuNUFFT']
<|end_body_0|>
<|body_start_1|>
for num_channels in self.num_channels:
for platform in self.platforms:
_mask = np.random.randint(2, size=(self.N, self.N, self.N))
... | Test the adjoint operator of the NFFT both for 2D and 3D. | TestAdjointOperatorFourierTransformGPU | [
"LicenseRef-scancode-cecill-b-en"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestAdjointOperatorFourierTransformGPU:
"""Test the adjoint operator of the NFFT both for 2D and 3D."""
def setUp(self):
"""Set the number of iterations."""
<|body_0|>
def test_NUFFT_3D(self):
"""Test the adjoint operator for the 3D non-Cartesian Fourier transfor... | stack_v2_sparse_classes_36k_train_015238 | 3,812 | permissive | [
{
"docstring": "Set the number of iterations.",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "Test the adjoint operator for the 3D non-Cartesian Fourier transform on GPU",
"name": "test_NUFFT_3D",
"signature": "def test_NUFFT_3D(self)"
},
{
"docstring": "Test... | 3 | stack_v2_sparse_classes_30k_train_005575 | Implement the Python class `TestAdjointOperatorFourierTransformGPU` described below.
Class description:
Test the adjoint operator of the NFFT both for 2D and 3D.
Method signatures and docstrings:
- def setUp(self): Set the number of iterations.
- def test_NUFFT_3D(self): Test the adjoint operator for the 3D non-Carte... | Implement the Python class `TestAdjointOperatorFourierTransformGPU` described below.
Class description:
Test the adjoint operator of the NFFT both for 2D and 3D.
Method signatures and docstrings:
- def setUp(self): Set the number of iterations.
- def test_NUFFT_3D(self): Test the adjoint operator for the 3D non-Carte... | 9a3e1f046fb31add5f276dc7869051d6ef2caac0 | <|skeleton|>
class TestAdjointOperatorFourierTransformGPU:
"""Test the adjoint operator of the NFFT both for 2D and 3D."""
def setUp(self):
"""Set the number of iterations."""
<|body_0|>
def test_NUFFT_3D(self):
"""Test the adjoint operator for the 3D non-Cartesian Fourier transfor... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestAdjointOperatorFourierTransformGPU:
"""Test the adjoint operator of the NFFT both for 2D and 3D."""
def setUp(self):
"""Set the number of iterations."""
self.N = 64
self.num_channels = [1, 16]
self.platforms = ['gpuNUFFT']
def test_NUFFT_3D(self):
"""Test ... | the_stack_v2_python_sparse | mri/test_local/test_fourier_adjoint_gpu.py | CEA-COSMIC/pysap-mri | train | 38 |
a763c9d6e4f909126e046c04ee2baa79a24923ea | [
"if m < n:\n m, n = (n, m)\nmul = lambda x, y: reduce(operator.mul, range(x, y), 1)\nreturn mul(m, m + n - 1) / mul(1, n)",
"if m < n:\n m, n = (n, m)\ndp = [0] * n\ndp[0] = 1\nfor x in range(m):\n for y in range(n - 1):\n dp[y + 1] += dp[y]\nreturn dp[n - 1]",
"dp = [[0] * n for x in range(m)]\... | <|body_start_0|>
if m < n:
m, n = (n, m)
mul = lambda x, y: reduce(operator.mul, range(x, y), 1)
return mul(m, m + n - 1) / mul(1, n)
<|end_body_0|>
<|body_start_1|>
if m < n:
m, n = (n, m)
dp = [0] * n
dp[0] = 1
for x in range(m):
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def uniquePaths(self, m, n):
""":type m: int :type n: int :rtype: int"""
<|body_0|>
def uniquePaths_v1(self, m, n):
""":type m: int :type n: int :rtype: int"""
<|body_1|>
def uniquePaths_v0(self, m, n):
""":type m: int :type n: int :rty... | stack_v2_sparse_classes_36k_train_015239 | 3,652 | no_license | [
{
"docstring": ":type m: int :type n: int :rtype: int",
"name": "uniquePaths",
"signature": "def uniquePaths(self, m, n)"
},
{
"docstring": ":type m: int :type n: int :rtype: int",
"name": "uniquePaths_v1",
"signature": "def uniquePaths_v1(self, m, n)"
},
{
"docstring": ":type m:... | 3 | stack_v2_sparse_classes_30k_train_005362 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def uniquePaths(self, m, n): :type m: int :type n: int :rtype: int
- def uniquePaths_v1(self, m, n): :type m: int :type n: int :rtype: int
- def uniquePaths_v0(self, m, n): :type... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def uniquePaths(self, m, n): :type m: int :type n: int :rtype: int
- def uniquePaths_v1(self, m, n): :type m: int :type n: int :rtype: int
- def uniquePaths_v0(self, m, n): :type... | b5e09f24e8e96454dc99e20281e853fb9fcc85ed | <|skeleton|>
class Solution:
def uniquePaths(self, m, n):
""":type m: int :type n: int :rtype: int"""
<|body_0|>
def uniquePaths_v1(self, m, n):
""":type m: int :type n: int :rtype: int"""
<|body_1|>
def uniquePaths_v0(self, m, n):
""":type m: int :type n: int :rty... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def uniquePaths(self, m, n):
""":type m: int :type n: int :rtype: int"""
if m < n:
m, n = (n, m)
mul = lambda x, y: reduce(operator.mul, range(x, y), 1)
return mul(m, m + n - 1) / mul(1, n)
def uniquePaths_v1(self, m, n):
""":type m: int :type... | the_stack_v2_python_sparse | python/62_Unique_Paths.py | Moby5/myleetcode | train | 2 | |
298afdd04d0898da81cdb976541ed34dd2aba2d9 | [
"self.net = net\nself.dataset = dataset\nself.val_image_ids = val_image_ids\nself.coco_labels = coco_labels",
"with torch.no_grad():\n results = []\n for i in range(len(self.dataset)):\n img, bbox, label, loc, scale = self.dataset[i]\n img = img.cuda().view(1, img.shape[0], img.shape[1], img.s... | <|body_start_0|>
self.net = net
self.dataset = dataset
self.val_image_ids = val_image_ids
self.coco_labels = coco_labels
<|end_body_0|>
<|body_start_1|>
with torch.no_grad():
results = []
for i in range(len(self.dataset)):
img, bbox, label... | COCOEvaluator | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class COCOEvaluator:
def __init__(self, net, dataset, val_image_ids, coco_labels):
"""external initialization structure: net(Model), dataset(Dataset) val_image_ids: [12341, 244135, ...] coco_labels: {"1": 1, "2": 4, ...}"""
<|body_0|>
def step_epoch(self):
"""all models sh... | stack_v2_sparse_classes_36k_train_015240 | 8,178 | permissive | [
{
"docstring": "external initialization structure: net(Model), dataset(Dataset) val_image_ids: [12341, 244135, ...] coco_labels: {\"1\": 1, \"2\": 4, ...}",
"name": "__init__",
"signature": "def __init__(self, net, dataset, val_image_ids, coco_labels)"
},
{
"docstring": "all models should be in ... | 2 | stack_v2_sparse_classes_30k_train_001479 | Implement the Python class `COCOEvaluator` described below.
Class description:
Implement the COCOEvaluator class.
Method signatures and docstrings:
- def __init__(self, net, dataset, val_image_ids, coco_labels): external initialization structure: net(Model), dataset(Dataset) val_image_ids: [12341, 244135, ...] coco_l... | Implement the Python class `COCOEvaluator` described below.
Class description:
Implement the COCOEvaluator class.
Method signatures and docstrings:
- def __init__(self, net, dataset, val_image_ids, coco_labels): external initialization structure: net(Model), dataset(Dataset) val_image_ids: [12341, 244135, ...] coco_l... | 4f62f7754cf3f408b785a5ef410d5ca452d9cabf | <|skeleton|>
class COCOEvaluator:
def __init__(self, net, dataset, val_image_ids, coco_labels):
"""external initialization structure: net(Model), dataset(Dataset) val_image_ids: [12341, 244135, ...] coco_labels: {"1": 1, "2": 4, ...}"""
<|body_0|>
def step_epoch(self):
"""all models sh... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class COCOEvaluator:
def __init__(self, net, dataset, val_image_ids, coco_labels):
"""external initialization structure: net(Model), dataset(Dataset) val_image_ids: [12341, 244135, ...] coco_labels: {"1": 1, "2": 4, ...}"""
self.net = net
self.dataset = dataset
self.val_image_ids = v... | the_stack_v2_python_sparse | api.py | Cuzzan/fcos | train | 1 | |
f9eda54446842508b1e43dd70e0451c368dec8e4 | [
"sketch = Sketch.query.get_with_acl(sketch_id)\nif not sketch:\n abort(HTTP_STATUS_CODE_NOT_FOUND, 'No sketch found with this ID.')\ngraphs = sketch.graphs\nreturn self.to_json(graphs)",
"sketch = Sketch.query.get_with_acl(sketch_id)\nif not sketch:\n abort(HTTP_STATUS_CODE_NOT_FOUND, 'No sketch found with ... | <|body_start_0|>
sketch = Sketch.query.get_with_acl(sketch_id)
if not sketch:
abort(HTTP_STATUS_CODE_NOT_FOUND, 'No sketch found with this ID.')
graphs = sketch.graphs
return self.to_json(graphs)
<|end_body_0|>
<|body_start_1|>
sketch = Sketch.query.get_with_acl(sket... | Resource to get all saved graphs for a sketch. | GraphListResource | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GraphListResource:
"""Resource to get all saved graphs for a sketch."""
def get(self, sketch_id):
"""Handles GET request to the resource. Returns: List of graphs in JSON (instance of flask.wrappers.Response)"""
<|body_0|>
def post(self, sketch_id):
"""Handles POS... | stack_v2_sparse_classes_36k_train_015241 | 12,247 | permissive | [
{
"docstring": "Handles GET request to the resource. Returns: List of graphs in JSON (instance of flask.wrappers.Response)",
"name": "get",
"signature": "def get(self, sketch_id)"
},
{
"docstring": "Handles POST request to the resource.",
"name": "post",
"signature": "def post(self, sket... | 2 | stack_v2_sparse_classes_30k_train_016249 | Implement the Python class `GraphListResource` described below.
Class description:
Resource to get all saved graphs for a sketch.
Method signatures and docstrings:
- def get(self, sketch_id): Handles GET request to the resource. Returns: List of graphs in JSON (instance of flask.wrappers.Response)
- def post(self, sk... | Implement the Python class `GraphListResource` described below.
Class description:
Resource to get all saved graphs for a sketch.
Method signatures and docstrings:
- def get(self, sketch_id): Handles GET request to the resource. Returns: List of graphs in JSON (instance of flask.wrappers.Response)
- def post(self, sk... | 24f471b58ca4a87cb053961b5f05c07a544ca7b8 | <|skeleton|>
class GraphListResource:
"""Resource to get all saved graphs for a sketch."""
def get(self, sketch_id):
"""Handles GET request to the resource. Returns: List of graphs in JSON (instance of flask.wrappers.Response)"""
<|body_0|>
def post(self, sketch_id):
"""Handles POS... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GraphListResource:
"""Resource to get all saved graphs for a sketch."""
def get(self, sketch_id):
"""Handles GET request to the resource. Returns: List of graphs in JSON (instance of flask.wrappers.Response)"""
sketch = Sketch.query.get_with_acl(sketch_id)
if not sketch:
... | the_stack_v2_python_sparse | timesketch/api/v1/resources/graph.py | google/timesketch | train | 2,263 |
71d934830476fd2eb3316749b3630e6090868f5d | [
"super(EntityFromHmiResults, self).__init__(resolve_type=Entity)\nself._robot = robot\nself._hmi_result_des = hmi_result_des\nself.parse = parse",
"entity_id = self._hmi_result_des.resolve().semantics\nif entity_id is None:\n return None\nentities = self._robot.ed.get_entities(uuid=entity_id)\nif entities:\n ... | <|body_start_0|>
super(EntityFromHmiResults, self).__init__(resolve_type=Entity)
self._robot = robot
self._hmi_result_des = hmi_result_des
self.parse = parse
<|end_body_0|>
<|body_start_1|>
entity_id = self._hmi_result_des.resolve().semantics
if entity_id is None:
... | Designator to pick the closest item on top of the table to grab. This is used for testing | EntityFromHmiResults | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EntityFromHmiResults:
"""Designator to pick the closest item on top of the table to grab. This is used for testing"""
def __init__(self, robot, hmi_result_des, parse=True):
"""Constructor :param robot: robot object :param hmi_result_des:"""
<|body_0|>
def _resolve(self):... | stack_v2_sparse_classes_36k_train_015242 | 18,216 | no_license | [
{
"docstring": "Constructor :param robot: robot object :param hmi_result_des:",
"name": "__init__",
"signature": "def __init__(self, robot, hmi_result_des, parse=True)"
},
{
"docstring": "Resolves :return: entity in the <area_description> of the <surface_designator> that is closest to the robot"... | 2 | null | Implement the Python class `EntityFromHmiResults` described below.
Class description:
Designator to pick the closest item on top of the table to grab. This is used for testing
Method signatures and docstrings:
- def __init__(self, robot, hmi_result_des, parse=True): Constructor :param robot: robot object :param hmi_r... | Implement the Python class `EntityFromHmiResults` described below.
Class description:
Designator to pick the closest item on top of the table to grab. This is used for testing
Method signatures and docstrings:
- def __init__(self, robot, hmi_result_des, parse=True): Constructor :param robot: robot object :param hmi_r... | 092a354315b9b2c08e32cdc049791d82dfd47745 | <|skeleton|>
class EntityFromHmiResults:
"""Designator to pick the closest item on top of the table to grab. This is used for testing"""
def __init__(self, robot, hmi_result_des, parse=True):
"""Constructor :param robot: robot object :param hmi_result_des:"""
<|body_0|>
def _resolve(self):... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class EntityFromHmiResults:
"""Designator to pick the closest item on top of the table to grab. This is used for testing"""
def __init__(self, robot, hmi_result_des, parse=True):
"""Constructor :param robot: robot object :param hmi_result_des:"""
super(EntityFromHmiResults, self).__init__(resol... | the_stack_v2_python_sparse | challenge_where_is_this/src/challenge_where_is_this/inform_machine.py | tue-robotics/tue_robocup | train | 39 |
75881f6389deacd3568bc63be989856665e42b3e | [
"super().__init__()\nself._num_observations_per_parameter = 4\nself._posterior_samples = None",
"if isinstance(parameters, torch.Tensor):\n parameters = utils.tensor2numpy(parameters)\nif parameters.ndim == 1:\n return self.simulate(parameters[np.newaxis, :])[0]\nnum_simulations = parameters.shape[0]\nself.... | <|body_start_0|>
super().__init__()
self._num_observations_per_parameter = 4
self._posterior_samples = None
<|end_body_0|>
<|body_start_1|>
if isinstance(parameters, torch.Tensor):
parameters = utils.tensor2numpy(parameters)
if parameters.ndim == 1:
retur... | Implemenation of nonlinear Gaussian simulator as described in section 5.2 and appendix A.1 of 'Sequential Neural Likelihood', Papamakarios et al. | NonlinearGaussianSimulator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NonlinearGaussianSimulator:
"""Implemenation of nonlinear Gaussian simulator as described in section 5.2 and appendix A.1 of 'Sequential Neural Likelihood', Papamakarios et al."""
def __init__(self):
"""Set up simulator."""
<|body_0|>
def __call__(self, parameters):
... | stack_v2_sparse_classes_36k_train_015243 | 7,303 | no_license | [
{
"docstring": "Set up simulator.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Generate observations from non-linear Gaussian model for the given batch of parameters. Arguments: parameters {torch.Tensor} -- Batch of parameters. Returns: torch.Tensor [batch size, 2 *... | 3 | stack_v2_sparse_classes_30k_train_011283 | Implement the Python class `NonlinearGaussianSimulator` described below.
Class description:
Implemenation of nonlinear Gaussian simulator as described in section 5.2 and appendix A.1 of 'Sequential Neural Likelihood', Papamakarios et al.
Method signatures and docstrings:
- def __init__(self): Set up simulator.
- def ... | Implement the Python class `NonlinearGaussianSimulator` described below.
Class description:
Implemenation of nonlinear Gaussian simulator as described in section 5.2 and appendix A.1 of 'Sequential Neural Likelihood', Papamakarios et al.
Method signatures and docstrings:
- def __init__(self): Set up simulator.
- def ... | 1bc2952f352a4b68d148b1a8d193c480b582b152 | <|skeleton|>
class NonlinearGaussianSimulator:
"""Implemenation of nonlinear Gaussian simulator as described in section 5.2 and appendix A.1 of 'Sequential Neural Likelihood', Papamakarios et al."""
def __init__(self):
"""Set up simulator."""
<|body_0|>
def __call__(self, parameters):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NonlinearGaussianSimulator:
"""Implemenation of nonlinear Gaussian simulator as described in section 5.2 and appendix A.1 of 'Sequential Neural Likelihood', Papamakarios et al."""
def __init__(self):
"""Set up simulator."""
super().__init__()
self._num_observations_per_parameter =... | the_stack_v2_python_sparse | sbi/simulators/nonlinear_gaussian.py | boyali/sbi | train | 0 |
6adc4ee00a565ea3ae12cbd1e577f8db42b3086c | [
"self.Path = '/proc/device-tree/p981x_1057@20'\nself.P981x0 = '/dev/p981x0'\ntry:\n if not os.path.exists(self.Path):\n InstallDTBO('BB-GPIO-P9813')\n while not os.path.exists(self.Path):\n time.sleep(0.1)\n self.f = open(self.P981x0, 'w')\n self.f.write('N %d\\n' % leds)\n self... | <|body_start_0|>
self.Path = '/proc/device-tree/p981x_1057@20'
self.P981x0 = '/dev/p981x0'
try:
if not os.path.exists(self.Path):
InstallDTBO('BB-GPIO-P9813')
while not os.path.exists(self.Path):
time.sleep(0.1)
self.f =... | P981X RGB LED Driver | P981X | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class P981X:
"""P981X RGB LED Driver"""
def __init__(self, leds=2):
"""Initialize the P981X using file python library leds:the LED's chain length (defult leds = 2)"""
<|body_0|>
def set(self, led, red, green, blue):
"""Set LED's value of R,G,B led:which one on LED's ch... | stack_v2_sparse_classes_36k_train_015244 | 1,976 | permissive | [
{
"docstring": "Initialize the P981X using file python library leds:the LED's chain length (defult leds = 2)",
"name": "__init__",
"signature": "def __init__(self, leds=2)"
},
{
"docstring": "Set LED's value of R,G,B led:which one on LED's chain(defult 0 or 1) red:The value that describes R of R... | 2 | stack_v2_sparse_classes_30k_train_005117 | Implement the Python class `P981X` described below.
Class description:
P981X RGB LED Driver
Method signatures and docstrings:
- def __init__(self, leds=2): Initialize the P981X using file python library leds:the LED's chain length (defult leds = 2)
- def set(self, led, red, green, blue): Set LED's value of R,G,B led:... | Implement the Python class `P981X` described below.
Class description:
P981X RGB LED Driver
Method signatures and docstrings:
- def __init__(self, leds=2): Initialize the P981X using file python library leds:the LED's chain length (defult leds = 2)
- def set(self, led, red, green, blue): Set LED's value of R,G,B led:... | 48236dd6d24885b0d06287d47b1c31e4b55fd1bf | <|skeleton|>
class P981X:
"""P981X RGB LED Driver"""
def __init__(self, leds=2):
"""Initialize the P981X using file python library leds:the LED's chain length (defult leds = 2)"""
<|body_0|>
def set(self, led, red, green, blue):
"""Set LED's value of R,G,B led:which one on LED's ch... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class P981X:
"""P981X RGB LED Driver"""
def __init__(self, leds=2):
"""Initialize the P981X using file python library leds:the LED's chain length (defult leds = 2)"""
self.Path = '/proc/device-tree/p981x_1057@20'
self.P981x0 = '/dev/p981x0'
try:
if not os.path.exists... | the_stack_v2_python_sparse | PocketBeagle/Grove/RGBLed.py | beagleboard/cloud9-examples | train | 51 |
7b77e6f71ea8bb254cef5e03b91bab19d204670c | [
"ob = webdriver.Firefox()\nob.get('https://free-ss.site/')\ntime.sleep(2)\na1 = ob.find_elements_by_css_selector(\"[role ='row']>td:nth-child(2)\")\na2 = ob.find_elements_by_css_selector(\"[role ='row']>td:nth-child(3)\")\na3 = ob.find_elements_by_css_selector(\"[role ='row']>td:nth-child(4)\")\na4 = ob.find_elemen... | <|body_start_0|>
ob = webdriver.Firefox()
ob.get('https://free-ss.site/')
time.sleep(2)
a1 = ob.find_elements_by_css_selector("[role ='row']>td:nth-child(2)")
a2 = ob.find_elements_by_css_selector("[role ='row']>td:nth-child(3)")
a3 = ob.find_elements_by_css_selector("[ro... | Getdata | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Getdata:
def get_data(self):
"""获取数据 :return:"""
<|body_0|>
def writ_data(self):
"""写入数据,去重 :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
ob = webdriver.Firefox()
ob.get('https://free-ss.site/')
time.sleep(2)
a1 = ... | stack_v2_sparse_classes_36k_train_015245 | 1,520 | no_license | [
{
"docstring": "获取数据 :return:",
"name": "get_data",
"signature": "def get_data(self)"
},
{
"docstring": "写入数据,去重 :return:",
"name": "writ_data",
"signature": "def writ_data(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_015322 | Implement the Python class `Getdata` described below.
Class description:
Implement the Getdata class.
Method signatures and docstrings:
- def get_data(self): 获取数据 :return:
- def writ_data(self): 写入数据,去重 :return: | Implement the Python class `Getdata` described below.
Class description:
Implement the Getdata class.
Method signatures and docstrings:
- def get_data(self): 获取数据 :return:
- def writ_data(self): 写入数据,去重 :return:
<|skeleton|>
class Getdata:
def get_data(self):
"""获取数据 :return:"""
<|body_0|>
... | ba63bc18f3c788090e43406315497329b00ec0a5 | <|skeleton|>
class Getdata:
def get_data(self):
"""获取数据 :return:"""
<|body_0|>
def writ_data(self):
"""写入数据,去重 :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Getdata:
def get_data(self):
"""获取数据 :return:"""
ob = webdriver.Firefox()
ob.get('https://free-ss.site/')
time.sleep(2)
a1 = ob.find_elements_by_css_selector("[role ='row']>td:nth-child(2)")
a2 = ob.find_elements_by_css_selector("[role ='row']>td:nth-child(3)")
... | the_stack_v2_python_sparse | create_date/get_ssh.py | NASA2333/study | train | 0 | |
0b62e5048083e9acc4ffb7788dc51e54bae28e9b | [
"self.account_id = account_id\nself.name = name\nself.org_no = org_no\nself.uni_customer_no = uni_customer_no\nself.created = APIHelper.RFC3339DateTime(created) if created else None\nself.last_modified = APIHelper.RFC3339DateTime(last_modified) if last_modified else None\nself.dealer_id = dealer_id\nself.dealer_nam... | <|body_start_0|>
self.account_id = account_id
self.name = name
self.org_no = org_no
self.uni_customer_no = uni_customer_no
self.created = APIHelper.RFC3339DateTime(created) if created else None
self.last_modified = APIHelper.RFC3339DateTime(last_modified) if last_modified... | Implementation of the 'AccountListItem' model. TODO: type model description here. Attributes: account_id (uuid|string): TODO: type description here. name (string): TODO: type description here. org_no (string): TODO: type description here. uni_customer_no (string): TODO: type description here. created (datetime): TODO: ... | AccountListItem | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AccountListItem:
"""Implementation of the 'AccountListItem' model. TODO: type model description here. Attributes: account_id (uuid|string): TODO: type description here. name (string): TODO: type description here. org_no (string): TODO: type description here. uni_customer_no (string): TODO: type d... | stack_v2_sparse_classes_36k_train_015246 | 4,399 | permissive | [
{
"docstring": "Constructor for the AccountListItem class",
"name": "__init__",
"signature": "def __init__(self, account_id=None, name=None, org_no=None, uni_customer_no=None, created=None, last_modified=None, dealer_id=None, dealer_name=None, dealer_reference=None, enabled=None, additional_properties={... | 2 | stack_v2_sparse_classes_30k_test_000710 | Implement the Python class `AccountListItem` described below.
Class description:
Implementation of the 'AccountListItem' model. TODO: type model description here. Attributes: account_id (uuid|string): TODO: type description here. name (string): TODO: type description here. org_no (string): TODO: type description here.... | Implement the Python class `AccountListItem` described below.
Class description:
Implementation of the 'AccountListItem' model. TODO: type model description here. Attributes: account_id (uuid|string): TODO: type description here. name (string): TODO: type description here. org_no (string): TODO: type description here.... | fa3918a6c54ea0eedb9146578645b7eb1755b642 | <|skeleton|>
class AccountListItem:
"""Implementation of the 'AccountListItem' model. TODO: type model description here. Attributes: account_id (uuid|string): TODO: type description here. name (string): TODO: type description here. org_no (string): TODO: type description here. uni_customer_no (string): TODO: type d... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AccountListItem:
"""Implementation of the 'AccountListItem' model. TODO: type model description here. Attributes: account_id (uuid|string): TODO: type description here. name (string): TODO: type description here. org_no (string): TODO: type description here. uni_customer_no (string): TODO: type description he... | the_stack_v2_python_sparse | idfy_rest_client/models/account_list_item.py | dealflowteam/Idfy | train | 0 |
32cbcb3fca334de16c74b94a72e87ecb48c5dc5f | [
"super().__init__()\nself.in_chans = in_chans\nself.out_chans = out_chans\nself.chans = chans\nself.num_pool_layers = num_pool_layers\nself.drop_prob = drop_prob\nself.down_sample_layers = torch.nn.ModuleList([ConvBlock(in_chans, chans, drop_prob)])\nch = chans\nfor _ in range(num_pool_layers - 1):\n self.down_s... | <|body_start_0|>
super().__init__()
self.in_chans = in_chans
self.out_chans = out_chans
self.chans = chans
self.num_pool_layers = num_pool_layers
self.drop_prob = drop_prob
self.down_sample_layers = torch.nn.ModuleList([ConvBlock(in_chans, chans, drop_prob)])
... | PyTorch implementation of a U-Net model, as presented in [1]_. References ---------- .. [1] O. Ronneberger, P. Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computer-assisted intervention, pages 234–241. Springer, 20... | Unet | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Unet:
"""PyTorch implementation of a U-Net model, as presented in [1]_. References ---------- .. [1] O. Ronneberger, P. Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computer-assisted intervent... | stack_v2_sparse_classes_36k_train_015247 | 10,509 | permissive | [
{
"docstring": "Parameters ---------- in_chans: Number of channels in the input to the U-Net model. out_chans: Number of channels in the output to the U-Net model. chans: Number of output channels of the first convolution layer. num_pool_layers: Number of down-sampling and up-sampling layers. drop_prob: Dropout... | 2 | null | Implement the Python class `Unet` described below.
Class description:
PyTorch implementation of a U-Net model, as presented in [1]_. References ---------- .. [1] O. Ronneberger, P. Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image co... | Implement the Python class `Unet` described below.
Class description:
PyTorch implementation of a U-Net model, as presented in [1]_. References ---------- .. [1] O. Ronneberger, P. Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image co... | 6d15dd55ca5ed6fc9fbfd31d8488ee7bab453066 | <|skeleton|>
class Unet:
"""PyTorch implementation of a U-Net model, as presented in [1]_. References ---------- .. [1] O. Ronneberger, P. Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computer-assisted intervent... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Unet:
"""PyTorch implementation of a U-Net model, as presented in [1]_. References ---------- .. [1] O. Ronneberger, P. Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computer-assisted intervention, pages 23... | the_stack_v2_python_sparse | mridc/collections/reconstruction/models/unet_base/unet_block.py | wdika/mridc | train | 40 |
8c3b9b3c825afce0260d13fb35fcd64ef6b13270 | [
"query_set = self.get_queryset().order_by('ranking_type', 'date')\nranking_types = clear_list(_extract_params(request, 'ranking_type'))\nif ranking_types:\n query_set = query_set.filter(ranking_type__in=ranking_types)\nreturn Response(query_set.values('ranking_type', 'date').distinct())",
"fat = parse_bool(nex... | <|body_start_0|>
query_set = self.get_queryset().order_by('ranking_type', 'date')
ranking_types = clear_list(_extract_params(request, 'ranking_type'))
if ranking_types:
query_set = query_set.filter(ranking_type__in=ranking_types)
return Response(query_set.values('ranking_type... | Ranking view set. | RankingViewSet | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RankingViewSet:
"""Ranking view set."""
def dates(self, request, format=None):
"""Find all available dates with rankings."""
<|body_0|>
def games(self, request, format=None):
"""Similar to self.list(), but with full game details."""
<|body_1|>
<|end_skel... | stack_v2_sparse_classes_36k_train_015248 | 33,764 | permissive | [
{
"docstring": "Find all available dates with rankings.",
"name": "dates",
"signature": "def dates(self, request, format=None)"
},
{
"docstring": "Similar to self.list(), but with full game details.",
"name": "games",
"signature": "def games(self, request, format=None)"
}
] | 2 | stack_v2_sparse_classes_30k_train_015242 | Implement the Python class `RankingViewSet` described below.
Class description:
Ranking view set.
Method signatures and docstrings:
- def dates(self, request, format=None): Find all available dates with rankings.
- def games(self, request, format=None): Similar to self.list(), but with full game details. | Implement the Python class `RankingViewSet` described below.
Class description:
Ranking view set.
Method signatures and docstrings:
- def dates(self, request, format=None): Find all available dates with rankings.
- def games(self, request, format=None): Similar to self.list(), but with full game details.
<|skeleton|... | 47493c3b32ea9d2153013371d4121ef50af20d45 | <|skeleton|>
class RankingViewSet:
"""Ranking view set."""
def dates(self, request, format=None):
"""Find all available dates with rankings."""
<|body_0|>
def games(self, request, format=None):
"""Similar to self.list(), but with full game details."""
<|body_1|>
<|end_skel... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RankingViewSet:
"""Ranking view set."""
def dates(self, request, format=None):
"""Find all available dates with rankings."""
query_set = self.get_queryset().order_by('ranking_type', 'date')
ranking_types = clear_list(_extract_params(request, 'ranking_type'))
if ranking_typ... | the_stack_v2_python_sparse | games/views.py | recommend-games/recommend-games-server | train | 3 |
1bc9cb24bf2e3556a9618f1d92b68b66a25c6bd8 | [
"ins_port = IOPort('ins', 'data', 'in', 32, False)\nopcode_port = IOPort('opcode', 'address', 'out', 8, False)\nreg_a_port = IOPort('reg-a', 'control', 'out', 4, False)\nreg_b_port = IOPort('reg-b', 'control', 'out', 4, False)\nreg_w_port = IOPort('reg-w', 'control', 'out', 4, False)\nimm_port = IOPort('imm', 'data... | <|body_start_0|>
ins_port = IOPort('ins', 'data', 'in', 32, False)
opcode_port = IOPort('opcode', 'address', 'out', 8, False)
reg_a_port = IOPort('reg-a', 'control', 'out', 4, False)
reg_b_port = IOPort('reg-b', 'control', 'out', 4, False)
reg_w_port = IOPort('reg-w', 'control', ... | A class to represent an instruction decoder that extends Component. This class is a functional logic component that splits an instruction into its opcode and arguments. | Decoder | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Decoder:
"""A class to represent an instruction decoder that extends Component. This class is a functional logic component that splits an instruction into its opcode and arguments."""
def __init__(self):
"""Initialize the Decoder object and extend Component."""
<|body_0|>
... | stack_v2_sparse_classes_36k_train_015249 | 2,060 | no_license | [
{
"docstring": "Initialize the Decoder object and extend Component.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Execute the decoder's functional logic. The decoder splits an instruction into its opcode and arguments.",
"name": "_execute",
"signature": "def ... | 2 | stack_v2_sparse_classes_30k_train_005105 | Implement the Python class `Decoder` described below.
Class description:
A class to represent an instruction decoder that extends Component. This class is a functional logic component that splits an instruction into its opcode and arguments.
Method signatures and docstrings:
- def __init__(self): Initialize the Decod... | Implement the Python class `Decoder` described below.
Class description:
A class to represent an instruction decoder that extends Component. This class is a functional logic component that splits an instruction into its opcode and arguments.
Method signatures and docstrings:
- def __init__(self): Initialize the Decod... | 0b360801545e459d616b35435788fddbb958a626 | <|skeleton|>
class Decoder:
"""A class to represent an instruction decoder that extends Component. This class is a functional logic component that splits an instruction into its opcode and arguments."""
def __init__(self):
"""Initialize the Decoder object and extend Component."""
<|body_0|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Decoder:
"""A class to represent an instruction decoder that extends Component. This class is a functional logic component that splits an instruction into its opcode and arguments."""
def __init__(self):
"""Initialize the Decoder object and extend Component."""
ins_port = IOPort('ins', 'd... | the_stack_v2_python_sparse | components/decoder.py | bwiswell/py-virpu | train | 1 |
c8fb98a6d62a13f31b5d565ca61de79d2ee540f7 | [
"super().__init__()\nself.register_buffer('unpool_mat', torch.from_numpy(np.ones((2, 2), dtype='float32')))\nself.unpool_mat.unsqueeze(0)",
"input_shape = list(x.shape)\nx = x.unsqueeze(-1)\nmat = self.unpool_mat.unsqueeze(0)\nret = torch.tensordot(x, mat, dims=1)\nret = ret.permute(0, 1, 2, 4, 3, 5)\nreturn ret.... | <|body_start_0|>
super().__init__()
self.register_buffer('unpool_mat', torch.from_numpy(np.ones((2, 2), dtype='float32')))
self.unpool_mat.unsqueeze(0)
<|end_body_0|>
<|body_start_1|>
input_shape = list(x.shape)
x = x.unsqueeze(-1)
mat = self.unpool_mat.unsqueeze(0)
... | A layer to scale input by a factor of 2. This layer uses Kronecker product underneath rather than the default pytorch interpolation. | UpSample2x | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UpSample2x:
"""A layer to scale input by a factor of 2. This layer uses Kronecker product underneath rather than the default pytorch interpolation."""
def __init__(self) -> None:
"""Initialize :class:`UpSample2x`."""
<|body_0|>
def forward(self, x: torch.Tensor):
... | stack_v2_sparse_classes_36k_train_015250 | 4,059 | permissive | [
{
"docstring": "Initialize :class:`UpSample2x`.",
"name": "__init__",
"signature": "def __init__(self) -> None"
},
{
"docstring": "Logic for using layers defined in init. Args: x (torch.Tensor): Input images, the tensor is in the shape of NCHW. Returns: torch.Tensor: Input images upsampled by a ... | 2 | stack_v2_sparse_classes_30k_train_020325 | Implement the Python class `UpSample2x` described below.
Class description:
A layer to scale input by a factor of 2. This layer uses Kronecker product underneath rather than the default pytorch interpolation.
Method signatures and docstrings:
- def __init__(self) -> None: Initialize :class:`UpSample2x`.
- def forward... | Implement the Python class `UpSample2x` described below.
Class description:
A layer to scale input by a factor of 2. This layer uses Kronecker product underneath rather than the default pytorch interpolation.
Method signatures and docstrings:
- def __init__(self) -> None: Initialize :class:`UpSample2x`.
- def forward... | f26387f46f675a7b9a8a48c95dad26e819229f2f | <|skeleton|>
class UpSample2x:
"""A layer to scale input by a factor of 2. This layer uses Kronecker product underneath rather than the default pytorch interpolation."""
def __init__(self) -> None:
"""Initialize :class:`UpSample2x`."""
<|body_0|>
def forward(self, x: torch.Tensor):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UpSample2x:
"""A layer to scale input by a factor of 2. This layer uses Kronecker product underneath rather than the default pytorch interpolation."""
def __init__(self) -> None:
"""Initialize :class:`UpSample2x`."""
super().__init__()
self.register_buffer('unpool_mat', torch.from... | the_stack_v2_python_sparse | tiatoolbox/models/architecture/utils.py | TissueImageAnalytics/tiatoolbox | train | 222 |
037b81d5fc2915be31411588c120f790c9a0b5c2 | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\ntry:\n mapping_value = parse_node.get_child_node('@odata.type').get_str_value()\nexcept AttributeError:\n mapping_value = None\nif mapping_value and mapping_value.casefold() == '#microsoft.graph.printUsageByPrinter'.casefold():\n from ... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
try:
mapping_value = parse_node.get_child_node('@odata.type').get_str_value()
except AttributeError:
mapping_value = None
if mapping_value and mapping_value.casefold() ==... | PrintUsage | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PrintUsage:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> PrintUsage:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: Prin... | stack_v2_sparse_classes_36k_train_015251 | 5,663 | permissive | [
{
"docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: PrintUsage",
"name": "create_from_discriminator_value",
"signature": "def create_from_discriminator_value(pa... | 3 | stack_v2_sparse_classes_30k_train_021574 | Implement the Python class `PrintUsage` described below.
Class description:
Implement the PrintUsage class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> PrintUsage: Creates a new instance of the appropriate class based on discriminator value Args: pa... | Implement the Python class `PrintUsage` described below.
Class description:
Implement the PrintUsage class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> PrintUsage: Creates a new instance of the appropriate class based on discriminator value Args: pa... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class PrintUsage:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> PrintUsage:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: Prin... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PrintUsage:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> PrintUsage:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: PrintUsage"""
... | the_stack_v2_python_sparse | msgraph/generated/models/print_usage.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
c0f79d0ebf6e8415ac50441946a9c08eb9bd4d77 | [
"carry = 0\nres = ListNode(0)\npre = res\nwhile l1 or l2 or carry:\n if l1:\n carry += l1.val\n l1 = l1.next\n if l2:\n carry += l2.val\n l2 = l2.next\n carry, val = divmod(carry, 10)\n pre.next = ListNode(val)\n pre = pre.next\nreturn res.next",
"m, n = ('', '')\nwhile ... | <|body_start_0|>
carry = 0
res = ListNode(0)
pre = res
while l1 or l2 or carry:
if l1:
carry += l1.val
l1 = l1.next
if l2:
carry += l2.val
l2 = l2.next
carry, val = divmod(carry, 10)
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def addTwoNumbers(self, l1: ListNode, l2: ListNode) -> ListNode:
""":param l1:ListNode :param l2: ListNode :return: ListNode"""
<|body_0|>
def addTwoNumbers1(self, l1: ListNode, l2: ListNode) -> ListNode:
""":param l1:ListNode :param l2: ListNode :return: L... | stack_v2_sparse_classes_36k_train_015252 | 3,699 | no_license | [
{
"docstring": ":param l1:ListNode :param l2: ListNode :return: ListNode",
"name": "addTwoNumbers",
"signature": "def addTwoNumbers(self, l1: ListNode, l2: ListNode) -> ListNode"
},
{
"docstring": ":param l1:ListNode :param l2: ListNode :return: ListNode",
"name": "addTwoNumbers1",
"sign... | 2 | stack_v2_sparse_classes_30k_val_000136 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def addTwoNumbers(self, l1: ListNode, l2: ListNode) -> ListNode: :param l1:ListNode :param l2: ListNode :return: ListNode
- def addTwoNumbers1(self, l1: ListNode, l2: ListNode) -... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def addTwoNumbers(self, l1: ListNode, l2: ListNode) -> ListNode: :param l1:ListNode :param l2: ListNode :return: ListNode
- def addTwoNumbers1(self, l1: ListNode, l2: ListNode) -... | f32cd4dc9670e55ffa6abe04c9184bfa5d8bbc41 | <|skeleton|>
class Solution:
def addTwoNumbers(self, l1: ListNode, l2: ListNode) -> ListNode:
""":param l1:ListNode :param l2: ListNode :return: ListNode"""
<|body_0|>
def addTwoNumbers1(self, l1: ListNode, l2: ListNode) -> ListNode:
""":param l1:ListNode :param l2: ListNode :return: L... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def addTwoNumbers(self, l1: ListNode, l2: ListNode) -> ListNode:
""":param l1:ListNode :param l2: ListNode :return: ListNode"""
carry = 0
res = ListNode(0)
pre = res
while l1 or l2 or carry:
if l1:
carry += l1.val
l1... | the_stack_v2_python_sparse | leecode/0710/两数相加.py | songdanlee/python_code_basic | train | 0 | |
8896115227b4c3247a2a42e536ad10b9c0f43c4e | [
"if grs:\n self.grs = grs\nelse:\n self.grs = []",
"if hasattr(Grasp, attr) and callable(getattr(Grasp, attr)):\n return lambda *args, **kwargs: list(map(lambda gr: getattr(gr, attr)(*args, **kwargs), self.grs))\nelse:\n raise AttributeError(\"Couldn't find function %s in BoundingBoxes or BoundingBox\... | <|body_start_0|>
if grs:
self.grs = grs
else:
self.grs = []
<|end_body_0|>
<|body_start_1|>
if hasattr(Grasp, attr) and callable(getattr(Grasp, attr)):
return lambda *args, **kwargs: list(map(lambda gr: getattr(gr, attr)(*args, **kwargs), self.grs))
e... | 定义一个多抓取框处理类,主要功能是从原始的标注文件中读出多个抓取框并将其构建成多个单一的抓取框Grasp类,同时能够对这些属于同一对象的多个抓取框对象进行一些数据的统一集成处理 | Grasps | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Grasps:
"""定义一个多抓取框处理类,主要功能是从原始的标注文件中读出多个抓取框并将其构建成多个单一的抓取框Grasp类,同时能够对这些属于同一对象的多个抓取框对象进行一些数据的统一集成处理"""
def __init__(self, grs=None):
""":功能 : 多抓取框类初始化函数,功能是将属于一个对象的多个单独的抓取框集成到一个类里面来。 :参数 grs : list,包含一个对象中多个抓取框类的列表"""
<|body_0|>
def __getattr__(self, attr):
"""当用... | stack_v2_sparse_classes_36k_train_015253 | 9,891 | no_license | [
{
"docstring": ":功能 : 多抓取框类初始化函数,功能是将属于一个对象的多个单独的抓取框集成到一个类里面来。 :参数 grs : list,包含一个对象中多个抓取框类的列表",
"name": "__init__",
"signature": "def __init__(self, grs=None)"
},
{
"docstring": "当用户调用某一个Grasps类中没有的属性时,查找iGrasp类中有没有这个函数,有的话就对Grasps类中的每个Grasp对象调用它。 这里是直接从ggcnn里面搬运过来的,高端操作,,,学到了",
"name": "__... | 5 | stack_v2_sparse_classes_30k_train_011411 | Implement the Python class `Grasps` described below.
Class description:
定义一个多抓取框处理类,主要功能是从原始的标注文件中读出多个抓取框并将其构建成多个单一的抓取框Grasp类,同时能够对这些属于同一对象的多个抓取框对象进行一些数据的统一集成处理
Method signatures and docstrings:
- def __init__(self, grs=None): :功能 : 多抓取框类初始化函数,功能是将属于一个对象的多个单独的抓取框集成到一个类里面来。 :参数 grs : list,包含一个对象中多个抓取框类的列表
- def __geta... | Implement the Python class `Grasps` described below.
Class description:
定义一个多抓取框处理类,主要功能是从原始的标注文件中读出多个抓取框并将其构建成多个单一的抓取框Grasp类,同时能够对这些属于同一对象的多个抓取框对象进行一些数据的统一集成处理
Method signatures and docstrings:
- def __init__(self, grs=None): :功能 : 多抓取框类初始化函数,功能是将属于一个对象的多个单独的抓取框集成到一个类里面来。 :参数 grs : list,包含一个对象中多个抓取框类的列表
- def __geta... | d0b7b14fa8b76ba95118c8b1af53fbd627860c00 | <|skeleton|>
class Grasps:
"""定义一个多抓取框处理类,主要功能是从原始的标注文件中读出多个抓取框并将其构建成多个单一的抓取框Grasp类,同时能够对这些属于同一对象的多个抓取框对象进行一些数据的统一集成处理"""
def __init__(self, grs=None):
""":功能 : 多抓取框类初始化函数,功能是将属于一个对象的多个单独的抓取框集成到一个类里面来。 :参数 grs : list,包含一个对象中多个抓取框类的列表"""
<|body_0|>
def __getattr__(self, attr):
"""当用... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Grasps:
"""定义一个多抓取框处理类,主要功能是从原始的标注文件中读出多个抓取框并将其构建成多个单一的抓取框Grasp类,同时能够对这些属于同一对象的多个抓取框对象进行一些数据的统一集成处理"""
def __init__(self, grs=None):
""":功能 : 多抓取框类初始化函数,功能是将属于一个对象的多个单独的抓取框集成到一个类里面来。 :参数 grs : list,包含一个对象中多个抓取框类的列表"""
if grs:
self.grs = grs
else:
self.grs =... | the_stack_v2_python_sparse | 3.data_augmentation/grasp_pro.py | Nhiemth1985/ggcnn_cornell_dataset | train | 0 |
bbbcd223be30c56e96b868ff0cbd6342822471db | [
"self.features = features\nself.labels = labels\nself.current_index = 0\nself.shuffle()",
"new_index = self.current_index + batch_size\nif new_index <= len(self.features):\n batch_features = np.array(self.features[self.current_index:new_index])\n batch_labels = np.array(self.labels[self.current_index:new_in... | <|body_start_0|>
self.features = features
self.labels = labels
self.current_index = 0
self.shuffle()
<|end_body_0|>
<|body_start_1|>
new_index = self.current_index + batch_size
if new_index <= len(self.features):
batch_features = np.array(self.features[self.c... | Manages a dataset Datasets are created from a list (preferably a numpy array) of features and labels. The data is then shuffled and repeated infinitely, shuffling again after every epoch. Attributes: features: List of features of the dataset labels: List of labels of the dataset current_index: Current position in the d... | Dataset | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Dataset:
"""Manages a dataset Datasets are created from a list (preferably a numpy array) of features and labels. The data is then shuffled and repeated infinitely, shuffling again after every epoch. Attributes: features: List of features of the dataset labels: List of labels of the dataset curre... | stack_v2_sparse_classes_36k_train_015254 | 2,627 | no_license | [
{
"docstring": "Initializes the dataset Args: features: List of features labesls: List of labels",
"name": "__init__",
"signature": "def __init__(self, features, labels)"
},
{
"docstring": "Fetches the next batch of data from the dataset Args: batch_size: *batch_size* features and labels are ret... | 3 | stack_v2_sparse_classes_30k_train_006485 | Implement the Python class `Dataset` described below.
Class description:
Manages a dataset Datasets are created from a list (preferably a numpy array) of features and labels. The data is then shuffled and repeated infinitely, shuffling again after every epoch. Attributes: features: List of features of the dataset labe... | Implement the Python class `Dataset` described below.
Class description:
Manages a dataset Datasets are created from a list (preferably a numpy array) of features and labels. The data is then shuffled and repeated infinitely, shuffling again after every epoch. Attributes: features: List of features of the dataset labe... | 7335326a2bb9ca8c51338693ef9a858f17f18fac | <|skeleton|>
class Dataset:
"""Manages a dataset Datasets are created from a list (preferably a numpy array) of features and labels. The data is then shuffled and repeated infinitely, shuffling again after every epoch. Attributes: features: List of features of the dataset labels: List of labels of the dataset curre... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Dataset:
"""Manages a dataset Datasets are created from a list (preferably a numpy array) of features and labels. The data is then shuffled and repeated infinitely, shuffling again after every epoch. Attributes: features: List of features of the dataset labels: List of labels of the dataset current_index: Cur... | the_stack_v2_python_sparse | saene/dataset.py | S-Tim/saene | train | 1 |
b4fd9bffee583db8cc45237db4c0604fa3a2c574 | [
"super(SyncArrival, self).__init__(name)\nself.logger.debug('%s.__init__()' % self.__class__.__name__)\nself._control = carla.VehicleControl()\nself._actor = actor\nself._actor_reference = actor_reference\nself._target_location = target_location\nself._gain = gain\nself._control.steering = 0",
"new_status = py_tr... | <|body_start_0|>
super(SyncArrival, self).__init__(name)
self.logger.debug('%s.__init__()' % self.__class__.__name__)
self._control = carla.VehicleControl()
self._actor = actor
self._actor_reference = actor_reference
self._target_location = target_location
self._g... | This class contains an atomic behavior to set velocity of actor so that it reaches location at the same time as actor_reference. The behavior assumes that the two actors are moving towards location in a straight line. Important parameters: - actor: CARLA actor to execute the behavior - actor_reference: Reference actor ... | SyncArrival | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SyncArrival:
"""This class contains an atomic behavior to set velocity of actor so that it reaches location at the same time as actor_reference. The behavior assumes that the two actors are moving towards location in a straight line. Important parameters: - actor: CARLA actor to execute the behav... | stack_v2_sparse_classes_36k_train_015255 | 39,839 | permissive | [
{
"docstring": "Setup required parameters",
"name": "__init__",
"signature": "def __init__(self, actor, actor_reference, target_location, gain=1, name='SyncArrival')"
},
{
"docstring": "Dynamic control update for actor velocity",
"name": "update",
"signature": "def update(self)"
},
{... | 3 | null | Implement the Python class `SyncArrival` described below.
Class description:
This class contains an atomic behavior to set velocity of actor so that it reaches location at the same time as actor_reference. The behavior assumes that the two actors are moving towards location in a straight line. Important parameters: - ... | Implement the Python class `SyncArrival` described below.
Class description:
This class contains an atomic behavior to set velocity of actor so that it reaches location at the same time as actor_reference. The behavior assumes that the two actors are moving towards location in a straight line. Important parameters: - ... | 8ab0894b92e1f994802a218002021ee075c405bf | <|skeleton|>
class SyncArrival:
"""This class contains an atomic behavior to set velocity of actor so that it reaches location at the same time as actor_reference. The behavior assumes that the two actors are moving towards location in a straight line. Important parameters: - actor: CARLA actor to execute the behav... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SyncArrival:
"""This class contains an atomic behavior to set velocity of actor so that it reaches location at the same time as actor_reference. The behavior assumes that the two actors are moving towards location in a straight line. Important parameters: - actor: CARLA actor to execute the behavior - actor_r... | 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 |
8a387d6da217d82b95dc5188843f1d61b40d94a4 | [
"if not root:\n return None\nroot.left, root.right = (root.right, root.left)\nself.invertTree(root.left)\nself.invertTree(root.right)\nreturn root",
"if not root:\n return None\nqueue = []\nqueue.append(root)\nwhile queue:\n t = queue.pop(0)\n t.left, t.right = (t.right, t.left)\n if t.left:\n ... | <|body_start_0|>
if not root:
return None
root.left, root.right = (root.right, root.left)
self.invertTree(root.left)
self.invertTree(root.right)
return root
<|end_body_0|>
<|body_start_1|>
if not root:
return None
queue = []
queue.... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def invertTree1(self, root):
""":type root: TreeNode :rtype: TreeNode"""
<|body_0|>
def invertTree(self, root):
""":type root: TreeNode :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not root:
return None
... | stack_v2_sparse_classes_36k_train_015256 | 1,133 | no_license | [
{
"docstring": ":type root: TreeNode :rtype: TreeNode",
"name": "invertTree1",
"signature": "def invertTree1(self, root)"
},
{
"docstring": ":type root: TreeNode :rtype: TreeNode",
"name": "invertTree",
"signature": "def invertTree(self, root)"
}
] | 2 | stack_v2_sparse_classes_30k_train_011450 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def invertTree1(self, root): :type root: TreeNode :rtype: TreeNode
- def invertTree(self, root): :type root: TreeNode :rtype: TreeNode | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def invertTree1(self, root): :type root: TreeNode :rtype: TreeNode
- def invertTree(self, root): :type root: TreeNode :rtype: TreeNode
<|skeleton|>
class Solution:
def inve... | 5f94a60d01dca431025d461d2e50dcf9612dee70 | <|skeleton|>
class Solution:
def invertTree1(self, root):
""":type root: TreeNode :rtype: TreeNode"""
<|body_0|>
def invertTree(self, root):
""":type root: TreeNode :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def invertTree1(self, root):
""":type root: TreeNode :rtype: TreeNode"""
if not root:
return None
root.left, root.right = (root.right, root.left)
self.invertTree(root.left)
self.invertTree(root.right)
return root
def invertTree(self, r... | the_stack_v2_python_sparse | 2.树/226.翻转二叉树.py | WJ-Lai/LeetCode-Python-Solution | train | 0 | |
155ffd9468ed73ef0650546a42c046379fc1f75c | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\ntry:\n mapping_value = parse_node.get_child_node('@odata.type').get_str_value()\nexcept AttributeError:\n mapping_value = None\nif mapping_value and mapping_value.casefold() == '#microsoft.graph.deleteUserFromSharedAppleDeviceActionResult... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
try:
mapping_value = parse_node.get_child_node('@odata.type').get_str_value()
except AttributeError:
mapping_value = None
if mapping_value and mapping_value.casefold() ==... | Device action result | DeviceActionResult | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DeviceActionResult:
"""Device action result"""
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> DeviceActionResult:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discrimi... | stack_v2_sparse_classes_36k_train_015257 | 6,203 | permissive | [
{
"docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: DeviceActionResult",
"name": "create_from_discriminator_value",
"signature": "def create_from_discriminator_... | 3 | stack_v2_sparse_classes_30k_train_004079 | Implement the Python class `DeviceActionResult` described below.
Class description:
Device action result
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> DeviceActionResult: Creates a new instance of the appropriate class based on discriminator value Arg... | Implement the Python class `DeviceActionResult` described below.
Class description:
Device action result
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> DeviceActionResult: Creates a new instance of the appropriate class based on discriminator value Arg... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class DeviceActionResult:
"""Device action result"""
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> DeviceActionResult:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discrimi... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DeviceActionResult:
"""Device action result"""
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> DeviceActionResult:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value a... | the_stack_v2_python_sparse | msgraph/generated/models/device_action_result.py | microsoftgraph/msgraph-sdk-python | train | 135 |
f4236a16b7551e09fb381c3363817cce5168e813 | [
"item = MzituScrapyItem()\nmax_num = response.xpath(\"descendant::div[@class='main']/div[@class='content']/div[@class='pagenavi']/a[last()-1]/span/text()\").extract_first(default='N/A')\nitem['name'] = response.xpath(\"./*//div[@class='main']/div[1]/h2/text()\").extract_first(default='N/A')\nitem['url'] = response.... | <|body_start_0|>
item = MzituScrapyItem()
max_num = response.xpath("descendant::div[@class='main']/div[@class='content']/div[@class='pagenavi']/a[last()-1]/span/text()").extract_first(default='N/A')
item['name'] = response.xpath("./*//div[@class='main']/div[1]/h2/text()").extract_first(default='... | Spider | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Spider:
def parse_item(self, response):
""":param response: 下载器返回的response :return:"""
<|body_0|>
def img_url(self, response):
"""取出图片URL 并添加进self.img_urls列表中 :param response: :param img_url 为每张图片的真实地址"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_36k_train_015258 | 1,685 | permissive | [
{
"docstring": ":param response: 下载器返回的response :return:",
"name": "parse_item",
"signature": "def parse_item(self, response)"
},
{
"docstring": "取出图片URL 并添加进self.img_urls列表中 :param response: :param img_url 为每张图片的真实地址",
"name": "img_url",
"signature": "def img_url(self, response)"
}
] | 2 | stack_v2_sparse_classes_30k_train_014993 | Implement the Python class `Spider` described below.
Class description:
Implement the Spider class.
Method signatures and docstrings:
- def parse_item(self, response): :param response: 下载器返回的response :return:
- def img_url(self, response): 取出图片URL 并添加进self.img_urls列表中 :param response: :param img_url 为每张图片的真实地址 | Implement the Python class `Spider` described below.
Class description:
Implement the Spider class.
Method signatures and docstrings:
- def parse_item(self, response): :param response: 下载器返回的response :return:
- def img_url(self, response): 取出图片URL 并添加进self.img_urls列表中 :param response: :param img_url 为每张图片的真实地址
<|ske... | 345e34fff7386d91acbb03a01fd4127c5dfed037 | <|skeleton|>
class Spider:
def parse_item(self, response):
""":param response: 下载器返回的response :return:"""
<|body_0|>
def img_url(self, response):
"""取出图片URL 并添加进self.img_urls列表中 :param response: :param img_url 为每张图片的真实地址"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Spider:
def parse_item(self, response):
""":param response: 下载器返回的response :return:"""
item = MzituScrapyItem()
max_num = response.xpath("descendant::div[@class='main']/div[@class='content']/div[@class='pagenavi']/a[last()-1]/span/text()").extract_first(default='N/A')
item['nam... | the_stack_v2_python_sparse | projects/scrapy_mzitu_webset/mzitu_scrapy/spiders/spider.py | ice-melt/python_code_manager | train | 0 | |
3bc9ed7fac8464e9d9f14df0ea35c50e38380ede | [
"argument_and_expected_result = {'a': 'a', 'aa': 'a', 'aaa': 'a', 'aba': 'ab', 'bba': 'ba', 'aab': 'ab', 'TechCity': 'Techiy'}\nfor word, expected_result in argument_and_expected_result.items():\n result = task1.remove_all_except_first(word)\n self.assertEqual(result, expected_result)",
"argument_and_expect... | <|body_start_0|>
argument_and_expected_result = {'a': 'a', 'aa': 'a', 'aaa': 'a', 'aba': 'ab', 'bba': 'ba', 'aab': 'ab', 'TechCity': 'Techiy'}
for word, expected_result in argument_and_expected_result.items():
result = task1.remove_all_except_first(word)
self.assertEqual(result, ... | Tests for string manipulation task. | StringManipulationTest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StringManipulationTest:
"""Tests for string manipulation task."""
def test_remove_all_except_first(self):
"""Test that all character in a strings are removed except first character"""
<|body_0|>
def test_remove_first_occurrence(self):
"""Test that first occurrenc... | stack_v2_sparse_classes_36k_train_015259 | 1,369 | no_license | [
{
"docstring": "Test that all character in a strings are removed except first character",
"name": "test_remove_all_except_first",
"signature": "def test_remove_all_except_first(self)"
},
{
"docstring": "Test that first occurrence of character is removed in a string",
"name": "test_remove_fir... | 2 | null | Implement the Python class `StringManipulationTest` described below.
Class description:
Tests for string manipulation task.
Method signatures and docstrings:
- def test_remove_all_except_first(self): Test that all character in a strings are removed except first character
- def test_remove_first_occurrence(self): Test... | Implement the Python class `StringManipulationTest` described below.
Class description:
Tests for string manipulation task.
Method signatures and docstrings:
- def test_remove_all_except_first(self): Test that all character in a strings are removed except first character
- def test_remove_first_occurrence(self): Test... | 4c5044a4e9085cc09d8eee223c89217cae408166 | <|skeleton|>
class StringManipulationTest:
"""Tests for string manipulation task."""
def test_remove_all_except_first(self):
"""Test that all character in a strings are removed except first character"""
<|body_0|>
def test_remove_first_occurrence(self):
"""Test that first occurrenc... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class StringManipulationTest:
"""Tests for string manipulation task."""
def test_remove_all_except_first(self):
"""Test that all character in a strings are removed except first character"""
argument_and_expected_result = {'a': 'a', 'aa': 'a', 'aaa': 'a', 'aba': 'ab', 'bba': 'ba', 'aab': 'ab', '... | the_stack_v2_python_sparse | unit_test/test_task1.py | monofal/Full-Stack-Training | train | 0 |
88042edc430f06aaca1393f08e7443568a6ba1eb | [
"self._session = session\nself.start_latitude = start_latitude\nself.start_longitude = start_longitude\nself.end_latitude = end_latitude\nself.end_longitude = end_longitude\nself.products = None",
"try:\n self.fetch_data()\nexcept APIError as exc:\n _LOGGER.error('Error fetching Lyft data: %s', exc)",
"cl... | <|body_start_0|>
self._session = session
self.start_latitude = start_latitude
self.start_longitude = start_longitude
self.end_latitude = end_latitude
self.end_longitude = end_longitude
self.products = None
<|end_body_0|>
<|body_start_1|>
try:
self.fet... | The class for handling the time and price estimate. | LyftEstimate | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LyftEstimate:
"""The class for handling the time and price estimate."""
def __init__(self, session, start_latitude, start_longitude, end_latitude=None, end_longitude=None):
"""Initialize the LyftEstimate object."""
<|body_0|>
def update(self):
"""Get the latest p... | stack_v2_sparse_classes_36k_train_015260 | 9,073 | permissive | [
{
"docstring": "Initialize the LyftEstimate object.",
"name": "__init__",
"signature": "def __init__(self, session, start_latitude, start_longitude, end_latitude=None, end_longitude=None)"
},
{
"docstring": "Get the latest product info and estimates from the Lyft API.",
"name": "update",
... | 3 | stack_v2_sparse_classes_30k_train_010115 | Implement the Python class `LyftEstimate` described below.
Class description:
The class for handling the time and price estimate.
Method signatures and docstrings:
- def __init__(self, session, start_latitude, start_longitude, end_latitude=None, end_longitude=None): Initialize the LyftEstimate object.
- def update(se... | Implement the Python class `LyftEstimate` described below.
Class description:
The class for handling the time and price estimate.
Method signatures and docstrings:
- def __init__(self, session, start_latitude, start_longitude, end_latitude=None, end_longitude=None): Initialize the LyftEstimate object.
- def update(se... | 2fee32fce03bc49e86cf2e7b741a15621a97cce5 | <|skeleton|>
class LyftEstimate:
"""The class for handling the time and price estimate."""
def __init__(self, session, start_latitude, start_longitude, end_latitude=None, end_longitude=None):
"""Initialize the LyftEstimate object."""
<|body_0|>
def update(self):
"""Get the latest p... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LyftEstimate:
"""The class for handling the time and price estimate."""
def __init__(self, session, start_latitude, start_longitude, end_latitude=None, end_longitude=None):
"""Initialize the LyftEstimate object."""
self._session = session
self.start_latitude = start_latitude
... | the_stack_v2_python_sparse | homeassistant/components/lyft/sensor.py | BenWoodford/home-assistant | train | 11 |
79d49aea9d87b6460e6df937a2e497fe637e2e91 | [
"try:\n team = Team.objects.get(pk=pk)\nexcept ObjectDoesNotExist:\n return Response(status=status.HTTP_404_NOT_FOUND)\nif request.user.has_perm(VIEW_TEAM):\n serializer = TeamDetailsSerializer(team)\n return Response(serializer.data)\nelse:\n return Response(status=status.HTTP_401_UNAUTHORIZED)",
... | <|body_start_0|>
try:
team = Team.objects.get(pk=pk)
except ObjectDoesNotExist:
return Response(status=status.HTTP_404_NOT_FOUND)
if request.user.has_perm(VIEW_TEAM):
serializer = TeamDetailsSerializer(team)
return Response(serializer.data)
... | Contains HTTP methods GET, PUT, DELETE used on /usermanagement/teams/{pk}. | TeamDetail | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TeamDetail:
"""Contains HTTP methods GET, PUT, DELETE used on /usermanagement/teams/{pk}."""
def get(self, request, pk, format='None'):
"""Implement the GET method. Parameters : request (HttpRequest) : the request coming from the front-end pk (int) : the id of the team Return : respo... | stack_v2_sparse_classes_36k_train_015261 | 10,635 | permissive | [
{
"docstring": "Implement the GET method. Parameters : request (HttpRequest) : the request coming from the front-end pk (int) : the id of the team Return : response (Response) : the response. GET request : return the team's data.",
"name": "get",
"signature": "def get(self, request, pk, format='None')"
... | 3 | stack_v2_sparse_classes_30k_train_008821 | Implement the Python class `TeamDetail` described below.
Class description:
Contains HTTP methods GET, PUT, DELETE used on /usermanagement/teams/{pk}.
Method signatures and docstrings:
- def get(self, request, pk, format='None'): Implement the GET method. Parameters : request (HttpRequest) : the request coming from t... | Implement the Python class `TeamDetail` described below.
Class description:
Contains HTTP methods GET, PUT, DELETE used on /usermanagement/teams/{pk}.
Method signatures and docstrings:
- def get(self, request, pk, format='None'): Implement the GET method. Parameters : request (HttpRequest) : the request coming from t... | 56511ebac83a5dc1fb8768a98bc675e88530a447 | <|skeleton|>
class TeamDetail:
"""Contains HTTP methods GET, PUT, DELETE used on /usermanagement/teams/{pk}."""
def get(self, request, pk, format='None'):
"""Implement the GET method. Parameters : request (HttpRequest) : the request coming from the front-end pk (int) : the id of the team Return : respo... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TeamDetail:
"""Contains HTTP methods GET, PUT, DELETE used on /usermanagement/teams/{pk}."""
def get(self, request, pk, format='None'):
"""Implement the GET method. Parameters : request (HttpRequest) : the request coming from the front-end pk (int) : the id of the team Return : response (Response... | the_stack_v2_python_sparse | usersmanagement/views/views_team.py | Open-CMMS/openCMMS_backend | train | 4 |
17b43884f48ee17119d19e1826fff9011ceb2482 | [
"if a >= b + c or b >= a + c or c >= a + b:\n raise TriangleError\nself.a, self.b, self.c = (a, b, c)",
"distinct_edges = len(set([self.a, self.b, self.c]))\nif distinct_edges == 1:\n return TRIANGLE_KIND_EQUILATERAL\nelif distinct_edges == 2:\n return TRIANGLE_KIND_ISOSCELES\nelse:\n return TRIANGLE_... | <|body_start_0|>
if a >= b + c or b >= a + c or c >= a + b:
raise TriangleError
self.a, self.b, self.c = (a, b, c)
<|end_body_0|>
<|body_start_1|>
distinct_edges = len(set([self.a, self.b, self.c]))
if distinct_edges == 1:
return TRIANGLE_KIND_EQUILATERAL
... | A Triangle | Triangle | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Triangle:
"""A Triangle"""
def __init__(self, a, b, c):
"""Create new triangle from given edges a, b and c. Raises: TriangleError: If given edges do not conform to the triangle inequality."""
<|body_0|>
def kind(self):
"""Return which kind of triangle this is."""... | stack_v2_sparse_classes_36k_train_015262 | 954 | no_license | [
{
"docstring": "Create new triangle from given edges a, b and c. Raises: TriangleError: If given edges do not conform to the triangle inequality.",
"name": "__init__",
"signature": "def __init__(self, a, b, c)"
},
{
"docstring": "Return which kind of triangle this is.",
"name": "kind",
"... | 2 | stack_v2_sparse_classes_30k_train_020781 | Implement the Python class `Triangle` described below.
Class description:
A Triangle
Method signatures and docstrings:
- def __init__(self, a, b, c): Create new triangle from given edges a, b and c. Raises: TriangleError: If given edges do not conform to the triangle inequality.
- def kind(self): Return which kind of... | Implement the Python class `Triangle` described below.
Class description:
A Triangle
Method signatures and docstrings:
- def __init__(self, a, b, c): Create new triangle from given edges a, b and c. Raises: TriangleError: If given edges do not conform to the triangle inequality.
- def kind(self): Return which kind of... | be0e2f635a7558f56c61bc0b36c6146b01d1e6e6 | <|skeleton|>
class Triangle:
"""A Triangle"""
def __init__(self, a, b, c):
"""Create new triangle from given edges a, b and c. Raises: TriangleError: If given edges do not conform to the triangle inequality."""
<|body_0|>
def kind(self):
"""Return which kind of triangle this is."""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Triangle:
"""A Triangle"""
def __init__(self, a, b, c):
"""Create new triangle from given edges a, b and c. Raises: TriangleError: If given edges do not conform to the triangle inequality."""
if a >= b + c or b >= a + c or c >= a + b:
raise TriangleError
self.a, self.b... | the_stack_v2_python_sparse | all_data/exercism_data/python/triangle/c4a35fc8be7140458c7d674bd3662f2c.py | itsolutionscorp/AutoStyle-Clustering | train | 4 |
863ec30c381cea0e13045bab89b662271773de83 | [
"self._text_maze = text_maze\nself._wall_char = wall_char\nself._make_odd_sized_walls = make_odd_sized_walls\nself._covered = np.full(text_maze.shape, False, dtype=np.bool)\nself._maze_size = GridCoordinates(*text_maze.shape)\nself._next_start = GridCoordinates(0, 0)\nself._calculated = False\nself._walls = ()",
... | <|body_start_0|>
self._text_maze = text_maze
self._wall_char = wall_char
self._make_odd_sized_walls = make_odd_sized_walls
self._covered = np.full(text_maze.shape, False, dtype=np.bool)
self._maze_size = GridCoordinates(*text_maze.shape)
self._next_start = GridCoordinates... | Calculates a covering of text mazes with overlapping rectangular walls. This class uses a greedy algorithm to try and minimize the number of geoms generated to create a given maze. The solution is not guaranteed to be optimal, but in most cases should result in a significantly smaller number of geoms than if each cell ... | _MazeWallCoveringContext | [
"Apache-2.0",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _MazeWallCoveringContext:
"""Calculates a covering of text mazes with overlapping rectangular walls. This class uses a greedy algorithm to try and minimize the number of geoms generated to create a given maze. The solution is not guaranteed to be optimal, but in most cases should result in a sign... | stack_v2_sparse_classes_36k_train_015263 | 5,466 | permissive | [
{
"docstring": "Initializes this _MazeWallCoveringContext. Args: text_maze: A `labmaze.TextGrid` instance. wall_char: (optional) The character that signifies a wall. make_odd_sized_walls: (optional) A boolean, if `True` all wall sections generated span odd numbers of grid cells. This option exists primarily to ... | 5 | stack_v2_sparse_classes_30k_train_010100 | Implement the Python class `_MazeWallCoveringContext` described below.
Class description:
Calculates a covering of text mazes with overlapping rectangular walls. This class uses a greedy algorithm to try and minimize the number of geoms generated to create a given maze. The solution is not guaranteed to be optimal, bu... | Implement the Python class `_MazeWallCoveringContext` described below.
Class description:
Calculates a covering of text mazes with overlapping rectangular walls. This class uses a greedy algorithm to try and minimize the number of geoms generated to create a given maze. The solution is not guaranteed to be optimal, bu... | 33d3ea2682409ee82bf9c5129ceaf06ab01cd48e | <|skeleton|>
class _MazeWallCoveringContext:
"""Calculates a covering of text mazes with overlapping rectangular walls. This class uses a greedy algorithm to try and minimize the number of geoms generated to create a given maze. The solution is not guaranteed to be optimal, but in most cases should result in a sign... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class _MazeWallCoveringContext:
"""Calculates a covering of text mazes with overlapping rectangular walls. This class uses a greedy algorithm to try and minimize the number of geoms generated to create a given maze. The solution is not guaranteed to be optimal, but in most cases should result in a significantly sma... | the_stack_v2_python_sparse | src/env/dm_control/dm_control/locomotion/arenas/covering.py | nicklashansen/svea-vit | train | 16 |
f651aefaa127a9e66ac269e1c0ca1dc229d95fbe | [
"self.taskDescription = taskDescription\nself.isFinished = False\nself.startTime = datetime.now()",
"finishTime = datetime.now()\nif not self.isFinished:\n isFinished = True\n print('%s took %s' % (self.taskDescription, str(finishTime - self.startTime)))\nelse:\n raise Exception('CodeSegmentTimer for tas... | <|body_start_0|>
self.taskDescription = taskDescription
self.isFinished = False
self.startTime = datetime.now()
<|end_body_0|>
<|body_start_1|>
finishTime = datetime.now()
if not self.isFinished:
isFinished = True
print('%s took %s' % (self.taskDescriptio... | A simple timer to measure the amount of wall clock time segments of code take. | CodeSegmentTimer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CodeSegmentTimer:
"""A simple timer to measure the amount of wall clock time segments of code take."""
def __init__(self, taskDescription):
"""Creates a starts a new CodeSegmentTimer. The taskDescription will be included in the message printed when this timer is finished."""
... | stack_v2_sparse_classes_36k_train_015264 | 2,099 | no_license | [
{
"docstring": "Creates a starts a new CodeSegmentTimer. The taskDescription will be included in the message printed when this timer is finished.",
"name": "__init__",
"signature": "def __init__(self, taskDescription)"
},
{
"docstring": "Finishes the timer and prints a message indicating how muc... | 2 | stack_v2_sparse_classes_30k_train_006917 | Implement the Python class `CodeSegmentTimer` described below.
Class description:
A simple timer to measure the amount of wall clock time segments of code take.
Method signatures and docstrings:
- def __init__(self, taskDescription): Creates a starts a new CodeSegmentTimer. The taskDescription will be included in the... | Implement the Python class `CodeSegmentTimer` described below.
Class description:
A simple timer to measure the amount of wall clock time segments of code take.
Method signatures and docstrings:
- def __init__(self, taskDescription): Creates a starts a new CodeSegmentTimer. The taskDescription will be included in the... | 39c787deef51ee0f64b65b56f672eee28c704c5a | <|skeleton|>
class CodeSegmentTimer:
"""A simple timer to measure the amount of wall clock time segments of code take."""
def __init__(self, taskDescription):
"""Creates a starts a new CodeSegmentTimer. The taskDescription will be included in the message printed when this timer is finished."""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CodeSegmentTimer:
"""A simple timer to measure the amount of wall clock time segments of code take."""
def __init__(self, taskDescription):
"""Creates a starts a new CodeSegmentTimer. The taskDescription will be included in the message printed when this timer is finished."""
self.taskDesc... | the_stack_v2_python_sparse | Lambdas/factoryEPG/.debug/lambda_functions/factoryEPGCommon.py | PMacHarrie/NPG-BK | train | 1 |
5a27d127d00ee03804d59fe91f1e8fd8fe8828c5 | [
"def get_encoded_name(name):\n \"\"\"Helper to get encoded name for an provided name.\n\n Args:\n name: Encoded name to convert to encoded_name.\n \"\"\"\n return db.get(model.ArtistInfo(name=name).put()).encoded_name\nself.assertEquals('stereo total', get_encoded_name('Stereo Total'))\nself.... | <|body_start_0|>
def get_encoded_name(name):
"""Helper to get encoded name for an provided name.
Args:
name: Encoded name to convert to encoded_name.
"""
return db.get(model.ArtistInfo(name=name).put()).encoded_name
self.assertEquals('... | Test the info base class. This test uses the ArtistInfo sub-class, but the functionality defined there will work for all sub-classes. | InfoTest | [
"LGPL-2.0-or-later",
"GPL-1.0-or-later",
"MIT",
"Apache-2.0",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InfoTest:
"""Test the info base class. This test uses the ArtistInfo sub-class, but the functionality defined there will work for all sub-classes."""
def testEncodedName(self):
"""Test the encoded_name derived property."""
<|body_0|>
def testSearch(self):
"""Test... | stack_v2_sparse_classes_36k_train_015265 | 2,980 | permissive | [
{
"docstring": "Test the encoded_name derived property.",
"name": "testEncodedName",
"signature": "def testEncodedName(self)"
},
{
"docstring": "Test searching by name prefix.",
"name": "testSearch",
"signature": "def testSearch(self)"
}
] | 2 | null | Implement the Python class `InfoTest` described below.
Class description:
Test the info base class. This test uses the ArtistInfo sub-class, but the functionality defined there will work for all sub-classes.
Method signatures and docstrings:
- def testEncodedName(self): Test the encoded_name derived property.
- def t... | Implement the Python class `InfoTest` described below.
Class description:
Test the info base class. This test uses the ArtistInfo sub-class, but the functionality defined there will work for all sub-classes.
Method signatures and docstrings:
- def testEncodedName(self): Test the encoded_name derived property.
- def t... | 72a05af97787001756bae2511b7985e61498c965 | <|skeleton|>
class InfoTest:
"""Test the info base class. This test uses the ArtistInfo sub-class, but the functionality defined there will work for all sub-classes."""
def testEncodedName(self):
"""Test the encoded_name derived property."""
<|body_0|>
def testSearch(self):
"""Test... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class InfoTest:
"""Test the info base class. This test uses the ArtistInfo sub-class, but the functionality defined there will work for all sub-classes."""
def testEncodedName(self):
"""Test the encoded_name derived property."""
def get_encoded_name(name):
"""Helper to get encoded n... | the_stack_v2_python_sparse | third_party/catapult/third_party/gsutil/third_party/protorpc/demos/tunes_db/server/model_test.py | metux/chromium-suckless | train | 5 |
dde40df29d623461c39f0e99caace39934694631 | [
"if nums is None or len(nums) <= 0:\n return 0\nl = len(nums)\nprev = 0\ncur = 0\nmax_value = -1 * 2 ** 31\nfor i in range(1, l + 1):\n for j in range(i, l + 1):\n if i == j:\n cur = nums[j - 1]\n prev = nums[j - 1]\n else:\n cur = prev + nums[j - 1]\n ... | <|body_start_0|>
if nums is None or len(nums) <= 0:
return 0
l = len(nums)
prev = 0
cur = 0
max_value = -1 * 2 ** 31
for i in range(1, l + 1):
for j in range(i, l + 1):
if i == j:
cur = nums[j - 1]
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxSubArray_bak(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def maxSubArray(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if nums is None or len(nums) <= 0:
... | stack_v2_sparse_classes_36k_train_015266 | 1,945 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "maxSubArray_bak",
"signature": "def maxSubArray_bak(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "maxSubArray",
"signature": "def maxSubArray(self, nums)"
}
] | 2 | stack_v2_sparse_classes_30k_train_004342 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxSubArray_bak(self, nums): :type nums: List[int] :rtype: int
- def maxSubArray(self, nums): :type nums: List[int] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxSubArray_bak(self, nums): :type nums: List[int] :rtype: int
- def maxSubArray(self, nums): :type nums: List[int] :rtype: int
<|skeleton|>
class Solution:
def maxSubA... | aa1d6677a89f15141a615d6d6151b09bcb825397 | <|skeleton|>
class Solution:
def maxSubArray_bak(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def maxSubArray(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def maxSubArray_bak(self, nums):
""":type nums: List[int] :rtype: int"""
if nums is None or len(nums) <= 0:
return 0
l = len(nums)
prev = 0
cur = 0
max_value = -1 * 2 ** 31
for i in range(1, l + 1):
for j in range(i, l +... | the_stack_v2_python_sparse | leetcode/dp/max_subarray.py | shubham166/Competitive_Programming | train | 0 | |
b47f32ffeef53ff13b2856ed4ed02651d05282e6 | [
"self._payment_date = payment_dates\nself._payment_step = payment_steps\nself._reset_date = reset_dates\nself._reset_step = reset_steps\nself._steps = reset_steps[len(reset_steps) - 1]\nself._the_tree = {}",
"bond = ZCBond(self._payment_date, self._payment_step)\nbond.get_price(hw_tree)\nfor i in reversed(range(s... | <|body_start_0|>
self._payment_date = payment_dates
self._payment_step = payment_steps
self._reset_date = reset_dates
self._reset_step = reset_steps
self._steps = reset_steps[len(reset_steps) - 1]
self._the_tree = {}
<|end_body_0|>
<|body_start_1|>
bond = ZCBond(... | Representation of a simple derivative product such as Caplet or Floor | SimpleDerivative | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SimpleDerivative:
"""Representation of a simple derivative product such as Caplet or Floor"""
def __init__(self, payment_dates, payment_steps, reset_dates, reset_steps):
"""Initialize a SimpleDerivative object Parameters ---------- payment_dates : array_like of shape (1, ) with datet... | stack_v2_sparse_classes_36k_train_015267 | 11,731 | no_license | [
{
"docstring": "Initialize a SimpleDerivative object Parameters ---------- payment_dates : array_like of shape (1, ) with datetime payment dates payment_steps : array_like of shape (1, ) with integer payment steps that corresponds to the tree exercise_dates : array_like of shape (1, ) with datetime exercise dat... | 2 | stack_v2_sparse_classes_30k_train_006169 | Implement the Python class `SimpleDerivative` described below.
Class description:
Representation of a simple derivative product such as Caplet or Floor
Method signatures and docstrings:
- def __init__(self, payment_dates, payment_steps, reset_dates, reset_steps): Initialize a SimpleDerivative object Parameters ------... | Implement the Python class `SimpleDerivative` described below.
Class description:
Representation of a simple derivative product such as Caplet or Floor
Method signatures and docstrings:
- def __init__(self, payment_dates, payment_steps, reset_dates, reset_steps): Initialize a SimpleDerivative object Parameters ------... | 9f710a8de56fb9b4456c6f98be91f4b22ef5ede5 | <|skeleton|>
class SimpleDerivative:
"""Representation of a simple derivative product such as Caplet or Floor"""
def __init__(self, payment_dates, payment_steps, reset_dates, reset_steps):
"""Initialize a SimpleDerivative object Parameters ---------- payment_dates : array_like of shape (1, ) with datet... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SimpleDerivative:
"""Representation of a simple derivative product such as Caplet or Floor"""
def __init__(self, payment_dates, payment_steps, reset_dates, reset_steps):
"""Initialize a SimpleDerivative object Parameters ---------- payment_dates : array_like of shape (1, ) with datetime payment d... | the_stack_v2_python_sparse | Hull-White Model/simple_derivatives.py | jesusmramirez/Term-Structure-Models | train | 1 |
4d7be19923471af86b84cb5846e86b47593db6ef | [
"self.model = ViewCls()\nif weight_path:\n self.model.load_weights(weight_path)\nself.labels = ['PA', 'Lateral', 'Others']",
"imgo = np.squeeze(sitk.GetArrayFromImage(sitk.ReadImage(path)))\nimg = cv2.resize(imgo, (512, 512), interpolation=cv2.INTER_LINEAR)\nimg = img.astype(np.float32)\nimg -= np.min(img)\nim... | <|body_start_0|>
self.model = ViewCls()
if weight_path:
self.model.load_weights(weight_path)
self.labels = ['PA', 'Lateral', 'Others']
<|end_body_0|>
<|body_start_1|>
imgo = np.squeeze(sitk.GetArrayFromImage(sitk.ReadImage(path)))
img = cv2.resize(imgo, (512, 512), i... | ViewpointClassifier | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ViewpointClassifier:
def __init__(self, weight_path: Optional[str]=None):
"""Classifying PA / Lateral / Others Args: (string) weight_path : pretrained weight path (optional)"""
<|body_0|>
def _preprocessing(self, path: str) -> Tuple[np.array, np.array]:
"""Args: (str... | stack_v2_sparse_classes_36k_train_015268 | 13,351 | permissive | [
{
"docstring": "Classifying PA / Lateral / Others Args: (string) weight_path : pretrained weight path (optional)",
"name": "__init__",
"signature": "def __init__(self, weight_path: Optional[str]=None)"
},
{
"docstring": "Args: (string) path : dicom path Return: (numpy ndarray) imgo : original im... | 3 | stack_v2_sparse_classes_30k_train_019800 | Implement the Python class `ViewpointClassifier` described below.
Class description:
Implement the ViewpointClassifier class.
Method signatures and docstrings:
- def __init__(self, weight_path: Optional[str]=None): Classifying PA / Lateral / Others Args: (string) weight_path : pretrained weight path (optional)
- def ... | Implement the Python class `ViewpointClassifier` described below.
Class description:
Implement the ViewpointClassifier class.
Method signatures and docstrings:
- def __init__(self, weight_path: Optional[str]=None): Classifying PA / Lateral / Others Args: (string) weight_path : pretrained weight path (optional)
- def ... | 158a74985074f95fcd6a345c310903936dd2adbe | <|skeleton|>
class ViewpointClassifier:
def __init__(self, weight_path: Optional[str]=None):
"""Classifying PA / Lateral / Others Args: (string) weight_path : pretrained weight path (optional)"""
<|body_0|>
def _preprocessing(self, path: str) -> Tuple[np.array, np.array]:
"""Args: (str... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ViewpointClassifier:
def __init__(self, weight_path: Optional[str]=None):
"""Classifying PA / Lateral / Others Args: (string) weight_path : pretrained weight path (optional)"""
self.model = ViewCls()
if weight_path:
self.model.load_weights(weight_path)
self.labels =... | the_stack_v2_python_sparse | medimodule/Chest/module.py | mi2rl/MI2RLNet | train | 13 | |
016909f2320a11ccfcb65e191c20565fa878557e | [
"database = None\ncontent = config.get('content')\nif content is True:\n content = 'sqlite'\nif content == 'duckdb':\n database = DuckDB(config)\nelif content == 'sqlite':\n database = SQLite(config)\nelif content:\n url = urlparse(content)\n if url.scheme:\n database = Client(config)\n els... | <|body_start_0|>
database = None
content = config.get('content')
if content is True:
content = 'sqlite'
if content == 'duckdb':
database = DuckDB(config)
elif content == 'sqlite':
database = SQLite(config)
elif content:
url ... | Methods to create document databases. | DatabaseFactory | [
"Apache-2.0",
"LicenseRef-scancode-proprietary-license"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DatabaseFactory:
"""Methods to create document databases."""
def create(config):
"""Create a Database. Args: config: database configuration parameters Returns: Database"""
<|body_0|>
def resolve(backend, config):
"""Attempt to resolve a custom backend. Args: back... | stack_v2_sparse_classes_36k_train_015269 | 1,767 | permissive | [
{
"docstring": "Create a Database. Args: config: database configuration parameters Returns: Database",
"name": "create",
"signature": "def create(config)"
},
{
"docstring": "Attempt to resolve a custom backend. Args: backend: backend class config: index configuration parameters Returns: Database... | 2 | stack_v2_sparse_classes_30k_train_006463 | Implement the Python class `DatabaseFactory` described below.
Class description:
Methods to create document databases.
Method signatures and docstrings:
- def create(config): Create a Database. Args: config: database configuration parameters Returns: Database
- def resolve(backend, config): Attempt to resolve a custo... | Implement the Python class `DatabaseFactory` described below.
Class description:
Methods to create document databases.
Method signatures and docstrings:
- def create(config): Create a Database. Args: config: database configuration parameters Returns: Database
- def resolve(backend, config): Attempt to resolve a custo... | 789a4555cb60ee9cdfa69afae5a5236d197e2b07 | <|skeleton|>
class DatabaseFactory:
"""Methods to create document databases."""
def create(config):
"""Create a Database. Args: config: database configuration parameters Returns: Database"""
<|body_0|>
def resolve(backend, config):
"""Attempt to resolve a custom backend. Args: back... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DatabaseFactory:
"""Methods to create document databases."""
def create(config):
"""Create a Database. Args: config: database configuration parameters Returns: Database"""
database = None
content = config.get('content')
if content is True:
content = 'sqlite'
... | the_stack_v2_python_sparse | src/python/txtai/database/factory.py | neuml/txtai | train | 4,804 |
b41e041d7e7aca67a81e717c028ebbb18df491ab | [
"if not head:\n return None\nstack = deque()\nbegin = start = ListNode()\nstart.next = head\ncnt = 0\nleft_ptr = None\nright_ptr = None\nwhile start:\n cnt = cnt + 1\n if cnt < left:\n start = start.next\n continue\n if cnt == left:\n left_ptr = start\n if cnt == right:\n ... | <|body_start_0|>
if not head:
return None
stack = deque()
begin = start = ListNode()
start.next = head
cnt = 0
left_ptr = None
right_ptr = None
while start:
cnt = cnt + 1
if cnt < left:
start = start.next... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def reverseBetween(self, head: Optional[ListNode], left: int, right: int) -> Optional[ListNode]:
"""reverse with the help of a stack :param head: :param left: :param right: :return:"""
<|body_0|>
def reverseBetween_v2(self, head: Optional[ListNode], left: int, righ... | stack_v2_sparse_classes_36k_train_015270 | 3,084 | no_license | [
{
"docstring": "reverse with the help of a stack :param head: :param left: :param right: :return:",
"name": "reverseBetween",
"signature": "def reverseBetween(self, head: Optional[ListNode], left: int, right: int) -> Optional[ListNode]"
},
{
"docstring": "reverse using subroutine :param head: :p... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def reverseBetween(self, head: Optional[ListNode], left: int, right: int) -> Optional[ListNode]: reverse with the help of a stack :param head: :param left: :param right: :return:... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def reverseBetween(self, head: Optional[ListNode], left: int, right: int) -> Optional[ListNode]: reverse with the help of a stack :param head: :param left: :param right: :return:... | 46bd8d1b44cb19aa773cc072cc9be97e9a0e348d | <|skeleton|>
class Solution:
def reverseBetween(self, head: Optional[ListNode], left: int, right: int) -> Optional[ListNode]:
"""reverse with the help of a stack :param head: :param left: :param right: :return:"""
<|body_0|>
def reverseBetween_v2(self, head: Optional[ListNode], left: int, righ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def reverseBetween(self, head: Optional[ListNode], left: int, right: int) -> Optional[ListNode]:
"""reverse with the help of a stack :param head: :param left: :param right: :return:"""
if not head:
return None
stack = deque()
begin = start = ListNode()
... | the_stack_v2_python_sparse | src/python/data_structure/linked_list/92_reverse_linkedlist2.py | alannesta/algo4 | train | 0 | |
08e7faaa9d8181775a58793982b1b6bcf1b05285 | [
"filters = dict(is_latest=True, is_published=True)\nlatest_schema = MetadataSchema.objects.filter(**filters).first()\nif not latest_schema:\n return err_resp('Metadata schema not found.')\nschema_ok, schema_or_err = latest_schema.get_schema()\nif schema_ok is False:\n return err_resp(schema_or_err)\nreturn ok... | <|body_start_0|>
filters = dict(is_latest=True, is_published=True)
latest_schema = MetadataSchema.objects.filter(**filters).first()
if not latest_schema:
return err_resp('Metadata schema not found.')
schema_ok, schema_or_err = latest_schema.get_schema()
if schema_ok i... | Convenience class for the metadata schema work flow | SchemaUtil | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SchemaUtil:
"""Convenience class for the metadata schema work flow"""
def get_latest_schema():
"""to get latest metadata schema"""
<|body_0|>
def get_schema_version(version):
"""Retrun the version of schema"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|... | stack_v2_sparse_classes_36k_train_015271 | 2,600 | permissive | [
{
"docstring": "to get latest metadata schema",
"name": "get_latest_schema",
"signature": "def get_latest_schema()"
},
{
"docstring": "Retrun the version of schema",
"name": "get_schema_version",
"signature": "def get_schema_version(version)"
}
] | 2 | stack_v2_sparse_classes_30k_train_003026 | Implement the Python class `SchemaUtil` described below.
Class description:
Convenience class for the metadata schema work flow
Method signatures and docstrings:
- def get_latest_schema(): to get latest metadata schema
- def get_schema_version(version): Retrun the version of schema | Implement the Python class `SchemaUtil` described below.
Class description:
Convenience class for the metadata schema work flow
Method signatures and docstrings:
- def get_latest_schema(): to get latest metadata schema
- def get_schema_version(version): Retrun the version of schema
<|skeleton|>
class SchemaUtil:
... | 9461522219f5ef0f4877f24c8f5923e462bd9557 | <|skeleton|>
class SchemaUtil:
"""Convenience class for the metadata schema work flow"""
def get_latest_schema():
"""to get latest metadata schema"""
<|body_0|>
def get_schema_version(version):
"""Retrun the version of schema"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SchemaUtil:
"""Convenience class for the metadata schema work flow"""
def get_latest_schema():
"""to get latest metadata schema"""
filters = dict(is_latest=True, is_published=True)
latest_schema = MetadataSchema.objects.filter(**filters).first()
if not latest_schema:
... | the_stack_v2_python_sparse | preprocess_web/code/ravens_metadata_apps/metadata_schemas/schema_util.py | TwoRavens/raven-metadata-service | train | 0 |
9bbcfacac476bb9d2befb82a33afdf2436de95e9 | [
"user_id = request.user.id\ndata = redis_obj.get('note' + str(note_id))\nif data is None:\n note = Note.objects.filter(id=note_id, user_id=user_id)\n serializer = NoteSerializer(note, many=True)\n note_data = str(serializer.data)\n redis_obj.set('note' + str(note_id), note_data)\n if note.count() == ... | <|body_start_0|>
user_id = request.user.id
data = redis_obj.get('note' + str(note_id))
if data is None:
note = Note.objects.filter(id=note_id, user_id=user_id)
serializer = NoteSerializer(note, many=True)
note_data = str(serializer.data)
redis_obj.... | NoteShareView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NoteShareView:
def get(self, request, note_id):
""":param note_id: The name parameter is for accessing a note with the note id as given by the user :param request: GET :return: returns an SMD response accordingly if the note with the name is present/not present in the database with the s... | stack_v2_sparse_classes_36k_train_015272 | 22,405 | no_license | [
{
"docstring": ":param note_id: The name parameter is for accessing a note with the note id as given by the user :param request: GET :return: returns an SMD response accordingly if the note with the name is present/not present in the database with the serialized data of the note",
"name": "get",
"signat... | 3 | stack_v2_sparse_classes_30k_train_010199 | Implement the Python class `NoteShareView` described below.
Class description:
Implement the NoteShareView class.
Method signatures and docstrings:
- def get(self, request, note_id): :param note_id: The name parameter is for accessing a note with the note id as given by the user :param request: GET :return: returns a... | Implement the Python class `NoteShareView` described below.
Class description:
Implement the NoteShareView class.
Method signatures and docstrings:
- def get(self, request, note_id): :param note_id: The name parameter is for accessing a note with the note id as given by the user :param request: GET :return: returns a... | 97e5870e9af3f5c6dab75f9bf336c05045a5fea8 | <|skeleton|>
class NoteShareView:
def get(self, request, note_id):
""":param note_id: The name parameter is for accessing a note with the note id as given by the user :param request: GET :return: returns an SMD response accordingly if the note with the name is present/not present in the database with the s... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NoteShareView:
def get(self, request, note_id):
""":param note_id: The name parameter is for accessing a note with the note id as given by the user :param request: GET :return: returns an SMD response accordingly if the note with the name is present/not present in the database with the serialized data... | the_stack_v2_python_sparse | notes/views.py | addyp1911/FundooNotes | train | 0 | |
2c6c30ec30e047db53cd0fefe0f6e7c1bf2ffaec | [
"DXDataObject.__init__(self, dxid=dxid, project=project)\nself._read_buf = BytesIO()\nself._read_bufsize = read_buffer_size\nself._expected_file_size = expected_file_size\nself._file_is_mmapd = file_is_mmapd\nself._download_url, self._download_url_headers, self._download_url_expires = (None, None, None)\nself._url_... | <|body_start_0|>
DXDataObject.__init__(self, dxid=dxid, project=project)
self._read_buf = BytesIO()
self._read_bufsize = read_buffer_size
self._expected_file_size = expected_file_size
self._file_is_mmapd = file_is_mmapd
self._download_url, self._download_url_headers, self... | Remote database object handler. :param dxid: Object ID :type dxid: string :param project: Project ID :type project: string | DXDatabase | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DXDatabase:
"""Remote database object handler. :param dxid: Object ID :type dxid: string :param project: Project ID :type project: string"""
def __init__(self, dxid=None, project=None, read_buffer_size=DEFAULT_BUFFER_SIZE, expected_file_size=None, file_is_mmapd=False):
""":param dxid... | stack_v2_sparse_classes_36k_train_015273 | 9,041 | permissive | [
{
"docstring": ":param dxid: Object ID :type dxid: string :param project: Project ID :type project: string :param read_buffer_size: size of read buffer in bytes :type read_buffer_size: int :param expected_file_size: size of data that will be written, if known :type expected_file_size: int :param file_is_mmapd: ... | 2 | null | Implement the Python class `DXDatabase` described below.
Class description:
Remote database object handler. :param dxid: Object ID :type dxid: string :param project: Project ID :type project: string
Method signatures and docstrings:
- def __init__(self, dxid=None, project=None, read_buffer_size=DEFAULT_BUFFER_SIZE, e... | Implement the Python class `DXDatabase` described below.
Class description:
Remote database object handler. :param dxid: Object ID :type dxid: string :param project: Project ID :type project: string
Method signatures and docstrings:
- def __init__(self, dxid=None, project=None, read_buffer_size=DEFAULT_BUFFER_SIZE, e... | ad4f498ae80fb0cd2e591f63a7bf4fb983049c75 | <|skeleton|>
class DXDatabase:
"""Remote database object handler. :param dxid: Object ID :type dxid: string :param project: Project ID :type project: string"""
def __init__(self, dxid=None, project=None, read_buffer_size=DEFAULT_BUFFER_SIZE, expected_file_size=None, file_is_mmapd=False):
""":param dxid... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DXDatabase:
"""Remote database object handler. :param dxid: Object ID :type dxid: string :param project: Project ID :type project: string"""
def __init__(self, dxid=None, project=None, read_buffer_size=DEFAULT_BUFFER_SIZE, expected_file_size=None, file_is_mmapd=False):
""":param dxid: Object ID :... | the_stack_v2_python_sparse | src/python/dxpy/bindings/dxdatabase.py | dnanexus/dx-toolkit | train | 82 |
cb34577accf8d1fe4f5a0688f702db354ad186e6 | [
"self.__node = root\nself.__forward = forward\nself.__s = []\nself.__cur = None\nwhile self.__node:\n self.__cur = self.__node.val\n self.__s.append(self.__node)\n self.__node = self.__node.left if self.__forward else self.__node.right",
"if self.__node or self.__s:\n return True\nelse:\n return Fa... | <|body_start_0|>
self.__node = root
self.__forward = forward
self.__s = []
self.__cur = None
while self.__node:
self.__cur = self.__node.val
self.__s.append(self.__node)
self.__node = self.__node.left if self.__forward else self.__node.right
<|... | BSTIterator2 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BSTIterator2:
def __init__(self, root, forward):
""":param root: :param forward: next smallest or next biggest"""
<|body_0|>
def hasNext(self):
""":rtype: bool"""
<|body_1|>
def next(self):
""":rtype: int"""
<|body_2|>
<|end_skeleton|>
... | stack_v2_sparse_classes_36k_train_015274 | 2,401 | no_license | [
{
"docstring": ":param root: :param forward: next smallest or next biggest",
"name": "__init__",
"signature": "def __init__(self, root, forward)"
},
{
"docstring": ":rtype: bool",
"name": "hasNext",
"signature": "def hasNext(self)"
},
{
"docstring": ":rtype: int",
"name": "ne... | 3 | stack_v2_sparse_classes_30k_val_000584 | Implement the Python class `BSTIterator2` described below.
Class description:
Implement the BSTIterator2 class.
Method signatures and docstrings:
- def __init__(self, root, forward): :param root: :param forward: next smallest or next biggest
- def hasNext(self): :rtype: bool
- def next(self): :rtype: int | Implement the Python class `BSTIterator2` described below.
Class description:
Implement the BSTIterator2 class.
Method signatures and docstrings:
- def __init__(self, root, forward): :param root: :param forward: next smallest or next biggest
- def hasNext(self): :rtype: bool
- def next(self): :rtype: int
<|skeleton|... | a5b02044ef39154b6a8d32eb57682f447e1632ba | <|skeleton|>
class BSTIterator2:
def __init__(self, root, forward):
""":param root: :param forward: next smallest or next biggest"""
<|body_0|>
def hasNext(self):
""":rtype: bool"""
<|body_1|>
def next(self):
""":rtype: int"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BSTIterator2:
def __init__(self, root, forward):
""":param root: :param forward: next smallest or next biggest"""
self.__node = root
self.__forward = forward
self.__s = []
self.__cur = None
while self.__node:
self.__cur = self.__node.val
... | the_stack_v2_python_sparse | algo/tree/binary_search_tree_iterator.py | xys234/coding-problems | train | 0 | |
939bc9982ffca1e19be467039795b75e407d9eaa | [
"env_name = env_info['name']\nvision = env_info['vision']\nconfig = env_info['config']\nenv = Env_Platform(env_name, vision, config)\nself.init_state = None\nreturn env",
"if reset_arg is None:\n state = self.env.reset()\nelse:\n state = self.env.reset(reset_arg)\nself.init_state = state\nreturn state"
] | <|body_start_0|>
env_name = env_info['name']
vision = env_info['vision']
config = env_info['config']
env = Env_Platform(env_name, vision, config)
self.init_state = None
return env
<|end_body_0|>
<|body_start_1|>
if reset_arg is None:
state = self.env.... | simulator platform for noah case | RlEnvSimu | [
"MIT",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RlEnvSimu:
"""simulator platform for noah case"""
def init_env(self, env_info):
"""create a environment instance :param: the config information of environment :return: the instance of environment"""
<|body_0|>
def reset(self, reset_arg=None):
"""reset the environ... | stack_v2_sparse_classes_36k_train_015275 | 2,290 | permissive | [
{
"docstring": "create a environment instance :param: the config information of environment :return: the instance of environment",
"name": "init_env",
"signature": "def init_env(self, env_info)"
},
{
"docstring": "reset the environment. :param reset_arg: optional parameter, it's used to specify ... | 2 | null | Implement the Python class `RlEnvSimu` described below.
Class description:
simulator platform for noah case
Method signatures and docstrings:
- def init_env(self, env_info): create a environment instance :param: the config information of environment :return: the instance of environment
- def reset(self, reset_arg=Non... | Implement the Python class `RlEnvSimu` described below.
Class description:
simulator platform for noah case
Method signatures and docstrings:
- def init_env(self, env_info): create a environment instance :param: the config information of environment :return: the instance of environment
- def reset(self, reset_arg=Non... | df51ed9c1d6dbde1deef63f2a037a369f8554406 | <|skeleton|>
class RlEnvSimu:
"""simulator platform for noah case"""
def init_env(self, env_info):
"""create a environment instance :param: the config information of environment :return: the instance of environment"""
<|body_0|>
def reset(self, reset_arg=None):
"""reset the environ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RlEnvSimu:
"""simulator platform for noah case"""
def init_env(self, env_info):
"""create a environment instance :param: the config information of environment :return: the instance of environment"""
env_name = env_info['name']
vision = env_info['vision']
config = env_info[... | the_stack_v2_python_sparse | built-in/TensorFlow/Research/reinforcement-learning/ModelZoo_PPO_TensorFlow/rl/xt/environment/rl_simu/rl_simu.py | Huawei-Ascend/modelzoo | train | 1 |
d3150354202d91857be31e8470106116151dd44e | [
"self.time_value = time_value\nif ok_button_label is None:\n ok_button_label = 'Edit'\nself.ok_button_label = ok_button_label\nself.validating_function = validating_function",
"if time_value is not None:\n self.time_value = time_value\nself.w_value.SetData(str(self.time_value.value))\nself.w_utc_datetime.Se... | <|body_start_0|>
self.time_value = time_value
if ok_button_label is None:
ok_button_label = 'Edit'
self.ok_button_label = ok_button_label
self.validating_function = validating_function
<|end_body_0|>
<|body_start_1|>
if time_value is not None:
self.time_v... | A class representing a dialog for editing a time value. | TimeValueEditDialog | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TimeValueEditDialog:
"""A class representing a dialog for editing a time value."""
def __init__(self, time_value, ok_button_label=None, validating_function=None):
"""Initialize the instance."""
<|body_0|>
def load_time_value(self, time_value=None):
"""Load the pr... | stack_v2_sparse_classes_36k_train_015276 | 9,476 | no_license | [
{
"docstring": "Initialize the instance.",
"name": "__init__",
"signature": "def __init__(self, time_value, ok_button_label=None, validating_function=None)"
},
{
"docstring": "Load the provided time value.",
"name": "load_time_value",
"signature": "def load_time_value(self, time_value=No... | 6 | stack_v2_sparse_classes_30k_test_000163 | Implement the Python class `TimeValueEditDialog` described below.
Class description:
A class representing a dialog for editing a time value.
Method signatures and docstrings:
- def __init__(self, time_value, ok_button_label=None, validating_function=None): Initialize the instance.
- def load_time_value(self, time_val... | Implement the Python class `TimeValueEditDialog` described below.
Class description:
A class representing a dialog for editing a time value.
Method signatures and docstrings:
- def __init__(self, time_value, ok_button_label=None, validating_function=None): Initialize the instance.
- def load_time_value(self, time_val... | 5e7cc7de3495145501ca53deb9efee2233ab7e1c | <|skeleton|>
class TimeValueEditDialog:
"""A class representing a dialog for editing a time value."""
def __init__(self, time_value, ok_button_label=None, validating_function=None):
"""Initialize the instance."""
<|body_0|>
def load_time_value(self, time_value=None):
"""Load the pr... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TimeValueEditDialog:
"""A class representing a dialog for editing a time value."""
def __init__(self, time_value, ok_button_label=None, validating_function=None):
"""Initialize the instance."""
self.time_value = time_value
if ok_button_label is None:
ok_button_label = ... | the_stack_v2_python_sparse | Python modules/pb_gui_core.py | webclinic017/fa-absa-py3 | train | 0 |
c34409f6e9d68a6aba35fcaa3374f94bb01d1df8 | [
"self.hex_layout = hex_layout\nself.number_layout = number_layout\nself.robber_hex = robber_hex",
"soclog_line = soclog_line.strip()\nmsg_match = SOCBOARDLAYOUT_MATCH.search(soclog_line)\nif msg_match is not None:\n hex_layout = [int(x) for x in msg_match.group('hex_layout').split(' ')]\n number_layout = [i... | <|body_start_0|>
self.hex_layout = hex_layout
self.number_layout = number_layout
self.robber_hex = robber_hex
<|end_body_0|>
<|body_start_1|>
soclog_line = soclog_line.strip()
msg_match = SOCBOARDLAYOUT_MATCH.search(soclog_line)
if msg_match is not None:
hex_... | Board itself. Parameters ---------- hex_layout : sequence of int General layout of the board, as a sequence of 37 terrain tiles for land, port, water. number_layout : sequence of int Production on the land hexes of the board, as a sequence of 19 number tokens. robber_hex : str Initial position of the robber, hexadecima... | CatanBoard | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CatanBoard:
"""Board itself. Parameters ---------- hex_layout : sequence of int General layout of the board, as a sequence of 37 terrain tiles for land, port, water. number_layout : sequence of int Production on the land hexes of the board, as a sequence of 19 number tokens. robber_hex : str Init... | stack_v2_sparse_classes_36k_train_015277 | 3,916 | no_license | [
{
"docstring": "Init",
"name": "__init__",
"signature": "def __init__(self, hex_layout, number_layout, robber_hex)"
},
{
"docstring": "Parse a SOCBoardLayout message from a line in the soclog.",
"name": "from_soclog_line",
"signature": "def from_soclog_line(cls, soclog_line)"
}
] | 2 | stack_v2_sparse_classes_30k_train_001713 | Implement the Python class `CatanBoard` described below.
Class description:
Board itself. Parameters ---------- hex_layout : sequence of int General layout of the board, as a sequence of 37 terrain tiles for land, port, water. number_layout : sequence of int Production on the land hexes of the board, as a sequence of ... | Implement the Python class `CatanBoard` described below.
Class description:
Board itself. Parameters ---------- hex_layout : sequence of int General layout of the board, as a sequence of 37 terrain tiles for land, port, water. number_layout : sequence of int Production on the land hexes of the board, as a sequence of ... | ec36fac93d26101ba1014db5540483a182472918 | <|skeleton|>
class CatanBoard:
"""Board itself. Parameters ---------- hex_layout : sequence of int General layout of the board, as a sequence of 37 terrain tiles for land, port, water. number_layout : sequence of int Production on the land hexes of the board, as a sequence of 19 number tokens. robber_hex : str Init... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CatanBoard:
"""Board itself. Parameters ---------- hex_layout : sequence of int General layout of the board, as a sequence of 37 terrain tiles for land, port, water. number_layout : sequence of int Production on the land hexes of the board, as a sequence of 19 number tokens. robber_hex : str Initial position ... | the_stack_v2_python_sparse | intake/catan_board.py | Tapojit/irit-stac | train | 0 |
62c3bd7535c3ee9495cb282facf5fad9213ec35f | [
"self.Data = Data\nself.K = K\nif weights is not None:\n self.weights = weights\nelse:\n self.weights = np.random.rand(self.K)\n self.weights /= np.sum(self.weights)\ncol = np.shape(self.Data)[1]\nif means is not None:\n self.means = means\nelse:\n self.means = []\n for i in range(self.K):\n ... | <|body_start_0|>
self.Data = Data
self.K = K
if weights is not None:
self.weights = weights
else:
self.weights = np.random.rand(self.K)
self.weights /= np.sum(self.weights)
col = np.shape(self.Data)[1]
if means is not None:
... | GMM | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GMM:
def __init__(self, Data, K, weights=None, means=None, covars=None):
"""这是GMM(高斯混合模型)类的构造函数 :param Data: 训练数据 :param K: 高斯分布的个数 :param weigths: 每个高斯分布的初始概率(权重) :param means: 高斯分布的均值向量 :param covars: 高斯分布的协方差矩阵集合"""
<|body_0|>
def Gaussian(self, x, mean, cov):
"""... | stack_v2_sparse_classes_36k_train_015278 | 7,656 | no_license | [
{
"docstring": "这是GMM(高斯混合模型)类的构造函数 :param Data: 训练数据 :param K: 高斯分布的个数 :param weigths: 每个高斯分布的初始概率(权重) :param means: 高斯分布的均值向量 :param covars: 高斯分布的协方差矩阵集合",
"name": "__init__",
"signature": "def __init__(self, Data, K, weights=None, means=None, covars=None)"
},
{
"docstring": "这是自定义的高斯分布概率密度函数 ... | 3 | stack_v2_sparse_classes_30k_train_013890 | Implement the Python class `GMM` described below.
Class description:
Implement the GMM class.
Method signatures and docstrings:
- def __init__(self, Data, K, weights=None, means=None, covars=None): 这是GMM(高斯混合模型)类的构造函数 :param Data: 训练数据 :param K: 高斯分布的个数 :param weigths: 每个高斯分布的初始概率(权重) :param means: 高斯分布的均值向量 :param c... | Implement the Python class `GMM` described below.
Class description:
Implement the GMM class.
Method signatures and docstrings:
- def __init__(self, Data, K, weights=None, means=None, covars=None): 这是GMM(高斯混合模型)类的构造函数 :param Data: 训练数据 :param K: 高斯分布的个数 :param weigths: 每个高斯分布的初始概率(权重) :param means: 高斯分布的均值向量 :param c... | 728852edefecfaf3af61a90c1c0325ee4991b4fc | <|skeleton|>
class GMM:
def __init__(self, Data, K, weights=None, means=None, covars=None):
"""这是GMM(高斯混合模型)类的构造函数 :param Data: 训练数据 :param K: 高斯分布的个数 :param weigths: 每个高斯分布的初始概率(权重) :param means: 高斯分布的均值向量 :param covars: 高斯分布的协方差矩阵集合"""
<|body_0|>
def Gaussian(self, x, mean, cov):
"""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GMM:
def __init__(self, Data, K, weights=None, means=None, covars=None):
"""这是GMM(高斯混合模型)类的构造函数 :param Data: 训练数据 :param K: 高斯分布的个数 :param weigths: 每个高斯分布的初始概率(权重) :param means: 高斯分布的均值向量 :param covars: 高斯分布的协方差矩阵集合"""
self.Data = Data
self.K = K
if weights is not None:
... | the_stack_v2_python_sparse | GMM.py | mrachelyu/yolo3_auto_label- | train | 1 | |
4872ddaf8ec14c6c6eb368ff26824c1c02d0511e | [
"from dask.distributed import Client\nprint('initiate Dask client')\nself.client = Client(self.cluster)\nbox = func_data['box']\nrange_window = func_data['range_window']\nazimuth_window = func_data['azimuth_window']\nsub_boxes = self.split_box2sub_boxes(box, range_window=range_window, azimuth_window=azimuth_window,... | <|body_start_0|>
from dask.distributed import Client
print('initiate Dask client')
self.client = Client(self.cluster)
box = func_data['box']
range_window = func_data['range_window']
azimuth_window = func_data['azimuth_window']
sub_boxes = self.split_box2sub_boxes(... | Generic dask cluster wrapper for parallel processing in blocks. This object takes in a computing function for one block in space. For the computing function: 1. the output is always several matrices and one box. 2. the number of matrices may vary for different applications/functions. 3. all matrices will be in 2D in si... | MDaskCluster | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MDaskCluster:
"""Generic dask cluster wrapper for parallel processing in blocks. This object takes in a computing function for one block in space. For the computing function: 1. the output is always several matrices and one box. 2. the number of matrices may vary for different applications/functi... | stack_v2_sparse_classes_36k_train_015279 | 6,949 | no_license | [
{
"docstring": "Wrapper function encapsulating submit_workers and compile_workers. For a generic result collection without prior knowledge of the computing function, we assume that the output of \"func\" is: several 2D or 3D matrices + a box :param func: function, a python function to run in parallel :param fun... | 3 | stack_v2_sparse_classes_30k_train_008470 | Implement the Python class `MDaskCluster` described below.
Class description:
Generic dask cluster wrapper for parallel processing in blocks. This object takes in a computing function for one block in space. For the computing function: 1. the output is always several matrices and one box. 2. the number of matrices may... | Implement the Python class `MDaskCluster` described below.
Class description:
Generic dask cluster wrapper for parallel processing in blocks. This object takes in a computing function for one block in space. For the computing function: 1. the output is always several matrices and one box. 2. the number of matrices may... | 6e92f8d887b16bdfa5d498b4c55abbb72014ca2b | <|skeleton|>
class MDaskCluster:
"""Generic dask cluster wrapper for parallel processing in blocks. This object takes in a computing function for one block in space. For the computing function: 1. the output is always several matrices and one box. 2. the number of matrices may vary for different applications/functi... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MDaskCluster:
"""Generic dask cluster wrapper for parallel processing in blocks. This object takes in a computing function for one block in space. For the computing function: 1. the output is always several matrices and one box. 2. the number of matrices may vary for different applications/functions. 3. all m... | the_stack_v2_python_sparse | dev/cluster_minopy_back.py | cherishing99/MiNoPy | train | 0 |
d7fc76055ea694a97998d319dda719f8ecdc856b | [
"rows = len(matrix)\nif rows == 0:\n return False\ncols = len(matrix[0])\nif cols == 0:\n return False\nleft, right = (0, rows * cols - 1)\nwhile left <= right:\n mid = left + (right - left) // 2\n num = matrix[mid // cols][mid % cols]\n if num == target:\n return True\n elif num < target:\... | <|body_start_0|>
rows = len(matrix)
if rows == 0:
return False
cols = len(matrix[0])
if cols == 0:
return False
left, right = (0, rows * cols - 1)
while left <= right:
mid = left + (right - left) // 2
num = matrix[mid // col... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def searchMatrix(self, matrix, target):
"""1. Integers in each row are sorted from left to right. 2. The first integer of each row is greater than the last integer of the previous row. :param matrix: List[List[int]] :param target: int :return: bool"""
<|body_0|>
de... | stack_v2_sparse_classes_36k_train_015280 | 2,051 | no_license | [
{
"docstring": "1. Integers in each row are sorted from left to right. 2. The first integer of each row is greater than the last integer of the previous row. :param matrix: List[List[int]] :param target: int :return: bool",
"name": "searchMatrix",
"signature": "def searchMatrix(self, matrix, target)"
... | 2 | stack_v2_sparse_classes_30k_train_006778 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def searchMatrix(self, matrix, target): 1. Integers in each row are sorted from left to right. 2. The first integer of each row is greater than the last integer of the previous r... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def searchMatrix(self, matrix, target): 1. Integers in each row are sorted from left to right. 2. The first integer of each row is greater than the last integer of the previous r... | 215d513b3564a7a76db3d2b29e4acc341a68e8ee | <|skeleton|>
class Solution:
def searchMatrix(self, matrix, target):
"""1. Integers in each row are sorted from left to right. 2. The first integer of each row is greater than the last integer of the previous row. :param matrix: List[List[int]] :param target: int :return: bool"""
<|body_0|>
de... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def searchMatrix(self, matrix, target):
"""1. Integers in each row are sorted from left to right. 2. The first integer of each row is greater than the last integer of the previous row. :param matrix: List[List[int]] :param target: int :return: bool"""
rows = len(matrix)
if ro... | the_stack_v2_python_sparse | python/bin-search/search-2D-matrix.py | euxuoh/leetcode | train | 0 | |
154aadba4e5c790c375bb62e66be09997c30476a | [
"self.model = load_model(model_filename)\nself.input_columns = list()\nfor transformer_step in self.model.steps[0][1].transformer_list:\n [self.input_columns.append(x) for x in transformer_step[1].in_columns if x not in self.input_columns]\ntry:\n assert desired_class\nexcept AssertionError:\n raise ValueE... | <|body_start_0|>
self.model = load_model(model_filename)
self.input_columns = list()
for transformer_step in self.model.steps[0][1].transformer_list:
[self.input_columns.append(x) for x in transformer_step[1].in_columns if x not in self.input_columns]
try:
assert ... | QueryModel | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class QueryModel:
def __init__(self, model_filename: str, desired_class: str):
"""Object that facilitates predictions of user submitted data on a persisted model :param model_filename: str - file path to the model :param desired_class: str - what is the class we want If all predicted values ar... | stack_v2_sparse_classes_36k_train_015281 | 6,511 | no_license | [
{
"docstring": "Object that facilitates predictions of user submitted data on a persisted model :param model_filename: str - file path to the model :param desired_class: str - what is the class we want If all predicted values are of the classs `desired_class` then the `predict` function will return true.",
... | 6 | stack_v2_sparse_classes_30k_train_004437 | Implement the Python class `QueryModel` described below.
Class description:
Implement the QueryModel class.
Method signatures and docstrings:
- def __init__(self, model_filename: str, desired_class: str): Object that facilitates predictions of user submitted data on a persisted model :param model_filename: str - file... | Implement the Python class `QueryModel` described below.
Class description:
Implement the QueryModel class.
Method signatures and docstrings:
- def __init__(self, model_filename: str, desired_class: str): Object that facilitates predictions of user submitted data on a persisted model :param model_filename: str - file... | 7d45576823ef3601dfdf31c57f1fc4772c7f5863 | <|skeleton|>
class QueryModel:
def __init__(self, model_filename: str, desired_class: str):
"""Object that facilitates predictions of user submitted data on a persisted model :param model_filename: str - file path to the model :param desired_class: str - what is the class we want If all predicted values ar... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class QueryModel:
def __init__(self, model_filename: str, desired_class: str):
"""Object that facilitates predictions of user submitted data on a persisted model :param model_filename: str - file path to the model :param desired_class: str - what is the class we want If all predicted values are of the class... | the_stack_v2_python_sparse | src/model/query_model.py | ryancollingwood/DGAClassifier | train | 12 | |
af788f1b33b24a6c2c3e80cb974c69b73c94106a | [
"role = request.get_json().get('role')\nmembership_status = request.get_json().get('status')\nnotify_user = request.get_json().get('notifyUser')\nupdated_fields_dict = {}\norigin = request.environ.get('HTTP_ORIGIN', 'localhost')\ntry:\n if role is not None:\n updated_role = MembershipService.get_membershi... | <|body_start_0|>
role = request.get_json().get('role')
membership_status = request.get_json().get('status')
notify_user = request.get_json().get('notifyUser')
updated_fields_dict = {}
origin = request.environ.get('HTTP_ORIGIN', 'localhost')
try:
if role is not... | Resource for managing a single membership record between an org and a user. | OrgMember | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OrgMember:
"""Resource for managing a single membership record between an org and a user."""
def patch(org_id, membership_id):
"""Update a membership record with new member role."""
<|body_0|>
def delete(org_id, membership_id):
"""Mark a membership record as inac... | stack_v2_sparse_classes_36k_train_015282 | 30,185 | permissive | [
{
"docstring": "Update a membership record with new member role.",
"name": "patch",
"signature": "def patch(org_id, membership_id)"
},
{
"docstring": "Mark a membership record as inactive. Membership must match current user token.",
"name": "delete",
"signature": "def delete(org_id, memb... | 2 | stack_v2_sparse_classes_30k_val_000323 | Implement the Python class `OrgMember` described below.
Class description:
Resource for managing a single membership record between an org and a user.
Method signatures and docstrings:
- def patch(org_id, membership_id): Update a membership record with new member role.
- def delete(org_id, membership_id): Mark a memb... | Implement the Python class `OrgMember` described below.
Class description:
Resource for managing a single membership record between an org and a user.
Method signatures and docstrings:
- def patch(org_id, membership_id): Update a membership record with new member role.
- def delete(org_id, membership_id): Mark a memb... | 923cb8a3ee88dcbaf0fe800ca70022b3c13c1d01 | <|skeleton|>
class OrgMember:
"""Resource for managing a single membership record between an org and a user."""
def patch(org_id, membership_id):
"""Update a membership record with new member role."""
<|body_0|>
def delete(org_id, membership_id):
"""Mark a membership record as inac... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class OrgMember:
"""Resource for managing a single membership record between an org and a user."""
def patch(org_id, membership_id):
"""Update a membership record with new member role."""
role = request.get_json().get('role')
membership_status = request.get_json().get('status')
... | the_stack_v2_python_sparse | auth-api/src/auth_api/resources/org.py | bcgov/sbc-auth | train | 13 |
b06bbd14aea4865b6abcee4bd2b9d643cce9eafe | [
"test_dir = file_utilities.create_test_directory(test_case)\ntry:\n real_contents = file_utilities.get_files(test_dir)\n expected_contents = [i[0] if isinstance(i, tuple) else i for i in test_case]\n sys.stdout.write('real_contents = %s\\n' % (real_contents,))\n sys.stdout.write('expected_contents = %s\... | <|body_start_0|>
test_dir = file_utilities.create_test_directory(test_case)
try:
real_contents = file_utilities.get_files(test_dir)
expected_contents = [i[0] if isinstance(i, tuple) else i for i in test_case]
sys.stdout.write('real_contents = %s\n' % (real_contents,))... | TestCreateTestDirectory | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestCreateTestDirectory:
def test_existence(self, test_case):
"""Ensure that all the files that were supposed to get created are there, and ensure that none were created that weren't supposed to be."""
<|body_0|>
def test_files_sizes(self, test_case):
"""Ensures that... | stack_v2_sparse_classes_36k_train_015283 | 43,570 | no_license | [
{
"docstring": "Ensure that all the files that were supposed to get created are there, and ensure that none were created that weren't supposed to be.",
"name": "test_existence",
"signature": "def test_existence(self, test_case)"
},
{
"docstring": "Ensures that the files created are the correct s... | 2 | null | Implement the Python class `TestCreateTestDirectory` described below.
Class description:
Implement the TestCreateTestDirectory class.
Method signatures and docstrings:
- def test_existence(self, test_case): Ensure that all the files that were supposed to get created are there, and ensure that none were created that w... | Implement the Python class `TestCreateTestDirectory` described below.
Class description:
Implement the TestCreateTestDirectory class.
Method signatures and docstrings:
- def test_existence(self, test_case): Ensure that all the files that were supposed to get created are there, and ensure that none were created that w... | 0ac6653219c2701c13c508c5c4fc9bc3437eea06 | <|skeleton|>
class TestCreateTestDirectory:
def test_existence(self, test_case):
"""Ensure that all the files that were supposed to get created are there, and ensure that none were created that weren't supposed to be."""
<|body_0|>
def test_files_sizes(self, test_case):
"""Ensures that... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestCreateTestDirectory:
def test_existence(self, test_case):
"""Ensure that all the files that were supposed to get created are there, and ensure that none were created that weren't supposed to be."""
test_dir = file_utilities.create_test_directory(test_case)
try:
real_con... | the_stack_v2_python_sparse | repoData/brownhead-superzippy/allPythonContent.py | aCoffeeYin/pyreco | train | 0 | |
3b5266a4acee04ad6a39a2efb0e8516bdc6c0a55 | [
"mean, stddevs = super().get_mean_and_stddevs(sites, rup, dists, imt, stddev_types)\nif imt == PGA():\n freq = 50.0\nelif imt == PGV():\n freq = 2.0\nelse:\n freq = 1.0 / imt.period\nx1 = np.min([-0.18 + 0.17 * np.log10(freq), 0])\nif rup.hypo_depth < 20.0:\n x0 = np.max([0.217 - 0.321 * np.log10(freq),... | <|body_start_0|>
mean, stddevs = super().get_mean_and_stddevs(sites, rup, dists, imt, stddev_types)
if imt == PGA():
freq = 50.0
elif imt == PGV():
freq = 2.0
else:
freq = 1.0 / imt.period
x1 = np.min([-0.18 + 0.17 * np.log10(freq), 0])
... | Modification of the original base class adjusted for application to the Hawaii region as described in: Atkinson, G. M. (2010) 'Ground-Motion Prediction Equations for Hawaii from a Referenced Empirical Approach", Bulletin of the Seismological Society of America, Vol. 100, No. 2, pp. 751–761 | Atkinson2010Hawaii | [
"BSD-3-Clause",
"AGPL-3.0-only"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Atkinson2010Hawaii:
"""Modification of the original base class adjusted for application to the Hawaii region as described in: Atkinson, G. M. (2010) 'Ground-Motion Prediction Equations for Hawaii from a Referenced Empirical Approach", Bulletin of the Seismological Society of America, Vol. 100, No... | stack_v2_sparse_classes_36k_train_015284 | 18,299 | permissive | [
{
"docstring": "Using a frequency dependent correction for the mean ground motion. Standard deviation is fixed.",
"name": "get_mean_and_stddevs",
"signature": "def get_mean_and_stddevs(self, sites, rup, dists, imt, stddev_types)"
},
{
"docstring": "Return total standard deviation.",
"name": ... | 2 | stack_v2_sparse_classes_30k_val_000560 | Implement the Python class `Atkinson2010Hawaii` described below.
Class description:
Modification of the original base class adjusted for application to the Hawaii region as described in: Atkinson, G. M. (2010) 'Ground-Motion Prediction Equations for Hawaii from a Referenced Empirical Approach", Bulletin of the Seismol... | Implement the Python class `Atkinson2010Hawaii` described below.
Class description:
Modification of the original base class adjusted for application to the Hawaii region as described in: Atkinson, G. M. (2010) 'Ground-Motion Prediction Equations for Hawaii from a Referenced Empirical Approach", Bulletin of the Seismol... | 0da9ba5a575360081715e8b90c71d4b16c6687c8 | <|skeleton|>
class Atkinson2010Hawaii:
"""Modification of the original base class adjusted for application to the Hawaii region as described in: Atkinson, G. M. (2010) 'Ground-Motion Prediction Equations for Hawaii from a Referenced Empirical Approach", Bulletin of the Seismological Society of America, Vol. 100, No... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Atkinson2010Hawaii:
"""Modification of the original base class adjusted for application to the Hawaii region as described in: Atkinson, G. M. (2010) 'Ground-Motion Prediction Equations for Hawaii from a Referenced Empirical Approach", Bulletin of the Seismological Society of America, Vol. 100, No. 2, pp. 751–... | the_stack_v2_python_sparse | openquake/hazardlib/gsim/boore_atkinson_2008.py | GFZ-Centre-for-Early-Warning/shakyground | train | 1 |
9524a849bd16f9fa793e54f920cc6cf1227a8ec1 | [
"motif_info = Motif.objects.get(pk=kwargs['motif_pk'])\nmotifinfo_serializer = MotifDetailSerializers(motif_info)\ncomments = Comment.objects.all().filter(motif=motif_info)\ncommentlist_serializer = CommentDetailSerializers(comments, many=True)\ncontent = {'commentList': commentlist_serializer.data, 'motifInfo': mo... | <|body_start_0|>
motif_info = Motif.objects.get(pk=kwargs['motif_pk'])
motifinfo_serializer = MotifDetailSerializers(motif_info)
comments = Comment.objects.all().filter(motif=motif_info)
commentlist_serializer = CommentDetailSerializers(comments, many=True)
content = {'commentLis... | 댓글 조회 및 생성 | CommentListCreateView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CommentListCreateView:
"""댓글 조회 및 생성"""
def get(self, request, *args, **kwargs):
"""모티프 내의 댓글 목록 전체 조회"""
<|body_0|>
def post(self, request, *args, **kwargs):
"""댓글 생성"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
motif_info = Motif.objects.ge... | stack_v2_sparse_classes_36k_train_015285 | 4,124 | no_license | [
{
"docstring": "모티프 내의 댓글 목록 전체 조회",
"name": "get",
"signature": "def get(self, request, *args, **kwargs)"
},
{
"docstring": "댓글 생성",
"name": "post",
"signature": "def post(self, request, *args, **kwargs)"
}
] | 2 | stack_v2_sparse_classes_30k_train_001587 | Implement the Python class `CommentListCreateView` described below.
Class description:
댓글 조회 및 생성
Method signatures and docstrings:
- def get(self, request, *args, **kwargs): 모티프 내의 댓글 목록 전체 조회
- def post(self, request, *args, **kwargs): 댓글 생성 | Implement the Python class `CommentListCreateView` described below.
Class description:
댓글 조회 및 생성
Method signatures and docstrings:
- def get(self, request, *args, **kwargs): 모티프 내의 댓글 목록 전체 조회
- def post(self, request, *args, **kwargs): 댓글 생성
<|skeleton|>
class CommentListCreateView:
"""댓글 조회 및 생성"""
def g... | 4031afe1b5d45865a61f4ff4136a8314258a917a | <|skeleton|>
class CommentListCreateView:
"""댓글 조회 및 생성"""
def get(self, request, *args, **kwargs):
"""모티프 내의 댓글 목록 전체 조회"""
<|body_0|>
def post(self, request, *args, **kwargs):
"""댓글 생성"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CommentListCreateView:
"""댓글 조회 및 생성"""
def get(self, request, *args, **kwargs):
"""모티프 내의 댓글 목록 전체 조회"""
motif_info = Motif.objects.get(pk=kwargs['motif_pk'])
motifinfo_serializer = MotifDetailSerializers(motif_info)
comments = Comment.objects.all().filter(motif=motif_inf... | the_stack_v2_python_sparse | django_app/motif/apis/comment.py | Monaegi/Julia-WordyGallery | train | 1 |
5240dec7b2edccc5469aac443c6b7eec99a12d38 | [
"self.capacity = capacity\nself.size = 0\nself.data = {}\nself.head = Node(0, 0)\nself.tail = Node(0, 0)\nself.head.next = self.tail\nself.tail.prev = self.head",
"if key not in self.data:\n return -1\nnode = self.data[key]\nif node.prev != self.head:\n node.prev.next = node.next\n node.next.prev = node.... | <|body_start_0|>
self.capacity = capacity
self.size = 0
self.data = {}
self.head = Node(0, 0)
self.tail = Node(0, 0)
self.head.next = self.tail
self.tail.prev = self.head
<|end_body_0|>
<|body_start_1|>
if key not in self.data:
return -1
... | LRUCache | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LRUCache:
def __init__(self, capacity):
""":type capacity: int"""
<|body_0|>
def get(self, key):
""":type key: int :rtype: int"""
<|body_1|>
def put(self, key, value):
""":type key: int :type value: int :rtype: None"""
<|body_2|>
<|end_s... | stack_v2_sparse_classes_36k_train_015286 | 1,868 | no_license | [
{
"docstring": ":type capacity: int",
"name": "__init__",
"signature": "def __init__(self, capacity)"
},
{
"docstring": ":type key: int :rtype: int",
"name": "get",
"signature": "def get(self, key)"
},
{
"docstring": ":type key: int :type value: int :rtype: None",
"name": "pu... | 3 | null | Implement the Python class `LRUCache` described below.
Class description:
Implement the LRUCache class.
Method signatures and docstrings:
- def __init__(self, capacity): :type capacity: int
- def get(self, key): :type key: int :rtype: int
- def put(self, key, value): :type key: int :type value: int :rtype: None | Implement the Python class `LRUCache` described below.
Class description:
Implement the LRUCache class.
Method signatures and docstrings:
- def __init__(self, capacity): :type capacity: int
- def get(self, key): :type key: int :rtype: int
- def put(self, key, value): :type key: int :type value: int :rtype: None
<|sk... | d2cbd0aabff2f0b617d34a59b62771f6764adf95 | <|skeleton|>
class LRUCache:
def __init__(self, capacity):
""":type capacity: int"""
<|body_0|>
def get(self, key):
""":type key: int :rtype: int"""
<|body_1|>
def put(self, key, value):
""":type key: int :type value: int :rtype: None"""
<|body_2|>
<|end_s... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LRUCache:
def __init__(self, capacity):
""":type capacity: int"""
self.capacity = capacity
self.size = 0
self.data = {}
self.head = Node(0, 0)
self.tail = Node(0, 0)
self.head.next = self.tail
self.tail.prev = self.head
def get(self, key):
... | the_stack_v2_python_sparse | 146.lru缓存机制.py | ChenghaoZHU/LeetCode | train | 0 | |
b40eb1adc242a7c9c1d2161ab713b7a1ebe15df4 | [
"super(DurationPredictorLoss, self).__init__()\nself.criterion = torch.nn.MSELoss(reduction=reduction)\nself.offset = offset",
"targets = torch.log(targets.float() + self.offset)\nloss = self.criterion(outputs, targets)\nreturn loss"
] | <|body_start_0|>
super(DurationPredictorLoss, self).__init__()
self.criterion = torch.nn.MSELoss(reduction=reduction)
self.offset = offset
<|end_body_0|>
<|body_start_1|>
targets = torch.log(targets.float() + self.offset)
loss = self.criterion(outputs, targets)
return lo... | Loss function module for duration predictor. The loss value is Calculated in log domain to make it Gaussian. | DurationPredictorLoss | [
"MIT",
"LicenseRef-scancode-proprietary-license",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DurationPredictorLoss:
"""Loss function module for duration predictor. The loss value is Calculated in log domain to make it Gaussian."""
def __init__(self, offset=1.0, reduction='mean'):
"""Initilize duration predictor loss module. Args: offset (float, optional): Offset value to avo... | stack_v2_sparse_classes_36k_train_015287 | 1,534 | permissive | [
{
"docstring": "Initilize duration predictor loss module. Args: offset (float, optional): Offset value to avoid nan in log domain. reduction (str): Reduction type in loss calculation.",
"name": "__init__",
"signature": "def __init__(self, offset=1.0, reduction='mean')"
},
{
"docstring": "Calcula... | 2 | stack_v2_sparse_classes_30k_train_009030 | Implement the Python class `DurationPredictorLoss` described below.
Class description:
Loss function module for duration predictor. The loss value is Calculated in log domain to make it Gaussian.
Method signatures and docstrings:
- def __init__(self, offset=1.0, reduction='mean'): Initilize duration predictor loss mo... | Implement the Python class `DurationPredictorLoss` described below.
Class description:
Loss function module for duration predictor. The loss value is Calculated in log domain to make it Gaussian.
Method signatures and docstrings:
- def __init__(self, offset=1.0, reduction='mean'): Initilize duration predictor loss mo... | c68b4590ab20eaf55e0b96b82325a90177fffd5c | <|skeleton|>
class DurationPredictorLoss:
"""Loss function module for duration predictor. The loss value is Calculated in log domain to make it Gaussian."""
def __init__(self, offset=1.0, reduction='mean'):
"""Initilize duration predictor loss module. Args: offset (float, optional): Offset value to avo... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DurationPredictorLoss:
"""Loss function module for duration predictor. The loss value is Calculated in log domain to make it Gaussian."""
def __init__(self, offset=1.0, reduction='mean'):
"""Initilize duration predictor loss module. Args: offset (float, optional): Offset value to avoid nan in log... | the_stack_v2_python_sparse | parallel_wavegan/losses/duration_prediction_loss.py | kan-bayashi/ParallelWaveGAN | train | 1,405 |
abd774ea44d0bf47c1b823520135c0b05c05672d | [
"def serialize_branch(root):\n if root is None:\n serialized.append('$')\n else:\n serialized.append(root.val)\n serialize_branch(root.left)\n serialize_branch(root.right)\nserialized = []\nserialize_branch(root)\nreturn '|'.join(('$' if x is None else str(x) for x in serialized))"... | <|body_start_0|>
def serialize_branch(root):
if root is None:
serialized.append('$')
else:
serialized.append(root.val)
serialize_branch(root.left)
serialize_branch(root.right)
serialized = []
serialize_branch... | Codec | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|>
<|body_... | stack_v2_sparse_classes_36k_train_015288 | 1,454 | permissive | [
{
"docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str",
"name": "serialize",
"signature": "def serialize(self, root)"
},
{
"docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode",
"name": "deserialize",
"signature": "def deserializ... | 2 | stack_v2_sparse_classes_30k_train_013653 | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:... | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:... | ba84c192fb9995dd48ddc6d81c3153488dd3c698 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
def serialize_branch(root):
if root is None:
serialized.append('$')
else:
serialized.append(root.val)
serialize_br... | the_stack_v2_python_sparse | Python/serialize-and-deserialize-binary-tree.py | phucle2411/LeetCode | train | 0 | |
f05da35244090f1558fb2b45819531dd1e8f202b | [
"numerOfLists = len(lists)\ninterval = 1\nwhile interval < numerOfLists:\n for idx in range(0, numerOfLists - interval, interval * 2):\n lists[idx] = self.mergeTwoLists(lists[idx], lists[idx + interval])\n interval *= 2\nreturn lists[0] if numerOfLists > 0 else None",
"if not l1 or not l2:\n retur... | <|body_start_0|>
numerOfLists = len(lists)
interval = 1
while interval < numerOfLists:
for idx in range(0, numerOfLists - interval, interval * 2):
lists[idx] = self.mergeTwoLists(lists[idx], lists[idx + interval])
interval *= 2
return lists[0] if n... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def mergeKLists(self, lists):
""":type lists: List[ListNode] :rtype: ListNode"""
<|body_0|>
def mergeTwoLists(self, l1, l2):
""":type l1: ListNode :type l2: ListNode :rtype: ListNode"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
numerOfL... | stack_v2_sparse_classes_36k_train_015289 | 4,614 | permissive | [
{
"docstring": ":type lists: List[ListNode] :rtype: ListNode",
"name": "mergeKLists",
"signature": "def mergeKLists(self, lists)"
},
{
"docstring": ":type l1: ListNode :type l2: ListNode :rtype: ListNode",
"name": "mergeTwoLists",
"signature": "def mergeTwoLists(self, l1, l2)"
}
] | 2 | stack_v2_sparse_classes_30k_train_017796 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def mergeKLists(self, lists): :type lists: List[ListNode] :rtype: ListNode
- def mergeTwoLists(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def mergeKLists(self, lists): :type lists: List[ListNode] :rtype: ListNode
- def mergeTwoLists(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode
<|skeleton|>... | 20ae1a048eddbc9a32c819cf61258e2b57572f05 | <|skeleton|>
class Solution:
def mergeKLists(self, lists):
""":type lists: List[ListNode] :rtype: ListNode"""
<|body_0|>
def mergeTwoLists(self, l1, l2):
""":type l1: ListNode :type l2: ListNode :rtype: ListNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def mergeKLists(self, lists):
""":type lists: List[ListNode] :rtype: ListNode"""
numerOfLists = len(lists)
interval = 1
while interval < numerOfLists:
for idx in range(0, numerOfLists - interval, interval * 2):
lists[idx] = self.mergeTwoLis... | the_stack_v2_python_sparse | leetcode.com/python/23_Merge_k_Sorted_Lists.py | partho-maple/coding-interview-gym | train | 862 | |
a1ce9297e106296f06ebe0eea12a302008a4aa00 | [
"try:\n data = data_api.get_by_id(request.GET['id'], request.user)\n acl_api.check_can_write(data, request.user)\n if main_file_utils.get_byte_size_from_string(data.xml_content) > MAX_DOCUMENT_EDITING_SIZE:\n raise exceptions.DocumentEditingSizeError('The file is too large (MAX_DOCUMENT_EDITING_SIZE... | <|body_start_0|>
try:
data = data_api.get_by_id(request.GET['id'], request.user)
acl_api.check_can_write(data, request.user)
if main_file_utils.get_byte_size_from_string(data.xml_content) > MAX_DOCUMENT_EDITING_SIZE:
raise exceptions.DocumentEditingSizeError('... | Data Content Editor View | DataContentEditor | [
"NIST-Software"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DataContentEditor:
"""Data Content Editor View"""
def get(self, request):
"""get Args: request Returns:"""
<|body_0|>
def save(self, *args, **kwargs):
"""Save xml content Args: args: kwargs: Returns:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_36k_train_015290 | 35,208 | permissive | [
{
"docstring": "get Args: request Returns:",
"name": "get",
"signature": "def get(self, request)"
},
{
"docstring": "Save xml content Args: args: kwargs: Returns:",
"name": "save",
"signature": "def save(self, *args, **kwargs)"
}
] | 2 | null | Implement the Python class `DataContentEditor` described below.
Class description:
Data Content Editor View
Method signatures and docstrings:
- def get(self, request): get Args: request Returns:
- def save(self, *args, **kwargs): Save xml content Args: args: kwargs: Returns: | Implement the Python class `DataContentEditor` described below.
Class description:
Data Content Editor View
Method signatures and docstrings:
- def get(self, request): get Args: request Returns:
- def save(self, *args, **kwargs): Save xml content Args: args: kwargs: Returns:
<|skeleton|>
class DataContentEditor:
... | f032036d95076f92b164389fdbec7415567e7b0f | <|skeleton|>
class DataContentEditor:
"""Data Content Editor View"""
def get(self, request):
"""get Args: request Returns:"""
<|body_0|>
def save(self, *args, **kwargs):
"""Save xml content Args: args: kwargs: Returns:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DataContentEditor:
"""Data Content Editor View"""
def get(self, request):
"""get Args: request Returns:"""
try:
data = data_api.get_by_id(request.GET['id'], request.user)
acl_api.check_can_write(data, request.user)
if main_file_utils.get_byte_size_from_... | the_stack_v2_python_sparse | core_main_app/views/common/views.py | usnistgov/core_main_app | train | 3 |
19860c6c8552c1729d17ab35b81dd6368be052c8 | [
"super(NeuralNet, self).__init__()\nself.input_dims = input_dims\nself.n_neurons = n_neurons\nself.n_layers = n_layers\nself.in_layer = nn.Linear(self.input_dims, self.n_neurons)\nself.dense = nn.Linear(self.n_neurons, self.n_neurons)\nself.activation = activation\nself.batchnorm = nn.BatchNorm1d(self.n_neurons)\ns... | <|body_start_0|>
super(NeuralNet, self).__init__()
self.input_dims = input_dims
self.n_neurons = n_neurons
self.n_layers = n_layers
self.in_layer = nn.Linear(self.input_dims, self.n_neurons)
self.dense = nn.Linear(self.n_neurons, self.n_neurons)
self.activation = ... | Neural Network class. | NeuralNet | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NeuralNet:
"""Neural Network class."""
def __init__(self, input_dims=input_dims, n_layers=1, n_neurons=209, activation=nn.ReLU()):
"""Initialize as subclass of nn.Module, inherit its methods."""
<|body_0|>
def forward(self, x):
"""Forward pass."""
<|body_... | stack_v2_sparse_classes_36k_train_015291 | 20,816 | no_license | [
{
"docstring": "Initialize as subclass of nn.Module, inherit its methods.",
"name": "__init__",
"signature": "def __init__(self, input_dims=input_dims, n_layers=1, n_neurons=209, activation=nn.ReLU())"
},
{
"docstring": "Forward pass.",
"name": "forward",
"signature": "def forward(self, ... | 2 | stack_v2_sparse_classes_30k_train_020975 | Implement the Python class `NeuralNet` described below.
Class description:
Neural Network class.
Method signatures and docstrings:
- def __init__(self, input_dims=input_dims, n_layers=1, n_neurons=209, activation=nn.ReLU()): Initialize as subclass of nn.Module, inherit its methods.
- def forward(self, x): Forward pas... | Implement the Python class `NeuralNet` described below.
Class description:
Neural Network class.
Method signatures and docstrings:
- def __init__(self, input_dims=input_dims, n_layers=1, n_neurons=209, activation=nn.ReLU()): Initialize as subclass of nn.Module, inherit its methods.
- def forward(self, x): Forward pas... | 5152faf59c38c4b168a1dc9639fa8d13c16a91cd | <|skeleton|>
class NeuralNet:
"""Neural Network class."""
def __init__(self, input_dims=input_dims, n_layers=1, n_neurons=209, activation=nn.ReLU()):
"""Initialize as subclass of nn.Module, inherit its methods."""
<|body_0|>
def forward(self, x):
"""Forward pass."""
<|body_... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NeuralNet:
"""Neural Network class."""
def __init__(self, input_dims=input_dims, n_layers=1, n_neurons=209, activation=nn.ReLU()):
"""Initialize as subclass of nn.Module, inherit its methods."""
super(NeuralNet, self).__init__()
self.input_dims = input_dims
self.n_neurons ... | the_stack_v2_python_sparse | mlp_interactive.py | ppiont/cnn-soc-wagga | train | 0 |
02e059cf0d98f794d181458bfc60acc71721c38a | [
"assert isinstance(entityCount, int)\nassert entityCount >= 2\nself.entityCount = entityCount\nassert acceptedEntityTypes is None or isinstance(acceptedEntityTypes, list)\nif acceptedEntityTypes is None:\n self.acceptedEntityTypes = None\nelse:\n for acceptedEntityType in acceptedEntityTypes:\n assert ... | <|body_start_0|>
assert isinstance(entityCount, int)
assert entityCount >= 2
self.entityCount = entityCount
assert acceptedEntityTypes is None or isinstance(acceptedEntityTypes, list)
if acceptedEntityTypes is None:
self.acceptedEntityTypes = None
else:
... | Generates set of all possible relations in corpus. :ivar entityCount: Number of entities in each relation (default=2) :ivar acceptedEntityTypes: Tuples of entities that candidate relations must match. Each entity should be the same length as entityCount. None will match all candidate relations. | CandidateBuilder | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CandidateBuilder:
"""Generates set of all possible relations in corpus. :ivar entityCount: Number of entities in each relation (default=2) :ivar acceptedEntityTypes: Tuples of entities that candidate relations must match. Each entity should be the same length as entityCount. None will match all c... | stack_v2_sparse_classes_36k_train_015292 | 2,967 | permissive | [
{
"docstring": "Constructor :param entityCount: Number of entities in each relation (default=2) :param acceptedEntityTypes: Tuples of entities that candidate relations must match. Each entity should be the same length as entityCount. None will match all candidate relations. :type entityCount: int :type accepted... | 2 | stack_v2_sparse_classes_30k_train_000046 | Implement the Python class `CandidateBuilder` described below.
Class description:
Generates set of all possible relations in corpus. :ivar entityCount: Number of entities in each relation (default=2) :ivar acceptedEntityTypes: Tuples of entities that candidate relations must match. Each entity should be the same lengt... | Implement the Python class `CandidateBuilder` described below.
Class description:
Generates set of all possible relations in corpus. :ivar entityCount: Number of entities in each relation (default=2) :ivar acceptedEntityTypes: Tuples of entities that candidate relations must match. Each entity should be the same lengt... | b6eac60fa40086b4c44e98e0baa34b760310d284 | <|skeleton|>
class CandidateBuilder:
"""Generates set of all possible relations in corpus. :ivar entityCount: Number of entities in each relation (default=2) :ivar acceptedEntityTypes: Tuples of entities that candidate relations must match. Each entity should be the same length as entityCount. None will match all c... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CandidateBuilder:
"""Generates set of all possible relations in corpus. :ivar entityCount: Number of entities in each relation (default=2) :ivar acceptedEntityTypes: Tuples of entities that candidate relations must match. Each entity should be the same length as entityCount. None will match all candidate rela... | the_stack_v2_python_sparse | kindred/CandidateBuilder.py | jakelever/kindred | train | 158 |
9c20bad68cc6c3e8b2a65bfe61b3ce37f8e03dc2 | [
"if analysis_name_list is None or analysis_params_list is None:\n print('Both analysis_name_list and analysis_params_list must be entered.')\n return\nif len(analysis_name_list) != len(analysis_params_list):\n print('Both analysis_name_list and analysis_params_list must be the same length.')\n return\ns... | <|body_start_0|>
if analysis_name_list is None or analysis_params_list is None:
print('Both analysis_name_list and analysis_params_list must be entered.')
return
if len(analysis_name_list) != len(analysis_params_list):
print('Both analysis_name_list and analysis_param... | Class to run multiple analyses on all subjects. | GroupAnalysisPipeline | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GroupAnalysisPipeline:
"""Class to run multiple analyses on all subjects."""
def __init__(self, analysis_name_list=[], analysis_params_list=[], log_dir=None, open_pool=False, n_jobs=20, G_per_job=12, subject_montage=None, task=None):
"""Parameters ---------- analysis_name_list: list ... | stack_v2_sparse_classes_36k_train_015293 | 12,431 | no_license | [
{
"docstring": "Parameters ---------- analysis_name_list: list of strings List of analysis names to run. They should be the name of a SubjectLevel analysis class. analysis_params_list: list of dictionaries List of dictionaries of attributes to set for each analysis log_dir: str Where to write the log file. If n... | 3 | stack_v2_sparse_classes_30k_train_011951 | Implement the Python class `GroupAnalysisPipeline` described below.
Class description:
Class to run multiple analyses on all subjects.
Method signatures and docstrings:
- def __init__(self, analysis_name_list=[], analysis_params_list=[], log_dir=None, open_pool=False, n_jobs=20, G_per_job=12, subject_montage=None, ta... | Implement the Python class `GroupAnalysisPipeline` described below.
Class description:
Class to run multiple analyses on all subjects.
Method signatures and docstrings:
- def __init__(self, analysis_name_list=[], analysis_params_list=[], log_dir=None, open_pool=False, n_jobs=20, G_per_job=12, subject_montage=None, ta... | a2b7cd2b9c8ff311fd2d60916acd1959e3b07306 | <|skeleton|>
class GroupAnalysisPipeline:
"""Class to run multiple analyses on all subjects."""
def __init__(self, analysis_name_list=[], analysis_params_list=[], log_dir=None, open_pool=False, n_jobs=20, G_per_job=12, subject_montage=None, task=None):
"""Parameters ---------- analysis_name_list: list ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GroupAnalysisPipeline:
"""Class to run multiple analyses on all subjects."""
def __init__(self, analysis_name_list=[], analysis_params_list=[], log_dir=None, open_pool=False, n_jobs=20, G_per_job=12, subject_montage=None, task=None):
"""Parameters ---------- analysis_name_list: list of strings Li... | the_stack_v2_python_sparse | miller_ecog_tools/GroupLevel/group.py | jayfmil/miller_ecog_tools | train | 4 |
cfde457675af576c03951a39725249b17164802d | [
"vel_x = set_up_xy_velocity_cube('advection_velocity_x')\nvel_y = vel_x.copy(data=2.0 * np.ones(shape=(4, 3)))\nself.dummy_plugin = AdvectField(vel_x, vel_y)\nself.data = np.array([[2.0, 3.0, 4.0], [1.0, 2.0, 3.0], [0.0, 1.0, 2.0], [0.0, 0.0, 1.0]])\nself.xgrid, self.ygrid = np.meshgrid(np.arange(3), np.arange(4))"... | <|body_start_0|>
vel_x = set_up_xy_velocity_cube('advection_velocity_x')
vel_y = vel_x.copy(data=2.0 * np.ones(shape=(4, 3)))
self.dummy_plugin = AdvectField(vel_x, vel_y)
self.data = np.array([[2.0, 3.0, 4.0], [1.0, 2.0, 3.0], [0.0, 1.0, 2.0], [0.0, 0.0, 1.0]])
self.xgrid, self.... | Tests for the _increment_output_array method | Test__increment_output_array | [
"BSD-3-Clause",
"LicenseRef-scancode-proprietary-license"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Test__increment_output_array:
"""Tests for the _increment_output_array method"""
def setUp(self):
"""Create input arrays"""
<|body_0|>
def test_basic(self):
"""Test one increment from the points negative x-wards and positive y-wards on the source grid, with diffe... | stack_v2_sparse_classes_36k_train_015294 | 22,262 | permissive | [
{
"docstring": "Create input arrays",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "Test one increment from the points negative x-wards and positive y-wards on the source grid, with different directional weightings",
"name": "test_basic",
"signature": "def test_basic... | 2 | stack_v2_sparse_classes_30k_train_014869 | Implement the Python class `Test__increment_output_array` described below.
Class description:
Tests for the _increment_output_array method
Method signatures and docstrings:
- def setUp(self): Create input arrays
- def test_basic(self): Test one increment from the points negative x-wards and positive y-wards on the so... | Implement the Python class `Test__increment_output_array` described below.
Class description:
Tests for the _increment_output_array method
Method signatures and docstrings:
- def setUp(self): Create input arrays
- def test_basic(self): Test one increment from the points negative x-wards and positive y-wards on the so... | cd2c9019944345df1e703bf8f625db537ad9f559 | <|skeleton|>
class Test__increment_output_array:
"""Tests for the _increment_output_array method"""
def setUp(self):
"""Create input arrays"""
<|body_0|>
def test_basic(self):
"""Test one increment from the points negative x-wards and positive y-wards on the source grid, with diffe... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Test__increment_output_array:
"""Tests for the _increment_output_array method"""
def setUp(self):
"""Create input arrays"""
vel_x = set_up_xy_velocity_cube('advection_velocity_x')
vel_y = vel_x.copy(data=2.0 * np.ones(shape=(4, 3)))
self.dummy_plugin = AdvectField(vel_x, v... | the_stack_v2_python_sparse | improver_tests/nowcasting/forecasting/test_AdvectField.py | metoppv/improver | train | 101 |
09a1b6c560f856e1d686ae30b19f01eb21edce10 | [
"start = self.startPixmap()\nend = self.endPixmap()\npainter = QPainter(self.outPixmap())\npainter.drawPixmap(0, 0, start)\nsize = start.size().expandedTo(end.size())\nwidth = size.width()\nheight = size.height()\nradius = int((width ** 2 + height ** 2) ** 0.5) / 2\nstart_rect = QRect(width / 2, height / 2, 0, 0)\n... | <|body_start_0|>
start = self.startPixmap()
end = self.endPixmap()
painter = QPainter(self.outPixmap())
painter.drawPixmap(0, 0, start)
size = start.size().expandedTo(end.size())
width = size.width()
height = size.height()
radius = int((width ** 2 + height... | A QPixmap transition which animates using an iris effect. | QIrisTransition | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class QIrisTransition:
"""A QPixmap transition which animates using an iris effect."""
def preparePixmap(self):
"""Prepare the pixmap(s) for the transition. This method draws the starting pixmap into the output pixmap. The transition update then sets a circular clipping region on the ouput... | stack_v2_sparse_classes_36k_train_015295 | 14,565 | permissive | [
{
"docstring": "Prepare the pixmap(s) for the transition. This method draws the starting pixmap into the output pixmap. The transition update then sets a circular clipping region on the ouput and draws in the ending pixmap.",
"name": "preparePixmap",
"signature": "def preparePixmap(self)"
},
{
"... | 2 | stack_v2_sparse_classes_30k_test_000230 | Implement the Python class `QIrisTransition` described below.
Class description:
A QPixmap transition which animates using an iris effect.
Method signatures and docstrings:
- def preparePixmap(self): Prepare the pixmap(s) for the transition. This method draws the starting pixmap into the output pixmap. The transition... | Implement the Python class `QIrisTransition` described below.
Class description:
A QPixmap transition which animates using an iris effect.
Method signatures and docstrings:
- def preparePixmap(self): Prepare the pixmap(s) for the transition. This method draws the starting pixmap into the output pixmap. The transition... | 1544e7fb371b8f941cfa2fde682795e479380284 | <|skeleton|>
class QIrisTransition:
"""A QPixmap transition which animates using an iris effect."""
def preparePixmap(self):
"""Prepare the pixmap(s) for the transition. This method draws the starting pixmap into the output pixmap. The transition update then sets a circular clipping region on the ouput... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class QIrisTransition:
"""A QPixmap transition which animates using an iris effect."""
def preparePixmap(self):
"""Prepare the pixmap(s) for the transition. This method draws the starting pixmap into the output pixmap. The transition update then sets a circular clipping region on the ouput and draws in... | the_stack_v2_python_sparse | enaml/qt/q_pixmap_transition.py | MatthieuDartiailh/enaml | train | 26 |
decfd7ec78ab4e5082a1b1d29fa2585ce8da4bb1 | [
"domain = domains.FixedLengthDiscreteDomain(vocab=domains.Vocabulary(tokens=range(3), include_bos=True), length=2)\ntrain_data = np.array([[0, 1], [1, 0]])\ntrain_ds = tf.data.Dataset.from_tensor_slices((train_data,))\neb = evaluation.EmpiricalBaseline(domain, train_ds, alpha=0)\nself.assertAllEqual(eb._empirical_d... | <|body_start_0|>
domain = domains.FixedLengthDiscreteDomain(vocab=domains.Vocabulary(tokens=range(3), include_bos=True), length=2)
train_data = np.array([[0, 1], [1, 0]])
train_ds = tf.data.Dataset.from_tensor_slices((train_data,))
eb = evaluation.EmpiricalBaseline(domain, train_ds, alph... | EvaluationTest | [
"Apache-2.0",
"CC-BY-4.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EvaluationTest:
def test_empirical_baseline_construction(self):
"""Tests that EmpiricalBaseline construction is correct."""
<|body_0|>
def test_empirical_baseline_evaluation(self):
"""Tests that EmpiricalBaseline evaluation is correct."""
<|body_1|>
def ... | stack_v2_sparse_classes_36k_train_015296 | 2,681 | permissive | [
{
"docstring": "Tests that EmpiricalBaseline construction is correct.",
"name": "test_empirical_baseline_construction",
"signature": "def test_empirical_baseline_construction(self)"
},
{
"docstring": "Tests that EmpiricalBaseline evaluation is correct.",
"name": "test_empirical_baseline_eval... | 3 | stack_v2_sparse_classes_30k_train_015428 | Implement the Python class `EvaluationTest` described below.
Class description:
Implement the EvaluationTest class.
Method signatures and docstrings:
- def test_empirical_baseline_construction(self): Tests that EmpiricalBaseline construction is correct.
- def test_empirical_baseline_evaluation(self): Tests that Empir... | Implement the Python class `EvaluationTest` described below.
Class description:
Implement the EvaluationTest class.
Method signatures and docstrings:
- def test_empirical_baseline_construction(self): Tests that EmpiricalBaseline construction is correct.
- def test_empirical_baseline_evaluation(self): Tests that Empir... | 5573d9c5822f4e866b6692769963ae819cb3f10d | <|skeleton|>
class EvaluationTest:
def test_empirical_baseline_construction(self):
"""Tests that EmpiricalBaseline construction is correct."""
<|body_0|>
def test_empirical_baseline_evaluation(self):
"""Tests that EmpiricalBaseline evaluation is correct."""
<|body_1|>
def ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class EvaluationTest:
def test_empirical_baseline_construction(self):
"""Tests that EmpiricalBaseline construction is correct."""
domain = domains.FixedLengthDiscreteDomain(vocab=domains.Vocabulary(tokens=range(3), include_bos=True), length=2)
train_data = np.array([[0, 1], [1, 0]])
... | the_stack_v2_python_sparse | protein_lm/evaluation_test.py | Jimmy-INL/google-research | train | 1 | |
905df4965861db4750a6be225777006021e4f720 | [
"ir_file = self.create_tempfile(content=NOT_ADD_IR)\noptimized_ir = subprocess.check_output([DELAY_INFO_MAIN_PATH, '--delay_model=unit', ir_file.full_path]).decode('utf-8')\nself.assertEqual(optimized_ir, '# Critical path:\\n 2ps (+ 1ps): not_sum: bits[32] = not(sum: bits[32], id=4)\\n 1ps (+ 1ps): sum:... | <|body_start_0|>
ir_file = self.create_tempfile(content=NOT_ADD_IR)
optimized_ir = subprocess.check_output([DELAY_INFO_MAIN_PATH, '--delay_model=unit', ir_file.full_path]).decode('utf-8')
self.assertEqual(optimized_ir, '# Critical path:\n 2ps (+ 1ps): not_sum: bits[32] = not(sum: bits[32],... | DelayInfoMainTest | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DelayInfoMainTest:
def test_without_schedule(self):
"""Test tool without specifying --schedule_path."""
<|body_0|>
def test_with_schedule(self):
"""Test tool with specifying --schedule_path."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
ir_file = ... | stack_v2_sparse_classes_36k_train_015297 | 2,957 | permissive | [
{
"docstring": "Test tool without specifying --schedule_path.",
"name": "test_without_schedule",
"signature": "def test_without_schedule(self)"
},
{
"docstring": "Test tool with specifying --schedule_path.",
"name": "test_with_schedule",
"signature": "def test_with_schedule(self)"
}
] | 2 | null | Implement the Python class `DelayInfoMainTest` described below.
Class description:
Implement the DelayInfoMainTest class.
Method signatures and docstrings:
- def test_without_schedule(self): Test tool without specifying --schedule_path.
- def test_with_schedule(self): Test tool with specifying --schedule_path. | Implement the Python class `DelayInfoMainTest` described below.
Class description:
Implement the DelayInfoMainTest class.
Method signatures and docstrings:
- def test_without_schedule(self): Test tool without specifying --schedule_path.
- def test_with_schedule(self): Test tool with specifying --schedule_path.
<|ske... | c2f3c725a9b54802119173a82412dc7a0bdf5a2e | <|skeleton|>
class DelayInfoMainTest:
def test_without_schedule(self):
"""Test tool without specifying --schedule_path."""
<|body_0|>
def test_with_schedule(self):
"""Test tool with specifying --schedule_path."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DelayInfoMainTest:
def test_without_schedule(self):
"""Test tool without specifying --schedule_path."""
ir_file = self.create_tempfile(content=NOT_ADD_IR)
optimized_ir = subprocess.check_output([DELAY_INFO_MAIN_PATH, '--delay_model=unit', ir_file.full_path]).decode('utf-8')
sel... | the_stack_v2_python_sparse | xls/tools/delay_info_main_test.py | google/xls | train | 1,003 | |
46f0c064e6b0835db6c3066df3a2c9741df4bacf | [
"ctx.ss = spatial_sigma\nctx.cs = color_sigma\nctx.fa = fast_approx\noutput_data = _C.bilateral_filter(input, spatial_sigma, color_sigma, fast_approx)\nreturn output_data",
"spatial_sigma, color_sigma, fast_approx = (ctx.ss, ctx.cs, ctx.fa)\ngrad_input = _C.bilateral_filter(grad_output, spatial_sigma, color_sigma... | <|body_start_0|>
ctx.ss = spatial_sigma
ctx.cs = color_sigma
ctx.fa = fast_approx
output_data = _C.bilateral_filter(input, spatial_sigma, color_sigma, fast_approx)
return output_data
<|end_body_0|>
<|body_start_1|>
spatial_sigma, color_sigma, fast_approx = (ctx.ss, ctx.c... | Blurs the input tensor spatially whilst preserving edges. Can run on 1D, 2D, or 3D, tensors (on top of Batch and Channel dimensions). Two implementations are provided, an exact solution and a much faster approximation which uses a permutohedral lattice. See: https://en.wikipedia.org/wiki/Bilateral_filter https://graphi... | BilateralFilter | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BilateralFilter:
"""Blurs the input tensor spatially whilst preserving edges. Can run on 1D, 2D, or 3D, tensors (on top of Batch and Channel dimensions). Two implementations are provided, an exact solution and a much faster approximation which uses a permutohedral lattice. See: https://en.wikiped... | stack_v2_sparse_classes_36k_train_015298 | 17,992 | permissive | [
{
"docstring": "autograd forward",
"name": "forward",
"signature": "def forward(ctx, input, spatial_sigma=5, color_sigma=0.5, fast_approx=True)"
},
{
"docstring": "autograd backward",
"name": "backward",
"signature": "def backward(ctx, grad_output)"
}
] | 2 | null | Implement the Python class `BilateralFilter` described below.
Class description:
Blurs the input tensor spatially whilst preserving edges. Can run on 1D, 2D, or 3D, tensors (on top of Batch and Channel dimensions). Two implementations are provided, an exact solution and a much faster approximation which uses a permuto... | Implement the Python class `BilateralFilter` described below.
Class description:
Blurs the input tensor spatially whilst preserving edges. Can run on 1D, 2D, or 3D, tensors (on top of Batch and Channel dimensions). Two implementations are provided, an exact solution and a much faster approximation which uses a permuto... | e48c3e2c741fa3fc705c4425d17ac4a5afac6c47 | <|skeleton|>
class BilateralFilter:
"""Blurs the input tensor spatially whilst preserving edges. Can run on 1D, 2D, or 3D, tensors (on top of Batch and Channel dimensions). Two implementations are provided, an exact solution and a much faster approximation which uses a permutohedral lattice. See: https://en.wikiped... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BilateralFilter:
"""Blurs the input tensor spatially whilst preserving edges. Can run on 1D, 2D, or 3D, tensors (on top of Batch and Channel dimensions). Two implementations are provided, an exact solution and a much faster approximation which uses a permutohedral lattice. See: https://en.wikipedia.org/wiki/B... | the_stack_v2_python_sparse | monai/networks/layers/filtering.py | Project-MONAI/MONAI | train | 4,805 |
bcf2858f3ccd39f02370d1d192053063974b9626 | [
"self.enabled = enabled\nself.monday = monday\nself.tuesday = tuesday\nself.wednesday = wednesday\nself.thursday = thursday\nself.friday = friday\nself.saturday = saturday\nself.sunday = sunday",
"if dictionary is None:\n return None\nenabled = dictionary.get('enabled')\nmonday = meraki_sdk.models.monday_model... | <|body_start_0|>
self.enabled = enabled
self.monday = monday
self.tuesday = tuesday
self.wednesday = wednesday
self.thursday = thursday
self.friday = friday
self.saturday = saturday
self.sunday = sunday
<|end_body_0|>
<|body_start_1|>
if dictionar... | Implementation of the 'Scheduling' model. The schedule for the group policy. Schedules are applied to days of the week. Attributes: enabled (bool): Whether scheduling is enabled (true) or disabled (false). Defaults to false. If true, the schedule objects for each day of the week (monday - sunday) are parsed. monday (Mo... | SchedulingModel | [
"MIT",
"Python-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SchedulingModel:
"""Implementation of the 'Scheduling' model. The schedule for the group policy. Schedules are applied to days of the week. Attributes: enabled (bool): Whether scheduling is enabled (true) or disabled (false). Defaults to false. If true, the schedule objects for each day of the we... | stack_v2_sparse_classes_36k_train_015299 | 4,253 | permissive | [
{
"docstring": "Constructor for the SchedulingModel class",
"name": "__init__",
"signature": "def __init__(self, enabled=None, monday=None, tuesday=None, wednesday=None, thursday=None, friday=None, saturday=None, sunday=None)"
},
{
"docstring": "Creates an instance of this model from a dictionar... | 2 | null | Implement the Python class `SchedulingModel` described below.
Class description:
Implementation of the 'Scheduling' model. The schedule for the group policy. Schedules are applied to days of the week. Attributes: enabled (bool): Whether scheduling is enabled (true) or disabled (false). Defaults to false. If true, the ... | Implement the Python class `SchedulingModel` described below.
Class description:
Implementation of the 'Scheduling' model. The schedule for the group policy. Schedules are applied to days of the week. Attributes: enabled (bool): Whether scheduling is enabled (true) or disabled (false). Defaults to false. If true, the ... | 9894089eb013318243ae48869cc5130eb37f80c0 | <|skeleton|>
class SchedulingModel:
"""Implementation of the 'Scheduling' model. The schedule for the group policy. Schedules are applied to days of the week. Attributes: enabled (bool): Whether scheduling is enabled (true) or disabled (false). Defaults to false. If true, the schedule objects for each day of the we... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SchedulingModel:
"""Implementation of the 'Scheduling' model. The schedule for the group policy. Schedules are applied to days of the week. Attributes: enabled (bool): Whether scheduling is enabled (true) or disabled (false). Defaults to false. If true, the schedule objects for each day of the week (monday - ... | the_stack_v2_python_sparse | meraki_sdk/models/scheduling_model.py | RaulCatalano/meraki-python-sdk | train | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.