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
f3006ab0a4c9e06489cc4024d6b5e5c7145e9ed0
[ "self.pred = pred\nself.target = target\nself.is_higher_better = is_higher_better\nself.supported_metrics = {'precision': 0, 'recall': 1, 'mrr': 2, 'map': 3, 'ndcg': 4}\nassert len(pred) == len(target), f'The prediction and groudtruth target should have the same number of queries, while there are {len(pred)...
<|body_start_0|> self.pred = pred self.target = target self.is_higher_better = is_higher_better self.supported_metrics = {'precision': 0, 'recall': 1, 'mrr': 2, 'map': 3, 'ndcg': 4} assert len(pred) == len(target), f'The prediction and groudtruth target should have the same numbe...
RankingMetrics
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RankingMetrics: def __init__(self, pred: Dict[str, Dict], target: Dict[str, Dict], is_higher_better=True): """Evaluation Metrics for information retrieval tasks such as document retrieval, image retrieval, etc. Reference: https://www.cs.cornell.edu/courses/cs4300/2013fa/lectures/metrics-...
stack_v2_sparse_classes_36k_train_029800
13,643
permissive
[ { "docstring": "Evaluation Metrics for information retrieval tasks such as document retrieval, image retrieval, etc. Reference: https://www.cs.cornell.edu/courses/cs4300/2013fa/lectures/metrics-2-4pp.pdf Parameters ---------- pred: the prediction of the ranking model. It has the following form. pred = { 'q1': {...
3
null
Implement the Python class `RankingMetrics` described below. Class description: Implement the RankingMetrics class. Method signatures and docstrings: - def __init__(self, pred: Dict[str, Dict], target: Dict[str, Dict], is_higher_better=True): Evaluation Metrics for information retrieval tasks such as document retriev...
Implement the Python class `RankingMetrics` described below. Class description: Implement the RankingMetrics class. Method signatures and docstrings: - def __init__(self, pred: Dict[str, Dict], target: Dict[str, Dict], is_higher_better=True): Evaluation Metrics for information retrieval tasks such as document retriev...
6af92e149491f6e5062495d87306b3625d12d992
<|skeleton|> class RankingMetrics: def __init__(self, pred: Dict[str, Dict], target: Dict[str, Dict], is_higher_better=True): """Evaluation Metrics for information retrieval tasks such as document retrieval, image retrieval, etc. Reference: https://www.cs.cornell.edu/courses/cs4300/2013fa/lectures/metrics-...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RankingMetrics: def __init__(self, pred: Dict[str, Dict], target: Dict[str, Dict], is_higher_better=True): """Evaluation Metrics for information retrieval tasks such as document retrieval, image retrieval, etc. Reference: https://www.cs.cornell.edu/courses/cs4300/2013fa/lectures/metrics-2-4pp.pdf Para...
the_stack_v2_python_sparse
multimodal/src/autogluon/multimodal/utils/metric.py
stjordanis/autogluon
train
0
ac4508c030d3171ba2e3d9f2fc57d133f39a0ae2
[ "self.submodules: Optional[GitSubmodules] = yaml.get('submodules', None)\nself.lfs: Optional[bool] = yaml.get('lfs', None)\nself.depth: Optional[int] = yaml.get('depth', None)\nself.config: Optional[GitConfig] = yaml.get('config', None)", "yaml = {}\nif self.submodules is not None:\n yaml['submodules'] = self....
<|body_start_0|> self.submodules: Optional[GitSubmodules] = yaml.get('submodules', None) self.lfs: Optional[bool] = yaml.get('lfs', None) self.depth: Optional[int] = yaml.get('depth', None) self.config: Optional[GitConfig] = yaml.get('config', None) <|end_body_0|> <|body_start_1|> ...
clowder yaml GitSettings model class :ivar Optional[bool] submodules: Whether to fetch submodules :ivar Optional[bool] lfs: Whether to set up lfs hooks and pull files :ivar Optional[int] depth: Depth to clone git repositories :ivar Optional[GitConfig] config: Custom git config values to set
GitSettings
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GitSettings: """clowder yaml GitSettings model class :ivar Optional[bool] submodules: Whether to fetch submodules :ivar Optional[bool] lfs: Whether to set up lfs hooks and pull files :ivar Optional[int] depth: Depth to clone git repositories :ivar Optional[GitConfig] config: Custom git config val...
stack_v2_sparse_classes_36k_train_029801
1,480
permissive
[ { "docstring": "Source __init__ :param dict yaml: Parsed YAML python object for GitSettings", "name": "__init__", "signature": "def __init__(self, yaml: dict)" }, { "docstring": "Return python object representation for saving yaml :return: YAML python object", "name": "get_yaml", "signat...
2
null
Implement the Python class `GitSettings` described below. Class description: clowder yaml GitSettings model class :ivar Optional[bool] submodules: Whether to fetch submodules :ivar Optional[bool] lfs: Whether to set up lfs hooks and pull files :ivar Optional[int] depth: Depth to clone git repositories :ivar Optional[G...
Implement the Python class `GitSettings` described below. Class description: clowder yaml GitSettings model class :ivar Optional[bool] submodules: Whether to fetch submodules :ivar Optional[bool] lfs: Whether to set up lfs hooks and pull files :ivar Optional[int] depth: Depth to clone git repositories :ivar Optional[G...
1438fc8b1bb7379de66142ffcb0e20b459b59159
<|skeleton|> class GitSettings: """clowder yaml GitSettings model class :ivar Optional[bool] submodules: Whether to fetch submodules :ivar Optional[bool] lfs: Whether to set up lfs hooks and pull files :ivar Optional[int] depth: Depth to clone git repositories :ivar Optional[GitConfig] config: Custom git config val...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GitSettings: """clowder yaml GitSettings model class :ivar Optional[bool] submodules: Whether to fetch submodules :ivar Optional[bool] lfs: Whether to set up lfs hooks and pull files :ivar Optional[int] depth: Depth to clone git repositories :ivar Optional[GitConfig] config: Custom git config values to set"""...
the_stack_v2_python_sparse
clowder/model/git_settings.py
JrGoodle/clowder
train
17
e191ea38f6e1bcf8755858cd21842eaa506515c8
[ "log.info('Creating CSRFProtectionMiddleware')\nself.application = application\nself.csrf_token_id = csrf_token_id\nself.clear_env = clear_env\nself.token_env = token_env\nself.auth_state = auth_state", "request = Request(environ)\nlog.debug('CSRFProtectionMiddleware(%s)' % request.path)\ntoken = environ.get('rep...
<|body_start_0|> log.info('Creating CSRFProtectionMiddleware') self.application = application self.csrf_token_id = csrf_token_id self.clear_env = clear_env self.token_env = token_env self.auth_state = auth_state <|end_body_0|> <|body_start_1|> request = Request(e...
CSRF Protection WSGI Middleware. A layer of WSGI middleware that is responsible for making sure authenticated requests originated from the user inside of the app's domain and not a malicious website. This middleware works with the :mod:`repoze.who` middleware, and requires that it is placed below :mod:`repoze.who` in t...
CSRFProtectionMiddleware
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CSRFProtectionMiddleware: """CSRF Protection WSGI Middleware. A layer of WSGI middleware that is responsible for making sure authenticated requests originated from the user inside of the app's domain and not a malicious website. This middleware works with the :mod:`repoze.who` middleware, and req...
stack_v2_sparse_classes_36k_train_029802
13,040
permissive
[ { "docstring": "Initialize the CSRF Protection WSGI Middleware. :csrf_token_id: The name of the CSRF token variable :clear_env: Variables to clear out of the `environ` on invalid token :token_env: The name of the token variable in the environ :auth_state: The environ key that will be set when we are logging in"...
2
stack_v2_sparse_classes_30k_train_013256
Implement the Python class `CSRFProtectionMiddleware` described below. Class description: CSRF Protection WSGI Middleware. A layer of WSGI middleware that is responsible for making sure authenticated requests originated from the user inside of the app's domain and not a malicious website. This middleware works with th...
Implement the Python class `CSRFProtectionMiddleware` described below. Class description: CSRF Protection WSGI Middleware. A layer of WSGI middleware that is responsible for making sure authenticated requests originated from the user inside of the app's domain and not a malicious website. This middleware works with th...
1e45769663f5a2ab80b8251cb633caf1f7328a11
<|skeleton|> class CSRFProtectionMiddleware: """CSRF Protection WSGI Middleware. A layer of WSGI middleware that is responsible for making sure authenticated requests originated from the user inside of the app's domain and not a malicious website. This middleware works with the :mod:`repoze.who` middleware, and req...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CSRFProtectionMiddleware: """CSRF Protection WSGI Middleware. A layer of WSGI middleware that is responsible for making sure authenticated requests originated from the user inside of the app's domain and not a malicious website. This middleware works with the :mod:`repoze.who` middleware, and requires that it...
the_stack_v2_python_sparse
moksha/middleware/csrf.py
ralphbean/moksha
train
2
e0da49cfb02d8e4bb5ddf381e2499a1b40b47a37
[ "name1 = self.__class__.__name__ + '.' + GetName.get_current_function_name()\nMinePage.Mine(self.driver).click_mine_entry()\nHotPage.Hot(self.driver).click_find()\nHotPage.Hot(self.driver).click_find_hotnews()\ntry:\n HotPage.Hot(self.driver).click_hotnews_hot()\n self.assertTrue(HotPage.Hot(self.driver).find...
<|body_start_0|> name1 = self.__class__.__name__ + '.' + GetName.get_current_function_name() MinePage.Mine(self.driver).click_mine_entry() HotPage.Hot(self.driver).click_find() HotPage.Hot(self.driver).click_find_hotnews() try: HotPage.Hot(self.driver).click_hotnews_h...
nologin_Hot
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class nologin_Hot: def test_01_hotnews(self): """发现热文UI测试""" <|body_0|> def test_02_hotman(self): """发现红人UI测试""" <|body_1|> <|end_skeleton|> <|body_start_0|> name1 = self.__class__.__name__ + '.' + GetName.get_current_function_name() MinePage.Mine...
stack_v2_sparse_classes_36k_train_029803
2,509
no_license
[ { "docstring": "发现热文UI测试", "name": "test_01_hotnews", "signature": "def test_01_hotnews(self)" }, { "docstring": "发现红人UI测试", "name": "test_02_hotman", "signature": "def test_02_hotman(self)" } ]
2
null
Implement the Python class `nologin_Hot` described below. Class description: Implement the nologin_Hot class. Method signatures and docstrings: - def test_01_hotnews(self): 发现热文UI测试 - def test_02_hotman(self): 发现红人UI测试
Implement the Python class `nologin_Hot` described below. Class description: Implement the nologin_Hot class. Method signatures and docstrings: - def test_01_hotnews(self): 发现热文UI测试 - def test_02_hotman(self): 发现红人UI测试 <|skeleton|> class nologin_Hot: def test_01_hotnews(self): """发现热文UI测试""" <|b...
7ce47cda6ac03b7eb707929dd2e0428132ff255f
<|skeleton|> class nologin_Hot: def test_01_hotnews(self): """发现热文UI测试""" <|body_0|> def test_02_hotman(self): """发现红人UI测试""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class nologin_Hot: def test_01_hotnews(self): """发现热文UI测试""" name1 = self.__class__.__name__ + '.' + GetName.get_current_function_name() MinePage.Mine(self.driver).click_mine_entry() HotPage.Hot(self.driver).click_find() HotPage.Hot(self.driver).click_find_hotnews() t...
the_stack_v2_python_sparse
android_warning/android_warning/apptest/TestCase/nologin_testhot.py
xiaominwanglast/uiautomator
train
0
caa85abe047c7793de7338ce74ab653f8c58fbaf
[ "with db.DBPoolManager().get_connect() as connect:\n cursor = connect.cursor(DictCursor)\n cursor.execute(sql_query, args)\n return cursor.fetchall()", "with db.DBPoolManager().get_cursor() as cursor:\n cursor.execute(sql_query, args)\n return cursor.fetchall()" ]
<|body_start_0|> with db.DBPoolManager().get_connect() as connect: cursor = connect.cursor(DictCursor) cursor.execute(sql_query, args) return cursor.fetchall() <|end_body_0|> <|body_start_1|> with db.DBPoolManager().get_cursor() as cursor: cursor.execute(...
Class for interacting with database using a pool manager.
DbHelper
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DbHelper: """Class for interacting with database using a pool manager.""" def _make_select(sql_query, args=None): """Makes SELECT SQL request using a pool manager. :param sql_query: sql query of request :param args: args for request :return: list of dicts""" <|body_0|> d...
stack_v2_sparse_classes_36k_train_029804
1,439
no_license
[ { "docstring": "Makes SELECT SQL request using a pool manager. :param sql_query: sql query of request :param args: args for request :return: list of dicts", "name": "_make_select", "signature": "def _make_select(sql_query, args=None)" }, { "docstring": "Makes INSERT, UPDATE, DELETE SQL requests ...
2
stack_v2_sparse_classes_30k_train_003980
Implement the Python class `DbHelper` described below. Class description: Class for interacting with database using a pool manager. Method signatures and docstrings: - def _make_select(sql_query, args=None): Makes SELECT SQL request using a pool manager. :param sql_query: sql query of request :param args: args for re...
Implement the Python class `DbHelper` described below. Class description: Class for interacting with database using a pool manager. Method signatures and docstrings: - def _make_select(sql_query, args=None): Makes SELECT SQL request using a pool manager. :param sql_query: sql query of request :param args: args for re...
7d8f85323cd553e1b7788b407f84f14d2563bd2b
<|skeleton|> class DbHelper: """Class for interacting with database using a pool manager.""" def _make_select(sql_query, args=None): """Makes SELECT SQL request using a pool manager. :param sql_query: sql query of request :param args: args for request :return: list of dicts""" <|body_0|> d...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DbHelper: """Class for interacting with database using a pool manager.""" def _make_select(sql_query, args=None): """Makes SELECT SQL request using a pool manager. :param sql_query: sql query of request :param args: args for request :return: list of dicts""" with db.DBPoolManager().get_co...
the_stack_v2_python_sparse
moneta/src/python/core/db/db_helper.py
lv-386-python/moneta
train
7
f597ec1aa18a314ece4229512b3f8e73dc07b6cc
[ "try:\n sock = socket.socket(31, socket.SOCK_RAW, 1)\n ioctl(sock.fileno(), 1074022602, index)\n sock.close()\nexcept IOError:\n return False\nreturn True", "try:\n sock = socket.socket(31, socket.SOCK_RAW, index)\n ioctl(sock.fileno(), 1074022603, 0)\n sock.close()\nexcept IOError:\n retu...
<|body_start_0|> try: sock = socket.socket(31, socket.SOCK_RAW, 1) ioctl(sock.fileno(), 1074022602, index) sock.close() except IOError: return False return True <|end_body_0|> <|body_start_1|> try: sock = socket.socket(31, sock...
This class allows to easily configure an HCI Interface.
HCIConfig
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HCIConfig: """This class allows to easily configure an HCI Interface.""" def down(index): """This class method stops an HCI interface. Its role is equivalent to the following command : ``hciconfig hci<index> down`` :param index: index of the HCI interface to stop :type index: integer...
stack_v2_sparse_classes_36k_train_029805
1,488
permissive
[ { "docstring": "This class method stops an HCI interface. Its role is equivalent to the following command : ``hciconfig hci<index> down`` :param index: index of the HCI interface to stop :type index: integer :Example: >>> HCIConfig.down(0)", "name": "down", "signature": "def down(index)" }, { "d...
3
null
Implement the Python class `HCIConfig` described below. Class description: This class allows to easily configure an HCI Interface. Method signatures and docstrings: - def down(index): This class method stops an HCI interface. Its role is equivalent to the following command : ``hciconfig hci<index> down`` :param index...
Implement the Python class `HCIConfig` described below. Class description: This class allows to easily configure an HCI Interface. Method signatures and docstrings: - def down(index): This class method stops an HCI interface. Its role is equivalent to the following command : ``hciconfig hci<index> down`` :param index...
f73f6c4442e4bfd239eb5caf5e1283c125d37db9
<|skeleton|> class HCIConfig: """This class allows to easily configure an HCI Interface.""" def down(index): """This class method stops an HCI interface. Its role is equivalent to the following command : ``hciconfig hci<index> down`` :param index: index of the HCI interface to stop :type index: integer...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HCIConfig: """This class allows to easily configure an HCI Interface.""" def down(index): """This class method stops an HCI interface. Its role is equivalent to the following command : ``hciconfig hci<index> down`` :param index: index of the HCI interface to stop :type index: integer :Example: >>...
the_stack_v2_python_sparse
mirage/libs/bt_utils/hciconfig.py
RCayre/mirage
train
199
d9f00e0c3732412ad8b06d6c64deac29d47a5d90
[ "self.val = None\nself.left = None\nself.right = None", "if self.val == None:\n self.val = word\nif word <= self.val:\n if self.left != None:\n self.left.insert(word)\n else:\n self.left = Trie()\n self.left.val = word\nelif word > self.val:\n if self.right != None:\n self....
<|body_start_0|> self.val = None self.left = None self.right = None <|end_body_0|> <|body_start_1|> if self.val == None: self.val = word if word <= self.val: if self.left != None: self.left.insert(word) else: se...
Trie
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Trie: def __init__(self): """Initialize your data structure here.""" <|body_0|> def insert(self, word): """Inserts a word into the trie. :type word: str :rtype: void""" <|body_1|> def search(self, word): """Returns if the word is in the trie. :ty...
stack_v2_sparse_classes_36k_train_029806
2,155
no_license
[ { "docstring": "Initialize your data structure here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Inserts a word into the trie. :type word: str :rtype: void", "name": "insert", "signature": "def insert(self, word)" }, { "docstring": "Returns if the w...
4
null
Implement the Python class `Trie` described below. Class description: Implement the Trie class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def insert(self, word): Inserts a word into the trie. :type word: str :rtype: void - def search(self, word): Returns if the wor...
Implement the Python class `Trie` described below. Class description: Implement the Trie class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def insert(self, word): Inserts a word into the trie. :type word: str :rtype: void - def search(self, word): Returns if the wor...
22359005ec5e0791e28294576fc6c40c61e4cbdb
<|skeleton|> class Trie: def __init__(self): """Initialize your data structure here.""" <|body_0|> def insert(self, word): """Inserts a word into the trie. :type word: str :rtype: void""" <|body_1|> def search(self, word): """Returns if the word is in the trie. :ty...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Trie: def __init__(self): """Initialize your data structure here.""" self.val = None self.left = None self.right = None def insert(self, word): """Inserts a word into the trie. :type word: str :rtype: void""" if self.val == None: self.val = word...
the_stack_v2_python_sparse
Day 49/49_Python.py
Skatie7/50DaysOfCode
train
0
8be088dda6bf281c0a914a1d9b5ca899b01e3fc0
[ "self.k = k\nself.elements = {}\nself.func_of_freq = lambda x: x ** p\nself.sample_p = sample_p", "if key in self.elements:\n raise Exception('This implementation works only for aggregated data')\nseed = np.random.exponential(1.0 / value ** self.sample_p)\nself.elements[key] = (seed, value)\nif len(self.elemen...
<|body_start_0|> self.k = k self.elements = {} self.func_of_freq = lambda x: x ** p self.sample_p = sample_p <|end_body_0|> <|body_start_1|> if key in self.elements: raise Exception('This implementation works only for aggregated data') seed = np.random.expone...
A simple implementation of PPSWOR sampling for aggregated data. Used as a benchmark for estimating moments with advice. The sketch assumes input that consists of (key, value) pairs, which is aggregated (each key appears at most once, no guarantees on the output otherwise). The sketch supports sampling keys with weight ...
PpsworSketch
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PpsworSketch: """A simple implementation of PPSWOR sampling for aggregated data. Used as a benchmark for estimating moments with advice. The sketch assumes input that consists of (key, value) pairs, which is aggregated (each key appears at most once, no guarantees on the output otherwise). The sk...
stack_v2_sparse_classes_36k_train_029807
24,996
permissive
[ { "docstring": "Initializes an empty sketch/sample of specified size. Args: k: Sample size p: The moment estimated by the sketch sample_p: The power of values used for the sampling weights, that is, the weight used for sampling an element (key, value) is going to be value ** sample_p.", "name": "__init__", ...
4
stack_v2_sparse_classes_30k_train_005327
Implement the Python class `PpsworSketch` described below. Class description: A simple implementation of PPSWOR sampling for aggregated data. Used as a benchmark for estimating moments with advice. The sketch assumes input that consists of (key, value) pairs, which is aggregated (each key appears at most once, no guar...
Implement the Python class `PpsworSketch` described below. Class description: A simple implementation of PPSWOR sampling for aggregated data. Used as a benchmark for estimating moments with advice. The sketch assumes input that consists of (key, value) pairs, which is aggregated (each key appears at most once, no guar...
727ec399ad17b4dd1f71ce69a26fc3b0371d9fa7
<|skeleton|> class PpsworSketch: """A simple implementation of PPSWOR sampling for aggregated data. Used as a benchmark for estimating moments with advice. The sketch assumes input that consists of (key, value) pairs, which is aggregated (each key appears at most once, no guarantees on the output otherwise). The sk...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PpsworSketch: """A simple implementation of PPSWOR sampling for aggregated data. Used as a benchmark for estimating moments with advice. The sketch assumes input that consists of (key, value) pairs, which is aggregated (each key appears at most once, no guarantees on the output otherwise). The sketch supports...
the_stack_v2_python_sparse
moment_advice/moment_advice.py
Ayoob7/google-research
train
2
1321df16179506d41263107f61f1c95e022cb1ca
[ "dictionary = self.__get_root_words_dict()\nstemmer = Stemmer(dictionary)\nreturn stemmer", "words = super().get_words_from_file()\ndictionary = ArrayDictionary(words)\nreturn dictionary" ]
<|body_start_0|> dictionary = self.__get_root_words_dict() stemmer = Stemmer(dictionary) return stemmer <|end_body_0|> <|body_start_1|> words = super().get_words_from_file() dictionary = ArrayDictionary(words) return dictionary <|end_body_1|>
StemmerFactory
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StemmerFactory: def create(self): """Membuat Objek Stemmer""" <|body_0|> def __get_root_words_dict(self): """Mendapatkan Daftar Kata Dasar Default Sastrawi""" <|body_1|> <|end_skeleton|> <|body_start_0|> dictionary = self.__get_root_words_dict() ...
stack_v2_sparse_classes_36k_train_029808
1,459
no_license
[ { "docstring": "Membuat Objek Stemmer", "name": "create", "signature": "def create(self)" }, { "docstring": "Mendapatkan Daftar Kata Dasar Default Sastrawi", "name": "__get_root_words_dict", "signature": "def __get_root_words_dict(self)" } ]
2
stack_v2_sparse_classes_30k_train_017690
Implement the Python class `StemmerFactory` described below. Class description: Implement the StemmerFactory class. Method signatures and docstrings: - def create(self): Membuat Objek Stemmer - def __get_root_words_dict(self): Mendapatkan Daftar Kata Dasar Default Sastrawi
Implement the Python class `StemmerFactory` described below. Class description: Implement the StemmerFactory class. Method signatures and docstrings: - def create(self): Membuat Objek Stemmer - def __get_root_words_dict(self): Mendapatkan Daftar Kata Dasar Default Sastrawi <|skeleton|> class StemmerFactory: def...
9742c193251303334ef805c8c94eb075afad777f
<|skeleton|> class StemmerFactory: def create(self): """Membuat Objek Stemmer""" <|body_0|> def __get_root_words_dict(self): """Mendapatkan Daftar Kata Dasar Default Sastrawi""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StemmerFactory: def create(self): """Membuat Objek Stemmer""" dictionary = self.__get_root_words_dict() stemmer = Stemmer(dictionary) return stemmer def __get_root_words_dict(self): """Mendapatkan Daftar Kata Dasar Default Sastrawi""" words = super().get_wo...
the_stack_v2_python_sparse
ujian_app/penilaian/pemrosesan_teks/stemmer.py
anh4rs/Aplikasi-Penilaian-Otomatis-Esai-BI
train
0
0911aecfae2a7fe78165764280f29550ee1bbca7
[ "QItemDelegate.__init__(self, parent)\nself.itemsDict = itemsDict\nself.column = column", "if index.column() == self.column:\n cbo = QComboBox(parent)\n for item in self.itemsDict:\n cbo.addItem(item, self.itemsDict[item])\n return cbo\nreturn QItemDelegate.createEditor(self, parent, option, index...
<|body_start_0|> QItemDelegate.__init__(self, parent) self.itemsDict = itemsDict self.column = column <|end_body_0|> <|body_start_1|> if index.column() == self.column: cbo = QComboBox(parent) for item in self.itemsDict: cbo.addItem(item, self.item...
ComboBoxDelegate
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ComboBoxDelegate: def __init__(self, parent, itemsDict, column): """Constructor""" <|body_0|> def createEditor(self, parent, option, index): """Creates a custom editor to edit value map data""" <|body_1|> def setEditorData(self, editor, index): "...
stack_v2_sparse_classes_36k_train_029809
16,608
no_license
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, parent, itemsDict, column)" }, { "docstring": "Creates a custom editor to edit value map data", "name": "createEditor", "signature": "def createEditor(self, parent, option, index)" }, { "docstring"...
4
null
Implement the Python class `ComboBoxDelegate` described below. Class description: Implement the ComboBoxDelegate class. Method signatures and docstrings: - def __init__(self, parent, itemsDict, column): Constructor - def createEditor(self, parent, option, index): Creates a custom editor to edit value map data - def s...
Implement the Python class `ComboBoxDelegate` described below. Class description: Implement the ComboBoxDelegate class. Method signatures and docstrings: - def __init__(self, parent, itemsDict, column): Constructor - def createEditor(self, parent, option, index): Creates a custom editor to edit value map data - def s...
edff378f356db3c0577ce34e618c5ae493d296ba
<|skeleton|> class ComboBoxDelegate: def __init__(self, parent, itemsDict, column): """Constructor""" <|body_0|> def createEditor(self, parent, option, index): """Creates a custom editor to edit value map data""" <|body_1|> def setEditorData(self, editor, index): "...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ComboBoxDelegate: def __init__(self, parent, itemsDict, column): """Constructor""" QItemDelegate.__init__(self, parent) self.itemsDict = itemsDict self.column = column def createEditor(self, parent, option, index): """Creates a custom editor to edit value map data"...
the_stack_v2_python_sparse
ComplexTools/manageComplex.py
euriconicacio/DsgTools
train
0
d764cb7bd2c69d7ee18c303fd60e86d5d5b505af
[ "super().__init__(**kwargs)\ndiscriminator = []\nassert len(kernel_sizes) == 2\nassert kernel_sizes[0] % 2 == 1\nassert kernel_sizes[1] % 2 == 1\ndiscriminator = [TFReflectionPad1d((np.prod(kernel_sizes) - 1) // 2, padding_type=padding_type), tf.keras.layers.Conv1D(filters=filters, kernel_size=int(np.prod(kernel_si...
<|body_start_0|> super().__init__(**kwargs) discriminator = [] assert len(kernel_sizes) == 2 assert kernel_sizes[0] % 2 == 1 assert kernel_sizes[1] % 2 == 1 discriminator = [TFReflectionPad1d((np.prod(kernel_sizes) - 1) // 2, padding_type=padding_type), tf.keras.layers.Co...
Tensorflow MelGAN generator module.
TFMelGANDiscriminator
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TFMelGANDiscriminator: """Tensorflow MelGAN generator module.""" def __init__(self, out_channels=1, kernel_sizes=[5, 3], filters=16, max_downsample_filters=1024, use_bias=True, downsample_scales=[4, 4, 4, 4], nonlinear_activation='LeakyReLU', nonlinear_activation_params={'alpha': 0.2}, paddi...
stack_v2_sparse_classes_36k_train_029810
17,807
permissive
[ { "docstring": "Initilize MelGAN discriminator module. Args: out_channels (int): Number of output channels. kernel_sizes (list): List of two kernel sizes. The prod will be used for the first conv layer, and the first and the second kernel sizes will be used for the last two layers. For example if kernel_sizes =...
3
stack_v2_sparse_classes_30k_train_012219
Implement the Python class `TFMelGANDiscriminator` described below. Class description: Tensorflow MelGAN generator module. Method signatures and docstrings: - def __init__(self, out_channels=1, kernel_sizes=[5, 3], filters=16, max_downsample_filters=1024, use_bias=True, downsample_scales=[4, 4, 4, 4], nonlinear_activ...
Implement the Python class `TFMelGANDiscriminator` described below. Class description: Tensorflow MelGAN generator module. Method signatures and docstrings: - def __init__(self, out_channels=1, kernel_sizes=[5, 3], filters=16, max_downsample_filters=1024, use_bias=True, downsample_scales=[4, 4, 4, 4], nonlinear_activ...
136877136355c82d7ba474ceb7a8f133bd84767e
<|skeleton|> class TFMelGANDiscriminator: """Tensorflow MelGAN generator module.""" def __init__(self, out_channels=1, kernel_sizes=[5, 3], filters=16, max_downsample_filters=1024, use_bias=True, downsample_scales=[4, 4, 4, 4], nonlinear_activation='LeakyReLU', nonlinear_activation_params={'alpha': 0.2}, paddi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TFMelGANDiscriminator: """Tensorflow MelGAN generator module.""" def __init__(self, out_channels=1, kernel_sizes=[5, 3], filters=16, max_downsample_filters=1024, use_bias=True, downsample_scales=[4, 4, 4, 4], nonlinear_activation='LeakyReLU', nonlinear_activation_params={'alpha': 0.2}, padding_type='REFL...
the_stack_v2_python_sparse
tensorflow_tts/models/melgan.py
TensorSpeech/TensorFlowTTS
train
2,889
9a1a1b57b859eb1da0152c377adea0856fd9cd79
[ "if l1 is None:\n return l2\nif l2 is None:\n return l1\ncur = ListNode(None)\nnewHead = cur\nwhile l1 is not None or l2 is not None:\n if l1.val <= l2.val:\n cur.next = l1\n l1 = l1.next\n else:\n cur.next = l2\n l2 = l2.next\n cur = cur.next\n if l1 is None:\n ...
<|body_start_0|> if l1 is None: return l2 if l2 is None: return l1 cur = ListNode(None) newHead = cur while l1 is not None or l2 is not None: if l1.val <= l2.val: cur.next = l1 l1 = l1.next else: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def mergeTwoLists(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_0|> def mergeKListsSecond(self, lists): """:type lists: List[ListNode] :rtype: ListNode""" <|body_1|> def mergeKLists(self, lists): """...
stack_v2_sparse_classes_36k_train_029811
1,955
no_license
[ { "docstring": ":type l1: ListNode :type l2: ListNode :rtype: ListNode", "name": "mergeTwoLists", "signature": "def mergeTwoLists(self, l1, l2)" }, { "docstring": ":type lists: List[ListNode] :rtype: ListNode", "name": "mergeKListsSecond", "signature": "def mergeKListsSecond(self, lists)...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeTwoLists(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode - def mergeKListsSecond(self, lists): :type lists: List[ListNode] :rtype: ListNode - def m...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeTwoLists(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode - def mergeKListsSecond(self, lists): :type lists: List[ListNode] :rtype: ListNode - def m...
88da6b274e49ce97d432e1f4d4de8efa55593836
<|skeleton|> class Solution: def mergeTwoLists(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_0|> def mergeKListsSecond(self, lists): """:type lists: List[ListNode] :rtype: ListNode""" <|body_1|> def mergeKLists(self, lists): """...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def mergeTwoLists(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" if l1 is None: return l2 if l2 is None: return l1 cur = ListNode(None) newHead = cur while l1 is not None or l2 is not None: ...
the_stack_v2_python_sparse
2nd/homework_7/id_52/mergeKLists_52.py
StuQAlgorithm/AlgorithmHomework
train
6
f8ff757a323ec25d1817f971a1a39e71a0de3287
[ "res = []\nnums.sort()\nfor i, num in enumerate(nums[0:-2]):\n l = i + 1\n r = len(nums) - 1\n if nums[l] + nums[l + 1] + num > target:\n res.append(nums[l] + nums[l + 1] + num)\n elif nums[r] + nums[r - 1] + num < target:\n res.append(nums[r] + nums[r - 1] + num)\n else:\n while...
<|body_start_0|> res = [] nums.sort() for i, num in enumerate(nums[0:-2]): l = i + 1 r = len(nums) - 1 if nums[l] + nums[l + 1] + num > target: res.append(nums[l] + nums[l + 1] + num) elif nums[r] + nums[r - 1] + num < target: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def threeSumClosest(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" <|body_0|> def threeSumClosest_myfirst(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" <|body_1|> <|end_skeleton|> <|...
stack_v2_sparse_classes_36k_train_029812
1,894
no_license
[ { "docstring": ":type nums: List[int] :type target: int :rtype: int", "name": "threeSumClosest", "signature": "def threeSumClosest(self, nums, target)" }, { "docstring": ":type nums: List[int] :type target: int :rtype: int", "name": "threeSumClosest_myfirst", "signature": "def threeSumCl...
2
stack_v2_sparse_classes_30k_train_011267
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def threeSumClosest(self, nums, target): :type nums: List[int] :type target: int :rtype: int - def threeSumClosest_myfirst(self, nums, target): :type nums: List[int] :type target...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def threeSumClosest(self, nums, target): :type nums: List[int] :type target: int :rtype: int - def threeSumClosest_myfirst(self, nums, target): :type nums: List[int] :type target...
f0d9070fa292ca36971a465a805faddb12025482
<|skeleton|> class Solution: def threeSumClosest(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" <|body_0|> def threeSumClosest_myfirst(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def threeSumClosest(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" res = [] nums.sort() for i, num in enumerate(nums[0:-2]): l = i + 1 r = len(nums) - 1 if nums[l] + nums[l + 1] + num > target: ...
the_stack_v2_python_sparse
16.3SumClosest.py
JerryRoc/leetcode
train
0
3ea752b496dd506b0ef584709aefc59c05417052
[ "if not root:\n return json.dumps([])\narr = []\nqueue = [[root, -1]]\nwhile queue:\n tmp = queue.pop(0)\n cur, parentIdx = (tmp[0], tmp[1])\n arr.append([cur.val, parentIdx])\n if cur.left:\n queue.append([cur.left, len(arr) - 1])\n if cur.right:\n queue.append([cur.right, len(arr) ...
<|body_start_0|> if not root: return json.dumps([]) arr = [] queue = [[root, -1]] while queue: tmp = queue.pop(0) cur, parentIdx = (tmp[0], tmp[1]) arr.append([cur.val, parentIdx]) if cur.left: queue.append([cur....
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data: str) -> TreeNode: """Decodes your encoded data to tree.""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not root: ...
stack_v2_sparse_classes_36k_train_029813
1,317
no_license
[ { "docstring": "Encodes a tree to a single string.", "name": "serialize", "signature": "def serialize(self, root: TreeNode) -> str" }, { "docstring": "Decodes your encoded data to tree.", "name": "deserialize", "signature": "def deserialize(self, data: str) -> TreeNode" } ]
2
stack_v2_sparse_classes_30k_train_010385
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string. - def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree.
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string. - def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree. <|skeleton|> class Co...
6c716ee37fcb82387f050422f578daa142926101
<|skeleton|> class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data: str) -> TreeNode: """Decodes your encoded data to tree.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" if not root: return json.dumps([]) arr = [] queue = [[root, -1]] while queue: tmp = queue.pop(0) cur, parentIdx = (tmp[0], tmp[1]) ...
the_stack_v2_python_sparse
src/449.py
yibwu/leetcode
train
0
3eeb547f8ffd63a2dab465ddb5379577eaac4a1a
[ "fname = '{}/{}-test.csv'.format(lang, lang)\nfpath = os.path.join(self.data_dir, fname)\nreturn self._create_examples(self.read_csv(fpath), 'dev')", "filename = '{}/{}-train.csv'.format(lang, lang)\nlines = self.read_csv(os.path.join(self.data_dir, filename))\nlabels = map(lambda l: l[2], lines)\nlabels = list(s...
<|body_start_0|> fname = '{}/{}-test.csv'.format(lang, lang) fpath = os.path.join(self.data_dir, fname) return self._create_examples(self.read_csv(fpath), 'dev') <|end_body_0|> <|body_start_1|> filename = '{}/{}-train.csv'.format(lang, lang) lines = self.read_csv(os.path.join(se...
AmritaParaphraseExact
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AmritaParaphraseExact: def get_dev_examples(self, lang): """See base class.""" <|body_0|> def get_labels(self, lang): """See base class.""" <|body_1|> def _create_examples(self, lines, set_type): """Creates examples for the training and dev sets....
stack_v2_sparse_classes_36k_train_029814
17,110
permissive
[ { "docstring": "See base class.", "name": "get_dev_examples", "signature": "def get_dev_examples(self, lang)" }, { "docstring": "See base class.", "name": "get_labels", "signature": "def get_labels(self, lang)" }, { "docstring": "Creates examples for the training and dev sets.", ...
3
stack_v2_sparse_classes_30k_val_000119
Implement the Python class `AmritaParaphraseExact` described below. Class description: Implement the AmritaParaphraseExact class. Method signatures and docstrings: - def get_dev_examples(self, lang): See base class. - def get_labels(self, lang): See base class. - def _create_examples(self, lines, set_type): Creates e...
Implement the Python class `AmritaParaphraseExact` described below. Class description: Implement the AmritaParaphraseExact class. Method signatures and docstrings: - def get_dev_examples(self, lang): See base class. - def get_labels(self, lang): See base class. - def _create_examples(self, lines, set_type): Creates e...
83f37bf46822f87d0b4c2fc7566568675c6d006e
<|skeleton|> class AmritaParaphraseExact: def get_dev_examples(self, lang): """See base class.""" <|body_0|> def get_labels(self, lang): """See base class.""" <|body_1|> def _create_examples(self, lines, set_type): """Creates examples for the training and dev sets....
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AmritaParaphraseExact: def get_dev_examples(self, lang): """See base class.""" fname = '{}/{}-test.csv'.format(lang, lang) fpath = os.path.join(self.data_dir, fname) return self._create_examples(self.read_csv(fpath), 'dev') def get_labels(self, lang): """See base c...
the_stack_v2_python_sparse
fine_tune/data/processors.py
euihyeonmoon/indic-bert
train
0
2f2627fd229e5362574970057b40fbdaca755406
[ "sc_table = parse_table_name(sc_table, wait=wait, db_host=db_host, db_user=db_user, db_pass=db_pass, db_port=db_port)\nreeds_build = parse_table_name(reeds_build, wait=wait, db_host=db_host, db_user=db_user, db_pass=db_pass, db_port=db_port)\nsc_table = DataCleaner.rename_cols(sc_table, name_map=DataCleaner.REV_NAM...
<|body_start_0|> sc_table = parse_table_name(sc_table, wait=wait, db_host=db_host, db_user=db_user, db_pass=db_pass, db_port=db_port) reeds_build = parse_table_name(reeds_build, wait=wait, db_host=db_host, db_user=db_user, db_pass=db_pass, db_port=db_port) sc_table = DataCleaner.rename_cols(sc_t...
Class to handle project GIDs for a plexos project. Can be used to make gid superset project points for 5min data.
ProjectGidHandler
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProjectGidHandler: """Class to handle project GIDs for a plexos project. Can be used to make gid superset project points for 5min data.""" def get_resource_gids(sc_table, reeds_build, wait=300, db_host='gds_edit.nrel.gov', db_user=None, db_pass=None, db_port=5432): """Get resource gi...
stack_v2_sparse_classes_36k_train_029815
18,002
permissive
[ { "docstring": "Get resource gids from a single reeds supply curve build Parameters ---------- sc_table : str | pd.DataFrame reV supply curve results (CSV file path or database.schema.name) reeds_build : str | pd.DataFrame REEDS buildout file with wait : int Integer seconds to wait for DB connection to become a...
2
stack_v2_sparse_classes_30k_train_001136
Implement the Python class `ProjectGidHandler` described below. Class description: Class to handle project GIDs for a plexos project. Can be used to make gid superset project points for 5min data. Method signatures and docstrings: - def get_resource_gids(sc_table, reeds_build, wait=300, db_host='gds_edit.nrel.gov', d...
Implement the Python class `ProjectGidHandler` described below. Class description: Class to handle project GIDs for a plexos project. Can be used to make gid superset project points for 5min data. Method signatures and docstrings: - def get_resource_gids(sc_table, reeds_build, wait=300, db_host='gds_edit.nrel.gov', d...
2dd05402c9c05ca0bf7f0e5bc2849ede0d0bc3cb
<|skeleton|> class ProjectGidHandler: """Class to handle project GIDs for a plexos project. Can be used to make gid superset project points for 5min data.""" def get_resource_gids(sc_table, reeds_build, wait=300, db_host='gds_edit.nrel.gov', db_user=None, db_pass=None, db_port=5432): """Get resource gi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProjectGidHandler: """Class to handle project GIDs for a plexos project. Can be used to make gid superset project points for 5min data.""" def get_resource_gids(sc_table, reeds_build, wait=300, db_host='gds_edit.nrel.gov', db_user=None, db_pass=None, db_port=5432): """Get resource gids from a sin...
the_stack_v2_python_sparse
reVX/plexos/utilities.py
NREL/reVX
train
10
b31dbddd2fb70acb1c19b2dfb5bfb8219b8e90b8
[ "self.variables: List[V] = variables\nself.domains: Dict[V, List[D]] = domains\nself.constraints: Dict[V, List[Constraint[V, D]]] = {}\nfor variable in self.variables:\n self.constraints[variable] = []\n if variable not in self.domains:\n raise LookupError('Every variable should have a domain assigned ...
<|body_start_0|> self.variables: List[V] = variables self.domains: Dict[V, List[D]] = domains self.constraints: Dict[V, List[Constraint[V, D]]] = {} for variable in self.variables: self.constraints[variable] = [] if variable not in self.domains: ra...
A constraint satisfaction problem consists of variables of type V that have ranges of values known as domains of type D and constraints that determine whether a particular variable's domain selection is valid.
CSP
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CSP: """A constraint satisfaction problem consists of variables of type V that have ranges of values known as domains of type D and constraints that determine whether a particular variable's domain selection is valid.""" def __init__(self, variables: List[V], domains: Dict[V, List[D]]) -> No...
stack_v2_sparse_classes_36k_train_029816
10,604
no_license
[ { "docstring": "Constructor for CSP class.", "name": "__init__", "signature": "def __init__(self, variables: List[V], domains: Dict[V, List[D]]) -> None" }, { "docstring": "This method adds constraint to variables as per their domains.", "name": "add_constraint", "signature": "def add_co...
4
stack_v2_sparse_classes_30k_test_000277
Implement the Python class `CSP` described below. Class description: A constraint satisfaction problem consists of variables of type V that have ranges of values known as domains of type D and constraints that determine whether a particular variable's domain selection is valid. Method signatures and docstrings: - def...
Implement the Python class `CSP` described below. Class description: A constraint satisfaction problem consists of variables of type V that have ranges of values known as domains of type D and constraints that determine whether a particular variable's domain selection is valid. Method signatures and docstrings: - def...
892d9c25b9712bf3bbfd7f29529eca8b47fb8039
<|skeleton|> class CSP: """A constraint satisfaction problem consists of variables of type V that have ranges of values known as domains of type D and constraints that determine whether a particular variable's domain selection is valid.""" def __init__(self, variables: List[V], domains: Dict[V, List[D]]) -> No...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CSP: """A constraint satisfaction problem consists of variables of type V that have ranges of values known as domains of type D and constraints that determine whether a particular variable's domain selection is valid.""" def __init__(self, variables: List[V], domains: Dict[V, List[D]]) -> None: "...
the_stack_v2_python_sparse
sem-4/Lab7_15_2/Lab7_GraphColoringProblem_ConstraintSatisfactionAlgorithm.py
B-Tech-AI-Python/Class-assignments
train
0
5dc4e213daef57cb10919bb09b98075aeb004d7a
[ "if not lists:\n return None\nleft, right = (0, len(lists) - 1)\nwhile right > 0:\n if left >= right:\n left = 0\n else:\n lists[left] = self.merge_two(lists[left], lists[right])\n left += 1\n right -= 1\nreturn lists[0]", "curr = dummy = ListNode('X')\nwhile l1 and l2:\n i...
<|body_start_0|> if not lists: return None left, right = (0, len(lists) - 1) while right > 0: if left >= right: left = 0 else: lists[left] = self.merge_two(lists[left], lists[right]) left += 1 rig...
Solution_STD
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution_STD: def mergeKLists(self, lists: List[ListNode]) -> ListNode: """Improved from C1 这个方法采用首尾合并, 这样能显著减少重复流经的节点 首尾相遇后, 重置首为0, 尾不变(因为已经都被合并到前面去了)""" <|body_0|> def merge_two(self, l1: ListNode, l2: ListNode) -> ListNode: """Helper for Solution C1 and C2 (now se...
stack_v2_sparse_classes_36k_train_029817
4,145
permissive
[ { "docstring": "Improved from C1 这个方法采用首尾合并, 这样能显著减少重复流经的节点 首尾相遇后, 重置首为0, 尾不变(因为已经都被合并到前面去了)", "name": "mergeKLists", "signature": "def mergeKLists(self, lists: List[ListNode]) -> ListNode" }, { "docstring": "Helper for Solution C1 and C2 (now set out side of the Solution) merge two sorted linke...
2
stack_v2_sparse_classes_30k_train_018431
Implement the Python class `Solution_STD` described below. Class description: Implement the Solution_STD class. Method signatures and docstrings: - def mergeKLists(self, lists: List[ListNode]) -> ListNode: Improved from C1 这个方法采用首尾合并, 这样能显著减少重复流经的节点 首尾相遇后, 重置首为0, 尾不变(因为已经都被合并到前面去了) - def merge_two(self, l1: ListNode,...
Implement the Python class `Solution_STD` described below. Class description: Implement the Solution_STD class. Method signatures and docstrings: - def mergeKLists(self, lists: List[ListNode]) -> ListNode: Improved from C1 这个方法采用首尾合并, 这样能显著减少重复流经的节点 首尾相遇后, 重置首为0, 尾不变(因为已经都被合并到前面去了) - def merge_two(self, l1: ListNode,...
143422321cbc3715ca08f6c3af8f960a55887ced
<|skeleton|> class Solution_STD: def mergeKLists(self, lists: List[ListNode]) -> ListNode: """Improved from C1 这个方法采用首尾合并, 这样能显著减少重复流经的节点 首尾相遇后, 重置首为0, 尾不变(因为已经都被合并到前面去了)""" <|body_0|> def merge_two(self, l1: ListNode, l2: ListNode) -> ListNode: """Helper for Solution C1 and C2 (now se...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution_STD: def mergeKLists(self, lists: List[ListNode]) -> ListNode: """Improved from C1 这个方法采用首尾合并, 这样能显著减少重复流经的节点 首尾相遇后, 重置首为0, 尾不变(因为已经都被合并到前面去了)""" if not lists: return None left, right = (0, len(lists) - 1) while right > 0: if left >= right: ...
the_stack_v2_python_sparse
LeetCode/LC023_merge_k_sorted_list.py
jxie0755/Learning_Python
train
0
6c003d885c6f3e5640b9007dfd07ad17d5e3461f
[ "field_name, rest = _get_field_name_and_rest(field)\ntry:\n field = model._meta.get_field(field_name)\n if isinstance(field, OneToOneRel):\n return self.is_valid_field(field.related_model, rest)\n if field.rel and rest:\n return self.is_valid_field(field.rel.to, rest)\n return True\nexcept...
<|body_start_0|> field_name, rest = _get_field_name_and_rest(field) try: field = model._meta.get_field(field_name) if isinstance(field, OneToOneRel): return self.is_valid_field(field.related_model, rest) if field.rel and rest: return se...
Extends OrderingFilter to support ordering by fields in related models using Django orm '__'. This class is copied and changed from the patch of the github issue. https://github.com/encode/django-rest-framework/issues/1005#issuecomment-289555282 This is based on rest_framework 3.2.5 because pdc-server is using this ver...
RelatedNestedOrderingFilter
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RelatedNestedOrderingFilter: """Extends OrderingFilter to support ordering by fields in related models using Django orm '__'. This class is copied and changed from the patch of the github issue. https://github.com/encode/django-rest-framework/issues/1005#issuecomment-289555282 This is based on re...
stack_v2_sparse_classes_36k_train_029818
4,416
permissive
[ { "docstring": "Return true if the field exists within the model (or in the related model specified using the Django ORM __ notation)", "name": "is_valid_field", "signature": "def is_valid_field(self, model, field)" }, { "docstring": "Rewrite the remove_invalid_fields methods and add the nested ...
2
stack_v2_sparse_classes_30k_train_006722
Implement the Python class `RelatedNestedOrderingFilter` described below. Class description: Extends OrderingFilter to support ordering by fields in related models using Django orm '__'. This class is copied and changed from the patch of the github issue. https://github.com/encode/django-rest-framework/issues/1005#iss...
Implement the Python class `RelatedNestedOrderingFilter` described below. Class description: Extends OrderingFilter to support ordering by fields in related models using Django orm '__'. This class is copied and changed from the patch of the github issue. https://github.com/encode/django-rest-framework/issues/1005#iss...
af79f73c30fa5f5709ba03d584b7a49b83166b81
<|skeleton|> class RelatedNestedOrderingFilter: """Extends OrderingFilter to support ordering by fields in related models using Django orm '__'. This class is copied and changed from the patch of the github issue. https://github.com/encode/django-rest-framework/issues/1005#issuecomment-289555282 This is based on re...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RelatedNestedOrderingFilter: """Extends OrderingFilter to support ordering by fields in related models using Django orm '__'. This class is copied and changed from the patch of the github issue. https://github.com/encode/django-rest-framework/issues/1005#issuecomment-289555282 This is based on rest_framework ...
the_stack_v2_python_sparse
pdc/apps/utils/utils.py
product-definition-center/product-definition-center
train
19
292264cfc982b8615c66907afe2794555183e64b
[ "if head == None or head.next == None:\n return head\ndummy = ListNode(-1000)\ndummy.next = head\nslow = dummy\nfast = dummy.next\nwhile fast:\n if fast.next and fast.next.val == fast.val:\n tmp = fast.val\n while fast and tmp == fast.val:\n fast = fast.next\n else:\n slow.n...
<|body_start_0|> if head == None or head.next == None: return head dummy = ListNode(-1000) dummy.next = head slow = dummy fast = dummy.next while fast: if fast.next and fast.next.val == fast.val: tmp = fast.val while...
Solution
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def deleteDuplicates(self, head: ListNode) -> ListNode: """迭代 :param head: :return:""" <|body_0|> def deleteDuplicates2(self, head: ListNode) -> ListNode: """感觉会用到两个循环 假设第一个virtual_node为自己创建的,node后面跟head 快指针指向head.next 慢指针指向head 当 head存在,循环遍历head.next 如果存在,...
stack_v2_sparse_classes_36k_train_029819
2,768
permissive
[ { "docstring": "迭代 :param head: :return:", "name": "deleteDuplicates", "signature": "def deleteDuplicates(self, head: ListNode) -> ListNode" }, { "docstring": "感觉会用到两个循环 假设第一个virtual_node为自己创建的,node后面跟head 快指针指向head.next 慢指针指向head 当 head存在,循环遍历head.next 如果存在,判断是否相等。如果不等,head为head.next 慢指针指向head ...
4
stack_v2_sparse_classes_30k_train_006045
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def deleteDuplicates(self, head: ListNode) -> ListNode: 迭代 :param head: :return: - def deleteDuplicates2(self, head: ListNode) -> ListNode: 感觉会用到两个循环 假设第一个virtual_node为自己创建的,node...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def deleteDuplicates(self, head: ListNode) -> ListNode: 迭代 :param head: :return: - def deleteDuplicates2(self, head: ListNode) -> ListNode: 感觉会用到两个循环 假设第一个virtual_node为自己创建的,node...
41f4b8b557cf15cbd602f187f6550184b3a108ec
<|skeleton|> class Solution: def deleteDuplicates(self, head: ListNode) -> ListNode: """迭代 :param head: :return:""" <|body_0|> def deleteDuplicates2(self, head: ListNode) -> ListNode: """感觉会用到两个循环 假设第一个virtual_node为自己创建的,node后面跟head 快指针指向head.next 慢指针指向head 当 head存在,循环遍历head.next 如果存在,...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def deleteDuplicates(self, head: ListNode) -> ListNode: """迭代 :param head: :return:""" if head == None or head.next == None: return head dummy = ListNode(-1000) dummy.next = head slow = dummy fast = dummy.next while fast: ...
the_stack_v2_python_sparse
leetcode/82. 删除排序链表中的重复元素 II.py
zhongmb/suanfa
train
0
d283d7777f0a055648dbbd3de345dcc0b327d241
[ "login_page.LoginPage(self.driver).login()\nsleep(2)\nlandlord_nav_page.LandlordNavPage(self.driver).Iamlandlord()\nsleep(2)\nlandlord_nav_page.LandlordNavPage(self.driver).close_weiChat()\nsleep(2)\nlandlord_nav_page.LandlordNavPage(self.driver).activitymanager()\nsleep(1)\nlandlord_nav_page.LandlordNavPage(self.d...
<|body_start_0|> login_page.LoginPage(self.driver).login() sleep(2) landlord_nav_page.LandlordNavPage(self.driver).Iamlandlord() sleep(2) landlord_nav_page.LandlordNavPage(self.driver).close_weiChat() sleep(2) landlord_nav_page.LandlordNavPage(self.driver).activit...
活动设置
TestActivity
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestActivity: """活动设置""" def test_active_good(self): """活动好处""" <|body_0|> def test_regular_desc(self): """活动规则""" <|body_1|> <|end_skeleton|> <|body_start_0|> login_page.LoginPage(self.driver).login() sleep(2) landlord_nav_page....
stack_v2_sparse_classes_36k_train_029820
1,807
permissive
[ { "docstring": "活动好处", "name": "test_active_good", "signature": "def test_active_good(self)" }, { "docstring": "活动规则", "name": "test_regular_desc", "signature": "def test_regular_desc(self)" } ]
2
stack_v2_sparse_classes_30k_train_012113
Implement the Python class `TestActivity` described below. Class description: 活动设置 Method signatures and docstrings: - def test_active_good(self): 活动好处 - def test_regular_desc(self): 活动规则
Implement the Python class `TestActivity` described below. Class description: 活动设置 Method signatures and docstrings: - def test_active_good(self): 活动好处 - def test_regular_desc(self): 活动规则 <|skeleton|> class TestActivity: """活动设置""" def test_active_good(self): """活动好处""" <|body_0|> def t...
192c70c49a8e9e072b9d0d0136f02c653c589410
<|skeleton|> class TestActivity: """活动设置""" def test_active_good(self): """活动好处""" <|body_0|> def test_regular_desc(self): """活动规则""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestActivity: """活动设置""" def test_active_good(self): """活动好处""" login_page.LoginPage(self.driver).login() sleep(2) landlord_nav_page.LandlordNavPage(self.driver).Iamlandlord() sleep(2) landlord_nav_page.LandlordNavPage(self.driver).close_weiChat() s...
the_stack_v2_python_sparse
mayi/test_case/test_landlord_activity.py
18701016443/mayi
train
0
446f93db141f6f425732417fb84e211bbd69465d
[ "super().__init__()\nself.mha = MultiHeadAttention(dm, h)\nself.ffn = point_wise_feed_forward_network(dm, hidden)\nself.layernorm1 = tf.keras.layers.LayerNormalization(epsilon=1e-06)\nself.layernorm2 = tf.keras.layers.LayerNormalization(epsilon=1e-06)\nself.dropout1 = tf.keras.layers.Dropout(drop_rate)\nself.dropou...
<|body_start_0|> super().__init__() self.mha = MultiHeadAttention(dm, h) self.ffn = point_wise_feed_forward_network(dm, hidden) self.layernorm1 = tf.keras.layers.LayerNormalization(epsilon=1e-06) self.layernorm2 = tf.keras.layers.LayerNormalization(epsilon=1e-06) self.dro...
class Encoder block
EncoderBlock
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EncoderBlock: """class Encoder block""" def __init__(self, dm, h, hidden, drop_rate=0.1): """* dm - the dimensionality of the model * h - the number of heads * hidden - the number of hidden units in the fully connected layer * drop_rate - the dropout rate Sets the following public in...
stack_v2_sparse_classes_36k_train_029821
18,002
no_license
[ { "docstring": "* dm - the dimensionality of the model * h - the number of heads * hidden - the number of hidden units in the fully connected layer * drop_rate - the dropout rate Sets the following public instance attributes: * mha - a MultiHeadAttention layer * dense_hidden - the hidden dense layer with hidden...
2
stack_v2_sparse_classes_30k_train_008533
Implement the Python class `EncoderBlock` described below. Class description: class Encoder block Method signatures and docstrings: - def __init__(self, dm, h, hidden, drop_rate=0.1): * dm - the dimensionality of the model * h - the number of heads * hidden - the number of hidden units in the fully connected layer * ...
Implement the Python class `EncoderBlock` described below. Class description: class Encoder block Method signatures and docstrings: - def __init__(self, dm, h, hidden, drop_rate=0.1): * dm - the dimensionality of the model * h - the number of heads * hidden - the number of hidden units in the fully connected layer * ...
8ad4c2594ff78b345dbd92e9d54d2a143ac4071a
<|skeleton|> class EncoderBlock: """class Encoder block""" def __init__(self, dm, h, hidden, drop_rate=0.1): """* dm - the dimensionality of the model * h - the number of heads * hidden - the number of hidden units in the fully connected layer * drop_rate - the dropout rate Sets the following public in...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EncoderBlock: """class Encoder block""" def __init__(self, dm, h, hidden, drop_rate=0.1): """* dm - the dimensionality of the model * h - the number of heads * hidden - the number of hidden units in the fully connected layer * drop_rate - the dropout rate Sets the following public instance attrib...
the_stack_v2_python_sparse
supervised_learning/0x12-transformer_apps/5-transformer.py
jorgezafra94/holbertonschool-machine_learning
train
1
9adef181bfce5395e5aa881bb040f1f7620e49ab
[ "config = mock.Mock()\nconfig.workspace = 'workspace'\nconfig.benchmark_method_patterns = ['new_foo.BenchmarkClass.filter:bench.*']\nbenchmark_runner = benchmark.BenchmarkRunner(config)\nmock_benchmark_class = mock.Mock()\nmock_benchmark_class.benchmark_method_1 = 'foo'\nmock_module = mock.Mock()\nsys.modules['new_...
<|body_start_0|> config = mock.Mock() config.workspace = 'workspace' config.benchmark_method_patterns = ['new_foo.BenchmarkClass.filter:bench.*'] benchmark_runner = benchmark.BenchmarkRunner(config) mock_benchmark_class = mock.Mock() mock_benchmark_class.benchmark_method_...
TestBenchmarkRunner
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestBenchmarkRunner: def test_get_benchmark_methods_filter(self): """Tests returning methods on a class based on a filter.""" <|body_0|> def test_get_benchmark_methods_exact_match(self): """Tests returning methods on a class based on a filter.""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_029822
2,160
permissive
[ { "docstring": "Tests returning methods on a class based on a filter.", "name": "test_get_benchmark_methods_filter", "signature": "def test_get_benchmark_methods_filter(self)" }, { "docstring": "Tests returning methods on a class based on a filter.", "name": "test_get_benchmark_methods_exact...
2
stack_v2_sparse_classes_30k_train_014447
Implement the Python class `TestBenchmarkRunner` described below. Class description: Implement the TestBenchmarkRunner class. Method signatures and docstrings: - def test_get_benchmark_methods_filter(self): Tests returning methods on a class based on a filter. - def test_get_benchmark_methods_exact_match(self): Tests...
Implement the Python class `TestBenchmarkRunner` described below. Class description: Implement the TestBenchmarkRunner class. Method signatures and docstrings: - def test_get_benchmark_methods_filter(self): Tests returning methods on a class based on a filter. - def test_get_benchmark_methods_exact_match(self): Tests...
c8e97df0d4d3d0c1020b98391c526df12371fc30
<|skeleton|> class TestBenchmarkRunner: def test_get_benchmark_methods_filter(self): """Tests returning methods on a class based on a filter.""" <|body_0|> def test_get_benchmark_methods_exact_match(self): """Tests returning methods on a class based on a filter.""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestBenchmarkRunner: def test_get_benchmark_methods_filter(self): """Tests returning methods on a class based on a filter.""" config = mock.Mock() config.workspace = 'workspace' config.benchmark_method_patterns = ['new_foo.BenchmarkClass.filter:bench.*'] benchmark_runne...
the_stack_v2_python_sparse
perfzero/lib/benchmark_test.py
tensorflow/benchmarks
train
1,182
5bc70628e80e7745f4ccd4caf5a7e25e799ec366
[ "return True\nif not attendee:\n return True\nevent = attendee.event\ndisable_ack_email = event.owner.groups.filter(name__iexact='disable ack email').count()\nif disable_ack_email:\n return True\nuser = attendee.attendee\nif user:\n email_template('[%s] Thanks for registering!' % settings.UI_SETTINGS['UI_S...
<|body_start_0|> return True if not attendee: return True event = attendee.event disable_ack_email = event.owner.groups.filter(name__iexact='disable ack email').count() if disable_ack_email: return True user = attendee.attendee if user: ...
AttendeeProcessor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AttendeeProcessor: def ack_attendee(self, attendee): """Send an email to the fan who registered for an event. Don't send email if the event owner belongs to the group 'Disable ack email'.""" <|body_0|> def event_faved(self, attendee): """Email users when a friend fav...
stack_v2_sparse_classes_36k_train_029823
7,085
no_license
[ { "docstring": "Send an email to the fan who registered for an event. Don't send email if the event owner belongs to the group 'Disable ack email'.", "name": "ack_attendee", "signature": "def ack_attendee(self, attendee)" }, { "docstring": "Email users when a friend favorites an event they've fa...
2
null
Implement the Python class `AttendeeProcessor` described below. Class description: Implement the AttendeeProcessor class. Method signatures and docstrings: - def ack_attendee(self, attendee): Send an email to the fan who registered for an event. Don't send email if the event owner belongs to the group 'Disable ack em...
Implement the Python class `AttendeeProcessor` described below. Class description: Implement the AttendeeProcessor class. Method signatures and docstrings: - def ack_attendee(self, attendee): Send an email to the fan who registered for an event. Don't send email if the event owner belongs to the group 'Disable ack em...
0992126edf1469f6d348f5064e42d38229a35637
<|skeleton|> class AttendeeProcessor: def ack_attendee(self, attendee): """Send an email to the fan who registered for an event. Don't send email if the event owner belongs to the group 'Disable ack email'.""" <|body_0|> def event_faved(self, attendee): """Email users when a friend fav...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AttendeeProcessor: def ack_attendee(self, attendee): """Send an email to the fan who registered for an event. Don't send email if the event owner belongs to the group 'Disable ack email'.""" return True if not attendee: return True event = attendee.event dis...
the_stack_v2_python_sparse
django-apps/event/queue_processor.py
kabirh/riotvine
train
1
7ce419484239945874650041c5a0fe02f16a476d
[ "if len(prices) == 0:\n return 0\nbuy = [0] * len(prices)\nsell = buy.copy()\nstop = buy.copy()\nbuy[0], sell[0], stop[0] = (-prices[0], 0, 0)\nfor i in range(1, len(prices)):\n buy[i] = max(stop[i - 1] - prices[i], buy[i - 1])\n sell[i] = buy[i - 1] + prices[i]\n stop[i] = max(stop[i - 1], sell[i - 1])...
<|body_start_0|> if len(prices) == 0: return 0 buy = [0] * len(prices) sell = buy.copy() stop = buy.copy() buy[0], sell[0], stop[0] = (-prices[0], 0, 0) for i in range(1, len(prices)): buy[i] = max(stop[i - 1] - prices[i], buy[i - 1]) s...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxProfit(self, prices): """:type prices: List[int] :rtype: int""" <|body_0|> def maxProfit_old(self, prices): """:type prices: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if len(prices) == 0: retu...
stack_v2_sparse_classes_36k_train_029824
1,097
permissive
[ { "docstring": ":type prices: List[int] :rtype: int", "name": "maxProfit", "signature": "def maxProfit(self, prices)" }, { "docstring": ":type prices: List[int] :rtype: int", "name": "maxProfit_old", "signature": "def maxProfit_old(self, prices)" } ]
2
stack_v2_sparse_classes_30k_train_018826
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices): :type prices: List[int] :rtype: int - def maxProfit_old(self, prices): :type prices: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices): :type prices: List[int] :rtype: int - def maxProfit_old(self, prices): :type prices: List[int] :rtype: int <|skeleton|> class Solution: def max...
d203aecd1afe1af13a0384a9c657c8424aab322d
<|skeleton|> class Solution: def maxProfit(self, prices): """:type prices: List[int] :rtype: int""" <|body_0|> def maxProfit_old(self, prices): """:type prices: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxProfit(self, prices): """:type prices: List[int] :rtype: int""" if len(prices) == 0: return 0 buy = [0] * len(prices) sell = buy.copy() stop = buy.copy() buy[0], sell[0], stop[0] = (-prices[0], 0, 0) for i in range(1, len(pri...
the_stack_v2_python_sparse
medium/Q309_BestTimeToBuyAndSellStockWithCooldown.py
Kaciras/leetcode
train
0
5b37a4471322a633d7ad60d4606ad9a5f6aaca7a
[ "self.maze = maze\nself.rat_1 = rat_1\nself.rat_2 = rat_2\nself.num_sprouts_left = 0\nfor i in range(len(self.maze)):\n row = self.maze[i]\n self.num_sprouts_left += row.count('@')", "if self.maze[row][col] == '#':\n return True\nelse:\n return False", "if row == self.rat_1.row and col == self.rat_1...
<|body_start_0|> self.maze = maze self.rat_1 = rat_1 self.rat_2 = rat_2 self.num_sprouts_left = 0 for i in range(len(self.maze)): row = self.maze[i] self.num_sprouts_left += row.count('@') <|end_body_0|> <|body_start_1|> if self.maze[row][col] == ...
A 2D maze.
Maze
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Maze: """A 2D maze.""" def __init__(self, maze, rat_1, rat_2): """(Maze, list of list of str, Rat, Rat) -> NoneType Initialize a maze with two rats. Args: maze (list of list of str): a maze with contents. rat_1 (object): the first rat in the maze. rat_2 (object): the second rat in th...
stack_v2_sparse_classes_36k_train_029825
6,001
permissive
[ { "docstring": "(Maze, list of list of str, Rat, Rat) -> NoneType Initialize a maze with two rats. Args: maze (list of list of str): a maze with contents. rat_1 (object): the first rat in the maze. rat_2 (object): the second rat in the maze. Example call: Maze([['#', '#', '#', '#', '#', '#', '#'], ['#', '.', '....
5
stack_v2_sparse_classes_30k_train_010375
Implement the Python class `Maze` described below. Class description: A 2D maze. Method signatures and docstrings: - def __init__(self, maze, rat_1, rat_2): (Maze, list of list of str, Rat, Rat) -> NoneType Initialize a maze with two rats. Args: maze (list of list of str): a maze with contents. rat_1 (object): the fi...
Implement the Python class `Maze` described below. Class description: A 2D maze. Method signatures and docstrings: - def __init__(self, maze, rat_1, rat_2): (Maze, list of list of str, Rat, Rat) -> NoneType Initialize a maze with two rats. Args: maze (list of list of str): a maze with contents. rat_1 (object): the fi...
ff265343635a0109b6deab31f2a112d304d020cb
<|skeleton|> class Maze: """A 2D maze.""" def __init__(self, maze, rat_1, rat_2): """(Maze, list of list of str, Rat, Rat) -> NoneType Initialize a maze with two rats. Args: maze (list of list of str): a maze with contents. rat_1 (object): the first rat in the maze. rat_2 (object): the second rat in th...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Maze: """A 2D maze.""" def __init__(self, maze, rat_1, rat_2): """(Maze, list of list of str, Rat, Rat) -> NoneType Initialize a maze with two rats. Args: maze (list of list of str): a maze with contents. rat_1 (object): the first rat in the maze. rat_2 (object): the second rat in the maze. Examp...
the_stack_v2_python_sparse
Crafting_Quality_Code_UniToronto/week5_functions/assignment/a2.py
bounty030/Coursera
train
1
fce59d35390e58115b540b80fb507735f53a267c
[ "valid, message = json_validate(nrange, {'type': 'object', 'properties': {'lower': {'$ref': '#/pScheduler/Numeric'}, 'upper': {'$ref': '#/pScheduler/Numeric'}}, 'additionalProperties': False, 'required': ['lower', 'upper']})\nif not valid:\n raise ValueError('Invalid numeric range: %s' % message)\nlower = nrange...
<|body_start_0|> valid, message = json_validate(nrange, {'type': 'object', 'properties': {'lower': {'$ref': '#/pScheduler/Numeric'}, 'upper': {'$ref': '#/pScheduler/Numeric'}}, 'additionalProperties': False, 'required': ['lower', 'upper']}) if not valid: raise ValueError('Invalid numeric ran...
Range of numbers
NumericRange
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumericRange: """Range of numbers""" def __init__(self, nrange): """Construct a range from a JSON NumericRange.""" <|body_0|> def __contains__(self, number): """See if the range contains the specified number, which can be any Numeric.""" <|body_1|> d...
stack_v2_sparse_classes_36k_train_029826
2,607
permissive
[ { "docstring": "Construct a range from a JSON NumericRange.", "name": "__init__", "signature": "def __init__(self, nrange)" }, { "docstring": "See if the range contains the specified number, which can be any Numeric.", "name": "__contains__", "signature": "def __contains__(self, number)"...
3
stack_v2_sparse_classes_30k_train_001348
Implement the Python class `NumericRange` described below. Class description: Range of numbers Method signatures and docstrings: - def __init__(self, nrange): Construct a range from a JSON NumericRange. - def __contains__(self, number): See if the range contains the specified number, which can be any Numeric. - def c...
Implement the Python class `NumericRange` described below. Class description: Range of numbers Method signatures and docstrings: - def __init__(self, nrange): Construct a range from a JSON NumericRange. - def __contains__(self, number): See if the range contains the specified number, which can be any Numeric. - def c...
f6d04c0455e5be4d490df16ec1acb377f9025d9f
<|skeleton|> class NumericRange: """Range of numbers""" def __init__(self, nrange): """Construct a range from a JSON NumericRange.""" <|body_0|> def __contains__(self, number): """See if the range contains the specified number, which can be any Numeric.""" <|body_1|> d...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NumericRange: """Range of numbers""" def __init__(self, nrange): """Construct a range from a JSON NumericRange.""" valid, message = json_validate(nrange, {'type': 'object', 'properties': {'lower': {'$ref': '#/pScheduler/Numeric'}, 'upper': {'$ref': '#/pScheduler/Numeric'}}, 'additionalPro...
the_stack_v2_python_sparse
python-pscheduler/pscheduler/pscheduler/numericrange.py
perfsonar/pscheduler
train
53
70c84f975ee6d31b632aa6e6ab35d66871b98887
[ "self.min_date = min([d for d, c in data]).date()\nself.max_date = max([d for d, c in data]).date()\nself.day_count = (self.max_date - self.min_date).days + 1\nself.dates = [self.min_date + timedelta(n) for n in range(self.day_count)]\nself.cameras = sorted(set([c for d, c in data]))\nself.per_camera = {c: {} for c...
<|body_start_0|> self.min_date = min([d for d, c in data]).date() self.max_date = max([d for d, c in data]).date() self.day_count = (self.max_date - self.min_date).days + 1 self.dates = [self.min_date + timedelta(n) for n in range(self.day_count)] self.cameras = sorted(set([c for...
Encapsulates a set of measured data for one or more cameras.
CameraData
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CameraData: """Encapsulates a set of measured data for one or more cameras.""" def __init__(self, data): """Initializes from a list of (datetime, camera) email tuples.""" <|body_0|> def createPlot(self): """Creates a comprehensive graphical output using current d...
stack_v2_sparse_classes_36k_train_029827
9,251
permissive
[ { "docstring": "Initializes from a list of (datetime, camera) email tuples.", "name": "__init__", "signature": "def __init__(self, data)" }, { "docstring": "Creates a comprehensive graphical output using current data.", "name": "createPlot", "signature": "def createPlot(self)" }, { ...
3
stack_v2_sparse_classes_30k_train_003831
Implement the Python class `CameraData` described below. Class description: Encapsulates a set of measured data for one or more cameras. Method signatures and docstrings: - def __init__(self, data): Initializes from a list of (datetime, camera) email tuples. - def createPlot(self): Creates a comprehensive graphical o...
Implement the Python class `CameraData` described below. Class description: Encapsulates a set of measured data for one or more cameras. Method signatures and docstrings: - def __init__(self, data): Initializes from a list of (datetime, camera) email tuples. - def createPlot(self): Creates a comprehensive graphical o...
cec8fae0c1872bbd91b244775bee18d5db831581
<|skeleton|> class CameraData: """Encapsulates a set of measured data for one or more cameras.""" def __init__(self, data): """Initializes from a list of (datetime, camera) email tuples.""" <|body_0|> def createPlot(self): """Creates a comprehensive graphical output using current d...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CameraData: """Encapsulates a set of measured data for one or more cameras.""" def __init__(self, data): """Initializes from a list of (datetime, camera) email tuples.""" self.min_date = min([d for d, c in data]).date() self.max_date = max([d for d, c in data]).date() self...
the_stack_v2_python_sparse
camera_event_trending.py
jodysankey/scripts
train
0
489f02def2ac5b3e94619dd971be18c8e82a4d98
[ "super(MySQLCompaniesTable, self).__init__(db_dict, dbtype, verbose)\nself.connectdb(db_dict, verbose)\nself._load_table()", "cursor = self.connection.cursor()\nsql = 'INSERT INTO Companies (CompanyName) VALUES (%s)'\ndata = company_name\ntry:\n cursor.execute(sql, (data,))\n self.connection.commit()\n a...
<|body_start_0|> super(MySQLCompaniesTable, self).__init__(db_dict, dbtype, verbose) self.connectdb(db_dict, verbose) self._load_table() <|end_body_0|> <|body_start_1|> cursor = self.connection.cursor() sql = 'INSERT INTO Companies (CompanyName) VALUES (%s)' data = compa...
Class representing the connection with a mysql database
MySQLCompaniesTable
[ "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MySQLCompaniesTable: """Class representing the connection with a mysql database""" def __init__(self, db_dict, dbtype, verbose): """Read the input file into a dictionary.""" <|body_0|> def insert(self, company_name): """Write a new record to the programs table of...
stack_v2_sparse_classes_36k_train_029828
9,313
permissive
[ { "docstring": "Read the input file into a dictionary.", "name": "__init__", "signature": "def __init__(self, db_dict, dbtype, verbose)" }, { "docstring": "Write a new record to the programs table of the database at the end of the database. Exceptions: Exception TODO clarify valid exceptions.", ...
4
stack_v2_sparse_classes_30k_train_007795
Implement the Python class `MySQLCompaniesTable` described below. Class description: Class representing the connection with a mysql database Method signatures and docstrings: - def __init__(self, db_dict, dbtype, verbose): Read the input file into a dictionary. - def insert(self, company_name): Write a new record to ...
Implement the Python class `MySQLCompaniesTable` described below. Class description: Class representing the connection with a mysql database Method signatures and docstrings: - def __init__(self, db_dict, dbtype, verbose): Read the input file into a dictionary. - def insert(self, company_name): Write a new record to ...
9c60b3489f02592bd9099b8719ca23ae43a9eaa5
<|skeleton|> class MySQLCompaniesTable: """Class representing the connection with a mysql database""" def __init__(self, db_dict, dbtype, verbose): """Read the input file into a dictionary.""" <|body_0|> def insert(self, company_name): """Write a new record to the programs table of...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MySQLCompaniesTable: """Class representing the connection with a mysql database""" def __init__(self, db_dict, dbtype, verbose): """Read the input file into a dictionary.""" super(MySQLCompaniesTable, self).__init__(db_dict, dbtype, verbose) self.connectdb(db_dict, verbose) ...
the_stack_v2_python_sparse
smipyping/_companiestable.py
KSchopmeyer/smipyping
train
0
e7c145dec3201b54e8f76bfbe8dc8c2d1f8c36a7
[ "if cls._is_tuple_or_list(model.exclude_compartments) and all((compartment in analysis_model.COMPARTMENTS for compartment in model.exclude_compartments)):\n return True\nreturn model.FIELD_TYPES.exclude_compartments", "if cls._is_tuple_or_list(model.exclude_measures) and all((measure in analysis_model.MEASURES...
<|body_start_0|> if cls._is_tuple_or_list(model.exclude_compartments) and all((compartment in analysis_model.COMPARTMENTS for compartment in model.exclude_compartments)): return True return model.FIELD_TYPES.exclude_compartments <|end_body_0|> <|body_start_1|> if cls._is_tuple_or_li...
XMLModelFactory
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class XMLModelFactory: def _validate_exclude_compartments(cls, model): """:type model: scanomatic.models.analysis_model.XMLModel""" <|body_0|> def _validate_exclude_measures(cls, model): """:type model: scanomatic.models.analysis_model.XMLModel""" <|body_1|> d...
stack_v2_sparse_classes_36k_train_029829
12,241
no_license
[ { "docstring": ":type model: scanomatic.models.analysis_model.XMLModel", "name": "_validate_exclude_compartments", "signature": "def _validate_exclude_compartments(cls, model)" }, { "docstring": ":type model: scanomatic.models.analysis_model.XMLModel", "name": "_validate_exclude_measures", ...
5
null
Implement the Python class `XMLModelFactory` described below. Class description: Implement the XMLModelFactory class. Method signatures and docstrings: - def _validate_exclude_compartments(cls, model): :type model: scanomatic.models.analysis_model.XMLModel - def _validate_exclude_measures(cls, model): :type model: sc...
Implement the Python class `XMLModelFactory` described below. Class description: Implement the XMLModelFactory class. Method signatures and docstrings: - def _validate_exclude_compartments(cls, model): :type model: scanomatic.models.analysis_model.XMLModel - def _validate_exclude_measures(cls, model): :type model: sc...
db5dd2e8501d9db8fb0fd8fbf5c9ddd652ae8fdf
<|skeleton|> class XMLModelFactory: def _validate_exclude_compartments(cls, model): """:type model: scanomatic.models.analysis_model.XMLModel""" <|body_0|> def _validate_exclude_measures(cls, model): """:type model: scanomatic.models.analysis_model.XMLModel""" <|body_1|> d...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class XMLModelFactory: def _validate_exclude_compartments(cls, model): """:type model: scanomatic.models.analysis_model.XMLModel""" if cls._is_tuple_or_list(model.exclude_compartments) and all((compartment in analysis_model.COMPARTMENTS for compartment in model.exclude_compartments)): re...
the_stack_v2_python_sparse
scanomatic/models/factories/analysis_factories.py
StenbergSimon/scanomatic
train
0
91b6ee9a49216fe43b30c0d9fd23df2cb65dd2b1
[ "if v2_data is not None:\n assert_equal(consensusBranchId, NU5_BRANCH_ID)\n orchard_root = v2_data[0]\n orchard_tx_count = v2_data[1]\nelse:\n orchard_root = None\n orchard_tx_count = None\nnode = Z()\nnode.left_child = None\nnode.right_child = None\nnode.hashSubtreeCommitment = ser_uint256(block.reh...
<|body_start_0|> if v2_data is not None: assert_equal(consensusBranchId, NU5_BRANCH_ID) orchard_root = v2_data[0] orchard_tx_count = v2_data[1] else: orchard_root = None orchard_tx_count = None node = Z() node.left_child = None ...
ZcashMMRNode
[ "MIT", "AGPL-3.0-only", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ZcashMMRNode: def from_block(Z, block: CBlockHeader, height, sapling_root, sapling_tx_count, consensusBranchId, v2_data=None) -> 'ZcashMMRNode': """Create a leaf node from a block""" <|body_0|> def serialize(self) -> bytes: """serializes a node""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_029830
7,791
permissive
[ { "docstring": "Create a leaf node from a block", "name": "from_block", "signature": "def from_block(Z, block: CBlockHeader, height, sapling_root, sapling_tx_count, consensusBranchId, v2_data=None) -> 'ZcashMMRNode'" }, { "docstring": "serializes a node", "name": "serialize", "signature"...
2
stack_v2_sparse_classes_30k_train_005029
Implement the Python class `ZcashMMRNode` described below. Class description: Implement the ZcashMMRNode class. Method signatures and docstrings: - def from_block(Z, block: CBlockHeader, height, sapling_root, sapling_tx_count, consensusBranchId, v2_data=None) -> 'ZcashMMRNode': Create a leaf node from a block - def s...
Implement the Python class `ZcashMMRNode` described below. Class description: Implement the ZcashMMRNode class. Method signatures and docstrings: - def from_block(Z, block: CBlockHeader, height, sapling_root, sapling_tx_count, consensusBranchId, v2_data=None) -> 'ZcashMMRNode': Create a leaf node from a block - def s...
e3c9773eead914811aaa12fc0c4abedd65c38647
<|skeleton|> class ZcashMMRNode: def from_block(Z, block: CBlockHeader, height, sapling_root, sapling_tx_count, consensusBranchId, v2_data=None) -> 'ZcashMMRNode': """Create a leaf node from a block""" <|body_0|> def serialize(self) -> bytes: """serializes a node""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ZcashMMRNode: def from_block(Z, block: CBlockHeader, height, sapling_root, sapling_tx_count, consensusBranchId, v2_data=None) -> 'ZcashMMRNode': """Create a leaf node from a block""" if v2_data is not None: assert_equal(consensusBranchId, NU5_BRANCH_ID) orchard_root = v...
the_stack_v2_python_sparse
qa/rpc-tests/test_framework/flyclient.py
KotoDevelopers/koto
train
29
9edfe7b6b6975679d226626fc0f2427c66629949
[ "if not nums:\n return 0\nelif len(nums) <= 2:\n return max(nums)\ngems = [[] for _ in range(len(nums))]\nfor index, num in enumerate(nums):\n if index < 1:\n gems[index] = [1, num]\n elif index < 2:\n if gems[index - 1][1] > num:\n gems[index] = gems[index - 1]\n else:\n...
<|body_start_0|> if not nums: return 0 elif len(nums) <= 2: return max(nums) gems = [[] for _ in range(len(nums))] for index, num in enumerate(nums): if index < 1: gems[index] = [1, num] elif index < 2: if ge...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def _rob(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def rob(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not nums: return 0 elif len(nums) <= ...
stack_v2_sparse_classes_36k_train_029831
3,627
permissive
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "_rob", "signature": "def _rob(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "rob", "signature": "def rob(self, nums)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def _rob(self, nums): :type nums: List[int] :rtype: int - def rob(self, nums): :type nums: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def _rob(self, nums): :type nums: List[int] :rtype: int - def rob(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution: def _rob(self, nums): ...
0dd67edca4e0b0323cb5a7239f02ea46383cd15a
<|skeleton|> class Solution: def _rob(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def rob(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 _rob(self, nums): """:type nums: List[int] :rtype: int""" if not nums: return 0 elif len(nums) <= 2: return max(nums) gems = [[] for _ in range(len(nums))] for index, num in enumerate(nums): if index < 1: ...
the_stack_v2_python_sparse
213.house-robber-ii.py
windard/leeeeee
train
0
eb23d06501f372fbb7791eb29f62afb13092a295
[ "with open(sql_filename, 'r') as sql_file:\n sql = sql_file.read()\nwith connection.cursor() as cursor:\n cursor.execute(sql, params)\n desc = cursor.description\n data = [dict(zip([col[0] for col in desc], row)) for row in cursor.fetchall()]\nreturn data", "unique_dict = {}\nunique_fields = self.get_...
<|body_start_0|> with open(sql_filename, 'r') as sql_file: sql = sql_file.read() with connection.cursor() as cursor: cursor.execute(sql, params) desc = cursor.description data = [dict(zip([col[0] for col in desc], row)) for row in cursor.fetchall()] ...
ApiHelper
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ApiHelper: def run_query(self, sql_filename=None, params=None): """Run query from a given sql file using the given parameters""" <|body_0|> def get_unique_dict(self, obj, data): """Get a sict of <field_name>: <field_value> Fields of the given object with a unique con...
stack_v2_sparse_classes_36k_train_029832
1,392
no_license
[ { "docstring": "Run query from a given sql file using the given parameters", "name": "run_query", "signature": "def run_query(self, sql_filename=None, params=None)" }, { "docstring": "Get a sict of <field_name>: <field_value> Fields of the given object with a unique constraint and supplied data"...
2
stack_v2_sparse_classes_30k_val_000146
Implement the Python class `ApiHelper` described below. Class description: Implement the ApiHelper class. Method signatures and docstrings: - def run_query(self, sql_filename=None, params=None): Run query from a given sql file using the given parameters - def get_unique_dict(self, obj, data): Get a sict of <field_nam...
Implement the Python class `ApiHelper` described below. Class description: Implement the ApiHelper class. Method signatures and docstrings: - def run_query(self, sql_filename=None, params=None): Run query from a given sql file using the given parameters - def get_unique_dict(self, obj, data): Get a sict of <field_nam...
351532fcfad8cb93658f333be95c70b53eab9171
<|skeleton|> class ApiHelper: def run_query(self, sql_filename=None, params=None): """Run query from a given sql file using the given parameters""" <|body_0|> def get_unique_dict(self, obj, data): """Get a sict of <field_name>: <field_value> Fields of the given object with a unique con...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ApiHelper: def run_query(self, sql_filename=None, params=None): """Run query from a given sql file using the given parameters""" with open(sql_filename, 'r') as sql_file: sql = sql_file.read() with connection.cursor() as cursor: cursor.execute(sql, params) ...
the_stack_v2_python_sparse
cbmsapi/apis/apihelper.py
dmostroff/cbmsapi
train
0
4288fa7532d098a3554ed69b536c8d502f0b6f9b
[ "flags.AddNodePoolNameArg(parser, 'The name of the node pool to delete.')\nparser.add_argument('--timeout', type=int, default=1800, hidden=True, help='THIS ARGUMENT NEEDS HELP TEXT.')\nflags.AddAsyncFlag(parser)\nflags.AddNodePoolClusterFlag(parser, 'The cluster from which to delete the node pool.')", "adapter = ...
<|body_start_0|> flags.AddNodePoolNameArg(parser, 'The name of the node pool to delete.') parser.add_argument('--timeout', type=int, default=1800, hidden=True, help='THIS ARGUMENT NEEDS HELP TEXT.') flags.AddAsyncFlag(parser) flags.AddNodePoolClusterFlag(parser, 'The cluster from which t...
Delete an existing node pool in a running cluster.
Delete
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Delete: """Delete an existing node pool in a running cluster.""" def Args(parser): """Register flags for this command. Args: parser: An argparse.ArgumentParser-like object. It is mocked out in order to capture some information, but behaves like an ArgumentParser.""" <|body_0|...
stack_v2_sparse_classes_36k_train_029833
3,844
permissive
[ { "docstring": "Register flags for this command. Args: parser: An argparse.ArgumentParser-like object. It is mocked out in order to capture some information, but behaves like an ArgumentParser.", "name": "Args", "signature": "def Args(parser)" }, { "docstring": "This is what gets called when the...
2
null
Implement the Python class `Delete` described below. Class description: Delete an existing node pool in a running cluster. Method signatures and docstrings: - def Args(parser): Register flags for this command. Args: parser: An argparse.ArgumentParser-like object. It is mocked out in order to capture some information,...
Implement the Python class `Delete` described below. Class description: Delete an existing node pool in a running cluster. Method signatures and docstrings: - def Args(parser): Register flags for this command. Args: parser: An argparse.ArgumentParser-like object. It is mocked out in order to capture some information,...
85bb264e273568b5a0408f733b403c56373e2508
<|skeleton|> class Delete: """Delete an existing node pool in a running cluster.""" def Args(parser): """Register flags for this command. Args: parser: An argparse.ArgumentParser-like object. It is mocked out in order to capture some information, but behaves like an ArgumentParser.""" <|body_0|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Delete: """Delete an existing node pool in a running cluster.""" def Args(parser): """Register flags for this command. Args: parser: An argparse.ArgumentParser-like object. It is mocked out in order to capture some information, but behaves like an ArgumentParser.""" flags.AddNodePoolNameA...
the_stack_v2_python_sparse
google-cloud-sdk/lib/surface/container/node_pools/delete.py
bopopescu/socialliteapp
train
0
30e99d032647863d6611bb9a2c3834a91ea5a965
[ "self.x = x\nself.y = y\nself.r = r\nself.dx = dx\nself.dy = dy\nself.color = color", "glPushMatrix()\nglColor4f(*self.color)\nglTranslatef(self.x, self.y, 0)\nq = gluNewQuadric()\nslices = min(360, 6 * self.r)\ngluDisk(q, 0, self.r, slices, 1)\nglPopMatrix()\nreturn", "if self.y - self.r < 0:\n game_info.ov...
<|body_start_0|> self.x = x self.y = y self.r = r self.dx = dx self.dy = dy self.color = color <|end_body_0|> <|body_start_1|> glPushMatrix() glColor4f(*self.color) glTranslatef(self.x, self.y, 0) q = gluNewQuadric() slices = min(3...
Ball object that knows how to draw itself
Ball
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Ball: """Ball object that knows how to draw itself""" def __init__(self, x, y, r, dx=120, dy=120, color=(1.0, 1.0, 1.0, 1.0)): """circle of radius r centered at (x, y) and opaque white by default""" <|body_0|> def draw(self): """draws a circle""" <|body_1...
stack_v2_sparse_classes_36k_train_029834
2,406
no_license
[ { "docstring": "circle of radius r centered at (x, y) and opaque white by default", "name": "__init__", "signature": "def __init__(self, x, y, r, dx=120, dy=120, color=(1.0, 1.0, 1.0, 1.0))" }, { "docstring": "draws a circle", "name": "draw", "signature": "def draw(self)" }, { "d...
3
null
Implement the Python class `Ball` described below. Class description: Ball object that knows how to draw itself Method signatures and docstrings: - def __init__(self, x, y, r, dx=120, dy=120, color=(1.0, 1.0, 1.0, 1.0)): circle of radius r centered at (x, y) and opaque white by default - def draw(self): draws a circl...
Implement the Python class `Ball` described below. Class description: Ball object that knows how to draw itself Method signatures and docstrings: - def __init__(self, x, y, r, dx=120, dy=120, color=(1.0, 1.0, 1.0, 1.0)): circle of radius r centered at (x, y) and opaque white by default - def draw(self): draws a circl...
dd721e096f8445aee48e69c3a3ebf6501aecc95b
<|skeleton|> class Ball: """Ball object that knows how to draw itself""" def __init__(self, x, y, r, dx=120, dy=120, color=(1.0, 1.0, 1.0, 1.0)): """circle of radius r centered at (x, y) and opaque white by default""" <|body_0|> def draw(self): """draws a circle""" <|body_1...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Ball: """Ball object that knows how to draw itself""" def __init__(self, x, y, r, dx=120, dy=120, color=(1.0, 1.0, 1.0, 1.0)): """circle of radius r centered at (x, y) and opaque white by default""" self.x = x self.y = y self.r = r self.dx = dx self.dy = dy...
the_stack_v2_python_sparse
game_tut/breakout_py/break6.py
aroberge/py-fun
train
0
beb3aa7398d745119f4e74b9b240dfcc23efad51
[ "self.name = 'connectome_stage'\nself.bids_dir = bids_dir\nself.output_dir = output_dir\nself.config = ConnectomeConfig()\nself.inputs = ['roi_volumes_registered', 'func_file', 'FD', 'DVARS', 'parcellation_scheme', 'atlas_info', 'roi_graphMLs']\nself.outputs = ['connectivity_matrices', 'avg_timeseries']", "cmtk_c...
<|body_start_0|> self.name = 'connectome_stage' self.bids_dir = bids_dir self.output_dir = output_dir self.config = ConnectomeConfig() self.inputs = ['roi_volumes_registered', 'func_file', 'FD', 'DVARS', 'parcellation_scheme', 'atlas_info', 'roi_graphMLs'] self.outputs = ...
Class that represents the connectome building stage of a :class:`~cmp.pipelines.functional.fMRI.fMRIPipeline`. Methods ------- create_workflow() Create the workflow of the fMRI `ConnectomeStage` See Also -------- cmp.pipelines.functional.fMRI.fMRIPipeline cmp.stages.connectome.fmri_connectome.ConnectomeConfig
ConnectomeStage
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConnectomeStage: """Class that represents the connectome building stage of a :class:`~cmp.pipelines.functional.fMRI.fMRIPipeline`. Methods ------- create_workflow() Create the workflow of the fMRI `ConnectomeStage` See Also -------- cmp.pipelines.functional.fMRI.fMRIPipeline cmp.stages.connectome...
stack_v2_sparse_classes_36k_train_029835
7,737
permissive
[ { "docstring": "Constructor of a :class:`~cmp.stages.connectome.fmri_connectome.Connectome` instance.", "name": "__init__", "signature": "def __init__(self, bids_dir, output_dir)" }, { "docstring": "Create the stage worflow. Parameters ---------- flow : nipype.pipeline.engine.Workflow The nipype...
3
stack_v2_sparse_classes_30k_test_000309
Implement the Python class `ConnectomeStage` described below. Class description: Class that represents the connectome building stage of a :class:`~cmp.pipelines.functional.fMRI.fMRIPipeline`. Methods ------- create_workflow() Create the workflow of the fMRI `ConnectomeStage` See Also -------- cmp.pipelines.functional....
Implement the Python class `ConnectomeStage` described below. Class description: Class that represents the connectome building stage of a :class:`~cmp.pipelines.functional.fMRI.fMRIPipeline`. Methods ------- create_workflow() Create the workflow of the fMRI `ConnectomeStage` See Also -------- cmp.pipelines.functional....
35cb2ee7be2e73896061359a6cd0a10503fadd42
<|skeleton|> class ConnectomeStage: """Class that represents the connectome building stage of a :class:`~cmp.pipelines.functional.fMRI.fMRIPipeline`. Methods ------- create_workflow() Create the workflow of the fMRI `ConnectomeStage` See Also -------- cmp.pipelines.functional.fMRI.fMRIPipeline cmp.stages.connectome...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ConnectomeStage: """Class that represents the connectome building stage of a :class:`~cmp.pipelines.functional.fMRI.fMRIPipeline`. Methods ------- create_workflow() Create the workflow of the fMRI `ConnectomeStage` See Also -------- cmp.pipelines.functional.fMRI.fMRIPipeline cmp.stages.connectome.fmri_connect...
the_stack_v2_python_sparse
cmp/stages/connectome/fmri_connectome.py
jwirsich/connectomemapper3
train
0
6d5deed41066b7f42ebcd288c69b8c86b4a7e95e
[ "self.allowed_url_patterns = allowed_url_patterns\nself.blocked_url_patterns = blocked_url_patterns\nself.blocked_url_categories = blocked_url_categories\nself.url_category_list_size = url_category_list_size", "if dictionary is None:\n return None\nallowed_url_patterns = dictionary.get('allowedUrlPatterns')\nb...
<|body_start_0|> self.allowed_url_patterns = allowed_url_patterns self.blocked_url_patterns = blocked_url_patterns self.blocked_url_categories = blocked_url_categories self.url_category_list_size = url_category_list_size <|end_body_0|> <|body_start_1|> if dictionary is None: ...
Implementation of the 'updateNetworkContentFiltering' model. TODO: type model description here. Attributes: allowed_url_patterns (list of string): A whitelist of URL patterns to allow blocked_url_patterns (list of string): A blacklist of URL patterns to block blocked_url_categories (list of string): A list of URL categ...
UpdateNetworkContentFilteringModel
[ "MIT", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UpdateNetworkContentFilteringModel: """Implementation of the 'updateNetworkContentFiltering' model. TODO: type model description here. Attributes: allowed_url_patterns (list of string): A whitelist of URL patterns to allow blocked_url_patterns (list of string): A blacklist of URL patterns to bloc...
stack_v2_sparse_classes_36k_train_029836
2,755
permissive
[ { "docstring": "Constructor for the UpdateNetworkContentFilteringModel class", "name": "__init__", "signature": "def __init__(self, allowed_url_patterns=None, blocked_url_patterns=None, blocked_url_categories=None, url_category_list_size=None)" }, { "docstring": "Creates an instance of this mode...
2
null
Implement the Python class `UpdateNetworkContentFilteringModel` described below. Class description: Implementation of the 'updateNetworkContentFiltering' model. TODO: type model description here. Attributes: allowed_url_patterns (list of string): A whitelist of URL patterns to allow blocked_url_patterns (list of strin...
Implement the Python class `UpdateNetworkContentFilteringModel` described below. Class description: Implementation of the 'updateNetworkContentFiltering' model. TODO: type model description here. Attributes: allowed_url_patterns (list of string): A whitelist of URL patterns to allow blocked_url_patterns (list of strin...
9894089eb013318243ae48869cc5130eb37f80c0
<|skeleton|> class UpdateNetworkContentFilteringModel: """Implementation of the 'updateNetworkContentFiltering' model. TODO: type model description here. Attributes: allowed_url_patterns (list of string): A whitelist of URL patterns to allow blocked_url_patterns (list of string): A blacklist of URL patterns to bloc...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UpdateNetworkContentFilteringModel: """Implementation of the 'updateNetworkContentFiltering' model. TODO: type model description here. Attributes: allowed_url_patterns (list of string): A whitelist of URL patterns to allow blocked_url_patterns (list of string): A blacklist of URL patterns to block blocked_url...
the_stack_v2_python_sparse
meraki_sdk/models/update_network_content_filtering_model.py
RaulCatalano/meraki-python-sdk
train
1
ae5cbd882c78ebb5413b5c645474fa006abb3c63
[ "model = MEGNet(n_node_features=n_node_features, n_edge_features=n_edge_features, n_global_features=n_global_features, n_blocks=n_blocks, is_undirected=is_undirected, residual_connection=residual_connection, mode=mode, n_classes=n_classes, n_tasks=n_tasks)\nif mode == 'regression':\n loss: Loss = L2Loss()\n o...
<|body_start_0|> model = MEGNet(n_node_features=n_node_features, n_edge_features=n_edge_features, n_global_features=n_global_features, n_blocks=n_blocks, is_undirected=is_undirected, residual_connection=residual_connection, mode=mode, n_classes=n_classes, n_tasks=n_tasks) if mode == 'regression': ...
MatErials Graph Network for Molecules and Crystals MatErials Graph Network [1]_ are Graph Networks [2]_ which are used for property prediction in molecules and crystals. The model implements multiple layers of Graph Network as MEGNetBlocks and then combines the node properties and edge properties of all nodes and edges...
MEGNetModel
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MEGNetModel: """MatErials Graph Network for Molecules and Crystals MatErials Graph Network [1]_ are Graph Networks [2]_ which are used for property prediction in molecules and crystals. The model implements multiple layers of Graph Network as MEGNetBlocks and then combines the node properties and...
stack_v2_sparse_classes_36k_train_029837
11,170
permissive
[ { "docstring": "Parameters ---------- n_node_features: int Number of features in a node n_edge_features: int Number of features in a edge n_global_features: int Number of global features n_blocks: int Number of GraphNetworks block to use in update is_undirected: bool, optional (default True) True when the model...
2
stack_v2_sparse_classes_30k_train_005746
Implement the Python class `MEGNetModel` described below. Class description: MatErials Graph Network for Molecules and Crystals MatErials Graph Network [1]_ are Graph Networks [2]_ which are used for property prediction in molecules and crystals. The model implements multiple layers of Graph Network as MEGNetBlocks an...
Implement the Python class `MEGNetModel` described below. Class description: MatErials Graph Network for Molecules and Crystals MatErials Graph Network [1]_ are Graph Networks [2]_ which are used for property prediction in molecules and crystals. The model implements multiple layers of Graph Network as MEGNetBlocks an...
ee6e67ebcf7bf04259cf13aff6388e2b791fea3d
<|skeleton|> class MEGNetModel: """MatErials Graph Network for Molecules and Crystals MatErials Graph Network [1]_ are Graph Networks [2]_ which are used for property prediction in molecules and crystals. The model implements multiple layers of Graph Network as MEGNetBlocks and then combines the node properties and...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MEGNetModel: """MatErials Graph Network for Molecules and Crystals MatErials Graph Network [1]_ are Graph Networks [2]_ which are used for property prediction in molecules and crystals. The model implements multiple layers of Graph Network as MEGNetBlocks and then combines the node properties and edge propert...
the_stack_v2_python_sparse
deepchem/models/torch_models/megnet.py
deepchem/deepchem
train
4,876
ffb8724a648d8cc3de42663942e08dc2404c46f3
[ "self.flag = flag\nif city == '北京':\n self.city = 'beijing'\nelif city == '上海':\n self.city = 'shanghai'\nelse:\n self.city = 'guangzhou'\nself.real_time = 'https://api.seniverse.com/v3/weather/now.json?key=******=' + self.city + '&language=zh-Hans&unit=c'\nself.nearly_3_days = 'https://api.seniverse.com/v...
<|body_start_0|> self.flag = flag if city == '北京': self.city = 'beijing' elif city == '上海': self.city = 'shanghai' else: self.city = 'guangzhou' self.real_time = 'https://api.seniverse.com/v3/weather/now.json?key=******=' + self.city + '&langua...
使用API获取天气
GetWeatherInfo
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GetWeatherInfo: """使用API获取天气""" def __init__(self, flag, city): """一些初始设置""" <|body_0|> def getweather(self): """根据API的返回值,以及究竟是实时天气还是近三天天气,返回给调用该函数变量""" <|body_1|> def internet(self, url): """requests库访问API,获取天气信息""" <|body_2|> <|en...
stack_v2_sparse_classes_36k_train_029838
2,226
no_license
[ { "docstring": "一些初始设置", "name": "__init__", "signature": "def __init__(self, flag, city)" }, { "docstring": "根据API的返回值,以及究竟是实时天气还是近三天天气,返回给调用该函数变量", "name": "getweather", "signature": "def getweather(self)" }, { "docstring": "requests库访问API,获取天气信息", "name": "internet", "...
3
null
Implement the Python class `GetWeatherInfo` described below. Class description: 使用API获取天气 Method signatures and docstrings: - def __init__(self, flag, city): 一些初始设置 - def getweather(self): 根据API的返回值,以及究竟是实时天气还是近三天天气,返回给调用该函数变量 - def internet(self, url): requests库访问API,获取天气信息
Implement the Python class `GetWeatherInfo` described below. Class description: 使用API获取天气 Method signatures and docstrings: - def __init__(self, flag, city): 一些初始设置 - def getweather(self): 根据API的返回值,以及究竟是实时天气还是近三天天气,返回给调用该函数变量 - def internet(self, url): requests库访问API,获取天气信息 <|skeleton|> class GetWeatherInfo: ""...
4d4c44365d5d0bf3d9fd94922a13d0b50f17a95c
<|skeleton|> class GetWeatherInfo: """使用API获取天气""" def __init__(self, flag, city): """一些初始设置""" <|body_0|> def getweather(self): """根据API的返回值,以及究竟是实时天气还是近三天天气,返回给调用该函数变量""" <|body_1|> def internet(self, url): """requests库访问API,获取天气信息""" <|body_2|> <|en...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GetWeatherInfo: """使用API获取天气""" def __init__(self, flag, city): """一些初始设置""" self.flag = flag if city == '北京': self.city = 'beijing' elif city == '上海': self.city = 'shanghai' else: self.city = 'guangzhou' self.real_time =...
the_stack_v2_python_sparse
PyQt5All/PyQt550/getweather.py
redmorningcn/PyQT5Example
train
1
871d8ce3c2c6b715da49ecae34b674ca09abe802
[ "if m == 1 or n == 1:\n return 1\nreturn self.uniquePaths(m - 1, n) + self.uniquePaths(m, n - 1)", "ans = [[1 for _ in range(n)] for _ in range(m)]\nfor row in range(1, m):\n for col in range(1, n):\n ans[row][col] = ans[row - 1][col] + ans[row][col - 1]\nreturn ans[-1][-1]" ]
<|body_start_0|> if m == 1 or n == 1: return 1 return self.uniquePaths(m - 1, n) + self.uniquePaths(m, n - 1) <|end_body_0|> <|body_start_1|> ans = [[1 for _ in range(n)] for _ in range(m)] for row in range(1, m): for col in range(1, n): ans[row][...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def uniquePaths(self, m: int, n: int) -> int: """递归的思想,不过注意使用缓存,不然会大量重复计算,超时 :param m: :param n: :return:""" <|body_0|> def uniquePaths_2(self, m: int, n: int) -> int: """动态规划思想 :param m: :param n: :return:""" <|body_1|> <|end_skeleton|> <|body_st...
stack_v2_sparse_classes_36k_train_029839
919
no_license
[ { "docstring": "递归的思想,不过注意使用缓存,不然会大量重复计算,超时 :param m: :param n: :return:", "name": "uniquePaths", "signature": "def uniquePaths(self, m: int, n: int) -> int" }, { "docstring": "动态规划思想 :param m: :param n: :return:", "name": "uniquePaths_2", "signature": "def uniquePaths_2(self, m: int, n:...
2
stack_v2_sparse_classes_30k_train_009346
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def uniquePaths(self, m: int, n: int) -> int: 递归的思想,不过注意使用缓存,不然会大量重复计算,超时 :param m: :param n: :return: - def uniquePaths_2(self, m: int, n: int) -> int: 动态规划思想 :param m: :param n...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def uniquePaths(self, m: int, n: int) -> int: 递归的思想,不过注意使用缓存,不然会大量重复计算,超时 :param m: :param n: :return: - def uniquePaths_2(self, m: int, n: int) -> int: 动态规划思想 :param m: :param n...
f2c162654a83c51495ebd161f42a1d0b69caf72d
<|skeleton|> class Solution: def uniquePaths(self, m: int, n: int) -> int: """递归的思想,不过注意使用缓存,不然会大量重复计算,超时 :param m: :param n: :return:""" <|body_0|> def uniquePaths_2(self, m: int, n: int) -> int: """动态规划思想 :param m: :param n: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def uniquePaths(self, m: int, n: int) -> int: """递归的思想,不过注意使用缓存,不然会大量重复计算,超时 :param m: :param n: :return:""" if m == 1 or n == 1: return 1 return self.uniquePaths(m - 1, n) + self.uniquePaths(m, n - 1) def uniquePaths_2(self, m: int, n: int) -> int: "...
the_stack_v2_python_sparse
62 uniquePaths.py
ABenxj/leetcode
train
1
4967435a522581d9c1b420c57066b42bcd8a4ab1
[ "self._bucket_capacity = 997\nself._capacity = 10 ** 6\nself._no_of_buckets = math.ceil(self._capacity / self._bucket_capacity)\nself._buckets = [Node(None) for _ in range(self._no_of_buckets)]", "bucket = self._buckets[key % self._bucket_capacity]\nnode = bucket\nprev = None\nwhile node:\n if node.val and nod...
<|body_start_0|> self._bucket_capacity = 997 self._capacity = 10 ** 6 self._no_of_buckets = math.ceil(self._capacity / self._bucket_capacity) self._buckets = [Node(None) for _ in range(self._no_of_buckets)] <|end_body_0|> <|body_start_1|> bucket = self._buckets[key % self._bucke...
MyHashMap
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyHashMap: def __init__(self): """Initialize your data structure here.""" <|body_0|> def put(self, key: int, value: int) -> None: """value will always be non-negative.""" <|body_1|> def get(self, key: int) -> int: """Returns the value to which th...
stack_v2_sparse_classes_36k_train_029840
1,953
no_license
[ { "docstring": "Initialize your data structure here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "value will always be non-negative.", "name": "put", "signature": "def put(self, key: int, value: int) -> None" }, { "docstring": "Returns the value to w...
4
stack_v2_sparse_classes_30k_train_017541
Implement the Python class `MyHashMap` described below. Class description: Implement the MyHashMap class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def put(self, key: int, value: int) -> None: value will always be non-negative. - def get(self, key: int) -> int: Ret...
Implement the Python class `MyHashMap` described below. Class description: Implement the MyHashMap class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def put(self, key: int, value: int) -> None: value will always be non-negative. - def get(self, key: int) -> int: Ret...
b7d3b9e2f45ba68a121951c0ca138bf94f035b26
<|skeleton|> class MyHashMap: def __init__(self): """Initialize your data structure here.""" <|body_0|> def put(self, key: int, value: int) -> None: """value will always be non-negative.""" <|body_1|> def get(self, key: int) -> int: """Returns the value to which th...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MyHashMap: def __init__(self): """Initialize your data structure here.""" self._bucket_capacity = 997 self._capacity = 10 ** 6 self._no_of_buckets = math.ceil(self._capacity / self._bucket_capacity) self._buckets = [Node(None) for _ in range(self._no_of_buckets)] d...
the_stack_v2_python_sparse
hash/design_hashmap.py
uma-c/CodingProblemSolving
train
0
b48b3e974502844fdaa550616e7897dff20d0d27
[ "M = len(nums1)\nN = len(nums2)\nif (N + M) % 2 == 0:\n K1 = (M + N) / 2\n K2 = (M + N) / 2 + 1\n val1 = self.find_k_Largest(nums1, nums2, K1)\n val2 = self.find_k_Largest(nums1, nums2, K2)\n return (val1 + val2) / 2.0\nelse:\n K = (M + N - 1) / 2 + 1\n return self.find_k_Largest(nums1, nums2, ...
<|body_start_0|> M = len(nums1) N = len(nums2) if (N + M) % 2 == 0: K1 = (M + N) / 2 K2 = (M + N) / 2 + 1 val1 = self.find_k_Largest(nums1, nums2, K1) val2 = self.find_k_Largest(nums1, nums2, K2) return (val1 + val2) / 2.0 else:...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findMedianSortedArrays(self, nums1, nums2): """:type nums1: List[int] :type nums2: List[int] :rtype: float""" <|body_0|> def find_k_Largest(self, nums1, nums2, k): """if len(nums1) > k: nums1 = list(nums1[:k]) if len(nums2) > k: nums2 = list(nums2[:k])"...
stack_v2_sparse_classes_36k_train_029841
1,672
permissive
[ { "docstring": ":type nums1: List[int] :type nums2: List[int] :rtype: float", "name": "findMedianSortedArrays", "signature": "def findMedianSortedArrays(self, nums1, nums2)" }, { "docstring": "if len(nums1) > k: nums1 = list(nums1[:k]) if len(nums2) > k: nums2 = list(nums2[:k])", "name": "fi...
2
stack_v2_sparse_classes_30k_test_000430
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMedianSortedArrays(self, nums1, nums2): :type nums1: List[int] :type nums2: List[int] :rtype: float - def find_k_Largest(self, nums1, nums2, k): if len(nums1) > k: nums1 ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMedianSortedArrays(self, nums1, nums2): :type nums1: List[int] :type nums2: List[int] :rtype: float - def find_k_Largest(self, nums1, nums2, k): if len(nums1) > k: nums1 ...
c8633ea7a36d97e4b5e45f33f8c339660e9c2d87
<|skeleton|> class Solution: def findMedianSortedArrays(self, nums1, nums2): """:type nums1: List[int] :type nums2: List[int] :rtype: float""" <|body_0|> def find_k_Largest(self, nums1, nums2, k): """if len(nums1) > k: nums1 = list(nums1[:k]) if len(nums2) > k: nums2 = list(nums2[:k])"...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findMedianSortedArrays(self, nums1, nums2): """:type nums1: List[int] :type nums2: List[int] :rtype: float""" M = len(nums1) N = len(nums2) if (N + M) % 2 == 0: K1 = (M + N) / 2 K2 = (M + N) / 2 + 1 val1 = self.find_k_Largest(nu...
the_stack_v2_python_sparse
Algorithms/#4 Median of Two Sorted Arrays/PythonCode.py
yingcuhk/LeetCode
train
3
c4fc4e689e78eeb136fe092005f8c4d275915ec8
[ "left = node.left != None\nright = node.right != None\nif not left and (not right):\n if cur_sum == node.val:\n foundSoFar.append(pathSoFar)\n return\nif left:\n self.helper(node.left, cur_sum - node.val, pathSoFar + [node.left.val], foundSoFar)\nif right:\n self.helper(node.right, cur_sum - node...
<|body_start_0|> left = node.left != None right = node.right != None if not left and (not right): if cur_sum == node.val: foundSoFar.append(pathSoFar) return if left: self.helper(node.left, cur_sum - node.val, pathSoFar + [node.left.val...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def helper(self, node, cur_sum, pathSoFar, foundSoFar): """:type node: TreeNode :type cur_sum: int :type pathSoFar: List[int] :type foundSoFar: List[List[int]] :rtype: None? List[List[int]]?""" <|body_0|> def pathSum(self, root, cur_sum): """:type root: Tre...
stack_v2_sparse_classes_36k_train_029842
1,181
no_license
[ { "docstring": ":type node: TreeNode :type cur_sum: int :type pathSoFar: List[int] :type foundSoFar: List[List[int]] :rtype: None? List[List[int]]?", "name": "helper", "signature": "def helper(self, node, cur_sum, pathSoFar, foundSoFar)" }, { "docstring": ":type root: TreeNode :type cur_sum: int...
2
stack_v2_sparse_classes_30k_train_005268
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def helper(self, node, cur_sum, pathSoFar, foundSoFar): :type node: TreeNode :type cur_sum: int :type pathSoFar: List[int] :type foundSoFar: List[List[int]] :rtype: None? List[Li...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def helper(self, node, cur_sum, pathSoFar, foundSoFar): :type node: TreeNode :type cur_sum: int :type pathSoFar: List[int] :type foundSoFar: List[List[int]] :rtype: None? List[Li...
dcf9768aeb120f3ad9925e407193e1a4b282a0a2
<|skeleton|> class Solution: def helper(self, node, cur_sum, pathSoFar, foundSoFar): """:type node: TreeNode :type cur_sum: int :type pathSoFar: List[int] :type foundSoFar: List[List[int]] :rtype: None? List[List[int]]?""" <|body_0|> def pathSum(self, root, cur_sum): """:type root: Tre...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def helper(self, node, cur_sum, pathSoFar, foundSoFar): """:type node: TreeNode :type cur_sum: int :type pathSoFar: List[int] :type foundSoFar: List[List[int]] :rtype: None? List[List[int]]?""" left = node.left != None right = node.right != None if not left and (not r...
the_stack_v2_python_sparse
Path_Sum_II_Optimized.py
O5-2/leetcode
train
0
a3c111459cf3f0212eb01ce9b102df34c0464bc8
[ "test_zipped_file = './test/test.zip'\ndesired_dir = os.path.join(CFG_TMPSHAREDDIR, 'apsharvest')\nunzipped_folder = unzip(test_zipped_file, desired_dir)\nself.assertTrue(unzipped_folder.startswith(desired_dir), 'Unzipped folder is located in the wrong place %s!' % unzipped_folder)\nunzipped_folder = unzip(test_zip...
<|body_start_0|> test_zipped_file = './test/test.zip' desired_dir = os.path.join(CFG_TMPSHAREDDIR, 'apsharvest') unzipped_folder = unzip(test_zipped_file, desired_dir) self.assertTrue(unzipped_folder.startswith(desired_dir), 'Unzipped folder is located in the wrong place %s!' % unzipped_...
FileTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FileTest: def test_unzip(self): """Test uncompressing function.""" <|body_0|> def test_md5_check(self): """Test md5 checking done by APS Harvester.""" <|body_1|> <|end_skeleton|> <|body_start_0|> test_zipped_file = './test/test.zip' desired_...
stack_v2_sparse_classes_36k_train_029843
5,627
no_license
[ { "docstring": "Test uncompressing function.", "name": "test_unzip", "signature": "def test_unzip(self)" }, { "docstring": "Test md5 checking done by APS Harvester.", "name": "test_md5_check", "signature": "def test_md5_check(self)" } ]
2
null
Implement the Python class `FileTest` described below. Class description: Implement the FileTest class. Method signatures and docstrings: - def test_unzip(self): Test uncompressing function. - def test_md5_check(self): Test md5 checking done by APS Harvester.
Implement the Python class `FileTest` described below. Class description: Implement the FileTest class. Method signatures and docstrings: - def test_unzip(self): Test uncompressing function. - def test_md5_check(self): Test md5 checking done by APS Harvester. <|skeleton|> class FileTest: def test_unzip(self): ...
37c905be9a569a6c25ced045eb84545ddb7ac3a5
<|skeleton|> class FileTest: def test_unzip(self): """Test uncompressing function.""" <|body_0|> def test_md5_check(self): """Test md5 checking done by APS Harvester.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FileTest: def test_unzip(self): """Test uncompressing function.""" test_zipped_file = './test/test.zip' desired_dir = os.path.join(CFG_TMPSHAREDDIR, 'apsharvest') unzipped_folder = unzip(test_zipped_file, desired_dir) self.assertTrue(unzipped_folder.startswith(desired_d...
the_stack_v2_python_sparse
apsharvest/apsharvest_tests.py
inspirehep/inspire
train
9
da9012b62dcc44372a39f460f223ed897f219f94
[ "url = 'os-agents'\nif params:\n url += '?%s' % urllib.urlencode(params)\nresp, body = self.get(url)\nbody = json.loads(body)\nself.validate_response(schema.list_agents, resp, body)\nreturn rest_client.ResponseBody(resp, body)", "post_body = json.dumps({'agent': kwargs})\nresp, body = self.post('os-agents', po...
<|body_start_0|> url = 'os-agents' if params: url += '?%s' % urllib.urlencode(params) resp, body = self.get(url) body = json.loads(body) self.validate_response(schema.list_agents, resp, body) return rest_client.ResponseBody(resp, body) <|end_body_0|> <|body_s...
Tests Agents API
AgentsClient
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AgentsClient: """Tests Agents API""" def list_agents(self, **params): """List all agent builds. For a full list of available parameters, please refer to the official API reference: https://docs.openstack.org/api-ref/compute/#list-agent-builds""" <|body_0|> def create_age...
stack_v2_sparse_classes_36k_train_029844
3,003
permissive
[ { "docstring": "List all agent builds. For a full list of available parameters, please refer to the official API reference: https://docs.openstack.org/api-ref/compute/#list-agent-builds", "name": "list_agents", "signature": "def list_agents(self, **params)" }, { "docstring": "Create an agent bui...
4
stack_v2_sparse_classes_30k_train_005451
Implement the Python class `AgentsClient` described below. Class description: Tests Agents API Method signatures and docstrings: - def list_agents(self, **params): List all agent builds. For a full list of available parameters, please refer to the official API reference: https://docs.openstack.org/api-ref/compute/#li...
Implement the Python class `AgentsClient` described below. Class description: Tests Agents API Method signatures and docstrings: - def list_agents(self, **params): List all agent builds. For a full list of available parameters, please refer to the official API reference: https://docs.openstack.org/api-ref/compute/#li...
3932a799e620a20d7abf7b89e21b520683a1809b
<|skeleton|> class AgentsClient: """Tests Agents API""" def list_agents(self, **params): """List all agent builds. For a full list of available parameters, please refer to the official API reference: https://docs.openstack.org/api-ref/compute/#list-agent-builds""" <|body_0|> def create_age...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AgentsClient: """Tests Agents API""" def list_agents(self, **params): """List all agent builds. For a full list of available parameters, please refer to the official API reference: https://docs.openstack.org/api-ref/compute/#list-agent-builds""" url = 'os-agents' if params: ...
the_stack_v2_python_sparse
tempest/lib/services/compute/agents_client.py
openstack/tempest
train
270
9e7614e4486fb6efd46ab43ba0dc495849ab9872
[ "if isinstance(data, PropertyData):\n pdata = data\nelif isinstance(data, list):\n pdata = PropertyData(data)\nelse:\n raise TypeError('list or PropertyData object required')\nsuper(PropertyTable, self).__init__(data=pdata, **kwargs)", "fp = get_file(file_or_path)\nd = json.load(fp)\nPropertyTable._valid...
<|body_start_0|> if isinstance(data, PropertyData): pdata = data elif isinstance(data, list): pdata = PropertyData(data) else: raise TypeError('list or PropertyData object required') super(PropertyTable, self).__init__(data=pdata, **kwargs) <|end_body_...
Property data and metadata together (at last!)
PropertyTable
[ "LicenseRef-scancode-unknown-license-reference", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PropertyTable: """Property data and metadata together (at last!)""" def __init__(self, data=None, **kwargs): """Constructor.""" <|body_0|> def load(cls, file_or_path, validate=True): """Create PropertyTable from JSON input. Args: file_or_path (file or str): Filen...
stack_v2_sparse_classes_36k_train_029845
18,955
permissive
[ { "docstring": "Constructor.", "name": "__init__", "signature": "def __init__(self, data=None, **kwargs)" }, { "docstring": "Create PropertyTable from JSON input. Args: file_or_path (file or str): Filename or file object from which to read the JSON-formatted data. validate (bool): If true, apply...
2
null
Implement the Python class `PropertyTable` described below. Class description: Property data and metadata together (at last!) Method signatures and docstrings: - def __init__(self, data=None, **kwargs): Constructor. - def load(cls, file_or_path, validate=True): Create PropertyTable from JSON input. Args: file_or_path...
Implement the Python class `PropertyTable` described below. Class description: Property data and metadata together (at last!) Method signatures and docstrings: - def __init__(self, data=None, **kwargs): Constructor. - def load(cls, file_or_path, validate=True): Create PropertyTable from JSON input. Args: file_or_path...
afec89b8273fcc17a0b5f08ea9b97b5fc98d2a31
<|skeleton|> class PropertyTable: """Property data and metadata together (at last!)""" def __init__(self, data=None, **kwargs): """Constructor.""" <|body_0|> def load(cls, file_or_path, validate=True): """Create PropertyTable from JSON input. Args: file_or_path (file or str): Filen...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PropertyTable: """Property data and metadata together (at last!)""" def __init__(self, data=None, **kwargs): """Constructor.""" if isinstance(data, PropertyData): pdata = data elif isinstance(data, list): pdata = PropertyData(data) else: ...
the_stack_v2_python_sparse
idaes/dmf/propdata.py
JackaChou/idaes-pse
train
1
04569dc67a6203e38376f57751e863878eb75d0b
[ "self.index_name = index_name\nself._rule = kwargs.get('rule')\nsuper().__init__(index_name, sketch_id, timeline_id=timeline_id)", "if not tag_list:\n tag_list = []\nreturn_fields = []\ntagged_events_counter = 0\nevents = self.event_stream(query_string=query, return_fields=return_fields)\nfor event in events:\...
<|body_start_0|> self.index_name = index_name self._rule = kwargs.get('rule') super().__init__(index_name, sketch_id, timeline_id=timeline_id) <|end_body_0|> <|body_start_1|> if not tag_list: tag_list = [] return_fields = [] tagged_events_counter = 0 ...
Analyzer for Sigma Rules.
SigmaPlugin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SigmaPlugin: """Analyzer for Sigma Rules.""" def __init__(self, index_name, sketch_id, timeline_id=None, **kwargs): """Initialize The Sigma Analyzer. Args: index_name: OpenSearch index name sketch_id: Sketch ID timeline_id: The ID of the timeline.""" <|body_0|> def run_s...
stack_v2_sparse_classes_36k_train_029846
4,728
permissive
[ { "docstring": "Initialize The Sigma Analyzer. Args: index_name: OpenSearch index name sketch_id: Sketch ID timeline_id: The ID of the timeline.", "name": "__init__", "signature": "def __init__(self, index_name, sketch_id, timeline_id=None, **kwargs)" }, { "docstring": "Runs a sigma rule and app...
4
null
Implement the Python class `SigmaPlugin` described below. Class description: Analyzer for Sigma Rules. Method signatures and docstrings: - def __init__(self, index_name, sketch_id, timeline_id=None, **kwargs): Initialize The Sigma Analyzer. Args: index_name: OpenSearch index name sketch_id: Sketch ID timeline_id: The...
Implement the Python class `SigmaPlugin` described below. Class description: Analyzer for Sigma Rules. Method signatures and docstrings: - def __init__(self, index_name, sketch_id, timeline_id=None, **kwargs): Initialize The Sigma Analyzer. Args: index_name: OpenSearch index name sketch_id: Sketch ID timeline_id: The...
24f471b58ca4a87cb053961b5f05c07a544ca7b8
<|skeleton|> class SigmaPlugin: """Analyzer for Sigma Rules.""" def __init__(self, index_name, sketch_id, timeline_id=None, **kwargs): """Initialize The Sigma Analyzer. Args: index_name: OpenSearch index name sketch_id: Sketch ID timeline_id: The ID of the timeline.""" <|body_0|> def run_s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SigmaPlugin: """Analyzer for Sigma Rules.""" def __init__(self, index_name, sketch_id, timeline_id=None, **kwargs): """Initialize The Sigma Analyzer. Args: index_name: OpenSearch index name sketch_id: Sketch ID timeline_id: The ID of the timeline.""" self.index_name = index_name s...
the_stack_v2_python_sparse
timesketch/lib/analyzers/sigma_tagger.py
google/timesketch
train
2,263
311ebc902bf5f7729c3ad898f353e3e7bf855b5a
[ "func = self._module.locally_linear_embedding\ny, squared_error = func(self._data.values, n_neighbors, n_components, *args, **kwargs)\ny = self._constructor(y, index=self._df.index)\nreturn (y, squared_error)", "func = self._module.spectral_embedding\ndata = self._data\nembedding = func(data.values, *args, **kwar...
<|body_start_0|> func = self._module.locally_linear_embedding y, squared_error = func(self._data.values, n_neighbors, n_components, *args, **kwargs) y = self._constructor(y, index=self._df.index) return (y, squared_error) <|end_body_0|> <|body_start_1|> func = self._module.spect...
Accessor to ``sklearn.manifold``.
ManifoldMethods
[ "Python-2.0", "Apache-2.0", "BSD-3-Clause", "LicenseRef-scancode-unknown" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ManifoldMethods: """Accessor to ``sklearn.manifold``.""" def locally_linear_embedding(self, n_neighbors, n_components, *args, **kwargs): """Call ``sklearn.manifold.locally_linear_embedding`` using automatic mapping. - ``X``: ``ModelFrame.data``""" <|body_0|> def spectral...
stack_v2_sparse_classes_36k_train_029847
1,167
permissive
[ { "docstring": "Call ``sklearn.manifold.locally_linear_embedding`` using automatic mapping. - ``X``: ``ModelFrame.data``", "name": "locally_linear_embedding", "signature": "def locally_linear_embedding(self, n_neighbors, n_components, *args, **kwargs)" }, { "docstring": "Call ``sklearn.manifold....
2
stack_v2_sparse_classes_30k_train_011571
Implement the Python class `ManifoldMethods` described below. Class description: Accessor to ``sklearn.manifold``. Method signatures and docstrings: - def locally_linear_embedding(self, n_neighbors, n_components, *args, **kwargs): Call ``sklearn.manifold.locally_linear_embedding`` using automatic mapping. - ``X``: ``...
Implement the Python class `ManifoldMethods` described below. Class description: Accessor to ``sklearn.manifold``. Method signatures and docstrings: - def locally_linear_embedding(self, n_neighbors, n_components, *args, **kwargs): Call ``sklearn.manifold.locally_linear_embedding`` using automatic mapping. - ``X``: ``...
2c9002f16bb5c265e0d14f4a2314c86eeaa35cb6
<|skeleton|> class ManifoldMethods: """Accessor to ``sklearn.manifold``.""" def locally_linear_embedding(self, n_neighbors, n_components, *args, **kwargs): """Call ``sklearn.manifold.locally_linear_embedding`` using automatic mapping. - ``X``: ``ModelFrame.data``""" <|body_0|> def spectral...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ManifoldMethods: """Accessor to ``sklearn.manifold``.""" def locally_linear_embedding(self, n_neighbors, n_components, *args, **kwargs): """Call ``sklearn.manifold.locally_linear_embedding`` using automatic mapping. - ``X``: ``ModelFrame.data``""" func = self._module.locally_linear_embedd...
the_stack_v2_python_sparse
lib/python2.7/site-packages/pandas_ml/skaccessors/manifold.py
wangyum/Anaconda
train
11
936f7860f120f92e44392776ddd14df0400fd61c
[ "f = getattr(loc, self.algorithm).batch\nopts = self.options\n\ndef ret(image):\n lc = f(image, **opts)\n return lc\nreturn ret", "for i in range(self.dataset.rowCount()):\n file = self.dataset.get(i, 'key')\n ld = self.dataset.get(i, 'locData')\n io.save(file.with_suffix('.h5'), ld)\n with file...
<|body_start_0|> f = getattr(loc, self.algorithm).batch opts = self.options def ret(image): lc = f(image, **opts) return lc return ret <|end_body_0|> <|body_start_1|> for i in range(self.dataset.rowCount()): file = self.dataset.get(i, 'key') ...
Locator
[ "BSD-3-Clause", "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Locator: def getLocateFunc(self) -> Callable[[Iterable[np.ndarray]], pd.DataFrame]: """Get a function that runs localization algorithm on image sequence Returns ------- The function takes an iterable of 2D arrays and will run the currently selected algorithm with currently selected optio...
stack_v2_sparse_classes_36k_train_029848
4,039
permissive
[ { "docstring": "Get a function that runs localization algorithm on image sequence Returns ------- The function takes an iterable of 2D arrays and will run the currently selected algorithm with currently selected options on this. See :py:func:`sdt.loc.daostorm_3d.batch` and :py:func:`sdt.loc.cg.batch`.", "na...
2
null
Implement the Python class `Locator` described below. Class description: Implement the Locator class. Method signatures and docstrings: - def getLocateFunc(self) -> Callable[[Iterable[np.ndarray]], pd.DataFrame]: Get a function that runs localization algorithm on image sequence Returns ------- The function takes an i...
Implement the Python class `Locator` described below. Class description: Implement the Locator class. Method signatures and docstrings: - def getLocateFunc(self) -> Callable[[Iterable[np.ndarray]], pd.DataFrame]: Get a function that runs localization algorithm on image sequence Returns ------- The function takes an i...
2f953e553f32118c3ad1f244481e5a0ac6c533f0
<|skeleton|> class Locator: def getLocateFunc(self) -> Callable[[Iterable[np.ndarray]], pd.DataFrame]: """Get a function that runs localization algorithm on image sequence Returns ------- The function takes an iterable of 2D arrays and will run the currently selected algorithm with currently selected optio...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Locator: def getLocateFunc(self) -> Callable[[Iterable[np.ndarray]], pd.DataFrame]: """Get a function that runs localization algorithm on image sequence Returns ------- The function takes an iterable of 2D arrays and will run the currently selected algorithm with currently selected options on this. Se...
the_stack_v2_python_sparse
sdt/gui/locator.py
schuetzgroup/sdt-python
train
31
4697393de6c2fd3186c5942b3a0c7255edf69a67
[ "self._N = N\nself._g = g\nself._salt = salt\nself._A = A\nself._b = b\nself._u = u\nself._hmac = hmac\nself._id = identifier\nsuper().__init__()", "xH = utils.sha256_mac(b'', utils.rawstr2bytes(str(self._salt) + password))\nx = int(xH.hex(), 16)\nv = pow(self._g, x, self._N)\nSb = self._A * pow(v, self._u, self....
<|body_start_0|> self._N = N self._g = g self._salt = salt self._A = A self._b = b self._u = u self._hmac = hmac self._id = identifier super().__init__() <|end_body_0|> <|body_start_1|> xH = utils.sha256_mac(b'', utils.rawstr2bytes(str(sel...
The thread used for the password breaking.
PasswordBreaker
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PasswordBreaker: """The thread used for the password breaking.""" def __init__(self, N, g, salt, A, b, u, hmac, identifier): """The constructor: gathers the elements required for breaking the password.""" <|body_0|> def get_password_hmac(self, password): """Compu...
stack_v2_sparse_classes_36k_train_029849
10,843
permissive
[ { "docstring": "The constructor: gathers the elements required for breaking the password.", "name": "__init__", "signature": "def __init__(self, N, g, salt, A, b, u, hmac, identifier)" }, { "docstring": "Compute the HMAC if the password would be 'password'.", "name": "get_password_hmac", ...
3
null
Implement the Python class `PasswordBreaker` described below. Class description: The thread used for the password breaking. Method signatures and docstrings: - def __init__(self, N, g, salt, A, b, u, hmac, identifier): The constructor: gathers the elements required for breaking the password. - def get_password_hmac(s...
Implement the Python class `PasswordBreaker` described below. Class description: The thread used for the password breaking. Method signatures and docstrings: - def __init__(self, N, g, salt, A, b, u, hmac, identifier): The constructor: gathers the elements required for breaking the password. - def get_password_hmac(s...
d322930cc94cfde28239b9738e8cd36e304532ea
<|skeleton|> class PasswordBreaker: """The thread used for the password breaking.""" def __init__(self, N, g, salt, A, b, u, hmac, identifier): """The constructor: gathers the elements required for breaking the password.""" <|body_0|> def get_password_hmac(self, password): """Compu...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PasswordBreaker: """The thread used for the password breaking.""" def __init__(self, N, g, salt, A, b, u, hmac, identifier): """The constructor: gathers the elements required for breaking the password.""" self._N = N self._g = g self._salt = salt self._A = A ...
the_stack_v2_python_sparse
src/cp_test_c38_attacker.py
rjpdasilva/cryptopals
train
0
5e42760a034b71e1e46b4c0890349b7fb4ab2ac6
[ "for name, c in inspect.getmembers(spaces):\n if inspect.isclass(c):\n cls.classes.append(c)", "for c in self.classes:\n if c not in class_arguments:\n assert False", "for c in self.classes:\n if c in class_arguments:\n check = partial(self.check_contains)\n check.descriptio...
<|body_start_0|> for name, c in inspect.getmembers(spaces): if inspect.isclass(c): cls.classes.append(c) <|end_body_0|> <|body_start_1|> for c in self.classes: if c not in class_arguments: assert False <|end_body_1|> <|body_start_2|> for ...
Wrap spaces tests.
TestSpaces
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestSpaces: """Wrap spaces tests.""" def setUpClass(cls): """Initialize classes list.""" <|body_0|> def exhaustive_tests(self): """Check: Spaces tests initial values for testing.""" <|body_1|> def generate_tests(self): """Generate tests for s...
stack_v2_sparse_classes_36k_train_029850
1,519
permissive
[ { "docstring": "Initialize classes list.", "name": "setUpClass", "signature": "def setUpClass(cls)" }, { "docstring": "Check: Spaces tests initial values for testing.", "name": "exhaustive_tests", "signature": "def exhaustive_tests(self)" }, { "docstring": "Generate tests for spa...
4
null
Implement the Python class `TestSpaces` described below. Class description: Wrap spaces tests. Method signatures and docstrings: - def setUpClass(cls): Initialize classes list. - def exhaustive_tests(self): Check: Spaces tests initial values for testing. - def generate_tests(self): Generate tests for spaces implement...
Implement the Python class `TestSpaces` described below. Class description: Wrap spaces tests. Method signatures and docstrings: - def setUpClass(cls): Initialize classes list. - def exhaustive_tests(self): Check: Spaces tests initial values for testing. - def generate_tests(self): Generate tests for spaces implement...
8500c8dd90a2b59a91b988a3c83e529f6c69332f
<|skeleton|> class TestSpaces: """Wrap spaces tests.""" def setUpClass(cls): """Initialize classes list.""" <|body_0|> def exhaustive_tests(self): """Check: Spaces tests initial values for testing.""" <|body_1|> def generate_tests(self): """Generate tests for s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestSpaces: """Wrap spaces tests.""" def setUpClass(cls): """Initialize classes list.""" for name, c in inspect.getmembers(spaces): if inspect.isclass(c): cls.classes.append(c) def exhaustive_tests(self): """Check: Spaces tests initial values for t...
the_stack_v2_python_sparse
Safe-RL/Safe-RL-Benchmark/SafeRLBench/spaces/test.py
chauncygu/Safe-Reinforcement-Learning-Baselines
train
233
eec0a00e433fb077ca8eae8947517c709b44cbec
[ "def adjs(i, j):\n for x, y in [(i + 1, j), (i - 1, j), (i, j + 1), (i, j - 1)]:\n if 0 <= x < len(A) and 0 <= y < len(A[0]):\n yield (x, y)\ncurr = deque()\nseen = set()\nfor i, row in enumerate(A):\n for j, space in enumerate(row):\n if space:\n break\n if space:\n ...
<|body_start_0|> def adjs(i, j): for x, y in [(i + 1, j), (i - 1, j), (i, j + 1), (i, j - 1)]: if 0 <= x < len(A) and 0 <= y < len(A[0]): yield (x, y) curr = deque() seen = set() for i, row in enumerate(A): for j, space in enume...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def shortestBridge(self, A: List[List[int]]) -> int: """Implementation using BFS and `set`, which is cleaner syntax-wise in my opinion:""" <|body_0|> def shortestBridge(self, A: List[List[int]]) -> int: """Solution using a 2D array for `seen`, which uses le...
stack_v2_sparse_classes_36k_train_029851
2,482
no_license
[ { "docstring": "Implementation using BFS and `set`, which is cleaner syntax-wise in my opinion:", "name": "shortestBridge", "signature": "def shortestBridge(self, A: List[List[int]]) -> int" }, { "docstring": "Solution using a 2D array for `seen`, which uses less memory:", "name": "shortestB...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def shortestBridge(self, A: List[List[int]]) -> int: Implementation using BFS and `set`, which is cleaner syntax-wise in my opinion: - def shortestBridge(self, A: List[List[int]]...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def shortestBridge(self, A: List[List[int]]) -> int: Implementation using BFS and `set`, which is cleaner syntax-wise in my opinion: - def shortestBridge(self, A: List[List[int]]...
f4cd43f082b58d4410008af49325770bc84d3aba
<|skeleton|> class Solution: def shortestBridge(self, A: List[List[int]]) -> int: """Implementation using BFS and `set`, which is cleaner syntax-wise in my opinion:""" <|body_0|> def shortestBridge(self, A: List[List[int]]) -> int: """Solution using a 2D array for `seen`, which uses le...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def shortestBridge(self, A: List[List[int]]) -> int: """Implementation using BFS and `set`, which is cleaner syntax-wise in my opinion:""" def adjs(i, j): for x, y in [(i + 1, j), (i - 1, j), (i, j + 1), (i, j - 1)]: if 0 <= x < len(A) and 0 <= y < len(A[0...
the_stack_v2_python_sparse
934.Shortest_Bridge.py
welsny/solutions
train
1
355193ea49364cb2f24d7d7a5c9175078dc6dea6
[ "current_app.logger.info('<AccountStatementsSettings.get')\ncheck_auth(business_identifier=None, account_id=account_id, contains_role=EDIT_ROLE, is_premium=True)\nresponse, status = (StatementSettingsService.find_by_account_id(account_id), HTTPStatus.OK)\ncurrent_app.logger.debug('>AccountStatementsSettings.get')\n...
<|body_start_0|> current_app.logger.info('<AccountStatementsSettings.get') check_auth(business_identifier=None, account_id=account_id, contains_role=EDIT_ROLE, is_premium=True) response, status = (StatementSettingsService.find_by_account_id(account_id), HTTPStatus.OK) current_app.logger....
Endpoint resource for statements.
AccountStatementsSettings
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AccountStatementsSettings: """Endpoint resource for statements.""" def get(account_id): """Get all statements records for an account.""" <|body_0|> def post(account_id): """Update the statement settings .""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_029852
3,037
permissive
[ { "docstring": "Get all statements records for an account.", "name": "get", "signature": "def get(account_id)" }, { "docstring": "Update the statement settings .", "name": "post", "signature": "def post(account_id)" } ]
2
stack_v2_sparse_classes_30k_train_009441
Implement the Python class `AccountStatementsSettings` described below. Class description: Endpoint resource for statements. Method signatures and docstrings: - def get(account_id): Get all statements records for an account. - def post(account_id): Update the statement settings .
Implement the Python class `AccountStatementsSettings` described below. Class description: Endpoint resource for statements. Method signatures and docstrings: - def get(account_id): Get all statements records for an account. - def post(account_id): Update the statement settings . <|skeleton|> class AccountStatements...
0d71d37b0e08d11f6b6d9f59a4b202dfabc98fc1
<|skeleton|> class AccountStatementsSettings: """Endpoint resource for statements.""" def get(account_id): """Get all statements records for an account.""" <|body_0|> def post(account_id): """Update the statement settings .""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AccountStatementsSettings: """Endpoint resource for statements.""" def get(account_id): """Get all statements records for an account.""" current_app.logger.info('<AccountStatementsSettings.get') check_auth(business_identifier=None, account_id=account_id, contains_role=EDIT_ROLE, i...
the_stack_v2_python_sparse
pay-api/src/pay_api/resources/account_statements_settings.py
bcgov/sbc-pay
train
6
2e303c43098f5dbb41096616a5f2fe2682d33b78
[ "super(GaussianProcessClassifier, self).__init__(kernel=kernel, sigma=sigma, a=a, b=b, h=h, theta=theta)\nClassifier.__init__(self)\nself.alpha = alpha\nself.gamma = gamma\nself.max_iter = max_iter\nself.threshold = threshold", "y = self._onehot_to_label(y)\ny = y.reshape(-1, 1)\nself.X = X\nself.y = y\nC = self....
<|body_start_0|> super(GaussianProcessClassifier, self).__init__(kernel=kernel, sigma=sigma, a=a, b=b, h=h, theta=theta) Classifier.__init__(self) self.alpha = alpha self.gamma = gamma self.max_iter = max_iter self.threshold = threshold <|end_body_0|> <|body_start_1|> ...
GaussianProcessClassifier Attributes: kernel_func (function) : kernel function k(x,y) gram_func (function) : function which make gram matrix alpha (float) : hyperparameter gamma (float) : noise parameter to ensure C is positive definite
GaussianProcessClassifier
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GaussianProcessClassifier: """GaussianProcessClassifier Attributes: kernel_func (function) : kernel function k(x,y) gram_func (function) : function which make gram matrix alpha (float) : hyperparameter gamma (float) : noise parameter to ensure C is positive definite""" def __init__(self, alp...
stack_v2_sparse_classes_36k_train_029853
10,708
permissive
[ { "docstring": "Args: alpha (float) : hyperparameter gamma (float) : noise parameter to ensure C is positive definite max_iter (int) : max iteration for parameter optimization threshold (float) : threshold for optimizint parameters kernel (string) : kernel type (default \"Linear\"). you can choose \"Linear\",\"...
3
stack_v2_sparse_classes_30k_train_012186
Implement the Python class `GaussianProcessClassifier` described below. Class description: GaussianProcessClassifier Attributes: kernel_func (function) : kernel function k(x,y) gram_func (function) : function which make gram matrix alpha (float) : hyperparameter gamma (float) : noise parameter to ensure C is positive ...
Implement the Python class `GaussianProcessClassifier` described below. Class description: GaussianProcessClassifier Attributes: kernel_func (function) : kernel function k(x,y) gram_func (function) : function which make gram matrix alpha (float) : hyperparameter gamma (float) : noise parameter to ensure C is positive ...
992f2c07e88b2bad331e08303bdba84684f04d40
<|skeleton|> class GaussianProcessClassifier: """GaussianProcessClassifier Attributes: kernel_func (function) : kernel function k(x,y) gram_func (function) : function which make gram matrix alpha (float) : hyperparameter gamma (float) : noise parameter to ensure C is positive definite""" def __init__(self, alp...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GaussianProcessClassifier: """GaussianProcessClassifier Attributes: kernel_func (function) : kernel function k(x,y) gram_func (function) : function which make gram matrix alpha (float) : hyperparameter gamma (float) : noise parameter to ensure C is positive definite""" def __init__(self, alpha=1.0, gamma...
the_stack_v2_python_sparse
prml/kernel_method.py
hedwig100/PRML
train
1
e70cb27efe800d73073f6aefb7e93d4dc533c8be
[ "if not nums:\n return -1\nelse:\n max_sum = nums[0]\n sum = 0\n for num in nums:\n if sum > 0:\n sum = sum + num\n else:\n sum = num\n max_sum = max(max_sum, sum)\n return max_sum", "n = len(nums)\nmax_sum = nums[0]\nfor i in range(1, n):\n if nums[i -...
<|body_start_0|> if not nums: return -1 else: max_sum = nums[0] sum = 0 for num in nums: if sum > 0: sum = sum + num else: sum = num max_sum = max(max_sum, sum) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxSubArray(self, nums: [int]) -> int: """贪心.使用单个数组作为输入来查找最大(或最小)元素(或总和)的问题,贪心算法是可以在线性时间解决的方法之一。 每一步都选择最佳方案,到最后就是全局最优的方案。 :param nums: :return:""" <|body_0|> def maxSubArray1(self, nums: [int]) -> int: """动态规划。 在整个数组或在固定大小的滑动窗口中找到总和或最大值或最小值的问题可以通过动态规划(D...
stack_v2_sparse_classes_36k_train_029854
1,515
no_license
[ { "docstring": "贪心.使用单个数组作为输入来查找最大(或最小)元素(或总和)的问题,贪心算法是可以在线性时间解决的方法之一。 每一步都选择最佳方案,到最后就是全局最优的方案。 :param nums: :return:", "name": "maxSubArray", "signature": "def maxSubArray(self, nums: [int]) -> int" }, { "docstring": "动态规划。 在整个数组或在固定大小的滑动窗口中找到总和或最大值或最小值的问题可以通过动态规划(DP)在线性时间内解决。 有两种标准 DP 方法适用于数组:...
2
stack_v2_sparse_classes_30k_train_015867
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSubArray(self, nums: [int]) -> int: 贪心.使用单个数组作为输入来查找最大(或最小)元素(或总和)的问题,贪心算法是可以在线性时间解决的方法之一。 每一步都选择最佳方案,到最后就是全局最优的方案。 :param nums: :return: - def maxSubArray1(self, nums: [i...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSubArray(self, nums: [int]) -> int: 贪心.使用单个数组作为输入来查找最大(或最小)元素(或总和)的问题,贪心算法是可以在线性时间解决的方法之一。 每一步都选择最佳方案,到最后就是全局最优的方案。 :param nums: :return: - def maxSubArray1(self, nums: [i...
4328382a65ac612aa4dc397f475c1d7db25c7723
<|skeleton|> class Solution: def maxSubArray(self, nums: [int]) -> int: """贪心.使用单个数组作为输入来查找最大(或最小)元素(或总和)的问题,贪心算法是可以在线性时间解决的方法之一。 每一步都选择最佳方案,到最后就是全局最优的方案。 :param nums: :return:""" <|body_0|> def maxSubArray1(self, nums: [int]) -> int: """动态规划。 在整个数组或在固定大小的滑动窗口中找到总和或最大值或最小值的问题可以通过动态规划(D...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxSubArray(self, nums: [int]) -> int: """贪心.使用单个数组作为输入来查找最大(或最小)元素(或总和)的问题,贪心算法是可以在线性时间解决的方法之一。 每一步都选择最佳方案,到最后就是全局最优的方案。 :param nums: :return:""" if not nums: return -1 else: max_sum = nums[0] sum = 0 for num in nums: ...
the_stack_v2_python_sparse
thor/array/ac_53.py
duangduangda/Thor
train
0
1d052e68851bfbee35867cf6718e181321af9c24
[ "stack = [root] if root else []\nall_nodes = {}\nwhile stack:\n new_stack = []\n for node in stack:\n for child in (node.left, node.right):\n if child:\n all_nodes[child] = node\n new_stack.append(child)\n if not new_stack:\n break\n stack = new_sta...
<|body_start_0|> stack = [root] if root else [] all_nodes = {} while stack: new_stack = [] for node in stack: for child in (node.left, node.right): if child: all_nodes[child] = node new_st...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def subtreeWithAllDeepest(self, root): """:type root: TreeNode :rtype: TreeNode""" <|body_0|> def subtreeWithAllDeepest(self, root): """:type root: TreeNode :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_start_0|> stack = [root] if...
stack_v2_sparse_classes_36k_train_029855
1,261
no_license
[ { "docstring": ":type root: TreeNode :rtype: TreeNode", "name": "subtreeWithAllDeepest", "signature": "def subtreeWithAllDeepest(self, root)" }, { "docstring": ":type root: TreeNode :rtype: TreeNode", "name": "subtreeWithAllDeepest", "signature": "def subtreeWithAllDeepest(self, root)" ...
2
stack_v2_sparse_classes_30k_train_007431
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def subtreeWithAllDeepest(self, root): :type root: TreeNode :rtype: TreeNode - def subtreeWithAllDeepest(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 subtreeWithAllDeepest(self, root): :type root: TreeNode :rtype: TreeNode - def subtreeWithAllDeepest(self, root): :type root: TreeNode :rtype: TreeNode <|skeleton|> class So...
16e4343922041929bc3021e152093425066620bb
<|skeleton|> class Solution: def subtreeWithAllDeepest(self, root): """:type root: TreeNode :rtype: TreeNode""" <|body_0|> def subtreeWithAllDeepest(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 subtreeWithAllDeepest(self, root): """:type root: TreeNode :rtype: TreeNode""" stack = [root] if root else [] all_nodes = {} while stack: new_stack = [] for node in stack: for child in (node.left, node.right): ...
the_stack_v2_python_sparse
865_subtreeWithAllDeepest.py
zzz686970/leetcode-2018
train
3
73cd8cd59396e908a3db3efd064b6c56c542892a
[ "super().__init__()\nself.depth = depth\nself.tag = tag\nself._checked = False\nself.toggle_active()\nself.setEditable(False)\nrgb = color.replace(')', '').replace(' ', '').split('(')[-1].split(',')\nself.setForeground(QColor(*[int(r) for r in rgb]))\nself.setText(txt)", "fnt = QFont('Roboto', 14)\nif self._check...
<|body_start_0|> super().__init__() self.depth = depth self.tag = tag self._checked = False self.toggle_active() self.setEditable(False) rgb = color.replace(')', '').replace(' ', '').split('(')[-1].split(',') self.setForeground(QColor(*[int(r) for r in rgb...
StandardItem
[ "BSD-3-Clause", "GPL-3.0-only" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StandardItem: def __init__(self, txt='', tag=None, depth=0, color=None): """Items in the tree list with some extended functionality to specify/update their look.""" <|body_0|> def toggle_active(self): """When a mesh corresponding to the item's region get's rendered, ...
stack_v2_sparse_classes_36k_train_029856
1,232
permissive
[ { "docstring": "Items in the tree list with some extended functionality to specify/update their look.", "name": "__init__", "signature": "def __init__(self, txt='', tag=None, depth=0, color=None)" }, { "docstring": "When a mesh corresponding to the item's region get's rendered, change the font t...
2
null
Implement the Python class `StandardItem` described below. Class description: Implement the StandardItem class. Method signatures and docstrings: - def __init__(self, txt='', tag=None, depth=0, color=None): Items in the tree list with some extended functionality to specify/update their look. - def toggle_active(self)...
Implement the Python class `StandardItem` described below. Class description: Implement the StandardItem class. Method signatures and docstrings: - def __init__(self, txt='', tag=None, depth=0, color=None): Items in the tree list with some extended functionality to specify/update their look. - def toggle_active(self)...
a14ead80c1dbc75f20a145a49394dc467c4f7bf1
<|skeleton|> class StandardItem: def __init__(self, txt='', tag=None, depth=0, color=None): """Items in the tree list with some extended functionality to specify/update their look.""" <|body_0|> def toggle_active(self): """When a mesh corresponding to the item's region get's rendered, ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StandardItem: def __init__(self, txt='', tag=None, depth=0, color=None): """Items in the tree list with some extended functionality to specify/update their look.""" super().__init__() self.depth = depth self.tag = tag self._checked = False self.toggle_active() ...
the_stack_v2_python_sparse
brainrender/gui/widgets/tree.py
brainglobe/brainrender
train
345
b5d588c6f95481853b9d658933d0ec48620f8d7e
[ "L = step.levels[level_number]\nL.sweep.compute_end_point()\nu_ref = L.prob.u_exact(t=L.time + L.dt)\nself.add_to_stats(process=step.status.slot, time=L.time + L.dt, level=L.level_index, iter=step.status.iter, sweep=L.status.sweep, type=f'e_global{suffix}', value=abs(u_ref - L.uend))\nself.add_to_stats(process=step...
<|body_start_0|> L = step.levels[level_number] L.sweep.compute_end_point() u_ref = L.prob.u_exact(t=L.time + L.dt) self.add_to_stats(process=step.status.slot, time=L.time + L.dt, level=L.level_index, iter=step.status.iter, sweep=L.status.sweep, type=f'e_global{suffix}', value=abs(u_ref -...
Base class with functions to add the local and global error to the stats, which can be inherited by hooks logging these at specific places. Errors are computed with respect to `u_exact` defined in the problem class. Be aware that this requires the problems to be compatible with this. We need some kind of "exact" soluti...
LogError
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LogError: """Base class with functions to add the local and global error to the stats, which can be inherited by hooks logging these at specific places. Errors are computed with respect to `u_exact` defined in the problem class. Be aware that this requires the problems to be compatible with this....
stack_v2_sparse_classes_36k_train_029857
7,407
permissive
[ { "docstring": "Function to add the global error to the stats Args: step (pySDC.Step.step): The current step level_number (int): The index of the level suffix (str): Suffix for naming the variable in stats Returns: None", "name": "log_global_error", "signature": "def log_global_error(self, step, level_n...
2
null
Implement the Python class `LogError` described below. Class description: Base class with functions to add the local and global error to the stats, which can be inherited by hooks logging these at specific places. Errors are computed with respect to `u_exact` defined in the problem class. Be aware that this requires t...
Implement the Python class `LogError` described below. Class description: Base class with functions to add the local and global error to the stats, which can be inherited by hooks logging these at specific places. Errors are computed with respect to `u_exact` defined in the problem class. Be aware that this requires t...
1a51834bedffd4472e344bed28f4d766614b1537
<|skeleton|> class LogError: """Base class with functions to add the local and global error to the stats, which can be inherited by hooks logging these at specific places. Errors are computed with respect to `u_exact` defined in the problem class. Be aware that this requires the problems to be compatible with this....
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LogError: """Base class with functions to add the local and global error to the stats, which can be inherited by hooks logging these at specific places. Errors are computed with respect to `u_exact` defined in the problem class. Be aware that this requires the problems to be compatible with this. We need some...
the_stack_v2_python_sparse
pySDC/implementations/hooks/log_errors.py
Parallel-in-Time/pySDC
train
30
d897c9ca13ebcfaa38c8b439461ccd66128ae5dc
[ "self.serializer = instance_serializer\nkwargs['source'] = '*'\nsuper().__init__(**kwargs)", "if data == self.parent.context['request'].user.id:\n raise serializers.ValidationError('Cannot be friend with self.')\nreturn {'friend': User.objects.get(id=data)}", "if self.parent.context['request'].user == value....
<|body_start_0|> self.serializer = instance_serializer kwargs['source'] = '*' super().__init__(**kwargs) <|end_body_0|> <|body_start_1|> if data == self.parent.context['request'].user.id: raise serializers.ValidationError('Cannot be friend with self.') return {'frien...
Field for a friend. This will check the `from_account` and `to_account` values and will return the one that is not the current user. :param instance_serializer: serializer used to serialize the friend :param kwargs: additional arguments to pass to the `Field` constructor
FriendField
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FriendField: """Field for a friend. This will check the `from_account` and `to_account` values and will return the one that is not the current user. :param instance_serializer: serializer used to serialize the friend :param kwargs: additional arguments to pass to the `Field` constructor""" d...
stack_v2_sparse_classes_36k_train_029858
14,729
no_license
[ { "docstring": "Override the default constructor of field to force the `source` to be the whole object. This also sets the serializer used internally :param kwargs: arguments to pass to the parent constructor", "name": "__init__", "signature": "def __init__(self, instance_serializer, **kwargs)" }, {...
3
stack_v2_sparse_classes_30k_train_005627
Implement the Python class `FriendField` described below. Class description: Field for a friend. This will check the `from_account` and `to_account` values and will return the one that is not the current user. :param instance_serializer: serializer used to serialize the friend :param kwargs: additional arguments to pa...
Implement the Python class `FriendField` described below. Class description: Field for a friend. This will check the `from_account` and `to_account` values and will return the one that is not the current user. :param instance_serializer: serializer used to serialize the friend :param kwargs: additional arguments to pa...
38f0b29e6fc737756ae21a8c193a110876bc221c
<|skeleton|> class FriendField: """Field for a friend. This will check the `from_account` and `to_account` values and will return the one that is not the current user. :param instance_serializer: serializer used to serialize the friend :param kwargs: additional arguments to pass to the `Field` constructor""" d...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FriendField: """Field for a friend. This will check the `from_account` and `to_account` values and will return the one that is not the current user. :param instance_serializer: serializer used to serialize the friend :param kwargs: additional arguments to pass to the `Field` constructor""" def __init__(s...
the_stack_v2_python_sparse
backend/user/serializers.py
BenjaminSchubert/HEIG_VD_2016_PDG
train
0
4e7359131ee5b830ecc832ac28de4bbb34d8e130
[ "client = test_client.TestClient(context.node['baseurl'])\nlog_records = client.getLogRecords(context.TOKEN, datetime.datetime(1800, 1, 1), event='create')\nassert log_records.total == context.object_total", "client = test_client.TestClient(context.node['baseurl'])\nlog_records = client.getLogRecords(context.TOKE...
<|body_start_0|> client = test_client.TestClient(context.node['baseurl']) log_records = client.getLogRecords(context.TOKEN, datetime.datetime(1800, 1, 1), event='create') assert log_records.total == context.object_total <|end_body_0|> <|body_start_1|> client = test_client.TestClient(con...
Test040GetLogRecords
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test040GetLogRecords: def test_010_create_events(self): """Event log contains the correct number of create events.""" <|body_0|> def test_020_get_total_events(self): """Get total number of events.""" <|body_1|> def xevent_log_contains_create_events(self)...
stack_v2_sparse_classes_36k_train_029859
2,896
permissive
[ { "docstring": "Event log contains the correct number of create events.", "name": "test_010_create_events", "signature": "def test_010_create_events(self)" }, { "docstring": "Get total number of events.", "name": "test_020_get_total_events", "signature": "def test_020_get_total_events(se...
3
stack_v2_sparse_classes_30k_train_010043
Implement the Python class `Test040GetLogRecords` described below. Class description: Implement the Test040GetLogRecords class. Method signatures and docstrings: - def test_010_create_events(self): Event log contains the correct number of create events. - def test_020_get_total_events(self): Get total number of event...
Implement the Python class `Test040GetLogRecords` described below. Class description: Implement the Test040GetLogRecords class. Method signatures and docstrings: - def test_010_create_events(self): Event log contains the correct number of create events. - def test_020_get_total_events(self): Get total number of event...
d72a9461894d9be7d71178fb7310101b8ef9066a
<|skeleton|> class Test040GetLogRecords: def test_010_create_events(self): """Event log contains the correct number of create events.""" <|body_0|> def test_020_get_total_events(self): """Get total number of events.""" <|body_1|> def xevent_log_contains_create_events(self)...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Test040GetLogRecords: def test_010_create_events(self): """Event log contains the correct number of create events.""" client = test_client.TestClient(context.node['baseurl']) log_records = client.getLogRecords(context.TOKEN, datetime.datetime(1800, 1, 1), event='create') assert...
the_stack_v2_python_sparse
test_utilities/src/d1_test/stress_tester/projects/_unit_test_bases_for_stress_tests/tier_1_mn_core_getlogrecords.py
DataONEorg/d1_python
train
15
dc8bf709c0bf2a6cd0d51a2fac2525abc58f1d1f
[ "v = 3.0 * np.sqrt(2) * self.eps * self.dw\nself.uext[0] = 0.5 * (1 + np.tanh((self.interval[0] - v * t) / (np.sqrt(2) * self.eps)))\nself.uext[-1] = 0.5 * (1 + np.tanh((self.interval[1] - v * t) / (np.sqrt(2) * self.eps)))\nself.uext[1:-1] = u[:]\nf = self.dtype_f(self.init)\nf.impl[:] = self.A.dot(self.uext)[1:-1...
<|body_start_0|> v = 3.0 * np.sqrt(2) * self.eps * self.dw self.uext[0] = 0.5 * (1 + np.tanh((self.interval[0] - v * t) / (np.sqrt(2) * self.eps))) self.uext[-1] = 0.5 * (1 + np.tanh((self.interval[1] - v * t) / (np.sqrt(2) * self.eps))) self.uext[1:-1] = u[:] f = self.dtype_f(se...
Example implementing the Allen-Cahn equation in 1D with finite differences and inhomogeneous Dirichlet-BC, with driving force, 0-1 formulation (Bayreuth example), semi-implicit time-stepping Attributes ---------- A : scipy.diags Second-order FD discretization of the 1D laplace operator. dx : float Distance between two ...
allencahn_front_semiimplicit
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class allencahn_front_semiimplicit: """Example implementing the Allen-Cahn equation in 1D with finite differences and inhomogeneous Dirichlet-BC, with driving force, 0-1 formulation (Bayreuth example), semi-implicit time-stepping Attributes ---------- A : scipy.diags Second-order FD discretization of t...
stack_v2_sparse_classes_36k_train_029860
26,441
permissive
[ { "docstring": "Parameters ---------- u : dtype_u Current values of the numerical solution. t : float Current time of the numerical solution is computed. Returns ------- f : dtype_f The right-hand side of the problem.", "name": "eval_f", "signature": "def eval_f(self, u, t)" }, { "docstring": "S...
2
null
Implement the Python class `allencahn_front_semiimplicit` described below. Class description: Example implementing the Allen-Cahn equation in 1D with finite differences and inhomogeneous Dirichlet-BC, with driving force, 0-1 formulation (Bayreuth example), semi-implicit time-stepping Attributes ---------- A : scipy.di...
Implement the Python class `allencahn_front_semiimplicit` described below. Class description: Example implementing the Allen-Cahn equation in 1D with finite differences and inhomogeneous Dirichlet-BC, with driving force, 0-1 formulation (Bayreuth example), semi-implicit time-stepping Attributes ---------- A : scipy.di...
1a51834bedffd4472e344bed28f4d766614b1537
<|skeleton|> class allencahn_front_semiimplicit: """Example implementing the Allen-Cahn equation in 1D with finite differences and inhomogeneous Dirichlet-BC, with driving force, 0-1 formulation (Bayreuth example), semi-implicit time-stepping Attributes ---------- A : scipy.diags Second-order FD discretization of t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class allencahn_front_semiimplicit: """Example implementing the Allen-Cahn equation in 1D with finite differences and inhomogeneous Dirichlet-BC, with driving force, 0-1 formulation (Bayreuth example), semi-implicit time-stepping Attributes ---------- A : scipy.diags Second-order FD discretization of the 1D laplace...
the_stack_v2_python_sparse
pySDC/implementations/problem_classes/AllenCahn_1D_FD.py
Parallel-in-Time/pySDC
train
30
a3e8841245ad8fbd3b72cc134cc8810b782b138e
[ "self.num_critical_alerts = num_critical_alerts\nself.num_critical_alerts_categories = num_critical_alerts_categories\nself.num_data_service_alerts = num_data_service_alerts\nself.num_data_service_critical_alerts = num_data_service_critical_alerts\nself.num_data_service_info_alerts = num_data_service_info_alerts\ns...
<|body_start_0|> self.num_critical_alerts = num_critical_alerts self.num_critical_alerts_categories = num_critical_alerts_categories self.num_data_service_alerts = num_data_service_alerts self.num_data_service_critical_alerts = num_data_service_critical_alerts self.num_data_servi...
Implementation of the 'ActiveAlertsStats' model. Specifies the active alert statistics details. Attributes: num_critical_alerts (long|int): Specifies the count of active critical Alerts excluding alerts that belong to other bucket. num_critical_alerts_categories (long|int): Specifies the count of active critical alerts...
ActiveAlertsStats
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ActiveAlertsStats: """Implementation of the 'ActiveAlertsStats' model. Specifies the active alert statistics details. Attributes: num_critical_alerts (long|int): Specifies the count of active critical Alerts excluding alerts that belong to other bucket. num_critical_alerts_categories (long|int): ...
stack_v2_sparse_classes_36k_train_029861
10,192
permissive
[ { "docstring": "Constructor for the ActiveAlertsStats class", "name": "__init__", "signature": "def __init__(self, num_critical_alerts=None, num_critical_alerts_categories=None, num_data_service_alerts=None, num_data_service_critical_alerts=None, num_data_service_info_alerts=None, num_data_service_warni...
2
null
Implement the Python class `ActiveAlertsStats` described below. Class description: Implementation of the 'ActiveAlertsStats' model. Specifies the active alert statistics details. Attributes: num_critical_alerts (long|int): Specifies the count of active critical Alerts excluding alerts that belong to other bucket. num_...
Implement the Python class `ActiveAlertsStats` described below. Class description: Implementation of the 'ActiveAlertsStats' model. Specifies the active alert statistics details. Attributes: num_critical_alerts (long|int): Specifies the count of active critical Alerts excluding alerts that belong to other bucket. num_...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class ActiveAlertsStats: """Implementation of the 'ActiveAlertsStats' model. Specifies the active alert statistics details. Attributes: num_critical_alerts (long|int): Specifies the count of active critical Alerts excluding alerts that belong to other bucket. num_critical_alerts_categories (long|int): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ActiveAlertsStats: """Implementation of the 'ActiveAlertsStats' model. Specifies the active alert statistics details. Attributes: num_critical_alerts (long|int): Specifies the count of active critical Alerts excluding alerts that belong to other bucket. num_critical_alerts_categories (long|int): Specifies the...
the_stack_v2_python_sparse
cohesity_management_sdk/models/active_alerts_stats.py
cohesity/management-sdk-python
train
24
d74ccc4fa9c99342a90721896edd07550d2a2735
[ "dirs, files = default_storage.listdir(path)\nfilenames = []\nfor filename in files:\n if filename.endswith('csv'):\n filenames.append(filename)\nlogging.debug(f\"Found the following bucket files: {','.join(filenames)}\")\nreturn filenames", "files = []\nfor filename in self.get_files_list():\n sis_t...
<|body_start_0|> dirs, files = default_storage.listdir(path) filenames = [] for filename in files: if filename.endswith('csv'): filenames.append(filename) logging.debug(f"Found the following bucket files: {','.join(filenames)}") return filenames <|end_...
StorageDao
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StorageDao: def get_files_list(self, path=''): """Returns list of file names at the given path. :param path: Path to list files at :type path: str""" <|body_0|> def get_latest_file(self): """Return latest RAD file in bucket""" <|body_1|> def download_fro...
stack_v2_sparse_classes_36k_train_029862
11,160
permissive
[ { "docstring": "Returns list of file names at the given path. :param path: Path to list files at :type path: str", "name": "get_files_list", "signature": "def get_files_list(self, path='')" }, { "docstring": "Return latest RAD file in bucket", "name": "get_latest_file", "signature": "def...
3
stack_v2_sparse_classes_30k_train_004323
Implement the Python class `StorageDao` described below. Class description: Implement the StorageDao class. Method signatures and docstrings: - def get_files_list(self, path=''): Returns list of file names at the given path. :param path: Path to list files at :type path: str - def get_latest_file(self): Return latest...
Implement the Python class `StorageDao` described below. Class description: Implement the StorageDao class. Method signatures and docstrings: - def get_files_list(self, path=''): Returns list of file names at the given path. :param path: Path to list files at :type path: str - def get_latest_file(self): Return latest...
bb81bf9a729f0919c47750909045ddd7bbe4d990
<|skeleton|> class StorageDao: def get_files_list(self, path=''): """Returns list of file names at the given path. :param path: Path to list files at :type path: str""" <|body_0|> def get_latest_file(self): """Return latest RAD file in bucket""" <|body_1|> def download_fro...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StorageDao: def get_files_list(self, path=''): """Returns list of file names at the given path. :param path: Path to list files at :type path: str""" dirs, files = default_storage.listdir(path) filenames = [] for filename in files: if filename.endswith('csv'): ...
the_stack_v2_python_sparse
retention_dashboard/dao/admin.py
uw-it-aca/retention-dashboard
train
0
0eb3423f2f00ffed3d61433f4323e621f4ddc6e0
[ "super(Plato2, self).__init__()\nargs = self.setup_args()\nif args.num_layers == 24:\n n_head = 16\n hidden_size = 1024\nelif args.num_layers == 32:\n n_head = 32\n hidden_size = 2048\nelse:\n raise ValueError('The pre-trained model only support 24 or 32 layers, but received num_layers=%d.' % args.nu...
<|body_start_0|> super(Plato2, self).__init__() args = self.setup_args() if args.num_layers == 24: n_head = 16 hidden_size = 1024 elif args.num_layers == 32: n_head = 32 hidden_size = 2048 else: raise ValueError('The pre...
Plato2
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Plato2: def __init__(self): """initialize with the necessary elements""" <|body_0|> def setup_args(self): """Setup arguments.""" <|body_1|> def generate(self, texts): """Get the robot responses of the input texts. Args: texts(list or str): If not...
stack_v2_sparse_classes_36k_train_029863
6,991
permissive
[ { "docstring": "initialize with the necessary elements", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Setup arguments.", "name": "setup_args", "signature": "def setup_args(self)" }, { "docstring": "Get the robot responses of the input texts. Args: text...
5
null
Implement the Python class `Plato2` described below. Class description: Implement the Plato2 class. Method signatures and docstrings: - def __init__(self): initialize with the necessary elements - def setup_args(self): Setup arguments. - def generate(self, texts): Get the robot responses of the input texts. Args: tex...
Implement the Python class `Plato2` described below. Class description: Implement the Plato2 class. Method signatures and docstrings: - def __init__(self): initialize with the necessary elements - def setup_args(self): Setup arguments. - def generate(self, texts): Get the robot responses of the input texts. Args: tex...
b402610a6f0b382a978e82473b541ea1fc6cf09a
<|skeleton|> class Plato2: def __init__(self): """initialize with the necessary elements""" <|body_0|> def setup_args(self): """Setup arguments.""" <|body_1|> def generate(self, texts): """Get the robot responses of the input texts. Args: texts(list or str): If not...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Plato2: def __init__(self): """initialize with the necessary elements""" super(Plato2, self).__init__() args = self.setup_args() if args.num_layers == 24: n_head = 16 hidden_size = 1024 elif args.num_layers == 32: n_head = 32 ...
the_stack_v2_python_sparse
modules/text/text_generation/plato2_en_large/module.py
PaddlePaddle/PaddleHub
train
12,914
64c2d34275e82de1920fa87b88c8f5db79128076
[ "def driver(start, target, cnt):\n res = []\n if cnt == 0 and target > 0:\n res.append([])\n for i in range(start, len(nums)):\n subsets = driver(i + 1, target - nums[i], cnt - 1)\n for subset in subsets:\n subset.append(i)\n res.extend(subsets)\n return res\nres =...
<|body_start_0|> def driver(start, target, cnt): res = [] if cnt == 0 and target > 0: res.append([]) for i in range(start, len(nums)): subsets = driver(i + 1, target - nums[i], cnt - 1) for subset in subsets: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def threeSumSmaller(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" <|body_0|> def threeSumSmaller2(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" <|body_1|> def threeSumSmallerTwoP...
stack_v2_sparse_classes_36k_train_029864
2,140
no_license
[ { "docstring": ":type nums: List[int] :type target: int :rtype: int", "name": "threeSumSmaller", "signature": "def threeSumSmaller(self, nums, target)" }, { "docstring": ":type nums: List[int] :type target: int :rtype: int", "name": "threeSumSmaller2", "signature": "def threeSumSmaller2(...
3
stack_v2_sparse_classes_30k_train_009964
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def threeSumSmaller(self, nums, target): :type nums: List[int] :type target: int :rtype: int - def threeSumSmaller2(self, nums, target): :type nums: List[int] :type target: int :...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def threeSumSmaller(self, nums, target): :type nums: List[int] :type target: int :rtype: int - def threeSumSmaller2(self, nums, target): :type nums: List[int] :type target: int :...
11d6bf2ba7b50c07e048df37c4e05c8f46b92241
<|skeleton|> class Solution: def threeSumSmaller(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" <|body_0|> def threeSumSmaller2(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" <|body_1|> def threeSumSmallerTwoP...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def threeSumSmaller(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" def driver(start, target, cnt): res = [] if cnt == 0 and target > 0: res.append([]) for i in range(start, len(nums)): ...
the_stack_v2_python_sparse
LeetCodes/Google/3Sum Smaller.py
chutianwen/LeetCodes
train
0
e0817766a0d19fdfe180f923a6272bf25f8c1b8d
[ "n_qubits = n_qubits or count_qubits(qubit_operator)\nn_hilbert = 2 ** n_qubits\nsuper(ParallelLinearQubitOperator, self).__init__(shape=(n_hilbert, n_hilbert), dtype=complex)\nself.qubit_operator = qubit_operator\nself.n_qubits = n_qubits\nself.options = options or LinearQubitOperatorOptions()\nself.qubit_operator...
<|body_start_0|> n_qubits = n_qubits or count_qubits(qubit_operator) n_hilbert = 2 ** n_qubits super(ParallelLinearQubitOperator, self).__init__(shape=(n_hilbert, n_hilbert), dtype=complex) self.qubit_operator = qubit_operator self.n_qubits = n_qubits self.options = optio...
A LinearOperator from a QubitOperator with multiple processors.
ParallelLinearQubitOperator
[ "LicenseRef-scancode-generic-cla", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ParallelLinearQubitOperator: """A LinearOperator from a QubitOperator with multiple processors.""" def __init__(self, qubit_operator, n_qubits=None, options=None): """Args: qubit_operator(QubitOperator): A qubit operator to be applied on vectors. n_qubits(int): The total number of qu...
stack_v2_sparse_classes_36k_train_029865
8,329
permissive
[ { "docstring": "Args: qubit_operator(QubitOperator): A qubit operator to be applied on vectors. n_qubits(int): The total number of qubits options(LinearQubitOperatorOptions): Options for the LinearOperator.", "name": "__init__", "signature": "def __init__(self, qubit_operator, n_qubits=None, options=Non...
2
null
Implement the Python class `ParallelLinearQubitOperator` described below. Class description: A LinearOperator from a QubitOperator with multiple processors. Method signatures and docstrings: - def __init__(self, qubit_operator, n_qubits=None, options=None): Args: qubit_operator(QubitOperator): A qubit operator to be ...
Implement the Python class `ParallelLinearQubitOperator` described below. Class description: A LinearOperator from a QubitOperator with multiple processors. Method signatures and docstrings: - def __init__(self, qubit_operator, n_qubits=None, options=None): Args: qubit_operator(QubitOperator): A qubit operator to be ...
788481753c798a72c5cb3aa9f2aa9da3ce3190b0
<|skeleton|> class ParallelLinearQubitOperator: """A LinearOperator from a QubitOperator with multiple processors.""" def __init__(self, qubit_operator, n_qubits=None, options=None): """Args: qubit_operator(QubitOperator): A qubit operator to be applied on vectors. n_qubits(int): The total number of qu...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ParallelLinearQubitOperator: """A LinearOperator from a QubitOperator with multiple processors.""" def __init__(self, qubit_operator, n_qubits=None, options=None): """Args: qubit_operator(QubitOperator): A qubit operator to be applied on vectors. n_qubits(int): The total number of qubits options(...
the_stack_v2_python_sparse
src/openfermion/linalg/linear_qubit_operator.py
quantumlib/OpenFermion
train
1,481
9a24c9335ef51e078bb970aa7705783607e06e86
[ "Editeur.__init__(self, pere, objet, attribut)\nself.ajouter_option('n', self.opt_creer_etat)\nself.ajouter_option('d', self.opt_supprimer_etat)", "prototype = self.objet\nmsg = '| |tit|' + 'Edition des états de {}'.format(prototype).ljust(76)\nmsg += '|ff||\\n' + self.opts.separateur + '\\n'\nmsg += 'Options :\\...
<|body_start_0|> Editeur.__init__(self, pere, objet, attribut) self.ajouter_option('n', self.opt_creer_etat) self.ajouter_option('d', self.opt_supprimer_etat) <|end_body_0|> <|body_start_1|> prototype = self.objet msg = '| |tit|' + 'Edition des états de {}'.format(prototype).lju...
Contexte-éditeur d'édition des états.
EdtEtats
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EdtEtats: """Contexte-éditeur d'édition des états.""" def __init__(self, pere, objet=None, attribut=None): """Constructeur de l'éditeur""" <|body_0|> def accueil(self): """Message d'accueil du contexte""" <|body_1|> def opt_creer_etat(self, arguments...
stack_v2_sparse_classes_36k_train_029866
4,367
permissive
[ { "docstring": "Constructeur de l'éditeur", "name": "__init__", "signature": "def __init__(self, pere, objet=None, attribut=None)" }, { "docstring": "Message d'accueil du contexte", "name": "accueil", "signature": "def accueil(self)" }, { "docstring": "Crée un nouvel état. Syntax...
5
stack_v2_sparse_classes_30k_train_014590
Implement the Python class `EdtEtats` described below. Class description: Contexte-éditeur d'édition des états. Method signatures and docstrings: - def __init__(self, pere, objet=None, attribut=None): Constructeur de l'éditeur - def accueil(self): Message d'accueil du contexte - def opt_creer_etat(self, arguments): C...
Implement the Python class `EdtEtats` described below. Class description: Contexte-éditeur d'édition des états. Method signatures and docstrings: - def __init__(self, pere, objet=None, attribut=None): Constructeur de l'éditeur - def accueil(self): Message d'accueil du contexte - def opt_creer_etat(self, arguments): C...
7e93bff08cdf891352efba587e89c40f3b4a2301
<|skeleton|> class EdtEtats: """Contexte-éditeur d'édition des états.""" def __init__(self, pere, objet=None, attribut=None): """Constructeur de l'éditeur""" <|body_0|> def accueil(self): """Message d'accueil du contexte""" <|body_1|> def opt_creer_etat(self, arguments...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EdtEtats: """Contexte-éditeur d'édition des états.""" def __init__(self, pere, objet=None, attribut=None): """Constructeur de l'éditeur""" Editeur.__init__(self, pere, objet, attribut) self.ajouter_option('n', self.opt_creer_etat) self.ajouter_option('d', self.opt_supprime...
the_stack_v2_python_sparse
src/primaires/salle/editeurs/sbedit/edt_etats.py
vincent-lg/tsunami
train
5
274d4086461a02d0f7413b391359524619e32c4c
[ "if not root:\n return []\nstack = []\nres = []\ncur = root\nstack.append(cur)\nwhile stack:\n cur = stack.pop()\n res.append(cur.val)\n if cur.right:\n stack.append(cur.right)\n if cur.left:\n stack.append(cur.left)\nreturn res", "if root is None:\n return []\nres = []\n\ndef trav...
<|body_start_0|> if not root: return [] stack = [] res = [] cur = root stack.append(cur) while stack: cur = stack.pop() res.append(cur.val) if cur.right: stack.append(cur.right) if cur.left: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def preorderTraversal(self, root): """:type root: TreeNode :rtype: List[int] 算法:迭代 基本思想: 前序遍历顺序:中左右 所以先将root节点入栈,然后出栈并保存, 再将其右节点入栈,左节点入栈,然后依次pop并保存""" <|body_0|> def preorderTraversal1(self, root): """:type root: TreeNode :rtype: List[int] 算法:递归""" ...
stack_v2_sparse_classes_36k_train_029867
1,705
no_license
[ { "docstring": ":type root: TreeNode :rtype: List[int] 算法:迭代 基本思想: 前序遍历顺序:中左右 所以先将root节点入栈,然后出栈并保存, 再将其右节点入栈,左节点入栈,然后依次pop并保存", "name": "preorderTraversal", "signature": "def preorderTraversal(self, root)" }, { "docstring": ":type root: TreeNode :rtype: List[int] 算法:递归", "name": "preorderTra...
2
stack_v2_sparse_classes_30k_train_017972
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def preorderTraversal(self, root): :type root: TreeNode :rtype: List[int] 算法:迭代 基本思想: 前序遍历顺序:中左右 所以先将root节点入栈,然后出栈并保存, 再将其右节点入栈,左节点入栈,然后依次pop并保存 - def preorderTraversal1(self, ro...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def preorderTraversal(self, root): :type root: TreeNode :rtype: List[int] 算法:迭代 基本思想: 前序遍历顺序:中左右 所以先将root节点入栈,然后出栈并保存, 再将其右节点入栈,左节点入栈,然后依次pop并保存 - def preorderTraversal1(self, ro...
6e18c5d257840489cc3fb1079ae3804c743982a4
<|skeleton|> class Solution: def preorderTraversal(self, root): """:type root: TreeNode :rtype: List[int] 算法:迭代 基本思想: 前序遍历顺序:中左右 所以先将root节点入栈,然后出栈并保存, 再将其右节点入栈,左节点入栈,然后依次pop并保存""" <|body_0|> def preorderTraversal1(self, root): """:type root: TreeNode :rtype: List[int] 算法:递归""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def preorderTraversal(self, root): """:type root: TreeNode :rtype: List[int] 算法:迭代 基本思想: 前序遍历顺序:中左右 所以先将root节点入栈,然后出栈并保存, 再将其右节点入栈,左节点入栈,然后依次pop并保存""" if not root: return [] stack = [] res = [] cur = root stack.append(cur) while sta...
the_stack_v2_python_sparse
out/production/leetcode/144.二叉树的前序遍历.py
yangyuxiang1996/leetcode
train
0
0ae879cbc727ebe8f4ab547c54b9fbe2fa08f7bf
[ "stack_name = data_utils.rand_name('heat')\ntemplate = self.read_template('random_string')\nenvironment = {'parameters': {'random_length': 20}}\nstack_identifier = self.create_stack(stack_name, template, environment=environment)\nself.client.wait_for_stack_status(stack_identifier, 'CREATE_COMPLETE')\nrandom_len = s...
<|body_start_0|> stack_name = data_utils.rand_name('heat') template = self.read_template('random_string') environment = {'parameters': {'random_length': 20}} stack_identifier = self.create_stack(stack_name, template, environment=environment) self.client.wait_for_stack_status(stac...
StackEnvironmentTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StackEnvironmentTest: def test_environment_parameter(self): """Test passing a stack parameter via the environment.""" <|body_0|> def test_environment_provider_resource(self): """Test passing resource_registry defining a provider resource.""" <|body_1|> d...
stack_v2_sparse_classes_36k_train_029868
3,986
permissive
[ { "docstring": "Test passing a stack parameter via the environment.", "name": "test_environment_parameter", "signature": "def test_environment_parameter(self)" }, { "docstring": "Test passing resource_registry defining a provider resource.", "name": "test_environment_provider_resource", ...
3
null
Implement the Python class `StackEnvironmentTest` described below. Class description: Implement the StackEnvironmentTest class. Method signatures and docstrings: - def test_environment_parameter(self): Test passing a stack parameter via the environment. - def test_environment_provider_resource(self): Test passing res...
Implement the Python class `StackEnvironmentTest` described below. Class description: Implement the StackEnvironmentTest class. Method signatures and docstrings: - def test_environment_parameter(self): Test passing a stack parameter via the environment. - def test_environment_provider_resource(self): Test passing res...
ae7e033fef80f2a4728a13bba18123f6fe32839a
<|skeleton|> class StackEnvironmentTest: def test_environment_parameter(self): """Test passing a stack parameter via the environment.""" <|body_0|> def test_environment_provider_resource(self): """Test passing resource_registry defining a provider resource.""" <|body_1|> d...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StackEnvironmentTest: def test_environment_parameter(self): """Test passing a stack parameter via the environment.""" stack_name = data_utils.rand_name('heat') template = self.read_template('random_string') environment = {'parameters': {'random_length': 20}} stack_ident...
the_stack_v2_python_sparse
tempest/api/orchestration/stacks/test_environment.py
Mirantis/tempest
train
3
fbba8018f1d961854ca82b15ad62cfc3088ff181
[ "getpermsessages = getpermsessage()\nif getpermsessages:\n self.uri = getpermsessages.get('zabbixurl', '')\n self.zabbixuser = getpermsessages.get('zabbixuser', '')\n self.zabbixpassword = encrypt_and_decode().decrypted_text(getpermsessages.get('zabbixpassword', ''))\nif zabbixurl:\n self.uri = zabbixur...
<|body_start_0|> getpermsessages = getpermsessage() if getpermsessages: self.uri = getpermsessages.get('zabbixurl', '') self.zabbixuser = getpermsessages.get('zabbixuser', '') self.zabbixpassword = encrypt_and_decode().decrypted_text(getpermsessages.get('zabbixpasswor...
Zabbix API类
ZabbixApi
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ZabbixApi: """Zabbix API类""" def __init__(self, encode='utf-8', zabbixurl=None, zabbixuser=None, zabbixpassword=None): """构造函数 :param request_id:JSON-RPC请求标识符""" <|body_0|> def call(self, method, params, AUTH=None): """ZabbixAPI请求程序 :param method: Zabbix API方法名称 ...
stack_v2_sparse_classes_36k_train_029869
21,075
no_license
[ { "docstring": "构造函数 :param request_id:JSON-RPC请求标识符", "name": "__init__", "signature": "def __init__(self, encode='utf-8', zabbixurl=None, zabbixuser=None, zabbixpassword=None)" }, { "docstring": "ZabbixAPI请求程序 :param method: Zabbix API方法名称 :param params: Zabbix API方法参数 :param through_authentic...
3
stack_v2_sparse_classes_30k_train_017372
Implement the Python class `ZabbixApi` described below. Class description: Zabbix API类 Method signatures and docstrings: - def __init__(self, encode='utf-8', zabbixurl=None, zabbixuser=None, zabbixpassword=None): 构造函数 :param request_id:JSON-RPC请求标识符 - def call(self, method, params, AUTH=None): ZabbixAPI请求程序 :param me...
Implement the Python class `ZabbixApi` described below. Class description: Zabbix API类 Method signatures and docstrings: - def __init__(self, encode='utf-8', zabbixurl=None, zabbixuser=None, zabbixpassword=None): 构造函数 :param request_id:JSON-RPC请求标识符 - def call(self, method, params, AUTH=None): ZabbixAPI请求程序 :param me...
5552af663ed2c668a16b9c687c2a50ed02595a01
<|skeleton|> class ZabbixApi: """Zabbix API类""" def __init__(self, encode='utf-8', zabbixurl=None, zabbixuser=None, zabbixpassword=None): """构造函数 :param request_id:JSON-RPC请求标识符""" <|body_0|> def call(self, method, params, AUTH=None): """ZabbixAPI请求程序 :param method: Zabbix API方法名称 ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ZabbixApi: """Zabbix API类""" def __init__(self, encode='utf-8', zabbixurl=None, zabbixuser=None, zabbixpassword=None): """构造函数 :param request_id:JSON-RPC请求标识符""" getpermsessages = getpermsessage() if getpermsessages: self.uri = getpermsessages.get('zabbixurl', '') ...
the_stack_v2_python_sparse
ADapi/zapi.py
openitsystem/itops
train
144
d0076b53aa907cac14adbf074e95388152652485
[ "super().__init__(z3_mask=z3_mask)\nself.edge_length = edge_length\nself.window_size = window_size", "z3_mask, result = self._optimize()\nmask = np.zeros((self.edge_length, self.edge_length))\nnum_masks_along_row = math.ceil(self.edge_length / self.window_size)\nfor row in range(self.edge_length):\n for column...
<|body_start_0|> super().__init__(z3_mask=z3_mask) self.edge_length = edge_length self.window_size = window_size <|end_body_0|> <|body_start_1|> z3_mask, result = self._optimize() mask = np.zeros((self.edge_length, self.edge_length)) num_masks_along_row = math.ceil(self....
Creates a solver by using z3 solver. Attributes: edge_length: int, side length of the 2D array (image) whose pixels are to be masked. window_size: int, side length of the square mask.
ImageOptimizer
[ "Apache-2.0", "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImageOptimizer: """Creates a solver by using z3 solver. Attributes: edge_length: int, side length of the 2D array (image) whose pixels are to be masked. window_size: int, side length of the square mask.""" def __init__(self, z3_mask, window_size, edge_length): """Initializer. Args: z...
stack_v2_sparse_classes_36k_train_029870
39,568
permissive
[ { "docstring": "Initializer. Args: z3_mask: list, contains mask bits as z3 vars. window_size: int, side length of the square mask. edge_length: int, side length of the 2D array (image) whose pixels are to be masked.", "name": "__init__", "signature": "def __init__(self, z3_mask, window_size, edge_length...
2
stack_v2_sparse_classes_30k_val_001145
Implement the Python class `ImageOptimizer` described below. Class description: Creates a solver by using z3 solver. Attributes: edge_length: int, side length of the 2D array (image) whose pixels are to be masked. window_size: int, side length of the square mask. Method signatures and docstrings: - def __init__(self,...
Implement the Python class `ImageOptimizer` described below. Class description: Creates a solver by using z3 solver. Attributes: edge_length: int, side length of the 2D array (image) whose pixels are to be masked. window_size: int, side length of the square mask. Method signatures and docstrings: - def __init__(self,...
5573d9c5822f4e866b6692769963ae819cb3f10d
<|skeleton|> class ImageOptimizer: """Creates a solver by using z3 solver. Attributes: edge_length: int, side length of the 2D array (image) whose pixels are to be masked. window_size: int, side length of the square mask.""" def __init__(self, z3_mask, window_size, edge_length): """Initializer. Args: z...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ImageOptimizer: """Creates a solver by using z3 solver. Attributes: edge_length: int, side length of the 2D array (image) whose pixels are to be masked. window_size: int, side length of the square mask.""" def __init__(self, z3_mask, window_size, edge_length): """Initializer. Args: z3_mask: list,...
the_stack_v2_python_sparse
smug_saliency/utils.py
Jimmy-INL/google-research
train
1
ff6878f3ed141a0b8bc18682be39bbe98d4f8cb4
[ "self.sync_data = QboSyncData.get_by_id(org_uid) or QboSyncData(id=org_uid, stage_index=0)\nself.stage = STAGES[self.sync_data.stage_index](org_uid)\nlogging.info('running stage {}: {}'.format(self.sync_data.stage_index, type(self.stage).__name__))", "stage_complete, next_payload = self.stage.next(payload)\nif st...
<|body_start_0|> self.sync_data = QboSyncData.get_by_id(org_uid) or QboSyncData(id=org_uid, stage_index=0) self.stage = STAGES[self.sync_data.stage_index](org_uid) logging.info('running stage {}: {}'.format(self.sync_data.stage_index, type(self.stage).__name__)) <|end_body_0|> <|body_start_1|> ...
Sync management class for a QBO org. This class gets repeatedly instantiated (with the org_uid) by the adapter, and its next method gets called. This class calls QBO APIs, stores the items retrieved via call to sync_utils, and does the bookkeeping so it knows what API to call next when the next method is called by the ...
QboSyncState
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QboSyncState: """Sync management class for a QBO org. This class gets repeatedly instantiated (with the org_uid) by the adapter, and its next method gets called. This class calls QBO APIs, stores the items retrieved via call to sync_utils, and does the bookkeeping so it knows what API to call nex...
stack_v2_sparse_classes_36k_train_029871
2,380
no_license
[ { "docstring": "Class initialiser. Retrieves stage of the sync which is in progress. Args: org_uid(str): org identifier", "name": "__init__", "signature": "def __init__(self, org_uid)" }, { "docstring": "Function which gets repeatedly called by the adapter. Delegates the call to the appropriate ...
2
stack_v2_sparse_classes_30k_val_000129
Implement the Python class `QboSyncState` described below. Class description: Sync management class for a QBO org. This class gets repeatedly instantiated (with the org_uid) by the adapter, and its next method gets called. This class calls QBO APIs, stores the items retrieved via call to sync_utils, and does the bookk...
Implement the Python class `QboSyncState` described below. Class description: Sync management class for a QBO org. This class gets repeatedly instantiated (with the org_uid) by the adapter, and its next method gets called. This class calls QBO APIs, stores the items retrieved via call to sync_utils, and does the bookk...
eeb4b2e879a5cb2492d4511d05aa5047d56892ad
<|skeleton|> class QboSyncState: """Sync management class for a QBO org. This class gets repeatedly instantiated (with the org_uid) by the adapter, and its next method gets called. This class calls QBO APIs, stores the items retrieved via call to sync_utils, and does the bookkeeping so it knows what API to call nex...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QboSyncState: """Sync management class for a QBO org. This class gets repeatedly instantiated (with the org_uid) by the adapter, and its next method gets called. This class calls QBO APIs, stores the items retrieved via call to sync_utils, and does the bookkeeping so it knows what API to call next when the ne...
the_stack_v2_python_sparse
app/sync_states/qbo/sync_state.py
SoulMen007/acuit-gl-ingester-zuora
train
0
d4c039cd805d97c83472227e72dbae3b0861883e
[ "username = username if username is not None else self.normalize_email(email)\nuser = self.model(username=username, email=self.normalize_email(email))\nuser.set_password(password)\nuser.save(using=self._db)\nreturn user", "user = self.create_user(username=email, email=email, password=password)\nuser.is_admin = Tr...
<|body_start_0|> username = username if username is not None else self.normalize_email(email) user = self.model(username=username, email=self.normalize_email(email)) user.set_password(password) user.save(using=self._db) return user <|end_body_0|> <|body_start_1|> user = ...
MyUserManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyUserManager: def create_user(self, email='', password=None, username=None): """Creates and saves a User with the given email, date of birth and password.""" <|body_0|> def create_superuser(self, email, password): """Creates and saves a superuser with the given emai...
stack_v2_sparse_classes_36k_train_029872
3,480
no_license
[ { "docstring": "Creates and saves a User with the given email, date of birth and password.", "name": "create_user", "signature": "def create_user(self, email='', password=None, username=None)" }, { "docstring": "Creates and saves a superuser with the given email, date of birth and password.", ...
2
stack_v2_sparse_classes_30k_train_019443
Implement the Python class `MyUserManager` described below. Class description: Implement the MyUserManager class. Method signatures and docstrings: - def create_user(self, email='', password=None, username=None): Creates and saves a User with the given email, date of birth and password. - def create_superuser(self, e...
Implement the Python class `MyUserManager` described below. Class description: Implement the MyUserManager class. Method signatures and docstrings: - def create_user(self, email='', password=None, username=None): Creates and saves a User with the given email, date of birth and password. - def create_superuser(self, e...
3fd9d8e7ece11848ff5026845dbfa41d2a017270
<|skeleton|> class MyUserManager: def create_user(self, email='', password=None, username=None): """Creates and saves a User with the given email, date of birth and password.""" <|body_0|> def create_superuser(self, email, password): """Creates and saves a superuser with the given emai...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MyUserManager: def create_user(self, email='', password=None, username=None): """Creates and saves a User with the given email, date of birth and password.""" username = username if username is not None else self.normalize_email(email) user = self.model(username=username, email=self.no...
the_stack_v2_python_sparse
users/models.py
fabiogelbcke/direitoemtela
train
1
cbb24778f2380ac7ebddb317b14761a8b48f67e1
[ "super(OneLayerNN, self).__init__()\nself.n_in = n_in\nself.hidden = nn.Linear(n_in, 1)\nself.dropout = nn.Dropout(dropout)\nself.relu = nn.ReLU()", "y = x.view(-1, self.n_in)\ny = self.hidden(y)\ny = self.dropout(y)\ny = self.relu(y)\nreturn y" ]
<|body_start_0|> super(OneLayerNN, self).__init__() self.n_in = n_in self.hidden = nn.Linear(n_in, 1) self.dropout = nn.Dropout(dropout) self.relu = nn.ReLU() <|end_body_0|> <|body_start_1|> y = x.view(-1, self.n_in) y = self.hidden(y) y = self.dropout(y)...
OneLayerNN
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OneLayerNN: def __init__(self, n_in, n_h=1, dropout=0.0): """FIXME! briefly describe function :param n_in: :param n_h: :param n_layers: :param dropout: :returns: :rtype:""" <|body_0|> def forward(self, x): """FIXME! briefly describe function :param x: :returns: :rtyp...
stack_v2_sparse_classes_36k_train_029873
1,740
permissive
[ { "docstring": "FIXME! briefly describe function :param n_in: :param n_h: :param n_layers: :param dropout: :returns: :rtype:", "name": "__init__", "signature": "def __init__(self, n_in, n_h=1, dropout=0.0)" }, { "docstring": "FIXME! briefly describe function :param x: :returns: :rtype:", "na...
2
stack_v2_sparse_classes_30k_train_015930
Implement the Python class `OneLayerNN` described below. Class description: Implement the OneLayerNN class. Method signatures and docstrings: - def __init__(self, n_in, n_h=1, dropout=0.0): FIXME! briefly describe function :param n_in: :param n_h: :param n_layers: :param dropout: :returns: :rtype: - def forward(self,...
Implement the Python class `OneLayerNN` described below. Class description: Implement the OneLayerNN class. Method signatures and docstrings: - def __init__(self, n_in, n_h=1, dropout=0.0): FIXME! briefly describe function :param n_in: :param n_h: :param n_layers: :param dropout: :returns: :rtype: - def forward(self,...
fc3fd121fbffb630e3652bacdc74d1b1bddab50e
<|skeleton|> class OneLayerNN: def __init__(self, n_in, n_h=1, dropout=0.0): """FIXME! briefly describe function :param n_in: :param n_h: :param n_layers: :param dropout: :returns: :rtype:""" <|body_0|> def forward(self, x): """FIXME! briefly describe function :param x: :returns: :rtyp...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OneLayerNN: def __init__(self, n_in, n_h=1, dropout=0.0): """FIXME! briefly describe function :param n_in: :param n_h: :param n_layers: :param dropout: :returns: :rtype:""" super(OneLayerNN, self).__init__() self.n_in = n_in self.hidden = nn.Linear(n_in, 1) self.dropout...
the_stack_v2_python_sparse
src/classicalgsg/nn_models/models.py
kyrarivest/ACRES_REU_Project_2021
train
0
aeb07c5d93da7b5207309c512f4625c85e24e871
[ "self.variance.gradient = gradients[0]\nself.wavelengths.gradient = gradients[1]\nself.lengthscales.gradient = gradients[2]", "N = 7\nw0 = 2 * np.pi / self.wavelengths\nlengthscales = 2 * self.lengthscales\n[q2, dq2l] = seriescoeff(N, lengthscales, self.variance)\ndq2l = 2 * dq2l\nif np.any(np.isfinite(q2) == Fal...
<|body_start_0|> self.variance.gradient = gradients[0] self.wavelengths.gradient = gradients[1] self.lengthscales.gradient = gradients[2] <|end_body_0|> <|body_start_1|> N = 7 w0 = 2 * np.pi / self.wavelengths lengthscales = 2 * self.lengthscales [q2, dq2l] = ser...
Class provide extra functionality to transfer this covariance function into SDE form. Standard Periodic kernel: .. math:: k(x,y) = heta_1 \\exp \\left[ - rac{1}{2} {}\\sum_{i=1}^{input\\_dim} \\left( rac{\\sin( rac{\\pi}{\\lambda_i} (x_i - y_i) )}{l_i} ight)^2 ight] }
sde_StdPeriodic
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class sde_StdPeriodic: """Class provide extra functionality to transfer this covariance function into SDE form. Standard Periodic kernel: .. math:: k(x,y) = heta_1 \\exp \\left[ - rac{1}{2} {}\\sum_{i=1}^{input\\_dim} \\left( rac{\\sin( rac{\\pi}{\\lambda_i} (x_i - y_i) )}{l_i} ight)^2 ight] }""" ...
stack_v2_sparse_classes_36k_train_029874
6,203
permissive
[ { "docstring": "Update gradient in the order in which parameters are represented in the kernel", "name": "sde_update_gradient_full", "signature": "def sde_update_gradient_full(self, gradients)" }, { "docstring": "Return the state space representation of the covariance. ! Note: one must constrain...
2
stack_v2_sparse_classes_30k_train_010692
Implement the Python class `sde_StdPeriodic` described below. Class description: Class provide extra functionality to transfer this covariance function into SDE form. Standard Periodic kernel: .. math:: k(x,y) = heta_1 \\exp \\left[ - rac{1}{2} {}\\sum_{i=1}^{input\\_dim} \\left( rac{\\sin( rac{\\pi}{\\lambda_i} (x_i ...
Implement the Python class `sde_StdPeriodic` described below. Class description: Class provide extra functionality to transfer this covariance function into SDE form. Standard Periodic kernel: .. math:: k(x,y) = heta_1 \\exp \\left[ - rac{1}{2} {}\\sum_{i=1}^{input\\_dim} \\left( rac{\\sin( rac{\\pi}{\\lambda_i} (x_i ...
4fb8af1d51e74e3cf3bee5dabd641857b8cf8100
<|skeleton|> class sde_StdPeriodic: """Class provide extra functionality to transfer this covariance function into SDE form. Standard Periodic kernel: .. math:: k(x,y) = heta_1 \\exp \\left[ - rac{1}{2} {}\\sum_{i=1}^{input\\_dim} \\left( rac{\\sin( rac{\\pi}{\\lambda_i} (x_i - y_i) )}{l_i} ight)^2 ight] }""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class sde_StdPeriodic: """Class provide extra functionality to transfer this covariance function into SDE form. Standard Periodic kernel: .. math:: k(x,y) = heta_1 \\exp \\left[ - rac{1}{2} {}\\sum_{i=1}^{input\\_dim} \\left( rac{\\sin( rac{\\pi}{\\lambda_i} (x_i - y_i) )}{l_i} ight)^2 ight] }""" def sde_updat...
the_stack_v2_python_sparse
bopl/aux_software/GPy/kern/_src/sde_standard_periodic.py
RaulAstudillo06/BOPL
train
3
456fe908a6e60f51a0dd4cd89d9186e91d668309
[ "intervals.append(newInterval)\nintervals.sort(key=lambda x: x.start)\nans = []\nfor i in range(len(intervals)):\n if ans == []:\n ans.append(intervals[i])\n elif ans[-1].start <= intervals[i].start <= ans[-1].end:\n ans[-1].end = max(ans[-1].end, intervals[i].end)\n else:\n ans.append...
<|body_start_0|> intervals.append(newInterval) intervals.sort(key=lambda x: x.start) ans = [] for i in range(len(intervals)): if ans == []: ans.append(intervals[i]) elif ans[-1].start <= intervals[i].start <= ans[-1].end: ans[-1].en...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def insert(self, intervals, newInterval): """:type intervals: List[Interval] :type newInterval: Interval :rtype: List[Interval]""" <|body_0|> def insert_no_class(self, intervals, newInterval): """:type intervals: List[Interval] :type newInterval: Interval :...
stack_v2_sparse_classes_36k_train_029875
3,075
no_license
[ { "docstring": ":type intervals: List[Interval] :type newInterval: Interval :rtype: List[Interval]", "name": "insert", "signature": "def insert(self, intervals, newInterval)" }, { "docstring": ":type intervals: List[Interval] :type newInterval: Interval :rtype: List[Interval]", "name": "inse...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def insert(self, intervals, newInterval): :type intervals: List[Interval] :type newInterval: Interval :rtype: List[Interval] - def insert_no_class(self, intervals, newInterval): ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def insert(self, intervals, newInterval): :type intervals: List[Interval] :type newInterval: Interval :rtype: List[Interval] - def insert_no_class(self, intervals, newInterval): ...
2d5fa4cd696d5035ea8859befeadc5cc436959c9
<|skeleton|> class Solution: def insert(self, intervals, newInterval): """:type intervals: List[Interval] :type newInterval: Interval :rtype: List[Interval]""" <|body_0|> def insert_no_class(self, intervals, newInterval): """:type intervals: List[Interval] :type newInterval: Interval :...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def insert(self, intervals, newInterval): """:type intervals: List[Interval] :type newInterval: Interval :rtype: List[Interval]""" intervals.append(newInterval) intervals.sort(key=lambda x: x.start) ans = [] for i in range(len(intervals)): if ans =...
the_stack_v2_python_sparse
SourceCode/Python/Problem/00057.Insert Interval.py
roger6blog/LeetCode
train
0
57b9fc03cd07705e7a03f717af91c5c3a89a16a1
[ "self.delimiter = delimiter\nself.exclude_cols = exclude_cols\nself.fieldnames = fieldnames", "with open(file, 'r') as f:\n reader = csv.DictReader(f, delimiter=self.delimiter, fieldnames=self.fieldnames)\n ncols = np.arange(len(reader.fieldnames))\n include_cols = np.delete(ncols, self.exclude_cols)\n ...
<|body_start_0|> self.delimiter = delimiter self.exclude_cols = exclude_cols self.fieldnames = fieldnames <|end_body_0|> <|body_start_1|> with open(file, 'r') as f: reader = csv.DictReader(f, delimiter=self.delimiter, fieldnames=self.fieldnames) ncols = np.arange...
FileReader
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FileReader: def __init__(self, delimiter: str=',', exclude_cols: list=[], fieldnames: list=None): """Initialize object class to read a file. Args: delimiter (str): Delimiter used in the file (default `,`). exclude_cols (list): Exclude column in the file (default `None`). fieldnames (list...
stack_v2_sparse_classes_36k_train_029876
1,550
permissive
[ { "docstring": "Initialize object class to read a file. Args: delimiter (str): Delimiter used in the file (default `,`). exclude_cols (list): Exclude column in the file (default `None`). fieldnames (list): Names of the column in the file (default `None`).", "name": "__init__", "signature": "def __init__...
2
stack_v2_sparse_classes_30k_train_021169
Implement the Python class `FileReader` described below. Class description: Implement the FileReader class. Method signatures and docstrings: - def __init__(self, delimiter: str=',', exclude_cols: list=[], fieldnames: list=None): Initialize object class to read a file. Args: delimiter (str): Delimiter used in the fil...
Implement the Python class `FileReader` described below. Class description: Implement the FileReader class. Method signatures and docstrings: - def __init__(self, delimiter: str=',', exclude_cols: list=[], fieldnames: list=None): Initialize object class to read a file. Args: delimiter (str): Delimiter used in the fil...
29657c0b0f3952dd2e817bdfe8253f76800c2342
<|skeleton|> class FileReader: def __init__(self, delimiter: str=',', exclude_cols: list=[], fieldnames: list=None): """Initialize object class to read a file. Args: delimiter (str): Delimiter used in the file (default `,`). exclude_cols (list): Exclude column in the file (default `None`). fieldnames (list...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FileReader: def __init__(self, delimiter: str=',', exclude_cols: list=[], fieldnames: list=None): """Initialize object class to read a file. Args: delimiter (str): Delimiter used in the file (default `,`). exclude_cols (list): Exclude column in the file (default `None`). fieldnames (list): Names of th...
the_stack_v2_python_sparse
end2you/data_generator/file_reader.py
end2you/end2you
train
101
8ebeb0f1da1bd23a06aef38c935911eeae9e4654
[ "if not root:\n return True\nreturn self.search_helper(root.left, root.right)", "if not t1 and (not t2):\n return True\nif not t1 or not t2:\n return False\nif t1.val != t2.val:\n return False\nreturn self.search_helper(t1.left, t2.right) and self.search_helper(t1.right, t2.left)", "queue = []\nqueu...
<|body_start_0|> if not root: return True return self.search_helper(root.left, root.right) <|end_body_0|> <|body_start_1|> if not t1 and (not t2): return True if not t1 or not t2: return False if t1.val != t2.val: return False ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def is_symmetric(self, root: TreeNode) -> bool: """判断两棵树是否相同 Args: root: 根节点 Returns: 布尔值""" <|body_0|> def search_helper(self, t1: TreeNode, t2: TreeNode) -> bool: """判断是否是对称二叉树 Args: t1: 二叉树t1 t2: 二叉树t2 Returns: 布尔值""" <|body_1|> def is_symme...
stack_v2_sparse_classes_36k_train_029877
2,784
permissive
[ { "docstring": "判断两棵树是否相同 Args: root: 根节点 Returns: 布尔值", "name": "is_symmetric", "signature": "def is_symmetric(self, root: TreeNode) -> bool" }, { "docstring": "判断是否是对称二叉树 Args: t1: 二叉树t1 t2: 二叉树t2 Returns: 布尔值", "name": "search_helper", "signature": "def search_helper(self, t1: TreeNod...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def is_symmetric(self, root: TreeNode) -> bool: 判断两棵树是否相同 Args: root: 根节点 Returns: 布尔值 - def search_helper(self, t1: TreeNode, t2: TreeNode) -> bool: 判断是否是对称二叉树 Args: t1: 二叉树t1 t...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def is_symmetric(self, root: TreeNode) -> bool: 判断两棵树是否相同 Args: root: 根节点 Returns: 布尔值 - def search_helper(self, t1: TreeNode, t2: TreeNode) -> bool: 判断是否是对称二叉树 Args: t1: 二叉树t1 t...
50f35eef6a0ad63173efed10df3c835b1dceaa3f
<|skeleton|> class Solution: def is_symmetric(self, root: TreeNode) -> bool: """判断两棵树是否相同 Args: root: 根节点 Returns: 布尔值""" <|body_0|> def search_helper(self, t1: TreeNode, t2: TreeNode) -> bool: """判断是否是对称二叉树 Args: t1: 二叉树t1 t2: 二叉树t2 Returns: 布尔值""" <|body_1|> def is_symme...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def is_symmetric(self, root: TreeNode) -> bool: """判断两棵树是否相同 Args: root: 根节点 Returns: 布尔值""" if not root: return True return self.search_helper(root.left, root.right) def search_helper(self, t1: TreeNode, t2: TreeNode) -> bool: """判断是否是对称二叉树 Args: t1:...
the_stack_v2_python_sparse
src/leetcodepython/tree/symmetric_tree_101.py
zhangyu345293721/leetcode
train
101
04e54ace2cb9f52486ec8f7881b1a7e5c7bc0ecc
[ "context = dict(form=UpLoadForm())\ncontext.update(setMenus())\nreturn render_template('webapp/datain.html', **context)", "_value = int(request.json.get('value'))\ncontext = dict(form=UpLoadForm())\ncontext.update(setMenus())\ntemplate_name = 'webapp/form/register.html'\nreturn jsonify(body=render_template(templa...
<|body_start_0|> context = dict(form=UpLoadForm()) context.update(setMenus()) return render_template('webapp/datain.html', **context) <|end_body_0|> <|body_start_1|> _value = int(request.json.get('value')) context = dict(form=UpLoadForm()) context.update(setMenus()) ...
CDHChange
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CDHChange: def get(self): """用于 列表翻页 的刷新 :return:""" <|body_0|> def post(self): """请求来自于:1)页面切换;2)定时器 :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> context = dict(form=UpLoadForm()) context.update(setMenus()) return render...
stack_v2_sparse_classes_36k_train_029878
4,507
no_license
[ { "docstring": "用于 列表翻页 的刷新 :return:", "name": "get", "signature": "def get(self)" }, { "docstring": "请求来自于:1)页面切换;2)定时器 :return:", "name": "post", "signature": "def post(self)" } ]
2
stack_v2_sparse_classes_30k_train_011232
Implement the Python class `CDHChange` described below. Class description: Implement the CDHChange class. Method signatures and docstrings: - def get(self): 用于 列表翻页 的刷新 :return: - def post(self): 请求来自于:1)页面切换;2)定时器 :return:
Implement the Python class `CDHChange` described below. Class description: Implement the CDHChange class. Method signatures and docstrings: - def get(self): 用于 列表翻页 的刷新 :return: - def post(self): 请求来自于:1)页面切换;2)定时器 :return: <|skeleton|> class CDHChange: def get(self): """用于 列表翻页 的刷新 :return:""" ...
f085ad50e52b6bbfd23d1afba2a7a86aae52e099
<|skeleton|> class CDHChange: def get(self): """用于 列表翻页 的刷新 :return:""" <|body_0|> def post(self): """请求来自于:1)页面切换;2)定时器 :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CDHChange: def get(self): """用于 列表翻页 的刷新 :return:""" context = dict(form=UpLoadForm()) context.update(setMenus()) return render_template('webapp/datain.html', **context) def post(self): """请求来自于:1)页面切换;2)定时器 :return:""" _value = int(request.json.get('value'...
the_stack_v2_python_sparse
nebula/portal/views/portal/hadoop/hadoop.py
shenwei0329/nebula
train
1
19445d8c1c6defe77a7d69523a592a9457c22cea
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "conte...
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
Missing associated documentation comment in .proto file.
JobServiceServicer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JobServiceServicer: """Missing associated documentation comment in .proto file.""" def ClaimStatus(self, request, context): """Claims status for the specified job.""" <|body_0|> def Get(self, request, context): """Returns the job for the specified agent.""" ...
stack_v2_sparse_classes_36k_train_029879
8,636
permissive
[ { "docstring": "Claims status for the specified job.", "name": "ClaimStatus", "signature": "def ClaimStatus(self, request, context)" }, { "docstring": "Returns the job for the specified agent.", "name": "Get", "signature": "def Get(self, request, context)" }, { "docstring": "Retu...
4
stack_v2_sparse_classes_30k_train_018962
Implement the Python class `JobServiceServicer` described below. Class description: Missing associated documentation comment in .proto file. Method signatures and docstrings: - def ClaimStatus(self, request, context): Claims status for the specified job. - def Get(self, request, context): Returns the job for the spec...
Implement the Python class `JobServiceServicer` described below. Class description: Missing associated documentation comment in .proto file. Method signatures and docstrings: - def ClaimStatus(self, request, context): Claims status for the specified job. - def Get(self, request, context): Returns the job for the spec...
b906a014dd893e2697864e1e48e814a8d9fbc48c
<|skeleton|> class JobServiceServicer: """Missing associated documentation comment in .proto file.""" def ClaimStatus(self, request, context): """Claims status for the specified job.""" <|body_0|> def Get(self, request, context): """Returns the job for the specified agent.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class JobServiceServicer: """Missing associated documentation comment in .proto file.""" def ClaimStatus(self, request, context): """Claims status for the specified job.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotIm...
the_stack_v2_python_sparse
yandex/cloud/loadtesting/agent/v1/job_service_pb2_grpc.py
yandex-cloud/python-sdk
train
63
ca39b775b45deb6d54c875baa82deec85a352da4
[ "professional_id = request.GET.get('id')\nprofessional_user = request.GET.get('user')\nif professional_id and professional_id is not None:\n queryset = queryset.filter(id=professional_id)\nif professional_user and professional_user is not None:\n queryset = queryset.filter(user=professional_user)\nqueryset = ...
<|body_start_0|> professional_id = request.GET.get('id') professional_user = request.GET.get('user') if professional_id and professional_id is not None: queryset = queryset.filter(id=professional_id) if professional_user and professional_user is not None: queryset...
Professional View
ProfessionalView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProfessionalView: """Professional View""" def filter(self, request, queryset): """Filter queryset from request argument""" <|body_0|> def post_save(self, request, instance, professional_data, created): """Save professional's M2M field""" <|body_1|> <|end...
stack_v2_sparse_classes_36k_train_029880
5,417
no_license
[ { "docstring": "Filter queryset from request argument", "name": "filter", "signature": "def filter(self, request, queryset)" }, { "docstring": "Save professional's M2M field", "name": "post_save", "signature": "def post_save(self, request, instance, professional_data, created)" } ]
2
null
Implement the Python class `ProfessionalView` described below. Class description: Professional View Method signatures and docstrings: - def filter(self, request, queryset): Filter queryset from request argument - def post_save(self, request, instance, professional_data, created): Save professional's M2M field
Implement the Python class `ProfessionalView` described below. Class description: Professional View Method signatures and docstrings: - def filter(self, request, queryset): Filter queryset from request argument - def post_save(self, request, instance, professional_data, created): Save professional's M2M field <|skel...
95d21cd6036a99c5f399b700a5426e9e2e17e878
<|skeleton|> class ProfessionalView: """Professional View""" def filter(self, request, queryset): """Filter queryset from request argument""" <|body_0|> def post_save(self, request, instance, professional_data, created): """Save professional's M2M field""" <|body_1|> <|end...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProfessionalView: """Professional View""" def filter(self, request, queryset): """Filter queryset from request argument""" professional_id = request.GET.get('id') professional_user = request.GET.get('user') if professional_id and professional_id is not None: qu...
the_stack_v2_python_sparse
listepro/views/professional_view.py
alexandrenorman/mixeur
train
0
5bfbaf23dbc7bae816032633e63f2c8bd25b395a
[ "from ibc.client import InteractiveBrokersClient\nself.client: InteractiveBrokersClient = ib_client\nself.session: InteractiveBrokersSession = ib_session", "if isinstance(frequency, Enum):\n frequency = frequency.value\npayload = {'acctIds': account_ids, 'freq': frequency}\ncontent = self.session.make_request(...
<|body_start_0|> from ibc.client import InteractiveBrokersClient self.client: InteractiveBrokersClient = ib_client self.session: InteractiveBrokersSession = ib_session <|end_body_0|> <|body_start_1|> if isinstance(frequency, Enum): frequency = frequency.value payload...
PortfolioAnalysis
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PortfolioAnalysis: def __init__(self, ib_client: object, ib_session: InteractiveBrokersSession) -> None: """Initializes the `PortfolioAnalysis` client. ### Parameters ---- ib_client : object The `InteractiveBrokersClient` Python Client. ib_session : InteractiveBrokersSession The IB sessi...
stack_v2_sparse_classes_36k_train_029881
3,507
permissive
[ { "docstring": "Initializes the `PortfolioAnalysis` client. ### Parameters ---- ib_client : object The `InteractiveBrokersClient` Python Client. ib_session : InteractiveBrokersSession The IB session handler.", "name": "__init__", "signature": "def __init__(self, ib_client: object, ib_session: Interactiv...
4
null
Implement the Python class `PortfolioAnalysis` described below. Class description: Implement the PortfolioAnalysis class. Method signatures and docstrings: - def __init__(self, ib_client: object, ib_session: InteractiveBrokersSession) -> None: Initializes the `PortfolioAnalysis` client. ### Parameters ---- ib_client ...
Implement the Python class `PortfolioAnalysis` described below. Class description: Implement the PortfolioAnalysis class. Method signatures and docstrings: - def __init__(self, ib_client: object, ib_session: InteractiveBrokersSession) -> None: Initializes the `PortfolioAnalysis` client. ### Parameters ---- ib_client ...
a5b02ea914d6cd7683aff30cd38547e6150dc374
<|skeleton|> class PortfolioAnalysis: def __init__(self, ib_client: object, ib_session: InteractiveBrokersSession) -> None: """Initializes the `PortfolioAnalysis` client. ### Parameters ---- ib_client : object The `InteractiveBrokersClient` Python Client. ib_session : InteractiveBrokersSession The IB sessi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PortfolioAnalysis: def __init__(self, ib_client: object, ib_session: InteractiveBrokersSession) -> None: """Initializes the `PortfolioAnalysis` client. ### Parameters ---- ib_client : object The `InteractiveBrokersClient` Python Client. ib_session : InteractiveBrokersSession The IB session handler."""...
the_stack_v2_python_sparse
ibc/rest/portfolio_analysis.py
xuelee85/interactive-brokers-api
train
0
b93ccbbeb49e048b9f874a28c38bd084eca037d4
[ "context = request.environ['cinder.context']\ntrimmed = dict(id=group_type.get('id'), name=group_type.get('name'), description=group_type.get('description'), is_public=group_type.get('is_public'))\nif context.authorize(policy.SHOW_ACCESS_POLICY, fatal=False):\n trimmed['group_specs'] = group_type.get('group_spec...
<|body_start_0|> context = request.environ['cinder.context'] trimmed = dict(id=group_type.get('id'), name=group_type.get('name'), description=group_type.get('description'), is_public=group_type.get('is_public')) if context.authorize(policy.SHOW_ACCESS_POLICY, fatal=False): trimmed['g...
ViewBuilder
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ViewBuilder: def show(self, request, group_type, brief=False): """Trim away extraneous group type attributes.""" <|body_0|> def index(self, request, group_types): """Index over trimmed group types.""" <|body_1|> <|end_skeleton|> <|body_start_0|> con...
stack_v2_sparse_classes_36k_train_029882
1,894
permissive
[ { "docstring": "Trim away extraneous group type attributes.", "name": "show", "signature": "def show(self, request, group_type, brief=False)" }, { "docstring": "Index over trimmed group types.", "name": "index", "signature": "def index(self, request, group_types)" } ]
2
stack_v2_sparse_classes_30k_train_021124
Implement the Python class `ViewBuilder` described below. Class description: Implement the ViewBuilder class. Method signatures and docstrings: - def show(self, request, group_type, brief=False): Trim away extraneous group type attributes. - def index(self, request, group_types): Index over trimmed group types.
Implement the Python class `ViewBuilder` described below. Class description: Implement the ViewBuilder class. Method signatures and docstrings: - def show(self, request, group_type, brief=False): Trim away extraneous group type attributes. - def index(self, request, group_types): Index over trimmed group types. <|sk...
04a5d6b8c28271f6aefe2bbae6a1e16c1c235835
<|skeleton|> class ViewBuilder: def show(self, request, group_type, brief=False): """Trim away extraneous group type attributes.""" <|body_0|> def index(self, request, group_types): """Index over trimmed group types.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ViewBuilder: def show(self, request, group_type, brief=False): """Trim away extraneous group type attributes.""" context = request.environ['cinder.context'] trimmed = dict(id=group_type.get('id'), name=group_type.get('name'), description=group_type.get('description'), is_public=group_t...
the_stack_v2_python_sparse
cinder/api/v3/views/group_types.py
LINBIT/openstack-cinder
train
9
f50eb6a7798f814239a85228d8b9e9d3e2ec7974
[ "identity = flask_jwt.get_jwt_identity() or {}\ntry:\n app = identity.get('app')\n return session.Session(save=False, profile=session.SessionProfile(**identity['profile']), groups=[groups.Group(**g) for g in identity['groups'] or []], app=app if app is None else session.SessionApp(**app), default_object_perms...
<|body_start_0|> identity = flask_jwt.get_jwt_identity() or {} try: app = identity.get('app') return session.Session(save=False, profile=session.SessionProfile(**identity['profile']), groups=[groups.Group(**g) for g in identity['groups'] or []], app=app if app is None else sessio...
Hooks up our JWT tokens to the session interface so we can use flask the way it was intended but also get the benefit of JWTs. Sessions in this system are immutable, and may only be written by an application server
JWTSessionInterface
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JWTSessionInterface: """Hooks up our JWT tokens to the session interface so we can use flask the way it was intended but also get the benefit of JWTs. Sessions in this system are immutable, and may only be written by an application server""" def open_session(self, app, request): """P...
stack_v2_sparse_classes_36k_train_029883
4,373
no_license
[ { "docstring": "Populate the session from the JWT cookies at the start of a request", "name": "open_session", "signature": "def open_session(self, app, request)" }, { "docstring": "Save the session at the end of a request if it's new and we are the auth server", "name": "save_session", "...
2
stack_v2_sparse_classes_30k_train_017026
Implement the Python class `JWTSessionInterface` described below. Class description: Hooks up our JWT tokens to the session interface so we can use flask the way it was intended but also get the benefit of JWTs. Sessions in this system are immutable, and may only be written by an application server Method signatures ...
Implement the Python class `JWTSessionInterface` described below. Class description: Hooks up our JWT tokens to the session interface so we can use flask the way it was intended but also get the benefit of JWTs. Sessions in this system are immutable, and may only be written by an application server Method signatures ...
dbba9f3b292ffef6ea924608fa54237171f0aaeb
<|skeleton|> class JWTSessionInterface: """Hooks up our JWT tokens to the session interface so we can use flask the way it was intended but also get the benefit of JWTs. Sessions in this system are immutable, and may only be written by an application server""" def open_session(self, app, request): """P...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class JWTSessionInterface: """Hooks up our JWT tokens to the session interface so we can use flask the way it was intended but also get the benefit of JWTs. Sessions in this system are immutable, and may only be written by an application server""" def open_session(self, app, request): """Populate the s...
the_stack_v2_python_sparse
lib/python/core/directorofme/flask/jwt.py
DirectorOfMe/directorof.me
train
0
1dc03d57bf97e65736e66f3c2212d4af0f916cab
[ "length = self.config.max_time_series_length(dataset_config)\nif length is not None:\n dataset = [{**item, 'target': item['target'][-length:]} for item in dataset_split.gluonts()]\nelse:\n dataset = dataset_split.gluonts()\nfor i, predictor in enumerate(self.predictors):\n logging.info('Evaluating predicto...
<|body_start_0|> length = self.config.max_time_series_length(dataset_config) if length is not None: dataset = [{**item, 'target': item['target'][-length:]} for item in dataset_split.gluonts()] else: dataset = dataset_split.gluonts() for i, predictor in enumerate(s...
A result object obtained when fitting a model.
FitResult
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FitResult: """A result object obtained when fitting a model.""" def evaluate_predictors(self, dataset_config: DatasetConfig, dataset_split: DatasetSplit, directory: Path, validation: bool=False) -> None: """Evaluates the given predictors on the specified dataset, logs the resulting m...
stack_v2_sparse_classes_36k_train_029884
4,949
permissive
[ { "docstring": "Evaluates the given predictors on the specified dataset, logs the resulting metrics and stores the forecasts in the given directory. The forecasts of predictor `i` are stored in the subdirectory `model_<i>`. Args: dataset_config: The configuration of the dataset to make predictions for. dataset_...
2
null
Implement the Python class `FitResult` described below. Class description: A result object obtained when fitting a model. Method signatures and docstrings: - def evaluate_predictors(self, dataset_config: DatasetConfig, dataset_split: DatasetSplit, directory: Path, validation: bool=False) -> None: Evaluates the given ...
Implement the Python class `FitResult` described below. Class description: A result object obtained when fitting a model. Method signatures and docstrings: - def evaluate_predictors(self, dataset_config: DatasetConfig, dataset_split: DatasetSplit, directory: Path, validation: bool=False) -> None: Evaluates the given ...
57ae07f571ff123eac04af077870c1f216f99d5c
<|skeleton|> class FitResult: """A result object obtained when fitting a model.""" def evaluate_predictors(self, dataset_config: DatasetConfig, dataset_split: DatasetSplit, directory: Path, validation: bool=False) -> None: """Evaluates the given predictors on the specified dataset, logs the resulting m...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FitResult: """A result object obtained when fitting a model.""" def evaluate_predictors(self, dataset_config: DatasetConfig, dataset_split: DatasetSplit, directory: Path, validation: bool=False) -> None: """Evaluates the given predictors on the specified dataset, logs the resulting metrics and st...
the_stack_v2_python_sparse
src/gluonts/nursery/tsbench/src/tsbench/evaluations/training/evaluate.py
canerturkmen/gluon-ts
train
1
8440b2c052a1363681053e1727822455995c5f99
[ "value = 0\nfor tribe in tribes:\n value |= 1 << tribe.value\nreturn value", "tribes = []\nfor tribe in Tribe:\n if value & 1 << tribe.value:\n tribes.append(tribe)\nreturn TribeList(tribes)" ]
<|body_start_0|> value = 0 for tribe in tribes: value |= 1 << tribe.value return value <|end_body_0|> <|body_start_1|> tribes = [] for tribe in Tribe: if value & 1 << tribe.value: tribes.append(tribe) return TribeList(tribes) <|end...
A field to store a list of tribes.
TribeListField
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TribeListField: """A field to store a list of tribes.""" def db_value(self, tribes: TribeList) -> int: """Convert a list of tribe enum instances to a series of bit flags.""" <|body_0|> def python_value(self, value: int) -> TribeList: """Convert a series of bit fl...
stack_v2_sparse_classes_36k_train_029885
4,521
no_license
[ { "docstring": "Convert a list of tribe enum instances to a series of bit flags.", "name": "db_value", "signature": "def db_value(self, tribes: TribeList) -> int" }, { "docstring": "Convert a series of bit flags to a list of tribe enum instances.", "name": "python_value", "signature": "d...
2
stack_v2_sparse_classes_30k_train_007612
Implement the Python class `TribeListField` described below. Class description: A field to store a list of tribes. Method signatures and docstrings: - def db_value(self, tribes: TribeList) -> int: Convert a list of tribe enum instances to a series of bit flags. - def python_value(self, value: int) -> TribeList: Conve...
Implement the Python class `TribeListField` described below. Class description: A field to store a list of tribes. Method signatures and docstrings: - def db_value(self, tribes: TribeList) -> int: Convert a list of tribe enum instances to a series of bit flags. - def python_value(self, value: int) -> TribeList: Conve...
05b2689fa191a10feea77afa94320f0b1d088dc0
<|skeleton|> class TribeListField: """A field to store a list of tribes.""" def db_value(self, tribes: TribeList) -> int: """Convert a list of tribe enum instances to a series of bit flags.""" <|body_0|> def python_value(self, value: int) -> TribeList: """Convert a series of bit fl...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TribeListField: """A field to store a list of tribes.""" def db_value(self, tribes: TribeList) -> int: """Convert a list of tribe enum instances to a series of bit flags.""" value = 0 for tribe in tribes: value |= 1 << tribe.value return value def python_v...
the_stack_v2_python_sparse
diplo-bot/main/tribes.py
Artemis21/polybots
train
3
0a20d5263876121c511f022dac4f67cbc546c89e
[ "def is_rep(a) -> bool:\n a_filtered = a[a != '.']\n a_filtered = a[np.where(a != '.')]\n return len(set(a_filtered)) != len(a_filtered)\nboard = np.array(board)\ncheck_col = np.apply_along_axis(is_rep, 0, board)\ncheck_row = np.apply_along_axis(is_rep, 1, board)\nif any(check_col) or any(check_row):\n ...
<|body_start_0|> def is_rep(a) -> bool: a_filtered = a[a != '.'] a_filtered = a[np.where(a != '.')] return len(set(a_filtered)) != len(a_filtered) board = np.array(board) check_col = np.apply_along_axis(is_rep, 0, board) check_row = np.apply_along_axis...
Solution
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isValidSudoku1(self, board) -> bool: """A numpy-style solution Runtime: 220ms""" <|body_0|> def isValidSudoku2(self, board) -> bool: """Three loops Runtime: 88ms""" <|body_1|> <|end_skeleton|> <|body_start_0|> def is_rep(a) -> bool: ...
stack_v2_sparse_classes_36k_train_029886
3,702
permissive
[ { "docstring": "A numpy-style solution Runtime: 220ms", "name": "isValidSudoku1", "signature": "def isValidSudoku1(self, board) -> bool" }, { "docstring": "Three loops Runtime: 88ms", "name": "isValidSudoku2", "signature": "def isValidSudoku2(self, board) -> bool" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isValidSudoku1(self, board) -> bool: A numpy-style solution Runtime: 220ms - def isValidSudoku2(self, board) -> bool: Three loops Runtime: 88ms
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isValidSudoku1(self, board) -> bool: A numpy-style solution Runtime: 220ms - def isValidSudoku2(self, board) -> bool: Three loops Runtime: 88ms <|skeleton|> class Solution: ...
49a0b03c55d8a702785888d473ef96539265ce9c
<|skeleton|> class Solution: def isValidSudoku1(self, board) -> bool: """A numpy-style solution Runtime: 220ms""" <|body_0|> def isValidSudoku2(self, board) -> bool: """Three loops Runtime: 88ms""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isValidSudoku1(self, board) -> bool: """A numpy-style solution Runtime: 220ms""" def is_rep(a) -> bool: a_filtered = a[a != '.'] a_filtered = a[np.where(a != '.')] return len(set(a_filtered)) != len(a_filtered) board = np.array(board) ...
the_stack_v2_python_sparse
leetcode/0036_valid_sudoku.py
chaosWsF/Python-Practice
train
1
86d6b5be8acf6d2622af1a2082c2e73ac74413ea
[ "with create_session() as session:\n parkinglot = session.query(ParkingLot).filter(ParkingLot.plate == plate).one()\n entity = ParkingSpaceMapper.to_entity(record=parkinglot)\n raise Return(entity)", "with create_session() as session:\n parking_space.validate()\n _parking_space = ParkingSpaceMapper...
<|body_start_0|> with create_session() as session: parkinglot = session.query(ParkingLot).filter(ParkingLot.plate == plate).one() entity = ParkingSpaceMapper.to_entity(record=parkinglot) raise Return(entity) <|end_body_0|> <|body_start_1|> with create_session() as se...
ParkingLotRepository
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ParkingLotRepository: def read_one(cls, plate): """Read one by plate :param str plate: :return: <ParkingSpace>: :raises noResultFound: vehicle with given plate is not in the parking lot""" <|body_0|> def insert(cls, parking_space): """Insert a parking space to the pa...
stack_v2_sparse_classes_36k_train_029887
1,886
no_license
[ { "docstring": "Read one by plate :param str plate: :return: <ParkingSpace>: :raises noResultFound: vehicle with given plate is not in the parking lot", "name": "read_one", "signature": "def read_one(cls, plate)" }, { "docstring": "Insert a parking space to the parking lot :return ParkingSpace:"...
3
null
Implement the Python class `ParkingLotRepository` described below. Class description: Implement the ParkingLotRepository class. Method signatures and docstrings: - def read_one(cls, plate): Read one by plate :param str plate: :return: <ParkingSpace>: :raises noResultFound: vehicle with given plate is not in the parki...
Implement the Python class `ParkingLotRepository` described below. Class description: Implement the ParkingLotRepository class. Method signatures and docstrings: - def read_one(cls, plate): Read one by plate :param str plate: :return: <ParkingSpace>: :raises noResultFound: vehicle with given plate is not in the parki...
fd759c16b9864f6b1b47b1ba3f1af77f8d08af20
<|skeleton|> class ParkingLotRepository: def read_one(cls, plate): """Read one by plate :param str plate: :return: <ParkingSpace>: :raises noResultFound: vehicle with given plate is not in the parking lot""" <|body_0|> def insert(cls, parking_space): """Insert a parking space to the pa...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ParkingLotRepository: def read_one(cls, plate): """Read one by plate :param str plate: :return: <ParkingSpace>: :raises noResultFound: vehicle with given plate is not in the parking lot""" with create_session() as session: parkinglot = session.query(ParkingLot).filter(ParkingLot.pl...
the_stack_v2_python_sparse
ParkingFinder/repositories/parking_lot.py
Big-Lemon/ParkingFinder
train
2
b011a76b9dff61ef9b00366ea198f2463a6044fa
[ "result = query_case_zip(case_id=case_id)\nif not result:\n return api_result(code=400, message='用例id:{}不存在'.format(case_id))\nreturn api_result(code=200, message='操作成功', data=result)", "data = request.get_json()\ncase_name = data.get('case_name')\nrequest_method = data.get('request_method')\nrequest_base_url ...
<|body_start_0|> result = query_case_zip(case_id=case_id) if not result: return api_result(code=400, message='用例id:{}不存在'.format(case_id)) return api_result(code=200, message='操作成功', data=result) <|end_body_0|> <|body_start_1|> data = request.get_json() case_name = d...
用例Api GET: 用例详情 POST: 用例新增 PUT: 用例编辑 DELETE: 用例删除
CaseApi
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CaseApi: """用例Api GET: 用例详情 POST: 用例新增 PUT: 用例编辑 DELETE: 用例删除""" def get(self, case_id): """用例详情""" <|body_0|> def post(self): """用例新增""" <|body_1|> def put(self): """用例编辑""" <|body_2|> def delete(self): """用例删除""" ...
stack_v2_sparse_classes_36k_train_029888
5,985
no_license
[ { "docstring": "用例详情", "name": "get", "signature": "def get(self, case_id)" }, { "docstring": "用例新增", "name": "post", "signature": "def post(self)" }, { "docstring": "用例编辑", "name": "put", "signature": "def put(self)" }, { "docstring": "用例删除", "name": "delete"...
4
stack_v2_sparse_classes_30k_train_000722
Implement the Python class `CaseApi` described below. Class description: 用例Api GET: 用例详情 POST: 用例新增 PUT: 用例编辑 DELETE: 用例删除 Method signatures and docstrings: - def get(self, case_id): 用例详情 - def post(self): 用例新增 - def put(self): 用例编辑 - def delete(self): 用例删除
Implement the Python class `CaseApi` described below. Class description: 用例Api GET: 用例详情 POST: 用例新增 PUT: 用例编辑 DELETE: 用例删除 Method signatures and docstrings: - def get(self, case_id): 用例详情 - def post(self): 用例新增 - def put(self): 用例编辑 - def delete(self): 用例删除 <|skeleton|> class CaseApi: """用例Api GET: 用例详情 POST: 用例...
df76812885d7d7f3a5269e3f7c652db6a9f3c3ad
<|skeleton|> class CaseApi: """用例Api GET: 用例详情 POST: 用例新增 PUT: 用例编辑 DELETE: 用例删除""" def get(self, case_id): """用例详情""" <|body_0|> def post(self): """用例新增""" <|body_1|> def put(self): """用例编辑""" <|body_2|> def delete(self): """用例删除""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CaseApi: """用例Api GET: 用例详情 POST: 用例新增 PUT: 用例编辑 DELETE: 用例删除""" def get(self, case_id): """用例详情""" result = query_case_zip(case_id=case_id) if not result: return api_result(code=400, message='用例id:{}不存在'.format(case_id)) return api_result(code=200, message='操作...
the_stack_v2_python_sparse
app/api/case_api/case_api.py
chengzizhen/ExileTestPlatformServer
train
0
7de0ac8c0746f4f26ca096f17215ff6248f9c3e7
[ "self.active = active\nself.mfrom = mfrom\nself.to = to", "if dictionary is None:\n return None\nactive = dictionary.get('active')\nmfrom = dictionary.get('from')\nto = dictionary.get('to')\nreturn cls(active, mfrom, to)" ]
<|body_start_0|> self.active = active self.mfrom = mfrom self.to = to <|end_body_0|> <|body_start_1|> if dictionary is None: return None active = dictionary.get('active') mfrom = dictionary.get('from') to = dictionary.get('to') return cls(acti...
Implementation of the 'Monday' model. The schedule object for Monday. Attributes: active (bool): Whether the schedule is active (true) or inactive (false) during the time specified between 'from' and 'to'. Defaults to true. mfrom (string): The time, from '00:00' to '24:00'. Must be less than the time specified in 'to'....
MondayModel
[ "MIT", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MondayModel: """Implementation of the 'Monday' model. The schedule object for Monday. Attributes: active (bool): Whether the schedule is active (true) or inactive (false) during the time specified between 'from' and 'to'. Defaults to true. mfrom (string): The time, from '00:00' to '24:00'. Must b...
stack_v2_sparse_classes_36k_train_029889
2,170
permissive
[ { "docstring": "Constructor for the MondayModel class", "name": "__init__", "signature": "def __init__(self, active=None, mfrom=None, to=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary representation of the object as obtai...
2
stack_v2_sparse_classes_30k_train_002062
Implement the Python class `MondayModel` described below. Class description: Implementation of the 'Monday' model. The schedule object for Monday. Attributes: active (bool): Whether the schedule is active (true) or inactive (false) during the time specified between 'from' and 'to'. Defaults to true. mfrom (string): Th...
Implement the Python class `MondayModel` described below. Class description: Implementation of the 'Monday' model. The schedule object for Monday. Attributes: active (bool): Whether the schedule is active (true) or inactive (false) during the time specified between 'from' and 'to'. Defaults to true. mfrom (string): Th...
9894089eb013318243ae48869cc5130eb37f80c0
<|skeleton|> class MondayModel: """Implementation of the 'Monday' model. The schedule object for Monday. Attributes: active (bool): Whether the schedule is active (true) or inactive (false) during the time specified between 'from' and 'to'. Defaults to true. mfrom (string): The time, from '00:00' to '24:00'. Must b...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MondayModel: """Implementation of the 'Monday' model. The schedule object for Monday. Attributes: active (bool): Whether the schedule is active (true) or inactive (false) during the time specified between 'from' and 'to'. Defaults to true. mfrom (string): The time, from '00:00' to '24:00'. Must be less than t...
the_stack_v2_python_sparse
meraki_sdk/models/monday_model.py
RaulCatalano/meraki-python-sdk
train
1
a00d5ddef611e1319e745dbe5ae4f910280cd417
[ "super(ClassificationHead, self).__init__()\nself.dense1 = PointNetDenseLayer(512, momentum)\nself.dense2 = PointNetDenseLayer(256, momentum)\nself.dropout = tf.keras.layers.Dropout(dropout_rate)\nself.dense3 = tf.keras.layers.Dense(num_classes, activation='linear')", "x = self.dense1(inputs, training)\nx = self....
<|body_start_0|> super(ClassificationHead, self).__init__() self.dense1 = PointNetDenseLayer(512, momentum) self.dense2 = PointNetDenseLayer(256, momentum) self.dropout = tf.keras.layers.Dropout(dropout_rate) self.dense3 = tf.keras.layers.Dense(num_classes, activation='linear') <...
The PointNet classification head. The head consists of 2x PointNetDenseLayer layers (512 and 256 channels) followed by a dropout layer (drop rate=30%) a dense linear layer producing the logits of the num_classes classes.
ClassificationHead
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClassificationHead: """The PointNet classification head. The head consists of 2x PointNetDenseLayer layers (512 and 256 channels) followed by a dropout layer (drop rate=30%) a dense linear layer producing the logits of the num_classes classes.""" def __init__(self, num_classes: int=40, momen...
stack_v2_sparse_classes_36k_train_029890
9,332
permissive
[ { "docstring": "Constructor. Args: num_classes: the number of classes to classify. momentum: the momentum used for the batch normalization layer. dropout_rate: the dropout rate for fully connected layer", "name": "__init__", "signature": "def __init__(self, num_classes: int=40, momentum: float=0.5, drop...
2
stack_v2_sparse_classes_30k_train_006195
Implement the Python class `ClassificationHead` described below. Class description: The PointNet classification head. The head consists of 2x PointNetDenseLayer layers (512 and 256 channels) followed by a dropout layer (drop rate=30%) a dense linear layer producing the logits of the num_classes classes. Method signat...
Implement the Python class `ClassificationHead` described below. Class description: The PointNet classification head. The head consists of 2x PointNetDenseLayer layers (512 and 256 channels) followed by a dropout layer (drop rate=30%) a dense linear layer producing the logits of the num_classes classes. Method signat...
1b0203eb538f2b6a1013ec7736d0d548416f059a
<|skeleton|> class ClassificationHead: """The PointNet classification head. The head consists of 2x PointNetDenseLayer layers (512 and 256 channels) followed by a dropout layer (drop rate=30%) a dense linear layer producing the logits of the num_classes classes.""" def __init__(self, num_classes: int=40, momen...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ClassificationHead: """The PointNet classification head. The head consists of 2x PointNetDenseLayer layers (512 and 256 channels) followed by a dropout layer (drop rate=30%) a dense linear layer producing the logits of the num_classes classes.""" def __init__(self, num_classes: int=40, momentum: float=0....
the_stack_v2_python_sparse
tensorflow_graphics/nn/layer/pointnet.py
tensorflow/graphics
train
2,920
8c55713a797b0ebe55c1d24fbfe4095e4abb83b0
[ "if self._body is None:\n self._body = self.stream.read(self.content_length or 0)\nreturn self._body", "if self._json is None:\n self._json = json.loads(self.body)\nreturn self._json" ]
<|body_start_0|> if self._body is None: self._body = self.stream.read(self.content_length or 0) return self._body <|end_body_0|> <|body_start_1|> if self._json is None: self._json = json.loads(self.body) return self._json <|end_body_1|>
Helper methods for falcon Request class
HTTPRequest
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HTTPRequest: """Helper methods for falcon Request class""" def body(self): """Keeps body available for future calls Returns: str: request body""" <|body_0|> def json(self): """Loads JSON object from body. Returns: dict: JSON object""" <|body_1|> <|end_sk...
stack_v2_sparse_classes_36k_train_029891
673
permissive
[ { "docstring": "Keeps body available for future calls Returns: str: request body", "name": "body", "signature": "def body(self)" }, { "docstring": "Loads JSON object from body. Returns: dict: JSON object", "name": "json", "signature": "def json(self)" } ]
2
stack_v2_sparse_classes_30k_train_009552
Implement the Python class `HTTPRequest` described below. Class description: Helper methods for falcon Request class Method signatures and docstrings: - def body(self): Keeps body available for future calls Returns: str: request body - def json(self): Loads JSON object from body. Returns: dict: JSON object
Implement the Python class `HTTPRequest` described below. Class description: Helper methods for falcon Request class Method signatures and docstrings: - def body(self): Keeps body available for future calls Returns: str: request body - def json(self): Loads JSON object from body. Returns: dict: JSON object <|skeleto...
4849d75906ae54fd383c3def31284e96964b2912
<|skeleton|> class HTTPRequest: """Helper methods for falcon Request class""" def body(self): """Keeps body available for future calls Returns: str: request body""" <|body_0|> def json(self): """Loads JSON object from body. Returns: dict: JSON object""" <|body_1|> <|end_sk...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HTTPRequest: """Helper methods for falcon Request class""" def body(self): """Keeps body available for future calls Returns: str: request body""" if self._body is None: self._body = self.stream.read(self.content_length or 0) return self._body def json(self): ...
the_stack_v2_python_sparse
src/clustaar/webhook/falcon/http_request.py
Clustaar/clustaar.webhook
train
4
686f1521e5922df9ba2dc5d8009f1997401c16b0
[ "length = len(nums)\nsum_num = sum(nums)\nif sum_num % 2 == 1:\n return False\nhalf = sum_num // 2\ndp = [[False for _ in range(half + 1)] for _ in range(length)]\nfor c in range(half + 1):\n if c == nums[0]:\n dp[0][c] = True\nfor i in range(1, length):\n for c in range(half + 1):\n if nums[...
<|body_start_0|> length = len(nums) sum_num = sum(nums) if sum_num % 2 == 1: return False half = sum_num // 2 dp = [[False for _ in range(half + 1)] for _ in range(length)] for c in range(half + 1): if c == nums[0]: dp[0][c] = True ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def canPartition(self, nums): """:type nums: List[int] :rtype: bool""" <|body_0|> def _canPartition(self, nums): """:type nums: List[int] :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> length = len(nums) sum_num = sum...
stack_v2_sparse_classes_36k_train_029892
1,953
no_license
[ { "docstring": ":type nums: List[int] :rtype: bool", "name": "canPartition", "signature": "def canPartition(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: bool", "name": "_canPartition", "signature": "def _canPartition(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_000703
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canPartition(self, nums): :type nums: List[int] :rtype: bool - def _canPartition(self, nums): :type nums: List[int] :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canPartition(self, nums): :type nums: List[int] :rtype: bool - def _canPartition(self, nums): :type nums: List[int] :rtype: bool <|skeleton|> class Solution: def canPar...
1d1ffe25d8b49832acc1791261c959ce436a6362
<|skeleton|> class Solution: def canPartition(self, nums): """:type nums: List[int] :rtype: bool""" <|body_0|> def _canPartition(self, nums): """:type nums: List[int] :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def canPartition(self, nums): """:type nums: List[int] :rtype: bool""" length = len(nums) sum_num = sum(nums) if sum_num % 2 == 1: return False half = sum_num // 2 dp = [[False for _ in range(half + 1)] for _ in range(length)] for c...
the_stack_v2_python_sparse
00-每日一题/20200325_416.py
qiaozhi827/leetcode-1
train
0
744b85f377a0d84048fbf5c614a594194706623f
[ "processed = 0\nfor base in queryset:\n base.ResetNames()\n processed += 1\nself.message_user(request, '%s reset.' % GetMessageBit(processed))", "processed = 0\nfor base in queryset:\n base.stateManaged = 'new'\n base.ResetNames()\n processed += 1\nself.message_user(request, '%s reset and marked as...
<|body_start_0|> processed = 0 for base in queryset: base.ResetNames() processed += 1 self.message_user(request, '%s reset.' % GetMessageBit(processed)) <|end_body_0|> <|body_start_1|> processed = 0 for base in queryset: base.stateManaged = 'n...
XrumerBaseSpamAdmin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class XrumerBaseSpamAdmin: def ResetNames(self, request, queryset): """Сбрасываем имена""" <|body_0|> def ResetNamesAndNew(self, request, queryset): """Сбрасываем имена и помечаем как новые""" <|body_1|> <|end_skeleton|> <|body_start_0|> processed = 0 ...
stack_v2_sparse_classes_36k_train_029893
29,849
no_license
[ { "docstring": "Сбрасываем имена", "name": "ResetNames", "signature": "def ResetNames(self, request, queryset)" }, { "docstring": "Сбрасываем имена и помечаем как новые", "name": "ResetNamesAndNew", "signature": "def ResetNamesAndNew(self, request, queryset)" } ]
2
stack_v2_sparse_classes_30k_train_021125
Implement the Python class `XrumerBaseSpamAdmin` described below. Class description: Implement the XrumerBaseSpamAdmin class. Method signatures and docstrings: - def ResetNames(self, request, queryset): Сбрасываем имена - def ResetNamesAndNew(self, request, queryset): Сбрасываем имена и помечаем как новые
Implement the Python class `XrumerBaseSpamAdmin` described below. Class description: Implement the XrumerBaseSpamAdmin class. Method signatures and docstrings: - def ResetNames(self, request, queryset): Сбрасываем имена - def ResetNamesAndNew(self, request, queryset): Сбрасываем имена и помечаем как новые <|skeleton...
d2771bf04aa187dda6d468883a5a167237589369
<|skeleton|> class XrumerBaseSpamAdmin: def ResetNames(self, request, queryset): """Сбрасываем имена""" <|body_0|> def ResetNamesAndNew(self, request, queryset): """Сбрасываем имена и помечаем как новые""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class XrumerBaseSpamAdmin: def ResetNames(self, request, queryset): """Сбрасываем имена""" processed = 0 for base in queryset: base.ResetNames() processed += 1 self.message_user(request, '%s reset.' % GetMessageBit(processed)) def ResetNamesAndNew(self, r...
the_stack_v2_python_sparse
doorsadmin/admin.py
cash2one/doorscenter
train
0
f81bdd355f12ad8cd4609d8fcf14c8e3a3c4f349
[ "self.username: str = config[CONF_USERNAME]\nself.api_key: str = config[CONF_API_KEY]\nself.recipients: list[str] = config[CONF_RECIPIENT]\nself.sender: str = config[CONF_SENDER]", "data: dict[str, Any] = {'messages': []}\nfor recipient in self.recipients:\n data['messages'].append({'source': 'hass.notify', 'f...
<|body_start_0|> self.username: str = config[CONF_USERNAME] self.api_key: str = config[CONF_API_KEY] self.recipients: list[str] = config[CONF_RECIPIENT] self.sender: str = config[CONF_SENDER] <|end_body_0|> <|body_start_1|> data: dict[str, Any] = {'messages': []} for rec...
Implementation of a notification service for the ClickSend service.
ClicksendNotificationService
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClicksendNotificationService: """Implementation of a notification service for the ClickSend service.""" def __init__(self, config: ConfigType) -> None: """Initialize the service.""" <|body_0|> def send_message(self, message: str='', **kwargs: Any) -> None: """Sen...
stack_v2_sparse_classes_36k_train_029894
3,372
permissive
[ { "docstring": "Initialize the service.", "name": "__init__", "signature": "def __init__(self, config: ConfigType) -> None" }, { "docstring": "Send a message to a user.", "name": "send_message", "signature": "def send_message(self, message: str='', **kwargs: Any) -> None" } ]
2
null
Implement the Python class `ClicksendNotificationService` described below. Class description: Implementation of a notification service for the ClickSend service. Method signatures and docstrings: - def __init__(self, config: ConfigType) -> None: Initialize the service. - def send_message(self, message: str='', **kwar...
Implement the Python class `ClicksendNotificationService` described below. Class description: Implementation of a notification service for the ClickSend service. Method signatures and docstrings: - def __init__(self, config: ConfigType) -> None: Initialize the service. - def send_message(self, message: str='', **kwar...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class ClicksendNotificationService: """Implementation of a notification service for the ClickSend service.""" def __init__(self, config: ConfigType) -> None: """Initialize the service.""" <|body_0|> def send_message(self, message: str='', **kwargs: Any) -> None: """Sen...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ClicksendNotificationService: """Implementation of a notification service for the ClickSend service.""" def __init__(self, config: ConfigType) -> None: """Initialize the service.""" self.username: str = config[CONF_USERNAME] self.api_key: str = config[CONF_API_KEY] self.re...
the_stack_v2_python_sparse
homeassistant/components/clicksend/notify.py
home-assistant/core
train
35,501
a4401c75dab0fe9545bfa85f58324434cabd49fc
[ "seriesMap = {}\nfor index, _ in enumerate(series):\n name, serie = series[index]\n seriesId = '{}_{}'.format(name, uid)\n seriesMap.update({seriesId: {'label': name, 'data': zip(range(0, len(serie)), serie), 'points': {'show': True}, 'lines': {'show': True}}})\nreturn seriesMap", "constituentNames = ['{...
<|body_start_0|> seriesMap = {} for index, _ in enumerate(series): name, serie = series[index] seriesId = '{}_{}'.format(name, uid) seriesMap.update({seriesId: {'label': name, 'data': zip(range(0, len(serie)), serie), 'points': {'show': True}, 'lines': {'show': True}}...
Builds chart visualization for a delta series collections from current profile session and benchmarks The flot builder creates charts with txnId in x-axis and duration (micro seconds) in y-axis The builder creates a line chart for delta series, from each pair of probes in the timeline
FlotBuilder
[ "MIT", "BSD-3-Clause", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FlotBuilder: """Builds chart visualization for a delta series collections from current profile session and benchmarks The flot builder creates charts with txnId in x-axis and duration (micro seconds) in y-axis The builder creates a line chart for delta series, from each pair of probes in the time...
stack_v2_sparse_classes_36k_train_029895
7,581
permissive
[ { "docstring": "Builds a map with data and options for creating visualizations :param series: the collection of series to be plotted", "name": "buildFlotSeriesMap", "signature": "def buildFlotSeriesMap(series, uid)" }, { "docstring": "Builds markup to render title for txn visualizations :param c...
5
stack_v2_sparse_classes_30k_train_014544
Implement the Python class `FlotBuilder` described below. Class description: Builds chart visualization for a delta series collections from current profile session and benchmarks The flot builder creates charts with txnId in x-axis and duration (micro seconds) in y-axis The builder creates a line chart for delta serie...
Implement the Python class `FlotBuilder` described below. Class description: Builds chart visualization for a delta series collections from current profile session and benchmarks The flot builder creates charts with txnId in x-axis and duration (micro seconds) in y-axis The builder creates a line chart for delta serie...
d6b67e98d4b640c98499a373425f1f009e5b9061
<|skeleton|> class FlotBuilder: """Builds chart visualization for a delta series collections from current profile session and benchmarks The flot builder creates charts with txnId in x-axis and duration (micro seconds) in y-axis The builder creates a line chart for delta series, from each pair of probes in the time...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FlotBuilder: """Builds chart visualization for a delta series collections from current profile session and benchmarks The flot builder creates charts with txnId in x-axis and duration (micro seconds) in y-axis The builder creates a line chart for delta series, from each pair of probes in the timeline""" ...
the_stack_v2_python_sparse
scripts/lib/xpedite/report/flot.py
dendisuhubdy/Xpedite
train
1
82e9c8562484bee33918ba3d2b6f01b622fba4bb
[ "request_id = http.request.env['hr.holidays.request'].sudo().browse(int(kw['id']))\nif request_id.sudo().access_token != kw['token']:\n return http.request.render('hr_paysheet.message_template', {'message': 'Error de suplantación', 'type': 'error'})\nif request_id.sudo().state in ('OK', 'REJ'):\n return http....
<|body_start_0|> request_id = http.request.env['hr.holidays.request'].sudo().browse(int(kw['id'])) if request_id.sudo().access_token != kw['token']: return http.request.render('hr_paysheet.message_template', {'message': 'Error de suplantación', 'type': 'error'}) if request_id.sudo()....
HRLeaveRequestManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HRLeaveRequestManager: def holidays_accept_action(self, **kw): """Accept holidas request. @returns: :class:`werkzeug.wrappers.Response`""" <|body_0|> def holidays_decline_action(self, **kw): """Decline holidas request. @returns: :class:`werkzeug.wrappers.Response`"""...
stack_v2_sparse_classes_36k_train_029896
4,327
no_license
[ { "docstring": "Accept holidas request. @returns: :class:`werkzeug.wrappers.Response`", "name": "holidays_accept_action", "signature": "def holidays_accept_action(self, **kw)" }, { "docstring": "Decline holidas request. @returns: :class:`werkzeug.wrappers.Response`", "name": "holidays_declin...
4
null
Implement the Python class `HRLeaveRequestManager` described below. Class description: Implement the HRLeaveRequestManager class. Method signatures and docstrings: - def holidays_accept_action(self, **kw): Accept holidas request. @returns: :class:`werkzeug.wrappers.Response` - def holidays_decline_action(self, **kw):...
Implement the Python class `HRLeaveRequestManager` described below. Class description: Implement the HRLeaveRequestManager class. Method signatures and docstrings: - def holidays_accept_action(self, **kw): Accept holidas request. @returns: :class:`werkzeug.wrappers.Response` - def holidays_decline_action(self, **kw):...
778dcd6e4247949daae3a40e64025b3aaf014373
<|skeleton|> class HRLeaveRequestManager: def holidays_accept_action(self, **kw): """Accept holidas request. @returns: :class:`werkzeug.wrappers.Response`""" <|body_0|> def holidays_decline_action(self, **kw): """Decline holidas request. @returns: :class:`werkzeug.wrappers.Response`"""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HRLeaveRequestManager: def holidays_accept_action(self, **kw): """Accept holidas request. @returns: :class:`werkzeug.wrappers.Response`""" request_id = http.request.env['hr.holidays.request'].sudo().browse(int(kw['id'])) if request_id.sudo().access_token != kw['token']: ret...
the_stack_v2_python_sparse
hr_paysheet/controllers/hr_requests.py
cardona18/ifaco
train
0
70edcb73239287b25b55f3bf69d90b40addb98ae
[ "self.other_field_name = other_field_name\nself.values = values\nself.message = message", "try:\n other_field = getattr(form, self.other_field_name)\n other_val = other_field.data\n for v in self.values:\n if callable(v) and v(other_val) or other_val == v:\n if not field.data or (isinst...
<|body_start_0|> self.other_field_name = other_field_name self.values = values self.message = message <|end_body_0|> <|body_start_1|> try: other_field = getattr(form, self.other_field_name) other_val = other_field.data for v in self.values: ...
Require field if value of another field is set to a certain value.
RequiredIf
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RequiredIf: """Require field if value of another field is set to a certain value.""" def __init__(self, other_field_name, values, message=None): """Initialize the validator.""" <|body_0|> def __call__(self, form, field): """Validate.""" <|body_1|> <|end_...
stack_v2_sparse_classes_36k_train_029897
11,750
no_license
[ { "docstring": "Initialize the validator.", "name": "__init__", "signature": "def __init__(self, other_field_name, values, message=None)" }, { "docstring": "Validate.", "name": "__call__", "signature": "def __call__(self, form, field)" } ]
2
stack_v2_sparse_classes_30k_train_011360
Implement the Python class `RequiredIf` described below. Class description: Require field if value of another field is set to a certain value. Method signatures and docstrings: - def __init__(self, other_field_name, values, message=None): Initialize the validator. - def __call__(self, form, field): Validate.
Implement the Python class `RequiredIf` described below. Class description: Require field if value of another field is set to a certain value. Method signatures and docstrings: - def __init__(self, other_field_name, values, message=None): Initialize the validator. - def __call__(self, form, field): Validate. <|skele...
4de8910fff569fc9028300c70b63200da521ddb9
<|skeleton|> class RequiredIf: """Require field if value of another field is set to a certain value.""" def __init__(self, other_field_name, values, message=None): """Initialize the validator.""" <|body_0|> def __call__(self, form, field): """Validate.""" <|body_1|> <|end_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RequiredIf: """Require field if value of another field is set to a certain value.""" def __init__(self, other_field_name, values, message=None): """Initialize the validator.""" self.other_field_name = other_field_name self.values = values self.message = message def __...
the_stack_v2_python_sparse
inspirehep/modules/forms/validation_utils.py
nikpap/inspire-next
train
1
0c7e2ee88918a40dc36e041c36e65c899828e54b
[ "l1, l2 = (len(word1), len(word2))\nprev = [j for j in range(l2 + 1)]\nfor i in range(1, l1 + 1, 1):\n curr = [i] + [0] * l2\n for j in range(1, l2 + 1, 1):\n if word1[i - 1] == word2[j - 1]:\n curr[j] = prev[j - 1]\n else:\n curr[j] = min(prev[j - 1], prev[j], curr[j - 1])...
<|body_start_0|> l1, l2 = (len(word1), len(word2)) prev = [j for j in range(l2 + 1)] for i in range(1, l1 + 1, 1): curr = [i] + [0] * l2 for j in range(1, l2 + 1, 1): if word1[i - 1] == word2[j - 1]: curr[j] = prev[j - 1] ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minDistance_1d(self, word1, word2): """:type word1: str :type word2: str :rtype: int""" <|body_0|> def minDistance_2d(self, word1, word2): """:type word1: str :type word2: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_029898
2,885
no_license
[ { "docstring": ":type word1: str :type word2: str :rtype: int", "name": "minDistance_1d", "signature": "def minDistance_1d(self, word1, word2)" }, { "docstring": ":type word1: str :type word2: str :rtype: int", "name": "minDistance_2d", "signature": "def minDistance_2d(self, word1, word2...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minDistance_1d(self, word1, word2): :type word1: str :type word2: str :rtype: int - def minDistance_2d(self, word1, word2): :type word1: str :type word2: str :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minDistance_1d(self, word1, word2): :type word1: str :type word2: str :rtype: int - def minDistance_2d(self, word1, word2): :type word1: str :type word2: str :rtype: int <|s...
9ac54720f571a4bea09d0cceb0039381a78df9e8
<|skeleton|> class Solution: def minDistance_1d(self, word1, word2): """:type word1: str :type word2: str :rtype: int""" <|body_0|> def minDistance_2d(self, word1, word2): """:type word1: str :type word2: str :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def minDistance_1d(self, word1, word2): """:type word1: str :type word2: str :rtype: int""" l1, l2 = (len(word1), len(word2)) prev = [j for j in range(l2 + 1)] for i in range(1, l1 + 1, 1): curr = [i] + [0] * l2 for j in range(1, l2 + 1, 1): ...
the_stack_v2_python_sparse
code/072_edit-distance.py
linhdvu14/leetcode-solutions
train
2
dc7a40aa501886d94fdf854acb0c349d95acd0b7
[ "self.fc = fc\nself.arrival_time = empty_value\nself.bearing = empty_value\nself.fs = fs\nself.timestamp = None\nself.recorded_data = None\nself.num_step = None\nself.dx = 0.0185\nself.c = 1480\nself.threshold = 1\nself.dead_time = 0.2\nself.num_snapshots = 4\nnum_look = 300\nself.look_directions = np.arange(num_lo...
<|body_start_0|> self.fc = fc self.arrival_time = empty_value self.bearing = empty_value self.fs = fs self.timestamp = None self.recorded_data = None self.num_step = None self.dx = 0.0185 self.c = 1480 self.threshold = 1 self.dead_t...
Download sound information from beaglebone, beamform at each ping
AcousticsNode
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AcousticsNode: """Download sound information from beaglebone, beamform at each ping""" def __init__(self, fc): """This node requires an external source of acoustic data""" <|body_0|> def is_active(self, to_arm): """Startup and shut down communication with beagle ...
stack_v2_sparse_classes_36k_train_029899
5,974
no_license
[ { "docstring": "This node requires an external source of acoustic data", "name": "__init__", "signature": "def __init__(self, fc)" }, { "docstring": "Startup and shut down communication with beagle over lcm", "name": "is_active", "signature": "def is_active(self, to_arm)" }, { "d...
5
stack_v2_sparse_classes_30k_train_004326
Implement the Python class `AcousticsNode` described below. Class description: Download sound information from beaglebone, beamform at each ping Method signatures and docstrings: - def __init__(self, fc): This node requires an external source of acoustic data - def is_active(self, to_arm): Startup and shut down commu...
Implement the Python class `AcousticsNode` described below. Class description: Download sound information from beaglebone, beamform at each ping Method signatures and docstrings: - def __init__(self, fc): This node requires an external source of acoustic data - def is_active(self, to_arm): Startup and shut down commu...
bfdd911d328dc730b1f6d0548bfb6a267b5e51af
<|skeleton|> class AcousticsNode: """Download sound information from beaglebone, beamform at each ping""" def __init__(self, fc): """This node requires an external source of acoustic data""" <|body_0|> def is_active(self, to_arm): """Startup and shut down communication with beagle ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AcousticsNode: """Download sound information from beaglebone, beamform at each ping""" def __init__(self, fc): """This node requires an external source of acoustic data""" self.fc = fc self.arrival_time = empty_value self.bearing = empty_value self.fs = fs ...
the_stack_v2_python_sparse
zoidberg/acoustics/acoustics_node.py
sdcityrobotics/zoidberg
train
2