blob_id stringlengths 40 40 | bodies listlengths 2 6 | bodies_text stringlengths 196 7.73k | class_docstring stringlengths 0 700 | class_name stringlengths 1 86 | detected_licenses listlengths 0 45 | format_version stringclasses 1
value | full_text stringlengths 378 8.64k | id stringlengths 44 44 | length_bytes int64 505 50k | license_type stringclasses 2
values | methods listlengths 2 6 | n_methods int64 2 6 | original_id stringlengths 38 40 ⌀ | prompt stringlengths 153 4.88k | prompted_full_text stringlengths 565 12.5k | revision_id stringlengths 40 40 | skeleton stringlengths 162 5.05k | snapshot_name stringclasses 1
value | snapshot_source_dir stringclasses 1
value | snapshot_total_rows int64 75.8k 75.8k | solution stringlengths 242 8.3k | source stringclasses 1
value | source_path stringlengths 4 177 | source_repo stringlengths 6 110 | split stringclasses 1
value | star_events_count int64 0 209k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f5ed6dd93b755b0389868391f22c184c9a552a79 | [
"val_s = Stack()\ncur_node = headnode\nwhile cur_node:\n val_s.push(cur_node.val)\n cur_node = cur_node.next\nwhile not val_s.empty():\n print(val_s.pop())",
"curnode = headnode\nif curnode:\n self.solve2(curnode.next)\n print(curnode.val)"
] | <|body_start_0|>
val_s = Stack()
cur_node = headnode
while cur_node:
val_s.push(cur_node.val)
cur_node = cur_node.next
while not val_s.empty():
print(val_s.pop())
<|end_body_0|>
<|body_start_1|>
curnode = headnode
if curnode:
... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def solve(self, headnode):
"""思路:用一个栈保存所有节点,之后一个一个 pop"""
<|body_0|>
def solve2(self, headnode):
"""能用栈就可以使用递归。这一点需要能联想到"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
val_s = Stack()
cur_node = headnode
while cur_node:
... | stack_v2_sparse_classes_75kplus_train_073800 | 1,362 | permissive | [
{
"docstring": "思路:用一个栈保存所有节点,之后一个一个 pop",
"name": "solve",
"signature": "def solve(self, headnode)"
},
{
"docstring": "能用栈就可以使用递归。这一点需要能联想到",
"name": "solve2",
"signature": "def solve2(self, headnode)"
}
] | 2 | stack_v2_sparse_classes_30k_train_019198 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def solve(self, headnode): 思路:用一个栈保存所有节点,之后一个一个 pop
- def solve2(self, headnode): 能用栈就可以使用递归。这一点需要能联想到 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def solve(self, headnode): 思路:用一个栈保存所有节点,之后一个一个 pop
- def solve2(self, headnode): 能用栈就可以使用递归。这一点需要能联想到
<|skeleton|>
class Solution:
def solve(self, headnode):
"""思路... | 3469a79c34b6c08ae52797c3974b49fbfa8cca51 | <|skeleton|>
class Solution:
def solve(self, headnode):
"""思路:用一个栈保存所有节点,之后一个一个 pop"""
<|body_0|>
def solve2(self, headnode):
"""能用栈就可以使用递归。这一点需要能联想到"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def solve(self, headnode):
"""思路:用一个栈保存所有节点,之后一个一个 pop"""
val_s = Stack()
cur_node = headnode
while cur_node:
val_s.push(cur_node.val)
cur_node = cur_node.next
while not val_s.empty():
print(val_s.pop())
def solve2(self... | the_stack_v2_python_sparse | 剑指offer/05_PrintListInReversedOrder(从尾到头打印链表).py | Mark24Code/python_data_structures_and_algorithms | train | 1 | |
5962836e5ddea635a6f5b954b5822a854517b4a7 | [
"if self.params:\n for k in configkeys:\n if k not in self.params or self.params[k] is None:\n self.params[k] = config.__getattribute__(k)\nelse:\n self.params = {k: config.__getattribute__(k) for k in configkeys}",
"release = self.params['release'] if self.params and 'release' in self.par... | <|body_start_0|>
if self.params:
for k in configkeys:
if k not in self.params or self.params[k] is None:
self.params[k] = config.__getattribute__(k)
else:
self.params = {k: config.__getattribute__(k) for k in configkeys}
<|end_body_0|>
<|body_... | Marvins Interaction class, subclassed from Brain This is the main class to make calls to the Marvin API. Instantaiate the Interaction object with a URL to make the call. GET requests can be made without passing parameters. POST requests require parameters to be passed. A successful call results in a HTTP status code of... | Interaction | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Interaction:
"""Marvins Interaction class, subclassed from Brain This is the main class to make calls to the Marvin API. Instantaiate the Interaction object with a URL to make the call. GET requests can be made without passing parameters. POST requests require parameters to be passed. A successfu... | stack_v2_sparse_classes_75kplus_train_073801 | 4,734 | permissive | [
{
"docstring": "Load the local configuration into a parameters dictionary to be sent with the request",
"name": "_loadConfigParams",
"signature": "def _loadConfigParams(self)"
},
{
"docstring": "Set the authorization",
"name": "setAuth",
"signature": "def setAuth(self, authtype=None)"
... | 2 | stack_v2_sparse_classes_30k_train_045237 | Implement the Python class `Interaction` described below.
Class description:
Marvins Interaction class, subclassed from Brain This is the main class to make calls to the Marvin API. Instantaiate the Interaction object with a URL to make the call. GET requests can be made without passing parameters. POST requests requi... | Implement the Python class `Interaction` described below.
Class description:
Marvins Interaction class, subclassed from Brain This is the main class to make calls to the Marvin API. Instantaiate the Interaction object with a URL to make the call. GET requests can be made without passing parameters. POST requests requi... | db4c536a65fb2f16fee05a4f34996a7fd35f0527 | <|skeleton|>
class Interaction:
"""Marvins Interaction class, subclassed from Brain This is the main class to make calls to the Marvin API. Instantaiate the Interaction object with a URL to make the call. GET requests can be made without passing parameters. POST requests require parameters to be passed. A successfu... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Interaction:
"""Marvins Interaction class, subclassed from Brain This is the main class to make calls to the Marvin API. Instantaiate the Interaction object with a URL to make the call. GET requests can be made without passing parameters. POST requests require parameters to be passed. A successful call result... | the_stack_v2_python_sparse | python/marvin/api/api.py | sdss/marvin | train | 56 |
31a0b3dc75b96d5dfd42e7cfccf7cc338e2a6a42 | [
"if dtype == np.int8 or dtype == np.int32:\n return DTYPE.INT\nelif dtype == np.uint or dtype == np.uint64:\n return DTYPE.ULONG\nelif dtype == np.int64:\n return DTYPE.LONG\nelif dtype == np.float32:\n return DTYPE.FLOAT\nelif dtype == np.float64:\n return DTYPE.DOUBLE\nelif dtype == np.bool:\n r... | <|body_start_0|>
if dtype == np.int8 or dtype == np.int32:
return DTYPE.INT
elif dtype == np.uint or dtype == np.uint64:
return DTYPE.ULONG
elif dtype == np.int64:
return DTYPE.LONG
elif dtype == np.float32:
return DTYPE.FLOAT
elif ... | TypeUtil | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TypeUtil:
def to_id_dtype(dtype):
"""to_numpy_dtype"""
<|body_0|>
def to_numpy_dtype(dtype):
"""to_numpy_dtype"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if dtype == np.int8 or dtype == np.int32:
return DTYPE.INT
elif dtype ... | stack_v2_sparse_classes_75kplus_train_073802 | 2,769 | permissive | [
{
"docstring": "to_numpy_dtype",
"name": "to_id_dtype",
"signature": "def to_id_dtype(dtype)"
},
{
"docstring": "to_numpy_dtype",
"name": "to_numpy_dtype",
"signature": "def to_numpy_dtype(dtype)"
}
] | 2 | stack_v2_sparse_classes_30k_train_051712 | Implement the Python class `TypeUtil` described below.
Class description:
Implement the TypeUtil class.
Method signatures and docstrings:
- def to_id_dtype(dtype): to_numpy_dtype
- def to_numpy_dtype(dtype): to_numpy_dtype | Implement the Python class `TypeUtil` described below.
Class description:
Implement the TypeUtil class.
Method signatures and docstrings:
- def to_id_dtype(dtype): to_numpy_dtype
- def to_numpy_dtype(dtype): to_numpy_dtype
<|skeleton|>
class TypeUtil:
def to_id_dtype(dtype):
"""to_numpy_dtype"""
... | 875ae298dfa84ee9815f53db5bf7a8b76a379a6f | <|skeleton|>
class TypeUtil:
def to_id_dtype(dtype):
"""to_numpy_dtype"""
<|body_0|>
def to_numpy_dtype(dtype):
"""to_numpy_dtype"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TypeUtil:
def to_id_dtype(dtype):
"""to_numpy_dtype"""
if dtype == np.int8 or dtype == np.int32:
return DTYPE.INT
elif dtype == np.uint or dtype == np.uint64:
return DTYPE.ULONG
elif dtype == np.int64:
return DTYPE.LONG
elif dtype == ... | the_stack_v2_python_sparse | src/foreign_if/python/main/python/frovedis/matrix/dtype.py | frovedis/frovedis | train | 68 | |
a032266520056552c05da8b2a96e44ea22facdf6 | [
"iconmapping = {'home': 'reset', 'filesave': 'save', 'zoom_to_rect': 'zoom'}\nicon = iconmapping[file] if iconmapping.get(file, None) else file\nimg = get_images().icons[icon]\nbtn = ttk.Button(frame, text=text, image=img, command=command)\nbtn.pack(side=tk.RIGHT, padx=2)\nreturn btn",
"xmin, xmax = self.canvas.f... | <|body_start_0|>
iconmapping = {'home': 'reset', 'filesave': 'save', 'zoom_to_rect': 'zoom'}
icon = iconmapping[file] if iconmapping.get(file, None) else file
img = get_images().icons[icon]
btn = ttk.Button(frame, text=text, image=img, command=command)
btn.pack(side=tk.RIGHT, pad... | Same as default, but only including buttons we need with custom icons and layout From: https://stackoverflow.com/questions/12695678 | NavigationToolbar | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NavigationToolbar:
"""Same as default, but only including buttons we need with custom icons and layout From: https://stackoverflow.com/questions/12695678"""
def _Button(frame, text, file, command, extension='.gif'):
"""Map Buttons to their own frame. Use custom button icons, Use ttk ... | stack_v2_sparse_classes_75kplus_train_073803 | 12,773 | permissive | [
{
"docstring": "Map Buttons to their own frame. Use custom button icons, Use ttk buttons pack to the right",
"name": "_Button",
"signature": "def _Button(frame, text, file, command, extension='.gif')"
},
{
"docstring": "Same as original but ttk widgets and standard tooltips used. Separator added... | 2 | stack_v2_sparse_classes_30k_train_049767 | Implement the Python class `NavigationToolbar` described below.
Class description:
Same as default, but only including buttons we need with custom icons and layout From: https://stackoverflow.com/questions/12695678
Method signatures and docstrings:
- def _Button(frame, text, file, command, extension='.gif'): Map Butt... | Implement the Python class `NavigationToolbar` described below.
Class description:
Same as default, but only including buttons we need with custom icons and layout From: https://stackoverflow.com/questions/12695678
Method signatures and docstrings:
- def _Button(frame, text, file, command, extension='.gif'): Map Butt... | e507f94d4f5d74c36e41c386c6fb14bb745a4885 | <|skeleton|>
class NavigationToolbar:
"""Same as default, but only including buttons we need with custom icons and layout From: https://stackoverflow.com/questions/12695678"""
def _Button(frame, text, file, command, extension='.gif'):
"""Map Buttons to their own frame. Use custom button icons, Use ttk ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class NavigationToolbar:
"""Same as default, but only including buttons we need with custom icons and layout From: https://stackoverflow.com/questions/12695678"""
def _Button(frame, text, file, command, extension='.gif'):
"""Map Buttons to their own frame. Use custom button icons, Use ttk buttons pack ... | the_stack_v2_python_sparse | lib/gui/display_graph.py | oveis/DeepVideoFaceSwap | train | 6 |
008e545c4f02d74019c8d0b6d0c5d7843838cae8 | [
"corpid = 'wwf39d4a17555d0bb6'\ncorpsecret = '5timW2hZA_80OcpSUkrl4lSuF3ZiIuJt9qFqQ5-MMkw'\naccess_token = 'https://qyapi.weixin.qq.com/cgi-bin/gettoken'\nself.tagid = 2\nparm = {'corpid': corpid, 'corpsecret': corpsecret}\nr = requests.get(url=access_token, params=parm)\nself.token = r.json()['access_token']",
"... | <|body_start_0|>
corpid = 'wwf39d4a17555d0bb6'
corpsecret = '5timW2hZA_80OcpSUkrl4lSuF3ZiIuJt9qFqQ5-MMkw'
access_token = 'https://qyapi.weixin.qq.com/cgi-bin/gettoken'
self.tagid = 2
parm = {'corpid': corpid, 'corpsecret': corpsecret}
r = requests.get(url=access_token, pa... | Test_tagname | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Test_tagname:
def setup_class(self):
"""定义token"""
<|body_0|>
def test_creat_tagname(self):
"""创建标签"""
<|body_1|>
def test_updat_tagname(self):
"""更新标签"""
<|body_2|>
def test_del_tagname(self):
"""删除接口"""
<|body_3|>
... | stack_v2_sparse_classes_75kplus_train_073804 | 2,132 | no_license | [
{
"docstring": "定义token",
"name": "setup_class",
"signature": "def setup_class(self)"
},
{
"docstring": "创建标签",
"name": "test_creat_tagname",
"signature": "def test_creat_tagname(self)"
},
{
"docstring": "更新标签",
"name": "test_updat_tagname",
"signature": "def test_updat_t... | 4 | null | Implement the Python class `Test_tagname` described below.
Class description:
Implement the Test_tagname class.
Method signatures and docstrings:
- def setup_class(self): 定义token
- def test_creat_tagname(self): 创建标签
- def test_updat_tagname(self): 更新标签
- def test_del_tagname(self): 删除接口 | Implement the Python class `Test_tagname` described below.
Class description:
Implement the Test_tagname class.
Method signatures and docstrings:
- def setup_class(self): 定义token
- def test_creat_tagname(self): 创建标签
- def test_updat_tagname(self): 更新标签
- def test_del_tagname(self): 删除接口
<|skeleton|>
class Test_tagna... | d06eb1c3c6c5149d73eae8733fabcd6c2586f3d9 | <|skeleton|>
class Test_tagname:
def setup_class(self):
"""定义token"""
<|body_0|>
def test_creat_tagname(self):
"""创建标签"""
<|body_1|>
def test_updat_tagname(self):
"""更新标签"""
<|body_2|>
def test_del_tagname(self):
"""删除接口"""
<|body_3|>
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Test_tagname:
def setup_class(self):
"""定义token"""
corpid = 'wwf39d4a17555d0bb6'
corpsecret = '5timW2hZA_80OcpSUkrl4lSuF3ZiIuJt9qFqQ5-MMkw'
access_token = 'https://qyapi.weixin.qq.com/cgi-bin/gettoken'
self.tagid = 2
parm = {'corpid': corpid, 'corpsecret': corps... | the_stack_v2_python_sparse | test_zuoye/test_tagname2.py | zhufenglili/zhufengli | train | 0 | |
44cbd94e285adb6554f5e565192f72037dae8cc5 | [
"startTime = datetime.datetime.now()\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('henryhcy_wangyp', 'henryhcy_wangyp')\nincome = repo['henryhcy_wangyp.income']\npoverty = repo['henryhcy_wangyp.poverty']\ninfo = []\nfor i in income.find():\n i = i.copy()\n temp = poverty.find_one... | <|body_start_0|>
startTime = datetime.datetime.now()
client = dml.pymongo.MongoClient()
repo = client.repo
repo.authenticate('henryhcy_wangyp', 'henryhcy_wangyp')
income = repo['henryhcy_wangyp.income']
poverty = repo['henryhcy_wangyp.poverty']
info = []
f... | mergeIncomePoverty | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class mergeIncomePoverty:
def execute(trial=False):
"""Retrieve some data sets (not using the API here for the sake of simplicity)."""
<|body_0|>
def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None):
"""Create the provenance document describing every... | stack_v2_sparse_classes_75kplus_train_073805 | 4,296 | no_license | [
{
"docstring": "Retrieve some data sets (not using the API here for the sake of simplicity).",
"name": "execute",
"signature": "def execute(trial=False)"
},
{
"docstring": "Create the provenance document describing everything happening in this script. Each run of the script will generate a new d... | 2 | stack_v2_sparse_classes_30k_train_015974 | Implement the Python class `mergeIncomePoverty` described below.
Class description:
Implement the mergeIncomePoverty class.
Method signatures and docstrings:
- def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity).
- def provenance(doc=prov.model.ProvDocument(), startTi... | Implement the Python class `mergeIncomePoverty` described below.
Class description:
Implement the mergeIncomePoverty class.
Method signatures and docstrings:
- def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity).
- def provenance(doc=prov.model.ProvDocument(), startTi... | 90284cf3debbac36eead07b8d2339cdd191b86cf | <|skeleton|>
class mergeIncomePoverty:
def execute(trial=False):
"""Retrieve some data sets (not using the API here for the sake of simplicity)."""
<|body_0|>
def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None):
"""Create the provenance document describing every... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class mergeIncomePoverty:
def execute(trial=False):
"""Retrieve some data sets (not using the API here for the sake of simplicity)."""
startTime = datetime.datetime.now()
client = dml.pymongo.MongoClient()
repo = client.repo
repo.authenticate('henryhcy_wangyp', 'henryhcy_wang... | the_stack_v2_python_sparse | henryhcy_wangyp/mergeIncomePoverty.py | maximega/course-2019-spr-proj | train | 2 | |
d6634a849a51df276a745a85b3bd595ffc84a2b6 | [
"self.features_parser = self.get_feature_parser(features, allowed_feature_types=[FeatureType.DATA_TIMELESS])\nself.distance_threshold = distance_threshold\nself.affinity = affinity\nself.linkage = linkage\nself.new_feature_name = new_feature_name\nself.n_clusters = n_clusters\nself.compute_full_tree: Literal['auto'... | <|body_start_0|>
self.features_parser = self.get_feature_parser(features, allowed_feature_types=[FeatureType.DATA_TIMELESS])
self.distance_threshold = distance_threshold
self.affinity = affinity
self.linkage = linkage
self.new_feature_name = new_feature_name
self.n_cluste... | Tasks computes clusters on selected features using `sklearn.cluster.AgglomerativeClustering`. The algorithm produces a timeless data feature where each cell has a natural number which corresponds to specific group. The cells marked with -1 are not marking clusters. They are either being excluded by a mask or later remo... | ClusteringTask | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ClusteringTask:
"""Tasks computes clusters on selected features using `sklearn.cluster.AgglomerativeClustering`. The algorithm produces a timeless data feature where each cell has a natural number which corresponds to specific group. The cells marked with -1 are not marking clusters. They are eit... | stack_v2_sparse_classes_75kplus_train_073806 | 5,977 | permissive | [
{
"docstring": "Class constructor :param features: A collection of features used for clustering. The features need to be of type DATA_TIMELESS :param new_feature_name: Name of feature that is the result of clustering :param distance_threshold: The linkage distance threshold above which, clusters will not be mer... | 2 | stack_v2_sparse_classes_30k_train_037721 | Implement the Python class `ClusteringTask` described below.
Class description:
Tasks computes clusters on selected features using `sklearn.cluster.AgglomerativeClustering`. The algorithm produces a timeless data feature where each cell has a natural number which corresponds to specific group. The cells marked with -1... | Implement the Python class `ClusteringTask` described below.
Class description:
Tasks computes clusters on selected features using `sklearn.cluster.AgglomerativeClustering`. The algorithm produces a timeless data feature where each cell has a natural number which corresponds to specific group. The cells marked with -1... | a65899e4632b50c9c41a67e1f7698c09b929d840 | <|skeleton|>
class ClusteringTask:
"""Tasks computes clusters on selected features using `sklearn.cluster.AgglomerativeClustering`. The algorithm produces a timeless data feature where each cell has a natural number which corresponds to specific group. The cells marked with -1 are not marking clusters. They are eit... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ClusteringTask:
"""Tasks computes clusters on selected features using `sklearn.cluster.AgglomerativeClustering`. The algorithm produces a timeless data feature where each cell has a natural number which corresponds to specific group. The cells marked with -1 are not marking clusters. They are either being exc... | the_stack_v2_python_sparse | features/eolearn/features/clustering.py | sentinel-hub/eo-learn | train | 1,072 |
49d00060bdcf1b332810888e9588173a20dc97f2 | [
"with mute_signals(post_save):\n profile = self.create_and_login_user()\n self.client.force_login(profile.user)\nresponse = self.client.get('/404/')\nassert response.status_code == status.HTTP_404_NOT_FOUND\nassert response.context['authenticated'] is True\nassert response.context['name'] == profile.preferred... | <|body_start_0|>
with mute_signals(post_save):
profile = self.create_and_login_user()
self.client.force_login(profile.user)
response = self.client.get('/404/')
assert response.status_code == status.HTTP_404_NOT_FOUND
assert response.context['authenticated'] is Tru... | Tests for 404 and 500 handlers | HandlerTests | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HandlerTests:
"""Tests for 404 and 500 handlers"""
def test_404_error_context_logged_in(self):
"""Assert context values for 404 error page when logged in"""
<|body_0|>
def test_404_error_context_logged_out(self):
"""Assert context values for 404 error page when l... | stack_v2_sparse_classes_75kplus_train_073807 | 17,507 | no_license | [
{
"docstring": "Assert context values for 404 error page when logged in",
"name": "test_404_error_context_logged_in",
"signature": "def test_404_error_context_logged_in(self)"
},
{
"docstring": "Assert context values for 404 error page when logged out",
"name": "test_404_error_context_logged... | 4 | stack_v2_sparse_classes_30k_train_035842 | Implement the Python class `HandlerTests` described below.
Class description:
Tests for 404 and 500 handlers
Method signatures and docstrings:
- def test_404_error_context_logged_in(self): Assert context values for 404 error page when logged in
- def test_404_error_context_logged_out(self): Assert context values for ... | Implement the Python class `HandlerTests` described below.
Class description:
Tests for 404 and 500 handlers
Method signatures and docstrings:
- def test_404_error_context_logged_in(self): Assert context values for 404 error page when logged in
- def test_404_error_context_logged_out(self): Assert context values for ... | 8eb49dfa808f144693735d95fa7305c480485852 | <|skeleton|>
class HandlerTests:
"""Tests for 404 and 500 handlers"""
def test_404_error_context_logged_in(self):
"""Assert context values for 404 error page when logged in"""
<|body_0|>
def test_404_error_context_logged_out(self):
"""Assert context values for 404 error page when l... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class HandlerTests:
"""Tests for 404 and 500 handlers"""
def test_404_error_context_logged_in(self):
"""Assert context values for 404 error page when logged in"""
with mute_signals(post_save):
profile = self.create_and_login_user()
self.client.force_login(profile.user)
... | the_stack_v2_python_sparse | ui/views_test.py | singingwolfboy/micromasters | train | 0 |
bd5ecded9057b3facd4b295bec53799680dd4303 | [
"super().__init__()\nself.ch_in = ch_in\nself.filters = filters\nself.pool_method = pool_method\nself.encoderConv = nn.ModuleList()\nif self.pool_method == 'max':\n self.pooling = nn.MaxPool2d(kernel_size=2, stride=2)\nelif self.pool_method == 'conv':\n self.pooling = nn.ModuleList()\nn_featuremaps = filters[... | <|body_start_0|>
super().__init__()
self.ch_in = ch_in
self.filters = filters
self.pool_method = pool_method
self.encoderConv = nn.ModuleList()
if self.pool_method == 'max':
self.pooling = nn.MaxPool2d(kernel_size=2, stride=2)
elif self.pool_method == ... | U-net with two decoder paths | DUNet | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DUNet:
"""U-net with two decoder paths"""
def __init__(self, ch_in=1, ch_out=1, pool_method='conv', act_fun='relu', normalization='bn', filters=(64, 1024)):
""":param ch_in: Number of channels of the input image. :type ch_in: int :param ch_out: Number of channels of the prediction. :... | stack_v2_sparse_classes_75kplus_train_073808 | 18,935 | permissive | [
{
"docstring": ":param ch_in: Number of channels of the input image. :type ch_in: int :param ch_out: Number of channels of the prediction. :type ch_out: int :param pool_method: 'max' (maximum pooling), 'conv' (convolution with stride 2). :type pool_method: str :param act_fun: 'relu', 'leakyrelu', 'elu', 'mish' ... | 2 | null | Implement the Python class `DUNet` described below.
Class description:
U-net with two decoder paths
Method signatures and docstrings:
- def __init__(self, ch_in=1, ch_out=1, pool_method='conv', act_fun='relu', normalization='bn', filters=(64, 1024)): :param ch_in: Number of channels of the input image. :type ch_in: i... | Implement the Python class `DUNet` described below.
Class description:
U-net with two decoder paths
Method signatures and docstrings:
- def __init__(self, ch_in=1, ch_out=1, pool_method='conv', act_fun='relu', normalization='bn', filters=(64, 1024)): :param ch_in: Number of channels of the input image. :type ch_in: i... | 7e5455f1a27bc42ad765ec06e62c36012be71c11 | <|skeleton|>
class DUNet:
"""U-net with two decoder paths"""
def __init__(self, ch_in=1, ch_out=1, pool_method='conv', act_fun='relu', normalization='bn', filters=(64, 1024)):
""":param ch_in: Number of channels of the input image. :type ch_in: int :param ch_out: Number of channels of the prediction. :... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DUNet:
"""U-net with two decoder paths"""
def __init__(self, ch_in=1, ch_out=1, pool_method='conv', act_fun='relu', normalization='bn', filters=(64, 1024)):
""":param ch_in: Number of channels of the input image. :type ch_in: int :param ch_out: Number of channels of the prediction. :type ch_out: ... | the_stack_v2_python_sparse | src/utils/unets.py | hip-satomi/microbeSEG | train | 6 |
d5e2472688f8bf0e45f7e620377e4b63b95c6e4b | [
"inventarie = create_inventarie()\nresp = self.client.get(reverse('inventarier:list'))\nself.assertEqual(resp.status_code, 200)\nself.assertIn(inventarie, resp.context['inventarie_list'])\nself.assertTemplateUsed(resp, 'inventarier/inventarie_list.html')\nself.assertContains(resp, inventarie.inventarie_nummer)",
... | <|body_start_0|>
inventarie = create_inventarie()
resp = self.client.get(reverse('inventarier:list'))
self.assertEqual(resp.status_code, 200)
self.assertIn(inventarie, resp.context['inventarie_list'])
self.assertTemplateUsed(resp, 'inventarier/inventarie_list.html')
self.... | InventarieViewTests | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InventarieViewTests:
def test_inventarie_list(self):
"""Test för att bekräfta att inventarien dyker upp i index efter att skapats"""
<|body_0|>
def test_inventaire_detail(self):
"""Test för att se om relevanta data finns på sidan."""
<|body_1|>
<|end_skeleto... | stack_v2_sparse_classes_75kplus_train_073809 | 2,696 | no_license | [
{
"docstring": "Test för att bekräfta att inventarien dyker upp i index efter att skapats",
"name": "test_inventarie_list",
"signature": "def test_inventarie_list(self)"
},
{
"docstring": "Test för att se om relevanta data finns på sidan.",
"name": "test_inventaire_detail",
"signature": ... | 2 | stack_v2_sparse_classes_30k_train_045718 | Implement the Python class `InventarieViewTests` described below.
Class description:
Implement the InventarieViewTests class.
Method signatures and docstrings:
- def test_inventarie_list(self): Test för att bekräfta att inventarien dyker upp i index efter att skapats
- def test_inventaire_detail(self): Test för att s... | Implement the Python class `InventarieViewTests` described below.
Class description:
Implement the InventarieViewTests class.
Method signatures and docstrings:
- def test_inventarie_list(self): Test för att bekräfta att inventarien dyker upp i index efter att skapats
- def test_inventaire_detail(self): Test för att s... | 6e9ac9e94eeef12fbcd1f805747a35f68c9a8212 | <|skeleton|>
class InventarieViewTests:
def test_inventarie_list(self):
"""Test för att bekräfta att inventarien dyker upp i index efter att skapats"""
<|body_0|>
def test_inventaire_detail(self):
"""Test för att se om relevanta data finns på sidan."""
<|body_1|>
<|end_skeleto... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class InventarieViewTests:
def test_inventarie_list(self):
"""Test för att bekräfta att inventarien dyker upp i index efter att skapats"""
inventarie = create_inventarie()
resp = self.client.get(reverse('inventarier:list'))
self.assertEqual(resp.status_code, 200)
self.assertI... | the_stack_v2_python_sparse | inventarier/tests.py | varuna126/pegasus | train | 0 | |
48ed01c731e16f0bb6c6dbec489f999e63dc50af | [
"super(ProjectService, self).__init__()\nself._zk_client = zk_client\nself._projects_manager = projects_manager\nself.project_id = project_id\nself.service_id = service_id\nself._stopped = False\nself.versions_node = '/appscale/projects/{}/services/{}/versions'.format(project_id, service_id)\nself._zk_client.ensure... | <|body_start_0|>
super(ProjectService, self).__init__()
self._zk_client = zk_client
self._projects_manager = projects_manager
self.project_id = project_id
self.service_id = service_id
self._stopped = False
self.versions_node = '/appscale/projects/{}/services/{}/ve... | Keeps track of a project's service details. | ProjectService | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProjectService:
"""Keeps track of a project's service details."""
def __init__(self, zk_client, projects_manager, project_id, service_id):
"""Creates a new ProjectService. Args: zk_client: A KazooClient. projects_manager: A GlobalProjectsManager object. project_id: A string specifyin... | stack_v2_sparse_classes_75kplus_train_073810 | 12,944 | permissive | [
{
"docstring": "Creates a new ProjectService. Args: zk_client: A KazooClient. projects_manager: A GlobalProjectsManager object. project_id: A string specifying a project ID. service_id: A string specifying a service ID.",
"name": "__init__",
"signature": "def __init__(self, zk_client, projects_manager, ... | 4 | null | Implement the Python class `ProjectService` described below.
Class description:
Keeps track of a project's service details.
Method signatures and docstrings:
- def __init__(self, zk_client, projects_manager, project_id, service_id): Creates a new ProjectService. Args: zk_client: A KazooClient. projects_manager: A Glo... | Implement the Python class `ProjectService` described below.
Class description:
Keeps track of a project's service details.
Method signatures and docstrings:
- def __init__(self, zk_client, projects_manager, project_id, service_id): Creates a new ProjectService. Args: zk_client: A KazooClient. projects_manager: A Glo... | be17e5f658d7b42b5aa7eeb7a5ddd4962f3ea82f | <|skeleton|>
class ProjectService:
"""Keeps track of a project's service details."""
def __init__(self, zk_client, projects_manager, project_id, service_id):
"""Creates a new ProjectService. Args: zk_client: A KazooClient. projects_manager: A GlobalProjectsManager object. project_id: A string specifyin... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ProjectService:
"""Keeps track of a project's service details."""
def __init__(self, zk_client, projects_manager, project_id, service_id):
"""Creates a new ProjectService. Args: zk_client: A KazooClient. projects_manager: A GlobalProjectsManager object. project_id: A string specifying a project I... | the_stack_v2_python_sparse | AdminServer/appscale/admin/instance_manager/projects_manager.py | obino/appscale | train | 1 |
cf6f9994b003493acd0adaaba15a99c45349d1b6 | [
"self.y_padding = y_padding\nself.x_padding = x_padding\nself.max_x = int(USER32.GetSystemMetrics(0) - x_padding)\nself.max_y = int(USER32.GetSystemMetrics(1) - 100)\nself._generator = self._cords_generator()",
"current_x, current_y = (self.x_padding, self.y_padding)\nwhile current_y < self.max_y:\n yield (cur... | <|body_start_0|>
self.y_padding = y_padding
self.x_padding = x_padding
self.max_x = int(USER32.GetSystemMetrics(0) - x_padding)
self.max_y = int(USER32.GetSystemMetrics(1) - 100)
self._generator = self._cords_generator()
<|end_body_0|>
<|body_start_1|>
current_x, current... | window coordinates helper class. | Coordinates | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Coordinates:
"""window coordinates helper class."""
def __init__(self, x_padding, y_padding):
"""Parameters: y_padding, number representing the boundaries in Y axis"""
<|body_0|>
def _cords_generator(self):
"""This generator will yeild next (x, y) cords of divide... | stack_v2_sparse_classes_75kplus_train_073811 | 10,659 | no_license | [
{
"docstring": "Parameters: y_padding, number representing the boundaries in Y axis",
"name": "__init__",
"signature": "def __init__(self, x_padding, y_padding)"
},
{
"docstring": "This generator will yeild next (x, y) cords of divided screen matrix.",
"name": "_cords_generator",
"signat... | 5 | stack_v2_sparse_classes_30k_train_041555 | Implement the Python class `Coordinates` described below.
Class description:
window coordinates helper class.
Method signatures and docstrings:
- def __init__(self, x_padding, y_padding): Parameters: y_padding, number representing the boundaries in Y axis
- def _cords_generator(self): This generator will yeild next (... | Implement the Python class `Coordinates` described below.
Class description:
window coordinates helper class.
Method signatures and docstrings:
- def __init__(self, x_padding, y_padding): Parameters: y_padding, number representing the boundaries in Y axis
- def _cords_generator(self): This generator will yeild next (... | 358a0341f5e7ef02957c959d6f07105d804d1ff2 | <|skeleton|>
class Coordinates:
"""window coordinates helper class."""
def __init__(self, x_padding, y_padding):
"""Parameters: y_padding, number representing the boundaries in Y axis"""
<|body_0|>
def _cords_generator(self):
"""This generator will yeild next (x, y) cords of divide... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Coordinates:
"""window coordinates helper class."""
def __init__(self, x_padding, y_padding):
"""Parameters: y_padding, number representing the boundaries in Y axis"""
self.y_padding = y_padding
self.x_padding = x_padding
self.max_x = int(USER32.GetSystemMetrics(0) - x_pad... | the_stack_v2_python_sparse | analyzer/windows/modules/auxiliary/human.py | SNDBOXLTD/cuckoo_home | train | 2 |
50e4c0c806f553d335c63a88afd399e60bc61e1f | [
"dp = [1] + [0] * amount\nfor coin in coins:\n for i in range(1, amount + 1):\n if i >= coin:\n dp[i] += dp[i - coin]\nreturn dp[-1]",
"if not amount:\n return 1\nif not coins:\n return 0\nstack = []\nself.ret = 0\ncoins.sort(reverse=True)\n\ndef go(current_amount):\n if current_amou... | <|body_start_0|>
dp = [1] + [0] * amount
for coin in coins:
for i in range(1, amount + 1):
if i >= coin:
dp[i] += dp[i - coin]
return dp[-1]
<|end_body_0|>
<|body_start_1|>
if not amount:
return 1
if not coins:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def change(self, amount, coins):
""":type amount: int :type coins: List[int] :rtype: int 本題和 Coin Change 是類似題, 不同的是本次不問最少枚數 而是要求你算出總共有幾種不同的組法 這邊要求不同就隱含著順序的問題 也就是 '2+1+1' 跟 '1+2+1' 跟 '1+1+2' 是一樣的組法 因此在雙迴圈的順序是有非常重要的, 必須是先根據錢種來迴圈 如果先根據金額量來迴圈, 就會發生上面提到的重複問題 舉例來說, 目標金額是 3, 金幣只有 [1, ... | stack_v2_sparse_classes_75kplus_train_073812 | 2,452 | no_license | [
{
"docstring": ":type amount: int :type coins: List[int] :rtype: int 本題和 Coin Change 是類似題, 不同的是本次不問最少枚數 而是要求你算出總共有幾種不同的組法 這邊要求不同就隱含著順序的問題 也就是 '2+1+1' 跟 '1+2+1' 跟 '1+1+2' 是一樣的組法 因此在雙迴圈的順序是有非常重要的, 必須是先根據錢種來迴圈 如果先根據金額量來迴圈, 就會發生上面提到的重複問題 舉例來說, 目標金額是 3, 金幣只有 [1, 2] 所以應該只有3種方法 [1, 1, 1, 1], [1, 1, 2], [2, 2] 但如果先從金額開... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def change(self, amount, coins): :type amount: int :type coins: List[int] :rtype: int 本題和 Coin Change 是類似題, 不同的是本次不問最少枚數 而是要求你算出總共有幾種不同的組法 這邊要求不同就隱含著順序的問題 也就是 '2+1+1' 跟 '1+2+1' 跟... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def change(self, amount, coins): :type amount: int :type coins: List[int] :rtype: int 本題和 Coin Change 是類似題, 不同的是本次不問最少枚數 而是要求你算出總共有幾種不同的組法 這邊要求不同就隱含著順序的問題 也就是 '2+1+1' 跟 '1+2+1' 跟... | ac53dd9bf2c4c9d17c9dc5f7fdda32e386658fdd | <|skeleton|>
class Solution:
def change(self, amount, coins):
""":type amount: int :type coins: List[int] :rtype: int 本題和 Coin Change 是類似題, 不同的是本次不問最少枚數 而是要求你算出總共有幾種不同的組法 這邊要求不同就隱含著順序的問題 也就是 '2+1+1' 跟 '1+2+1' 跟 '1+1+2' 是一樣的組法 因此在雙迴圈的順序是有非常重要的, 必須是先根據錢種來迴圈 如果先根據金額量來迴圈, 就會發生上面提到的重複問題 舉例來說, 目標金額是 3, 金幣只有 [1, ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def change(self, amount, coins):
""":type amount: int :type coins: List[int] :rtype: int 本題和 Coin Change 是類似題, 不同的是本次不問最少枚數 而是要求你算出總共有幾種不同的組法 這邊要求不同就隱含著順序的問題 也就是 '2+1+1' 跟 '1+2+1' 跟 '1+1+2' 是一樣的組法 因此在雙迴圈的順序是有非常重要的, 必須是先根據錢種來迴圈 如果先根據金額量來迴圈, 就會發生上面提到的重複問題 舉例來說, 目標金額是 3, 金幣只有 [1, 2] 所以應該只有3種方法 ... | the_stack_v2_python_sparse | cs_notes/dynamic_programming/coin_change_ii.py | hwc1824/LeetCodeSolution | train | 0 | |
4b86320e2761c192a64b096d4b4234c2cd3e2b25 | [
"super().__init__(csv_filename, use_dict)\nself.__logger = StockInfoRecordsHelper.__logger\nself.__logger.debug('locals() = %s', locals())",
"record = None\nif self._records:\n for item in self._records:\n if self._use_dict:\n if item[self._headers[FIELD_IDX_TICKER]] == ticker:\n ... | <|body_start_0|>
super().__init__(csv_filename, use_dict)
self.__logger = StockInfoRecordsHelper.__logger
self.__logger.debug('locals() = %s', locals())
<|end_body_0|>
<|body_start_1|>
record = None
if self._records:
for item in self._records:
if self... | Manage host records. | StockInfoRecordsHelper | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StockInfoRecordsHelper:
"""Manage host records."""
def __init__(self, csv_filename, use_dict=False):
"""@param csv_filename: CSV file. @param use_dict: Boolean, whether to open CSV as dict. True: read records as a list of dict; False: read records as a list of list."""
<|body... | stack_v2_sparse_classes_75kplus_train_073813 | 1,773 | permissive | [
{
"docstring": "@param csv_filename: CSV file. @param use_dict: Boolean, whether to open CSV as dict. True: read records as a list of dict; False: read records as a list of list.",
"name": "__init__",
"signature": "def __init__(self, csv_filename, use_dict=False)"
},
{
"docstring": "Find record ... | 2 | stack_v2_sparse_classes_30k_train_027168 | Implement the Python class `StockInfoRecordsHelper` described below.
Class description:
Manage host records.
Method signatures and docstrings:
- def __init__(self, csv_filename, use_dict=False): @param csv_filename: CSV file. @param use_dict: Boolean, whether to open CSV as dict. True: read records as a list of dict;... | Implement the Python class `StockInfoRecordsHelper` described below.
Class description:
Manage host records.
Method signatures and docstrings:
- def __init__(self, csv_filename, use_dict=False): @param csv_filename: CSV file. @param use_dict: Boolean, whether to open CSV as dict. True: read records as a list of dict;... | 91c1ee4875a740d8be48fc9d74098a37e2f5cae6 | <|skeleton|>
class StockInfoRecordsHelper:
"""Manage host records."""
def __init__(self, csv_filename, use_dict=False):
"""@param csv_filename: CSV file. @param use_dict: Boolean, whether to open CSV as dict. True: read records as a list of dict; False: read records as a list of list."""
<|body... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class StockInfoRecordsHelper:
"""Manage host records."""
def __init__(self, csv_filename, use_dict=False):
"""@param csv_filename: CSV file. @param use_dict: Boolean, whether to open CSV as dict. True: read records as a list of dict; False: read records as a list of list."""
super().__init__(cs... | the_stack_v2_python_sparse | Python_Test/PyFinanceApiSample/com/djs/learn/files/StockInfoRecordsHelper.py | djsilenceboy/LearnTest | train | 3 |
cabe426890d9f8fec63b70ea205bdb95ab29b59c | [
"self._parent_module = parent_module\nself._attribute_modules = self._build_attribute_modules(module_attributes)\nself._loaded_modules = {}\nsys.modules[parent_module.__name__] = self",
"attribute_modules = {}\nfor module, attributes in iteritems(module_attributes):\n for attribute in attributes:\n attr... | <|body_start_0|>
self._parent_module = parent_module
self._attribute_modules = self._build_attribute_modules(module_attributes)
self._loaded_modules = {}
sys.modules[parent_module.__name__] = self
<|end_body_0|>
<|body_start_1|>
attribute_modules = {}
for module, attribu... | Importer that dynamically loads a class and module from its parent. This allows Airflow to support ``from airflow.operators import BashOperator`` even though BashOperator is actually in ``airflow.operators.bash_operator``. The importer also takes over for the parent_module by wrapping it. This is required to support at... | XToolImporter | [
"MIT",
"BSD-3-Clause",
"Apache-2.0",
"BSD-2-Clause",
"Python-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class XToolImporter:
"""Importer that dynamically loads a class and module from its parent. This allows Airflow to support ``from airflow.operators import BashOperator`` even though BashOperator is actually in ``airflow.operators.bash_operator``. The importer also takes over for the parent_module by wr... | stack_v2_sparse_classes_75kplus_train_073814 | 9,714 | permissive | [
{
"docstring": ":param parent_module: The string package name of the parent module. For example, 'airflow.operators' :type parent_module: string :param module_attributes: The file to class mappings for all importable classes. :type module_attributes: string",
"name": "__init__",
"signature": "def __init... | 4 | stack_v2_sparse_classes_30k_train_037880 | Implement the Python class `XToolImporter` described below.
Class description:
Importer that dynamically loads a class and module from its parent. This allows Airflow to support ``from airflow.operators import BashOperator`` even though BashOperator is actually in ``airflow.operators.bash_operator``. The importer also... | Implement the Python class `XToolImporter` described below.
Class description:
Importer that dynamically loads a class and module from its parent. This allows Airflow to support ``from airflow.operators import BashOperator`` even though BashOperator is actually in ``airflow.operators.bash_operator``. The importer also... | 57d745ce6be531c000a3b477c38bfdd4c2ac74e3 | <|skeleton|>
class XToolImporter:
"""Importer that dynamically loads a class and module from its parent. This allows Airflow to support ``from airflow.operators import BashOperator`` even though BashOperator is actually in ``airflow.operators.bash_operator``. The importer also takes over for the parent_module by wr... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class XToolImporter:
"""Importer that dynamically loads a class and module from its parent. This allows Airflow to support ``from airflow.operators import BashOperator`` even though BashOperator is actually in ``airflow.operators.bash_operator``. The importer also takes over for the parent_module by wrapping it. Th... | the_stack_v2_python_sparse | xTool/utils/module_loading.py | fengzhongzhu1621/xTool | train | 3 |
76c4de2c83b3e3ebbf01af528bdaae6c4d9795a0 | [
"est = clone(self.clf)\nest.fit(X.to_numpy(), y)\nif hasattr(est, 'coef_'):\n importance = est.coef_\nelif hasattr(est, 'feature_importances_'):\n importance = est.feature_importances_\nelse:\n raise AttributeError('{} do not has coef_ or feature_importance_'.format(self.clf.__class__.__name__))\nreturn (i... | <|body_start_0|>
est = clone(self.clf)
est.fit(X.to_numpy(), y)
if hasattr(est, 'coef_'):
importance = est.coef_
elif hasattr(est, 'feature_importances_'):
importance = est.feature_importances_
else:
raise AttributeError('{} do not has coef_ or... | FeatureImportanceSelect | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FeatureImportanceSelect:
def get_thres(self, X, y):
"""得到不同特征的重要程度和最小值。"""
<|body_0|>
def choose(self, X, y, to_select=None):
"""不断出去最不重要的特征,最终选取结果最好的作为最终选择的特征进行后续建模。"""
<|body_1|>
def plot_process(self):
"""可视化在不断去除掉最不重要特征的情况下,结果的变化过程。"""
... | stack_v2_sparse_classes_75kplus_train_073815 | 15,365 | no_license | [
{
"docstring": "得到不同特征的重要程度和最小值。",
"name": "get_thres",
"signature": "def get_thres(self, X, y)"
},
{
"docstring": "不断出去最不重要的特征,最终选取结果最好的作为最终选择的特征进行后续建模。",
"name": "choose",
"signature": "def choose(self, X, y, to_select=None)"
},
{
"docstring": "可视化在不断去除掉最不重要特征的情况下,结果的变化过程。",
... | 3 | stack_v2_sparse_classes_30k_train_039008 | Implement the Python class `FeatureImportanceSelect` described below.
Class description:
Implement the FeatureImportanceSelect class.
Method signatures and docstrings:
- def get_thres(self, X, y): 得到不同特征的重要程度和最小值。
- def choose(self, X, y, to_select=None): 不断出去最不重要的特征,最终选取结果最好的作为最终选择的特征进行后续建模。
- def plot_process(self)... | Implement the Python class `FeatureImportanceSelect` described below.
Class description:
Implement the FeatureImportanceSelect class.
Method signatures and docstrings:
- def get_thres(self, X, y): 得到不同特征的重要程度和最小值。
- def choose(self, X, y, to_select=None): 不断出去最不重要的特征,最终选取结果最好的作为最终选择的特征进行后续建模。
- def plot_process(self)... | 823184005a3a2ed70a32b37c0afc2066e6e8907a | <|skeleton|>
class FeatureImportanceSelect:
def get_thres(self, X, y):
"""得到不同特征的重要程度和最小值。"""
<|body_0|>
def choose(self, X, y, to_select=None):
"""不断出去最不重要的特征,最终选取结果最好的作为最终选择的特征进行后续建模。"""
<|body_1|>
def plot_process(self):
"""可视化在不断去除掉最不重要特征的情况下,结果的变化过程。"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class FeatureImportanceSelect:
def get_thres(self, X, y):
"""得到不同特征的重要程度和最小值。"""
est = clone(self.clf)
est.fit(X.to_numpy(), y)
if hasattr(est, 'coef_'):
importance = est.coef_
elif hasattr(est, 'feature_importances_'):
importance = est.feature_importa... | the_stack_v2_python_sparse | WorkCode/Models/UserFunc/FeatureEngineering.py | johngolt/gitln | train | 1 | |
4e7ec8c30460b533ed42be795accc18263e58348 | [
"ret = []\ni = j = 0\nwhile i < len(firstList) and j < len(secondList):\n lo = max(firstList[i][0], secondList[j][0])\n hi = min(firstList[i][1], secondList[j][1])\n if lo <= hi:\n ret.append([lo, hi])\n if firstList[i][1] < secondList[j][1]:\n i += 1\n else:\n j += 1\nreturn ret... | <|body_start_0|>
ret = []
i = j = 0
while i < len(firstList) and j < len(secondList):
lo = max(firstList[i][0], secondList[j][0])
hi = min(firstList[i][1], secondList[j][1])
if lo <= hi:
ret.append([lo, hi])
if firstList[i][1] < sec... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def intervalIntersection(self, firstList, secondList):
""":type firstList: List[List[int]] :type secondList: List[List[int]] :rtype: List[List[int]] better solution is like the merge part of merge sort, use 2 pointers. a trick to use, max(a2,b2) and min(a1,b2) to check if they ... | stack_v2_sparse_classes_75kplus_train_073816 | 3,412 | no_license | [
{
"docstring": ":type firstList: List[List[int]] :type secondList: List[List[int]] :rtype: List[List[int]] better solution is like the merge part of merge sort, use 2 pointers. a trick to use, max(a2,b2) and min(a1,b2) to check if they have intersection. 08/11/2022 12:11 Accepted 118 ms 14.2 MB python < 08/11/2... | 2 | stack_v2_sparse_classes_30k_train_029473 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def intervalIntersection(self, firstList, secondList): :type firstList: List[List[int]] :type secondList: List[List[int]] :rtype: List[List[int]] better solution is like the merg... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def intervalIntersection(self, firstList, secondList): :type firstList: List[List[int]] :type secondList: List[List[int]] :rtype: List[List[int]] better solution is like the merg... | 02726da394971ef02616a038dadc126c6ff260de | <|skeleton|>
class Solution:
def intervalIntersection(self, firstList, secondList):
""":type firstList: List[List[int]] :type secondList: List[List[int]] :rtype: List[List[int]] better solution is like the merge part of merge sort, use 2 pointers. a trick to use, max(a2,b2) and min(a1,b2) to check if they ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def intervalIntersection(self, firstList, secondList):
""":type firstList: List[List[int]] :type secondList: List[List[int]] :rtype: List[List[int]] better solution is like the merge part of merge sort, use 2 pointers. a trick to use, max(a2,b2) and min(a1,b2) to check if they have intersect... | the_stack_v2_python_sparse | intervals/N986_IntervalListIntersections.py | zerghua/leetcode-python | train | 2 | |
d4bf260c03641d7c602bb72f6756b9fd42e930f7 | [
"super().__init__(**kwargs)\nassert json_topology is not None, 'must give a JSON format topology'\nassert init_state is not None, 'must give an init state for the topology PDB'\nif main_rep_idxs is None:\n self.main_rep_idxs = list(range(init_state['positions'].shape[0]))\nelse:\n self.main_rep_idxs = main_re... | <|body_start_0|>
super().__init__(**kwargs)
assert json_topology is not None, 'must give a JSON format topology'
assert init_state is not None, 'must give an init state for the topology PDB'
if main_rep_idxs is None:
self.main_rep_idxs = list(range(init_state['positions'].sha... | Reporter for generating 3D molecular structure files of the walkers produced by a cycle. It generates two different files using the mdtraj library: a PDB format and a DCD file. The PDB is used as a "topology" that is only generated once at the beginning of a simulation (in the call to the 'init' method). This defines t... | WalkerReporter | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WalkerReporter:
"""Reporter for generating 3D molecular structure files of the walkers produced by a cycle. It generates two different files using the mdtraj library: a PDB format and a DCD file. The PDB is used as a "topology" that is only generated once at the beginning of a simulation (in the ... | stack_v2_sparse_classes_75kplus_train_073817 | 5,495 | permissive | [
{
"docstring": "Constructor for the WalkerReporter. Parameters ---------- init_state : object implementing WalkerState An initial state, only used for writing the PDB topology. json_topology : str A molecular topology in the common JSON format, that matches the main_rep_idxs. main_rep_idxs : listlike of int The... | 3 | stack_v2_sparse_classes_30k_train_039124 | Implement the Python class `WalkerReporter` described below.
Class description:
Reporter for generating 3D molecular structure files of the walkers produced by a cycle. It generates two different files using the mdtraj library: a PDB format and a DCD file. The PDB is used as a "topology" that is only generated once at... | Implement the Python class `WalkerReporter` described below.
Class description:
Reporter for generating 3D molecular structure files of the walkers produced by a cycle. It generates two different files using the mdtraj library: a PDB format and a DCD file. The PDB is used as a "topology" that is only generated once at... | 3a029510114db6e66db6a264bd213c9f06559b41 | <|skeleton|>
class WalkerReporter:
"""Reporter for generating 3D molecular structure files of the walkers produced by a cycle. It generates two different files using the mdtraj library: a PDB format and a DCD file. The PDB is used as a "topology" that is only generated once at the beginning of a simulation (in the ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class WalkerReporter:
"""Reporter for generating 3D molecular structure files of the walkers produced by a cycle. It generates two different files using the mdtraj library: a PDB format and a DCD file. The PDB is used as a "topology" that is only generated once at the beginning of a simulation (in the call to the '... | the_stack_v2_python_sparse | src/wepy/reporter/walker.py | ADicksonLab/wepy | train | 43 |
b818fb964fd834091577c99736824c426e21a9ae | [
"try:\n nr_model = RequestDAO.query.get(nr_id)\n if not nr_model:\n return (jsonify(message=f'{nr_id} not found'), 400)\n payment_id = int(clean_url_path_param(payment_id))\n payment = PaymentDAO.query.get(payment_id)\n payment_response = get_payment(payment.payment_token)\n receipts = paym... | <|body_start_0|>
try:
nr_model = RequestDAO.query.get(nr_id)
if not nr_model:
return (jsonify(message=f'{nr_id} not found'), 400)
payment_id = int(clean_url_path_param(payment_id))
payment = PaymentDAO.query.get(payment_id)
payment_resp... | Name request payment endpoints. | NameRequestPayment | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NameRequestPayment:
"""Name request payment endpoints."""
def get(self, nr_id, payment_id):
"""Get endpoint."""
<|body_0|>
def delete(self, nr_id, payment_id):
"""Delete endpoint."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
try:
... | stack_v2_sparse_classes_75kplus_train_073818 | 39,319 | permissive | [
{
"docstring": "Get endpoint.",
"name": "get",
"signature": "def get(self, nr_id, payment_id)"
},
{
"docstring": "Delete endpoint.",
"name": "delete",
"signature": "def delete(self, nr_id, payment_id)"
}
] | 2 | null | Implement the Python class `NameRequestPayment` described below.
Class description:
Name request payment endpoints.
Method signatures and docstrings:
- def get(self, nr_id, payment_id): Get endpoint.
- def delete(self, nr_id, payment_id): Delete endpoint. | Implement the Python class `NameRequestPayment` described below.
Class description:
Name request payment endpoints.
Method signatures and docstrings:
- def get(self, nr_id, payment_id): Get endpoint.
- def delete(self, nr_id, payment_id): Delete endpoint.
<|skeleton|>
class NameRequestPayment:
"""Name request pa... | 0175587b7322a3e41076b8bd7a3976f486491a5c | <|skeleton|>
class NameRequestPayment:
"""Name request payment endpoints."""
def get(self, nr_id, payment_id):
"""Get endpoint."""
<|body_0|>
def delete(self, nr_id, payment_id):
"""Delete endpoint."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class NameRequestPayment:
"""Name request payment endpoints."""
def get(self, nr_id, payment_id):
"""Get endpoint."""
try:
nr_model = RequestDAO.query.get(nr_id)
if not nr_model:
return (jsonify(message=f'{nr_id} not found'), 400)
payment_id =... | the_stack_v2_python_sparse | api/namex/resources/payment/payment.py | bcgov/namex | train | 5 |
7e766aacfad92a5527b3fcebb8cd70b350e09244 | [
"self._base_item = None\nif description is None:\n description = name\nif description in translations:\n self._base_item = description + ':'\n description = translations[description].get_string(**tokens)\nsuper().__init__(cvar_prefix + name, default, description, flags, min_value, max_value)\nself.translat... | <|body_start_0|>
self._base_item = None
if description is None:
description = name
if description in translations:
self._base_item = description + ':'
description = translations[description].get_string(**tokens)
super().__init__(cvar_prefix + name, def... | Class used to more easily add translations for cvars in config files. | _GunGameCvarManager | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _GunGameCvarManager:
"""Class used to more easily add translations for cvars in config files."""
def __init__(self, name, default, description, flags, min_value, max_value, cvar_prefix, translations, **tokens):
"""Get the true description and store the translations."""
<|body... | stack_v2_sparse_classes_75kplus_train_073819 | 4,371 | no_license | [
{
"docstring": "Get the true description and store the translations.",
"name": "__init__",
"signature": "def __init__(self, name, default, description, flags, min_value, max_value, cvar_prefix, translations, **tokens)"
},
{
"docstring": "Add all other text for the ConVar.",
"name": "add_text... | 2 | stack_v2_sparse_classes_30k_train_036569 | Implement the Python class `_GunGameCvarManager` described below.
Class description:
Class used to more easily add translations for cvars in config files.
Method signatures and docstrings:
- def __init__(self, name, default, description, flags, min_value, max_value, cvar_prefix, translations, **tokens): Get the true ... | Implement the Python class `_GunGameCvarManager` described below.
Class description:
Class used to more easily add translations for cvars in config files.
Method signatures and docstrings:
- def __init__(self, name, default, description, flags, min_value, max_value, cvar_prefix, translations, **tokens): Get the true ... | dd76d1f581a1a8aff18c2194834665fa66a82aab | <|skeleton|>
class _GunGameCvarManager:
"""Class used to more easily add translations for cvars in config files."""
def __init__(self, name, default, description, flags, min_value, max_value, cvar_prefix, translations, **tokens):
"""Get the true description and store the translations."""
<|body... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class _GunGameCvarManager:
"""Class used to more easily add translations for cvars in config files."""
def __init__(self, name, default, description, flags, min_value, max_value, cvar_prefix, translations, **tokens):
"""Get the true description and store the translations."""
self._base_item = N... | the_stack_v2_python_sparse | addons/source-python/plugins/gungame/core/config/manager.py | Hackmastr/GunGame-SP | train | 0 |
e81cb9d759600a33a508423b99b77b241b1ecb72 | [
"words_matched = []\nfor word in WordList.word_list:\n if word in Dictionary.dictionary and len(Dictionary.dictionary[word][0]) > 1:\n words_matched.append(word)\nreturn words_matched",
"words_not_matched = []\nfor word in WordList.word_list:\n if word not in Dictionary.dictionary:\n words_not... | <|body_start_0|>
words_matched = []
for word in WordList.word_list:
if word in Dictionary.dictionary and len(Dictionary.dictionary[word][0]) > 1:
words_matched.append(word)
return words_matched
<|end_body_0|>
<|body_start_1|>
words_not_matched = []
fo... | Analyser | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Analyser:
def get_briefs(Dictionary, WordList):
"""Return a list of words for which there is no one-stroker"""
<|body_0|>
def get_missing_words(Dictionary, WordList):
"""Return list of words that aren't in a dictionary as compared with a word list"""
<|body_1... | stack_v2_sparse_classes_75kplus_train_073820 | 2,597 | no_license | [
{
"docstring": "Return a list of words for which there is no one-stroker",
"name": "get_briefs",
"signature": "def get_briefs(Dictionary, WordList)"
},
{
"docstring": "Return list of words that aren't in a dictionary as compared with a word list",
"name": "get_missing_words",
"signature"... | 2 | stack_v2_sparse_classes_30k_train_032311 | Implement the Python class `Analyser` described below.
Class description:
Implement the Analyser class.
Method signatures and docstrings:
- def get_briefs(Dictionary, WordList): Return a list of words for which there is no one-stroker
- def get_missing_words(Dictionary, WordList): Return list of words that aren't in ... | Implement the Python class `Analyser` described below.
Class description:
Implement the Analyser class.
Method signatures and docstrings:
- def get_briefs(Dictionary, WordList): Return a list of words for which there is no one-stroker
- def get_missing_words(Dictionary, WordList): Return list of words that aren't in ... | 09dec3f66ed5df1e50bad7cdfd67451d51f8db39 | <|skeleton|>
class Analyser:
def get_briefs(Dictionary, WordList):
"""Return a list of words for which there is no one-stroker"""
<|body_0|>
def get_missing_words(Dictionary, WordList):
"""Return list of words that aren't in a dictionary as compared with a word list"""
<|body_1... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Analyser:
def get_briefs(Dictionary, WordList):
"""Return a list of words for which there is no one-stroker"""
words_matched = []
for word in WordList.word_list:
if word in Dictionary.dictionary and len(Dictionary.dictionary[word][0]) > 1:
words_matched.appe... | the_stack_v2_python_sparse | briefology/dictionaryanalysis/dictionary_analysis.py | euanwho/Briefology | train | 0 | |
bc403fcdd9722d84dd2b72e1f64e8c21370e268f | [
"self.graph = graph\nself.point_dict = dict()\nself.radius = 1.0",
"if root is None:\n algorithm = TreeCenter(self.graph)\n algorithm.run()\n root = algorithm.tree_center[0]\nself.plot(root, 0.0, 2.0 * math.pi, level=0)",
"angle = 0.5 * (left + right)\nx = self.radius * level * math.cos(angle)\ny = sel... | <|body_start_0|>
self.graph = graph
self.point_dict = dict()
self.radius = 1.0
<|end_body_0|>
<|body_start_1|>
if root is None:
algorithm = TreeCenter(self.graph)
algorithm.run()
root = algorithm.tree_center[0]
self.plot(root, 0.0, 2.0 * math.... | Finding the positions of tree nodes in the plane. This is not suitable for large trees (|V| > 1e4) due to numerical errors. For large trees use TreePlotRadiusAngle with fractions. | TreePlot | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TreePlot:
"""Finding the positions of tree nodes in the plane. This is not suitable for large trees (|V| > 1e4) due to numerical errors. For large trees use TreePlotRadiusAngle with fractions."""
def __init__(self, graph):
"""The algorithm initialization."""
<|body_0|>
d... | stack_v2_sparse_classes_75kplus_train_073821 | 3,663 | permissive | [
{
"docstring": "The algorithm initialization.",
"name": "__init__",
"signature": "def __init__(self, graph)"
},
{
"docstring": "Executable pseudocode.",
"name": "run",
"signature": "def run(self, root=None)"
},
{
"docstring": "Find node positions. Parameters ---------- source : c... | 3 | stack_v2_sparse_classes_30k_train_025200 | Implement the Python class `TreePlot` described below.
Class description:
Finding the positions of tree nodes in the plane. This is not suitable for large trees (|V| > 1e4) due to numerical errors. For large trees use TreePlotRadiusAngle with fractions.
Method signatures and docstrings:
- def __init__(self, graph): T... | Implement the Python class `TreePlot` described below.
Class description:
Finding the positions of tree nodes in the plane. This is not suitable for large trees (|V| > 1e4) due to numerical errors. For large trees use TreePlotRadiusAngle with fractions.
Method signatures and docstrings:
- def __init__(self, graph): T... | 0ff4ae303e8824e6bb8474d23b29a7b3e5ed8e60 | <|skeleton|>
class TreePlot:
"""Finding the positions of tree nodes in the plane. This is not suitable for large trees (|V| > 1e4) due to numerical errors. For large trees use TreePlotRadiusAngle with fractions."""
def __init__(self, graph):
"""The algorithm initialization."""
<|body_0|>
d... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TreePlot:
"""Finding the positions of tree nodes in the plane. This is not suitable for large trees (|V| > 1e4) due to numerical errors. For large trees use TreePlotRadiusAngle with fractions."""
def __init__(self, graph):
"""The algorithm initialization."""
self.graph = graph
sel... | the_stack_v2_python_sparse | graphtheory/forests/treeplot.py | kgashok/graphs-dict | train | 0 |
328c897a3d9d41cce3aa6832c53592ef638f519d | [
"if not nums:\n return None\nlo = 0\nhi = len(nums) - 1\nwhile lo < hi:\n mid = (lo + hi) // 2\n if nums[mid] > nums[hi]:\n lo = mid + 1\n else:\n hi = mid\nreturn nums[lo]",
"if not nums:\n return None\nlo = 0\nhi = len(nums) - 1\nwhile lo < hi:\n mid = (lo + hi) // 2\n if nums... | <|body_start_0|>
if not nums:
return None
lo = 0
hi = len(nums) - 1
while lo < hi:
mid = (lo + hi) // 2
if nums[mid] > nums[hi]:
lo = mid + 1
else:
hi = mid
return nums[lo]
<|end_body_0|>
<|body_star... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findMin(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def findMinDup(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not nums:
return None
lo = ... | stack_v2_sparse_classes_75kplus_train_073822 | 1,487 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "findMin",
"signature": "def findMin(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "findMinDup",
"signature": "def findMinDup(self, nums)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findMin(self, nums): :type nums: List[int] :rtype: int
- def findMinDup(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 findMin(self, nums): :type nums: List[int] :rtype: int
- def findMinDup(self, nums): :type nums: List[int] :rtype: int
<|skeleton|>
class Solution:
def findMin(self, nu... | 0584b86642dff667f5bf6b7acfbbce86a41a55b6 | <|skeleton|>
class Solution:
def findMin(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def findMinDup(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def findMin(self, nums):
""":type nums: List[int] :rtype: int"""
if not nums:
return None
lo = 0
hi = len(nums) - 1
while lo < hi:
mid = (lo + hi) // 2
if nums[mid] > nums[hi]:
lo = mid + 1
else:
... | the_stack_v2_python_sparse | python_solution/151_160/FindMin.py | CescWang1991/LeetCode-Python | train | 1 | |
466d0babc55ba3949ae0ebac5e065a43cdaf27b7 | [
"token = AccessToken(app_id, app_certificate, expire=expire)\nchar_user_id = get_md5(user_uuid)\neducation_service = ServiceEducation(room_uuid, user_uuid, role)\neducation_service.add_privilege(ServiceEducation.kPrivilegeRoomUser, expire)\ntoken.add_service(education_service)\nrtm_service = ServiceRtm(user_uuid)\n... | <|body_start_0|>
token = AccessToken(app_id, app_certificate, expire=expire)
char_user_id = get_md5(user_uuid)
education_service = ServiceEducation(room_uuid, user_uuid, role)
education_service.add_privilege(ServiceEducation.kPrivilegeRoomUser, expire)
token.add_service(education... | EducationTokenBuilder | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EducationTokenBuilder:
def build_room_user_token(app_id, app_certificate, room_uuid, user_uuid, role, expire):
"""Build user room token :param app_id: The App ID issued to you by Agora. Apply for a new App ID from Agora Dashboard if it is missing from your kit. See Get an App ID. :param ... | stack_v2_sparse_classes_75kplus_train_073823 | 3,863 | permissive | [
{
"docstring": "Build user room token :param app_id: The App ID issued to you by Agora. Apply for a new App ID from Agora Dashboard if it is missing from your kit. See Get an App ID. :param app_certificate: Certificate of the application that you registered in the Agora Dashboard. See Get an App Certificate. :p... | 3 | stack_v2_sparse_classes_30k_train_034650 | Implement the Python class `EducationTokenBuilder` described below.
Class description:
Implement the EducationTokenBuilder class.
Method signatures and docstrings:
- def build_room_user_token(app_id, app_certificate, room_uuid, user_uuid, role, expire): Build user room token :param app_id: The App ID issued to you by... | Implement the Python class `EducationTokenBuilder` described below.
Class description:
Implement the EducationTokenBuilder class.
Method signatures and docstrings:
- def build_room_user_token(app_id, app_certificate, room_uuid, user_uuid, role, expire): Build user room token :param app_id: The App ID issued to you by... | 5c800b136f132a92d5f70252aac12e9c32dbf5e7 | <|skeleton|>
class EducationTokenBuilder:
def build_room_user_token(app_id, app_certificate, room_uuid, user_uuid, role, expire):
"""Build user room token :param app_id: The App ID issued to you by Agora. Apply for a new App ID from Agora Dashboard if it is missing from your kit. See Get an App ID. :param ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class EducationTokenBuilder:
def build_room_user_token(app_id, app_certificate, room_uuid, user_uuid, role, expire):
"""Build user room token :param app_id: The App ID issued to you by Agora. Apply for a new App ID from Agora Dashboard if it is missing from your kit. See Get an App ID. :param app_certificat... | the_stack_v2_python_sparse | DynamicKey/AgoraDynamicKey/python3/src/education_token_builder.py | AgoraIO/Tools | train | 380 | |
74a2af8d8b59b0cb3142fee192a8e4e5ac293e7f | [
"super(Jade, self).setup()\nself.argv.append(self.jade or 'jade')\nself.argv.append('--client')\nif self.jade_no_debug:\n self.argv.append('--no-debug')\nif not self.js_var:\n self.js_var = 'templates'",
"proc = subprocess.Popen(self.argv, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIP... | <|body_start_0|>
super(Jade, self).setup()
self.argv.append(self.jade or 'jade')
self.argv.append('--client')
if self.jade_no_debug:
self.argv.append('--no-debug')
if not self.js_var:
self.js_var = 'templates'
<|end_body_0|>
<|body_start_1|>
proc ... | Converts `Jade <http://jade-lang.com/>`_ templates to client-side JavaScript functions. Requires the Jade executable to be available externally. You can install it using the `Node Package Manager <http://npmjs.org/>`_:: $ npm install jade Jade templates are compiled and stored in a window-level JavaScript object under ... | Jade | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Jade:
"""Converts `Jade <http://jade-lang.com/>`_ templates to client-side JavaScript functions. Requires the Jade executable to be available externally. You can install it using the `Node Package Manager <http://npmjs.org/>`_:: $ npm install jade Jade templates are compiled and stored in a windo... | stack_v2_sparse_classes_75kplus_train_073824 | 4,016 | permissive | [
{
"docstring": "Check options and apply defaults if necessary",
"name": "setup",
"signature": "def setup(self)"
},
{
"docstring": "Compile individual Jade templates",
"name": "input",
"signature": "def input(self, _in, out, **kwargs)"
},
{
"docstring": "Prepend Jade runtime and i... | 3 | stack_v2_sparse_classes_30k_train_046437 | Implement the Python class `Jade` described below.
Class description:
Converts `Jade <http://jade-lang.com/>`_ templates to client-side JavaScript functions. Requires the Jade executable to be available externally. You can install it using the `Node Package Manager <http://npmjs.org/>`_:: $ npm install jade Jade templ... | Implement the Python class `Jade` described below.
Class description:
Converts `Jade <http://jade-lang.com/>`_ templates to client-side JavaScript functions. Requires the Jade executable to be available externally. You can install it using the `Node Package Manager <http://npmjs.org/>`_:: $ npm install jade Jade templ... | 65b7a50b22fcb9dadc7e91a98225f6ca2b33f3b8 | <|skeleton|>
class Jade:
"""Converts `Jade <http://jade-lang.com/>`_ templates to client-side JavaScript functions. Requires the Jade executable to be available externally. You can install it using the `Node Package Manager <http://npmjs.org/>`_:: $ npm install jade Jade templates are compiled and stored in a windo... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Jade:
"""Converts `Jade <http://jade-lang.com/>`_ templates to client-side JavaScript functions. Requires the Jade executable to be available externally. You can install it using the `Node Package Manager <http://npmjs.org/>`_:: $ npm install jade Jade templates are compiled and stored in a window-level JavaS... | the_stack_v2_python_sparse | weppy_assets/webassets/filter/jade.py | gi0baro/weppy-assets | train | 2 |
8684ca0578bc54040497a2064a6e4de06ab20292 | [
"loss = sum([max(0, 1 - y[i] * X[i].dot(w)) for i in range(len(y))]) / y.shape[0]\nif self.regularization is not None:\n loss = loss + self.regularization.forward(w)\nreturn loss",
"gradient = np.zeros(X[0].shape)\nfor i in range(len(X)):\n if 1 - y[i] * X[i].dot(w) < 0:\n continue\n gradient += -... | <|body_start_0|>
loss = sum([max(0, 1 - y[i] * X[i].dot(w)) for i in range(len(y))]) / y.shape[0]
if self.regularization is not None:
loss = loss + self.regularization.forward(w)
return loss
<|end_body_0|>
<|body_start_1|>
gradient = np.zeros(X[0].shape)
for i in ran... | The hinge loss function. https://en.wikipedia.org/wiki/Hinge_loss | HingeLoss | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HingeLoss:
"""The hinge loss function. https://en.wikipedia.org/wiki/Hinge_loss"""
def forward(self, X, w, y):
"""Computes the forward pass through the loss function. If self.regularization is not None, also adds the forward pass of the regularization term to the loss. The hinge loss... | stack_v2_sparse_classes_75kplus_train_073825 | 9,968 | permissive | [
{
"docstring": "Computes the forward pass through the loss function. If self.regularization is not None, also adds the forward pass of the regularization term to the loss. The hinge loss for a single example is given as follows: L_h(x, y; w) = max(0, 1 - y w^T x) The hinge loss over a dataset of N points is the... | 2 | null | Implement the Python class `HingeLoss` described below.
Class description:
The hinge loss function. https://en.wikipedia.org/wiki/Hinge_loss
Method signatures and docstrings:
- def forward(self, X, w, y): Computes the forward pass through the loss function. If self.regularization is not None, also adds the forward pa... | Implement the Python class `HingeLoss` described below.
Class description:
The hinge loss function. https://en.wikipedia.org/wiki/Hinge_loss
Method signatures and docstrings:
- def forward(self, X, w, y): Computes the forward pass through the loss function. If self.regularization is not None, also adds the forward pa... | aad5ff878a6d7d74d2bb73078e53520317ca3ad3 | <|skeleton|>
class HingeLoss:
"""The hinge loss function. https://en.wikipedia.org/wiki/Hinge_loss"""
def forward(self, X, w, y):
"""Computes the forward pass through the loss function. If self.regularization is not None, also adds the forward pass of the regularization term to the loss. The hinge loss... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class HingeLoss:
"""The hinge loss function. https://en.wikipedia.org/wiki/Hinge_loss"""
def forward(self, X, w, y):
"""Computes the forward pass through the loss function. If self.regularization is not None, also adds the forward pass of the regularization term to the loss. The hinge loss for a single... | the_stack_v2_python_sparse | Gradient_Descent/your_code/loss.py | YaelBenShalom/Machine-Learning | train | 0 |
f93842d0e70ea88979cfb1afd5e3f167625c3ee5 | [
"if 'write' not in self._ctrl.data['access']:\n return\npath = self.entity_description.data_switch_path\nparam = '.id'\nvalue = None\nfor uid in self._ctrl.data['filter']:\n if self._ctrl.data['filter'][uid]['uniq-id'] == f\"{self._data['chain']},{self._data['action']},{self._data['protocol']},{self._data['la... | <|body_start_0|>
if 'write' not in self._ctrl.data['access']:
return
path = self.entity_description.data_switch_path
param = '.id'
value = None
for uid in self._ctrl.data['filter']:
if self._ctrl.data['filter'][uid]['uniq-id'] == f"{self._data['chain']},{s... | Representation of a Filter switch. | MikrotikFilterSwitch | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MikrotikFilterSwitch:
"""Representation of a Filter switch."""
async def async_turn_on(self) -> None:
"""Turn on the switch."""
<|body_0|>
async def async_turn_off(self) -> None:
"""Turn off the switch."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_75kplus_train_073826 | 15,221 | permissive | [
{
"docstring": "Turn on the switch.",
"name": "async_turn_on",
"signature": "async def async_turn_on(self) -> None"
},
{
"docstring": "Turn off the switch.",
"name": "async_turn_off",
"signature": "async def async_turn_off(self) -> None"
}
] | 2 | stack_v2_sparse_classes_30k_train_044869 | Implement the Python class `MikrotikFilterSwitch` described below.
Class description:
Representation of a Filter switch.
Method signatures and docstrings:
- async def async_turn_on(self) -> None: Turn on the switch.
- async def async_turn_off(self) -> None: Turn off the switch. | Implement the Python class `MikrotikFilterSwitch` described below.
Class description:
Representation of a Filter switch.
Method signatures and docstrings:
- async def async_turn_on(self) -> None: Turn on the switch.
- async def async_turn_off(self) -> None: Turn off the switch.
<|skeleton|>
class MikrotikFilterSwitc... | 4d957aec223b8dd44de1ddc90ea113aef8d1a40b | <|skeleton|>
class MikrotikFilterSwitch:
"""Representation of a Filter switch."""
async def async_turn_on(self) -> None:
"""Turn on the switch."""
<|body_0|>
async def async_turn_off(self) -> None:
"""Turn off the switch."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MikrotikFilterSwitch:
"""Representation of a Filter switch."""
async def async_turn_on(self) -> None:
"""Turn on the switch."""
if 'write' not in self._ctrl.data['access']:
return
path = self.entity_description.data_switch_path
param = '.id'
value = Non... | the_stack_v2_python_sparse | custom_components/mikrotik_router/switch.py | tomaae/homeassistant-mikrotik_router | train | 216 |
e5d243450d8a5e5909a27bb460a6ee3f6564b93b | [
"super().__init__()\nRs_out = normalizeRs(Rs_out)\nRs_in = normalizeRs(Rs_in)\nself.scalar_act = scalar_activation\nself.gate_act = gate_activation\nRs = []\nRs_gates = []\nfor mul, l, p in Rs_out:\n if p != 0:\n raise ValueError('use GatedBlockParity instead')\n Rs.append((mul, l))\n if l != 0:\n ... | <|body_start_0|>
super().__init__()
Rs_out = normalizeRs(Rs_out)
Rs_in = normalizeRs(Rs_in)
self.scalar_act = scalar_activation
self.gate_act = gate_activation
Rs = []
Rs_gates = []
for mul, l, p in Rs_out:
if p != 0:
raise Valu... | GatedBlock | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GatedBlock:
def __init__(self, Rs_in, Rs_out, scalar_activation, gate_activation, Operation):
""":param Rs_in: list of triplet (multiplicity, representation order, parity) :param Rs_out: list of triplet (multiplicity, representation order, parity) :param scalar_activation: nonlinear func... | stack_v2_sparse_classes_75kplus_train_073827 | 2,960 | permissive | [
{
"docstring": ":param Rs_in: list of triplet (multiplicity, representation order, parity) :param Rs_out: list of triplet (multiplicity, representation order, parity) :param scalar_activation: nonlinear function applied on l=0 channels :param gate_activation: nonlinear function applied on the gates :param Opera... | 2 | null | Implement the Python class `GatedBlock` described below.
Class description:
Implement the GatedBlock class.
Method signatures and docstrings:
- def __init__(self, Rs_in, Rs_out, scalar_activation, gate_activation, Operation): :param Rs_in: list of triplet (multiplicity, representation order, parity) :param Rs_out: li... | Implement the Python class `GatedBlock` described below.
Class description:
Implement the GatedBlock class.
Method signatures and docstrings:
- def __init__(self, Rs_in, Rs_out, scalar_activation, gate_activation, Operation): :param Rs_in: list of triplet (multiplicity, representation order, parity) :param Rs_out: li... | afd027c72e87f2c390e0a2e7c6cfc8deea34b0cf | <|skeleton|>
class GatedBlock:
def __init__(self, Rs_in, Rs_out, scalar_activation, gate_activation, Operation):
""":param Rs_in: list of triplet (multiplicity, representation order, parity) :param Rs_out: list of triplet (multiplicity, representation order, parity) :param scalar_activation: nonlinear func... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GatedBlock:
def __init__(self, Rs_in, Rs_out, scalar_activation, gate_activation, Operation):
""":param Rs_in: list of triplet (multiplicity, representation order, parity) :param Rs_out: list of triplet (multiplicity, representation order, parity) :param scalar_activation: nonlinear function applied o... | the_stack_v2_python_sparse | se3cnn/non_linearities/gated_block.py | mariogeiger/se3cnn | train | 198 | |
edcc61e45f7fc0cdd277139836e0289542f451c4 | [
"comments = list(_get_comments(dependency_results))\nsimple_keywords_regex = re.compile('(' + '|'.join((re.escape(key) for key in keywords)) + ')', re.IGNORECASE)\nmessage = \"The line contains the keyword '{}'.\"\nyield from self.check_keywords(filename, file, comments, simple_keywords_regex, message)\nif regex_ke... | <|body_start_0|>
comments = list(_get_comments(dependency_results))
simple_keywords_regex = re.compile('(' + '|'.join((re.escape(key) for key in keywords)) + ')', re.IGNORECASE)
message = "The line contains the keyword '{}'."
yield from self.check_keywords(filename, file, comments, simpl... | KeywordBear | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KeywordBear:
def run(self, filename, file, keywords: list=['todo', 'fixme'], regex_keyword: str='', dependency_results: dict=None):
"""Checks the code files for given keywords. :param keywords: A list of keywords to search for (case insensitive). Default are TODO and FIXME. :param regex_... | stack_v2_sparse_classes_75kplus_train_073828 | 5,129 | no_license | [
{
"docstring": "Checks the code files for given keywords. :param keywords: A list of keywords to search for (case insensitive). Default are TODO and FIXME. :param regex_keyword: A regular expression to search for matching keywords in a file.",
"name": "run",
"signature": "def run(self, filename, file, k... | 2 | stack_v2_sparse_classes_30k_test_002443 | Implement the Python class `KeywordBear` described below.
Class description:
Implement the KeywordBear class.
Method signatures and docstrings:
- def run(self, filename, file, keywords: list=['todo', 'fixme'], regex_keyword: str='', dependency_results: dict=None): Checks the code files for given keywords. :param keyw... | Implement the Python class `KeywordBear` described below.
Class description:
Implement the KeywordBear class.
Method signatures and docstrings:
- def run(self, filename, file, keywords: list=['todo', 'fixme'], regex_keyword: str='', dependency_results: dict=None): Checks the code files for given keywords. :param keyw... | 278e4f6f8ce4677e213150716704330d83debf9f | <|skeleton|>
class KeywordBear:
def run(self, filename, file, keywords: list=['todo', 'fixme'], regex_keyword: str='', dependency_results: dict=None):
"""Checks the code files for given keywords. :param keywords: A list of keywords to search for (case insensitive). Default are TODO and FIXME. :param regex_... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class KeywordBear:
def run(self, filename, file, keywords: list=['todo', 'fixme'], regex_keyword: str='', dependency_results: dict=None):
"""Checks the code files for given keywords. :param keywords: A list of keywords to search for (case insensitive). Default are TODO and FIXME. :param regex_keyword: A reg... | the_stack_v2_python_sparse | ve/Lib/site-packages/bears/general/KeywordBear.py | lugnitdgp/avskr2.0 | train | 4 | |
cfc2797934f5bd9e243dcdafc90e39d3e7f7cc99 | [
"self.config_path = config_path\nself.clocks_path = clocks_path\nself.power_path = power_path\nconfig = configparser.ConfigParser()\ntry:\n config.read(self.config_path)\n f = open(self.clocks_path, 'r')\n self.df_power = pd.read_csv(self.power_path)\nexcept Exception:\n raise\nfor line in f:\n if 'C... | <|body_start_0|>
self.config_path = config_path
self.clocks_path = clocks_path
self.power_path = power_path
config = configparser.ConfigParser()
try:
config.read(self.config_path)
f = open(self.clocks_path, 'r')
self.df_power = pd.read_csv(self... | The Power Calculator Class. | PowerCalculator | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PowerCalculator:
"""The Power Calculator Class."""
def __init__(self, config_path, clocks_path, power_path):
"""Intitialize the PowerCalculator by providing the necessary files."""
<|body_0|>
def get_static_power(self):
"""Get the static power of all routers."""
... | stack_v2_sparse_classes_75kplus_train_073829 | 4,529 | permissive | [
{
"docstring": "Intitialize the PowerCalculator by providing the necessary files.",
"name": "__init__",
"signature": "def __init__(self, config_path, clocks_path, power_path)"
},
{
"docstring": "Get the static power of all routers.",
"name": "get_static_power",
"signature": "def get_stat... | 4 | stack_v2_sparse_classes_30k_train_022699 | Implement the Python class `PowerCalculator` described below.
Class description:
The Power Calculator Class.
Method signatures and docstrings:
- def __init__(self, config_path, clocks_path, power_path): Intitialize the PowerCalculator by providing the necessary files.
- def get_static_power(self): Get the static powe... | Implement the Python class `PowerCalculator` described below.
Class description:
The Power Calculator Class.
Method signatures and docstrings:
- def __init__(self, config_path, clocks_path, power_path): Intitialize the PowerCalculator by providing the necessary files.
- def get_static_power(self): Get the static powe... | d8c117a0c77fd86464ebe1c1717e23c87439f396 | <|skeleton|>
class PowerCalculator:
"""The Power Calculator Class."""
def __init__(self, config_path, clocks_path, power_path):
"""Intitialize the PowerCalculator by providing the necessary files."""
<|body_0|>
def get_static_power(self):
"""Get the static power of all routers."""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PowerCalculator:
"""The Power Calculator Class."""
def __init__(self, config_path, clocks_path, power_path):
"""Intitialize the PowerCalculator by providing the necessary files."""
self.config_path = config_path
self.clocks_path = clocks_path
self.power_path = power_path
... | the_stack_v2_python_sparse | bin/power/router_power.py | MTz12/ratatoskr | train | 0 |
b5343630cc6fab3f7710a3209f3f9736ea9892e0 | [
"super(CSVWriter, self).__init__(filename)\nself.data_file = None\nself.writer = None\nif filename:\n self.data_file = open(filename, 'w', encoding='utf-8', newline='')\n self.writer = csv.writer(self.data_file, dialect='excel')",
"if not self.writer:\n return False\nself.writer.writerow(line)\nreturn Tr... | <|body_start_0|>
super(CSVWriter, self).__init__(filename)
self.data_file = None
self.writer = None
if filename:
self.data_file = open(filename, 'w', encoding='utf-8', newline='')
self.writer = csv.writer(self.data_file, dialect='excel')
<|end_body_0|>
<|body_sta... | CSV file's writer. | CSVWriter | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CSVWriter:
"""CSV file's writer."""
def __init__(self, filename=None):
"""Args: filename: (String) data file's name. Returns: None"""
<|body_0|>
def writeln(self, line):
"""Write data line. Args: line: (List) Line data. Returns: boolean: Write success."""
... | stack_v2_sparse_classes_75kplus_train_073830 | 6,679 | permissive | [
{
"docstring": "Args: filename: (String) data file's name. Returns: None",
"name": "__init__",
"signature": "def __init__(self, filename=None)"
},
{
"docstring": "Write data line. Args: line: (List) Line data. Returns: boolean: Write success.",
"name": "writeln",
"signature": "def writel... | 3 | stack_v2_sparse_classes_30k_train_041124 | Implement the Python class `CSVWriter` described below.
Class description:
CSV file's writer.
Method signatures and docstrings:
- def __init__(self, filename=None): Args: filename: (String) data file's name. Returns: None
- def writeln(self, line): Write data line. Args: line: (List) Line data. Returns: boolean: Writ... | Implement the Python class `CSVWriter` described below.
Class description:
CSV file's writer.
Method signatures and docstrings:
- def __init__(self, filename=None): Args: filename: (String) data file's name. Returns: None
- def writeln(self, line): Write data line. Args: line: (List) Line data. Returns: boolean: Writ... | 5fa06b29bf800646dc4da5851fdf7a1f299f15a7 | <|skeleton|>
class CSVWriter:
"""CSV file's writer."""
def __init__(self, filename=None):
"""Args: filename: (String) data file's name. Returns: None"""
<|body_0|>
def writeln(self, line):
"""Write data line. Args: line: (List) Line data. Returns: boolean: Write success."""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CSVWriter:
"""CSV file's writer."""
def __init__(self, filename=None):
"""Args: filename: (String) data file's name. Returns: None"""
super(CSVWriter, self).__init__(filename)
self.data_file = None
self.writer = None
if filename:
self.data_file = open(f... | the_stack_v2_python_sparse | muddery/common/utils/writers.py | muddery/muddery | train | 139 |
a84e35c21fa897b03e69e27b9b9452dacc46a491 | [
"cls.maxDiff = None\ncls.has_settings = False\ncls.job_types = {'conformers': True, 'opt': True, 'fine_grid': False, 'freq': True, 'sp': True, 'rotors': False, 'irc': False}\ncls.species_list_1 = [ARCSpecies(label='2-propanol', smiles='CC(O)C'), ARCSpecies(label='1-propanol', smiles='CCCO'), ARCSpecies(label='NN', ... | <|body_start_0|>
cls.maxDiff = None
cls.has_settings = False
cls.job_types = {'conformers': True, 'opt': True, 'fine_grid': False, 'freq': True, 'sp': True, 'rotors': False, 'irc': False}
cls.species_list_1 = [ARCSpecies(label='2-propanol', smiles='CC(O)C'), ARCSpecies(label='1-propanol'... | Contains functional tests for ARC. | TestFunctional | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestFunctional:
"""Contains functional tests for ARC."""
def setUpClass(cls):
"""A method that is run before all unit tests in this class."""
<|body_0|>
def testThermo(self):
"""Test thermo"""
<|body_1|>
def testKinetic(self):
"""Test kinetic... | stack_v2_sparse_classes_75kplus_train_073831 | 5,244 | permissive | [
{
"docstring": "A method that is run before all unit tests in this class.",
"name": "setUpClass",
"signature": "def setUpClass(cls)"
},
{
"docstring": "Test thermo",
"name": "testThermo",
"signature": "def testThermo(self)"
},
{
"docstring": "Test kinetics",
"name": "testKine... | 4 | stack_v2_sparse_classes_30k_train_049391 | Implement the Python class `TestFunctional` described below.
Class description:
Contains functional tests for ARC.
Method signatures and docstrings:
- def setUpClass(cls): A method that is run before all unit tests in this class.
- def testThermo(self): Test thermo
- def testKinetic(self): Test kinetics
- def tearDow... | Implement the Python class `TestFunctional` described below.
Class description:
Contains functional tests for ARC.
Method signatures and docstrings:
- def setUpClass(cls): A method that is run before all unit tests in this class.
- def testThermo(self): Test thermo
- def testKinetic(self): Test kinetics
- def tearDow... | 617b2c5430e409271e241eda0de3dd673ec41835 | <|skeleton|>
class TestFunctional:
"""Contains functional tests for ARC."""
def setUpClass(cls):
"""A method that is run before all unit tests in this class."""
<|body_0|>
def testThermo(self):
"""Test thermo"""
<|body_1|>
def testKinetic(self):
"""Test kinetic... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestFunctional:
"""Contains functional tests for ARC."""
def setUpClass(cls):
"""A method that is run before all unit tests in this class."""
cls.maxDiff = None
cls.has_settings = False
cls.job_types = {'conformers': True, 'opt': True, 'fine_grid': False, 'freq': True, 'sp... | the_stack_v2_python_sparse | functional/functional_test.py | ReactionMechanismGenerator/ARC | train | 40 |
a17a9865b8223d0311da36e39f8dfc76193d3b8a | [
"self.team = team\nself.designation = designation\nself.role = role\nself.additional_properties = additional_properties\nsuper(Developer, self).__init__(address, cell_number, company_name, first_name, id, last_name, company)",
"if dictionary is None:\n return None\naddress = dictionary.get('address')\ncell_num... | <|body_start_0|>
self.team = team
self.designation = designation
self.role = role
self.additional_properties = additional_properties
super(Developer, self).__init__(address, cell_number, company_name, first_name, id, last_name, company)
<|end_body_0|>
<|body_start_1|>
if... | Implementation of the 'developer' model. TODO: type model description here. NOTE: This class inherits from 'EmployeeComp'. Attributes: team (string): TODO: type description here. designation (string): TODO: type description here. role (string): TODO: type description here. | Developer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Developer:
"""Implementation of the 'developer' model. TODO: type model description here. NOTE: This class inherits from 'EmployeeComp'. Attributes: team (string): TODO: type description here. designation (string): TODO: type description here. role (string): TODO: type description here."""
d... | stack_v2_sparse_classes_75kplus_train_073832 | 16,075 | permissive | [
{
"docstring": "Constructor for the Developer class",
"name": "__init__",
"signature": "def __init__(self, address=None, cell_number=None, company_name=None, designation=None, first_name=None, id=None, last_name=None, role=None, team=None, company=None, additional_properties={})"
},
{
"docstring... | 2 | null | Implement the Python class `Developer` described below.
Class description:
Implementation of the 'developer' model. TODO: type model description here. NOTE: This class inherits from 'EmployeeComp'. Attributes: team (string): TODO: type description here. designation (string): TODO: type description here. role (string):... | Implement the Python class `Developer` described below.
Class description:
Implementation of the 'developer' model. TODO: type model description here. NOTE: This class inherits from 'EmployeeComp'. Attributes: team (string): TODO: type description here. designation (string): TODO: type description here. role (string):... | 49acc3d416a1dde7ea43b178d070484baf1b7f2b | <|skeleton|>
class Developer:
"""Implementation of the 'developer' model. TODO: type model description here. NOTE: This class inherits from 'EmployeeComp'. Attributes: team (string): TODO: type description here. designation (string): TODO: type description here. role (string): TODO: type description here."""
d... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Developer:
"""Implementation of the 'developer' model. TODO: type model description here. NOTE: This class inherits from 'EmployeeComp'. Attributes: team (string): TODO: type description here. designation (string): TODO: type description here. role (string): TODO: type description here."""
def __init__(s... | the_stack_v2_python_sparse | PYTHON_GENERIC_LIB/tester/models/company.py | MaryamAdnan3/Tester1 | train | 0 |
6183b9333f4af98cb3e8d493b9944775192c7e04 | [
"uwide = idleConf.GetOption('main', 'EditorWindow', 'width', type='int')\nuhigh = idleConf.GetOption('main', 'EditorWindow', 'height', type='int')\nuhigh = 3 * uhigh // 4\nText.__init__(self, parent, wrap='word', highlightthickness=0, padx=5, borderwidth=0, width=uwide, height=uhigh)\nnormalfont = self.findfont(['T... | <|body_start_0|>
uwide = idleConf.GetOption('main', 'EditorWindow', 'width', type='int')
uhigh = idleConf.GetOption('main', 'EditorWindow', 'height', type='int')
uhigh = 3 * uhigh // 4
Text.__init__(self, parent, wrap='word', highlightthickness=0, padx=5, borderwidth=0, width=uwide, heig... | Display help.html. | HelpText | [
"Python-2.0",
"GPL-1.0-or-later",
"LicenseRef-scancode-python-cwi",
"LicenseRef-scancode-free-unknown",
"LicenseRef-scancode-other-copyleft",
"ISC"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HelpText:
"""Display help.html."""
def __init__(self, parent, filename):
"""Configure tags and feed file to parser."""
<|body_0|>
def findfont(self, names):
"""Return name of first font family derived from names."""
<|body_1|>
<|end_skeleton|>
<|body_st... | stack_v2_sparse_classes_75kplus_train_073833 | 11,325 | permissive | [
{
"docstring": "Configure tags and feed file to parser.",
"name": "__init__",
"signature": "def __init__(self, parent, filename)"
},
{
"docstring": "Return name of first font family derived from names.",
"name": "findfont",
"signature": "def findfont(self, names)"
}
] | 2 | null | Implement the Python class `HelpText` described below.
Class description:
Display help.html.
Method signatures and docstrings:
- def __init__(self, parent, filename): Configure tags and feed file to parser.
- def findfont(self, names): Return name of first font family derived from names. | Implement the Python class `HelpText` described below.
Class description:
Display help.html.
Method signatures and docstrings:
- def __init__(self, parent, filename): Configure tags and feed file to parser.
- def findfont(self, names): Return name of first font family derived from names.
<|skeleton|>
class HelpText:... | 0d748ad58e1063dd1f8560f18a0c75293b9415b7 | <|skeleton|>
class HelpText:
"""Display help.html."""
def __init__(self, parent, filename):
"""Configure tags and feed file to parser."""
<|body_0|>
def findfont(self, names):
"""Return name of first font family derived from names."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class HelpText:
"""Display help.html."""
def __init__(self, parent, filename):
"""Configure tags and feed file to parser."""
uwide = idleConf.GetOption('main', 'EditorWindow', 'width', type='int')
uhigh = idleConf.GetOption('main', 'EditorWindow', 'height', type='int')
uhigh = 3... | the_stack_v2_python_sparse | third_party/python/Lib/idlelib/help.py | jart/cosmopolitan | train | 11,887 |
27f9bb13be841e4fddec23f80041502e56b96e7b | [
"self.required_options(request, 'domainURI')\n\ndef _finished(thread, result, request):\n if self._check_thread_error(thread, result, request):\n return\n node_uri, domain_uuid = urlparse.urldefrag(request.options['domainURI'])\n success, data = result\n if success:\n snapshot_list = []\n ... | <|body_start_0|>
self.required_options(request, 'domainURI')
def _finished(thread, result, request):
if self._check_thread_error(thread, result, request):
return
node_uri, domain_uuid = urlparse.urldefrag(request.options['domainURI'])
success, data = ... | Snapshots | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Snapshots:
def snapshot_query(self, request):
"""Returns a list of snapshots of a domain options: { 'domainURI': <domain URI> } return: [ { 'id' : <snapshot name>, 'label' : <snapshot name>, 'time' : <creation time> }, ... ]"""
<|body_0|>
def snapshot_create(self, request):
... | stack_v2_sparse_classes_75kplus_train_073834 | 4,659 | no_license | [
{
"docstring": "Returns a list of snapshots of a domain options: { 'domainURI': <domain URI> } return: [ { 'id' : <snapshot name>, 'label' : <snapshot name>, 'time' : <creation time> }, ... ]",
"name": "snapshot_query",
"signature": "def snapshot_query(self, request)"
},
{
"docstring": "Create a... | 4 | stack_v2_sparse_classes_30k_train_042604 | Implement the Python class `Snapshots` described below.
Class description:
Implement the Snapshots class.
Method signatures and docstrings:
- def snapshot_query(self, request): Returns a list of snapshots of a domain options: { 'domainURI': <domain URI> } return: [ { 'id' : <snapshot name>, 'label' : <snapshot name>,... | Implement the Python class `Snapshots` described below.
Class description:
Implement the Snapshots class.
Method signatures and docstrings:
- def snapshot_query(self, request): Returns a list of snapshots of a domain options: { 'domainURI': <domain URI> } return: [ { 'id' : <snapshot name>, 'label' : <snapshot name>,... | 1a6765deafd8679079b64dcc35f91933d37cf2dd | <|skeleton|>
class Snapshots:
def snapshot_query(self, request):
"""Returns a list of snapshots of a domain options: { 'domainURI': <domain URI> } return: [ { 'id' : <snapshot name>, 'label' : <snapshot name>, 'time' : <creation time> }, ... ]"""
<|body_0|>
def snapshot_create(self, request):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Snapshots:
def snapshot_query(self, request):
"""Returns a list of snapshots of a domain options: { 'domainURI': <domain URI> } return: [ { 'id' : <snapshot name>, 'label' : <snapshot name>, 'time' : <creation time> }, ... ]"""
self.required_options(request, 'domainURI')
def _finished... | the_stack_v2_python_sparse | ucs/virtualization/univention-virtual-machine-manager-daemon/umc/python/uvmm/snapshots.py | m-narayan/smart | train | 8 | |
b9deb868162ce6a95fbb6c987fd59c1f03e5e774 | [
"super().__init__(name=name)\nself.conv_0 = ConvWithBatchNorm(filters=filters, kernel_size=1, activation=activation, padding='valid', kernel_initializer=kernel_initializer, kernel_regularizer=kernel_regularizer, strides=1, name=name + '_cb_0', **kwargs)\nself.conv_1 = ConvWithBatchNorm(filters=filters, kernel_size=... | <|body_start_0|>
super().__init__(name=name)
self.conv_0 = ConvWithBatchNorm(filters=filters, kernel_size=1, activation=activation, padding='valid', kernel_initializer=kernel_initializer, kernel_regularizer=kernel_regularizer, strides=1, name=name + '_cb_0', **kwargs)
self.conv_1 = ConvWithBatch... | Residual block with bottleneck, recommended for deep ResNets (depth > 34) | BottleneckBlock | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BottleneckBlock:
"""Residual block with bottleneck, recommended for deep ResNets (depth > 34)"""
def __init__(self, filters=16, kernel_size=1, strides=1, activation='relu', kernel_initializer='he_normal', kernel_regularizer=tf.keras.regularizers.l2(0.0001), name='res_basic', **kwargs):
... | stack_v2_sparse_classes_75kplus_train_073835 | 11,492 | no_license | [
{
"docstring": "Initialize the block. :param filters: Number of filters :param kernel_size: Kernel size :param strides: Convolution strides :param activation: Activation function (name or callable) :param kernel_initializer: Kernel initialisation method name :param kernel_regularizer: Kernel regularizer :param ... | 2 | null | Implement the Python class `BottleneckBlock` described below.
Class description:
Residual block with bottleneck, recommended for deep ResNets (depth > 34)
Method signatures and docstrings:
- def __init__(self, filters=16, kernel_size=1, strides=1, activation='relu', kernel_initializer='he_normal', kernel_regularizer=... | Implement the Python class `BottleneckBlock` described below.
Class description:
Residual block with bottleneck, recommended for deep ResNets (depth > 34)
Method signatures and docstrings:
- def __init__(self, filters=16, kernel_size=1, strides=1, activation='relu', kernel_initializer='he_normal', kernel_regularizer=... | 1bdb7906c0a7489ddd5e639730080502e6277b61 | <|skeleton|>
class BottleneckBlock:
"""Residual block with bottleneck, recommended for deep ResNets (depth > 34)"""
def __init__(self, filters=16, kernel_size=1, strides=1, activation='relu', kernel_initializer='he_normal', kernel_regularizer=tf.keras.regularizers.l2(0.0001), name='res_basic', **kwargs):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BottleneckBlock:
"""Residual block with bottleneck, recommended for deep ResNets (depth > 34)"""
def __init__(self, filters=16, kernel_size=1, strides=1, activation='relu', kernel_initializer='he_normal', kernel_regularizer=tf.keras.regularizers.l2(0.0001), name='res_basic', **kwargs):
"""Initial... | the_stack_v2_python_sparse | _misc/vision_models/trainer_resnet_v2.py | ilyarudyak/dl_projects_2020 | train | 1 |
be76ad3d413e402df7e6ac137d0d26a444ef98f9 | [
"super().__init__(max_number=max_number, min_number=min_number, seed=seed)\nself.stamp_size = stamp_size\nself.mag_name = mag_name\nif min_number < 1:\n raise ValueError('At least 1 bright galaxy will be added, so need min_number >=1.')",
"if self.mag_name not in table.colnames:\n raise ValueError(f\"Catalo... | <|body_start_0|>
super().__init__(max_number=max_number, min_number=min_number, seed=seed)
self.stamp_size = stamp_size
self.mag_name = mag_name
if min_number < 1:
raise ValueError('At least 1 bright galaxy will be added, so need min_number >=1.')
<|end_body_0|>
<|body_start... | Example of basic sampling function features. Includes magnitude cut, restriction on the shape, shift randomization. | BasicSampling | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BasicSampling:
"""Example of basic sampling function features. Includes magnitude cut, restriction on the shape, shift randomization."""
def __init__(self, max_number: int=4, min_number: int=1, stamp_size: float=24.0, mag_name: str='i_ab', seed: int=DEFAULT_SEED):
"""Initializes the ... | stack_v2_sparse_classes_75kplus_train_073836 | 12,943 | permissive | [
{
"docstring": "Initializes the basic sampling function. Args: max_number: Defined in parent class. min_number: Defined in parent class. stamp_size: Size of the desired stamp. seed: Seed to initialize randomness for reproducibility. mag_name: Name of the magnitude column in the catalog for cuts.",
"name": "... | 2 | stack_v2_sparse_classes_30k_train_027176 | Implement the Python class `BasicSampling` described below.
Class description:
Example of basic sampling function features. Includes magnitude cut, restriction on the shape, shift randomization.
Method signatures and docstrings:
- def __init__(self, max_number: int=4, min_number: int=1, stamp_size: float=24.0, mag_na... | Implement the Python class `BasicSampling` described below.
Class description:
Example of basic sampling function features. Includes magnitude cut, restriction on the shape, shift randomization.
Method signatures and docstrings:
- def __init__(self, max_number: int=4, min_number: int=1, stamp_size: float=24.0, mag_na... | f5b716a373f130238100db8980aa0d282822983a | <|skeleton|>
class BasicSampling:
"""Example of basic sampling function features. Includes magnitude cut, restriction on the shape, shift randomization."""
def __init__(self, max_number: int=4, min_number: int=1, stamp_size: float=24.0, mag_name: str='i_ab', seed: int=DEFAULT_SEED):
"""Initializes the ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BasicSampling:
"""Example of basic sampling function features. Includes magnitude cut, restriction on the shape, shift randomization."""
def __init__(self, max_number: int=4, min_number: int=1, stamp_size: float=24.0, mag_name: str='i_ab', seed: int=DEFAULT_SEED):
"""Initializes the basic samplin... | the_stack_v2_python_sparse | btk/sampling_functions.py | LSSTDESC/BlendingToolKit | train | 22 |
2f0b58d6a3e8cb91fd2ff61cf4559c32d828a564 | [
"self.xi_buf = xi_buf\nself.v0_buf = v0_buf\nsuper().__init__(discretized_bath, tridiag, 'bath', max_nof_coefficients)",
"self.discretized_bath.compute_until(ncap)\ngamma = self.discretized_bath.gamma_buf[:ncap]\nxi = self.discretized_bath.xi_buf[:ncap]\nif self.sorting.sort is not None:\n sorted_indices = sel... | <|body_start_0|>
self.xi_buf = xi_buf
self.v0_buf = v0_buf
super().__init__(discretized_bath, tridiag, 'bath', max_nof_coefficients)
<|end_body_0|>
<|body_start_1|>
self.discretized_bath.compute_until(ncap)
gamma = self.discretized_bath.gamma_buf[:ncap]
xi = self.discret... | SparseDiagMapping | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SparseDiagMapping:
def __init__(self, xi_buf, v0_buf, discretized_bath, tridiag, max_nof_coefficients=100):
"""Mapping for diagonal star bath coefficient matrices, which include only the bath :param xi_buf: Numpy array of the diagonal elements (the bathe energies) :param v0_buf: Numpy ar... | stack_v2_sparse_classes_75kplus_train_073837 | 2,757 | permissive | [
{
"docstring": "Mapping for diagonal star bath coefficient matrices, which include only the bath :param xi_buf: Numpy array of the diagonal elements (the bathe energies) :param v0_buf: Numpy array of the normalized couplings (the system-bath couplings), which is used as initial vector for the Lanczos tridiagona... | 3 | null | Implement the Python class `SparseDiagMapping` described below.
Class description:
Implement the SparseDiagMapping class.
Method signatures and docstrings:
- def __init__(self, xi_buf, v0_buf, discretized_bath, tridiag, max_nof_coefficients=100): Mapping for diagonal star bath coefficient matrices, which include only... | Implement the Python class `SparseDiagMapping` described below.
Class description:
Implement the SparseDiagMapping class.
Method signatures and docstrings:
- def __init__(self, xi_buf, v0_buf, discretized_bath, tridiag, max_nof_coefficients=100): Mapping for diagonal star bath coefficient matrices, which include only... | daf37f522f8acb6af2285d44f39cab31f34b01a4 | <|skeleton|>
class SparseDiagMapping:
def __init__(self, xi_buf, v0_buf, discretized_bath, tridiag, max_nof_coefficients=100):
"""Mapping for diagonal star bath coefficient matrices, which include only the bath :param xi_buf: Numpy array of the diagonal elements (the bathe energies) :param v0_buf: Numpy ar... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SparseDiagMapping:
def __init__(self, xi_buf, v0_buf, discretized_bath, tridiag, max_nof_coefficients=100):
"""Mapping for diagonal star bath coefficient matrices, which include only the bath :param xi_buf: Numpy array of the diagonal elements (the bathe energies) :param v0_buf: Numpy array of the nor... | the_stack_v2_python_sparse | mapping/chain/mapping/base/sparse_bath.py | fhoeb/py-mapping | train | 2 | |
db7070f2a70211498e489aacee8a6c19282bb999 | [
"self.commandName = commandName\nself.messageType = messageType\nrospy.Service(self.commandName, self.messageType, self.commandCaller)",
"rospy.logdebug('Sending parameters \"' + str(req.parameters) + '\" to command \"' + str(self.commandName) + '\" with timeout ' + str(req.timeout))\ncommandResponse = BB.SendAnd... | <|body_start_0|>
self.commandName = commandName
self.messageType = messageType
rospy.Service(self.commandName, self.messageType, self.commandCaller)
<|end_body_0|>
<|body_start_1|>
rospy.logdebug('Sending parameters "' + str(req.parameters) + '" to command "' + str(self.commandName) + '... | Class to bridge the BB Commands to allow ROS Calls | ROS2BB_CommandsCalls | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ROS2BB_CommandsCalls:
"""Class to bridge the BB Commands to allow ROS Calls"""
def __init__(self, commandName, messageType):
"""Constructor Creates a new ROS2BB_CommandsCalls Object. Receives: commandName: Name of the command to bridge."""
<|body_0|>
def commandCaller(se... | stack_v2_sparse_classes_75kplus_train_073838 | 1,380 | no_license | [
{
"docstring": "Constructor Creates a new ROS2BB_CommandsCalls Object. Receives: commandName: Name of the command to bridge.",
"name": "__init__",
"signature": "def __init__(self, commandName, messageType)"
},
{
"docstring": "Handle the ros service corresponding to the BB command to call",
"... | 2 | stack_v2_sparse_classes_30k_train_018098 | Implement the Python class `ROS2BB_CommandsCalls` described below.
Class description:
Class to bridge the BB Commands to allow ROS Calls
Method signatures and docstrings:
- def __init__(self, commandName, messageType): Constructor Creates a new ROS2BB_CommandsCalls Object. Receives: commandName: Name of the command t... | Implement the Python class `ROS2BB_CommandsCalls` described below.
Class description:
Class to bridge the BB Commands to allow ROS Calls
Method signatures and docstrings:
- def __init__(self, commandName, messageType): Constructor Creates a new ROS2BB_CommandsCalls Object. Receives: commandName: Name of the command t... | c2b4de807d5f3a18b317b9b01fdeb0cec3f7327e | <|skeleton|>
class ROS2BB_CommandsCalls:
"""Class to bridge the BB Commands to allow ROS Calls"""
def __init__(self, commandName, messageType):
"""Constructor Creates a new ROS2BB_CommandsCalls Object. Receives: commandName: Name of the command to bridge."""
<|body_0|>
def commandCaller(se... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ROS2BB_CommandsCalls:
"""Class to bridge the BB Commands to allow ROS Calls"""
def __init__(self, commandName, messageType):
"""Constructor Creates a new ROS2BB_CommandsCalls Object. Receives: commandName: Name of the command to bridge."""
self.commandName = commandName
self.messa... | the_stack_v2_python_sparse | catkin_ws/src/interoperation/bbros_bridge/src/bbros_bridge/commands_bridge.py | RobotJustina/JUSTINA | train | 7 |
82bd3a1e4e603059afadb57610996a24b2dc5a1d | [
"content = '\\n\\n Welcome to the club! We are delighted you\\'ve decided to let Vinely make your wine experience easy, fun, and convenient.\\n You\\'re in good hands.\\n\\n Your first delicious surprise will arrive within 7 - 10 business days.\\n Remember, someone 21 years or older must... | <|body_start_0|>
content = '\n\n Welcome to the club! We are delighted you\'ve decided to let Vinely make your wine experience easy, fun, and convenient.\n You\'re in good hands.\n\n Your first delicious surprise will arrive within 7 - 10 business days.\n Remember, someone 21 years o... | Migration | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Migration:
def forwards(self, orm):
"""Write your forwards methods here."""
<|body_0|>
def backwards(self, orm):
"""Write your backwards methods here."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
content = '\n\n Welcome to the club! We are... | stack_v2_sparse_classes_75kplus_train_073839 | 3,432 | no_license | [
{
"docstring": "Write your forwards methods here.",
"name": "forwards",
"signature": "def forwards(self, orm)"
},
{
"docstring": "Write your backwards methods here.",
"name": "backwards",
"signature": "def backwards(self, orm)"
}
] | 2 | stack_v2_sparse_classes_30k_train_008163 | Implement the Python class `Migration` described below.
Class description:
Implement the Migration class.
Method signatures and docstrings:
- def forwards(self, orm): Write your forwards methods here.
- def backwards(self, orm): Write your backwards methods here. | Implement the Python class `Migration` described below.
Class description:
Implement the Migration class.
Method signatures and docstrings:
- def forwards(self, orm): Write your forwards methods here.
- def backwards(self, orm): Write your backwards methods here.
<|skeleton|>
class Migration:
def forwards(self,... | c5c7d8a0b1a297e07302870017d3fb03c5dbb009 | <|skeleton|>
class Migration:
def forwards(self, orm):
"""Write your forwards methods here."""
<|body_0|>
def backwards(self, orm):
"""Write your backwards methods here."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Migration:
def forwards(self, orm):
"""Write your forwards methods here."""
content = '\n\n Welcome to the club! We are delighted you\'ve decided to let Vinely make your wine experience easy, fun, and convenient.\n You\'re in good hands.\n\n Your first delicious surprise w... | the_stack_v2_python_sparse | cms/migrations/0027_join_the_club_anon_email.py | RSV3/nuvine | train | 0 | |
9890fb43a4312c9a70ff271d1e1437e7429dae39 | [
"self._shape = shape\nself._n = sum(shape)\nself._initial_data = [[None] * s for s in shape]\nif max_entry is None:\n max_entry = sum(shape)\nself.max_entry = max_entry\nending_row = len(shape) - 1\nending_col = shape[-1] - 1\nself._ending_position = (ending_row, ending_col)\nstarting_row = 0\nstarting_col = 0\n... | <|body_start_0|>
self._shape = shape
self._n = sum(shape)
self._initial_data = [[None] * s for s in shape]
if max_entry is None:
max_entry = sum(shape)
self.max_entry = max_entry
ending_row = len(shape) - 1
ending_col = shape[-1] - 1
self._endi... | A backtracker class for generating sets of composition tableaux. | CompositionTableauxBacktracker | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CompositionTableauxBacktracker:
"""A backtracker class for generating sets of composition tableaux."""
def __init__(self, shape, max_entry=None):
"""EXAMPLES:: sage: from sage.combinat.composition_tableau import CompositionTableauxBacktracker sage: n = CompositionTableauxBacktracker(... | stack_v2_sparse_classes_75kplus_train_073840 | 27,659 | no_license | [
{
"docstring": "EXAMPLES:: sage: from sage.combinat.composition_tableau import CompositionTableauxBacktracker sage: n = CompositionTableauxBacktracker([1,3,2]) sage: n._ending_position (2, 1) sage: n._initial_state (0, 0)",
"name": "__init__",
"signature": "def __init__(self, shape, max_entry=None)"
}... | 3 | null | Implement the Python class `CompositionTableauxBacktracker` described below.
Class description:
A backtracker class for generating sets of composition tableaux.
Method signatures and docstrings:
- def __init__(self, shape, max_entry=None): EXAMPLES:: sage: from sage.combinat.composition_tableau import CompositionTabl... | Implement the Python class `CompositionTableauxBacktracker` described below.
Class description:
A backtracker class for generating sets of composition tableaux.
Method signatures and docstrings:
- def __init__(self, shape, max_entry=None): EXAMPLES:: sage: from sage.combinat.composition_tableau import CompositionTabl... | 0d9eacbf74e2acffefde93e39f8bcbec745cdaba | <|skeleton|>
class CompositionTableauxBacktracker:
"""A backtracker class for generating sets of composition tableaux."""
def __init__(self, shape, max_entry=None):
"""EXAMPLES:: sage: from sage.combinat.composition_tableau import CompositionTableauxBacktracker sage: n = CompositionTableauxBacktracker(... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CompositionTableauxBacktracker:
"""A backtracker class for generating sets of composition tableaux."""
def __init__(self, shape, max_entry=None):
"""EXAMPLES:: sage: from sage.combinat.composition_tableau import CompositionTableauxBacktracker sage: n = CompositionTableauxBacktracker([1,3,2]) sage... | the_stack_v2_python_sparse | sage/src/sage/combinat/composition_tableau.py | bopopescu/geosci | train | 0 |
5ac18b8f0c16327bd1b82306f37abd8d74b5f6f2 | [
"self.X = X_init\nself.Y = Y_init\nself.l = l\nself.sigma_f = sigma_f\nsum1 = np.sum(X_init ** 2, 1)\nsquaredDistance = sum1.reshape(-1, 1) + sum1 - 2 * np.dot(X_init, X_init.T)\ncovarianceKernelMatrix = sigma_f ** 2 * np.exp(-0.5 / l ** 2 * squaredDistance)\nself.K = covarianceKernelMatrix",
"squaredDistance = n... | <|body_start_0|>
self.X = X_init
self.Y = Y_init
self.l = l
self.sigma_f = sigma_f
sum1 = np.sum(X_init ** 2, 1)
squaredDistance = sum1.reshape(-1, 1) + sum1 - 2 * np.dot(X_init, X_init.T)
covarianceKernelMatrix = sigma_f ** 2 * np.exp(-0.5 / l ** 2 * squaredDista... | Class that represents a noiseless 1D Gaussian process | GaussianProcess | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GaussianProcess:
"""Class that represents a noiseless 1D Gaussian process"""
def __init__(self, X_init, Y_init, l=1, sigma_f=1):
"""Init constructor"""
<|body_0|>
def kernel(self, X1, X2):
"""Method that calculates the covariance kernel matrix between two matrice... | stack_v2_sparse_classes_75kplus_train_073841 | 1,027 | no_license | [
{
"docstring": "Init constructor",
"name": "__init__",
"signature": "def __init__(self, X_init, Y_init, l=1, sigma_f=1)"
},
{
"docstring": "Method that calculates the covariance kernel matrix between two matrices",
"name": "kernel",
"signature": "def kernel(self, X1, X2)"
}
] | 2 | null | Implement the Python class `GaussianProcess` described below.
Class description:
Class that represents a noiseless 1D Gaussian process
Method signatures and docstrings:
- def __init__(self, X_init, Y_init, l=1, sigma_f=1): Init constructor
- def kernel(self, X1, X2): Method that calculates the covariance kernel matri... | Implement the Python class `GaussianProcess` described below.
Class description:
Class that represents a noiseless 1D Gaussian process
Method signatures and docstrings:
- def __init__(self, X_init, Y_init, l=1, sigma_f=1): Init constructor
- def kernel(self, X1, X2): Method that calculates the covariance kernel matri... | c7b6ea4c37b7c5dc41e63cdb8142b3cdfb3e1d23 | <|skeleton|>
class GaussianProcess:
"""Class that represents a noiseless 1D Gaussian process"""
def __init__(self, X_init, Y_init, l=1, sigma_f=1):
"""Init constructor"""
<|body_0|>
def kernel(self, X1, X2):
"""Method that calculates the covariance kernel matrix between two matrice... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GaussianProcess:
"""Class that represents a noiseless 1D Gaussian process"""
def __init__(self, X_init, Y_init, l=1, sigma_f=1):
"""Init constructor"""
self.X = X_init
self.Y = Y_init
self.l = l
self.sigma_f = sigma_f
sum1 = np.sum(X_init ** 2, 1)
s... | the_stack_v2_python_sparse | unsupervised_learning/0x03-hyperparameter_tuning/0-gp.py | linkjavier/holbertonschool-machine_learning | train | 0 |
1b0abc3c41a8b7b0786988f0119c3f3cc41113a0 | [
"super(DarknetBody, self).__init__(**args)\nself.darknet_conv_bn_leaky1 = DarknetConv2D_BN_Leaky(32, (3, 3))\nself.resblock_body1 = ResblockBody(64, 1)\nself.resblock_body2 = ResblockBody(128, 2)\nself.resblock_body3 = ResblockBody(256, 8)\nself.resblock_body4 = ResblockBody(512, 8)\nself.resblock_body5 = ResblockB... | <|body_start_0|>
super(DarknetBody, self).__init__(**args)
self.darknet_conv_bn_leaky1 = DarknetConv2D_BN_Leaky(32, (3, 3))
self.resblock_body1 = ResblockBody(64, 1)
self.resblock_body2 = ResblockBody(128, 2)
self.resblock_body3 = ResblockBody(256, 8)
self.resblock_body4 ... | DarknetBody | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DarknetBody:
def __init__(self, **args):
"""初始化网络"""
<|body_0|>
def call(self, x, training):
"""运算部分"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
super(DarknetBody, self).__init__(**args)
self.darknet_conv_bn_leaky1 = DarknetConv2D_BN_Lea... | stack_v2_sparse_classes_75kplus_train_073842 | 12,569 | no_license | [
{
"docstring": "初始化网络",
"name": "__init__",
"signature": "def __init__(self, **args)"
},
{
"docstring": "运算部分",
"name": "call",
"signature": "def call(self, x, training)"
}
] | 2 | stack_v2_sparse_classes_30k_train_053788 | Implement the Python class `DarknetBody` described below.
Class description:
Implement the DarknetBody class.
Method signatures and docstrings:
- def __init__(self, **args): 初始化网络
- def call(self, x, training): 运算部分 | Implement the Python class `DarknetBody` described below.
Class description:
Implement the DarknetBody class.
Method signatures and docstrings:
- def __init__(self, **args): 初始化网络
- def call(self, x, training): 运算部分
<|skeleton|>
class DarknetBody:
def __init__(self, **args):
"""初始化网络"""
<|body_0... | b7549701b0b1a7e4cc2c8275df2bc6c7a3253d24 | <|skeleton|>
class DarknetBody:
def __init__(self, **args):
"""初始化网络"""
<|body_0|>
def call(self, x, training):
"""运算部分"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DarknetBody:
def __init__(self, **args):
"""初始化网络"""
super(DarknetBody, self).__init__(**args)
self.darknet_conv_bn_leaky1 = DarknetConv2D_BN_Leaky(32, (3, 3))
self.resblock_body1 = ResblockBody(64, 1)
self.resblock_body2 = ResblockBody(128, 2)
self.resblock_bod... | the_stack_v2_python_sparse | AIServer/ai_api/ai_models/yolo_v3/model.py | tfwcn/tensorflow2-machine-vision | train | 1 | |
07015697a309763c9dd62e212fb8a48856c6a5bf | [
"if len(arr.shape) == 1:\n arr = np.expand_dims(arr, axis=0)\nif arr.shape[-1] != 599 and arr.shape[-1] != 603:\n raise RuntimeError('This is not an array valid with all classes defined!')\nelif arr.shape[-1] == 599:\n return arr[:, list(CATEGORIES_MAP.values())]\nelse:\n return arr[:, list(CATEGORIES_M... | <|body_start_0|>
if len(arr.shape) == 1:
arr = np.expand_dims(arr, axis=0)
if arr.shape[-1] != 599 and arr.shape[-1] != 603:
raise RuntimeError('This is not an array valid with all classes defined!')
elif arr.shape[-1] == 599:
return arr[:, list(CATEGORIES_MAP... | CategoryEncoder | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CategoryEncoder:
def transform(arr: np.array) -> np.array:
"""Return the useful categories, according to class exploration notebook Args: arr: np.array Returns: np.array"""
<|body_0|>
def invert_transform(arr: np.array) -> np.array:
"""Returns all categories, tranfor... | stack_v2_sparse_classes_75kplus_train_073843 | 2,046 | no_license | [
{
"docstring": "Return the useful categories, according to class exploration notebook Args: arr: np.array Returns: np.array",
"name": "transform",
"signature": "def transform(arr: np.array) -> np.array"
},
{
"docstring": "Returns all categories, tranforming back from useful categories Args: arr:... | 2 | stack_v2_sparse_classes_30k_train_026724 | Implement the Python class `CategoryEncoder` described below.
Class description:
Implement the CategoryEncoder class.
Method signatures and docstrings:
- def transform(arr: np.array) -> np.array: Return the useful categories, according to class exploration notebook Args: arr: np.array Returns: np.array
- def invert_t... | Implement the Python class `CategoryEncoder` described below.
Class description:
Implement the CategoryEncoder class.
Method signatures and docstrings:
- def transform(arr: np.array) -> np.array: Return the useful categories, according to class exploration notebook Args: arr: np.array Returns: np.array
- def invert_t... | af685a136a6303b56af857bf70011b222db46fe5 | <|skeleton|>
class CategoryEncoder:
def transform(arr: np.array) -> np.array:
"""Return the useful categories, according to class exploration notebook Args: arr: np.array Returns: np.array"""
<|body_0|>
def invert_transform(arr: np.array) -> np.array:
"""Returns all categories, tranfor... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CategoryEncoder:
def transform(arr: np.array) -> np.array:
"""Return the useful categories, according to class exploration notebook Args: arr: np.array Returns: np.array"""
if len(arr.shape) == 1:
arr = np.expand_dims(arr, axis=0)
if arr.shape[-1] != 599 and arr.shape[-1] !... | the_stack_v2_python_sparse | project/utils/category_encoder.py | BAlmeidaS/capstone-udacity-mle | train | 1 | |
f8ed86e77a2fca38bd71134c2cf4f4bb148668c8 | [
"org = Org.get_by_id(org_uid) or Org(id=org_uid, provider='xerov2', provider_config=provider_config.key)\nif org.provider_config is None:\n org.provider_config = provider_config.key\nlogging.info('Provider secret = {} provider id {}'.format(provider_config.client_secret, provider_config.client_id))\nmsg = \"sett... | <|body_start_0|>
org = Org.get_by_id(org_uid) or Org(id=org_uid, provider='xerov2', provider_config=provider_config.key)
if org.provider_config is None:
org.provider_config = provider_config.key
logging.info('Provider secret = {} provider id {}'.format(provider_config.client_secret, ... | Class that facilitates first step of the oAuth flow. Stores org details and gives a URL for user to go to in order to complete the authorisation. | XeroAuthorizationSession | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class XeroAuthorizationSession:
"""Class that facilitates first step of the oAuth flow. Stores org details and gives a URL for user to go to in order to complete the authorisation."""
def __init__(self, org_uid, provider_config, redirect_url):
"""Prepares the org for linking. Args: org_uid... | stack_v2_sparse_classes_75kplus_train_073844 | 13,263 | no_license | [
{
"docstring": "Prepares the org for linking. Args: org_uid(str): org identifier provider_config(ProviderConfig): ndb model holding the provider config for the org redirect_url(str): the url to which the linker should send the user to after saving xero tokens",
"name": "__init__",
"signature": "def __in... | 2 | stack_v2_sparse_classes_30k_train_054127 | Implement the Python class `XeroAuthorizationSession` described below.
Class description:
Class that facilitates first step of the oAuth flow. Stores org details and gives a URL for user to go to in order to complete the authorisation.
Method signatures and docstrings:
- def __init__(self, org_uid, provider_config, r... | Implement the Python class `XeroAuthorizationSession` described below.
Class description:
Class that facilitates first step of the oAuth flow. Stores org details and gives a URL for user to go to in order to complete the authorisation.
Method signatures and docstrings:
- def __init__(self, org_uid, provider_config, r... | eeb4b2e879a5cb2492d4511d05aa5047d56892ad | <|skeleton|>
class XeroAuthorizationSession:
"""Class that facilitates first step of the oAuth flow. Stores org details and gives a URL for user to go to in order to complete the authorisation."""
def __init__(self, org_uid, provider_config, redirect_url):
"""Prepares the org for linking. Args: org_uid... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class XeroAuthorizationSession:
"""Class that facilitates first step of the oAuth flow. Stores org details and gives a URL for user to go to in order to complete the authorisation."""
def __init__(self, org_uid, provider_config, redirect_url):
"""Prepares the org for linking. Args: org_uid(str): org id... | the_stack_v2_python_sparse | app/clients/xero_client.py | SoulMen007/acuit-gl-ingester-zuora | train | 0 |
f66a2e21c622428174ca321c57a4c944ed9b294d | [
"dict.__init__(self)\nself.filename = filename\nf = open(self.filename, 'rU')\ntry:\n position = 0\n while True:\n line = f.readline()\n if not line:\n break\n key = line[0:5]\n if key != None:\n self[key] = position\n position = f.tell()\nfinally:\n ... | <|body_start_0|>
dict.__init__(self)
self.filename = filename
f = open(self.filename, 'rU')
try:
position = 0
while True:
line = f.readline()
if not line:
break
key = line[0:5]
if ... | An RAF file index. The RAF file itself is about 50 MB. This index provides rapid, random access of RAF records without having to load the entire file into memory. The index key is a concatenation of the PDB ID and chain ID. e.g "2drcA", "155c_". RAF uses an underscore to indicate blank chain IDs. | SeqMapIndex | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SeqMapIndex:
"""An RAF file index. The RAF file itself is about 50 MB. This index provides rapid, random access of RAF records without having to load the entire file into memory. The index key is a concatenation of the PDB ID and chain ID. e.g "2drcA", "155c_". RAF uses an underscore to indicate ... | stack_v2_sparse_classes_75kplus_train_073845 | 12,101 | permissive | [
{
"docstring": "Arguments: filename -- The file to index",
"name": "__init__",
"signature": "def __init__(self, filename)"
},
{
"docstring": "Return an item from the indexed file.",
"name": "__getitem__",
"signature": "def __getitem__(self, key)"
},
{
"docstring": "Get the sequen... | 3 | stack_v2_sparse_classes_30k_train_019848 | Implement the Python class `SeqMapIndex` described below.
Class description:
An RAF file index. The RAF file itself is about 50 MB. This index provides rapid, random access of RAF records without having to load the entire file into memory. The index key is a concatenation of the PDB ID and chain ID. e.g "2drcA", "155c... | Implement the Python class `SeqMapIndex` described below.
Class description:
An RAF file index. The RAF file itself is about 50 MB. This index provides rapid, random access of RAF records without having to load the entire file into memory. The index key is a concatenation of the PDB ID and chain ID. e.g "2drcA", "155c... | 1d9a8e84a8572809ee3260ede44290e14de3bdd1 | <|skeleton|>
class SeqMapIndex:
"""An RAF file index. The RAF file itself is about 50 MB. This index provides rapid, random access of RAF records without having to load the entire file into memory. The index key is a concatenation of the PDB ID and chain ID. e.g "2drcA", "155c_". RAF uses an underscore to indicate ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SeqMapIndex:
"""An RAF file index. The RAF file itself is about 50 MB. This index provides rapid, random access of RAF records without having to load the entire file into memory. The index key is a concatenation of the PDB ID and chain ID. e.g "2drcA", "155c_". RAF uses an underscore to indicate blank chain I... | the_stack_v2_python_sparse | bin/last_wrapper/Bio/SCOP/Raf.py | LyonsLab/coge | train | 41 |
f0e96308c20a0dc933bb32f56591f9e3bfd8b3b0 | [
"log_degree = np.array([math.log(graph.degree(node) + 1) for node in range(graph.number_of_nodes())]).reshape(-1, 1)\neccentricity = np.array([nx.eccentricity(graph, node) for node in range(graph.number_of_nodes())]).reshape(-1, 1)\nX = np.concatenate([log_degree, eccentricity], axis=1)\nreturn X",
"features = []... | <|body_start_0|>
log_degree = np.array([math.log(graph.degree(node) + 1) for node in range(graph.number_of_nodes())]).reshape(-1, 1)
eccentricity = np.array([nx.eccentricity(graph, node) for node in range(graph.number_of_nodes())]).reshape(-1, 1)
X = np.concatenate([log_degree, eccentricity], ax... | GeoScattering_child | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GeoScattering_child:
def _create_node_feature_matrix(self, graph):
"""Calculating the node features. Arg types: * **graph** *(NetworkX graph)* - The graph of interest. Return types: * **X** *(NumPy array)* - The node features."""
<|body_0|>
def _get_zero_order_features(self,... | stack_v2_sparse_classes_75kplus_train_073846 | 5,599 | no_license | [
{
"docstring": "Calculating the node features. Arg types: * **graph** *(NetworkX graph)* - The graph of interest. Return types: * **X** *(NumPy array)* - The node features.",
"name": "_create_node_feature_matrix",
"signature": "def _create_node_feature_matrix(self, graph)"
},
{
"docstring": "Cal... | 5 | stack_v2_sparse_classes_30k_val_000126 | Implement the Python class `GeoScattering_child` described below.
Class description:
Implement the GeoScattering_child class.
Method signatures and docstrings:
- def _create_node_feature_matrix(self, graph): Calculating the node features. Arg types: * **graph** *(NetworkX graph)* - The graph of interest. Return types... | Implement the Python class `GeoScattering_child` described below.
Class description:
Implement the GeoScattering_child class.
Method signatures and docstrings:
- def _create_node_feature_matrix(self, graph): Calculating the node features. Arg types: * **graph** *(NetworkX graph)* - The graph of interest. Return types... | 57737a1d93ad5a3d4d7cb91df440f32b3475d072 | <|skeleton|>
class GeoScattering_child:
def _create_node_feature_matrix(self, graph):
"""Calculating the node features. Arg types: * **graph** *(NetworkX graph)* - The graph of interest. Return types: * **X** *(NumPy array)* - The node features."""
<|body_0|>
def _get_zero_order_features(self,... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GeoScattering_child:
def _create_node_feature_matrix(self, graph):
"""Calculating the node features. Arg types: * **graph** *(NetworkX graph)* - The graph of interest. Return types: * **X** *(NumPy array)* - The node features."""
log_degree = np.array([math.log(graph.degree(node) + 1) for node... | the_stack_v2_python_sparse | node_fingerprints/data_geoscattering2.py | jiaxinying/HistogramGraphFingerprints | train | 1 | |
7722cc3e51e4c2ed5d7cc5bf1a6889d12c7017ca | [
"self.__logger = Logger.get_instance()\nself.__lunar_crush_client = lunar_crush_client\nself.__calculator_ids = [calculator.id for calculator in calculators]\nself.__fundamantals_calculators = [calculator for calculator in calculators if calculator.is_fundamental]\nself.__calculators = {calculator.id: calculator fo... | <|body_start_0|>
self.__logger = Logger.get_instance()
self.__lunar_crush_client = lunar_crush_client
self.__calculator_ids = [calculator.id for calculator in calculators]
self.__fundamantals_calculators = [calculator for calculator in calculators if calculator.is_fundamental]
se... | Represents the engine that drives all the data fetching and the generation and delivery of analytics to web clients of Coinarius. ... Class Attributes ---------------- update_lag : int The number of seconds between when the `update` method is called. Instance Attributes ---------- _logger : Logger The logger of this cl... | AnalyticsEngine | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AnalyticsEngine:
"""Represents the engine that drives all the data fetching and the generation and delivery of analytics to web clients of Coinarius. ... Class Attributes ---------------- update_lag : int The number of seconds between when the `update` method is called. Instance Attributes ------... | stack_v2_sparse_classes_75kplus_train_073847 | 7,668 | no_license | [
{
"docstring": "Initialises a new instance of this class. Parameters ---------- lunar_crush_client : LynarCryshClient The client for the LunarCrysh API",
"name": "__init__",
"signature": "def __init__(self, lunar_crush_client, symbol_store, calculators)"
},
{
"docstring": "Initialises the analyt... | 6 | stack_v2_sparse_classes_30k_train_041116 | Implement the Python class `AnalyticsEngine` described below.
Class description:
Represents the engine that drives all the data fetching and the generation and delivery of analytics to web clients of Coinarius. ... Class Attributes ---------------- update_lag : int The number of seconds between when the `update` metho... | Implement the Python class `AnalyticsEngine` described below.
Class description:
Represents the engine that drives all the data fetching and the generation and delivery of analytics to web clients of Coinarius. ... Class Attributes ---------------- update_lag : int The number of seconds between when the `update` metho... | db6506683fd664a918fff298a671a004310a5709 | <|skeleton|>
class AnalyticsEngine:
"""Represents the engine that drives all the data fetching and the generation and delivery of analytics to web clients of Coinarius. ... Class Attributes ---------------- update_lag : int The number of seconds between when the `update` method is called. Instance Attributes ------... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AnalyticsEngine:
"""Represents the engine that drives all the data fetching and the generation and delivery of analytics to web clients of Coinarius. ... Class Attributes ---------------- update_lag : int The number of seconds between when the `update` method is called. Instance Attributes ---------- _logger ... | the_stack_v2_python_sparse | src/core/analytics_engine.py | skingswolf/coinarius-analytics | train | 0 |
830a276688fba0bc102f1efac95f11725e197d13 | [
"assert len(v) == len(u)\nif len(v) == 0 or len(u) == 0:\n return np.array([])\nelse:\n return v.dot(u)",
"if isinstance(a, Ciphertext):\n product = [0 for _ in range(len(v))]\n for i in range(len(product)):\n product[i] = a * v[i]\n return product\nelse:\n raise TypeError('invalid scalar... | <|body_start_0|>
assert len(v) == len(u)
if len(v) == 0 or len(u) == 0:
return np.array([])
else:
return v.dot(u)
<|end_body_0|>
<|body_start_1|>
if isinstance(a, Ciphertext):
product = [0 for _ in range(len(v))]
for i in range(len(product... | LinearAlgebra | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LinearAlgebra:
def pdot(v, u):
"""Plaintext inner product :param v: numpy.ndarray :param u: numpy.ndarray :return:"""
<|body_0|>
def cmult(a, v):
"""Ciphertext scalar product a * v :param a: Ciphertext :param v: numpy.ndarray or list :return: list[Ciphertext]"""
... | stack_v2_sparse_classes_75kplus_train_073848 | 1,462 | no_license | [
{
"docstring": "Plaintext inner product :param v: numpy.ndarray :param u: numpy.ndarray :return:",
"name": "pdot",
"signature": "def pdot(v, u)"
},
{
"docstring": "Ciphertext scalar product a * v :param a: Ciphertext :param v: numpy.ndarray or list :return: list[Ciphertext]",
"name": "cmult"... | 4 | stack_v2_sparse_classes_30k_test_000001 | Implement the Python class `LinearAlgebra` described below.
Class description:
Implement the LinearAlgebra class.
Method signatures and docstrings:
- def pdot(v, u): Plaintext inner product :param v: numpy.ndarray :param u: numpy.ndarray :return:
- def cmult(a, v): Ciphertext scalar product a * v :param a: Ciphertext... | Implement the Python class `LinearAlgebra` described below.
Class description:
Implement the LinearAlgebra class.
Method signatures and docstrings:
- def pdot(v, u): Plaintext inner product :param v: numpy.ndarray :param u: numpy.ndarray :return:
- def cmult(a, v): Ciphertext scalar product a * v :param a: Ciphertext... | db959eef96f95fcdd92185f0cb728d1d0b99857b | <|skeleton|>
class LinearAlgebra:
def pdot(v, u):
"""Plaintext inner product :param v: numpy.ndarray :param u: numpy.ndarray :return:"""
<|body_0|>
def cmult(a, v):
"""Ciphertext scalar product a * v :param a: Ciphertext :param v: numpy.ndarray or list :return: list[Ciphertext]"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LinearAlgebra:
def pdot(v, u):
"""Plaintext inner product :param v: numpy.ndarray :param u: numpy.ndarray :return:"""
assert len(v) == len(u)
if len(v) == 0 or len(u) == 0:
return np.array([])
else:
return v.dot(u)
def cmult(a, v):
"""Cipher... | the_stack_v2_python_sparse | privacy/math/linear_algebra.py | som-don/jeddak | train | 0 | |
4eb8ea7c1b562ff154bfa60141a6834c119fc649 | [
"i, j = (0, len(node_list) - 1)\nwhile i < j:\n if node_list[i] != node_list[j]:\n return False\n i += 1\n j -= 1\nreturn True",
"node_list = []\nif not head:\n return True\nwhile head:\n node_list.append(head.val)\n head = head.next\nreturn self.is_palindrome_list(node_list)"
] | <|body_start_0|>
i, j = (0, len(node_list) - 1)
while i < j:
if node_list[i] != node_list[j]:
return False
i += 1
j -= 1
return True
<|end_body_0|>
<|body_start_1|>
node_list = []
if not head:
return True
wh... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def is_palindrome_list(self, node_list: ListNode) -> bool:
"""判断链表是否是回文串 Args: node_list: node链表 Returns: 布尔值"""
<|body_0|>
def is_palindrome(self, head: ListNode) -> bool:
"""返回交点 Args: head: 节点head Returns: 布尔值"""
<|body_1|>
<|end_skeleton|>
<|b... | stack_v2_sparse_classes_75kplus_train_073849 | 2,023 | permissive | [
{
"docstring": "判断链表是否是回文串 Args: node_list: node链表 Returns: 布尔值",
"name": "is_palindrome_list",
"signature": "def is_palindrome_list(self, node_list: ListNode) -> bool"
},
{
"docstring": "返回交点 Args: head: 节点head Returns: 布尔值",
"name": "is_palindrome",
"signature": "def is_palindrome(self... | 2 | stack_v2_sparse_classes_30k_train_002482 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def is_palindrome_list(self, node_list: ListNode) -> bool: 判断链表是否是回文串 Args: node_list: node链表 Returns: 布尔值
- def is_palindrome(self, head: ListNode) -> bool: 返回交点 Args: head: 节点h... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def is_palindrome_list(self, node_list: ListNode) -> bool: 判断链表是否是回文串 Args: node_list: node链表 Returns: 布尔值
- def is_palindrome(self, head: ListNode) -> bool: 返回交点 Args: head: 节点h... | 50f35eef6a0ad63173efed10df3c835b1dceaa3f | <|skeleton|>
class Solution:
def is_palindrome_list(self, node_list: ListNode) -> bool:
"""判断链表是否是回文串 Args: node_list: node链表 Returns: 布尔值"""
<|body_0|>
def is_palindrome(self, head: ListNode) -> bool:
"""返回交点 Args: head: 节点head Returns: 布尔值"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def is_palindrome_list(self, node_list: ListNode) -> bool:
"""判断链表是否是回文串 Args: node_list: node链表 Returns: 布尔值"""
i, j = (0, len(node_list) - 1)
while i < j:
if node_list[i] != node_list[j]:
return False
i += 1
j -= 1
... | the_stack_v2_python_sparse | src/leetcodepython/list/palindrome_linked_list_234.py | zhangyu345293721/leetcode | train | 101 | |
0d9d0fcb29341f051b4b31640a98976da53f2422 | [
"for id, op in vars(cls).items():\n if isinstance(op, IOperation) and op.is_valid(operator, left, right):\n if isinstance(op, BinaryOperation):\n return op.build(left, right)\n else:\n from boa3.model.type.type import Type\n operand = right if left is Type.none else... | <|body_start_0|>
for id, op in vars(cls).items():
if isinstance(op, IOperation) and op.is_valid(operator, left, right):
if isinstance(op, BinaryOperation):
return op.build(left, right)
else:
from boa3.model.type.type import Type... | BinaryOp | [
"Apache-2.0",
"LicenseRef-scancode-free-unknown"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BinaryOp:
def validate_type(cls, operator: Operator, left: IType, right: IType) -> Optional[BinaryOperation]:
"""Gets a binary operation given the operator and the operands types. :param operator: binary operator :param left: type of the left operand :param right: type of the right opera... | stack_v2_sparse_classes_75kplus_train_073850 | 4,052 | permissive | [
{
"docstring": "Gets a binary operation given the operator and the operands types. :param operator: binary operator :param left: type of the left operand :param right: type of the right operand :return: The operation if exists. None otherwise; :rtype: BinaryOperation or None",
"name": "validate_type",
"... | 3 | stack_v2_sparse_classes_30k_train_025006 | Implement the Python class `BinaryOp` described below.
Class description:
Implement the BinaryOp class.
Method signatures and docstrings:
- def validate_type(cls, operator: Operator, left: IType, right: IType) -> Optional[BinaryOperation]: Gets a binary operation given the operator and the operands types. :param oper... | Implement the Python class `BinaryOp` described below.
Class description:
Implement the BinaryOp class.
Method signatures and docstrings:
- def validate_type(cls, operator: Operator, left: IType, right: IType) -> Optional[BinaryOperation]: Gets a binary operation given the operator and the operands types. :param oper... | e4ef340744b5bd25ade26f847eac50789b97f3e9 | <|skeleton|>
class BinaryOp:
def validate_type(cls, operator: Operator, left: IType, right: IType) -> Optional[BinaryOperation]:
"""Gets a binary operation given the operator and the operands types. :param operator: binary operator :param left: type of the left operand :param right: type of the right opera... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BinaryOp:
def validate_type(cls, operator: Operator, left: IType, right: IType) -> Optional[BinaryOperation]:
"""Gets a binary operation given the operator and the operands types. :param operator: binary operator :param left: type of the left operand :param right: type of the right operand :return: Th... | the_stack_v2_python_sparse | boa3/model/operation/binaryop.py | DanPopa46/neo3-boa | train | 0 | |
0a684bbcfd3942c49f723954169c57c7ac77181d | [
"if not nums:\n return 0\nres = self.find_first(nums, 0, len(nums) - 1)\nreturn res",
"if start > end:\n return len(nums)\nmid = start + (end - start) // 2\nif nums[mid] != mid:\n if mid > 0 and nums[mid - 1] == mid - 1 or mid == 0:\n return mid\n end = mid - 1\nelse:\n start = mid + 1\nretu... | <|body_start_0|>
if not nums:
return 0
res = self.find_first(nums, 0, len(nums) - 1)
return res
<|end_body_0|>
<|body_start_1|>
if start > end:
return len(nums)
mid = start + (end - start) // 2
if nums[mid] != mid:
if mid > 0 and nums[... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def missingNumber(self, nums: List[int]) -> int:
"""missing number is the first number that is not equal to its index. binary search."""
<|body_0|>
def find_first(self, nums, start, end):
"""find first element that isn't equal to its index. binary search"""... | stack_v2_sparse_classes_75kplus_train_073851 | 869 | no_license | [
{
"docstring": "missing number is the first number that is not equal to its index. binary search.",
"name": "missingNumber",
"signature": "def missingNumber(self, nums: List[int]) -> int"
},
{
"docstring": "find first element that isn't equal to its index. binary search",
"name": "find_first... | 2 | stack_v2_sparse_classes_30k_train_014404 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def missingNumber(self, nums: List[int]) -> int: missing number is the first number that is not equal to its index. binary search.
- def find_first(self, nums, start, end): find ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def missingNumber(self, nums: List[int]) -> int: missing number is the first number that is not equal to its index. binary search.
- def find_first(self, nums, start, end): find ... | 0f16635de49dc63a207d34f7e612546977a5753e | <|skeleton|>
class Solution:
def missingNumber(self, nums: List[int]) -> int:
"""missing number is the first number that is not equal to its index. binary search."""
<|body_0|>
def find_first(self, nums, start, end):
"""find first element that isn't equal to its index. binary search"""... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def missingNumber(self, nums: List[int]) -> int:
"""missing number is the first number that is not equal to its index. binary search."""
if not nums:
return 0
res = self.find_first(nums, 0, len(nums) - 1)
return res
def find_first(self, nums, start, e... | the_stack_v2_python_sparse | jianzhioffer/53-2missingNumberBetween0andn-1.py | bycxw/coder | train | 0 | |
c3641d4e7463259190934193429f3317fc44c06d | [
"size = len(matrix)\nfor i in range(size):\n self.rotate_row(matrix, i)\nreturn",
"size = len(matrix)\nfor j, v in enumerate(matrix[n][n:size - n - 1]):\n temp, i, j = self.exchange(matrix, size, n, j + n, matrix[n][j + n])\n temp, i, j = self.exchange(matrix, size, i, j, temp)\n temp, i, j = self.exc... | <|body_start_0|>
size = len(matrix)
for i in range(size):
self.rotate_row(matrix, i)
return
<|end_body_0|>
<|body_start_1|>
size = len(matrix)
for j, v in enumerate(matrix[n][n:size - n - 1]):
temp, i, j = self.exchange(matrix, size, n, j + n, matrix[n][j... | Solution | [
"WTFPL"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def rotate(self, matrix):
""":type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead."""
<|body_0|>
def rotate_row(self, matrix, n):
"""n is the row index"""
<|body_1|>
def exchange(self, matrix, size, ... | stack_v2_sparse_classes_75kplus_train_073852 | 1,081 | permissive | [
{
"docstring": ":type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.",
"name": "rotate",
"signature": "def rotate(self, matrix)"
},
{
"docstring": "n is the row index",
"name": "rotate_row",
"signature": "def rotate_row(self, matrix, n)"
},... | 3 | stack_v2_sparse_classes_30k_train_004138 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def rotate(self, matrix): :type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.
- def rotate_row(self, matrix, n): n is the row index... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def rotate(self, matrix): :type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.
- def rotate_row(self, matrix, n): n is the row index... | 2677b6d26bedb9bc6c6137a2392d0afaceb91ec2 | <|skeleton|>
class Solution:
def rotate(self, matrix):
""":type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead."""
<|body_0|>
def rotate_row(self, matrix, n):
"""n is the row index"""
<|body_1|>
def exchange(self, matrix, size, ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def rotate(self, matrix):
""":type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead."""
size = len(matrix)
for i in range(size):
self.rotate_row(matrix, i)
return
def rotate_row(self, matrix, n):
"""n... | the_stack_v2_python_sparse | rotate_image/solution.py | haotianzhu/Questions_Solutions | train | 0 | |
c4ecd1600a103e129b137ec874c25f3c6b86c7d1 | [
"excluded_ports = set(['TruePort', 'FalsePort', 'TrueOutputPorts', 'FalseOutputPorts'])\nfor port_name, connector_list in self.inputPorts.iteritems():\n if port_name not in excluded_ports:\n for connector in connector_list:\n connector.obj.update()\nfor port_name, connectorList in copy.copy(sel... | <|body_start_0|>
excluded_ports = set(['TruePort', 'FalsePort', 'TrueOutputPorts', 'FalseOutputPorts'])
for port_name, connector_list in self.inputPorts.iteritems():
if port_name not in excluded_ports:
for connector in connector_list:
connector.obj.update(... | The If Module alows the user to choose the part of the workflow to be executed through the use of a condition. | If | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class If:
"""The If Module alows the user to choose the part of the workflow to be executed through the use of a condition."""
def updateUpstream(self):
"""A modified version of the updateUpstream method."""
<|body_0|>
def compute(self):
"""The compute method for the I... | stack_v2_sparse_classes_75kplus_train_073853 | 5,146 | permissive | [
{
"docstring": "A modified version of the updateUpstream method.",
"name": "updateUpstream",
"signature": "def updateUpstream(self)"
},
{
"docstring": "The compute method for the If module.",
"name": "compute",
"signature": "def compute(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_031745 | Implement the Python class `If` described below.
Class description:
The If Module alows the user to choose the part of the workflow to be executed through the use of a condition.
Method signatures and docstrings:
- def updateUpstream(self): A modified version of the updateUpstream method.
- def compute(self): The com... | Implement the Python class `If` described below.
Class description:
The If Module alows the user to choose the part of the workflow to be executed through the use of a condition.
Method signatures and docstrings:
- def updateUpstream(self): A modified version of the updateUpstream method.
- def compute(self): The com... | 23ef56ec24b85c82416e1437a08381635328abe5 | <|skeleton|>
class If:
"""The If Module alows the user to choose the part of the workflow to be executed through the use of a condition."""
def updateUpstream(self):
"""A modified version of the updateUpstream method."""
<|body_0|>
def compute(self):
"""The compute method for the I... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class If:
"""The If Module alows the user to choose the part of the workflow to be executed through the use of a condition."""
def updateUpstream(self):
"""A modified version of the updateUpstream method."""
excluded_ports = set(['TruePort', 'FalsePort', 'TrueOutputPorts', 'FalseOutputPorts'])
... | the_stack_v2_python_sparse | vistrails_current/vistrails/packages/controlflow/conditional.py | lumig242/VisTrailsRecommendation | train | 3 |
90e08401cf50ef80d42fcfa6c388650e5fc09d54 | [
"if not vertex:\n return jsonify_response({'error': 'Vertex not found'}, 404)\ncore_vertices = CoreVertexInheritsFromTemplate.get_all_template_inheritors(template_id)\nschema = CoreVertexListSchema(many=True)\nresponse = json.loads(schema.dumps(core_vertices).data)\nreturn jsonify_response(response, 200)",
"if... | <|body_start_0|>
if not vertex:
return jsonify_response({'error': 'Vertex not found'}, 404)
core_vertices = CoreVertexInheritsFromTemplate.get_all_template_inheritors(template_id)
schema = CoreVertexListSchema(many=True)
response = json.loads(schema.dumps(core_vertices).data)... | Contains the GET and POST views required for listing and creating children CoreVertices in a given Team or CoreVertex | ListCreateCoreVertexView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ListCreateCoreVertexView:
"""Contains the GET and POST views required for listing and creating children CoreVertices in a given Team or CoreVertex"""
def get(self, vertex=None, vertex_type=None, vertex_id=None, template_id=None):
"""Returns all corevertices that inherit from the give... | stack_v2_sparse_classes_75kplus_train_073854 | 44,865 | no_license | [
{
"docstring": "Returns all corevertices that inherit from the given template id",
"name": "get",
"signature": "def get(self, vertex=None, vertex_type=None, vertex_id=None, template_id=None)"
},
{
"docstring": "Creates the core vertex instance of the given type as well as and edge from the paren... | 2 | stack_v2_sparse_classes_30k_train_019369 | Implement the Python class `ListCreateCoreVertexView` described below.
Class description:
Contains the GET and POST views required for listing and creating children CoreVertices in a given Team or CoreVertex
Method signatures and docstrings:
- def get(self, vertex=None, vertex_type=None, vertex_id=None, template_id=N... | Implement the Python class `ListCreateCoreVertexView` described below.
Class description:
Contains the GET and POST views required for listing and creating children CoreVertices in a given Team or CoreVertex
Method signatures and docstrings:
- def get(self, vertex=None, vertex_type=None, vertex_id=None, template_id=N... | 00434985013b65fe45b0a8c8a7f0b50bb727087a | <|skeleton|>
class ListCreateCoreVertexView:
"""Contains the GET and POST views required for listing and creating children CoreVertices in a given Team or CoreVertex"""
def get(self, vertex=None, vertex_type=None, vertex_id=None, template_id=None):
"""Returns all corevertices that inherit from the give... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ListCreateCoreVertexView:
"""Contains the GET and POST views required for listing and creating children CoreVertices in a given Team or CoreVertex"""
def get(self, vertex=None, vertex_type=None, vertex_id=None, template_id=None):
"""Returns all corevertices that inherit from the given template id... | the_stack_v2_python_sparse | core/views.py | gingerComms/gingerCommsAPIs | train | 0 |
cfd404458c4ae82b964b91e6ca78123fba158d5b | [
"super(ReportCampaignAbuseReports, self).__init__(*args, **kwargs)\nself.endpoint = 'reports'\nself.campaign_id = None\nself.report_id = None",
"self.campaign_id = campaign_id\nself.report_id = None\nreturn self._mc_client._get(url=self._build_path(campaign_id, 'abuse-reports'), **queryparams)",
"self.campaign_... | <|body_start_0|>
super(ReportCampaignAbuseReports, self).__init__(*args, **kwargs)
self.endpoint = 'reports'
self.campaign_id = None
self.report_id = None
<|end_body_0|>
<|body_start_1|>
self.campaign_id = campaign_id
self.report_id = None
return self._mc_client.... | Get information about campaign abuse complaints. | ReportCampaignAbuseReports | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ReportCampaignAbuseReports:
"""Get information about campaign abuse complaints."""
def __init__(self, *args, **kwargs):
"""Initialize the endpoint"""
<|body_0|>
def all(self, campaign_id, **queryparams):
"""Get a list of abuse complaints for a specific campaign. ... | stack_v2_sparse_classes_75kplus_train_073855 | 1,850 | permissive | [
{
"docstring": "Initialize the endpoint",
"name": "__init__",
"signature": "def __init__(self, *args, **kwargs)"
},
{
"docstring": "Get a list of abuse complaints for a specific campaign. :param campaign_id: The unique id for the campaign. :type campaign_id: :py:class:`str` :param queryparams: T... | 3 | stack_v2_sparse_classes_30k_train_049832 | Implement the Python class `ReportCampaignAbuseReports` described below.
Class description:
Get information about campaign abuse complaints.
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): Initialize the endpoint
- def all(self, campaign_id, **queryparams): Get a list of abuse complaints for ... | Implement the Python class `ReportCampaignAbuseReports` described below.
Class description:
Get information about campaign abuse complaints.
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): Initialize the endpoint
- def all(self, campaign_id, **queryparams): Get a list of abuse complaints for ... | bf61cd602dc44cbff32fbf6f6dcdd33cf6f782e8 | <|skeleton|>
class ReportCampaignAbuseReports:
"""Get information about campaign abuse complaints."""
def __init__(self, *args, **kwargs):
"""Initialize the endpoint"""
<|body_0|>
def all(self, campaign_id, **queryparams):
"""Get a list of abuse complaints for a specific campaign. ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ReportCampaignAbuseReports:
"""Get information about campaign abuse complaints."""
def __init__(self, *args, **kwargs):
"""Initialize the endpoint"""
super(ReportCampaignAbuseReports, self).__init__(*args, **kwargs)
self.endpoint = 'reports'
self.campaign_id = None
... | the_stack_v2_python_sparse | mailchimp3/entities/reportcampaignabusereports.py | VingtCinq/python-mailchimp | train | 190 |
a9f00c2fb6e1358eba012688122ba30d9cfb840d | [
"rank_zero_deprecation('`TrainerOptimizersMixin.init_optimizers` was deprecated in v1.6 and will be removed in v1.8.')\npl_module = self.lightning_module or model\nreturn _init_optimizers_and_lr_schedulers(pl_module)",
"rank_zero_deprecation('`TrainerOptimizersMixin.convert_to_lightning_optimizers` was deprecated... | <|body_start_0|>
rank_zero_deprecation('`TrainerOptimizersMixin.init_optimizers` was deprecated in v1.6 and will be removed in v1.8.')
pl_module = self.lightning_module or model
return _init_optimizers_and_lr_schedulers(pl_module)
<|end_body_0|>
<|body_start_1|>
rank_zero_deprecation('`... | .. deprecated:: v1.6 The `TrainerOptimizersMixin` was deprecated in v1.6 and will be removed in v1.8. | TrainerOptimizersMixin | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TrainerOptimizersMixin:
""".. deprecated:: v1.6 The `TrainerOptimizersMixin` was deprecated in v1.6 and will be removed in v1.8."""
def init_optimizers(self, model: Optional['pl.LightningModule']) -> Tuple[List, List, List]:
""".. deprecated:: v1.6 `TrainerOptimizersMixin.init_optimi... | stack_v2_sparse_classes_75kplus_train_073856 | 2,682 | permissive | [
{
"docstring": ".. deprecated:: v1.6 `TrainerOptimizersMixin.init_optimizers` was deprecated in v1.6 and will be removed in v1.8.",
"name": "init_optimizers",
"signature": "def init_optimizers(self, model: Optional['pl.LightningModule']) -> Tuple[List, List, List]"
},
{
"docstring": ".. deprecat... | 2 | null | Implement the Python class `TrainerOptimizersMixin` described below.
Class description:
.. deprecated:: v1.6 The `TrainerOptimizersMixin` was deprecated in v1.6 and will be removed in v1.8.
Method signatures and docstrings:
- def init_optimizers(self, model: Optional['pl.LightningModule']) -> Tuple[List, List, List]:... | Implement the Python class `TrainerOptimizersMixin` described below.
Class description:
.. deprecated:: v1.6 The `TrainerOptimizersMixin` was deprecated in v1.6 and will be removed in v1.8.
Method signatures and docstrings:
- def init_optimizers(self, model: Optional['pl.LightningModule']) -> Tuple[List, List, List]:... | fe34bf2a653ebd50e6a3a00be829e3611f820c3c | <|skeleton|>
class TrainerOptimizersMixin:
""".. deprecated:: v1.6 The `TrainerOptimizersMixin` was deprecated in v1.6 and will be removed in v1.8."""
def init_optimizers(self, model: Optional['pl.LightningModule']) -> Tuple[List, List, List]:
""".. deprecated:: v1.6 `TrainerOptimizersMixin.init_optimi... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TrainerOptimizersMixin:
""".. deprecated:: v1.6 The `TrainerOptimizersMixin` was deprecated in v1.6 and will be removed in v1.8."""
def init_optimizers(self, model: Optional['pl.LightningModule']) -> Tuple[List, List, List]:
""".. deprecated:: v1.6 `TrainerOptimizersMixin.init_optimizers` was dep... | the_stack_v2_python_sparse | pytorch_lightning/trainer/optimizers.py | wandb/pytorch-lightning | train | 3 |
b891a1d58d4a863f443a35cd5c3803828e8b3b29 | [
"self.ebvs = {}\nself.ebvs['young'] = float(self.parameters['E_BVs_young'])\nself.ebvs_old_factor = float(self.parameters['E_BVs_old_factor'])\nself.ebvs['old'] = self.ebvs_old_factor * self.ebvs['young']\nself.uv_bump_wavelength = float(self.parameters['uv_bump_wavelength'])\nself.uv_bump_width = float(self.parame... | <|body_start_0|>
self.ebvs = {}
self.ebvs['young'] = float(self.parameters['E_BVs_young'])
self.ebvs_old_factor = float(self.parameters['E_BVs_old_factor'])
self.ebvs['old'] = self.ebvs_old_factor * self.ebvs['young']
self.uv_bump_wavelength = float(self.parameters['uv_bump_wavel... | Calzetti + Leitherer attenuation module This module computes the dust attenuation using the formulae from Calzetti et al. (2000) and Leitherer et al. (2002). The attenuation can be computed on the whole spectrum or on a specific contribution and is added to the SED as a negative contribution. | CalzLeit | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CalzLeit:
"""Calzetti + Leitherer attenuation module This module computes the dust attenuation using the formulae from Calzetti et al. (2000) and Leitherer et al. (2002). The attenuation can be computed on the whole spectrum or on a specific contribution and is added to the SED as a negative cont... | stack_v2_sparse_classes_75kplus_train_073857 | 11,143 | no_license | [
{
"docstring": "Get the filters from the database",
"name": "_init_code",
"signature": "def _init_code(self)"
},
{
"docstring": "Add the CCM dust attenuation to the SED. Parameters ---------- sed: pcigale.sed.SED object",
"name": "process",
"signature": "def process(self, sed)"
}
] | 2 | stack_v2_sparse_classes_30k_train_022349 | Implement the Python class `CalzLeit` described below.
Class description:
Calzetti + Leitherer attenuation module This module computes the dust attenuation using the formulae from Calzetti et al. (2000) and Leitherer et al. (2002). The attenuation can be computed on the whole spectrum or on a specific contribution and... | Implement the Python class `CalzLeit` described below.
Class description:
Calzetti + Leitherer attenuation module This module computes the dust attenuation using the formulae from Calzetti et al. (2000) and Leitherer et al. (2002). The attenuation can be computed on the whole spectrum or on a specific contribution and... | 9ef9b99425537350b8706fddfe90ed47301107a5 | <|skeleton|>
class CalzLeit:
"""Calzetti + Leitherer attenuation module This module computes the dust attenuation using the formulae from Calzetti et al. (2000) and Leitherer et al. (2002). The attenuation can be computed on the whole spectrum or on a specific contribution and is added to the SED as a negative cont... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CalzLeit:
"""Calzetti + Leitherer attenuation module This module computes the dust attenuation using the formulae from Calzetti et al. (2000) and Leitherer et al. (2002). The attenuation can be computed on the whole spectrum or on a specific contribution and is added to the SED as a negative contribution."""
... | the_stack_v2_python_sparse | pcigale/sed_modules/dustatt_calzleit.py | JohannesBuchner/cigale | train | 5 |
3432d07d9b26f3dbc2a69e24cb3a81171a232dd2 | [
"if maximumSectorExposure <= 0:\n raise ValueError('MaximumSectorExposureRiskManagementModel: the maximum sector exposure cannot be a non-positive value.')\nself.maximumSectorExposure = maximumSectorExposure\nself.targetsCollection = PortfolioTargetCollection()",
"maximumSectorExposureValue = float(algorithm.P... | <|body_start_0|>
if maximumSectorExposure <= 0:
raise ValueError('MaximumSectorExposureRiskManagementModel: the maximum sector exposure cannot be a non-positive value.')
self.maximumSectorExposure = maximumSectorExposure
self.targetsCollection = PortfolioTargetCollection()
<|end_body... | Provides an implementation of IRiskManagementModel that that limits the sector exposure to the specified percentage | MaximumSectorExposureRiskManagementModel | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MaximumSectorExposureRiskManagementModel:
"""Provides an implementation of IRiskManagementModel that that limits the sector exposure to the specified percentage"""
def __init__(self, maximumSectorExposure=0.2):
"""Initializes a new instance of the MaximumSectorExposureRiskManagementM... | stack_v2_sparse_classes_75kplus_train_073858 | 4,700 | permissive | [
{
"docstring": "Initializes a new instance of the MaximumSectorExposureRiskManagementModel class Args: maximumDrawdownPercent: The maximum exposure for any sector, defaults to 20% sector exposure.",
"name": "__init__",
"signature": "def __init__(self, maximumSectorExposure=0.2)"
},
{
"docstring"... | 3 | null | Implement the Python class `MaximumSectorExposureRiskManagementModel` described below.
Class description:
Provides an implementation of IRiskManagementModel that that limits the sector exposure to the specified percentage
Method signatures and docstrings:
- def __init__(self, maximumSectorExposure=0.2): Initializes a... | Implement the Python class `MaximumSectorExposureRiskManagementModel` described below.
Class description:
Provides an implementation of IRiskManagementModel that that limits the sector exposure to the specified percentage
Method signatures and docstrings:
- def __init__(self, maximumSectorExposure=0.2): Initializes a... | b33dd3bc140e14b883f39ecf848a793cf7292277 | <|skeleton|>
class MaximumSectorExposureRiskManagementModel:
"""Provides an implementation of IRiskManagementModel that that limits the sector exposure to the specified percentage"""
def __init__(self, maximumSectorExposure=0.2):
"""Initializes a new instance of the MaximumSectorExposureRiskManagementM... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MaximumSectorExposureRiskManagementModel:
"""Provides an implementation of IRiskManagementModel that that limits the sector exposure to the specified percentage"""
def __init__(self, maximumSectorExposure=0.2):
"""Initializes a new instance of the MaximumSectorExposureRiskManagementModel class Ar... | the_stack_v2_python_sparse | Algorithm.Framework/Risk/MaximumSectorExposureRiskManagementModel.py | Capnode/Algoloop | train | 87 |
abd774ea44d0bf47c1b823520135c0b05c05672d | [
"def serialize_branch(root):\n if root is None:\n serialized.append('$')\n else:\n serialized.append(root.val)\n serialize_branch(root.left)\n serialize_branch(root.right)\nserialized = []\nserialize_branch(root)\nreturn '|'.join(('$' if x is None else str(x) for x in serialized))"... | <|body_start_0|>
def serialize_branch(root):
if root is None:
serialized.append('$')
else:
serialized.append(root.val)
serialize_branch(root.left)
serialize_branch(root.right)
serialized = []
serialize_branch... | Codec | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|>
<|body_... | stack_v2_sparse_classes_75kplus_train_073859 | 1,454 | permissive | [
{
"docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str",
"name": "serialize",
"signature": "def serialize(self, root)"
},
{
"docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode",
"name": "deserialize",
"signature": "def deserializ... | 2 | stack_v2_sparse_classes_30k_train_006731 | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:... | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:... | ba84c192fb9995dd48ddc6d81c3153488dd3c698 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
def serialize_branch(root):
if root is None:
serialized.append('$')
else:
serialized.append(root.val)
serialize_br... | the_stack_v2_python_sparse | Python/serialize-and-deserialize-binary-tree.py | phucle2411/LeetCode | train | 0 | |
e51d63b34f5f6b620b75cfde5d90e8b669f81647 | [
"d = {}\nfor s in strs:\n k = tuple(sorted(s))\n d.setdefault(k, [])\n d[k].append(s)\nreturn [v for k, v in d.items()]",
"rets = []\nwhile strs:\n s_letters = [0] * 26\n for c in strs[0]:\n s_letters[ord(c) - ord('a')] += 1\n ret = [0]\n for i in range(1, len(strs)):\n table = ... | <|body_start_0|>
d = {}
for s in strs:
k = tuple(sorted(s))
d.setdefault(k, [])
d[k].append(s)
return [v for k, v in d.items()]
<|end_body_0|>
<|body_start_1|>
rets = []
while strs:
s_letters = [0] * 26
for c in strs[0]... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def groupAnagrams(self, strs):
""":type strs: List[str] :rtype: List[List[str]]"""
<|body_0|>
def groupAnagramsSlow(self, strs):
""":type strs: List[str] :rtype: List[List[str]]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
d = {}
... | stack_v2_sparse_classes_75kplus_train_073860 | 1,284 | no_license | [
{
"docstring": ":type strs: List[str] :rtype: List[List[str]]",
"name": "groupAnagrams",
"signature": "def groupAnagrams(self, strs)"
},
{
"docstring": ":type strs: List[str] :rtype: List[List[str]]",
"name": "groupAnagramsSlow",
"signature": "def groupAnagramsSlow(self, strs)"
}
] | 2 | stack_v2_sparse_classes_30k_train_029824 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def groupAnagrams(self, strs): :type strs: List[str] :rtype: List[List[str]]
- def groupAnagramsSlow(self, strs): :type strs: List[str] :rtype: List[List[str]] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def groupAnagrams(self, strs): :type strs: List[str] :rtype: List[List[str]]
- def groupAnagramsSlow(self, strs): :type strs: List[str] :rtype: List[List[str]]
<|skeleton|>
clas... | ac53dd9bf2c4c9d17c9dc5f7fdda32e386658fdd | <|skeleton|>
class Solution:
def groupAnagrams(self, strs):
""":type strs: List[str] :rtype: List[List[str]]"""
<|body_0|>
def groupAnagramsSlow(self, strs):
""":type strs: List[str] :rtype: List[List[str]]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def groupAnagrams(self, strs):
""":type strs: List[str] :rtype: List[List[str]]"""
d = {}
for s in strs:
k = tuple(sorted(s))
d.setdefault(k, [])
d[k].append(s)
return [v for k, v in d.items()]
def groupAnagramsSlow(self, strs)... | the_stack_v2_python_sparse | cs_notes/string/group_anagrams.py | hwc1824/LeetCodeSolution | train | 0 | |
df859ad61ad861d19bf9e8343c4ecc8ea4d1f5b8 | [
"if endWord not in wordList:\n return 0\nqueue = deque([(beginWord, 1)])\nvisted = set([beginWord])\nchars = [chr(ord('a') + i) for i in range(26)]\nwhile queue:\n word, step = queue.popleft()\n if word == endWord:\n return step\n for i in range(len(word)):\n for c in chars:\n n... | <|body_start_0|>
if endWord not in wordList:
return 0
queue = deque([(beginWord, 1)])
visted = set([beginWord])
chars = [chr(ord('a') + i) for i in range(26)]
while queue:
word, step = queue.popleft()
if word == endWord:
return ... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def ladderLength(self, beginWord, endWord, wordList):
""":type beginWord: str :type endWord: str :type wordList: List[str] :rtype: int Time Limit Exceeded"""
<|body_0|>
def ladderLength1(self, beginWord, endWord, wordList):
""":type beginWord: str :type end... | stack_v2_sparse_classes_75kplus_train_073861 | 2,378 | no_license | [
{
"docstring": ":type beginWord: str :type endWord: str :type wordList: List[str] :rtype: int Time Limit Exceeded",
"name": "ladderLength",
"signature": "def ladderLength(self, beginWord, endWord, wordList)"
},
{
"docstring": ":type beginWord: str :type endWord: str :type wordList: List[str] :rt... | 2 | stack_v2_sparse_classes_30k_train_034803 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def ladderLength(self, beginWord, endWord, wordList): :type beginWord: str :type endWord: str :type wordList: List[str] :rtype: int Time Limit Exceeded
- def ladderLength1(self, ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def ladderLength(self, beginWord, endWord, wordList): :type beginWord: str :type endWord: str :type wordList: List[str] :rtype: int Time Limit Exceeded
- def ladderLength1(self, ... | bad06f681d8d3f2b841cb3c8a969198b8643f864 | <|skeleton|>
class Solution:
def ladderLength(self, beginWord, endWord, wordList):
""":type beginWord: str :type endWord: str :type wordList: List[str] :rtype: int Time Limit Exceeded"""
<|body_0|>
def ladderLength1(self, beginWord, endWord, wordList):
""":type beginWord: str :type end... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def ladderLength(self, beginWord, endWord, wordList):
""":type beginWord: str :type endWord: str :type wordList: List[str] :rtype: int Time Limit Exceeded"""
if endWord not in wordList:
return 0
queue = deque([(beginWord, 1)])
visted = set([beginWord])
... | the_stack_v2_python_sparse | 127_word_ladder.py | subicWang/leetcode_aotang | train | 0 | |
ddd775049ca4e01d28b0ff50daa3ca7e71e504cc | [
"super().__init__(**kwargs)\nif isinstance(filters, int):\n self._filters = [filters]\nelse:\n self._filters = filters\nself._strides = strides\nself._kernel_size = kernel_size\nself._kernel_initializer = kernel_initializer\nself._kernel_regularizer = kernel_regularizer\nself._bias_regularizer = bias_regulari... | <|body_start_0|>
super().__init__(**kwargs)
if isinstance(filters, int):
self._filters = [filters]
else:
self._filters = filters
self._strides = strides
self._kernel_size = kernel_size
self._kernel_initializer = kernel_initializer
self._ker... | A basic 3d convolution block. | BasicBlock3DVolume | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BasicBlock3DVolume:
"""A basic 3d convolution block."""
def __init__(self, filters: Union[int, Sequence[int]], strides: Union[int, Sequence[int]], kernel_size: Union[int, Sequence[int]], kernel_initializer: str='VarianceScaling', kernel_regularizer: tf.keras.regularizers.Regularizer=None, bi... | stack_v2_sparse_classes_75kplus_train_073862 | 19,158 | permissive | [
{
"docstring": "Creates a basic 3d convolution block applying one or more convolutions. Args: filters: A list of `int` numbers or an `int` number of filters. Given an `int` input, a single convolution is applied; otherwise a series of convolutions are applied. strides: An integer or tuple/list of 3 integers, sp... | 4 | null | Implement the Python class `BasicBlock3DVolume` described below.
Class description:
A basic 3d convolution block.
Method signatures and docstrings:
- def __init__(self, filters: Union[int, Sequence[int]], strides: Union[int, Sequence[int]], kernel_size: Union[int, Sequence[int]], kernel_initializer: str='VarianceScal... | Implement the Python class `BasicBlock3DVolume` described below.
Class description:
A basic 3d convolution block.
Method signatures and docstrings:
- def __init__(self, filters: Union[int, Sequence[int]], strides: Union[int, Sequence[int]], kernel_size: Union[int, Sequence[int]], kernel_initializer: str='VarianceScal... | d3507b550a3ade40cade60a79eb5b8978b56c7ae | <|skeleton|>
class BasicBlock3DVolume:
"""A basic 3d convolution block."""
def __init__(self, filters: Union[int, Sequence[int]], strides: Union[int, Sequence[int]], kernel_size: Union[int, Sequence[int]], kernel_initializer: str='VarianceScaling', kernel_regularizer: tf.keras.regularizers.Regularizer=None, bi... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BasicBlock3DVolume:
"""A basic 3d convolution block."""
def __init__(self, filters: Union[int, Sequence[int]], strides: Union[int, Sequence[int]], kernel_size: Union[int, Sequence[int]], kernel_initializer: str='VarianceScaling', kernel_regularizer: tf.keras.regularizers.Regularizer=None, bias_regularize... | the_stack_v2_python_sparse | official/projects/volumetric_models/modeling/nn_blocks_3d.py | jianzhnie/models | train | 2 |
79e8f81cfe5cc34ecd5f90787d768c69fe9a787b | [
"cargo_id = self.initial_data.get('cargo')\nrequest = self.context.get('request')\ncargo = Cargo.objects.filter().cargo_handled_by_agent(agent=request.user).get(id=cargo_id)\norder = Order.objects.check_cargo_order(cargo)\nif order:\n raise serializers.ValidationError({'errosrs': {'cargo': 'The cargo already has... | <|body_start_0|>
cargo_id = self.initial_data.get('cargo')
request = self.context.get('request')
cargo = Cargo.objects.filter().cargo_handled_by_agent(agent=request.user).get(id=cargo_id)
order = Order.objects.check_cargo_order(cargo)
if order:
raise serializers.Valid... | Serializer for Order objects | OrderSerializer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OrderSerializer:
"""Serializer for Order objects"""
def validate(self, data):
"""Validate data."""
<|body_0|>
def create(self, validated_data):
"""Ensure that the correct methods are used to create Order"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_75kplus_train_073863 | 2,158 | permissive | [
{
"docstring": "Validate data.",
"name": "validate",
"signature": "def validate(self, data)"
},
{
"docstring": "Ensure that the correct methods are used to create Order",
"name": "create",
"signature": "def create(self, validated_data)"
}
] | 2 | stack_v2_sparse_classes_30k_train_003492 | Implement the Python class `OrderSerializer` described below.
Class description:
Serializer for Order objects
Method signatures and docstrings:
- def validate(self, data): Validate data.
- def create(self, validated_data): Ensure that the correct methods are used to create Order | Implement the Python class `OrderSerializer` described below.
Class description:
Serializer for Order objects
Method signatures and docstrings:
- def validate(self, data): Validate data.
- def create(self, validated_data): Ensure that the correct methods are used to create Order
<|skeleton|>
class OrderSerializer:
... | 60d034681da66771412fc73402d690a9fcaa5920 | <|skeleton|>
class OrderSerializer:
"""Serializer for Order objects"""
def validate(self, data):
"""Validate data."""
<|body_0|>
def create(self, validated_data):
"""Ensure that the correct methods are used to create Order"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class OrderSerializer:
"""Serializer for Order objects"""
def validate(self, data):
"""Validate data."""
cargo_id = self.initial_data.get('cargo')
request = self.context.get('request')
cargo = Cargo.objects.filter().cargo_handled_by_agent(agent=request.user).get(id=cargo_id)
... | the_stack_v2_python_sparse | cargotracker/orders/serializers.py | MandelaK/CargoTracker | train | 0 |
afb6c810bfb8c1a74bcb32ce02e3e388f214ed4d | [
"import sys, traceback\nexc_str = exc_only_str = _('Missing exception information')\ntry:\n etype, value, tb = sys.exc_info()\n exc_str = ''.join(traceback.format_exception(etype, value, tb))\n exc_only_str = ''.join(traceback.format_exception_only(etype, value))\nfinally:\n etype = value = tb = None\nr... | <|body_start_0|>
import sys, traceback
exc_str = exc_only_str = _('Missing exception information')
try:
etype, value, tb = sys.exc_info()
exc_str = ''.join(traceback.format_exception(etype, value, tb))
exc_only_str = ''.join(traceback.format_exception_only(ety... | A specialized Dialog. TODO actually make it a subclass instead of owning. For now, this might be redundant. The class hierarchy should be: GimpUi.Dialog Dialog (GimpFu) ControlDialog ExceptionDialog WarningDialog | ExceptionDialog | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ExceptionDialog:
"""A specialized Dialog. TODO actually make it a subclass instead of owning. For now, this might be redundant. The class hierarchy should be: GimpUi.Dialog Dialog (GimpFu) ControlDialog ExceptionDialog WarningDialog"""
def create_exception_str():
"""Create two string... | stack_v2_sparse_classes_75kplus_train_073864 | 4,228 | no_license | [
{
"docstring": "Create two strings from latest exception.",
"name": "create_exception_str",
"signature": "def create_exception_str()"
},
{
"docstring": "Return error dialog containing Python trace for latest exception",
"name": "_create_error_dialog",
"signature": "def _create_error_dial... | 3 | stack_v2_sparse_classes_30k_train_040327 | Implement the Python class `ExceptionDialog` described below.
Class description:
A specialized Dialog. TODO actually make it a subclass instead of owning. For now, this might be redundant. The class hierarchy should be: GimpUi.Dialog Dialog (GimpFu) ControlDialog ExceptionDialog WarningDialog
Method signatures and do... | Implement the Python class `ExceptionDialog` described below.
Class description:
A specialized Dialog. TODO actually make it a subclass instead of owning. For now, this might be redundant. The class hierarchy should be: GimpUi.Dialog Dialog (GimpFu) ControlDialog ExceptionDialog WarningDialog
Method signatures and do... | 7e6e08a2acb34fe2dce6631f9f255dae5ab34a6b | <|skeleton|>
class ExceptionDialog:
"""A specialized Dialog. TODO actually make it a subclass instead of owning. For now, this might be redundant. The class hierarchy should be: GimpUi.Dialog Dialog (GimpFu) ControlDialog ExceptionDialog WarningDialog"""
def create_exception_str():
"""Create two string... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ExceptionDialog:
"""A specialized Dialog. TODO actually make it a subclass instead of owning. For now, this might be redundant. The class hierarchy should be: GimpUi.Dialog Dialog (GimpFu) ControlDialog ExceptionDialog WarningDialog"""
def create_exception_str():
"""Create two strings from latest... | the_stack_v2_python_sparse | gimpfu/gui/exception_dialog.py | bootchk/GimpFu-v3 | train | 21 |
4a3512564d2c6686a7305dcf26fcaa55d3d6e208 | [
"req = self.create_api(get_agent, CoopSts=1, RecordIndex=0, RecordSize=9999)\nagentlist = req.json()['Data']['RecordList']\nself.agentid = None\nfor i in range(len(agentlist)):\n if agentname == agentlist[i]['LaborName']:\n self.agentid = agentlist[i]['SpId']\nreturn self.agentid",
"print(entname)\nreq ... | <|body_start_0|>
req = self.create_api(get_agent, CoopSts=1, RecordIndex=0, RecordSize=9999)
agentlist = req.json()['Data']['RecordList']
self.agentid = None
for i in range(len(agentlist)):
if agentname == agentlist[i]['LaborName']:
self.agentid = agentlist[i]... | AdvanceManage | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AdvanceManage:
def get_agent(self, agentname):
"""获取来源id :param agentname: 来源名称 :return: self.agentid 来源id"""
<|body_0|>
def get_ent(self, entname):
"""获取标准企业id :param entname: 标准企业名称 :return: self.entid 标准企业id"""
<|body_1|>
def advance_import(self, entn... | stack_v2_sparse_classes_75kplus_train_073865 | 6,131 | no_license | [
{
"docstring": "获取来源id :param agentname: 来源名称 :return: self.agentid 来源id",
"name": "get_agent",
"signature": "def get_agent(self, agentname)"
},
{
"docstring": "获取标准企业id :param entname: 标准企业名称 :return: self.entid 标准企业id",
"name": "get_ent",
"signature": "def get_ent(self, entname)"
},
... | 5 | stack_v2_sparse_classes_30k_train_054596 | Implement the Python class `AdvanceManage` described below.
Class description:
Implement the AdvanceManage class.
Method signatures and docstrings:
- def get_agent(self, agentname): 获取来源id :param agentname: 来源名称 :return: self.agentid 来源id
- def get_ent(self, entname): 获取标准企业id :param entname: 标准企业名称 :return: self.ent... | Implement the Python class `AdvanceManage` described below.
Class description:
Implement the AdvanceManage class.
Method signatures and docstrings:
- def get_agent(self, agentname): 获取来源id :param agentname: 来源名称 :return: self.agentid 来源id
- def get_ent(self, entname): 获取标准企业id :param entname: 标准企业名称 :return: self.ent... | 7240500e63599033d904ac60b788ce4e8eec8746 | <|skeleton|>
class AdvanceManage:
def get_agent(self, agentname):
"""获取来源id :param agentname: 来源名称 :return: self.agentid 来源id"""
<|body_0|>
def get_ent(self, entname):
"""获取标准企业id :param entname: 标准企业名称 :return: self.entid 标准企业id"""
<|body_1|>
def advance_import(self, entn... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AdvanceManage:
def get_agent(self, agentname):
"""获取来源id :param agentname: 来源名称 :return: self.agentid 来源id"""
req = self.create_api(get_agent, CoopSts=1, RecordIndex=0, RecordSize=9999)
agentlist = req.json()['Data']['RecordList']
self.agentid = None
for i in range(len(... | the_stack_v2_python_sparse | common/lib/comm_func/advance_management.py | yhtnumberone/automatic_test | train | 0 | |
02787cf21447367a93a11764d58285a29207fdb2 | [
"if self.env['ir.config_parameter'].sudo().get_param('generate_payslip'):\n if self.env['ir.config_parameter'].sudo().get_param('option', 'first') == 'first':\n self.month_first()\n elif self.env['ir.config_parameter'].sudo().get_param('option', 'specific') == 'specific':\n self.specific_date()\... | <|body_start_0|>
if self.env['ir.config_parameter'].sudo().get_param('generate_payslip'):
if self.env['ir.config_parameter'].sudo().get_param('option', 'first') == 'first':
self.month_first()
elif self.env['ir.config_parameter'].sudo().get_param('option', 'specific') == '... | Automate payslip generation 1.Month First 2.Specific Date 3.Month End | HrPayslipRunCron | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HrPayslipRunCron:
"""Automate payslip generation 1.Month First 2.Specific Date 3.Month End"""
def _check(self):
"""Check the options and call the corresponding methods"""
<|body_0|>
def month_first(self):
"""Method for automate month first option"""
<|bod... | stack_v2_sparse_classes_75kplus_train_073866 | 5,128 | no_license | [
{
"docstring": "Check the options and call the corresponding methods",
"name": "_check",
"signature": "def _check(self)"
},
{
"docstring": "Method for automate month first option",
"name": "month_first",
"signature": "def month_first(self)"
},
{
"docstring": "Method for automate ... | 5 | stack_v2_sparse_classes_30k_train_014366 | Implement the Python class `HrPayslipRunCron` described below.
Class description:
Automate payslip generation 1.Month First 2.Specific Date 3.Month End
Method signatures and docstrings:
- def _check(self): Check the options and call the corresponding methods
- def month_first(self): Method for automate month first op... | Implement the Python class `HrPayslipRunCron` described below.
Class description:
Automate payslip generation 1.Month First 2.Specific Date 3.Month End
Method signatures and docstrings:
- def _check(self): Check the options and call the corresponding methods
- def month_first(self): Method for automate month first op... | 4b1bcb8f17aad44fe9c80a8180eb0128e6bb2c14 | <|skeleton|>
class HrPayslipRunCron:
"""Automate payslip generation 1.Month First 2.Specific Date 3.Month End"""
def _check(self):
"""Check the options and call the corresponding methods"""
<|body_0|>
def month_first(self):
"""Method for automate month first option"""
<|bod... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class HrPayslipRunCron:
"""Automate payslip generation 1.Month First 2.Specific Date 3.Month End"""
def _check(self):
"""Check the options and call the corresponding methods"""
if self.env['ir.config_parameter'].sudo().get_param('generate_payslip'):
if self.env['ir.config_parameter'... | the_stack_v2_python_sparse | automatic_payroll/models/auto_generate_payslips.py | CybroOdoo/CybroAddons | train | 209 |
caccb734707b1ce314af178a2558160ef6ccbaa1 | [
"files = self.files.getlist('file_field')\nfor file in files:\n validators.validate_filename(file.name)\n if not file:\n raise forms.ValidationError('Could not read file: %(file_name)s', params={'file_name': file.name})\nfor file in files:\n if file.size > ActiveProject.INDIVIDUAL_FILE_SIZE_LIMIT:\n... | <|body_start_0|>
files = self.files.getlist('file_field')
for file in files:
validators.validate_filename(file.name)
if not file:
raise forms.ValidationError('Could not read file: %(file_name)s', params={'file_name': file.name})
for file in files:
... | Form for uploading multiple files to a project. `subdir` is the project subdirectory relative to the file root. | UploadFilesForm | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UploadFilesForm:
"""Form for uploading multiple files to a project. `subdir` is the project subdirectory relative to the file root."""
def clean_file_field(self):
"""Check for file name, size limits and whether they are readable"""
<|body_0|>
def perform_action(self):
... | stack_v2_sparse_classes_75kplus_train_073867 | 45,155 | permissive | [
{
"docstring": "Check for file name, size limits and whether they are readable",
"name": "clean_file_field",
"signature": "def clean_file_field(self)"
},
{
"docstring": "Upload the files",
"name": "perform_action",
"signature": "def perform_action(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_043416 | Implement the Python class `UploadFilesForm` described below.
Class description:
Form for uploading multiple files to a project. `subdir` is the project subdirectory relative to the file root.
Method signatures and docstrings:
- def clean_file_field(self): Check for file name, size limits and whether they are readabl... | Implement the Python class `UploadFilesForm` described below.
Class description:
Form for uploading multiple files to a project. `subdir` is the project subdirectory relative to the file root.
Method signatures and docstrings:
- def clean_file_field(self): Check for file name, size limits and whether they are readabl... | 304e093dc550da8636552dc601d6545c07ffc771 | <|skeleton|>
class UploadFilesForm:
"""Form for uploading multiple files to a project. `subdir` is the project subdirectory relative to the file root."""
def clean_file_field(self):
"""Check for file name, size limits and whether they are readable"""
<|body_0|>
def perform_action(self):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class UploadFilesForm:
"""Form for uploading multiple files to a project. `subdir` is the project subdirectory relative to the file root."""
def clean_file_field(self):
"""Check for file name, size limits and whether they are readable"""
files = self.files.getlist('file_field')
for file... | the_stack_v2_python_sparse | physionet-django/project/forms.py | MIT-LCP/physionet-build | train | 50 |
33ec09ba13f6846d5027bb4199082f3bab99bd67 | [
"if not l or not r or r < l:\n return list()\nt = list()\nfor i in range(l, r + 1, 1):\n if self.is_self_dividing(i):\n t.append(i)\nreturn t",
"if not i:\n return False\np = i\nwhile p > 0:\n p, d = divmod(p, 10)\n if d == 0 or i % d != 0:\n return False\nreturn True"
] | <|body_start_0|>
if not l or not r or r < l:
return list()
t = list()
for i in range(l, r + 1, 1):
if self.is_self_dividing(i):
t.append(i)
return t
<|end_body_0|>
<|body_start_1|>
if not i:
return False
p = i
w... | Iteration over all integers in range. Time complexity: O(n ** m) - Amortized iterate over all integers and contained digits Space complexity: O(n) - Amortized store all integers in range | Solution2 | [
"Unlicense"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution2:
"""Iteration over all integers in range. Time complexity: O(n ** m) - Amortized iterate over all integers and contained digits Space complexity: O(n) - Amortized store all integers in range"""
def find_self_dividing_nums(self, l, r):
"""Determines all self-dividing numbers... | stack_v2_sparse_classes_75kplus_train_073868 | 3,918 | permissive | [
{
"docstring": "Determines all self-dividing numbers within target limits (inclusive). :param int l: lower limit of target range :param int r: upper limit of target range :return: array of all self-dividing numbers in range :rtype: list[int]",
"name": "find_self_dividing_nums",
"signature": "def find_se... | 2 | stack_v2_sparse_classes_30k_train_048281 | Implement the Python class `Solution2` described below.
Class description:
Iteration over all integers in range. Time complexity: O(n ** m) - Amortized iterate over all integers and contained digits Space complexity: O(n) - Amortized store all integers in range
Method signatures and docstrings:
- def find_self_dividi... | Implement the Python class `Solution2` described below.
Class description:
Iteration over all integers in range. Time complexity: O(n ** m) - Amortized iterate over all integers and contained digits Space complexity: O(n) - Amortized store all integers in range
Method signatures and docstrings:
- def find_self_dividi... | 69f90877c5466927e8b081c4268cbcda074813ec | <|skeleton|>
class Solution2:
"""Iteration over all integers in range. Time complexity: O(n ** m) - Amortized iterate over all integers and contained digits Space complexity: O(n) - Amortized store all integers in range"""
def find_self_dividing_nums(self, l, r):
"""Determines all self-dividing numbers... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution2:
"""Iteration over all integers in range. Time complexity: O(n ** m) - Amortized iterate over all integers and contained digits Space complexity: O(n) - Amortized store all integers in range"""
def find_self_dividing_nums(self, l, r):
"""Determines all self-dividing numbers within targe... | the_stack_v2_python_sparse | 0728_self_dividing_numbers/python_source.py | arthurdysart/LeetCode | train | 0 |
968b1b0349ce74e58af2193d7743ea3b4aafa6a4 | [
"def reverse(nl: ListNode):\n if nl is None or nl.next is None:\n return (nl, nl)\n hnode, tnode = reverse(nl.next)\n nl.next = None\n tnode.next = nl\n return (hnode, nl)\nret, _ = reverse(head)\nreturn ret",
"pre = None\nwhile head:\n pre, head.next, head = (head, pre, head.next)\nretur... | <|body_start_0|>
def reverse(nl: ListNode):
if nl is None or nl.next is None:
return (nl, nl)
hnode, tnode = reverse(nl.next)
nl.next = None
tnode.next = nl
return (hnode, nl)
ret, _ = reverse(head)
return ret
<|end_body... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def reverseList2(self, head: Optional[ListNode]) -> Optional[ListNode]:
"""20210907 Updated with recursively 28 / 28 test cases passed. Status: Accepted Runtime: 40 ms Memory Usage: 20.3 MB :param head: :return:"""
<|body_0|>
def reverseList(self, head: ListNode) -... | stack_v2_sparse_classes_75kplus_train_073869 | 1,605 | permissive | [
{
"docstring": "20210907 Updated with recursively 28 / 28 test cases passed. Status: Accepted Runtime: 40 ms Memory Usage: 20.3 MB :param head: :return:",
"name": "reverseList2",
"signature": "def reverseList2(self, head: Optional[ListNode]) -> Optional[ListNode]"
},
{
"docstring": "2022-08-23 :... | 2 | stack_v2_sparse_classes_30k_train_002180 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def reverseList2(self, head: Optional[ListNode]) -> Optional[ListNode]: 20210907 Updated with recursively 28 / 28 test cases passed. Status: Accepted Runtime: 40 ms Memory Usage:... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def reverseList2(self, head: Optional[ListNode]) -> Optional[ListNode]: 20210907 Updated with recursively 28 / 28 test cases passed. Status: Accepted Runtime: 40 ms Memory Usage:... | 4dd1e54d8d08f7e6590bc76abd08ecaacaf775e5 | <|skeleton|>
class Solution:
def reverseList2(self, head: Optional[ListNode]) -> Optional[ListNode]:
"""20210907 Updated with recursively 28 / 28 test cases passed. Status: Accepted Runtime: 40 ms Memory Usage: 20.3 MB :param head: :return:"""
<|body_0|>
def reverseList(self, head: ListNode) -... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def reverseList2(self, head: Optional[ListNode]) -> Optional[ListNode]:
"""20210907 Updated with recursively 28 / 28 test cases passed. Status: Accepted Runtime: 40 ms Memory Usage: 20.3 MB :param head: :return:"""
def reverse(nl: ListNode):
if nl is None or nl.next is No... | the_stack_v2_python_sparse | src/206-ReverseLinkedList.py | Jiezhi/myleetcode | train | 1 | |
23af437450c93a21c17140a2b45c0a7d7fbab986 | [
"\"\"\"\n self.head = head\n \"\"\"\nself.range = []\nwhile head:\n self.range.append(head.val)\n head = head.next",
"\"\"\"\n n, k = 1, 1\n head, ans = self.head, self.head\n while head.next:\n n += 1\n head = head.next\n if random() < k /... | <|body_start_0|>
"""
self.head = head
"""
self.range = []
while head:
self.range.append(head.val)
head = head.next
<|end_body_0|>
<|body_start_1|>
"""
n, k = 1, 1
head, ans = self.head, self.head
... | Solution | [
"CC0-1.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def __init__(self, head: ListNode):
"""@param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node."""
<|body_0|>
def getRandom(self) -> int:
"""Returns a random node's value."""
<|body_1|>
... | stack_v2_sparse_classes_75kplus_train_073870 | 1,892 | permissive | [
{
"docstring": "@param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node.",
"name": "__init__",
"signature": "def __init__(self, head: ListNode)"
},
{
"docstring": "Returns a random node's value.",
"name": "getRandom",
"signatu... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def __init__(self, head: ListNode): @param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node.
- def getRandom(self) -... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def __init__(self, head: ListNode): @param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node.
- def getRandom(self) -... | 4ea4c1579c28308455be4dfa02bd45ebd88b2d0a | <|skeleton|>
class Solution:
def __init__(self, head: ListNode):
"""@param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node."""
<|body_0|>
def getRandom(self) -> int:
"""Returns a random node's value."""
<|body_1|>
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def __init__(self, head: ListNode):
"""@param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node."""
"""
self.head = head
"""
self.range = []
while head:
self.range... | the_stack_v2_python_sparse | src/linkedLists/getRandom.py | way2arun/datastructures_algorithms | train | 1 | |
302c9e6b630d32c466166bb1e2c60c770e23c46c | [
"try:\n self.teaClassPractice = []\n self.sqlhandler = None\n if not utils.isUIDValid(self):\n self.write('no uid')\n return\n self.practiceId = self.get_argument('practiceId')\n self.StuId = self.get_argument('stuId')\n self.stuAnser = None\n if self.getAnswer():\n print(s... | <|body_start_0|>
try:
self.teaClassPractice = []
self.sqlhandler = None
if not utils.isUIDValid(self):
self.write('no uid')
return
self.practiceId = self.get_argument('practiceId')
self.StuId = self.get_argument('stuId')... | TeaGetStuPracticeAnswerListRequestHandler | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TeaGetStuPracticeAnswerListRequestHandler:
def get(self):
"""获取练习题答案,返回给老师客户端"""
<|body_0|>
def getAnswer(self):
"""查询学生练习答案"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
try:
self.teaClassPractice = []
self.sqlhandler = No... | stack_v2_sparse_classes_75kplus_train_073871 | 2,169 | no_license | [
{
"docstring": "获取练习题答案,返回给老师客户端",
"name": "get",
"signature": "def get(self)"
},
{
"docstring": "查询学生练习答案",
"name": "getAnswer",
"signature": "def getAnswer(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_039294 | Implement the Python class `TeaGetStuPracticeAnswerListRequestHandler` described below.
Class description:
Implement the TeaGetStuPracticeAnswerListRequestHandler class.
Method signatures and docstrings:
- def get(self): 获取练习题答案,返回给老师客户端
- def getAnswer(self): 查询学生练习答案 | Implement the Python class `TeaGetStuPracticeAnswerListRequestHandler` described below.
Class description:
Implement the TeaGetStuPracticeAnswerListRequestHandler class.
Method signatures and docstrings:
- def get(self): 获取练习题答案,返回给老师客户端
- def getAnswer(self): 查询学生练习答案
<|skeleton|>
class TeaGetStuPracticeAnswerListR... | b28eb4163b02bd0a931653b94851592f2654b199 | <|skeleton|>
class TeaGetStuPracticeAnswerListRequestHandler:
def get(self):
"""获取练习题答案,返回给老师客户端"""
<|body_0|>
def getAnswer(self):
"""查询学生练习答案"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TeaGetStuPracticeAnswerListRequestHandler:
def get(self):
"""获取练习题答案,返回给老师客户端"""
try:
self.teaClassPractice = []
self.sqlhandler = None
if not utils.isUIDValid(self):
self.write('no uid')
return
self.practiceId = s... | the_stack_v2_python_sparse | server/teacher/TeaGetStuPracticeAnswerListRequestHandler.py | lyh-ADT/edu-app | train | 1 | |
2f18f3c8a0a771e85fa9443767293cbc6b3a544f | [
"super().__init__()\nself.device = device\nself.tok_embedding = nn.Embedding(num_embeddings=input_dim, embedding_dim=hid_dim)\nself.pos_embedding = nn.Embedding(num_embeddings=max_length, embedding_dim=hid_dim)\nself.layers = nn.ModuleList([EncoderLayer(hid_dim, n_heads, pf_dim, dropout, device) for _ in range(n_la... | <|body_start_0|>
super().__init__()
self.device = device
self.tok_embedding = nn.Embedding(num_embeddings=input_dim, embedding_dim=hid_dim)
self.pos_embedding = nn.Embedding(num_embeddings=max_length, embedding_dim=hid_dim)
self.layers = nn.ModuleList([EncoderLayer(hid_dim, n_hea... | Encoder | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Encoder:
def __init__(self, input_dim: int, hid_dim: int, n_layers: int, n_heads: int, pf_dim: int, dropout: float, device: str, max_length=100):
"""Encoder wrapper for Transformer: preprocessing the input data, call EncoderLayer, and provide output Parameters ---------- input_dim: int i... | stack_v2_sparse_classes_75kplus_train_073872 | 25,270 | permissive | [
{
"docstring": "Encoder wrapper for Transformer: preprocessing the input data, call EncoderLayer, and provide output Parameters ---------- input_dim: int input dim of the word vector, not to the EncoderLayer hid_dim: int dim of the input to the EncoderLayer n_layers: int number of layers of the EncoderLayer n_h... | 2 | null | Implement the Python class `Encoder` described below.
Class description:
Implement the Encoder class.
Method signatures and docstrings:
- def __init__(self, input_dim: int, hid_dim: int, n_layers: int, n_heads: int, pf_dim: int, dropout: float, device: str, max_length=100): Encoder wrapper for Transformer: preprocess... | Implement the Python class `Encoder` described below.
Class description:
Implement the Encoder class.
Method signatures and docstrings:
- def __init__(self, input_dim: int, hid_dim: int, n_layers: int, n_heads: int, pf_dim: int, dropout: float, device: str, max_length=100): Encoder wrapper for Transformer: preprocess... | a6c870d4ed0788f15cfdf58c85ed5201dff60ee9 | <|skeleton|>
class Encoder:
def __init__(self, input_dim: int, hid_dim: int, n_layers: int, n_heads: int, pf_dim: int, dropout: float, device: str, max_length=100):
"""Encoder wrapper for Transformer: preprocessing the input data, call EncoderLayer, and provide output Parameters ---------- input_dim: int i... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Encoder:
def __init__(self, input_dim: int, hid_dim: int, n_layers: int, n_heads: int, pf_dim: int, dropout: float, device: str, max_length=100):
"""Encoder wrapper for Transformer: preprocessing the input data, call EncoderLayer, and provide output Parameters ---------- input_dim: int input dim of th... | the_stack_v2_python_sparse | src/gated_transformers_nlp/utils/original_transformers/model.py | mnguyen0226/gated_transformers_nlp | train | 2 | |
ccf8fed0a89f01332434d4ec3042641cfb52f497 | [
"super().__init__(pretrained_model_name_or_path=pretrained_model_name_or_path, model_type=model_type, language=language, n_added_tokens=n_added_tokens, use_auth_token=use_auth_token, model_kwargs=model_kwargs)\nconfig = self.model.config\nsequence_summary_config = POOLER_PARAMETERS.get(self.name.lower(), {})\nfor k... | <|body_start_0|>
super().__init__(pretrained_model_name_or_path=pretrained_model_name_or_path, model_type=model_type, language=language, n_added_tokens=n_added_tokens, use_auth_token=use_auth_token, model_kwargs=model_kwargs)
config = self.model.config
sequence_summary_config = POOLER_PARAMETERS... | A model that wraps Hugging Face's implementation (https://github.com/huggingface/transformers) to fit the LanguageModel class, with an extra pooler. NOTE: - Unlike the other BERT variants, these don't output the `pooled_output`. An additional pooler is initialized. | HFLanguageModelWithPooler | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HFLanguageModelWithPooler:
"""A model that wraps Hugging Face's implementation (https://github.com/huggingface/transformers) to fit the LanguageModel class, with an extra pooler. NOTE: - Unlike the other BERT variants, these don't output the `pooled_output`. An additional pooler is initialized.""... | stack_v2_sparse_classes_75kplus_train_073873 | 45,397 | permissive | [
{
"docstring": "Load a pretrained model by supplying one of the following: * The name of a remote model on s3 (for example, \"distilbert-base-german-cased\") * A local path of a model trained using transformers (for example, \"some_dir/huggingface_model\") * A local path of a model trained using Haystack (for e... | 2 | null | Implement the Python class `HFLanguageModelWithPooler` described below.
Class description:
A model that wraps Hugging Face's implementation (https://github.com/huggingface/transformers) to fit the LanguageModel class, with an extra pooler. NOTE: - Unlike the other BERT variants, these don't output the `pooled_output`.... | Implement the Python class `HFLanguageModelWithPooler` described below.
Class description:
A model that wraps Hugging Face's implementation (https://github.com/huggingface/transformers) to fit the LanguageModel class, with an extra pooler. NOTE: - Unlike the other BERT variants, these don't output the `pooled_output`.... | 5f1256ac7e5734c2ea481e72cb7e02c34baf8c43 | <|skeleton|>
class HFLanguageModelWithPooler:
"""A model that wraps Hugging Face's implementation (https://github.com/huggingface/transformers) to fit the LanguageModel class, with an extra pooler. NOTE: - Unlike the other BERT variants, these don't output the `pooled_output`. An additional pooler is initialized.""... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class HFLanguageModelWithPooler:
"""A model that wraps Hugging Face's implementation (https://github.com/huggingface/transformers) to fit the LanguageModel class, with an extra pooler. NOTE: - Unlike the other BERT variants, these don't output the `pooled_output`. An additional pooler is initialized."""
def __... | the_stack_v2_python_sparse | haystack/modeling/model/language_model.py | deepset-ai/haystack | train | 10,599 |
073503454ae8fa5fd8a39216f87beaabdbf03d1f | [
"self.event_count_dict = dict()\nself.prior_count_dict = dict()\nself.attrs = df.columns\nself.size = 0\nfor attr in self.attrs:\n for attr_val, label in zip(df[attr], y):\n event = '{}={}'.format(attr, attr_val)\n if (event, label) in self.event_count_dict:\n self.event_count_dict[event... | <|body_start_0|>
self.event_count_dict = dict()
self.prior_count_dict = dict()
self.attrs = df.columns
self.size = 0
for attr in self.attrs:
for attr_val, label in zip(df[attr], y):
event = '{}={}'.format(attr, attr_val)
if (event, labe... | NB | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NB:
def fit(self, df, y):
"""Accumulate the count for class prior and individual joint event"""
<|body_0|>
def conditional_proba(self, attr, attr_val, label):
"""Compute the conditional probability"""
<|body_1|>
def predict(self, X):
"""Predict t... | stack_v2_sparse_classes_75kplus_train_073874 | 4,003 | no_license | [
{
"docstring": "Accumulate the count for class prior and individual joint event",
"name": "fit",
"signature": "def fit(self, df, y)"
},
{
"docstring": "Compute the conditional probability",
"name": "conditional_proba",
"signature": "def conditional_proba(self, attr, attr_val, label)"
}... | 3 | null | Implement the Python class `NB` described below.
Class description:
Implement the NB class.
Method signatures and docstrings:
- def fit(self, df, y): Accumulate the count for class prior and individual joint event
- def conditional_proba(self, attr, attr_val, label): Compute the conditional probability
- def predict(... | Implement the Python class `NB` described below.
Class description:
Implement the NB class.
Method signatures and docstrings:
- def fit(self, df, y): Accumulate the count for class prior and individual joint event
- def conditional_proba(self, attr, attr_val, label): Compute the conditional probability
- def predict(... | 2dec992716b0166196efc72b1e275c82afdf7ebe | <|skeleton|>
class NB:
def fit(self, df, y):
"""Accumulate the count for class prior and individual joint event"""
<|body_0|>
def conditional_proba(self, attr, attr_val, label):
"""Compute the conditional probability"""
<|body_1|>
def predict(self, X):
"""Predict t... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class NB:
def fit(self, df, y):
"""Accumulate the count for class prior and individual joint event"""
self.event_count_dict = dict()
self.prior_count_dict = dict()
self.attrs = df.columns
self.size = 0
for attr in self.attrs:
for attr_val, label in zip(df[... | the_stack_v2_python_sparse | lab_quiz/quiz9/build_naive_bayes.py | freekid00/ACT4311 | train | 0 | |
a948eb55485fea45858b883e7a7f6fa517b8d816 | [
"dataset_args = ()\ndataset_kwargs = {'cache_dir': cache_dir, 'languages': languages}\nsuper().__init__(dataset_args=dataset_args, dataset_kwargs=dataset_kwargs)",
"print(self.instantiation_guide)\nlanguages = kwargs['languages']\nkwargs.pop('languages', None)\nif languages == 'all':\n selected_languages = sel... | <|body_start_0|>
dataset_args = ()
dataset_kwargs = {'cache_dir': cache_dir, 'languages': languages}
super().__init__(dataset_args=dataset_args, dataset_kwargs=dataset_kwargs)
<|end_body_0|>
<|body_start_1|>
print(self.instantiation_guide)
languages = kwargs['languages']
... | The XLSum dataset - A massively multilingual dataset including 45 languages Contains 1.35 million article-summary pairs from BBC in the following languages: | XlsumDataset | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class XlsumDataset:
"""The XLSum dataset - A massively multilingual dataset including 45 languages Contains 1.35 million article-summary pairs from BBC in the following languages:"""
def __init__(self, languages: Union[str, List[str]], cache_dir: Optional[str]=None):
"""Create dataset info... | stack_v2_sparse_classes_75kplus_train_073875 | 33,443 | permissive | [
{
"docstring": "Create dataset information from the huggingface Dataset class :rtype: object :param languages: Optional, a str or a list[str] specifying languages to be included :param cache_dir: Optional, a str specifying where to download/load the dataset to/from",
"name": "__init__",
"signature": "de... | 4 | null | Implement the Python class `XlsumDataset` described below.
Class description:
The XLSum dataset - A massively multilingual dataset including 45 languages Contains 1.35 million article-summary pairs from BBC in the following languages:
Method signatures and docstrings:
- def __init__(self, languages: Union[str, List[s... | Implement the Python class `XlsumDataset` described below.
Class description:
The XLSum dataset - A massively multilingual dataset including 45 languages Contains 1.35 million article-summary pairs from BBC in the following languages:
Method signatures and docstrings:
- def __init__(self, languages: Union[str, List[s... | 761676ddda5dce5cf776ab16ee38b6d995b631ac | <|skeleton|>
class XlsumDataset:
"""The XLSum dataset - A massively multilingual dataset including 45 languages Contains 1.35 million article-summary pairs from BBC in the following languages:"""
def __init__(self, languages: Union[str, List[str]], cache_dir: Optional[str]=None):
"""Create dataset info... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class XlsumDataset:
"""The XLSum dataset - A massively multilingual dataset including 45 languages Contains 1.35 million article-summary pairs from BBC in the following languages:"""
def __init__(self, languages: Union[str, List[str]], cache_dir: Optional[str]=None):
"""Create dataset information from ... | the_stack_v2_python_sparse | summertime/dataset/dataset_loaders.py | Yale-LILY/SummerTime | train | 232 |
4a1e933f7afeda8e69f5199150428a7462843d67 | [
"super(GeoMAN_DataLoader, self).__init__(closeness_len=input_steps, period_len=input_steps, trend_len=input_steps, target_length=output_steps, **kwargs)\nself.input_steps = input_steps\nself.output_steps = output_steps\nself.move_ef = MoveSample(input_steps, 0, 0, output_steps)\nself.train_local_features, self.trai... | <|body_start_0|>
super(GeoMAN_DataLoader, self).__init__(closeness_len=input_steps, period_len=input_steps, trend_len=input_steps, target_length=output_steps, **kwargs)
self.input_steps = input_steps
self.output_steps = output_steps
self.move_ef = MoveSample(input_steps, 0, 0, output_ste... | GeoMAN_DataLoader | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GeoMAN_DataLoader:
def __init__(self, input_steps=12, output_steps=1, **kwargs):
"""A wrapper of ``NodeTrafficLoader`` to make its data form compatible with GeoMAN's inputs. Args: input_steps (int): The length of historical input data, a.k.a, input timesteps. Default: 12 output_steps (in... | stack_v2_sparse_classes_75kplus_train_073876 | 6,962 | permissive | [
{
"docstring": "A wrapper of ``NodeTrafficLoader`` to make its data form compatible with GeoMAN's inputs. Args: input_steps (int): The length of historical input data, a.k.a, input timesteps. Default: 12 output_steps (int): The number of steps that need prediction by one piece of history data, a.k.a, output tim... | 2 | null | Implement the Python class `GeoMAN_DataLoader` described below.
Class description:
Implement the GeoMAN_DataLoader class.
Method signatures and docstrings:
- def __init__(self, input_steps=12, output_steps=1, **kwargs): A wrapper of ``NodeTrafficLoader`` to make its data form compatible with GeoMAN's inputs. Args: in... | Implement the Python class `GeoMAN_DataLoader` described below.
Class description:
Implement the GeoMAN_DataLoader class.
Method signatures and docstrings:
- def __init__(self, input_steps=12, output_steps=1, **kwargs): A wrapper of ``NodeTrafficLoader`` to make its data form compatible with GeoMAN's inputs. Args: in... | c5a59769fe61c1126fe59ee4e7c8dcfb651bb6ee | <|skeleton|>
class GeoMAN_DataLoader:
def __init__(self, input_steps=12, output_steps=1, **kwargs):
"""A wrapper of ``NodeTrafficLoader`` to make its data form compatible with GeoMAN's inputs. Args: input_steps (int): The length of historical input data, a.k.a, input timesteps. Default: 12 output_steps (in... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GeoMAN_DataLoader:
def __init__(self, input_steps=12, output_steps=1, **kwargs):
"""A wrapper of ``NodeTrafficLoader`` to make its data form compatible with GeoMAN's inputs. Args: input_steps (int): The length of historical input data, a.k.a, input timesteps. Default: 12 output_steps (int): The number... | the_stack_v2_python_sparse | QuickStarts/GeoMAN.py | GRE-EXAMINATION/UCTB | train | 2 | |
2e808586873dc7f567fb12d1b9e04ccf1368ea80 | [
"elements = self.driver.find_elements(*AdminPageLocators.CATALOG)\nfor element in elements:\n if element.text == 'Catalog':\n catalog = element\n break\ncatalog.click()",
"catalog_elements = self.driver.find_elements(*AdminPageLocators.CATALOG_ELEMENTS)\nfor catalog_element in catalog_elements:\n... | <|body_start_0|>
elements = self.driver.find_elements(*AdminPageLocators.CATALOG)
for element in elements:
if element.text == 'Catalog':
catalog = element
break
catalog.click()
<|end_body_0|>
<|body_start_1|>
catalog_elements = self.driver.fin... | Admin page class | AdminPage | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AdminPage:
"""Admin page class"""
def choose_catalog(self):
"""public method to choose catalog in menu"""
<|body_0|>
def choose_catalog_element(self, element_name):
"""public method to choose catalog element"""
<|body_1|>
<|end_skeleton|>
<|body_start_0... | stack_v2_sparse_classes_75kplus_train_073877 | 5,320 | permissive | [
{
"docstring": "public method to choose catalog in menu",
"name": "choose_catalog",
"signature": "def choose_catalog(self)"
},
{
"docstring": "public method to choose catalog element",
"name": "choose_catalog_element",
"signature": "def choose_catalog_element(self, element_name)"
}
] | 2 | stack_v2_sparse_classes_30k_train_044089 | Implement the Python class `AdminPage` described below.
Class description:
Admin page class
Method signatures and docstrings:
- def choose_catalog(self): public method to choose catalog in menu
- def choose_catalog_element(self, element_name): public method to choose catalog element | Implement the Python class `AdminPage` described below.
Class description:
Admin page class
Method signatures and docstrings:
- def choose_catalog(self): public method to choose catalog in menu
- def choose_catalog_element(self, element_name): public method to choose catalog element
<|skeleton|>
class AdminPage:
... | 9d7e31317857801735bad8c05e2c15757dab0ab1 | <|skeleton|>
class AdminPage:
"""Admin page class"""
def choose_catalog(self):
"""public method to choose catalog in menu"""
<|body_0|>
def choose_catalog_element(self, element_name):
"""public method to choose catalog element"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AdminPage:
"""Admin page class"""
def choose_catalog(self):
"""public method to choose catalog in menu"""
elements = self.driver.find_elements(*AdminPageLocators.CATALOG)
for element in elements:
if element.text == 'Catalog':
catalog = element
... | the_stack_v2_python_sparse | lesson_8/pages.py | Sokolov85/otus-qa-course | train | 0 |
6e21041c69338a7111dcc3d4b036d2c4ca2e2e44 | [
"if identifier.startswith('T'):\n return ({'message': babel('No information on temp registrations.')}, 200)\nbusiness = Business.find_by_identifier(identifier)\nif not business:\n return (jsonify({'message': f'{identifier} not found'}), HTTPStatus.NOT_FOUND)\nif not authorized(identifier, jwt, action=['view']... | <|body_start_0|>
if identifier.startswith('T'):
return ({'message': babel('No information on temp registrations.')}, 200)
business = Business.find_by_identifier(identifier)
if not business:
return (jsonify({'message': f'{identifier} not found'}), HTTPStatus.NOT_FOUND)
... | Meta information about the overall service. | BusinessResource | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BusinessResource:
"""Meta information about the overall service."""
def get(identifier: str):
"""Return a JSON object with meta information about the Service."""
<|body_0|>
def post():
"""Create a valid filing, else error out."""
<|body_1|>
<|end_skeleto... | stack_v2_sparse_classes_75kplus_train_073878 | 4,386 | permissive | [
{
"docstring": "Return a JSON object with meta information about the Service.",
"name": "get",
"signature": "def get(identifier: str)"
},
{
"docstring": "Create a valid filing, else error out.",
"name": "post",
"signature": "def post()"
}
] | 2 | stack_v2_sparse_classes_30k_train_039221 | Implement the Python class `BusinessResource` described below.
Class description:
Meta information about the overall service.
Method signatures and docstrings:
- def get(identifier: str): Return a JSON object with meta information about the Service.
- def post(): Create a valid filing, else error out. | Implement the Python class `BusinessResource` described below.
Class description:
Meta information about the overall service.
Method signatures and docstrings:
- def get(identifier: str): Return a JSON object with meta information about the Service.
- def post(): Create a valid filing, else error out.
<|skeleton|>
c... | d90f11a7b14411b02c07fe97d2c1fc31cd4a9b32 | <|skeleton|>
class BusinessResource:
"""Meta information about the overall service."""
def get(identifier: str):
"""Return a JSON object with meta information about the Service."""
<|body_0|>
def post():
"""Create a valid filing, else error out."""
<|body_1|>
<|end_skeleto... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BusinessResource:
"""Meta information about the overall service."""
def get(identifier: str):
"""Return a JSON object with meta information about the Service."""
if identifier.startswith('T'):
return ({'message': babel('No information on temp registrations.')}, 200)
bu... | the_stack_v2_python_sparse | legal-api/src/legal_api/resources/v1/business/business.py | bcgov/lear | train | 13 |
00715fd902c00a250461844d54fd9f4cf925c054 | [
"super(File, self).__init__(name, **kwargs)\nself.modulename = modulename\nself.content = content",
"if inline:\n if 'source' in self:\n raise ValueError(\"source tarballs can't be dumped as strings.\")\n if getattr(self, 'content', None) is not None:\n self['content'] = self.content\n ... | <|body_start_0|>
super(File, self).__init__(name, **kwargs)
self.modulename = modulename
self.content = content
<|end_body_0|>
<|body_start_1|>
if inline:
if 'source' in self:
raise ValueError("source tarballs can't be dumped as strings.")
if geta... | Puppet file resource. | File | [
"BSD-2-Clause-Views",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class File:
"""Puppet file resource."""
def __init__(self, name, modulename=None, content=None, **kwargs):
"""File resources handle their content explicitly because in some cases it is not written as a normal parameter."""
<|body_0|>
def dumps(self, inline=False, tab=''):
... | stack_v2_sparse_classes_75kplus_train_073879 | 20,994 | permissive | [
{
"docstring": "File resources handle their content explicitly because in some cases it is not written as a normal parameter.",
"name": "__init__",
"signature": "def __init__(self, name, modulename=None, content=None, **kwargs)"
},
{
"docstring": "Treat the content as a normal parameter if and o... | 2 | stack_v2_sparse_classes_30k_train_051505 | Implement the Python class `File` described below.
Class description:
Puppet file resource.
Method signatures and docstrings:
- def __init__(self, name, modulename=None, content=None, **kwargs): File resources handle their content explicitly because in some cases it is not written as a normal parameter.
- def dumps(s... | Implement the Python class `File` described below.
Class description:
Puppet file resource.
Method signatures and docstrings:
- def __init__(self, name, modulename=None, content=None, **kwargs): File resources handle their content explicitly because in some cases it is not written as a normal parameter.
- def dumps(s... | dffdcd0792a9c66ec218f0a2baf416292e59afcd | <|skeleton|>
class File:
"""Puppet file resource."""
def __init__(self, name, modulename=None, content=None, **kwargs):
"""File resources handle their content explicitly because in some cases it is not written as a normal parameter."""
<|body_0|>
def dumps(self, inline=False, tab=''):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class File:
"""Puppet file resource."""
def __init__(self, name, modulename=None, content=None, **kwargs):
"""File resources handle their content explicitly because in some cases it is not written as a normal parameter."""
super(File, self).__init__(name, **kwargs)
self.modulename = mod... | the_stack_v2_python_sparse | blueprint/frontend/puppet.py | sarguru/blueprint | train | 1 |
2c8a3e77dfc920ac8318c95ab3441c439dc35506 | [
"super(PyMimeData, self).__init__()\nself._instance = instance\nself.setData(self.MIME_TYPE, '1')",
"if str(mime_type) == self.MIME_TYPE:\n return self._instance\nreturn super(PyMimeData, self).data(mime_type)"
] | <|body_start_0|>
super(PyMimeData, self).__init__()
self._instance = instance
self.setData(self.MIME_TYPE, '1')
<|end_body_0|>
<|body_start_1|>
if str(mime_type) == self.MIME_TYPE:
return self._instance
return super(PyMimeData, self).data(mime_type)
<|end_body_1|>
| Stores references to live python objects. Normal QMimeData instances store all data as QByteArrays. This makes it hard to pass around live python objects in drag/drop events, since one would have to convert between object references and byte sequences. The object to store is passed to the constructor, and stored in the... | PyMimeData | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PyMimeData:
"""Stores references to live python objects. Normal QMimeData instances store all data as QByteArrays. This makes it hard to pass around live python objects in drag/drop events, since one would have to convert between object references and byte sequences. The object to store is passed... | stack_v2_sparse_classes_75kplus_train_073880 | 5,146 | no_license | [
{
"docstring": ":param instance: The python object to store",
"name": "__init__",
"signature": "def __init__(self, instance)"
},
{
"docstring": "Retrieve the data stored at the specified mime_type If mime_type is application/py_instance, a python object is returned. Otherwise, a QByteArray is re... | 2 | null | Implement the Python class `PyMimeData` described below.
Class description:
Stores references to live python objects. Normal QMimeData instances store all data as QByteArrays. This makes it hard to pass around live python objects in drag/drop events, since one would have to convert between object references and byte s... | Implement the Python class `PyMimeData` described below.
Class description:
Stores references to live python objects. Normal QMimeData instances store all data as QByteArrays. This makes it hard to pass around live python objects in drag/drop events, since one would have to convert between object references and byte s... | e7d869363c7784c3a7d8f8b73a4b17fb21208b44 | <|skeleton|>
class PyMimeData:
"""Stores references to live python objects. Normal QMimeData instances store all data as QByteArrays. This makes it hard to pass around live python objects in drag/drop events, since one would have to convert between object references and byte sequences. The object to store is passed... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PyMimeData:
"""Stores references to live python objects. Normal QMimeData instances store all data as QByteArrays. This makes it hard to pass around live python objects in drag/drop events, since one would have to convert between object references and byte sequences. The object to store is passed to the const... | the_stack_v2_python_sparse | glue/qt/qtutil.py | drphilmarshall/glue | train | 0 |
8c69b04818eb1c529b6ad11ac1a9de153b213ba5 | [
"self.ds_type = 10\nself.num_elements = num_elements\nself.element_multiplier = element_multiplier\nself.image = 0\nself.name_len = 8\nself.Name = 'E000001\\x00'\nself.Velocities = []\nfor bins in range(num_elements):\n bins = []\n for beams in range(element_multiplier):\n bins.append([Ensemble().BadVe... | <|body_start_0|>
self.ds_type = 10
self.num_elements = num_elements
self.element_multiplier = element_multiplier
self.image = 0
self.name_len = 8
self.Name = 'E000001\x00'
self.Velocities = []
for bins in range(num_elements):
bins = []
... | Beam Velocity DataSet. [Bin x Beam] data. | BeamVelocity | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BeamVelocity:
"""Beam Velocity DataSet. [Bin x Beam] data."""
def __init__(self, num_elements, element_multiplier):
"""Beam Velocity data. :param num_elements: Number of bins :param element_multiplier: Number of beams."""
<|body_0|>
def decode(self, data):
"""Tak... | stack_v2_sparse_classes_75kplus_train_073881 | 4,649 | no_license | [
{
"docstring": "Beam Velocity data. :param num_elements: Number of bins :param element_multiplier: Number of beams.",
"name": "__init__",
"signature": "def __init__(self, num_elements, element_multiplier)"
},
{
"docstring": "Take the data bytearray. Decode the data to populate the velocities. :p... | 5 | stack_v2_sparse_classes_30k_train_041750 | Implement the Python class `BeamVelocity` described below.
Class description:
Beam Velocity DataSet. [Bin x Beam] data.
Method signatures and docstrings:
- def __init__(self, num_elements, element_multiplier): Beam Velocity data. :param num_elements: Number of bins :param element_multiplier: Number of beams.
- def de... | Implement the Python class `BeamVelocity` described below.
Class description:
Beam Velocity DataSet. [Bin x Beam] data.
Method signatures and docstrings:
- def __init__(self, num_elements, element_multiplier): Beam Velocity data. :param num_elements: Number of bins :param element_multiplier: Number of beams.
- def de... | 384edef9c14ae5296d7e123eec473b29905a8a58 | <|skeleton|>
class BeamVelocity:
"""Beam Velocity DataSet. [Bin x Beam] data."""
def __init__(self, num_elements, element_multiplier):
"""Beam Velocity data. :param num_elements: Number of bins :param element_multiplier: Number of beams."""
<|body_0|>
def decode(self, data):
"""Tak... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BeamVelocity:
"""Beam Velocity DataSet. [Bin x Beam] data."""
def __init__(self, num_elements, element_multiplier):
"""Beam Velocity data. :param num_elements: Number of bins :param element_multiplier: Number of beams."""
self.ds_type = 10
self.num_elements = num_elements
... | the_stack_v2_python_sparse | Ensemble/BeamVelocity.py | ricorx7/rti_python-1 | train | 0 |
dce7e2a1860729468e4f9d11fd9097e41b0673e4 | [
"self.extent = width / 2.0\nself.frame = frame\nself.sub = rospy.Subscriber('input_scan', LaserScan, self.filter_scan, queue_size=1)\nself.pub = rospy.Publisher('output_scan', LaserScan, queue_size=10)\nself.listener = tf.TransformListener()\nself.cloud = PointCloud()",
"self.cloud.header = msg.header\nangles = l... | <|body_start_0|>
self.extent = width / 2.0
self.frame = frame
self.sub = rospy.Subscriber('input_scan', LaserScan, self.filter_scan, queue_size=1)
self.pub = rospy.Publisher('output_scan', LaserScan, queue_size=10)
self.listener = tf.TransformListener()
self.cloud = Point... | A class that implements a LaserScan filter that removes all of the points that are not in front of the robot. | FrontFilter | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FrontFilter:
"""A class that implements a LaserScan filter that removes all of the points that are not in front of the robot."""
def __init__(self, width, frame):
""":param self: The self reference. :param width: The width of the robot. :param frame: The base coordinate frame of the ... | stack_v2_sparse_classes_75kplus_train_073882 | 2,996 | permissive | [
{
"docstring": ":param self: The self reference. :param width: The width of the robot. :param frame: The base coordinate frame of the robot.",
"name": "__init__",
"signature": "def __init__(self, width, frame)"
},
{
"docstring": ":param self: Self reference. :param msg: LaserScan message.",
... | 2 | stack_v2_sparse_classes_30k_train_042987 | Implement the Python class `FrontFilter` described below.
Class description:
A class that implements a LaserScan filter that removes all of the points that are not in front of the robot.
Method signatures and docstrings:
- def __init__(self, width, frame): :param self: The self reference. :param width: The width of t... | Implement the Python class `FrontFilter` described below.
Class description:
A class that implements a LaserScan filter that removes all of the points that are not in front of the robot.
Method signatures and docstrings:
- def __init__(self, width, frame): :param self: The self reference. :param width: The width of t... | 0da63ef9a36e174f782c00f56099eb71bc15ca8b | <|skeleton|>
class FrontFilter:
"""A class that implements a LaserScan filter that removes all of the points that are not in front of the robot."""
def __init__(self, width, frame):
""":param self: The self reference. :param width: The width of the robot. :param frame: The base coordinate frame of the ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class FrontFilter:
"""A class that implements a LaserScan filter that removes all of the points that are not in front of the robot."""
def __init__(self, width, frame):
""":param self: The self reference. :param width: The width of the robot. :param frame: The base coordinate frame of the robot."""
... | the_stack_v2_python_sparse | rob599_hw1_ref/src/front_filter_faster.py | patu0/rob599 | train | 0 |
d2d27c2d852ca82fa3c013df2f1cf08049f297db | [
"value = proposal['value']\nif value is None:\n return value\nif self.min and self.min > value:\n value = max(value, self.min)\nif self.max and self.max < value:\n value = min(value, self.max)\nreturn value",
"min = proposal['value']\nif min is None:\n return min\nif self.max and min > self.max:\n ... | <|body_start_0|>
value = proposal['value']
if value is None:
return value
if self.min and self.min > value:
value = max(value, self.min)
if self.max and self.max < value:
value = min(value, self.max)
return value
<|end_body_0|>
<|body_start_1|... | Display a widget for picking dates. Parameters ---------- value: datetime.date The current value of the widget. disabled: bool Whether to disable user changes. Examples -------- >>> import datetime >>> import ipywidgets as widgets >>> date_pick = widgets.DatePicker() >>> date_pick.value = datetime.date(2019, 7, 9) | DatePicker | [
"BSD-3-Clause",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DatePicker:
"""Display a widget for picking dates. Parameters ---------- value: datetime.date The current value of the widget. disabled: bool Whether to disable user changes. Examples -------- >>> import datetime >>> import ipywidgets as widgets >>> date_pick = widgets.DatePicker() >>> date_pick.... | stack_v2_sparse_classes_75kplus_train_073883 | 2,597 | permissive | [
{
"docstring": "Cap and floor value",
"name": "_validate_value",
"signature": "def _validate_value(self, proposal)"
},
{
"docstring": "Enforce min <= value <= max",
"name": "_validate_min",
"signature": "def _validate_min(self, proposal)"
},
{
"docstring": "Enforce min <= value <... | 3 | stack_v2_sparse_classes_30k_train_018321 | Implement the Python class `DatePicker` described below.
Class description:
Display a widget for picking dates. Parameters ---------- value: datetime.date The current value of the widget. disabled: bool Whether to disable user changes. Examples -------- >>> import datetime >>> import ipywidgets as widgets >>> date_pic... | Implement the Python class `DatePicker` described below.
Class description:
Display a widget for picking dates. Parameters ---------- value: datetime.date The current value of the widget. disabled: bool Whether to disable user changes. Examples -------- >>> import datetime >>> import ipywidgets as widgets >>> date_pic... | f5042e35b945aded77b23470ead62d7eacefde92 | <|skeleton|>
class DatePicker:
"""Display a widget for picking dates. Parameters ---------- value: datetime.date The current value of the widget. disabled: bool Whether to disable user changes. Examples -------- >>> import datetime >>> import ipywidgets as widgets >>> date_pick = widgets.DatePicker() >>> date_pick.... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DatePicker:
"""Display a widget for picking dates. Parameters ---------- value: datetime.date The current value of the widget. disabled: bool Whether to disable user changes. Examples -------- >>> import datetime >>> import ipywidgets as widgets >>> date_pick = widgets.DatePicker() >>> date_pick.value = datet... | the_stack_v2_python_sparse | contrib/python/ipywidgets/py3/ipywidgets/widgets/widget_date.py | catboost/catboost | train | 8,012 |
46c46bd40c3665869143c508aca56c9fc0c0ee36 | [
"body = eval(response_self.request.body)\nuser_id = str(body['userId'])\ndata = str(body['data'])\nif not (judgeIfPermiss(user_id=user_id, mode=1, page='systemUsers') == True or judgeIfPermiss(user_id=user_id, mode=1, page='systemRoleTeam') == True or judgeIfPermiss(user_id=user_id, mode=1, page='systemUserTeam') =... | <|body_start_0|>
body = eval(response_self.request.body)
user_id = str(body['userId'])
data = str(body['data'])
if not (judgeIfPermiss(user_id=user_id, mode=1, page='systemUsers') == True or judgeIfPermiss(user_id=user_id, mode=1, page='systemRoleTeam') == True or judgeIfPermiss(user_id=... | 添加一个用户,前端发送来的信息为: "userId": "admin", "data": { "name": "用户三", "description": "巴拉巴拉", "userTeamName": "用户组一", "roleTeamName": "角色组一", "passWord": "1234", } 本函数接收该信息,判断userId用户是否拥有该权限并根据结果将其添加入库,返回: { "status": 1, #1表示成功,0表示失败 "errorInfo": "用户没有权限设置", #status为0时,前端展示errorinfo } | AddOneUser | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AddOneUser:
"""添加一个用户,前端发送来的信息为: "userId": "admin", "data": { "name": "用户三", "description": "巴拉巴拉", "userTeamName": "用户组一", "roleTeamName": "角色组一", "passWord": "1234", } 本函数接收该信息,判断userId用户是否拥有该权限并根据结果将其添加入库,返回: { "status": 1, #1表示成功,0表示失败 "errorInfo": "用户没有权限设置", #status为0时,前端展示errorinfo }"""
... | stack_v2_sparse_classes_75kplus_train_073884 | 2,980 | no_license | [
{
"docstring": "response为tornado下get函数接收到前端数据后的self",
"name": "entry",
"signature": "def entry(self, response_self)"
},
{
"docstring": "对前端发来的data进行校验",
"name": "judgePara",
"signature": "def judgePara(self, data)"
},
{
"docstring": "将data中用户信息入库",
"name": "insertInMysql",
... | 3 | null | Implement the Python class `AddOneUser` described below.
Class description:
添加一个用户,前端发送来的信息为: "userId": "admin", "data": { "name": "用户三", "description": "巴拉巴拉", "userTeamName": "用户组一", "roleTeamName": "角色组一", "passWord": "1234", } 本函数接收该信息,判断userId用户是否拥有该权限并根据结果将其添加入库,返回: { "status": 1, #1表示成功,0表示失败 "errorInfo": "用户没有... | Implement the Python class `AddOneUser` described below.
Class description:
添加一个用户,前端发送来的信息为: "userId": "admin", "data": { "name": "用户三", "description": "巴拉巴拉", "userTeamName": "用户组一", "roleTeamName": "角色组一", "passWord": "1234", } 本函数接收该信息,判断userId用户是否拥有该权限并根据结果将其添加入库,返回: { "status": 1, #1表示成功,0表示失败 "errorInfo": "用户没有... | a31364869894c72349e3587944ecb4fda018e020 | <|skeleton|>
class AddOneUser:
"""添加一个用户,前端发送来的信息为: "userId": "admin", "data": { "name": "用户三", "description": "巴拉巴拉", "userTeamName": "用户组一", "roleTeamName": "角色组一", "passWord": "1234", } 本函数接收该信息,判断userId用户是否拥有该权限并根据结果将其添加入库,返回: { "status": 1, #1表示成功,0表示失败 "errorInfo": "用户没有权限设置", #status为0时,前端展示errorinfo }"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AddOneUser:
"""添加一个用户,前端发送来的信息为: "userId": "admin", "data": { "name": "用户三", "description": "巴拉巴拉", "userTeamName": "用户组一", "roleTeamName": "角色组一", "passWord": "1234", } 本函数接收该信息,判断userId用户是否拥有该权限并根据结果将其添加入库,返回: { "status": 1, #1表示成功,0表示失败 "errorInfo": "用户没有权限设置", #status为0时,前端展示errorinfo }"""
def entry(... | the_stack_v2_python_sparse | tornado/system/add_one_user.py | fxrc/care-system | train | 1 |
e9999c112fed2aa27840f65a0c410a5206c026c7 | [
"res = []\nnums.sort()\ni = 0\nfor n in range(1, len(nums) + 1):\n if i < len(nums) and n < nums[i] or (i == len(nums) and n > nums[-1]):\n res.append(n)\n while i < len(nums) and n >= nums[i]:\n i += 1\nreturn res",
"if len(nums) < 2:\n return []\nresult = []\nfor i in range(len(nums)):\n ... | <|body_start_0|>
res = []
nums.sort()
i = 0
for n in range(1, len(nums) + 1):
if i < len(nums) and n < nums[i] or (i == len(nums) and n > nums[-1]):
res.append(n)
while i < len(nums) and n >= nums[i]:
i += 1
return res
<|end... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findDisappearedNumbers(self, nums):
""":type nums: List[int] :rtype: List[int]"""
<|body_0|>
def findDisappearedNumbers(self, nums):
""":type nums: List[int] :rtype: List[int]"""
<|body_1|>
def findDisappearedNumbers(self, nums):
""... | stack_v2_sparse_classes_75kplus_train_073885 | 1,946 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: List[int]",
"name": "findDisappearedNumbers",
"signature": "def findDisappearedNumbers(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: List[int]",
"name": "findDisappearedNumbers",
"signature": "def findDisappearedNumbers(self, ... | 3 | stack_v2_sparse_classes_30k_train_019521 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findDisappearedNumbers(self, nums): :type nums: List[int] :rtype: List[int]
- def findDisappearedNumbers(self, nums): :type nums: List[int] :rtype: List[int]
- def findDisapp... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findDisappearedNumbers(self, nums): :type nums: List[int] :rtype: List[int]
- def findDisappearedNumbers(self, nums): :type nums: List[int] :rtype: List[int]
- def findDisapp... | f3fc71f344cd758cfce77f16ab72992c99ab288e | <|skeleton|>
class Solution:
def findDisappearedNumbers(self, nums):
""":type nums: List[int] :rtype: List[int]"""
<|body_0|>
def findDisappearedNumbers(self, nums):
""":type nums: List[int] :rtype: List[int]"""
<|body_1|>
def findDisappearedNumbers(self, nums):
""... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def findDisappearedNumbers(self, nums):
""":type nums: List[int] :rtype: List[int]"""
res = []
nums.sort()
i = 0
for n in range(1, len(nums) + 1):
if i < len(nums) and n < nums[i] or (i == len(nums) and n > nums[-1]):
res.append(n)
... | the_stack_v2_python_sparse | 448_findDisappearedNumbers.py | jennyChing/leetCode | train | 2 | |
a5433244acc81c3157067d348b67f756b2caabaf | [
"command_name = 'verify_DCR_exists'\ncommand_to_run = 'sudo ls -l /etc/opt/microsoft/azuremonitoragent/config-cache/configchunks/'\nresult_keywords_array = ['.json']\ncommand_object = CommandVerification(command_name, command_to_run, result_keywords_array)\ncommand_object.run_full_test()\nif not command_object.is_s... | <|body_start_0|>
command_name = 'verify_DCR_exists'
command_to_run = 'sudo ls -l /etc/opt/microsoft/azuremonitoragent/config-cache/configchunks/'
result_keywords_array = ['.json']
command_object = CommandVerification(command_name, command_to_run, result_keywords_array)
command_ob... | This class is for data collection rules verifications | DCRConfigurationVerifications | [
"MIT",
"LicenseRef-scancode-generic-cla"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DCRConfigurationVerifications:
"""This class is for data collection rules verifications"""
def verify_dcr_exists(self):
"""Verifying there is at least one dcr on the machine"""
<|body_0|>
def verify_dcr_content_has_stream(self, dcr_stream):
"""Verifying there is ... | stack_v2_sparse_classes_75kplus_train_073886 | 45,720 | permissive | [
{
"docstring": "Verifying there is at least one dcr on the machine",
"name": "verify_dcr_exists",
"signature": "def verify_dcr_exists(self)"
},
{
"docstring": "Verifying there is a DCR on the machine for forwarding cef data",
"name": "verify_dcr_content_has_stream",
"signature": "def ver... | 5 | stack_v2_sparse_classes_30k_test_002092 | Implement the Python class `DCRConfigurationVerifications` described below.
Class description:
This class is for data collection rules verifications
Method signatures and docstrings:
- def verify_dcr_exists(self): Verifying there is at least one dcr on the machine
- def verify_dcr_content_has_stream(self, dcr_stream)... | Implement the Python class `DCRConfigurationVerifications` described below.
Class description:
This class is for data collection rules verifications
Method signatures and docstrings:
- def verify_dcr_exists(self): Verifying there is at least one dcr on the machine
- def verify_dcr_content_has_stream(self, dcr_stream)... | 4536a3f6b9bdef902312b3d96f9c2e66b8bf52c1 | <|skeleton|>
class DCRConfigurationVerifications:
"""This class is for data collection rules verifications"""
def verify_dcr_exists(self):
"""Verifying there is at least one dcr on the machine"""
<|body_0|>
def verify_dcr_content_has_stream(self, dcr_stream):
"""Verifying there is ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DCRConfigurationVerifications:
"""This class is for data collection rules verifications"""
def verify_dcr_exists(self):
"""Verifying there is at least one dcr on the machine"""
command_name = 'verify_DCR_exists'
command_to_run = 'sudo ls -l /etc/opt/microsoft/azuremonitoragent/con... | the_stack_v2_python_sparse | DataConnectors/Syslog/Sentinel_AMA_troubleshoot.py | Azure/Azure-Sentinel | train | 3,697 |
702ddad536355fcf9944274ee7c29131ef1fa966 | [
"res = []\nfor rec in self:\n rec_str = ''\n if rec.name:\n rec_str += str(rec.name)\n if rec.code:\n rec_str += rec.code\n res.append((rec.id, rec_str))\nreturn res",
"args += ['|', ('name', operator, name), ('code', operator, name)]\ncuur_ids = self.search(args, limit=limit)\nreturn cu... | <|body_start_0|>
res = []
for rec in self:
rec_str = ''
if rec.name:
rec_str += str(rec.name)
if rec.code:
rec_str += rec.code
res.append((rec.id, rec_str))
return res
<|end_body_0|>
<|body_start_1|>
args +=... | PropertyLabel | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PropertyLabel:
def name_get(self):
"""Added name_get for purpose of displaying name with code number. @param self: The object pointer"""
<|body_0|>
def name_search(self, name='', args=[], operator='ilike', limit=100):
"""Added name_search for purpose to search by nam... | stack_v2_sparse_classes_75kplus_train_073887 | 14,902 | no_license | [
{
"docstring": "Added name_get for purpose of displaying name with code number. @param self: The object pointer",
"name": "name_get",
"signature": "def name_get(self)"
},
{
"docstring": "Added name_search for purpose to search by name and code @param self: The object pointer.",
"name": "name... | 2 | null | Implement the Python class `PropertyLabel` described below.
Class description:
Implement the PropertyLabel class.
Method signatures and docstrings:
- def name_get(self): Added name_get for purpose of displaying name with code number. @param self: The object pointer
- def name_search(self, name='', args=[], operator='... | Implement the Python class `PropertyLabel` described below.
Class description:
Implement the PropertyLabel class.
Method signatures and docstrings:
- def name_get(self): Added name_get for purpose of displaying name with code number. @param self: The object pointer
- def name_search(self, name='', args=[], operator='... | 163136f382faa8607db8fb6cda42a5ba07c4076b | <|skeleton|>
class PropertyLabel:
def name_get(self):
"""Added name_get for purpose of displaying name with code number. @param self: The object pointer"""
<|body_0|>
def name_search(self, name='', args=[], operator='ilike', limit=100):
"""Added name_search for purpose to search by nam... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PropertyLabel:
def name_get(self):
"""Added name_get for purpose of displaying name with code number. @param self: The object pointer"""
res = []
for rec in self:
rec_str = ''
if rec.name:
rec_str += str(rec.name)
if rec.code:
... | the_stack_v2_python_sparse | property_booking_ee/models/property_booking.py | maarejsys/Roya | train | 0 | |
01b529747572ce667f41cdc1235538238378875b | [
"def generate(left: int, right: int) -> List[TreeNode]:\n if left > right:\n return [None]\n all_trees = []\n for i in range(left, right + 1):\n left_trees = generate(left, i - 1)\n right_trees = generate(i + 1, right)\n for l in left_trees:\n for r in right_trees:\n ... | <|body_start_0|>
def generate(left: int, right: int) -> List[TreeNode]:
if left > right:
return [None]
all_trees = []
for i in range(left, right + 1):
left_trees = generate(left, i - 1)
right_trees = generate(i + 1, right)
... | Trees | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Trees:
def generate_trees(self, n: int) -> List[TreeNode]:
"""Approach: Recursion Time Complexity: O(4^n / n ^ 1/2) Space Complexity: O(4^n / n ^ 1/2) :param n: :return:"""
<|body_0|>
def number_of_unique_bst(self, n: int) -> int:
"""Approach: DP Time Complexity: O(n... | stack_v2_sparse_classes_75kplus_train_073888 | 1,974 | no_license | [
{
"docstring": "Approach: Recursion Time Complexity: O(4^n / n ^ 1/2) Space Complexity: O(4^n / n ^ 1/2) :param n: :return:",
"name": "generate_trees",
"signature": "def generate_trees(self, n: int) -> List[TreeNode]"
},
{
"docstring": "Approach: DP Time Complexity: O(n^2) Space Complexity: O(n)... | 3 | null | Implement the Python class `Trees` described below.
Class description:
Implement the Trees class.
Method signatures and docstrings:
- def generate_trees(self, n: int) -> List[TreeNode]: Approach: Recursion Time Complexity: O(4^n / n ^ 1/2) Space Complexity: O(4^n / n ^ 1/2) :param n: :return:
- def number_of_unique_b... | Implement the Python class `Trees` described below.
Class description:
Implement the Trees class.
Method signatures and docstrings:
- def generate_trees(self, n: int) -> List[TreeNode]: Approach: Recursion Time Complexity: O(4^n / n ^ 1/2) Space Complexity: O(4^n / n ^ 1/2) :param n: :return:
- def number_of_unique_b... | 65cc78b5afa0db064f9fe8f06597e3e120f7363d | <|skeleton|>
class Trees:
def generate_trees(self, n: int) -> List[TreeNode]:
"""Approach: Recursion Time Complexity: O(4^n / n ^ 1/2) Space Complexity: O(4^n / n ^ 1/2) :param n: :return:"""
<|body_0|>
def number_of_unique_bst(self, n: int) -> int:
"""Approach: DP Time Complexity: O(n... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Trees:
def generate_trees(self, n: int) -> List[TreeNode]:
"""Approach: Recursion Time Complexity: O(4^n / n ^ 1/2) Space Complexity: O(4^n / n ^ 1/2) :param n: :return:"""
def generate(left: int, right: int) -> List[TreeNode]:
if left > right:
return [None]
... | the_stack_v2_python_sparse | data_structures/tree_node/generate_trees.py | Shiv2157k/leet_code | train | 1 | |
2fa02e22cf153bb1a0507e03eb8ea7c0fc044477 | [
"url = 'https://service.post.ch/EasyTrack/submitParcelData.do'\nurl += '?formattedParcelCodes={}'.format(';'.join(numbers))\nurl += '&p_language={}'.format(TRACK_TRACE_LANGUAGE)\nfh = urlopen(url)\nhtml = fh.read()\nfh.close()\nreturn html",
"parser = BeautifulSoup(html, 'html.parser')\nresult = parser.body.find(... | <|body_start_0|>
url = 'https://service.post.ch/EasyTrack/submitParcelData.do'
url += '?formattedParcelCodes={}'.format(';'.join(numbers))
url += '&p_language={}'.format(TRACK_TRACE_LANGUAGE)
fh = urlopen(url)
html = fh.read()
fh.close()
return html
<|end_body_0|>... | Track & Trace class for post.ch. | TrackAndTrace | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TrackAndTrace:
"""Track & Trace class for post.ch."""
def request(cls, numbers):
"""Sends the HTTP request to the post.ch Track & Trace site."""
<|body_0|>
def parse(cls, html):
"""Parses the received HTML content from the post.ch Track & Trace site and returns t... | stack_v2_sparse_classes_75kplus_train_073889 | 2,497 | no_license | [
{
"docstring": "Sends the HTTP request to the post.ch Track & Trace site.",
"name": "request",
"signature": "def request(cls, numbers)"
},
{
"docstring": "Parses the received HTML content from the post.ch Track & Trace site and returns the shipping numbers and status in an ordered dict.",
"n... | 3 | stack_v2_sparse_classes_30k_train_043652 | Implement the Python class `TrackAndTrace` described below.
Class description:
Track & Trace class for post.ch.
Method signatures and docstrings:
- def request(cls, numbers): Sends the HTTP request to the post.ch Track & Trace site.
- def parse(cls, html): Parses the received HTML content from the post.ch Track & Tra... | Implement the Python class `TrackAndTrace` described below.
Class description:
Track & Trace class for post.ch.
Method signatures and docstrings:
- def request(cls, numbers): Sends the HTTP request to the post.ch Track & Trace site.
- def parse(cls, html): Parses the received HTML content from the post.ch Track & Tra... | 79e5057a43abe855d49b93b3d1b4e834be45edf5 | <|skeleton|>
class TrackAndTrace:
"""Track & Trace class for post.ch."""
def request(cls, numbers):
"""Sends the HTTP request to the post.ch Track & Trace site."""
<|body_0|>
def parse(cls, html):
"""Parses the received HTML content from the post.ch Track & Trace site and returns t... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TrackAndTrace:
"""Track & Trace class for post.ch."""
def request(cls, numbers):
"""Sends the HTTP request to the post.ch Track & Trace site."""
url = 'https://service.post.ch/EasyTrack/submitParcelData.do'
url += '?formattedParcelCodes={}'.format(';'.join(numbers))
url +=... | the_stack_v2_python_sparse | toolbox/ordertracking/post.py | domibarton/toolbox | train | 0 |
78db134fffac10f1e3c757a6506cbf1135214a5f | [
"rawline = self.file.readline()\nwhile rawline:\n rematch = self.line_re.match(rawline)\n if not rematch:\n rawline = self.file.readline()\n continue\n while rematch:\n rep = Replica()\n self.reps.append(rep)\n rep.index = [0 for i in range(self.numexchg)]\n rep.pr... | <|body_start_0|>
rawline = self.file.readline()
while rawline:
rematch = self.line_re.match(rawline)
if not rematch:
rawline = self.file.readline()
continue
while rematch:
rep = Replica()
self.reps.append... | A class for a rem.log file in pH exchange | pHRemLog | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class pHRemLog:
"""A class for a rem.log file in pH exchange"""
def _get_replicas(self):
"""Gets all of the replica information from the first block of repinfo"""
<|body_0|>
def _parse(self):
"""Parses the rem.log file and loads the data arrays"""
<|body_1|>
<... | stack_v2_sparse_classes_75kplus_train_073890 | 12,296 | no_license | [
{
"docstring": "Gets all of the replica information from the first block of repinfo",
"name": "_get_replicas",
"signature": "def _get_replicas(self)"
},
{
"docstring": "Parses the rem.log file and loads the data arrays",
"name": "_parse",
"signature": "def _parse(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_017961 | Implement the Python class `pHRemLog` described below.
Class description:
A class for a rem.log file in pH exchange
Method signatures and docstrings:
- def _get_replicas(self): Gets all of the replica information from the first block of repinfo
- def _parse(self): Parses the rem.log file and loads the data arrays | Implement the Python class `pHRemLog` described below.
Class description:
A class for a rem.log file in pH exchange
Method signatures and docstrings:
- def _get_replicas(self): Gets all of the replica information from the first block of repinfo
- def _parse(self): Parses the rem.log file and loads the data arrays
<|... | 5cec8112637be7a19c4aac893f612aa8c354b733 | <|skeleton|>
class pHRemLog:
"""A class for a rem.log file in pH exchange"""
def _get_replicas(self):
"""Gets all of the replica information from the first block of repinfo"""
<|body_0|>
def _parse(self):
"""Parses the rem.log file and loads the data arrays"""
<|body_1|>
<... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class pHRemLog:
"""A class for a rem.log file in pH exchange"""
def _get_replicas(self):
"""Gets all of the replica information from the first block of repinfo"""
rawline = self.file.readline()
while rawline:
rematch = self.line_re.match(rawline)
if not rematch:
... | the_stack_v2_python_sparse | remd.py | jeff-wang/JmsScripts | train | 0 |
78409fe5c067cdbd71a448c327ac37ae2639b1c8 | [
"try:\n if self.TRACEPARENT_REGEX.match(traceparent):\n return traceparent\nexcept Exception:\n logger.debug('traceparent does not follow version {} specification'.format(self.SPECIFICATION_VERSION))\nreturn None",
"try:\n traceparent_properties = traceparent.split('-')\n version = traceparent_... | <|body_start_0|>
try:
if self.TRACEPARENT_REGEX.match(traceparent):
return traceparent
except Exception:
logger.debug('traceparent does not follow version {} specification'.format(self.SPECIFICATION_VERSION))
return None
<|end_body_0|>
<|body_start_1|>
... | Traceparent | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Traceparent:
def validate(self, traceparent):
"""Method used to validate the traceparent header :param traceparent: string :return: traceparent or None"""
<|body_0|>
def get_traceparent_fields(traceparent):
"""Parses the validated traceparent header into its fields a... | stack_v2_sparse_classes_75kplus_train_073891 | 4,102 | permissive | [
{
"docstring": "Method used to validate the traceparent header :param traceparent: string :return: traceparent or None",
"name": "validate",
"signature": "def validate(self, traceparent)"
},
{
"docstring": "Parses the validated traceparent header into its fields and returns the fields :param tra... | 3 | stack_v2_sparse_classes_30k_train_005100 | Implement the Python class `Traceparent` described below.
Class description:
Implement the Traceparent class.
Method signatures and docstrings:
- def validate(self, traceparent): Method used to validate the traceparent header :param traceparent: string :return: traceparent or None
- def get_traceparent_fields(tracepa... | Implement the Python class `Traceparent` described below.
Class description:
Implement the Traceparent class.
Method signatures and docstrings:
- def validate(self, traceparent): Method used to validate the traceparent header :param traceparent: string :return: traceparent or None
- def get_traceparent_fields(tracepa... | 4b2d90baf67db3b923c23564590dabe89a0e41d2 | <|skeleton|>
class Traceparent:
def validate(self, traceparent):
"""Method used to validate the traceparent header :param traceparent: string :return: traceparent or None"""
<|body_0|>
def get_traceparent_fields(traceparent):
"""Parses the validated traceparent header into its fields a... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Traceparent:
def validate(self, traceparent):
"""Method used to validate the traceparent header :param traceparent: string :return: traceparent or None"""
try:
if self.TRACEPARENT_REGEX.match(traceparent):
return traceparent
except Exception:
log... | the_stack_v2_python_sparse | instana/w3c_trace_context/traceparent.py | instana/python-sensor | train | 69 | |
43f4401333a2c6925e613b0fb2670df654547cc2 | [
"self.offer_listing_id = offer_listing_id\nself.price = price\nself.sale_price = sale_price\nself.amount_saved = amount_saved\nself.percentage_saved = percentage_saved\nself.availability = availability\nself.availability_attributes = availability_attributes\nself.is_eligible_for_super_saver_shipping = is_eligible_f... | <|body_start_0|>
self.offer_listing_id = offer_listing_id
self.price = price
self.sale_price = sale_price
self.amount_saved = amount_saved
self.percentage_saved = percentage_saved
self.availability = availability
self.availability_attributes = availability_attribu... | Implementation of the 'OfferListing' model. TODO: type model description here. Attributes: offer_listing_id (string): TODO: type description here. price (Price): TODO: type description here. sale_price (Price): TODO: type description here. amount_saved (Price): TODO: type description here. percentage_saved (int): TODO:... | OfferListing | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OfferListing:
"""Implementation of the 'OfferListing' model. TODO: type model description here. Attributes: offer_listing_id (string): TODO: type description here. price (Price): TODO: type description here. sale_price (Price): TODO: type description here. amount_saved (Price): TODO: type descrip... | stack_v2_sparse_classes_75kplus_train_073892 | 4,415 | permissive | [
{
"docstring": "Constructor for the OfferListing class",
"name": "__init__",
"signature": "def __init__(self, offer_listing_id=None, price=None, sale_price=None, amount_saved=None, percentage_saved=None, availability=None, availability_attributes=None, is_eligible_for_super_saver_shipping=None, is_eligi... | 2 | stack_v2_sparse_classes_30k_train_005938 | Implement the Python class `OfferListing` described below.
Class description:
Implementation of the 'OfferListing' model. TODO: type model description here. Attributes: offer_listing_id (string): TODO: type description here. price (Price): TODO: type description here. sale_price (Price): TODO: type description here. a... | Implement the Python class `OfferListing` described below.
Class description:
Implementation of the 'OfferListing' model. TODO: type model description here. Attributes: offer_listing_id (string): TODO: type description here. price (Price): TODO: type description here. sale_price (Price): TODO: type description here. a... | 26ea1019115a1de3b1b37a4b830525e164ac55ce | <|skeleton|>
class OfferListing:
"""Implementation of the 'OfferListing' model. TODO: type model description here. Attributes: offer_listing_id (string): TODO: type description here. price (Price): TODO: type description here. sale_price (Price): TODO: type description here. amount_saved (Price): TODO: type descrip... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class OfferListing:
"""Implementation of the 'OfferListing' model. TODO: type model description here. Attributes: offer_listing_id (string): TODO: type description here. price (Price): TODO: type description here. sale_price (Price): TODO: type description here. amount_saved (Price): TODO: type description here. pe... | the_stack_v2_python_sparse | awsecommerceservice/models/offer_listing.py | nidaizamir/Test-PY | train | 0 |
e263caa2ed8806b2af639fcddb7a76c863913e60 | [
"self.name = 'my.unique.xform.object.name'\nlogging.debug('{0} __init___...'.format(self.name))\nself.config = config\nself.tags = tags\nself.inputKinds = []\nself.outputKinds = ['fashion.core.generate.jinja2.spec']",
"logging.debug('{0} executing...'.format(self.name))\nmodel = {}\ntemplate = '{{ template }}'\nt... | <|body_start_0|>
self.name = 'my.unique.xform.object.name'
logging.debug('{0} __init___...'.format(self.name))
self.config = config
self.tags = tags
self.inputKinds = []
self.outputKinds = ['fashion.core.generate.jinja2.spec']
<|end_body_0|>
<|body_start_1|>
logg... | MyXform object. | MyXform | [
"Apache-2.0",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MyXform:
"""MyXform object."""
def __init__(self, config, mdb, verbose, tags):
"""Constructor, called from init(...) above. :param config: is the xformConfig object from the segment file. :param mdb: is a ModelAccess object, where inputKinds, outputKinds, templatePath, etc. are from ... | stack_v2_sparse_classes_75kplus_train_073893 | 2,743 | permissive | [
{
"docstring": "Constructor, called from init(...) above. :param config: is the xformConfig object from the segment file. :param mdb: is a ModelAccess object, where inputKinds, outputKinds, templatePath, etc. are from the xformConfig object. :param tags: is a list of tags specified at init time, which might alt... | 2 | null | Implement the Python class `MyXform` described below.
Class description:
MyXform object.
Method signatures and docstrings:
- def __init__(self, config, mdb, verbose, tags): Constructor, called from init(...) above. :param config: is the xformConfig object from the segment file. :param mdb: is a ModelAccess object, wh... | Implement the Python class `MyXform` described below.
Class description:
MyXform object.
Method signatures and docstrings:
- def __init__(self, config, mdb, verbose, tags): Constructor, called from init(...) above. :param config: is the xformConfig object from the segment file. :param mdb: is a ModelAccess object, wh... | 2588f3712a72e81f3cb7733e40b6c3751aa5ece2 | <|skeleton|>
class MyXform:
"""MyXform object."""
def __init__(self, config, mdb, verbose, tags):
"""Constructor, called from init(...) above. :param config: is the xformConfig object from the segment file. :param mdb: is a ModelAccess object, where inputKinds, outputKinds, templatePath, etc. are from ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MyXform:
"""MyXform object."""
def __init__(self, config, mdb, verbose, tags):
"""Constructor, called from init(...) above. :param config: is the xformConfig object from the segment file. :param mdb: is a ModelAccess object, where inputKinds, outputKinds, templatePath, etc. are from the xformConf... | the_stack_v2_python_sparse | fashion/warehouse/fashion.core/template/defaultNabXformTemplate.py | braddillman/fashion | train | 1 |
dfff576e1390d0e048d4a18d5a710aa7c3d7f386 | [
"bad_params = [param for param in query if param not in QUERY_PARAMETERS]\nif bad_params:\n raise InvalidQueryError(f\"parameter{('s' if len(bad_params) > 1 else '')} {', '.join(bad_params)} {('are' if len(bad_params) > 1 else 'is')} invalid. For a description of valid query parameters see http://svo2.cab.inta-c... | <|body_start_0|>
bad_params = [param for param in query if param not in QUERY_PARAMETERS]
if bad_params:
raise InvalidQueryError(f"parameter{('s' if len(bad_params) > 1 else '')} {', '.join(bad_params)} {('are' if len(bad_params) > 1 else 'is')} invalid. For a description of valid query para... | Class for querying the Spanish Virtual Observatory filter profile service | SvoFpsClass | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SvoFpsClass:
"""Class for querying the Spanish Virtual Observatory filter profile service"""
def data_from_svo(self, query, *, cache=True, timeout=None, error_msg='No data found for requested query'):
"""Get data in response to the query send to SVO FPS. This method is not generally ... | stack_v2_sparse_classes_75kplus_train_073894 | 6,490 | permissive | [
{
"docstring": "Get data in response to the query send to SVO FPS. This method is not generally intended for users, but it can be helpful if you want something very specific from the SVO FPS service. If you don't know what you're doing, try `get_filter_index`, `get_filter_list`, and `get_transmission_data` inst... | 4 | null | Implement the Python class `SvoFpsClass` described below.
Class description:
Class for querying the Spanish Virtual Observatory filter profile service
Method signatures and docstrings:
- def data_from_svo(self, query, *, cache=True, timeout=None, error_msg='No data found for requested query'): Get data in response to... | Implement the Python class `SvoFpsClass` described below.
Class description:
Class for querying the Spanish Virtual Observatory filter profile service
Method signatures and docstrings:
- def data_from_svo(self, query, *, cache=True, timeout=None, error_msg='No data found for requested query'): Get data in response to... | 51316d7417d7daf01a8b29d1df99037b9227c2bc | <|skeleton|>
class SvoFpsClass:
"""Class for querying the Spanish Virtual Observatory filter profile service"""
def data_from_svo(self, query, *, cache=True, timeout=None, error_msg='No data found for requested query'):
"""Get data in response to the query send to SVO FPS. This method is not generally ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SvoFpsClass:
"""Class for querying the Spanish Virtual Observatory filter profile service"""
def data_from_svo(self, query, *, cache=True, timeout=None, error_msg='No data found for requested query'):
"""Get data in response to the query send to SVO FPS. This method is not generally intended for ... | the_stack_v2_python_sparse | astroquery/svo_fps/core.py | astropy/astroquery | train | 636 |
66730ac42d50807b439609c771bd8605a60eca23 | [
"try:\n return self.find_elem('input[name=\"' + self.comp_name + '\"] + div')\nexcept Exception as ex:\n print('调查问卷获取div异常:%s' % ex)\n return 'none'",
"try:\n return self.get_the_div().text\nexcept Exception as ex:\n print('调查问卷获取内容异常:%s' % ex)\n return ''",
"try:\n the_div = self.get_the_... | <|body_start_0|>
try:
return self.find_elem('input[name="' + self.comp_name + '"] + div')
except Exception as ex:
print('调查问卷获取div异常:%s' % ex)
return 'none'
<|end_body_0|>
<|body_start_1|>
try:
return self.get_the_div().text
except Excepti... | SuperSurveyPage | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SuperSurveyPage:
def get_the_div(self):
"""获取the div"""
<|body_0|>
def get_the_div_text(self):
"""获取the div 内容"""
<|body_1|>
def the_check_is_enabled(self):
"""复选框是否只读"""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>
try:
... | stack_v2_sparse_classes_75kplus_train_073895 | 1,780 | no_license | [
{
"docstring": "获取the div",
"name": "get_the_div",
"signature": "def get_the_div(self)"
},
{
"docstring": "获取the div 内容",
"name": "get_the_div_text",
"signature": "def get_the_div_text(self)"
},
{
"docstring": "复选框是否只读",
"name": "the_check_is_enabled",
"signature": "def t... | 3 | stack_v2_sparse_classes_30k_train_052610 | Implement the Python class `SuperSurveyPage` described below.
Class description:
Implement the SuperSurveyPage class.
Method signatures and docstrings:
- def get_the_div(self): 获取the div
- def get_the_div_text(self): 获取the div 内容
- def the_check_is_enabled(self): 复选框是否只读 | Implement the Python class `SuperSurveyPage` described below.
Class description:
Implement the SuperSurveyPage class.
Method signatures and docstrings:
- def get_the_div(self): 获取the div
- def get_the_div_text(self): 获取the div 内容
- def the_check_is_enabled(self): 复选框是否只读
<|skeleton|>
class SuperSurveyPage:
def ... | 78768989a79a14013b983024cf6e4838d51ed595 | <|skeleton|>
class SuperSurveyPage:
def get_the_div(self):
"""获取the div"""
<|body_0|>
def get_the_div_text(self):
"""获取the div 内容"""
<|body_1|>
def the_check_is_enabled(self):
"""复选框是否只读"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SuperSurveyPage:
def get_the_div(self):
"""获取the div"""
try:
return self.find_elem('input[name="' + self.comp_name + '"] + div')
except Exception as ex:
print('调查问卷获取div异常:%s' % ex)
return 'none'
def get_the_div_text(self):
"""获取the div ... | the_stack_v2_python_sparse | test_case/page_obj/form/survey_page.py | pylk/pythonSelenium | train | 0 | |
b571df4713bca6425bbacd1cec81705812de801b | [
"if self.current_user is None:\n return\ntry:\n role_id = int(role_id)\nexcept ValueError:\n self.set_status(400, 'Parameter must be an integer')\ntry:\n role = self.api_endpoint.role_by_id(role_id)\nexcept ZoeException as e:\n self.set_status(e.status_code, e.message)\n return\nret = {'role': rol... | <|body_start_0|>
if self.current_user is None:
return
try:
role_id = int(role_id)
except ValueError:
self.set_status(400, 'Parameter must be an integer')
try:
role = self.api_endpoint.role_by_id(role_id)
except ZoeException as e:
... | The Role API endpoint. Ops on a single role. | RoleAPI | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RoleAPI:
"""The Role API endpoint. Ops on a single role."""
def get(self, role_id):
"""HTTP GET method."""
<|body_0|>
def post(self, role_id):
"""HTTP POST method, to edit a role."""
<|body_1|>
def delete(self, role_id: int):
"""HTTP DELETE m... | stack_v2_sparse_classes_75kplus_train_073896 | 4,210 | permissive | [
{
"docstring": "HTTP GET method.",
"name": "get",
"signature": "def get(self, role_id)"
},
{
"docstring": "HTTP POST method, to edit a role.",
"name": "post",
"signature": "def post(self, role_id)"
},
{
"docstring": "HTTP DELETE method.",
"name": "delete",
"signature": "d... | 3 | null | Implement the Python class `RoleAPI` described below.
Class description:
The Role API endpoint. Ops on a single role.
Method signatures and docstrings:
- def get(self, role_id): HTTP GET method.
- def post(self, role_id): HTTP POST method, to edit a role.
- def delete(self, role_id: int): HTTP DELETE method. | Implement the Python class `RoleAPI` described below.
Class description:
The Role API endpoint. Ops on a single role.
Method signatures and docstrings:
- def get(self, role_id): HTTP GET method.
- def post(self, role_id): HTTP POST method, to edit a role.
- def delete(self, role_id: int): HTTP DELETE method.
<|skele... | c8e0c908af1954a8b41d0f6de23d08589564f0ab | <|skeleton|>
class RoleAPI:
"""The Role API endpoint. Ops on a single role."""
def get(self, role_id):
"""HTTP GET method."""
<|body_0|>
def post(self, role_id):
"""HTTP POST method, to edit a role."""
<|body_1|>
def delete(self, role_id: int):
"""HTTP DELETE m... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RoleAPI:
"""The Role API endpoint. Ops on a single role."""
def get(self, role_id):
"""HTTP GET method."""
if self.current_user is None:
return
try:
role_id = int(role_id)
except ValueError:
self.set_status(400, 'Parameter must be an int... | the_stack_v2_python_sparse | zoe_api/rest_api/role.py | DistributedSystemsGroup/zoe | train | 60 |
e5c29bae50d7d74e28ecdf98fd623de321ccfafe | [
"parser.add_argument('--batch_size', nargs='?', type=int, default=64, help='batch_size for experiment')\nparser.add_argument('--epochs', type=int, nargs='?', default=100, help='Number of epochs to train for')\nparser.add_argument('--logs_path', type=str, nargs='?', default='classification_logs/', help='Experiment l... | <|body_start_0|>
parser.add_argument('--batch_size', nargs='?', type=int, default=64, help='batch_size for experiment')
parser.add_argument('--epochs', type=int, nargs='?', default=100, help='Number of epochs to train for')
parser.add_argument('--logs_path', type=str, nargs='?', default='classif... | ParserClass | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ParserClass:
def __init__(self, parser):
"""Parses arguments and saves them in the Parser Class :param parser: A parser to get input from"""
<|body_0|>
def get_argument_variables(self):
"""Processes the parsed arguments and produces variables of specific types needed... | stack_v2_sparse_classes_75kplus_train_073897 | 5,172 | permissive | [
{
"docstring": "Parses arguments and saves them in the Parser Class :param parser: A parser to get input from",
"name": "__init__",
"signature": "def __init__(self, parser)"
},
{
"docstring": "Processes the parsed arguments and produces variables of specific types needed for the experiments :ret... | 2 | stack_v2_sparse_classes_30k_train_026090 | Implement the Python class `ParserClass` described below.
Class description:
Implement the ParserClass class.
Method signatures and docstrings:
- def __init__(self, parser): Parses arguments and saves them in the Parser Class :param parser: A parser to get input from
- def get_argument_variables(self): Processes the ... | Implement the Python class `ParserClass` described below.
Class description:
Implement the ParserClass class.
Method signatures and docstrings:
- def __init__(self, parser): Parses arguments and saves them in the Parser Class :param parser: A parser to get input from
- def get_argument_variables(self): Processes the ... | 2831df3ef210cb3e259bbc43dd39159533f4a33e | <|skeleton|>
class ParserClass:
def __init__(self, parser):
"""Parses arguments and saves them in the Parser Class :param parser: A parser to get input from"""
<|body_0|>
def get_argument_variables(self):
"""Processes the parsed arguments and produces variables of specific types needed... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ParserClass:
def __init__(self, parser):
"""Parses arguments and saves them in the Parser Class :param parser: A parser to get input from"""
parser.add_argument('--batch_size', nargs='?', type=int, default=64, help='batch_size for experiment')
parser.add_argument('--epochs', type=int, ... | the_stack_v2_python_sparse | utils/parser_utils.py | comRamona/ACL-2018-Multimodal-Sentiment-Analysis-Multicomp | train | 0 | |
e077ba9a9fb0b7374ac35e2a6b6da7626b897fc4 | [
"num_samples = 1000\ntheta, sigma = (0.1, 0.2)\nou = common.ornstein_uhlenbeck_process(tf.zeros([10]), damping=theta, stddev=sigma)\nsamples = np.ndarray([num_samples, 10])\nself.evaluate(tf.compat.v1.global_variables_initializer())\nfor i in range(num_samples):\n samples[i] = self.evaluate(ou)\ndiffs = np.ndarr... | <|body_start_0|>
num_samples = 1000
theta, sigma = (0.1, 0.2)
ou = common.ornstein_uhlenbeck_process(tf.zeros([10]), damping=theta, stddev=sigma)
samples = np.ndarray([num_samples, 10])
self.evaluate(tf.compat.v1.global_variables_initializer())
for i in range(num_samples)... | OrnsteinUhlenbeckSamplesTest | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OrnsteinUhlenbeckSamplesTest:
def testSamples(self):
"""Tests that samples follow Ornstein-Uhlenbeck process. This is done by checking that the successive differences `x_next - (1-theta) * x` have the expected mean and variance."""
<|body_0|>
def testMultipleSamples(self):
... | stack_v2_sparse_classes_75kplus_train_073898 | 42,533 | permissive | [
{
"docstring": "Tests that samples follow Ornstein-Uhlenbeck process. This is done by checking that the successive differences `x_next - (1-theta) * x` have the expected mean and variance.",
"name": "testSamples",
"signature": "def testSamples(self)"
},
{
"docstring": "Tests that creates differe... | 2 | stack_v2_sparse_classes_30k_train_018909 | Implement the Python class `OrnsteinUhlenbeckSamplesTest` described below.
Class description:
Implement the OrnsteinUhlenbeckSamplesTest class.
Method signatures and docstrings:
- def testSamples(self): Tests that samples follow Ornstein-Uhlenbeck process. This is done by checking that the successive differences `x_n... | Implement the Python class `OrnsteinUhlenbeckSamplesTest` described below.
Class description:
Implement the OrnsteinUhlenbeckSamplesTest class.
Method signatures and docstrings:
- def testSamples(self): Tests that samples follow Ornstein-Uhlenbeck process. This is done by checking that the successive differences `x_n... | eca1093d3a047e538f17f6ab92ab4d8144284f23 | <|skeleton|>
class OrnsteinUhlenbeckSamplesTest:
def testSamples(self):
"""Tests that samples follow Ornstein-Uhlenbeck process. This is done by checking that the successive differences `x_next - (1-theta) * x` have the expected mean and variance."""
<|body_0|>
def testMultipleSamples(self):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class OrnsteinUhlenbeckSamplesTest:
def testSamples(self):
"""Tests that samples follow Ornstein-Uhlenbeck process. This is done by checking that the successive differences `x_next - (1-theta) * x` have the expected mean and variance."""
num_samples = 1000
theta, sigma = (0.1, 0.2)
o... | the_stack_v2_python_sparse | tf_agents/utils/common_test.py | tensorflow/agents | train | 2,755 | |
8cd089e5fe8ac3149330de8c17073ee2b4a187c4 | [
"super(UnaryTransformation, self).__init__(operator, inner_expression)\nself.operator = operator\nself.inner_expression = inner_expression",
"_validate_operator_name(self.operator, UnaryTransformation.SUPPORTED_OPERATORS)\nif not isinstance(self.inner_expression, Expression):\n raise TypeError(u'Expected Expre... | <|body_start_0|>
super(UnaryTransformation, self).__init__(operator, inner_expression)
self.operator = operator
self.inner_expression = inner_expression
<|end_body_0|>
<|body_start_1|>
_validate_operator_name(self.operator, UnaryTransformation.SUPPORTED_OPERATORS)
if not isinsta... | An expression that modifies an underlying expression with a unary operator. | UnaryTransformation | [
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UnaryTransformation:
"""An expression that modifies an underlying expression with a unary operator."""
def __init__(self, operator, inner_expression):
"""Construct a UnaryExpression that modifies the given inner expression."""
<|body_0|>
def validate(self):
"""Va... | stack_v2_sparse_classes_75kplus_train_073899 | 41,432 | permissive | [
{
"docstring": "Construct a UnaryExpression that modifies the given inner expression.",
"name": "__init__",
"signature": "def __init__(self, operator, inner_expression)"
},
{
"docstring": "Validate that the UnaryTransformation is correctly representable.",
"name": "validate",
"signature"... | 5 | stack_v2_sparse_classes_30k_train_047920 | Implement the Python class `UnaryTransformation` described below.
Class description:
An expression that modifies an underlying expression with a unary operator.
Method signatures and docstrings:
- def __init__(self, operator, inner_expression): Construct a UnaryExpression that modifies the given inner expression.
- d... | Implement the Python class `UnaryTransformation` described below.
Class description:
An expression that modifies an underlying expression with a unary operator.
Method signatures and docstrings:
- def __init__(self, operator, inner_expression): Construct a UnaryExpression that modifies the given inner expression.
- d... | 4511793281698bd55e63fd7a3f25f9cb094084d4 | <|skeleton|>
class UnaryTransformation:
"""An expression that modifies an underlying expression with a unary operator."""
def __init__(self, operator, inner_expression):
"""Construct a UnaryExpression that modifies the given inner expression."""
<|body_0|>
def validate(self):
"""Va... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class UnaryTransformation:
"""An expression that modifies an underlying expression with a unary operator."""
def __init__(self, operator, inner_expression):
"""Construct a UnaryExpression that modifies the given inner expression."""
super(UnaryTransformation, self).__init__(operator, inner_expr... | the_stack_v2_python_sparse | graphql_compiler/compiler/expressions.py | jb-kensho/graphql-compiler | train | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.